From 49f2d7ce15bcbda133440a1687569a80328aa44f Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Sat, 11 Nov 2017 21:18:26 -0500 Subject: [PATCH 01/90] Trying to make strictFunctionTypes work (#21206). Wrapper assignability is fixed, but tests are failing due to GC error. --- types/lodash/index.d.ts | 12 ++++++++---- types/lodash/tsconfig.json | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index f038846d22..fafa7f6b5c 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -10723,7 +10723,7 @@ declare namespace _ { /** * @see _.toArray */ - toArray(): LoDashImplicitWrapper>; + //toArray(): LoDashImplicitWrapper>; } interface LoDashExplicitWrapper { @@ -10735,7 +10735,7 @@ declare namespace _ { /** * @see _.toArray */ - toArray(): LoDashExplicitWrapper>; + //toArray(): LoDashExplicitWrapper>; } //_.toPlainObject @@ -16078,14 +16078,18 @@ declare namespace _ { /** * @see _.constant */ - constant(): LoDashImplicitWrapper<() => TValue>; + constant(this: LoDashImplicitWrapper): LoDashImplicitWrapper<() => T>; + // Note: we can't use TValue here because of an issue with dtslint. Using T as a workaround; change back to TValue once dtsLint is working. + // constant(): LoDashImplicitWrapper<() => TValue>; } interface LoDashExplicitWrapper { /** * @see _.constant */ - constant(): LoDashExplicitWrapper<() => TValue>; + constant(this: LoDashExplicitWrapper): LoDashExplicitWrapper<() => T>; + // Note: we can't use TValue here because of an issue with dtslint. Using T as a workaround; change back to TValue once dtsLint is working. + // constant(): LoDashExplicitWrapper<() => TValue>; } //_.defaultTo diff --git a/types/lodash/tsconfig.json b/types/lodash/tsconfig.json index 2c4aa57c54..8bd56c0b87 100644 --- a/types/lodash/tsconfig.json +++ b/types/lodash/tsconfig.json @@ -7,7 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "strictFunctionTypes": false, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 1424fbdf299fc193c016675e1201b4d27cd806bf Mon Sep 17 00:00:00 2001 From: Romke van der Meulen Date: Mon, 13 Nov 2017 11:23:28 +0100 Subject: [PATCH 02/90] [cucumber] replace StepDefinitionParam with any Fixes #19831. --- types/cucumber/index.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/types/cucumber/index.d.ts b/types/cucumber/index.d.ts index d72b3ee4ac..6ffb26ddb8 100644 --- a/types/cucumber/index.d.ts +++ b/types/cucumber/index.d.ts @@ -23,9 +23,7 @@ export interface TableDefinition { hashes(): Array<{ [colName: string]: string }>; } -export type StepDefinitionParam = string | number | CallbackStepDefinition | TableDefinition; - -export type StepDefinitionCode = (this: World, ...stepArgs: StepDefinitionParam[]) => PromiseLike | any | void; +export type StepDefinitionCode = (this: World, ...stepArgs: any[]) => PromiseLike | any | void; export interface StepDefinitionOptions { timeout?: number; From d0250af00770578f71d9867566eef567adcd5acf Mon Sep 17 00:00:00 2001 From: Romke van der Meulen Date: Mon, 13 Nov 2017 11:30:06 +0100 Subject: [PATCH 03/90] [cucumber] bump version number --- types/cucumber/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/cucumber/index.d.ts b/types/cucumber/index.d.ts index 6ffb26ddb8..5d406ffeaa 100644 --- a/types/cucumber/index.d.ts +++ b/types/cucumber/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cucumber-js 2.0 +// Type definitions for cucumber-js 2.1 // Project: https://github.com/cucumber/cucumber-js // Definitions by: Abraão Alves // Jan Molak From c8196d8e753f9e8d9bce2bfac827ef4519bd1327 Mon Sep 17 00:00:00 2001 From: Yu-Hsin Lu Date: Mon, 13 Nov 2017 18:49:02 +0800 Subject: [PATCH 04/90] Add data field to CheerioElement --- types/cheerio/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/cheerio/index.d.ts b/types/cheerio/index.d.ts index 511fce354d..7ea8360849 100644 --- a/types/cheerio/index.d.ts +++ b/types/cheerio/index.d.ts @@ -263,6 +263,7 @@ interface CheerioElement { parent: CheerioElement; parentNode: CheerioElement; nodeValue: string; + data: string; } interface CheerioAPI extends CheerioSelector, CheerioStatic { From aa615ebb7eb9b243d7d1eec9667844a9ac48c071 Mon Sep 17 00:00:00 2001 From: Dan Kraus Date: Wed, 15 Nov 2017 18:42:32 -0500 Subject: [PATCH 05/90] Adds string base64 typings --- types/joi/index.d.ts | 14 ++++++++++++++ types/joi/joi-tests.ts | 8 ++++++++ 2 files changed, 22 insertions(+) diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index 6dbc08245a..41a8063cac 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -8,6 +8,7 @@ // Rytis Alekna // Pavel Ivanov // Youngrok Kim +// Dan Kraus // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -127,6 +128,13 @@ export interface UriOptions { scheme?: string | RegExp | Array; } +export interface Base64Options { + /** + * optional parameter defaulting to true which will require = padding if true or make padding optional if false + */ + paddingRequired?: boolean; +} + export interface WhenOptions { /** * the required condition joi type. @@ -520,6 +528,12 @@ export interface StringSchema extends AnySchema { */ normalize(form?: 'NFC' | 'NFD' | 'NFKC' | 'NFKD'): this; + /** + * Requires the string value to be a valid base64 string; does not check the decoded value. + * @param options - optional settings: The unicode normalization options to use. Valid values: NFC [default], NFD, NFKC, NFKD + */ + base64(options?: Base64Options): this; + /** * Requires the number to be a credit card number (Using Lunh Algorithm). */ diff --git a/types/joi/joi-tests.ts b/types/joi/joi-tests.ts index 96d91a72b9..58531f5d24 100644 --- a/types/joi/joi-tests.ts +++ b/types/joi/joi-tests.ts @@ -113,6 +113,12 @@ uriOpts = { scheme: expArr }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- +var base64Opts: Joi.Base64Options = null; + +base64Opts = { paddingRequired: bool }; + +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + var whenOpts: Joi.WhenOptions = null; whenOpts = { is: x }; @@ -777,6 +783,8 @@ strSchema = strSchema.truncate(); strSchema = strSchema.truncate(false); strSchema = strSchema.normalize(); strSchema = strSchema.normalize('NFKC'); +strSchema = strSchema.base64(); +strSchema = strSchema.base64(base64Opts); namespace common { strSchema = strSchema.allow(x); From 89667eb5cbee013f697ef1adef6582caa62385f3 Mon Sep 17 00:00:00 2001 From: Jeff Jacobson Date: Thu, 16 Nov 2017 14:50:49 -0800 Subject: [PATCH 06/90] Updated GeoJSON type definitions Updated to match RFC 7946 (https://tools.ietf.org/html/rfc7946). * Removed coordinate reference system types due to their removal from the standard. (https://tools.ietf.org/html/rfc7946#appendix-B.1) * Position arrays are now restricted to either two or three positions. (https://tools.ietf.org/html/rfc7946#section-3.1.1) * Feature and feature collection types are no longer generic. * Added support for foreign members. (https://tools.ietf.org/html/rfc7946#section-6.1) --- types/geojson/geojson-tests.ts | 93 ++++++++++-------- types/geojson/index.d.ts | 166 ++++++++++++++++++++------------- 2 files changed, 154 insertions(+), 105 deletions(-) diff --git a/types/geojson/geojson-tests.ts b/types/geojson/geojson-tests.ts index 4adb7f88f2..c9042c9da2 100644 --- a/types/geojson/geojson-tests.ts +++ b/types/geojson/geojson-tests.ts @@ -1,4 +1,9 @@ -let featureCollection: GeoJSON.FeatureCollection = { +import { + Feature, FeatureCollection, GeometryCollection, LineString, + MultiLineString, MultiPoint, MultiPolygon, Point, Polygon +} from "geojson"; + +let featureCollection: FeatureCollection = { type: "FeatureCollection", features: [ { @@ -34,7 +39,7 @@ let featureCollection: GeoJSON.FeatureCollection = { geometry: { type: "Polygon", coordinates: [ - [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] + [[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]] ] }, properties: { @@ -45,6 +50,9 @@ let featureCollection: GeoJSON.FeatureCollection = { } } ], + // Coordinate Systems no longer supported in GeoJSON as of RFC 7946. + // This will still work due to the standard's allowance for + // "foregin members", however. crs: { type: "link", properties: { @@ -54,7 +62,7 @@ let featureCollection: GeoJSON.FeatureCollection = { } }; -let featureWithPolygon: GeoJSON.Feature = { +const featureWithPolygon: Feature = { type: "Feature", bbox: [-180.0, -90.0, 180.0, 90.0], geometry: { @@ -66,57 +74,57 @@ let featureWithPolygon: GeoJSON.Feature = { properties: null }; -let point: GeoJSON.Point = { +const point: Point = { type: "Point", coordinates: [100.0, 0.0] }; // This type is commonly used in the turf package -let pointCoordinates: number[] = point.coordinates; +const pointCoordinates: number[] = point.coordinates; -let lineString: GeoJSON.LineString = { +const lineString: LineString = { type: "LineString", - coordinates: [ [100.0, 0.0], [101.0, 1.0] ] + coordinates: [[100.0, 0.0], [101.0, 1.0]] }; -let polygon: GeoJSON.Polygon = { +const polygon: Polygon = { type: "Polygon", coordinates: [ - [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] + [[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]] ] }; -let polygonWithHole: GeoJSON.Polygon = { +const polygonWithHole: Polygon = { type: "Polygon", coordinates: [ - [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ], - [ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2] ] + [[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], + [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]] ] }; -let multiPoint: GeoJSON.MultiPoint = { +const multiPoint: MultiPoint = { type: "MultiPoint", - coordinates: [ [100.0, 0.0], [101.0, 1.0] ] + coordinates: [[100.0, 0.0], [101.0, 1.0]] }; -let multiLineString: GeoJSON.MultiLineString = { +const multiLineString: MultiLineString = { type: "MultiLineString", coordinates: [ - [ [100.0, 0.0], [101.0, 1.0] ], - [ [102.0, 2.0], [103.0, 3.0] ] + [[100.0, 0.0], [101.0, 1.0]], + [[102.0, 2.0], [103.0, 3.0]] ] }; -let multiPolygon: GeoJSON.MultiPolygon = { +const multiPolygon: MultiPolygon = { type: "MultiPolygon", coordinates: [ [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]], [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], - [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]] + [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]] ] }; -let geometryCollection: GeoJSON.GeometryCollection = { +const geometryCollection: GeometryCollection = { type: "GeometryCollection", geometries: [ { @@ -125,12 +133,12 @@ let geometryCollection: GeoJSON.GeometryCollection = { }, { type: "LineString", - coordinates: [ [101.0, 0.0], [102.0, 1.0] ] + coordinates: [[101.0, 0.0], [102.0, 1.0]] } ] }; -let feature: GeoJSON.Feature = { +let feature: Feature = { type: "Feature", geometry: lineString, properties: null @@ -172,31 +180,31 @@ featureCollection = { { type: "Feature", geometry: lineString, - properties: {test: "OK"} + properties: { test: "OK" } }, { type: "Feature", geometry: polygon, - properties: {test: "OK"} + properties: { test: "OK" } }, { type: "Feature", geometry: polygonWithHole, - properties: {test: "OK"} + properties: { test: "OK" } }, { type: "Feature", geometry: multiPoint, - properties: {test: "OK"} + properties: { test: "OK" } }, { type: "Feature", geometry: multiLineString, - properties: {test: "OK"} + properties: { test: "OK" } }, { type: "Feature", geometry: multiPolygon, - properties: {test: "OK"} + properties: { test: "OK" } }, { type: "Feature", geometry: geometryCollection, - properties: {test: "OK"} + properties: { test: "OK" } } ], crs: { @@ -209,7 +217,7 @@ featureCollection = { }; // Allow access to custom properties -const pt: GeoJSON.Feature = { +const pt: Feature = { type: "Feature", properties: { foo: "bar", @@ -221,9 +229,14 @@ const pt: GeoJSON.Feature = { coordinates: [0, 0] } }; -pt.properties.foo; -pt.properties.hello; -pt.properties[1]; + +if (pt.properties) { + if (pt.properties.foo == null || pt.properties.hello == null || pt.properties[1] == null) { + throw TypeError("Properties should not be null or undefined."); + } +} else { + throw TypeError("Feature should have a 'properties' property."); +} // Optional generic for properties @@ -232,19 +245,21 @@ interface TestProperty { hello: string; } -const typedPropertiesFeature: GeoJSON.Feature = { +const testProps: TestProperty = { + foo: "bar", + hello: "world" +}; + +const typedPropertiesFeature: Feature = { type: "Feature", - properties: { - foo: "bar", - hello: "world", - }, + properties: testProps, geometry: { type: "Point", coordinates: [0, 0] } }; -const typedPropertiesFeatureCollection: GeoJSON.FeatureCollection = { +const typedPropertiesFeatureCollection: FeatureCollection = { type: "FeatureCollection", features: [typedPropertiesFeature] }; diff --git a/types/geojson/index.d.ts b/types/geojson/index.d.ts index b916179fac..2b086bc382 100644 --- a/types/geojson/index.d.ts +++ b/types/geojson/index.d.ts @@ -1,123 +1,157 @@ -// Type definitions for GeoJSON Format Specification Revision 1.0 -// Project: http://geojson.org/ +// Type definitions for geojson 7946.0 +// Project: https://geojson.org/ // Definitions by: Jacob Bruun // Arne Schubert +// Jeff Jacobson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 +// Note: as of the RFC 7946 version of GeoJSON, Coordinate Reference Systems +// are no longer supported. (See https://tools.ietf.org/html/rfc7946#appendix-B)} + export as namespace GeoJSON; -/*** - * http://geojson.org/geojson-spec.html#geojson-objects +/** + * The valid values for the "type" property of GeoJSON geometry objects. + * https://tools.ietf.org/html/rfc7946#section-1.4 + */ +export type GeoJsonGeometryTypeNames = "Point" | "LineString" | "MultiPoint" | "Polygon" | "MultiLineString" | + "MultiPolygon" | "GeometryCollection"; + +/** + * The value values for the "type" property of GeoJSON Objects. + * https://tools.ietf.org/html/rfc7946#section-1.4 + */ +export type GeoJsonTypeNames = "FeatureCollection" | "Feature" | GeoJsonGeometryTypeNames; + +/** + * Bounding box + * https://tools.ietf.org/html/rfc7946#section-5 + */ +export type BoundingBox = [number, number, number, number] | [number, number, number, number, number]; + +/** + * A Position is an array of coordinates. + * https://tools.ietf.org/html/rfc7946#section-3.1.1 + */ +export type Position = [number, number] | [number, number, number]; + +/** + * The base GeoJSON object. + * https://tools.ietf.org/html/rfc7946#section-3 */ export interface GeoJsonObject { - type: string; - bbox?: number[]; - crs?: CoordinateReferenceSystem; + /** + * Allow foreign members as specified in https://tools.ietf.org/html/rfc7946#section-6.1 + */ + [key: string]: any; + /** + * Specifies the type of GeoJSON object. + */ + type: GeoJsonTypeNames; + /** + * Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections. + * https://tools.ietf.org/html/rfc7946#section-5 + */ + bbox?: BoundingBox; } -/*** - * http://geojson.org/geojson-spec.html#positions - */ -export type Position = number[]; - -/*** - * http://geojson.org/geojson-spec.html#geometry-objects - */ -export interface DirectGeometryObject extends GeoJsonObject { - coordinates: Position[][][] | Position[][] | Position[] | Position; -} /** - * GeometryObject supports geometry collection as well + * A geometry object. + * https://tools.ietf.org/html/rfc7946#section-3 */ -export type GeometryObject = DirectGeometryObject | GeometryCollection; +export interface GeometryObject extends GeoJsonObject { + type: GeoJsonGeometryTypeNames; +} -/*** - * http://geojson.org/geojson-spec.html#point +/** + * Point geometry object. + * https://tools.ietf.org/html/rfc7946#section-3.1.2 */ -export interface Point extends DirectGeometryObject { +export interface Point extends GeometryObject { type: "Point"; coordinates: Position; } -/*** - * http://geojson.org/geojson-spec.html#multipoint +/** + * MultiPoint geometry object. + * https://tools.ietf.org/html/rfc7946#section-3.1.3 */ -export interface MultiPoint extends DirectGeometryObject { +export interface MultiPoint extends GeometryObject { type: "MultiPoint"; coordinates: Position[]; } -/*** - * http://geojson.org/geojson-spec.html#linestring +/** + * LineString geometry object. + * https://tools.ietf.org/html/rfc7946#section-3.1.4 */ -export interface LineString extends DirectGeometryObject { +export interface LineString extends GeometryObject { type: "LineString"; coordinates: Position[]; } -/*** - * http://geojson.org/geojson-spec.html#multilinestring +/** + * MultiLineString geometry object. + * https://tools.ietf.org/html/rfc7946#section-3.1.5 */ -export interface MultiLineString extends DirectGeometryObject { +export interface MultiLineString extends GeometryObject { type: "MultiLineString"; coordinates: Position[][]; } -/*** - * http://geojson.org/geojson-spec.html#polygon +/** + * Polygon geometry object. + * https://tools.ietf.org/html/rfc7946#section-3.1.6 */ -export interface Polygon extends DirectGeometryObject { +export interface Polygon extends GeometryObject { type: "Polygon"; coordinates: Position[][]; } -/*** - * http://geojson.org/geojson-spec.html#multipolygon +/** + * MultiPolygon geometry object. + * https://tools.ietf.org/html/rfc7946#section-3.1.7 */ -export interface MultiPolygon extends DirectGeometryObject { +export interface MultiPolygon extends GeometryObject { type: "MultiPolygon"; coordinates: Position[][][]; } -/*** - * http://geojson.org/geojson-spec.html#geometry-collection +/** + * Geometry Collection + * https://tools.ietf.org/html/rfc7946#section-3.1.8 */ -export interface GeometryCollection extends GeoJsonObject { +export interface GeometryCollection extends GeometryObject { type: "GeometryCollection"; geometries: GeometryObject[]; } -/*** +/** + * A feature object which contains a geometry and associated properties. * https://tools.ietf.org/html/rfc7946#section-3.2 */ -export interface Feature extends GeoJsonObject { +export interface Feature extends GeoJsonObject { type: "Feature"; - geometry: G; - properties: P; + /** + * The feature's geometry + */ + geometry: GeometryObject | null; + /** + * A value that uniquely identifies this feature in a + * https://tools.ietf.org/html/rfc7946#section-3.2. + */ id?: string | number; + /** + * Properties associated with this feature. + */ + properties: { [name: string]: any; } | null; } -/*** - * http://geojson.org/geojson-spec.html#feature-collection-objects +/** + * A collection of feature objects. + * https://tools.ietf.org/html/rfc7946#section-3.3 */ -export interface FeatureCollection extends GeoJsonObject { - type: "FeatureCollection"; - features: Array>; -} - -/*** - * http://geojson.org/geojson-spec.html#coordinate-reference-system-objects - */ -export interface CoordinateReferenceSystem { - type: string; - properties: any; -} - -export interface NamedCoordinateReferenceSystem extends CoordinateReferenceSystem { - properties: { name: string }; -} - -export interface LinkedCoordinateReferenceSystem extends CoordinateReferenceSystem { - properties: { href: string; type: string }; +export interface FeatureCollection extends GeoJsonObject { + features: Feature[]; } From 335d12a4ee9af8e7f0c25dc6fe93a059e3ee9fa9 Mon Sep 17 00:00:00 2001 From: Jeff Jacobson Date: Thu, 16 Nov 2017 15:40:04 -0800 Subject: [PATCH 07/90] Modified typedefs dependent on "geojson" to accommodate changes. --- types/d3-geo/d3-geo-tests.ts | 4 ++-- types/d3-geo/index.d.ts | 4 +++- types/geojson2osm/geojson2osm-tests.ts | 2 +- types/geojson2osm/index.d.ts | 2 +- types/leaflet/index.d.ts | 28 +++++++++++++------------- types/leaflet/v0/index.d.ts | 12 +++++------ types/mapbox-gl/index.d.ts | 8 ++++---- types/polyline/index.d.ts | 2 +- types/shapefile/index.d.ts | 4 ++-- types/supercluster/index.d.ts | 2 +- types/tilebelt/index.d.ts | 4 ++-- 11 files changed, 37 insertions(+), 35 deletions(-) diff --git a/types/d3-geo/d3-geo-tests.ts b/types/d3-geo/d3-geo-tests.ts index 876461e3e9..e6014837a7 100644 --- a/types/d3-geo/d3-geo-tests.ts +++ b/types/d3-geo/d3-geo-tests.ts @@ -49,7 +49,7 @@ const sampleExtendedGeometryCollection: d3Geo.ExtendedGeometryCollection = { +const sampleFeature: GeoJSON.Feature = { type: 'Feature', geometry: samplePolygon, properties: { @@ -74,7 +74,7 @@ const sampleExtendedFeature2: d3Geo.ExtendedFeature = { +const sampleFeatureCollection: GeoJSON.FeatureCollection = { type: 'FeatureCollection', features: [ sampleFeature, diff --git a/types/d3-geo/index.d.ts b/types/d3-geo/index.d.ts index 4093b696e9..1d1d36fe91 100644 --- a/types/d3-geo/index.d.ts +++ b/types/d3-geo/index.d.ts @@ -36,7 +36,9 @@ export type GeoGeometryObjects = GeoJSON.GeometryObject | GeoSphere; export interface ExtendedGeometryCollection { type: string; bbox?: number[]; - crs?: GeoJSON.CoordinateReferenceSystem; + // GeoJSON removed the Coordinate System objects from the spec, but does allow + // "foreign members". + crs?: GeoJSON.GeoJsonObject; geometries: GeometryType[]; } diff --git a/types/geojson2osm/geojson2osm-tests.ts b/types/geojson2osm/geojson2osm-tests.ts index 887f10a83c..9d95de64c4 100644 --- a/types/geojson2osm/geojson2osm-tests.ts +++ b/types/geojson2osm/geojson2osm-tests.ts @@ -1,6 +1,6 @@ import { geojson2osm } from 'geojson2osm' -const features: GeoJSON.FeatureCollection = { +const features: GeoJSON.FeatureCollection = { type: 'FeatureCollection', features: [{ type: 'Feature', diff --git a/types/geojson2osm/index.d.ts b/types/geojson2osm/index.d.ts index 39b03de5bf..513348eeae 100644 --- a/types/geojson2osm/index.d.ts +++ b/types/geojson2osm/index.d.ts @@ -11,4 +11,4 @@ * @param features Input features * @returns OpenStreetMap XML */ -export function geojson2osm(features: GeoJSON.Feature | GeoJSON.FeatureCollection): any +export function geojson2osm(features: GeoJSON.Feature | GeoJSON.FeatureCollection): any diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index b1e7ead796..727478864a 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -583,7 +583,7 @@ export interface PolylineOptions extends PathOptions { export class Polyline extends Path { constructor(latlngs: LatLngExpression[], options?: PolylineOptions); - toGeoJSON(): geojson.Feature; + toGeoJSON(): geojson.Feature; getLatLngs(): LatLng[]; setLatLngs(latlngs: LatLngExpression[]): this; isEmpty(): boolean; @@ -591,7 +591,7 @@ export class Polyline; + feature?: geojson.Feature; options: PolylineOptions; } @@ -616,14 +616,14 @@ export interface CircleMarkerOptions extends PathOptions { export class CircleMarker

extends Path { constructor(latlng: LatLngExpression, options?: CircleMarkerOptions); - toGeoJSON(): geojson.Feature; + toGeoJSON(): geojson.Feature; setLatLng(latLng: LatLngExpression): this; getLatLng(): LatLng; setRadius(radius: number): this; getRadius(): number; options: CircleMarkerOptions; - feature?: geojson.Feature; + feature?: geojson.Feature; } export function circleMarker(latlng: LatLngExpression, options?: CircleMarkerOptions): CircleMarker; @@ -671,7 +671,7 @@ export class LayerGroup

extends Layer { /** * Returns a GeoJSON representation of the layer group (as a GeoJSON GeometryCollection, GeoJSONFeatureCollection or Multipoint). */ - toGeoJSON(): geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection; + toGeoJSON(): geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection; /** * Adds the given layer to the group. @@ -725,7 +725,7 @@ export class LayerGroup

extends Layer { */ getLayerId(layer: Layer): number; - feature?: geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection; + feature?: geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection; } /** @@ -765,7 +765,7 @@ export class FeatureGroup

extends LayerGroup

{ */ export function featureGroup(layers?: Layer[]): FeatureGroup; -export type StyleFunction

= (feature?: geojson.Feature) => PathOptions; +export type StyleFunction

= (feature?: geojson.Feature) => PathOptions; export interface GeoJSONOptions

extends LayerOptions { /** @@ -781,7 +781,7 @@ export interface GeoJSONOptions

extends LayerOptions { * } * ``` */ - pointToLayer?(geoJsonPoint: geojson.Feature, latlng: LatLng): Layer; // should import GeoJSON typings + pointToLayer?(geoJsonPoint: geojson.Feature, latlng: LatLng): Layer; // should import GeoJSON typings /** * A Function defining the Path options for styling GeoJSON lines and polygons, @@ -807,7 +807,7 @@ export interface GeoJSONOptions

extends LayerOptions { * function (feature, layer) {} * ``` */ - onEachFeature?(feature: geojson.Feature, layer: Layer): void; + onEachFeature?(feature: geojson.Feature, layer: Layer): void; /** * A Function that will be used to decide whether to show a feature or not. @@ -820,7 +820,7 @@ export interface GeoJSONOptions

extends LayerOptions { * } * ``` */ - filter?(geoJsonFeature: geojson.Feature): boolean; + filter?(geoJsonFeature: geojson.Feature): boolean; /** * A Function that will be used for converting GeoJSON coordinates to LatLngs. @@ -838,7 +838,7 @@ export class GeoJSON

extends FeatureGroup

{ * Creates a Layer from a given GeoJSON feature. Can use a custom pointToLayer * and/or coordsToLatLng functions if provided as options. */ - static geometryToLayer

(featureData: geojson.Feature, options?: GeoJSONOptions

): Layer; + static geometryToLayer(featureData: geojson.Feature, options?: GeoJSONOptions): Layer; /** * Creates a LatLng object from an array of 2 numbers (longitude, latitude) or @@ -872,7 +872,7 @@ export class GeoJSON

extends FeatureGroup

{ /** * Normalize GeoJSON geometries/features into GeoJSON features. */ - static asFeature

(geojson: geojson.Feature | geojson.GeometryObject): geojson.Feature; + static asFeature(geojson: geojson.Feature | geojson.GeometryObject): geojson.Feature; constructor(geojson?: geojson.GeoJsonObject, options?: GeoJSONOptions

) /** @@ -1454,7 +1454,7 @@ export interface MarkerOptions extends InteractiveLayerOptions { export class Marker

extends Layer { constructor(latlng: LatLngExpression, options?: MarkerOptions); - toGeoJSON(): geojson.Feature; + toGeoJSON(): geojson.Feature; getLatLng(): LatLng; setLatLng(latlng: LatLngExpression): this; setZIndexOffset(offset: number): this; @@ -1465,7 +1465,7 @@ export class Marker

extends Layer { // Properties options: MarkerOptions; dragging?: Handler; - feature?: geojson.Feature; + feature?: geojson.Feature; } export function marker(latlng: LatLngExpression, options?: MarkerOptions): Marker; diff --git a/types/leaflet/v0/index.d.ts b/types/leaflet/v0/index.d.ts index efadd88e8f..d841a45133 100644 --- a/types/leaflet/v0/index.d.ts +++ b/types/leaflet/v0/index.d.ts @@ -223,7 +223,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the circle (GeoJSON Point Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; } } @@ -1716,7 +1716,7 @@ declare namespace L { * Returns a GeoJSON representation of the layer group (GeoJSON FeatureCollection). * Note: Descendent classes MultiPolygon & MultiPolyLine return `Feature`s, not `FeatureCollection`s */ - toGeoJSON(): GeoJSON.FeatureCollection|GeoJSON.Feature; + toGeoJSON(): GeoJSON.FeatureCollection|GeoJSON.Feature; //////////// //////////// @@ -2943,7 +2943,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the marker (GeoJSON Point Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; /** * Marker dragging handler (by both mouse and touch). @@ -3103,7 +3103,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the multipolygon (GeoJSON MultiPolygon Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; } } @@ -3144,7 +3144,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the multipolyline (GeoJSON MultiLineString Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; } } @@ -3565,7 +3565,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the polyline (GeoJSON LineString Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; } } diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index 6be9a465ef..6e61c90c70 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -54,9 +54,9 @@ declare namespace mapboxgl { unproject(point: PointLike): mapboxgl.LngLat; - queryRenderedFeatures(pointOrBox?: PointLike | PointLike[], parameters?: {layers?: string[], filter?: any[]}): GeoJSON.Feature[]; + queryRenderedFeatures(pointOrBox?: PointLike | PointLike[], parameters?: {layers?: string[], filter?: any[]}): GeoJSON.Feature[]; - querySourceFeatures(sourceID: string, parameters?: {sourceLayer?: string, filter?: any[]}): GeoJSON.Feature[]; + querySourceFeatures(sourceID: string, parameters?: {sourceLayer?: string, filter?: any[]}): GeoJSON.Feature[]; setStyle(style: mapboxgl.Style | string): this; @@ -507,11 +507,11 @@ declare namespace mapboxgl { constructor(options?: mapboxgl.GeoJSONSourceOptions); - setData(data: GeoJSON.Feature | GeoJSON.FeatureCollection | String): this; + setData(data: GeoJSON.Feature | GeoJSON.FeatureCollection | String): this; } export interface GeoJSONSourceOptions { - data?: GeoJSON.Feature | GeoJSON.FeatureCollection | string; + data?: GeoJSON.Feature | GeoJSON.FeatureCollection | string; maxzoom?: number; diff --git a/types/polyline/index.d.ts b/types/polyline/index.d.ts index 7a8b7eeb19..6961205212 100644 --- a/types/polyline/index.d.ts +++ b/types/polyline/index.d.ts @@ -9,7 +9,7 @@ interface Polyline { decode(string: string, precision?: number): number[][]; encode(coordinate: number[][], precision?: number): string; - fromGeoJSON(geojson: GeoJSON.LineString | GeoJSON.Feature, precision?: number): string; + fromGeoJSON(geojson: GeoJSON.LineString | GeoJSON.Feature, precision?: number): string; } declare var polyline: Polyline; diff --git a/types/shapefile/index.d.ts b/types/shapefile/index.d.ts index 54a18a2503..83852507e1 100644 --- a/types/shapefile/index.d.ts +++ b/types/shapefile/index.d.ts @@ -15,7 +15,7 @@ declare namespace shapefile { } interface Feature { done: boolean - value: GeoJSON.Feature + value: GeoJSON.Feature } interface Shapefile { bbox: Array @@ -23,7 +23,7 @@ declare namespace shapefile { } interface ShapefileStatic { open(shp: any, dbf?: any, options?: Options): Promise; - read(shp: any, dbf?: any, options?: Options): Promise>; + read(shp: any, dbf?: any, options?: Options): Promise; } } diff --git a/types/supercluster/index.d.ts b/types/supercluster/index.d.ts index 7fd487ae09..7463b4a43a 100644 --- a/types/supercluster/index.d.ts +++ b/types/supercluster/index.d.ts @@ -94,7 +94,7 @@ export class Supercluster { */ export default function supercluster(options: Options): Supercluster; -export type Point = GeoJSON.Feature; +export type Point = GeoJSON.Feature; export type Points = Point[]; export type Clusters = Cluster[]; export type TileFeatures = TileFeature[]; diff --git a/types/tilebelt/index.d.ts b/types/tilebelt/index.d.ts index f8d3adae1c..eed92f915b 100644 --- a/types/tilebelt/index.d.ts +++ b/types/tilebelt/index.d.ts @@ -14,12 +14,12 @@ declare namespace tilebelt { * * @name tileToGeoJSON * @param {Array} tile - * @returns {Feature} + * @returns {Feature} * @example * var poly = tileToGeoJSON([5, 10, 10]) * //=poly */ - tileToGeoJSON(tile: Array): GeoJSON.Feature + tileToGeoJSON(tile: Array): GeoJSON.Feature /** * Get the bbox of a tile From 10e05d7aa22d48fdef923483120749d1fb168e65 Mon Sep 17 00:00:00 2001 From: Peter Bartha Date: Sat, 18 Nov 2017 20:07:33 +0100 Subject: [PATCH 08/90] Add 'setSelections' to CodeMirror --- types/codemirror/index.d.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/types/codemirror/index.d.ts b/types/codemirror/index.d.ts index 126eafe013..45e503e068 100644 --- a/types/codemirror/index.d.ts +++ b/types/codemirror/index.d.ts @@ -105,9 +105,9 @@ declare namespace CodeMirror { function signal(target: any, name: string, ...args: any[]): void; type DOMEvent = 'mousedown' | 'dblclick' | 'touchstart' | 'contextmenu' | 'keydown' | 'keypress' | 'keyup' | 'cut' | 'copy' | 'paste' | 'dragstart' | 'dragenter' | 'dragover' | 'dragleave' | 'drop'; - + type CoordsMode = 'window' | 'page' | 'local'; - + interface Token { /** The character(on the given line) at which the token starts. */ start: number; @@ -202,10 +202,10 @@ declare namespace CodeMirror { /** Compute the line at the given pixel height. mode is the relative element to use to compute this line, it may be "window", "page" (the default), or "local" */ lineAtHeight(height: number, mode?: CoordsMode): number; - - /** Computes the height of the top of a line, in the coordinate system specified by mode, it may be "window", - "page" (the default), or "local". When a line below the bottom of the document is specified, the returned value - is the bottom of the last line in the document. By default, the position of the actual text is returned. + + /** Computes the height of the top of a line, in the coordinate system specified by mode, it may be "window", + "page" (the default), or "local". When a line below the bottom of the document is specified, the returned value + is the bottom of the last line in the document. By default, the position of the actual text is returned. If includeWidgets is true and the line has line widgets, the position above the first line widget is returned. */ heightAtLine(line: any, mode?: CoordsMode, includeWidgets?: boolean): number; @@ -292,7 +292,7 @@ declare namespace CodeMirror { charCoords(pos: CodeMirror.Position, mode?: CoordsMode): { left: number; right: number; top: number; bottom: number; }; /** Given an { left , top } object , returns the { line , ch } position that corresponds to it. - The optional mode parameter determines relative to what the coordinates are interpreted. + The optional mode parameter determines relative to what the coordinates are interpreted. It may be "window", "page" (the default), or "local". */ coordsChar(object: { left: number; top: number; }, mode?: CoordsMode): CodeMirror.Position; @@ -512,7 +512,7 @@ declare namespace CodeMirror { /** Get the currently selected code. */ getSelection(): string; - + /** Returns an array containing a string for each selection, representing the content of the selections. */ getSelections(lineSep?: string): Array; @@ -538,6 +538,9 @@ declare namespace CodeMirror { /** Set the selection range.anchor and head should be { line , ch } objects.head defaults to anchor when not given. */ setSelection(anchor: CodeMirror.Position, head: CodeMirror.Position): void; + /** Set and normalize selection ranges and range should be { anchor, head } objects. primary determines which selection is the primary one. */ + setSelections(ranges: Array<{ anchor: CodeMirror.Position, head: CodeMirror.Position }>, primary?: number): void; + /** Similar to setSelection , but will, if shift is held or the extending flag is set, move the head of the selection while leaving the anchor at its current place. pos2 is optional , and can be passed to ensure a region (for example a word or paragraph) will end up selected @@ -779,7 +782,7 @@ declare namespace CodeMirror { /** Determines whether the gutter scrolls along with the content horizontally (false) or whether it stays fixed during horizontal scrolling (true, the default). */ fixedGutter?: boolean; - + /** * Chooses a scrollbar implementation. The default is "native", showing native scrollbars. The core library also * provides the "null" style, which completely hides the scrollbars. Addons can implement additional scrollbar models. From efcfa2916364b838ebfbedf6bd16fecf926c3780 Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Sat, 18 Nov 2017 22:49:43 -0500 Subject: [PATCH 09/90] Fix the remaining strictFunctionTypes issues --- types/lodash/index.d.ts | 178 ++++++++++++++++++++++------------- types/lodash/lodash-tests.ts | 103 ++++---------------- 2 files changed, 131 insertions(+), 150 deletions(-) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index fafa7f6b5c..5be5358b4b 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -1234,7 +1234,7 @@ declare namespace _ { */ findIndex( array: List | null | undefined, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): number; } @@ -1245,7 +1245,7 @@ declare namespace _ { */ findIndex( this: LoDashImplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): number; } @@ -1256,7 +1256,7 @@ declare namespace _ { */ findIndex( this: LoDashExplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): LoDashExplicitWrapper; } @@ -1282,7 +1282,7 @@ declare namespace _ { */ findLastIndex( array: List | null | undefined, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): number; } @@ -1293,7 +1293,7 @@ declare namespace _ { */ findLastIndex( this: LoDashImplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): number; } @@ -1304,7 +1304,7 @@ declare namespace _ { */ findLastIndex( this: LoDashExplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): LoDashExplicitWrapper; } @@ -4315,6 +4315,14 @@ declare namespace _ { * @param thisArg The this binding of iteratee. * @return Returns the composed aggregate object. */ + countBy( + collection: string | null | undefined, + iteratee?: StringIterator + ): Dictionary; + + /** + * @see _.countBy + */ countBy( collection: List | null | undefined, iteratee?: ListIteratee @@ -4338,6 +4346,14 @@ declare namespace _ { } interface LoDashImplicitWrapper { + /** + * @see _.countBy + */ + countBy( + this: LoDashImplicitWrapper, + iteratee?: StringIterator + ): LoDashImplicitWrapper>; + /** * @see _.countBy */ @@ -4364,6 +4380,14 @@ declare namespace _ { } interface LoDashExplicitWrapper { + /** + * @see _.countBy + */ + countBy( + this: LoDashExplicitWrapper, + iteratee?: StringIterator + ): LoDashExplicitWrapper>; + /** * @see _.countBy */ @@ -4479,7 +4503,7 @@ declare namespace _ { */ every( collection: List | null | undefined, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): boolean; /** @@ -4487,7 +4511,7 @@ declare namespace _ { */ every( collection: NumericDictionary | null | undefined, - predicate?: NumericDictionaryIterateeBoolean + predicate?: NumericDictionaryIterateeCustom ): boolean; /** @@ -4495,7 +4519,7 @@ declare namespace _ { */ every( collection: T | null | undefined, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): boolean; } @@ -4505,7 +4529,7 @@ declare namespace _ { */ every( this: LoDashImplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): boolean; /** @@ -4513,7 +4537,7 @@ declare namespace _ { */ every( this: LoDashImplicitWrapper, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): boolean; /** @@ -4521,7 +4545,7 @@ declare namespace _ { */ every( this: LoDashImplicitWrapper | null | undefined>, - predicate?: NumericDictionaryIterateeBoolean + predicate?: NumericDictionaryIterateeCustom ): boolean; } @@ -4531,7 +4555,7 @@ declare namespace _ { */ every( this: LoDashExplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): LoDashExplicitWrapper; /** @@ -4539,7 +4563,7 @@ declare namespace _ { */ every( this: LoDashExplicitWrapper, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): LoDashExplicitWrapper; /** @@ -4547,7 +4571,7 @@ declare namespace _ { */ every( this: LoDashExplicitWrapper | null | undefined>, - predicate?: NumericDictionaryIterateeBoolean + predicate?: NumericDictionaryIterateeCustom ): LoDashExplicitWrapper; } @@ -4589,7 +4613,7 @@ declare namespace _ { */ filter( collection: List | null | undefined, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): T[]; /** @@ -4605,7 +4629,7 @@ declare namespace _ { */ filter( collection: T | null | undefined, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): Array; } @@ -4631,7 +4655,7 @@ declare namespace _ { */ filter( this: LoDashImplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): LoDashImplicitWrapper; /** @@ -4647,7 +4671,7 @@ declare namespace _ { */ filter( this: LoDashImplicitWrapper, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): LoDashImplicitWrapper>; } @@ -4673,7 +4697,7 @@ declare namespace _ { */ filter( this: LoDashExplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): LoDashExplicitWrapper; /** @@ -4689,7 +4713,7 @@ declare namespace _ { */ filter( this: LoDashExplicitWrapper, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): LoDashExplicitWrapper>; } @@ -4724,7 +4748,7 @@ declare namespace _ { */ find( collection: List | null | undefined, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): T|undefined; @@ -4742,7 +4766,7 @@ declare namespace _ { */ find( collection: T | null | undefined, - predicate?: ObjectIterateeBoolean, + predicate?: ObjectIterateeCustom, fromIndex?: number ): T[keyof T]|undefined; } @@ -4762,7 +4786,7 @@ declare namespace _ { */ find( this: LoDashImplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): T|undefined; @@ -4780,7 +4804,7 @@ declare namespace _ { */ find( this: LoDashImplicitWrapper, - predicate?: ObjectIterateeBoolean, + predicate?: ObjectIterateeCustom, fromIndex?: number ): T[keyof T]|undefined; } @@ -4800,7 +4824,7 @@ declare namespace _ { */ find( this: LoDashExplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): LoDashExplicitWrapper; @@ -4818,7 +4842,7 @@ declare namespace _ { */ find( this: LoDashExplicitWrapper, - predicate?: ObjectIterateeBoolean, + predicate?: ObjectIterateeCustom, fromIndex?: number ): LoDashExplicitWrapper; } @@ -4844,7 +4868,7 @@ declare namespace _ { */ findLast( collection: List | null | undefined, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): T|undefined; @@ -4862,7 +4886,7 @@ declare namespace _ { */ findLast( collection: T | null | undefined, - predicate?: ObjectIterateeBoolean, + predicate?: ObjectIterateeCustom, fromIndex?: number ): T[keyof T]|undefined; } @@ -4882,7 +4906,7 @@ declare namespace _ { */ findLast( this: LoDashImplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): T | undefined; @@ -4900,7 +4924,7 @@ declare namespace _ { */ findLast( this: LoDashImplicitWrapper, - predicate?: ObjectIterateeBoolean, + predicate?: ObjectIterateeCustom, fromIndex?: number ): T[keyof T]|undefined; } @@ -4920,7 +4944,7 @@ declare namespace _ { */ findLast( this: LoDashExplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): LoDashExplicitWrapper; @@ -4938,7 +4962,7 @@ declare namespace _ { */ findLast( this: LoDashExplicitWrapper, - predicate?: ObjectIterateeBoolean, + predicate?: ObjectIterateeCustom, fromIndex?: number ): LoDashExplicitWrapper; } @@ -5849,9 +5873,17 @@ declare namespace _ { * @param thisArg The this binding of iteratee. * @return Returns the composed aggregate object. */ + keyBy( + collection: string | null | undefined, + iteratee?: StringIterator + ): Dictionary; + + /** + * @see _.keyBy + */ keyBy( collection: List | null | undefined, - iteratee?: ListIteratee + iteratee?: ListIterateeCustom ): Dictionary; /** @@ -5859,7 +5891,7 @@ declare namespace _ { */ keyBy( collection: T | null | undefined, - iteratee?: ObjectIteratee + iteratee?: ObjectIterateeCustom ): Dictionary; /** @@ -5867,17 +5899,25 @@ declare namespace _ { */ keyBy( collection: NumericDictionary | null | undefined, - iteratee?: NumericDictionaryIteratee + iteratee?: NumericDictionaryIterateeCustom ): Dictionary; } interface LoDashImplicitWrapper { + /** + * @see _.keyBy + */ + keyBy( + this: LoDashImplicitWrapper, + iteratee?: StringIterator + ): LoDashImplicitWrapper>; + /** * @see _.keyBy */ keyBy( this: LoDashImplicitWrapper | null | undefined>, - iteratee?: ListIteratee + iteratee?: ListIterateeCustom ): LoDashImplicitWrapper>; /** @@ -5885,7 +5925,7 @@ declare namespace _ { */ keyBy( this: LoDashImplicitWrapper, - iteratee?: ObjectIteratee + iteratee?: ObjectIterateeCustom ): LoDashImplicitWrapper>; /** @@ -5893,17 +5933,25 @@ declare namespace _ { */ keyBy( this: LoDashImplicitWrapper | null | undefined>, - iteratee?: NumericDictionaryIteratee + iteratee?: NumericDictionaryIterateeCustom ): LoDashImplicitWrapper>; } interface LoDashExplicitWrapper { + /** + * @see _.keyBy + */ + keyBy( + this: LoDashExplicitWrapper, + iteratee?: StringIterator + ): LoDashExplicitWrapper>; + /** * @see _.keyBy */ keyBy( this: LoDashExplicitWrapper | null | undefined>, - iteratee?: ListIteratee + iteratee?: ListIterateeCustom ): LoDashExplicitWrapper>; /** @@ -5911,7 +5959,7 @@ declare namespace _ { */ keyBy( this: LoDashExplicitWrapper, - iteratee?: ObjectIteratee + iteratee?: ObjectIterateeCustom ): LoDashExplicitWrapper>; /** @@ -5919,7 +5967,7 @@ declare namespace _ { */ keyBy( this: LoDashExplicitWrapper | null | undefined>, - iteratee?: NumericDictionaryIteratee + iteratee?: NumericDictionaryIterateeCustom ): LoDashExplicitWrapper>; } @@ -6718,7 +6766,7 @@ declare namespace _ { */ reject( collection: List | null | undefined, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): T[]; /** @@ -6726,7 +6774,7 @@ declare namespace _ { */ reject( collection: T | null | undefined, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): Array; } @@ -6744,7 +6792,7 @@ declare namespace _ { */ reject( this: LoDashImplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): LoDashImplicitWrapper; /** @@ -6752,7 +6800,7 @@ declare namespace _ { */ reject( this: LoDashImplicitWrapper, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): LoDashImplicitWrapper>; } @@ -6770,7 +6818,7 @@ declare namespace _ { */ reject( this: LoDashExplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): LoDashExplicitWrapper; /** @@ -6778,7 +6826,7 @@ declare namespace _ { */ reject( this: LoDashExplicitWrapper, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): LoDashExplicitWrapper>; } @@ -6992,7 +7040,7 @@ declare namespace _ { */ some( collection: List | null | undefined, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): boolean; /** @@ -7000,7 +7048,7 @@ declare namespace _ { */ some( collection: T | null | undefined, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): boolean; /** @@ -7008,7 +7056,7 @@ declare namespace _ { */ some( collection: NumericDictionary | null | undefined, - predicate?: NumericDictionaryIterateeBoolean + predicate?: NumericDictionaryIterateeCustom ): boolean; } @@ -7018,7 +7066,7 @@ declare namespace _ { */ some( this: LoDashImplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): boolean; /** @@ -7026,7 +7074,7 @@ declare namespace _ { */ some( this: LoDashImplicitWrapper, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): boolean; /** @@ -7034,7 +7082,7 @@ declare namespace _ { */ some( this: LoDashImplicitWrapper | null | undefined>, - predicate?: NumericDictionaryIterateeBoolean + predicate?: NumericDictionaryIterateeCustom ): boolean; } @@ -7044,7 +7092,7 @@ declare namespace _ { */ some( this: LoDashExplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): LoDashExplicitWrapper; /** @@ -7052,7 +7100,7 @@ declare namespace _ { */ some( this: LoDashExplicitWrapper, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): LoDashExplicitWrapper; /** @@ -7060,7 +7108,7 @@ declare namespace _ { */ some( this: LoDashExplicitWrapper | null | undefined>, - predicate?: NumericDictionaryIterateeBoolean + predicate?: NumericDictionaryIterateeCustom ): LoDashExplicitWrapper; } @@ -9315,14 +9363,16 @@ declare namespace _ { /** * @see _.conformsTo */ - conformsTo(source: ConformsPredicateObject): boolean; + conformsTo(this: LoDashImplicitWrapper, source: ConformsPredicateObject): boolean; + // Note: we can't use TValue here, because it generates a typescript error when strictFunctionTypes is enabled. } interface LoDashExplicitWrapper { /** * @see _.conformsTo */ - conformsTo(source: ConformsPredicateObject): LoDashExplicitWrapper; + conformsTo(this: LoDashImplicitWrapper, source: ConformsPredicateObject): LoDashExplicitWrapper; + // Note: we can't use TValue here, because it generates a typescript error when strictFunctionTypes is enabled. } type CondPair = [(val: T) => boolean, (val: T) => R] @@ -10723,7 +10773,7 @@ declare namespace _ { /** * @see _.toArray */ - //toArray(): LoDashImplicitWrapper>; + toArray(this: LoDashImplicitWrapper): LoDashImplicitWrapper>; } interface LoDashExplicitWrapper { @@ -10735,7 +10785,7 @@ declare namespace _ { /** * @see _.toArray */ - //toArray(): LoDashExplicitWrapper>; + toArray(this: LoDashImplicitWrapper): LoDashExplicitWrapper>; } //_.toPlainObject @@ -17019,13 +17069,13 @@ declare namespace _ { type ArrayIterator = (value: T, index: number, collection: T[]) => TResult; type ListIterator = (value: T, index: number, collection: List) => TResult; type ListIteratee = ListIterator | string | [string, any] | PartialDeep; - type ListIterateeBoolean = ListIterator | string | [string, any] | PartialDeep; + type ListIterateeCustom = ListIterator | string | [string, any] | PartialDeep; type ListIteratorTypeGuard = (value: T, index: number, collection: List) => value is S; // Note: key should be string, not keyof T, because the actual object may contain extra properties that were not specified in the type. type ObjectIterator = (value: TObject[keyof TObject], key: string, collection: TObject) => TResult; type ObjectIteratee = ObjectIterator | string | [string, any] | PartialDeep; - type ObjectIterateeBoolean = ObjectIterator | string | [string, any] | PartialDeep; + type ObjectIterateeCustom = ObjectIterator | string | [string, any] | PartialDeep; type ObjectIteratorTypeGuard = (value: TObject[keyof TObject], key: string, collection: TObject) => value is S; type DictionaryIterator = ObjectIterator, TResult>; @@ -17034,7 +17084,7 @@ declare namespace _ { type NumericDictionaryIterator = (value: T, key: number, collection: NumericDictionary) => TResult; type NumericDictionaryIteratee = NumericDictionaryIterator | string | [string, any] | PartialDeep; - type NumericDictionaryIterateeBoolean = NumericDictionaryIterator | string | [string, any] | PartialDeep; + type NumericDictionaryIterateeCustom = NumericDictionaryIterator | string | [string, any] | PartialDeep; type StringIterator = (char: string, index: number, string: string) => TResult; diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index e40569204d..cca7c239c7 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -4,86 +4,19 @@ interface IFoodOrganic { name: string; organic: boolean; } - -interface IFoodType { - name: string; - type: string; -} - -interface IFoodCombined { - name: string; - organic: boolean; - type: string; -} - -interface IStoogesQuote { - name: string; - quotes: string[]; -} - interface IStoogesAge { name: string; age: number; } -interface IStoogesCombined { - name: string; - age: number; - quotes: string[]; -} - -interface IKey { - dir: string; - code: number; -} - -interface IDictionary { - [index: string]: T; -} - const foodsOrganic: IFoodOrganic[] = [ { name: 'banana', organic: true }, { name: 'beet', organic: false }, ]; -const foodsType: IFoodType[] = [ - { name: 'apple', type: 'fruit' }, - { name: 'banana', type: 'fruit' }, - { name: 'beet', type: 'vegetable' } -]; -const foodsCombined: IFoodCombined[] = [ - { 'name': 'apple', 'organic': false, 'type': 'fruit' }, - { 'name': 'carrot', 'organic': true, 'type': 'vegetable' } -]; - -const stoogesQuotes: IStoogesQuote[] = [ - { 'name': 'curly', 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] }, - { 'name': 'moe', 'quotes': ['Spread out!', 'You knucklehead!'] } -]; const stoogesAges: IStoogesAge[] = [ { 'name': 'moe', 'age': 40 }, { 'name': 'larry', 'age': 50 } ]; -const stoogesAgesDict: IDictionary = { - first: { 'name': 'moe', 'age': 40 }, - second: { 'name': 'larry', 'age': 50 } -}; -const stoogesCombined: IStoogesCombined[] = [ - { 'name': 'curly', 'age': 30, 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] }, - { 'name': 'moe', 'age': 40, 'quotes': ['Spread out!', 'You knucklehead!'] } -]; - -const keys: IKey[] = [ - { 'dir': 'left', 'code': 97 }, - { 'dir': 'right', 'code': 100 } -]; - -class Dog { - constructor(public name: string) { } - - bark() { - // Woof - } -} let result: any; @@ -4591,9 +4524,9 @@ namespace TestFilter { let obj: any = {}; let dictionary: _.Dictionary | null | undefined = obj; - let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; - let listIterator: (value: TResult, index: number, collection: _.List) => any = (value: TResult, index: number, collection: _.List) => 1; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any = (value: TResult, key: string, collection: _.Dictionary) => 1; + let stringIterator = (char: string, index: number, string: string) => true; + let listIterator = (value: TResult, index: number, collection: _.List) => true; + let dictionaryIterator = (value: TResult, key: string, collection: _.Dictionary) => true; { let result: string[]; @@ -5207,7 +5140,7 @@ namespace TestFlatMapDepth { let listIterator: (value: number|number[], index: number, collection: _.List) => _.ListOfRecursiveArraysOrValues = (a, b, c) =>[ 1]; - let dictionaryIterator: (value: number|number[], key: number, collection: _.Dictionary) => _.ListOfRecursiveArraysOrValues = (a, b, c) => [1]; + let dictionaryIterator: (value: number|number[], key: string, collection: _.Dictionary) => _.ListOfRecursiveArraysOrValues = (a, b, c) => [1]; let numericDictionaryIterator: (value: number|number[], key: number, collection: _.NumericDictionary) => _.ListOfRecursiveArraysOrValues = (a, b, c) => [1]; @@ -5776,8 +5709,8 @@ namespace TestGroupBy { { let result: _.Dictionary; - result = _.groupBy(''); - result = _.groupBy('', stringIterator); + result = _.groupBy(''); + result = _.groupBy('', stringIterator); } { @@ -5909,16 +5842,16 @@ namespace TestKeyBy { let dictionary: _.Dictionary | null | undefined = obj; let numericDictionary: _.NumericDictionary | null | undefined = obj; - let stringIterator: (value: string, index: number, collection: string) => any = (value: string, index: number, collection: string) => 1; - let listIterator: (value: SampleObject, index: number, collection: _.List) => any = (value: SampleObject, index: number, collection: _.List) => 1; - let dictionaryIterator: (value: SampleObject, key: string, collection: _.Dictionary) => any = (value: SampleObject, key: string, collection: _.Dictionary) => 1; - let numericDictionaryIterator: (value: SampleObject, key: number, collection: _.NumericDictionary) => any = (value: SampleObject, key: number, collection: _.NumericDictionary) => 1; + let stringIterator = (value: string, index: number, collection: string) => "a"; + let listIterator = (value: SampleObject, index: number, collection: _.List) => 1; + let dictionaryIterator = (value: SampleObject, key: string, collection: _.Dictionary) => Symbol.name; + let numericDictionaryIterator = (value: SampleObject, key: number, collection: _.NumericDictionary) => "a"; { let result: _.Dictionary; - result = _.keyBy('abcd'); - result = _.keyBy('abcd', stringIterator); + result = _.keyBy('abcd'); + result = _.keyBy('abcd', stringIterator); } { @@ -6464,9 +6397,9 @@ namespace TestReject { let obj: any = {}; let dictionary: _.Dictionary | null | undefined = obj; - let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; - let listIterator: (value: TResult, index: number, collection: _.List) => any = (value: TResult, index: number, collection: _.List) => 1; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any = (value: TResult, key: string, collection: _.Dictionary) => 1; + let stringIterator = (char: string, index: number, string: string) => true; + let listIterator = (value: TResult, index: number, collection: _.List) => true; + let dictionaryIterator = (value: TResult, key: string, collection: _.Dictionary) => true; { let result: string[]; @@ -8667,9 +8600,7 @@ namespace TestIsEqual { // _.isEqualWith namespace TestIsEqualWith { - let customizer = (value: any, other: any, indexOrKey: number|string|undefined, parent: any, otherParent: any, stack: any) => { - return value ? undefined : true; - }; + let customizer = (value: any, other: any, indexOrKey: number|string|symbol|undefined, parent: any, otherParent: any, stack: any) => true; { let result: boolean; @@ -8873,7 +8804,7 @@ namespace TestIsMatch { // _.isMatchWith namespace TestIsMatchWith { - let testIsMatchCustiomizerFn = (value: any, other: any, indexOrKey: number|string) => true; + let testIsMatchCustiomizerFn = (value: any, other: any, indexOrKey: number|string|symbol) => true; let result: boolean; From a8408bce17669bd6bb0516890347dea6cf0c1578 Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Sat, 18 Nov 2017 22:57:55 -0500 Subject: [PATCH 10/90] lodash: revert back to old constant types. The old types seem to work again, so no need to use the workaround. --- types/lodash/index.d.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index 5be5358b4b..a19f4aa4a1 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -16128,18 +16128,14 @@ declare namespace _ { /** * @see _.constant */ - constant(this: LoDashImplicitWrapper): LoDashImplicitWrapper<() => T>; - // Note: we can't use TValue here because of an issue with dtslint. Using T as a workaround; change back to TValue once dtsLint is working. - // constant(): LoDashImplicitWrapper<() => TValue>; + constant(): LoDashImplicitWrapper<() => TValue>; } interface LoDashExplicitWrapper { /** * @see _.constant */ - constant(this: LoDashExplicitWrapper): LoDashExplicitWrapper<() => T>; - // Note: we can't use TValue here because of an issue with dtslint. Using T as a workaround; change back to TValue once dtsLint is working. - // constant(): LoDashExplicitWrapper<() => TValue>; + constant(): LoDashExplicitWrapper<() => TValue>; } //_.defaultTo From 934892c37d7ba758cd3f3f09d8a7fff1bcc807c0 Mon Sep 17 00:00:00 2001 From: johanblumenberg Date: Sun, 19 Nov 2017 12:44:22 +0100 Subject: [PATCH 11/90] Update css types Make all of the AtRule interfaces inherit from Node. Break out StyleRules from Stylesheet, as it's own type. This is useful when using rework, which is only given the Stylesheet.stylesheet object. Change StyleRules proeprty rules to be mandatory. It is always set. --- types/css/index.d.ts | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/types/css/index.d.ts b/types/css/index.d.ts index c892d5c3a2..be8f1323a0 100644 --- a/types/css/index.d.ts +++ b/types/css/index.d.ts @@ -112,7 +112,7 @@ export interface Comment extends Node { /** * The @charset at-rule. */ -export interface Charset { +export interface Charset extends Node { /** The part following @charset. */ charset?: string; } @@ -120,7 +120,7 @@ export interface Charset { /** * The @custom-media at-rule */ -export interface CustomMedia { +export interface CustomMedia extends Node { /** The ---prefixed name. */ name?: string; /** The part following the name. */ @@ -130,7 +130,7 @@ export interface CustomMedia { /** * The @document at-rule. */ -export interface Document { +export interface Document extends Node { /** The part following @document. */ document?: string; /** The vendor prefix in @document, or undefined if there is none. */ @@ -142,7 +142,7 @@ export interface Document { /** * The @font-face at-rule. */ -export interface FontFace { +export interface FontFace extends Node { /** Array of nodes with the types declaration and comment. */ declarations?: Array; } @@ -150,7 +150,7 @@ export interface FontFace { /** * The @host at-rule. */ -export interface Host { +export interface Host extends Node { /** Array of nodes with the types rule, comment and any of the at-rule types. */ rules?: Array; } @@ -158,7 +158,7 @@ export interface Host { /** * The @import at-rule. */ -export interface Import { +export interface Import extends Node { /** The part following @import. */ import?: string; } @@ -166,7 +166,7 @@ export interface Import { /** * The @keyframes at-rule. */ -export interface KeyFrames { +export interface KeyFrames extends Node { /** The name of the keyframes rule. */ name?: string; /** The vendor prefix in @keyframes, or undefined if there is none. */ @@ -175,7 +175,7 @@ export interface KeyFrames { keyframes?: Array; } -export interface KeyFrame { +export interface KeyFrame extends Node { /** The list of "selectors" of the keyframe rule, split on commas. Each “selector” is trimmed from whitespace. */ values?: Array; /** Array of nodes with the types declaration and comment. */ @@ -185,7 +185,7 @@ export interface KeyFrame { /** * The @media at-rule. */ -export interface Media { +export interface Media extends Node { /** The part following @media. */ media?: string; /** Array of nodes with the types rule, comment and any of the at-rule types. */ @@ -195,7 +195,7 @@ export interface Media { /** * The @namespace at-rule. */ -export interface Namespace { +export interface Namespace extends Node { /** The part following @namespace. */ namespace?: string; } @@ -203,7 +203,7 @@ export interface Namespace { /** * The @page at-rule. */ -export interface Page { +export interface Page extends Node { /** The list of selectors of the rule, split on commas. Each selector is trimmed from whitespace and comments. */ selectors?: Array; /** Array of nodes with the types declaration and comment. */ @@ -213,7 +213,7 @@ export interface Page { /** * The @supports at-rule. */ -export interface Supports { +export interface Supports extends Node { /** The part following @supports. */ supports?: string; /** Array of nodes with the types rule, comment and any of the at-rule types. */ @@ -223,16 +223,21 @@ export interface Supports { /** All at-rules. */ export type AtRule = Charset | CustomMedia | Document | FontFace | Host | Import | KeyFrames | Media | Namespace | Page | Supports; +/** + * A collection of rules + */ +export interface StyleRules { + /** Array of nodes with the types rule, comment and any of the at-rule types. */ + rules: Array; + /** Array of Errors. Errors collected during parsing when option silent is true. */ + parsingErrors?: Array +} + /** * The root node returned by css.parse. */ export interface Stylesheet extends Node { - stylesheet?: { - /** Array of nodes with the types rule, comment and any of the at-rule types. */ - rules?: Array; - /** Array of Errors. Errors collected during parsing when option silent is true. */ - parsingErrors?: Array - }; + stylesheet?: StyleRules; } // --------------------------------------------------------------------------------- From c49ab1c37bf43923cf784c6ce1db584ccaffad9a Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Sun, 19 Nov 2017 08:19:44 -0500 Subject: [PATCH 12/90] lodash: fix compile error with _.pick --- types/lodash/index.d.ts | 19 +++++++++++++++++++ types/lodash/lodash-tests.ts | 16 +++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index a19f4aa4a1..a0eaef941c 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -14398,6 +14398,9 @@ declare namespace _ { ...props: Array> ): Pick; + /** + * @see _.pick + */ pick( object: T | null | undefined, ...props: PropertyPath[] @@ -14405,6 +14408,14 @@ declare namespace _ { } interface LoDashImplicitWrapper { + /** + * @see _.pick + */ + pick( + this: LoDashImplicitWrapper, + ...props: Array> + ): LoDashImplicitWrapper>; + /** * @see _.pick */ @@ -14415,6 +14426,14 @@ declare namespace _ { } interface LoDashExplicitWrapper { + /** + * @see _.pick + */ + pick( + this: LoDashExplicitWrapper, + ...props: Array> + ): LoDashExplicitWrapper>; + /** * @see _.pick */ diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index cca7c239c7..dbefb1abaa 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -11821,7 +11821,7 @@ namespace TestPick { { let result: Pick; result = _.pick(obj, 'a', 'b'); - result = _.pick(obj, ['a', 'b']); + result = _.pick(obj, ['a' as 'a', 'b' as 'b']); } { @@ -11832,6 +11832,13 @@ namespace TestPick { result = _(obj).pick(['b', 1], 0, 'a'); } + { + let result: _.LoDashImplicitWrapper>; + + result = _(obj).pick('a', 'b'); + result = _(obj).pick(['a' as 'a', 'b' as 'b']); + } + { let result: _.LoDashExplicitWrapper>; @@ -11839,6 +11846,13 @@ namespace TestPick { result = _(obj).chain().pick(0, 'a'); result = _(obj).chain().pick(['b', 1], 0, 'a'); } + + { + let result: _.LoDashExplicitWrapper>; + + result = _(obj).chain().pick('a', 'b'); + result = _(obj).chain().pick(['a' as 'a', 'b' as 'b']); + } } // _.pickBy From ef5a0d3661348381847b0f4de187cc7e81dda9ec Mon Sep 17 00:00:00 2001 From: Oleg Repin Date: Mon, 20 Nov 2017 19:19:11 +0300 Subject: [PATCH 13/90] [puppeteer] NavigationOptions.waitUntil fix NavigationOptions.waitUntil could be array according to https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagegobackoptions --- types/puppeteer/index.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/types/puppeteer/index.d.ts b/types/puppeteer/index.d.ts index f92bedd135..065cbab7b4 100644 --- a/types/puppeteer/index.d.ts +++ b/types/puppeteer/index.d.ts @@ -249,6 +249,12 @@ export interface EmulateOptions { export type EvaluateFn = string | ((...args: any[]) => any); +export type LoadEvent = + | "load" + | "domcontentloaded" + | "networkidle0" + | "networkidle2"; + /** The navigation options. */ export interface NavigationOptions { /** @@ -260,7 +266,7 @@ export interface NavigationOptions { * When to consider navigation succeeded. * @default load Navigation is consider when the `load` event is fired. */ - waitUntil?: "load" | "domcontentloaded" | "networkidle0" | "networkidle2"; + waitUntil?: LoadEvent | LoadEvent[]; } export type PDFFormat = From 3962926dc14798e685f9f2e49821ac1c33afc0d1 Mon Sep 17 00:00:00 2001 From: Jeff Jacobson Date: Mon, 20 Nov 2017 16:00:41 -0800 Subject: [PATCH 14/90] Revert "Modified typedefs dependent on "geojson" to accommodate changes." This reverts commit 335d12a4ee9af8e7f0c25dc6fe93a059e3ee9fa9. --- types/d3-geo/d3-geo-tests.ts | 4 ++-- types/d3-geo/index.d.ts | 4 +--- types/geojson2osm/geojson2osm-tests.ts | 2 +- types/geojson2osm/index.d.ts | 2 +- types/leaflet/index.d.ts | 28 +++++++++++++------------- types/leaflet/v0/index.d.ts | 12 +++++------ types/mapbox-gl/index.d.ts | 8 ++++---- types/polyline/index.d.ts | 2 +- types/shapefile/index.d.ts | 4 ++-- types/supercluster/index.d.ts | 2 +- types/tilebelt/index.d.ts | 4 ++-- 11 files changed, 35 insertions(+), 37 deletions(-) diff --git a/types/d3-geo/d3-geo-tests.ts b/types/d3-geo/d3-geo-tests.ts index e6014837a7..876461e3e9 100644 --- a/types/d3-geo/d3-geo-tests.ts +++ b/types/d3-geo/d3-geo-tests.ts @@ -49,7 +49,7 @@ const sampleExtendedGeometryCollection: d3Geo.ExtendedGeometryCollection = { type: 'Feature', geometry: samplePolygon, properties: { @@ -74,7 +74,7 @@ const sampleExtendedFeature2: d3Geo.ExtendedFeature = { type: 'FeatureCollection', features: [ sampleFeature, diff --git a/types/d3-geo/index.d.ts b/types/d3-geo/index.d.ts index 1d1d36fe91..4093b696e9 100644 --- a/types/d3-geo/index.d.ts +++ b/types/d3-geo/index.d.ts @@ -36,9 +36,7 @@ export type GeoGeometryObjects = GeoJSON.GeometryObject | GeoSphere; export interface ExtendedGeometryCollection { type: string; bbox?: number[]; - // GeoJSON removed the Coordinate System objects from the spec, but does allow - // "foreign members". - crs?: GeoJSON.GeoJsonObject; + crs?: GeoJSON.CoordinateReferenceSystem; geometries: GeometryType[]; } diff --git a/types/geojson2osm/geojson2osm-tests.ts b/types/geojson2osm/geojson2osm-tests.ts index 9d95de64c4..887f10a83c 100644 --- a/types/geojson2osm/geojson2osm-tests.ts +++ b/types/geojson2osm/geojson2osm-tests.ts @@ -1,6 +1,6 @@ import { geojson2osm } from 'geojson2osm' -const features: GeoJSON.FeatureCollection = { +const features: GeoJSON.FeatureCollection = { type: 'FeatureCollection', features: [{ type: 'Feature', diff --git a/types/geojson2osm/index.d.ts b/types/geojson2osm/index.d.ts index 513348eeae..39b03de5bf 100644 --- a/types/geojson2osm/index.d.ts +++ b/types/geojson2osm/index.d.ts @@ -11,4 +11,4 @@ * @param features Input features * @returns OpenStreetMap XML */ -export function geojson2osm(features: GeoJSON.Feature | GeoJSON.FeatureCollection): any +export function geojson2osm(features: GeoJSON.Feature | GeoJSON.FeatureCollection): any diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index 727478864a..b1e7ead796 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -583,7 +583,7 @@ export interface PolylineOptions extends PathOptions { export class Polyline extends Path { constructor(latlngs: LatLngExpression[], options?: PolylineOptions); - toGeoJSON(): geojson.Feature; + toGeoJSON(): geojson.Feature; getLatLngs(): LatLng[]; setLatLngs(latlngs: LatLngExpression[]): this; isEmpty(): boolean; @@ -591,7 +591,7 @@ export class Polyline; options: PolylineOptions; } @@ -616,14 +616,14 @@ export interface CircleMarkerOptions extends PathOptions { export class CircleMarker

extends Path { constructor(latlng: LatLngExpression, options?: CircleMarkerOptions); - toGeoJSON(): geojson.Feature; + toGeoJSON(): geojson.Feature; setLatLng(latLng: LatLngExpression): this; getLatLng(): LatLng; setRadius(radius: number): this; getRadius(): number; options: CircleMarkerOptions; - feature?: geojson.Feature; + feature?: geojson.Feature; } export function circleMarker(latlng: LatLngExpression, options?: CircleMarkerOptions): CircleMarker; @@ -671,7 +671,7 @@ export class LayerGroup

extends Layer { /** * Returns a GeoJSON representation of the layer group (as a GeoJSON GeometryCollection, GeoJSONFeatureCollection or Multipoint). */ - toGeoJSON(): geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection; + toGeoJSON(): geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection; /** * Adds the given layer to the group. @@ -725,7 +725,7 @@ export class LayerGroup

extends Layer { */ getLayerId(layer: Layer): number; - feature?: geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection; + feature?: geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection; } /** @@ -765,7 +765,7 @@ export class FeatureGroup

extends LayerGroup

{ */ export function featureGroup(layers?: Layer[]): FeatureGroup; -export type StyleFunction

= (feature?: geojson.Feature) => PathOptions; +export type StyleFunction

= (feature?: geojson.Feature) => PathOptions; export interface GeoJSONOptions

extends LayerOptions { /** @@ -781,7 +781,7 @@ export interface GeoJSONOptions

extends LayerOptions { * } * ``` */ - pointToLayer?(geoJsonPoint: geojson.Feature, latlng: LatLng): Layer; // should import GeoJSON typings + pointToLayer?(geoJsonPoint: geojson.Feature, latlng: LatLng): Layer; // should import GeoJSON typings /** * A Function defining the Path options for styling GeoJSON lines and polygons, @@ -807,7 +807,7 @@ export interface GeoJSONOptions

extends LayerOptions { * function (feature, layer) {} * ``` */ - onEachFeature?(feature: geojson.Feature, layer: Layer): void; + onEachFeature?(feature: geojson.Feature, layer: Layer): void; /** * A Function that will be used to decide whether to show a feature or not. @@ -820,7 +820,7 @@ export interface GeoJSONOptions

extends LayerOptions { * } * ``` */ - filter?(geoJsonFeature: geojson.Feature): boolean; + filter?(geoJsonFeature: geojson.Feature): boolean; /** * A Function that will be used for converting GeoJSON coordinates to LatLngs. @@ -838,7 +838,7 @@ export class GeoJSON

extends FeatureGroup

{ * Creates a Layer from a given GeoJSON feature. Can use a custom pointToLayer * and/or coordsToLatLng functions if provided as options. */ - static geometryToLayer(featureData: geojson.Feature, options?: GeoJSONOptions): Layer; + static geometryToLayer

(featureData: geojson.Feature, options?: GeoJSONOptions

): Layer; /** * Creates a LatLng object from an array of 2 numbers (longitude, latitude) or @@ -872,7 +872,7 @@ export class GeoJSON

extends FeatureGroup

{ /** * Normalize GeoJSON geometries/features into GeoJSON features. */ - static asFeature(geojson: geojson.Feature | geojson.GeometryObject): geojson.Feature; + static asFeature

(geojson: geojson.Feature | geojson.GeometryObject): geojson.Feature; constructor(geojson?: geojson.GeoJsonObject, options?: GeoJSONOptions

) /** @@ -1454,7 +1454,7 @@ export interface MarkerOptions extends InteractiveLayerOptions { export class Marker

extends Layer { constructor(latlng: LatLngExpression, options?: MarkerOptions); - toGeoJSON(): geojson.Feature; + toGeoJSON(): geojson.Feature; getLatLng(): LatLng; setLatLng(latlng: LatLngExpression): this; setZIndexOffset(offset: number): this; @@ -1465,7 +1465,7 @@ export class Marker

extends Layer { // Properties options: MarkerOptions; dragging?: Handler; - feature?: geojson.Feature; + feature?: geojson.Feature; } export function marker(latlng: LatLngExpression, options?: MarkerOptions): Marker; diff --git a/types/leaflet/v0/index.d.ts b/types/leaflet/v0/index.d.ts index d841a45133..efadd88e8f 100644 --- a/types/leaflet/v0/index.d.ts +++ b/types/leaflet/v0/index.d.ts @@ -223,7 +223,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the circle (GeoJSON Point Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; } } @@ -1716,7 +1716,7 @@ declare namespace L { * Returns a GeoJSON representation of the layer group (GeoJSON FeatureCollection). * Note: Descendent classes MultiPolygon & MultiPolyLine return `Feature`s, not `FeatureCollection`s */ - toGeoJSON(): GeoJSON.FeatureCollection|GeoJSON.Feature; + toGeoJSON(): GeoJSON.FeatureCollection|GeoJSON.Feature; //////////// //////////// @@ -2943,7 +2943,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the marker (GeoJSON Point Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; /** * Marker dragging handler (by both mouse and touch). @@ -3103,7 +3103,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the multipolygon (GeoJSON MultiPolygon Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; } } @@ -3144,7 +3144,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the multipolyline (GeoJSON MultiLineString Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; } } @@ -3565,7 +3565,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the polyline (GeoJSON LineString Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; } } diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index 6e61c90c70..6be9a465ef 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -54,9 +54,9 @@ declare namespace mapboxgl { unproject(point: PointLike): mapboxgl.LngLat; - queryRenderedFeatures(pointOrBox?: PointLike | PointLike[], parameters?: {layers?: string[], filter?: any[]}): GeoJSON.Feature[]; + queryRenderedFeatures(pointOrBox?: PointLike | PointLike[], parameters?: {layers?: string[], filter?: any[]}): GeoJSON.Feature[]; - querySourceFeatures(sourceID: string, parameters?: {sourceLayer?: string, filter?: any[]}): GeoJSON.Feature[]; + querySourceFeatures(sourceID: string, parameters?: {sourceLayer?: string, filter?: any[]}): GeoJSON.Feature[]; setStyle(style: mapboxgl.Style | string): this; @@ -507,11 +507,11 @@ declare namespace mapboxgl { constructor(options?: mapboxgl.GeoJSONSourceOptions); - setData(data: GeoJSON.Feature | GeoJSON.FeatureCollection | String): this; + setData(data: GeoJSON.Feature | GeoJSON.FeatureCollection | String): this; } export interface GeoJSONSourceOptions { - data?: GeoJSON.Feature | GeoJSON.FeatureCollection | string; + data?: GeoJSON.Feature | GeoJSON.FeatureCollection | string; maxzoom?: number; diff --git a/types/polyline/index.d.ts b/types/polyline/index.d.ts index 6961205212..7a8b7eeb19 100644 --- a/types/polyline/index.d.ts +++ b/types/polyline/index.d.ts @@ -9,7 +9,7 @@ interface Polyline { decode(string: string, precision?: number): number[][]; encode(coordinate: number[][], precision?: number): string; - fromGeoJSON(geojson: GeoJSON.LineString | GeoJSON.Feature, precision?: number): string; + fromGeoJSON(geojson: GeoJSON.LineString | GeoJSON.Feature, precision?: number): string; } declare var polyline: Polyline; diff --git a/types/shapefile/index.d.ts b/types/shapefile/index.d.ts index 83852507e1..54a18a2503 100644 --- a/types/shapefile/index.d.ts +++ b/types/shapefile/index.d.ts @@ -15,7 +15,7 @@ declare namespace shapefile { } interface Feature { done: boolean - value: GeoJSON.Feature + value: GeoJSON.Feature } interface Shapefile { bbox: Array @@ -23,7 +23,7 @@ declare namespace shapefile { } interface ShapefileStatic { open(shp: any, dbf?: any, options?: Options): Promise; - read(shp: any, dbf?: any, options?: Options): Promise; + read(shp: any, dbf?: any, options?: Options): Promise>; } } diff --git a/types/supercluster/index.d.ts b/types/supercluster/index.d.ts index 7463b4a43a..7fd487ae09 100644 --- a/types/supercluster/index.d.ts +++ b/types/supercluster/index.d.ts @@ -94,7 +94,7 @@ export class Supercluster { */ export default function supercluster(options: Options): Supercluster; -export type Point = GeoJSON.Feature; +export type Point = GeoJSON.Feature; export type Points = Point[]; export type Clusters = Cluster[]; export type TileFeatures = TileFeature[]; diff --git a/types/tilebelt/index.d.ts b/types/tilebelt/index.d.ts index eed92f915b..f8d3adae1c 100644 --- a/types/tilebelt/index.d.ts +++ b/types/tilebelt/index.d.ts @@ -14,12 +14,12 @@ declare namespace tilebelt { * * @name tileToGeoJSON * @param {Array} tile - * @returns {Feature} + * @returns {Feature} * @example * var poly = tileToGeoJSON([5, 10, 10]) * //=poly */ - tileToGeoJSON(tile: Array): GeoJSON.Feature + tileToGeoJSON(tile: Array): GeoJSON.Feature /** * Get the bbox of a tile From f12705b83b35eb0c9c96aaf6211113431738022a Mon Sep 17 00:00:00 2001 From: Jeff Jacobson Date: Mon, 20 Nov 2017 16:23:57 -0800 Subject: [PATCH 15/90] Made revisions suggested by other devs. * Corrected number of elements for 3D bounding boxes. (Mistakenly had five elements instead of six.) * Renamed "BoundingBox" to "BBox" to shorten name. * Restored generic types to Feature and FeatureCollection. * Removed the support for foreign members on GeoJsonObject. Users can instead extend the interface or use "&". --- types/geojson/geojson-tests.ts | 37 +++++++++------------------- types/geojson/index.d.ts | 44 ++++++++++++++++++++-------------- 2 files changed, 37 insertions(+), 44 deletions(-) diff --git a/types/geojson/geojson-tests.ts b/types/geojson/geojson-tests.ts index c9042c9da2..ce8c62418e 100644 --- a/types/geojson/geojson-tests.ts +++ b/types/geojson/geojson-tests.ts @@ -1,9 +1,10 @@ import { + BBox, Feature, FeatureCollection, GeometryCollection, LineString, - MultiLineString, MultiPoint, MultiPolygon, Point, Polygon + MultiLineString, MultiPoint, MultiPolygon, Point, Polygon, GeometryObject } from "geojson"; -let featureCollection: FeatureCollection = { +let featureCollection: FeatureCollection = { type: "FeatureCollection", features: [ { @@ -49,20 +50,10 @@ let featureCollection: FeatureCollection = { } } } - ], - // Coordinate Systems no longer supported in GeoJSON as of RFC 7946. - // This will still work due to the standard's allowance for - // "foregin members", however. - crs: { - type: "link", - properties: { - href: "http://example.com/crs/42", - type: "proj4" - } - } + ] }; -const featureWithPolygon: Feature = { +const featureWithPolygon: Feature = { type: "Feature", bbox: [-180.0, -90.0, 180.0, 90.0], geometry: { @@ -138,11 +129,12 @@ const geometryCollection: GeometryCollection = { ] }; -let feature: Feature = { +let feature: Feature = { type: "Feature", geometry: lineString, properties: null }; + feature = { type: "Feature", geometry: polygon, @@ -206,18 +198,11 @@ featureCollection = { geometry: geometryCollection, properties: { test: "OK" } } - ], - crs: { - type: "link", - properties: { - href: "http://example.com/crs/42", - type: "proj4" - } - } + ] }; // Allow access to custom properties -const pt: Feature = { +const pt: Feature = { type: "Feature", properties: { foo: "bar", @@ -250,7 +235,7 @@ const testProps: TestProperty = { hello: "world" }; -const typedPropertiesFeature: Feature = { +const typedPropertiesFeature: Feature = { type: "Feature", properties: testProps, geometry: { @@ -259,7 +244,7 @@ const typedPropertiesFeature: Feature = { } }; -const typedPropertiesFeatureCollection: FeatureCollection = { +const typedPropertiesFeatureCollection: FeatureCollection = { type: "FeatureCollection", features: [typedPropertiesFeature] }; diff --git a/types/geojson/index.d.ts b/types/geojson/index.d.ts index 2b086bc382..936756ff86 100644 --- a/types/geojson/index.d.ts +++ b/types/geojson/index.d.ts @@ -15,45 +15,51 @@ export as namespace GeoJSON; * The valid values for the "type" property of GeoJSON geometry objects. * https://tools.ietf.org/html/rfc7946#section-1.4 */ -export type GeoJsonGeometryTypeNames = "Point" | "LineString" | "MultiPoint" | "Polygon" | "MultiLineString" | +export type GeoJsonGeometryTypes = "Point" | "LineString" | "MultiPoint" | "Polygon" | "MultiLineString" | "MultiPolygon" | "GeometryCollection"; /** * The value values for the "type" property of GeoJSON Objects. * https://tools.ietf.org/html/rfc7946#section-1.4 */ -export type GeoJsonTypeNames = "FeatureCollection" | "Feature" | GeoJsonGeometryTypeNames; +export type GeoJsonTypes = "FeatureCollection" | "Feature" | GeoJsonGeometryTypes; /** * Bounding box * https://tools.ietf.org/html/rfc7946#section-5 */ -export type BoundingBox = [number, number, number, number] | [number, number, number, number, number]; +export type BBox = [number, number, number, number] | [number, number, number, number, number, number]; /** * A Position is an array of coordinates. * https://tools.ietf.org/html/rfc7946#section-3.1.1 + * Array should contain between two and three elements. + * The previous GeoJSON specification allowed more elements (e.g., which could be used to represent M values), + * but the current specification only allows X, Y, and (optionally) Z to be defined. */ -export type Position = [number, number] | [number, number, number]; +export type Position = number[]; // [number, number] | [number, number, number]; /** * The base GeoJSON object. - * https://tools.ietf.org/html/rfc7946#section-3 + * https://tools.ietf.org/html/rfc7946#section-3 + * The GeoJSON specification also allows foreign members + * (https://tools.ietf.org/html/rfc7946#section-6.1) + * Developers should use "&" type in TypeScript or extend the interface + * to add these foreign members. */ export interface GeoJsonObject { - /** - * Allow foreign members as specified in https://tools.ietf.org/html/rfc7946#section-6.1 - */ - [key: string]: any; + // Don't include foreign members directly into this type def. + // in order to preserve type safety. + // [key: string]: any; /** * Specifies the type of GeoJSON object. */ - type: GeoJsonTypeNames; + type: GeoJsonTypes; /** * Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections. * https://tools.ietf.org/html/rfc7946#section-5 */ - bbox?: BoundingBox; + bbox?: BBox; } /** @@ -61,7 +67,7 @@ export interface GeoJsonObject { * https://tools.ietf.org/html/rfc7946#section-3 */ export interface GeometryObject extends GeoJsonObject { - type: GeoJsonGeometryTypeNames; + type: GeoJsonGeometryTypes; } /** @@ -124,19 +130,21 @@ export interface MultiPolygon extends GeometryObject { */ export interface GeometryCollection extends GeometryObject { type: "GeometryCollection"; - geometries: GeometryObject[]; + geometries: Array; } +export type GeoJsonProperties = { [name: string]: any; } | null; + /** * A feature object which contains a geometry and associated properties. * https://tools.ietf.org/html/rfc7946#section-3.2 */ -export interface Feature extends GeoJsonObject { +export interface Feature extends GeoJsonObject { type: "Feature"; /** * The feature's geometry */ - geometry: GeometryObject | null; + geometry: G | null; /** * A value that uniquely identifies this feature in a * https://tools.ietf.org/html/rfc7946#section-3.2. @@ -145,13 +153,13 @@ export interface Feature extends GeoJsonObject { /** * Properties associated with this feature. */ - properties: { [name: string]: any; } | null; + properties: P | null; } /** * A collection of feature objects. * https://tools.ietf.org/html/rfc7946#section-3.3 */ -export interface FeatureCollection extends GeoJsonObject { - features: Feature[]; +export interface FeatureCollection extends GeoJsonObject { + features: Array>; } From 2d23c6a91bd16e260ebe9688a91dd4851622f245 Mon Sep 17 00:00:00 2001 From: Jochen Becker Date: Tue, 21 Nov 2017 16:52:56 +0100 Subject: [PATCH 16/90] [cordova-plugin-keyboard] update to version 1.2.0 add methods "hide" and "show" --- .../cordova-plugin-keyboard-tests.ts | 34 +-- types/cordova-plugin-keyboard/index.d.ts | 195 +++++++++--------- 2 files changed, 124 insertions(+), 105 deletions(-) diff --git a/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts b/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts index 767eaa6ed2..8a707f057d 100644 --- a/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts +++ b/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts @@ -1,23 +1,31 @@ Keyboard.shrinkView(true); Keyboard.shrinkView(false); +Keyboard.shrinkView(null, (currentValue) => console.log(currentValue)); + Keyboard.hideFormAccessoryBar(true); Keyboard.hideFormAccessoryBar(false); +Keyboard.hideFormAccessoryBar(null, (currentValue) => console.log(currentValue)); + Keyboard.disableScrollingInShrinkView(true); Keyboard.disableScrollingInShrinkView(false); +Keyboard.disableScrollingInShrinkView(null, (currentValue) => console.log(currentValue)); + +Keyboard.hide(); + +Keyboard.show(); + if (Keyboard.isVisible) { console.log('Keyboard is visible'); } -Keyboard.automaticScrollToTopOnHiding = true; -Keyboard.onshow = function () { - console.log('onshow'); -}; -Keyboard.onhide = function () { - console.log('onhide'); -}; -Keyboard.onshowing = function () { - console.log('onshowing'); -}; -Keyboard.onhiding= function () { - console.log('onhiding'); -}; +Keyboard.automaticScrollToTopOnHiding = true; + +window.addEventListener('keyboardDidShow', () => console.log('keyboardDidShow')); + +window.addEventListener('keyboardDidHide', () => console.log('keyboardDidHide')); + +window.addEventListener('keyboardWillShow', () => console.log('keyboardWillShow')); + +window.addEventListener('keyboardWillHide', () => console.log('keyboardWillHide')); + +window.addEventListener('keyboardHeightWillChange', (event) => console.log(`keyboardHeightWillChange - keyboard height: ${event.keyboardHeight}`)); diff --git a/types/cordova-plugin-keyboard/index.d.ts b/types/cordova-plugin-keyboard/index.d.ts index 427a5425e5..6298050b2c 100644 --- a/types/cordova-plugin-keyboard/index.d.ts +++ b/types/cordova-plugin-keyboard/index.d.ts @@ -1,32 +1,9 @@ -// Type definitions for Apache Cordova Keyboard plugin v0.1.2 -// Project: https://github.com/apache/cordova-plugins/tree/master/keyboard -// Definitions by: Dan Manastireanu +// Type definitions for Apache Cordova Keyboard plugin v1.2.0 +// Project: https://github.com/cjpearson/cordova-plugin-keyboard +// Definitions by: Dan Manastireanu +// Jochen Becker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/** - * The Keyboard object provides some functions to customize the iOS keyboard. - * - * Supported Platforms: iOS - * - * This plugin has only been tested in Cordova 3.2 or greater, - * and its use in previous Cordova versions is not recommended - * (potential conflict with keyboard customization code present in the core in previous Cordova versions). - * - * If you do use this plugin in an older Cordova version (again, not recommended), - * you have to make sure the HideKeyboardFormAccessoryBar and KeyboardShrinksView preference values are always false, - * and only use the API functions to turn things on/off. - * - * This plugin supports the HideKeyboardFormAccessoryBar (boolean) - * and KeyboardShrinksView (boolean) preferences in config.xml. - * - * Permissions in config.xml - * - * - * - * - * - * - */ interface Keyboard { // Methods @@ -39,15 +16,20 @@ interface Keyboard { * This applies to apps that position their elements relative to the bottom of the WebView. * This is the default behaviour on Android, and makes a lot of sense when building apps as opposed to webpages. * + * Supported Platforms: + * - iOS + * * Example: * * Keyboard.shrinkView(true); * Keyboard.shrinkView(false); + * Keyboard.shrinkView(null, function (currentValue) { console.log(currentValue); }); * * * @param shrink + * @param successCallback A success callbackfunction */ - shrinkView(shrink:boolean): void, + shrinkView(shrink: boolean, successCallback?: (currentValue: any) => void): void, /** * Hide the keyboard toolbar. @@ -55,21 +37,29 @@ interface Keyboard { * Set to true to hide the additional toolbar that is on top of the keyboard. * This toolbar features the Prev, Next, and Done buttons. * + * Supported Platforms: + * - iOS + * * Example: * * Keyboard.hideFormAccessoryBar(true); * Keyboard.hideFormAccessoryBar(false); + * Keyboard.hideFormAccessoryBar(null, function (currentValue) { console.log(currentValue); }); * * * @param hide + * @param successCallback A success callbackfunction */ - hideFormAccessoryBar(hide:boolean): void, + hideFormAccessoryBar(hide: boolean, successCallback?: (currentValue: any) => void): void, /** * Disable scrolling when the the WebView is shrunk. * * Set to true to disable scrolling when the WebView is shrunk. * + * Supported Platforms: + * - iOS + * * Example: * * Keyboard.disableScrollingInShrinkView(true); @@ -77,8 +67,40 @@ interface Keyboard { * * * @param disable + * @param successCallback A success callbackfunction */ - disableScrollingInShrinkView(disable:boolean): void, + disableScrollingInShrinkView(disable: boolean, successCallback?: (currentValue: any) => void): void, + + /** + * Hide the keyboard + * + * Call this method to hide the keyboard + * + * Supported Platforms: + * - iOS + * - Android + * + * Example: + * + * Keyboard.hide(); + * + */ + hide(): void, + + /** + * Show the keyboard + * + * Call this method to show the keyboard. + * + * Supported Platforms: + * - Android + * + * Example: + * + * Keyboard.show(); + * + */ + show(): void, // Properties @@ -87,6 +109,9 @@ interface Keyboard { * * Read this property to determine if the keyboard is visible. * + * Supported Platforms: + * - iOS + * * Example: * * if (Keyboard.isVisible) { @@ -102,73 +127,59 @@ interface Keyboard { * Set this to true if you need that page scroll to beginning when keyboard is hiding. * This is allows to fix issue with elements declared with position: fixed, after keyboard is hiding. * + * Supported Platforms: + * - iOS + * * Example: * * Keyboard.automaticScrollToTopOnHiding = true; * * */ - automaticScrollToTopOnHiding: boolean, - - // Events - - /** - * If defined, this function is fired when keyboard fully shown. - * - * Attach handler to this event to be able to receive notification when keyboard is shown. - * - * Example: - * - * Keyboard.onshow = function () { - * // Describe your logic which will be run each time keyboard is shown. - * } - * - * - */ - onshow():void, - /** - * If defined, this function is fired when keyboard fully closed. - * - * Attach handler to this event to be able to receive notification when keyboard is closed. - * - * Example: - * - * Keyboard.onhide = function () { - * // Describe your logic which will be run each time keyboard is closed. - * } - * - * - */ - onhide():void, - /** - * If defined, this function is fired before keyboard will be shown. - * - * Attach handler to this event to be able to receive notification when keyboard is about to be shown on the screen. - * - * Example: - * - * Keyboard.onshowing = function () { - * // Describe your logic which will be run each time when keyboard is about to be shown. - * } - * - * - */ - onshowing():void, - /** - * If defined, this function is fired when keyboard is about to be closed. - * - * Attach handler to this event to be able to receive notification when keyboard is about to be closed. - * - * Example: - * - * Keyboard.onhiding = function () { - * // Describe your logic which will be run each time when keyboard is about to be closed. - * } - * - * - */ - onhiding():void, - + automaticScrollToTopOnHiding: boolean } -declare var Keyboard:Keyboard; +interface CordovaKeyboardEvent extends Event { + /** The height of the keyboard */ + keyboardHeight: number; +} + +interface Window { + /** + * @param type This event is fired when keyboard fully shown. + * + * @param callback Function is called when keyboard is shown. + */ + addEventListener(type: 'keyboardDidShow', callback: () => any, useCapture?: boolean): void; + + /** + * @param type This event is fired when the keyboard is fully closed. + * + * @param callback Function is called when keyboard is closed. + */ + addEventListener(type: 'keyboardDidHide', callback: () => any, useCapture?: boolean): void; + + /** + * @param type This event fires before keyboard will be shown. + * + * @param callback Function is called when keyboard is about to be shown on the screen. + */ + addEventListener(type: 'keyboardWillShow', callback: () => any, useCapture?: boolean): void; + + /** + * @param type This event is fired when the keyboard is fully closed. + * + * @param callback Function is called when keyboard is about to be closed. + */ + addEventListener(type: 'keyboardWillHide', callback: () => any, useCapture?: boolean): void; + + /** + * @param type This event is fired when the keyboard is fully closed. + * + * @param callback Function is called when keyboard is about to be closed. The function is + * passed an InAppBrowserEvent object as a parameter. + */ + addEventListener(type: 'keyboardHeightWillChange', callback: (event: CordovaKeyboardEvent) => any, useCapture?: boolean): void; +} + +declare var Keyboard: Keyboard; From d9620b5e2a618683aec2c94d12fd360ecb4e0c73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Flor=C3=AAncio?= Date: Tue, 21 Nov 2017 16:38:00 +0000 Subject: [PATCH 17/90] Updated index.d.ts with the last version Replaced the contents with the new version: https://github.com/mpneuried/nodecache/blob/master/index.d.ts Has new methods. --- types/node-cache/index.d.ts | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/types/node-cache/index.d.ts b/types/node-cache/index.d.ts index 558882a086..00e7316edc 100644 --- a/types/node-cache/index.d.ts +++ b/types/node-cache/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/tcs-de/nodecache // Definitions by: Ilya Mochalov // Daniel Thunell +// Ulf Seltmann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -89,8 +90,16 @@ declare namespace NodeCache { ttl( key: Key, - cb?: Callback, - ttl?: number + cb?: Callback + ): boolean; + + getTtl( + key: Key, + ): number|undefined; + + getTtl( + key: Key, + cb?: Callback ): boolean; /** @@ -130,6 +139,7 @@ declare namespace NodeCache { checkperiod?: number; useClones?: boolean; errorOnMissing?: boolean; + deleteOnExpire?: boolean; } interface Stats { @@ -225,7 +235,7 @@ declare class NodeCache extends events.EventEmitter implements NodeCache.NodeCac ): number; /** - * reset or redefine the ttl of a key. If `ttl` is not passed or set to 0 it's similar to `.del()` + * reset or redefine the ttl of a key. If `ttl` is not passed or set to 0 `stdTtl` is used. if set lt 0 it's similar to `.del()` */ ttl( key: Key, @@ -235,10 +245,19 @@ declare class NodeCache extends events.EventEmitter implements NodeCache.NodeCac ttl( key: Key, - cb?: Callback, - ttl?: number + cb?: Callback ): boolean; + getTtl( + key: Key + ): number|undefined; + + getTtl( + key: Key, + cb?: Callback, + ): boolean; + + /** * list all keys within this cache * @param cb Callback function From 5c544da4bd563e1264a722e7e8dc4ad7ce6c271b Mon Sep 17 00:00:00 2001 From: Jeff Jacobson Date: Tue, 21 Nov 2017 10:26:40 -0800 Subject: [PATCH 18/90] Added missing space --- types/geojson/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/geojson/index.d.ts b/types/geojson/index.d.ts index 936756ff86..d6ba411e3f 100644 --- a/types/geojson/index.d.ts +++ b/types/geojson/index.d.ts @@ -130,7 +130,7 @@ export interface MultiPolygon extends GeometryObject { */ export interface GeometryCollection extends GeometryObject { type: "GeometryCollection"; - geometries: Array; + geometries: Array; } export type GeoJsonProperties = { [name: string]: any; } | null; From 4bf9699f266191627f85253d366daed02a241295 Mon Sep 17 00:00:00 2001 From: Peter Bartha Date: Tue, 21 Nov 2017 19:56:38 +0100 Subject: [PATCH 19/90] Add optional 'options' parameter to the setSelection and setSelections method in CodeMirror. --- types/codemirror/index.d.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/types/codemirror/index.d.ts b/types/codemirror/index.d.ts index 45e503e068..24e905b8e2 100644 --- a/types/codemirror/index.d.ts +++ b/types/codemirror/index.d.ts @@ -535,11 +535,14 @@ declare namespace CodeMirror { /** Set the cursor position.You can either pass a single { line , ch } object , or the line and the character as two separate parameters. */ setCursor(pos: CodeMirror.Position): void; - /** Set the selection range.anchor and head should be { line , ch } objects.head defaults to anchor when not given. */ - setSelection(anchor: CodeMirror.Position, head: CodeMirror.Position): void; + /** Set a single selection range. anchor and head should be {line, ch} objects. head defaults to anchor when not given. */ + setSelection(anchor: CodeMirror.Position, head: CodeMirror.Position, options?: { bias: number, clearRedo: boolean, origin: string, scroll: boolean }): void; - /** Set and normalize selection ranges and range should be { anchor, head } objects. primary determines which selection is the primary one. */ - setSelections(ranges: Array<{ anchor: CodeMirror.Position, head: CodeMirror.Position }>, primary?: number): void; + /** Sets a new set of selections. There must be at least one selection in the given array. When primary is a + number, it determines which selection is the primary one. When it is not given, the primary index is taken from + the previous selection, or set to the last range if the previous selection had less ranges than the new one. + Supports the same options as setSelection. */ + setSelections(ranges: Array<{ anchor: CodeMirror.Position, head: CodeMirror.Position }>, primary?: number, options?: { bias: number, clearRedo: boolean, origin: string, scroll: boolean }): void; /** Similar to setSelection , but will, if shift is held or the extending flag is set, move the head of the selection while leaving the anchor at its current place. From 2c708ba138274c676752a3736460042afa51b454 Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Tue, 21 Nov 2017 23:19:34 +0100 Subject: [PATCH 20/90] elasticsearch: add error classes, flatten definitions, lint --- types/elasticsearch/elasticsearch-tests.ts | 59 +- types/elasticsearch/index.d.ts | 3150 ++++++++++---------- types/elasticsearch/tsconfig.json | 4 +- types/elasticsearch/tslint.json | 76 +- 4 files changed, 1633 insertions(+), 1656 deletions(-) diff --git a/types/elasticsearch/elasticsearch-tests.ts b/types/elasticsearch/elasticsearch-tests.ts index 1be3f740bc..3043a1f473 100644 --- a/types/elasticsearch/elasticsearch-tests.ts +++ b/types/elasticsearch/elasticsearch-tests.ts @@ -1,6 +1,6 @@ -import elasticsearch = require("elasticsearch"); +import * as elasticsearch from "elasticsearch"; -var client = new elasticsearch.Client({ +let client = new elasticsearch.Client({ host: 'localhost:9200', log: 'trace' }); @@ -10,26 +10,26 @@ client = new elasticsearch.Client({ 'box1.server.org', 'box2.server.org' ], - selector: function (hosts: any) { } + selector: (hosts: any) => { } }); client.ping({ requestTimeout: 30000 -}, function (error) { +}, (error) => { }); client.search({ q: 'pants' -}).then(function (body) { - var hits = body.hits.hits; -}, function (error) { +}).then((body) => { + const hits = body.hits.hits; +}, (error) => { }); client.indices.delete({ index: 'test_index', ignore: [404] -}).then(function (body) { -}, function (error) { +}).then((body) => { +}, (error) => { }); client.deleteByQuery({ @@ -39,8 +39,8 @@ client.deleteByQuery({ query: { } } -}).then(function (response) { -}, function (error) { +}).then((response) => { +}, (error) => { }); client.create({ @@ -103,7 +103,7 @@ client.cluster.stats({ client.count({ index: 'index_name' -}, function (error, response) { +}, (error, response) => { // ... }); @@ -120,7 +120,7 @@ client.count({ } } } -}, function (err, response) { +}, (err, response) => { // ... }); @@ -132,7 +132,7 @@ client.explain({ // the query to score it against q: 'field:value' -}, function (error, response) { +}, (error, response) => { // ... }); @@ -145,7 +145,7 @@ client.explain({ match: { title: 'test' } } } -}, function (error, response) { +}, (error, response) => { // ... }); @@ -158,8 +158,7 @@ client.index({ tags: ['y', 'z'], published: true, } -}, function (error, response) { - +}, (error, response) => { }); client.mget({ @@ -170,7 +169,7 @@ client.mget({ { _index: 'indexC', _type: 'typeC', _id: '1' } ] } -}, function (error, response) { +}, (error, response) => { // ... }); @@ -180,14 +179,14 @@ client.mget({ body: { ids: [1, 2, 3] } -}, function (error, response) { +}, (error, response) => { // ... }); client.search({ index: 'myindex', q: 'title:test' -}, function (error, response) { +}, (error, response) => { // ... }); @@ -207,7 +206,7 @@ client.search({ } } } -}, function (error, response) { +}, (error, response) => { // ... }); @@ -221,12 +220,11 @@ client.suggest({ } } } -}, function (error, response) { +}, (error, response) => { }); - // first we do a search, and specify a scroll timeout -var allTitles: string[] = []; +const allTitles: string[] = []; client.search({ index: 'myindex', // Set to 30 seconds because we are calling right back @@ -236,14 +234,14 @@ client.search({ q: 'title:test' }, function getMoreUntilDone(error, response) { // collect the title from each response - response.hits.hits.forEach(function (hit) { + response.hits.hits.forEach((hit) => { allTitles.push(hit.fields.title); }); if (response.hits.total !== allTitles.length) { // now we can call scroll over and over client.scroll({ - scrollId: response._scroll_id, + scrollId: response._scroll_id!, scroll: '30s' }, getMoreUntilDone); } else { @@ -258,8 +256,13 @@ client.indices.updateAliases({ { add: { index: 'logstash-2014.05', alias: 'logstash-current' } } ] } -}).then(function (response) { +}).then((response) => { // ... -}, function (error) { +}, (error) => { // ... }); + +// Errors +function testErrors() { + throw new elasticsearch.errors.AuthenticationException(); +} diff --git a/types/elasticsearch/index.d.ts b/types/elasticsearch/index.d.ts index 8acc7e4097..c728f9e495 100644 --- a/types/elasticsearch/index.d.ts +++ b/types/elasticsearch/index.d.ts @@ -2,1607 +2,1651 @@ // Project: https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html // Definitions by: Casper Skydt , Blake Smith , Dave Dunkin , Jeffery Grajkowski , Margus Lamp , Ahmad Ferdous Bin Alam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -declare module Elasticsearch { - export class Client { - constructor(params: ConfigOptions); - cat: Cat; - cluster: Cluster; - indices: Indices; - ingest: Ingest; - nodes: Nodes; - snapshot: Snapshot; - tasks: Tasks; - bulk(params: BulkIndexDocumentsParams): Promise; - bulk(params: BulkIndexDocumentsParams, callback: (error: any, response: any) => void): void; - clearScroll(params: ClearScrollParams, callback: (error: any, response: any) => void): void; - clearScroll(params: ClearScrollParams): Promise; - count(params: CountParams, callback: (error: any, response: CountResponse) => void): void; - count(params: CountParams): Promise; - create(params: CreateDocumentParams): Promise; - create(params: CreateDocumentParams, callback: (err: any, response: CreateDocumentResponse, status: any) => void): void; - delete(params: DeleteDocumentParams): Promise; - delete(params: DeleteDocumentParams, callback: (error: any, response: DeleteDocumentResponse) => void): void; - deleteByQuery(params: DeleteDocumentByQueryParams): Promise; - deleteByQuery(params: DeleteDocumentByQueryParams, callback: (error: any, response: DeleteDocumentByQueryResponse) => void): void; - deleteScript(params: DeleteScriptParams): Promise; - deleteScript(params: DeleteScriptParams, callback: (error: any, response: any) => void): void; - deleteTemplate(params: DeleteTemplateParams): Promise; - deleteTemplate(params: DeleteTemplateParams, callback: (error: any, response: any) => void): void; - exists(params: ExistsParams): Promise; - exists(params: ExistsParams, callback: (error: any, response: any, status?: any) => void): void; - explain(params: ExplainParams): Promise; - explain(params: ExplainParams, callback: (error: any, response: ExplainResponse) => void): void; - fieldStats(params: FieldStatsParams): Promise; - fieldStats(params: FieldStatsParams, callback: (error: any, response: FieldStatsResponse) => void): void; - get(params: GetParams, callback: (error: any, response: GetResponse) => void): void; - get(params: GetParams): Promise>; - getScript(params: GetScriptParams): Promise; - getScript(params: GetScriptParams, callback: (error: any, response: any) => void): void; - getSource(params: GetSourceParams): Promise; - getSource(params: GetSourceParams, callback: (error: any, response: any) => void): void; - getTemplate(params: GetTemplateParams): Promise; - getTemplate(params: GetTemplateParams, callback: (error: any, response: any) => void): void; - index(params: IndexDocumentParams): Promise; - index(params: IndexDocumentParams, callback: (error: any, response: any) => void): void; - info(params: InfoParams): Promise; - info(params: InfoParams, callback: (error: any, response: any) => void): void; - mget(params: MGetParams, callback: (error: any, response: MGetResponse) => void): void; - mget(params: MGetParams): Promise>; - msearch(params: MSearchParams, callback: (error: any, response: MSearchResponse) => void): void; - msearch(params: MSearchParams): Promise>; - msearchTemplate(params: MSearchTemplateParams, callback: (error: any, response: MSearchResponse) => void): void; - msearchTemplate(params: MSearchTemplateParams): Promise>; - mtermvectors(params: MTermVectorsParams): Promise; - mtermvectors(params: MTermVectorsParams, callback: (error: any, response: any) => void): void; - ping(params: PingParams): Promise; - ping(params: PingParams, callback: (err: any, response: any, status: any) => void): void; - putScript(params: PutScriptParams): Promise; - putScript(params: PutScriptParams, callback: (err: any, response: any, status: any) => void): void; - putTemplate(params: PutTemplateParams): Promise; - putTemplate(params: PutTemplateParams, callback: (err: any, response: any, status: any) => void): void; - reindex(params: ReindexParams): Promise; - reindex(params: ReindexParams, callback: (error: any, response: ReindexResponse) => void): void; - reindexRethrottle(params: ReindexRethrottleParams): Promise; - reindexRethrottle(params: ReindexRethrottleParams, callback: (error: any, response: any) => void): void; - renderSearchTemplate(params: RenderSearchTemplateParams): Promise; - renderSearchTemplate(params: RenderSearchTemplateParams, callback: (error: any, response: any) => void): void; - scroll(params: ScrollParams): Promise>; - scroll(params: ScrollParams, callback: (error: any, response: SearchResponse) => void): void; - search(params: SearchParams): Promise>; - search(params: SearchParams, callback: (error: any, response: SearchResponse) => void): void; - searchShards(params: SearchShardsParams): Promise; - searchShards(params: SearchShardsParams, callback: (error: any, response: SearchShardsResponse) => void): void; - searchTemplate(params: SearchTemplateParams): Promise; - searchTemplate(params: SearchTemplateParams, callback: (error: any, response: any) => void): void; - suggest(params: SuggestParams): Promise; - suggest(params: SuggestParams, callback: (error: any, response: any) => void): void; - termvectors(params: TermvectorsParams): Promise; - termvectors(params: TermvectorsParams, callback: (error: any, response: any) => void): void; - update(params: UpdateDocumentParams): Promise; - update(params: UpdateDocumentParams, callback: (error: any, response: any) => void): void; - updateByQuery(params: UpdateDocumentByQueryParams): Promise; - updateByQuery(params: UpdateDocumentByQueryParams, callback: (error: any, response: any) => void): void; - close(): void; - } +export class Client { + constructor(params: ConfigOptions); + cat: Cat; + cluster: Cluster; + indices: Indices; + ingest: Ingest; + nodes: Nodes; + snapshot: Snapshot; + tasks: Tasks; + bulk(params: BulkIndexDocumentsParams): Promise; + bulk(params: BulkIndexDocumentsParams, callback: (error: any, response: any) => void): void; + clearScroll(params: ClearScrollParams, callback: (error: any, response: any) => void): void; + clearScroll(params: ClearScrollParams): Promise; + count(params: CountParams, callback: (error: any, response: CountResponse) => void): void; + count(params: CountParams): Promise; + create(params: CreateDocumentParams): Promise; + create(params: CreateDocumentParams, callback: (err: any, response: CreateDocumentResponse, status: any) => void): void; + delete(params: DeleteDocumentParams): Promise; + delete(params: DeleteDocumentParams, callback: (error: any, response: DeleteDocumentResponse) => void): void; + deleteByQuery(params: DeleteDocumentByQueryParams): Promise; + deleteByQuery(params: DeleteDocumentByQueryParams, callback: (error: any, response: DeleteDocumentByQueryResponse) => void): void; + deleteScript(params: DeleteScriptParams): Promise; + deleteScript(params: DeleteScriptParams, callback: (error: any, response: any) => void): void; + deleteTemplate(params: DeleteTemplateParams): Promise; + deleteTemplate(params: DeleteTemplateParams, callback: (error: any, response: any) => void): void; + exists(params: ExistsParams): Promise; + exists(params: ExistsParams, callback: (error: any, response: any, status?: any) => void): void; + explain(params: ExplainParams): Promise; + explain(params: ExplainParams, callback: (error: any, response: ExplainResponse) => void): void; + fieldStats(params: FieldStatsParams): Promise; + fieldStats(params: FieldStatsParams, callback: (error: any, response: FieldStatsResponse) => void): void; + get(params: GetParams, callback: (error: any, response: GetResponse) => void): void; + get(params: GetParams): Promise>; + getScript(params: GetScriptParams): Promise; + getScript(params: GetScriptParams, callback: (error: any, response: any) => void): void; + getSource(params: GetSourceParams): Promise; + getSource(params: GetSourceParams, callback: (error: any, response: any) => void): void; + getTemplate(params: GetTemplateParams): Promise; + getTemplate(params: GetTemplateParams, callback: (error: any, response: any) => void): void; + index(params: IndexDocumentParams): Promise; + index(params: IndexDocumentParams, callback: (error: any, response: any) => void): void; + info(params: InfoParams): Promise; + info(params: InfoParams, callback: (error: any, response: any) => void): void; + mget(params: MGetParams, callback: (error: any, response: MGetResponse) => void): void; + mget(params: MGetParams): Promise>; + msearch(params: MSearchParams, callback: (error: any, response: MSearchResponse) => void): void; + msearch(params: MSearchParams): Promise>; + msearchTemplate(params: MSearchTemplateParams, callback: (error: any, response: MSearchResponse) => void): void; + msearchTemplate(params: MSearchTemplateParams): Promise>; + mtermvectors(params: MTermVectorsParams): Promise; + mtermvectors(params: MTermVectorsParams, callback: (error: any, response: any) => void): void; + ping(params: PingParams): Promise; + ping(params: PingParams, callback: (err: any, response: any, status: any) => void): void; + putScript(params: PutScriptParams): Promise; + putScript(params: PutScriptParams, callback: (err: any, response: any, status: any) => void): void; + putTemplate(params: PutTemplateParams): Promise; + putTemplate(params: PutTemplateParams, callback: (err: any, response: any, status: any) => void): void; + reindex(params: ReindexParams): Promise; + reindex(params: ReindexParams, callback: (error: any, response: ReindexResponse) => void): void; + reindexRethrottle(params: ReindexRethrottleParams): Promise; + reindexRethrottle(params: ReindexRethrottleParams, callback: (error: any, response: any) => void): void; + renderSearchTemplate(params: RenderSearchTemplateParams): Promise; + renderSearchTemplate(params: RenderSearchTemplateParams, callback: (error: any, response: any) => void): void; + scroll(params: ScrollParams): Promise>; + scroll(params: ScrollParams, callback: (error: any, response: SearchResponse) => void): void; + search(params: SearchParams): Promise>; + search(params: SearchParams, callback: (error: any, response: SearchResponse) => void): void; + searchShards(params: SearchShardsParams): Promise; + searchShards(params: SearchShardsParams, callback: (error: any, response: SearchShardsResponse) => void): void; + searchTemplate(params: SearchTemplateParams): Promise; + searchTemplate(params: SearchTemplateParams, callback: (error: any, response: any) => void): void; + suggest(params: SuggestParams): Promise; + suggest(params: SuggestParams, callback: (error: any, response: any) => void): void; + termvectors(params: TermvectorsParams): Promise; + termvectors(params: TermvectorsParams, callback: (error: any, response: any) => void): void; + update(params: UpdateDocumentParams): Promise; + update(params: UpdateDocumentParams, callback: (error: any, response: any) => void): void; + updateByQuery(params: UpdateDocumentByQueryParams): Promise; + updateByQuery(params: UpdateDocumentByQueryParams, callback: (error: any, response: any) => void): void; + close(): void; +} - export interface ConfigOptions { - host?: any; - hosts?: any; - httpAuth?: string; - log?: any; - apiVersion?: string; - plugins?: any; - sniffOnStart?: boolean; - sniffInterval?: number; - sniffOnConnectionFault?: boolean; - maxRetries?: number; - requestTimeout?: number; - deadTimeout?: number; - pingTimeout?: number; - keepAlive?: boolean; - maxSockets?: number; - suggestCompression?: boolean; - connectionClass?: string; - sniffedNodesProtocol?: string; - ssl?: Object; - selector?: any; - defer?: () => void; - nodesToHostCallback?: any; - createNodeAgent?: any; - } +export interface ConfigOptions { + host?: any; + hosts?: any; + httpAuth?: string; + log?: any; + apiVersion?: string; + plugins?: any; + sniffOnStart?: boolean; + sniffInterval?: number; + sniffOnConnectionFault?: boolean; + maxRetries?: number; + requestTimeout?: number; + deadTimeout?: number; + pingTimeout?: number; + keepAlive?: boolean; + maxSockets?: number; + suggestCompression?: boolean; + connectionClass?: string; + sniffedNodesProtocol?: string; + ssl?: object; + selector?: any; + defer?: () => void; + nodesToHostCallback?: any; + createNodeAgent?: any; +} - export interface Explanation { - value: number; - description: string; - details: Explanation[]; - } +export interface Explanation { + value: number; + description: string; + details: Explanation[]; +} - export interface GenericParams { - requestTimeout?: number; - maxRetries?: number; - method?: string; - body?: any; - ignore?: number | number[]; - filterPath?: string | string[]; - } +export interface GenericParams { + requestTimeout?: number; + maxRetries?: number; + method?: string; + body?: any; + ignore?: number | number[]; + filterPath?: string | string[]; +} - export interface ShardsResponse { - total: number; - successful: number; - failed: number; - } +export interface ShardsResponse { + total: number; + successful: number; + failed: number; +} - /** - * A string of a number and a time unit. A time unit is one of - * [d, h, m, s, ms, micros, nanos]. eg: "30s" for 30 seconds. - * These are incorrectly identified as `Date | number` in the docs as of 2016-11-15. - */ - export type TimeSpan = string; +/** + * A string of a number and a time unit. A time unit is one of + * [d, h, m, s, ms, micros, nanos]. eg: "30s" for 30 seconds. + * These are incorrectly identified as `Date | number` in the docs as of 2016-11-15. + */ +export type TimeSpan = string; - export type NameList = string | string[] | boolean; - export type Refresh = boolean | "true" | "false" | "wait_for" | ""; - export type VersionType = "internal" | "external" | "external_gte" | "force"; - export type ExpandWildcards = "open" | "closed" | "none" | "all"; - export type DefaultOperator = "AND" | "OR"; - export type Conflicts = "abort" | "proceed"; +export type NameList = string | string[] | boolean; +export type Refresh = boolean | "true" | "false" | "wait_for" | ""; +export type VersionType = "internal" | "external" | "external_gte" | "force"; +export type ExpandWildcards = "open" | "closed" | "none" | "all"; +export type DefaultOperator = "AND" | "OR"; +export type Conflicts = "abort" | "proceed"; - export interface BulkIndexDocumentsParams extends GenericParams { - waitForActiveShards?: string; - refresh?: Refresh; - routing?: string; - timeout?: TimeSpan; - type?: string; - fields?: NameList; - _source?: NameList; - _sourceExclude?: NameList; - _sourceInclude?: NameList; - pipeline?: string; - index?: string; - } +export interface BulkIndexDocumentsParams extends GenericParams { + waitForActiveShards?: string; + refresh?: Refresh; + routing?: string; + timeout?: TimeSpan; + type?: string; + fields?: NameList; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + pipeline?: string; + index?: string; +} - export interface ClearScrollParams extends GenericParams { - scrollId: NameList; - } +export interface ClearScrollParams extends GenericParams { + scrollId: NameList; +} - export interface CountParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - minScore?: number; - preference?: string; - routing?: string; - q?: string; - analyzer?: string; - analyzeWildcard?: boolean; - defaultOperator?: DefaultOperator; - df?: string; - lenient?: boolean; - lowercaseExpandedTerms?: boolean; - index?: NameList; - type?: NameList; - } +export interface CountParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + minScore?: number; + preference?: string; + routing?: string; + q?: string; + analyzer?: string; + analyzeWildcard?: boolean; + defaultOperator?: DefaultOperator; + df?: string; + lenient?: boolean; + lowercaseExpandedTerms?: boolean; + index?: NameList; + type?: NameList; +} - export interface CountResponse { - count: number; - _shards: ShardsResponse; - } +export interface CountResponse { + count: number; + _shards: ShardsResponse; +} - export interface CreateDocumentParams extends GenericParams { - waitForActiveShards?: string; - parent?: string; - refresh?: Refresh; - timeout?: TimeSpan; - timestamp?: Date | number; - ttl?: TimeSpan; - version?: number; - versionType?: VersionType; - pipeline?: string; - id?: string; - index: string; - type: string; - } +export interface CreateDocumentParams extends GenericParams { + waitForActiveShards?: string; + parent?: string; + refresh?: Refresh; + timeout?: TimeSpan; + timestamp?: Date | number; + ttl?: TimeSpan; + version?: number; + versionType?: VersionType; + pipeline?: string; + id?: string; + index: string; + type: string; +} - export interface CreateDocumentResponse { - _shards: ShardsResponse; - _index: string; - _type: string; - _id: string; - _version: number; - created: boolean; - result: string; - } +export interface CreateDocumentResponse { + _shards: ShardsResponse; + _index: string; + _type: string; + _id: string; + _version: number; + created: boolean; + result: string; +} - export interface DeleteDocumentParams extends GenericParams { - waitForActiveShards?: string; - parent?: string; - refresh?: Refresh; - routing?: string; - timeout?: TimeSpan; - version?: number; - versionType?: VersionType; - index: string; - type: string; - id: string; - } +export interface DeleteDocumentParams extends GenericParams { + waitForActiveShards?: string; + parent?: string; + refresh?: Refresh; + routing?: string; + timeout?: TimeSpan; + version?: number; + versionType?: VersionType; + index: string; + type: string; + id: string; +} - export interface DeleteDocumentResponse { - _shards: ShardsResponse; - found: boolean; - _index: string; - _type: string; - _id: string; - _version: number; - result: string; - } +export interface DeleteDocumentResponse { + _shards: ShardsResponse; + found: boolean; + _index: string; + _type: string; + _id: string; + _version: number; + result: string; +} - export interface DeleteDocumentByQueryParams extends GenericParams { - analyzer?: string; - analyzeWildcard?: boolean; - defaultOperator?: DefaultOperator; - df?: string; - from?: number; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - conflicts?: Conflicts; - expandWildcards?: ExpandWildcards; - lenient?: boolean; - lowercaseExpandedTerms?: boolean; - preference?: string; - q?: string; - routing?: string | string[] | boolean; - scroll?: string; - searchType?: "query_then_fetch" | "dfs_query_then_fetch"; - searchTimeout?: TimeSpan; - size?: number; - sort?: NameList; - _source?: NameList; - _sourceExclude?: NameList; - _sourceInclude?: NameList; - terminateAfter?: number; - stats?: string | string[] | boolean; - version?: number; - requestCache?: boolean; - refresh?: Refresh; - timeout?: TimeSpan; - waitForActiveShards?: string; - scrollSize?: number; - waitForCompletion?: boolean; - requestsPerSecond?: number; - index?: string; - type?: string; - } +export interface DeleteDocumentByQueryParams extends GenericParams { + analyzer?: string; + analyzeWildcard?: boolean; + defaultOperator?: DefaultOperator; + df?: string; + from?: number; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + conflicts?: Conflicts; + expandWildcards?: ExpandWildcards; + lenient?: boolean; + lowercaseExpandedTerms?: boolean; + preference?: string; + q?: string; + routing?: string | string[] | boolean; + scroll?: string; + searchType?: "query_then_fetch" | "dfs_query_then_fetch"; + searchTimeout?: TimeSpan; + size?: number; + sort?: NameList; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + terminateAfter?: number; + stats?: string | string[] | boolean; + version?: number; + requestCache?: boolean; + refresh?: Refresh; + timeout?: TimeSpan; + waitForActiveShards?: string; + scrollSize?: number; + waitForCompletion?: boolean; + requestsPerSecond?: number; + index?: string; + type?: string; +} - export interface DeleteDocumentByQueryResponse { - took: number; - timed_out: boolean; - deleted: number; - batches: number; - version_conflicts: number; - noops: number; - retries: { - bulk: number; - search: number; - }; - throttled_millis: number; - requests_per_second: number; - throttled_until_millis: number; - total: number; - failures: any[]; - } +export interface DeleteDocumentByQueryResponse { + took: number; + timed_out: boolean; + deleted: number; + batches: number; + version_conflicts: number; + noops: number; + retries: { + bulk: number; + search: number; + }; + throttled_millis: number; + requests_per_second: number; + throttled_until_millis: number; + total: number; + failures: any[]; +} - export interface DeleteScriptParams extends GenericParams { - id: string; - lang: string; - } +export interface DeleteScriptParams extends GenericParams { + id: string; + lang: string; +} - export interface DeleteTemplateParams extends GenericParams { - id: string; - } +export interface DeleteTemplateParams extends GenericParams { + id: string; +} - export interface ExistsParams extends GenericParams { - parent?: string; - preference?: string; - realtime?: boolean; - refresh?: boolean; - routing?: string; - id: string; - index: string; - type: string; - } +export interface ExistsParams extends GenericParams { + parent?: string; + preference?: string; + realtime?: boolean; + refresh?: boolean; + routing?: string; + id: string; + index: string; + type: string; +} - export interface ExplainParams extends GenericParams { - analyzeWildcard?: boolean; - analyzer?: string; - defaultOperator?: DefaultOperator; - df?: string; - storedFields?: NameList; - lenient?: boolean; - lowercaseExpandedTerms?: boolean; - parent?: string; - preference?: string; - q?: string; - routing?: string; - _source?: NameList; - _sourceExclude?: NameList; - _sourceInclude?: NameList; - id?: string; - index?: string; - type?: string; - } +export interface ExplainParams extends GenericParams { + analyzeWildcard?: boolean; + analyzer?: string; + defaultOperator?: DefaultOperator; + df?: string; + storedFields?: NameList; + lenient?: boolean; + lowercaseExpandedTerms?: boolean; + parent?: string; + preference?: string; + q?: string; + routing?: string; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + id?: string; + index?: string; + type?: string; +} - export interface ExplainResponse { - _index: string; - _type: string; - _id: string; - matched: boolean; - explanation: ExplainResponseDetails; - } +export interface ExplainResponse { + _index: string; + _type: string; + _id: string; + matched: boolean; + explanation: ExplainResponseDetails; +} - export interface ExplainResponseDetails { - value: number; - description: string; - details: ExplainResponseDetails[]; - } +export interface ExplainResponseDetails { + value: number; + description: string; + details: ExplainResponseDetails[]; +} - export interface FieldStatsParams extends GenericParams { - fields?: NameList; - level?: "indices" | "cluster"; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - index?: NameList; - } +export interface FieldStatsParams extends GenericParams { + fields?: NameList; + level?: "indices" | "cluster"; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index?: NameList; +} - export interface FieldStatsResponse { - _shards: ShardsResponse; - indices: { [indexName: string]: FieldStatsResponseIndex }; - conflicts?: { [fieldName: string]: string }; - } +export interface FieldStatsResponse { + _shards: ShardsResponse; + indices: { [indexName: string]: FieldStatsResponseIndex }; + conflicts?: { [fieldName: string]: string }; +} - export interface FieldStatsResponseIndex { - fields: { [fieldName: string]: FieldStatsResponseField }; - } +export interface FieldStatsResponseIndex { + fields: { [fieldName: string]: FieldStatsResponseField }; +} - export interface FieldStatsResponseField { - max_doc: number; - doc_count: number; - density: number; - sum_doc_freq: number; - sum_total_term_freq: number; - min_value: any; - max_value: any; - is_searchable: string; - is_aggregatable: string; - } +export interface FieldStatsResponseField { + max_doc: number; + doc_count: number; + density: number; + sum_doc_freq: number; + sum_total_term_freq: number; + min_value: any; + max_value: any; + is_searchable: string; + is_aggregatable: string; +} - export interface GetParams extends GenericParams { - storedFields?: NameList; - parent?: string; - preference?: string; - realtime?: boolean; - refresh?: boolean; - routing?: string; - _source?: NameList; - _sourceExclude?: NameList; - _sourceInclude?: NameList; - version?: number; - versionType?: VersionType; - id: string; - index: string; - type: string; - } +export interface GetParams extends GenericParams { + storedFields?: NameList; + parent?: string; + preference?: string; + realtime?: boolean; + refresh?: boolean; + routing?: string; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + version?: number; + versionType?: VersionType; + id: string; + index: string; + type: string; +} - export interface GetResponse { - _index: string; - _type: string; - _id: string; - _version: number; - found: boolean; - _source: T; - } +export interface GetResponse { + _index: string; + _type: string; + _id: string; + _version: number; + found: boolean; + _source: T; +} - export interface GetScriptParams extends GenericParams { - id: string; - lang: string; - } +export interface GetScriptParams extends GenericParams { + id: string; + lang: string; +} - export interface GetSourceParams extends GenericParams { - preference?: string; - realtime?: boolean; - refresh?: boolean; - routing?: string; - _source: NameList; - _sourceExclude?: NameList; - _sourceInclude?: NameList; - version?: number; - versionType?: VersionType; - id: string; - index: string; - type: string; - } +export interface GetSourceParams extends GenericParams { + preference?: string; + realtime?: boolean; + refresh?: boolean; + routing?: string; + _source: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + version?: number; + versionType?: VersionType; + id: string; + index: string; + type: string; +} - export interface GetTemplateParams extends GenericParams { - id: string; - } +export interface GetTemplateParams extends GenericParams { + id: string; +} - export interface IndexDocumentParams extends GenericParams { - waitForActiveShards?: string; - opType?: "index" | "create"; - parent?: string; - refresh?: string; - routing?: string; - timeout?: TimeSpan; - timestamp?: Date | number; - ttl?: TimeSpan; - version?: number; - versionType?: VersionType; - pipeline?: string; - id?: string; - index: string; - type: string; - body: T; - } +export interface IndexDocumentParams extends GenericParams { + waitForActiveShards?: string; + opType?: "index" | "create"; + parent?: string; + refresh?: string; + routing?: string; + timeout?: TimeSpan; + timestamp?: Date | number; + ttl?: TimeSpan; + version?: number; + versionType?: VersionType; + pipeline?: string; + id?: string; + index: string; + type: string; + body: T; +} - export interface InfoParams extends GenericParams { - } +export interface InfoParams extends GenericParams { +} - export interface MGetParams extends GenericParams { - storedFields?: NameList; - preference?: string; - realtime?: Boolean; - refresh?: Boolean; - source?: NameList; - _sourceExclude?: NameList; - _sourceInclude?: NameList; - index?: string; - type?: string; - } +export interface MGetParams extends GenericParams { + storedFields?: NameList; + preference?: string; + realtime?: boolean; + refresh?: boolean; + source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + index?: string; + type?: string; +} - export interface MGetResponse { - docs?: GetResponse[]; - } +export interface MGetResponse { + docs?: GetResponse[]; +} - export interface MSearchParams extends GenericParams { - search_type?: "query_then_fetch" | "query_and_fetch" | "dfs_query_then_fetch" | "dfs_query_and_fetch"; - maxConcurrentSearches?: number; - index?: NameList; - type?: NameList; - } +export interface MSearchParams extends GenericParams { + search_type?: "query_then_fetch" | "query_and_fetch" | "dfs_query_then_fetch" | "dfs_query_and_fetch"; + maxConcurrentSearches?: number; + index?: NameList; + type?: NameList; +} - export interface MSearchResponse { - responses?: SearchResponse[]; - } +export interface MSearchResponse { + responses?: SearchResponse[]; +} - export interface MSearchTemplateParams extends GenericParams { - search_type?: "query_then_fetch" | "query_and_fetch" | "dfs_query_then_fetch" | "dfs_query_and_fetch"; - index?: NameList; - type?: NameList; - } +export interface MSearchTemplateParams extends GenericParams { + search_type?: "query_then_fetch" | "query_and_fetch" | "dfs_query_then_fetch" | "dfs_query_and_fetch"; + index?: NameList; + type?: NameList; +} - export interface MTermVectorsParams extends GenericParams { - ids?: NameList; - termStatistics?: boolean; - fieldStatistics?: boolean; - fields?: NameList; - offsets?: boolean; - positions?: boolean; - payloads?: boolean; - preference?: string; - routing?: string; - parent?: string; - realtime?: boolean; - version?: number; - versionType?: VersionType; - index: string; - type: string; - } +export interface MTermVectorsParams extends GenericParams { + ids?: NameList; + termStatistics?: boolean; + fieldStatistics?: boolean; + fields?: NameList; + offsets?: boolean; + positions?: boolean; + payloads?: boolean; + preference?: string; + routing?: string; + parent?: string; + realtime?: boolean; + version?: number; + versionType?: VersionType; + index: string; + type: string; +} - export interface PingParams extends GenericParams { - } +export interface PingParams extends GenericParams { +} - export interface PutScriptParams extends GenericParams { - id: string; - lang: string; - body: any; - } +export interface PutScriptParams extends GenericParams { + id: string; + lang: string; + body: any; +} - export interface PutTemplateParams extends GenericParams { - id: string; - body: any; - } +export interface PutTemplateParams extends GenericParams { + id: string; + body: any; +} - export interface ReindexParams extends GenericParams { - refresh?: boolean; - timeout?: TimeSpan; - waitForActiveShards?: string; - waitForCompletion?: boolean; - requestsPerSecond?: number; - body: { - conflicts?: string; - source: { - index: string | string[]; - type?: string | string[]; - query?: any; - sort?: any; - size?: number; - remote?: { - host: string; - username?: string; - password?: string; - } - }; - dest: { - index: string; - version_type?: string; - op_type?: string; - routing?: string; - pipeline?: string; - }; - script?: { - inline: string; - lang: string; +export interface ReindexParams extends GenericParams { + refresh?: boolean; + timeout?: TimeSpan; + waitForActiveShards?: string; + waitForCompletion?: boolean; + requestsPerSecond?: number; + body: { + conflicts?: string; + source: { + index: string | string[]; + type?: string | string[]; + query?: any; + sort?: any; + size?: number; + remote?: { + host: string; + username?: string; + password?: string; } }; - } - - export interface ReindexResponse { - took: number; - updated: number; - created: number; - batches: number; - version_conflicts: number; - retries: { - bulk: number; - search: number; - }; - throttled_millis: number; - failures: any[]; - } - - export interface ReindexRethrottleParams extends GenericParams { - requestsPerSecond: number; - taskId: string; - } - - export interface RenderSearchTemplateParams extends GenericParams { - id: string; - } - - export interface ScrollParams extends GenericParams { - scroll: TimeSpan; - scrollId: string; - } - - export interface SearchParams extends GenericParams { - analyzer?: string; - analyzeWildcard?: boolean; - defaultOperator?: DefaultOperator; - df?: string; - explain?: boolean; - storedFields?: NameList; - docvalueFields?: NameList; - fielddataFields?: NameList; - from?: number; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - lenient?: boolean; - lowercaseExpandedTerms?: boolean; - preference?: string; - q?: string; - routing?: NameList; - scroll?: TimeSpan; - searchType?: "query_then_fetch" | "dfs_query_then_fetch"; - size?: number; - sort?: NameList; - _source?: NameList; - _sourceExclude?: NameList; - _sourceInclude?: NameList; - terminateAfter?: number; - stats?: NameList; - suggestField?: string; - suggestMode?: "missing" | "popular" | "always"; - suggestSize?: number; - suggestText?: string; - timeout?: TimeSpan; - trackScores?: boolean; - version?: boolean; - requestCache?: boolean; - index?: NameList; - type?: NameList; - } - - export interface SearchResponse { - took: number; - timed_out: boolean; - _scroll_id?: string; - _shards: ShardsResponse; - hits: { - total: number; - max_score: number; - hits: { - _index: string; - _type: string; - _id: string; - _score: number; - _source: T; - _version?: number; - _explanation?: Explanation; - fields?: any; - highlight?: any; - inner_hits?: any; - }[]; - }; - aggregations?: any; - } - - export interface SearchShardsParams extends GenericParams { - preference?: string; - routing?: string; - local?: boolean; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - index: NameList; - type: NameList; - } - - export interface SearchShardsResponse { - nodes: any; - shards: SearchShardsResponseShard[][]; - } - - export interface SearchShardsResponseShard { - index: string; - node: string; - primary: boolean; - share: number; - state: string; - allocation_id: { - id: string; - }; - relocating_node: any; - } - - export interface SearchTemplateParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - preference?: string; - routing?: NameList; - scroll?: TimeSpan; - searchType?: "query_then_fetch" | "query_and_fetch" | "dfs_query_then_fetch" | "dfs_query_and_fetch"; - index: NameList; - type: NameList; - } - - export interface SuggestParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - preference?: string; - routing?: string; - index: NameList; - } - - export interface TermvectorsParams extends GenericParams { - termStatistics?: boolean; - fieldStatistics?: boolean; - fields?: NameList; - offsets?: boolean; - positions?: boolean; - payloads?: boolean; - preference?: string; - routing?: string; - parent?: string; - realtime?: boolean; - version?: number; - versionType?: VersionType; - index: string; - type: string; - id?: string; - } - - export interface UpdateDocumentParams extends GenericParams { - waitForActiveShards?: string; - fields?: NameList; - _source?: NameList; - _sourceExclude?: NameList; - _sourceInclude?: NameList; - lang?: string; - parent?: string; - refresh?: Refresh; - retryOnConflict?: number; - routing?: string; - timeout?: TimeSpan; - timestamp?: Date | number; - ttl?: TimeSpan; - version?: number; - versionType?: "internal" | "force"; - id: string; - index: string; - type: string; - } - - export interface UpdateDocumentByQueryParams extends GenericParams { - analyzer?: string; - analyzeWildcard?: boolean; - defaultOperator?: DefaultOperator; - df?: string; - explain?: boolean; - storedFields?: NameList; - docvalueFields?: NameList; - fielddataFields?: NameList; - from?: number; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - conflicts?: Conflicts; - expandWildcards?: ExpandWildcards; - lenient?: boolean; - lowercaseExpandedTerms?: boolean; - pipeline?: string; - preference?: string; - q?: string; - routing?: NameList; - scroll?: TimeSpan; - searchType?: "query_then_fetch" | "dfs_query_then_fetch"; - searchTimeout?: TimeSpan; - size?: number; - sort?: NameList; - _source?: NameList; - _sourceExclude?: NameList; - _sourceInclude?: NameList; - terminateAfter?: number; - stats?: NameList; - suggestField?: string; - suggestMode?: "missing" | "popular" | "always"; - suggestSize?: number; - suggestText?: string; - timeout?: TimeSpan; - trackScores?: boolean; - version?: boolean; - versionType?: boolean; - requestCache?: boolean; - refresh?: boolean; - waitForActiveShards?: string; - scrollSize?: number; - waitForCompletion?: boolean; - requestsPerSecond?: number; - index: NameList; - type: NameList; - } - - export interface Cat { - aliases(params: CatAliasesParams, callback: (error: any, response: any) => void): void; - aliases(params: CatAliasesParams): Promise; - allocation(params: CatAllocationParams, callback: (error: any, response: any) => void): void; - allocation(params: CatAllocationParams): Promise; - count(params: CatCountParams, callback: (error: any, response: any) => void): void; - count(params: CatAllocationParams): Promise; - fielddata(params: CatFielddataParams, callback: (error: any, response: any) => void): void; - fielddata(params: CatFielddataParams): Promise; - health(params: CatHealthParams, callback: (error: any, response: any) => void): void; - health(params: CatHealthParams): Promise; - help(params: CatHelpParams, callback: (error: any, response: any) => void): void; - help(params: CatHelpParams): Promise; - indices(params: CatIndicesParams, callback: (error: any, response: any) => void): void; - indices(params: CatIndicesParams): Promise; - master(params: CatCommonParams, callback: (error: any, response: any) => void): void; - master(params: CatCommonParams): Promise; - nodeattrs(params: CatCommonParams, callback: (error: any, response: any) => void): void; - nodeattrs(params: CatCommonParams): Promise; - nodes(params: CatCommonParams, callback: (error: any, response: any) => void): void; - nodes(params: CatCommonParams): Promise; - pendingTasks(params: CatCommonParams, callback: (error: any, response: any) => void): void; - pendingTasks(params: CatCommonParams): Promise; - plugins(params: CatCommonParams, callback: (error: any, response: any) => void): void; - plugins(params: CatCommonParams): Promise; - recovery(params: CatRecoveryParams, callback: (error: any, response: any) => void): void; - recovery(params: CatRecoveryParams): Promise; - repositories(params: CatCommonParams, callback: (error: any, response: any) => void): void; - repositories(params: CatCommonParams): Promise; - segments(params: CatSegmentsParams, callback: (error: any, response: any) => void): void; - segments(params: CatSegmentsParams): Promise; - shards(params: CatShardsParams, callback: (error: any, response: any) => void): void; - shards(params: CatShardsParams): Promise; - snapshots(params: CatSnapshotsParams, callback: (error: any, response: any) => void): void; - snapshots(params: CatSnapshotsParams): Promise; - tasks(params: CatTasksParams, callback: (error: any, response: any) => void): void; - tasks(params: CatTasksParams): Promise; - threadPool(params: CatThreadPoolParams, callback: (error: any, response: any) => void): void; - threadPool(params: CatThreadPoolParams): Promise; - } - - export type CatBytes = "b" | "k" | "kb" | "m" | "mb" | "g" | "gb" | "t" | "tb" | "p" | "pb"; - - export interface CatCommonParams extends GenericParams { - format: string; - local?: boolean; - masterTimeout?: TimeSpan; - h?: NameList; - help?: boolean; - v?: boolean; - } - - export interface CatAliasesParams extends CatCommonParams { - name?: NameList; - } - - export interface CatAllocationParams extends CatCommonParams { - bytes?: CatBytes; - nodeId?: NameList; - } - - export interface CatCountParams extends CatCommonParams { - index?: NameList; - } - - export interface CatFielddataParams extends CatCommonParams { - bytes?: CatBytes; - fields?: NameList; - } - - export interface CatHealthParams extends CatCommonParams { - ts?: boolean; - } - - export interface CatHelpParams extends GenericParams { - help?: boolean; - } - - export interface CatIndicesParams extends CatCommonParams { - bytes?: CatBytes; - health?: "green" | "yellow" | "red"; - pri?: boolean; - index?: NameList; - } - - export interface CatRecoveryParams extends GenericParams { - format: string; - bytes?: CatBytes; - masterTimeout?: TimeSpan; - h?: NameList; - help?: boolean; - v?: boolean; - } - - export interface CatSegmentsParams extends GenericParams { - format: string; - h?: NameList; - help?: boolean; - v?: boolean; - index?: NameList; - } - - export interface CatShardsParams extends CatCommonParams { - index?: NameList; - } - - export interface CatSnapshotsParams extends GenericParams { - format: string; - ignoreUnavailable?: boolean; - masterTimeout?: TimeSpan; - h?: NameList; - help?: boolean; - v?: boolean; - repository?: NameList; - } - - export interface CatTasksParams extends GenericParams { - format: string; - nodeId?: NameList; - actions?: NameList; - detailed?: boolean; - parentNode?: string; - parentTask?: number; - h?: NameList; - help?: boolean; - v?: boolean; - } - - export interface CatThreadPoolParams extends CatCommonParams { - size?: "" | "k" | "m" | "g" | "t" | "p"; - threadPoolPatterns?: NameList; - } - - export interface Cluster { - allocationExplain(params: ClusterAllocationExplainParams, callback: (error: any, response: any) => void): void; - allocationExplain(params: ClusterAllocationExplainParams): Promise; - getSettings(params: ClusterGetSettingsParams, callback: (error: any, response: any) => void): void; - getSettings(params: ClusterGetSettingsParams): Promise; - health(params: ClusterHealthParams, callback: (error: any, response: any) => void): void; - health(params: ClusterHealthParams): Promise; - pendingTasks(params: ClusterPendingTasksParams, callback: (error: any, response: any) => void): void; - pendingTasks(params: ClusterPendingTasksParams): Promise; - putSettings(params: ClusterPutSettingsParams, callback: (error: any, response: any) => void): void; - putSettings(params: ClusterPutSettingsParams): Promise; - reroute(params: ClusterRerouteParams, callback: (error: any, response: any) => void): void; - reroute(params: ClusterRerouteParams): Promise; - state(params: ClusterStateParams, callback: (error: any, response: any) => void): void; - state(params: ClusterStateParams): Promise; - stats(params: ClusterStatsParams, callback: (error: any, response: any) => void): void; - stats(params: ClusterStatsParams): Promise; - } - - export interface ClusterAllocationExplainParams extends GenericParams { - includeYesDecisions?: boolean; - includeDiskInfo?: boolean; - } - - export interface ClusterGetSettingsParams extends GenericParams { - flatSettings?: boolean; - masterTimeout?: TimeSpan; - timeout?: TimeSpan; - includeDefaults?: boolean; - } - - export interface ClusterHealthParams extends GenericParams { - level?: "cluster" | "indices" | "shards"; - local?: boolean; - masterTimeout?: TimeSpan; - waitForActiveShards?: string; - waitForNodes?: string; - waitForEvents?: "immediate" | "urgent" | "high" | "normal" | "low" | "languid"; - waitForRelocatingShards?: boolean; - waitForStatus?: "green" | "yellow" | "red"; - index?: NameList; - } - - export interface ClusterPendingTasksParams extends GenericParams { - local?: boolean; - masterTimeout?: TimeSpan; - } - - export interface ClusterPutSettingsParams extends GenericParams { - flatSettings?: boolean; - masterTimeout?: TimeSpan; - timeout?: TimeSpan; - } - - export interface ClusterRerouteParams extends GenericParams { - dryRun?: boolean; - explain?: boolean; - retryFailed?: boolean; - metric?: NameList; - masterTimeout?: TimeSpan; - timeout?: TimeSpan; - } - - export interface ClusterStateParams extends GenericParams { - local?: boolean; - masterTimeout?: TimeSpan; - flatSettings?: boolean; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - index?: NameList; - metric?: NameList; - } - - export interface ClusterStatsParams extends GenericParams { - flatSettings?: boolean; - human?: boolean; - timeout?: TimeSpan; - nodeId?: NameList; - } - - export class Indices { - analyze(params: IndicesAnalyzeParams, callback: (error: any, response: any, status: any) => void): void; - analyze(params: IndicesAnalyzeParams): Promise; - clearCache(params: IndicesClearCacheParams, callback: (error: any, response: any, status: any) => void): void; - clearCache(params: IndicesClearCacheParams): Promise; - close(params: IndicesCloseParams, callback: (error: any, response: any, status: any) => void): void; - close(params: IndicesCloseParams): Promise; - create(params: IndicesCreateParams, callback: (error: any, response: any, status: any) => void): void; - create(params: IndicesCreateParams): Promise; - delete(params: IndicesDeleteParams, callback: (error: any, response: any, status: any) => void): void; - delete(params: IndicesDeleteParams): Promise; - deleteAlias(params: IndicesDeleteAliasParams, callback: (error: any, response: any, status: any) => void): void; - deleteAlias(params: IndicesDeleteAliasParams): Promise; - deleteTemplate(params: IndicesDeleteTemplateParams, callback: (error: any, response: any, status: any) => void): void; - deleteTemplate(params: IndicesDeleteTemplateParams): Promise; - exists(params: IndicesExistsParams, callback: (error: any, response: any, status: any) => void): void; - exists(params: IndicesExistsParams): Promise; - existsAlias(params: IndicesExistsAliasParams, callback: (error: any, response: any, status: any) => void): void; - existsAlias(params: IndicesExistsAliasParams): Promise; - existsTemplate(params: IndicesExistsTemplateParams, callback: (error: any, response: any, status: any) => void): void; - existsTemplate(params: IndicesExistsTemplateParams): Promise; - existsType(params: IndicesExistsTypeParams, callback: (error: any, response: any, status: any) => void): void; - existsType(params: IndicesExistsTypeParams): Promise; - flush(params: IndicesFlushParams, callback: (error: any, response: any, status: any) => void): void; - flush(params: IndicesFlushParams): Promise; - flushSynced(params: IndicesFlushSyncedParams, callback: (error: any, response: any, status: any) => void): void; - flushSynced(params: IndicesFlushSyncedParams): Promise; - forcemerge(params: IndicesForcemergeParams, callback: (error: any, response: any, status: any) => void): void; - forcemerge(params: IndicesForcemergeParams): Promise; - get(params: IndicesGetParams, callback: (error: any, response: any, status: any) => void): void; - get(params: IndicesGetParams): Promise; - getAlias(params: IndicesGetAliasParams, callback: (error: any, response: any, status: any) => void): void; - getAlias(params: IndicesGetAliasParams): Promise; - getFieldMapping(params: IndicesGetFieldMappingParams, callback: (error: any, response: any, status: any) => void): void; - getFieldMapping(params: IndicesGetFieldMappingParams): Promise; - getMapping(params: IndicesGetMappingParams, callback: (error: any, response: any, status: any) => void): void; - getMapping(params: IndicesGetMappingParams): Promise; - getSettings(params: IndicesGetSettingsParams, callback: (error: any, response: any, status: any) => void): void; - getSettings(params: IndicesGetSettingsParams): Promise; - getTemplate(params: IndicesGetTemplateParams, callback: (error: any, response: any, status: any) => void): void; - getTemplate(params: IndicesGetTemplateParams): Promise; - getUpgrade(params: IndicesGetUpgradeParams, callback: (error: any, response: any, status: any) => void): void; - getUpgrade(params: IndicesGetUpgradeParams): Promise; - open(params: IndicesOpenParams, callback: (error: any, response: any, status: any) => void): void; - open(params: IndicesOpenParams): Promise; - putAlias(params: IndicesPutAliasParams, callback: (error: any, response: any, status: any) => void): void; - putAlias(params: IndicesPutAliasParams): Promise; - putMapping(params: IndicesPutMappingParams, callback: (error: any, response: any, status: any) => void): void; - putMapping(params: IndicesPutMappingParams): Promise; - putSettings(params: IndicesPutSettingsParams, callback: (error: any, response: any, status: any) => void): void; - putSettings(params: IndicesPutSettingsParams): Promise; - putTemplate(params: IndicesPutTemplateParams, callback: (error: any, response: any) => void): void; - putTemplate(params: IndicesPutTemplateParams): Promise; - recovery(params: IndicesRecoveryParams, callback: (error: any, response: any) => void): void; - recovery(params: IndicesRecoveryParams): Promise; - refresh(params: IndicesRefreshParams, callback: (error: any, response: any) => void): void; - refresh(params: IndicesRefreshParams): Promise; - rollover(params: IndicesRolloverParams, callback: (error: any, response: IndicesRolloverResponse) => void): void; - rollover(params: IndicesRolloverParams): Promise; - segments(params: IndicesSegmentsParams, callback: (error: any, response: any) => void): void; - segments(params: IndicesSegmentsParams): Promise; - shardStores(params: IndicesShardStoresParams, callback: (error: any, response: any) => void): void; - shardStores(params: IndicesShardStoresParams): Promise; - shrink(params: IndicesShrinkParams, callback: (error: any, response: any) => void): void; - shrink(params: IndicesShrinkParams): Promise; - stats(params: IndicesStatsParams, callback: (error: any, response: any) => void): void; - stats(params: IndicesStatsParams): Promise; - updateAliases(params: IndicesUpdateAliasesParams, callback: (error: any, response: any) => void): void; - updateAliases(params: IndicesUpdateAliasesParams): Promise; - upgrade(params: IndicesUpgradeParams, callback: (error: any, response: any) => void): void; - upgrade(params: IndicesUpgradeParams): Promise; - validateQuery(params: IndicesValidateQueryParams, callback: (error: any, response: any) => void): void; - validateQuery(params: IndicesValidateQueryParams): Promise; - } - - export interface IndicesAnalyzeParams extends GenericParams { - analyzer?: string; - charFilter?: NameList; - field?: string; - filter?: NameList; - index?: string; - perferLocal?: boolean; - text?: NameList; - tokenizer?: string; - explain?: boolean; - attributes?: NameList; - format?: ""; - } - - export interface IndicesClearCacheParams extends GenericParams { - fieldData?: boolean; - fielddata?: boolean; // yes the docs really have both - fields?: NameList; - query?: boolean; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - index?: NameList; - recycler?: boolean; - request?: boolean; - } - - export interface IndicesCloseParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - index: NameList; - } - - export interface IndicesCreateParams extends GenericParams { - waitForActiveShards?: string; - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - updateAllTypes?: boolean; - index: string; - } - - export interface IndicesDeleteParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - index: NameList; - } - - export interface IndicesDeleteAliasParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - index: NameList; - name: NameList; - } - - export interface IndicesDeleteTemplateParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - name: string; - } - - export interface IndicesExistsParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - local?: boolean; - index: NameList; - } - - export interface IndicesExistsAliasParams extends IndicesExistsParams { - name: NameList; - } - - export interface IndicesExistsTemplateParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - name: NameList; - } - - export interface IndicesExistsTypeParams extends IndicesExistsParams { - type: NameList; - } - - export interface IndicesFlushParams extends GenericParams { - force?: boolean; - waitIfOngoing?: boolean; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - index: NameList; - } - - export interface IndicesFlushSyncedParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - index: NameList; - } - - export interface IndicesForcemergeParams extends GenericParams { - flush?: boolean; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - maxNumSegments?: number; - onlyExpungeDeletes?: boolean; - operationThreading?: any; // even the docs don't know what this does - waitForMerge?: boolean; - index: NameList; - } - - export interface IndicesGetParams extends GenericParams { - local?: boolean; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - flatSettings?: boolean; - human?: boolean; - includeDefaults?: boolean; - index?: NameList; - feature?: NameList; - } - - export interface IndicesGetAliasParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - local?: boolean; - index?: NameList; - name?: NameList; - } - - export interface IndicesGetFieldMappingParams extends GenericParams { - includeDefaults?: boolean; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - local?: boolean; - index?: NameList; - type?: NameList; - fields?: NameList; - } - - export interface IndicesGetMappingParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - local?: boolean; - index?: NameList; - type?: NameList; - } - - export interface IndicesGetSettingsParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - flatSettings?: boolean; - local?: boolean; - human?: boolean; - includeDefaults?: boolean; - index?: NameList; - name?: NameList; - } - - export interface IndicesGetTemplateParams extends GenericParams { - flatSettings?: boolean; - masterTimeout?: TimeSpan; - local?: boolean; - name?: NameList; - } - - export interface IndicesGetUpgradeParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - human?: boolean; - index?: NameList; - } - - export interface IndicesOpenParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - index?: NameList; - } - - export interface IndicesPutAliasParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - index?: NameList; - name: NameList; - } - - export interface IndicesPutMappingParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - updateAllTypes?: boolean; - index: NameList; - type: string; - body: any; - } - - export interface IndicesPutSettingsParams extends GenericParams { - masterTimeout?: TimeSpan; - preserveExisting?: boolean; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - flatSettings?: boolean; - index: NameList; - body: any; - } - - export interface IndicesPutTemplateParams extends GenericParams { - order?: number; - create?: boolean; - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - flatSettings?: boolean; - name: string; - body: any; - } - - export interface IndicesRecoveryParams extends GenericParams { - detailed?: boolean; - activeOnly?: boolean; - human?: boolean; - index: NameList; - } - - export interface IndicesRefreshParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - force?: boolean; - operationThreading?: any; // even the docs don't know what this does - index: NameList; - } - - export interface IndicesRolloverParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - waitForActiveShards?: number | string; - alias?: string; - newIndex?: string; - } - - export interface IndicesRolloverResponse { - acknowledged: boolean; - shards_acknowledged: boolean; - old_index: string; - new_index: string; - rolled_over: boolean; - dry_run: boolean; - conditions: { [condition: string]: boolean }; - } - - export interface IndicesSegmentsParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - human?: boolean; - operationThreading?: any; // even the docs don't know what this does - verbose?: boolean; - index: NameList; - } - - export interface IndicesShardStoresParams extends GenericParams { - status?: NameList; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - operationThreading?: any; // even the docs don't know what this does - index: NameList; - } - - export interface IndicesShrinkParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - waitForActiveShards?: string | number; - index: string; - target: string; - } - - export interface IndicesStatsParams extends GenericParams { - completionFields?: NameList; - fielddataFields?: NameList; - fields?: NameList; - groups?: NameList; - human?: boolean; - level?: "cluster" | "indices" | "shards"; - types?: NameList; - index: NameList; - metric?: NameList; - } - - export interface IndicesUpdateAliasesParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - body: { - actions: IndicesUpdateAliasesParamsAction[]; - }; - } - - export interface IndicesUpdateAliasesParamsAction { - add?: { - index?: string; - indices?: string[]; - alias: string; - }; - remove?: { - index?: string; - indices?: string[]; - alias: string; - }; - remove_index?: { + dest: { index: string; + version_type?: string; + op_type?: string; + routing?: string; + pipeline?: string; }; - } - - export interface IndicesUpgradeParams extends GenericParams { - expandWildcards?: ExpandWildcards; - ignoreUnavailable?: boolean; - waitForCompletion?: boolean; - onlyAncientSegments?: boolean; - index: NameList; - } - - export interface IndicesValidateQueryParams extends GenericParams { - explain?: boolean; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - operationThreading?: any; // even the docs don't know what this does - q?: string; - analyzer?: string; - analyzeWildcard?: boolean; - defaultOperator?: DefaultOperator; - df?: string; - lenient?: boolean; - lowercaseExpandedTerms?: boolean; - rewrite?: boolean; - index: NameList; - type?: NameList; - } - - export class Ingest { - deletePipeline(params: IngestDeletePipelineParams, callback: (error: any, response: any, status: any) => void): void; - deletePipeline(params: IngestDeletePipelineParams): Promise; - getPipeline(params: IngestGetPipelineParams, callback: (error: any, response: any, status: any) => void): void; - getPipeline(params: IngestGetPipelineParams): Promise; - putPipeline(params: IngestPutPipelineParams, callback: (error: any, response: any, status: any) => void): void; - putPipeline(params: IngestPutPipelineParams): Promise; - simulate(params: IngestSimulateParams, callback: (error: any, response: any, status: any) => void): void; - simulate(params: IngestSimulateParams): Promise; - } - - export interface IngestDeletePipelineParams extends GenericParams { - masterTimeout?: number; - timeout?: number; - id: string; - } - - export interface IngestGetPipelineParams extends GenericParams { - masterTimeout?: number; - id: string; - } - - export interface IngestPutPipelineParams extends GenericParams { - masterTimeout?: number; - timeout?: number; - id: string; - body: any; - } - - export interface IngestSimulateParams extends GenericParams { - verbose?: boolean; - id: string; - } - - export class Nodes { - hotThreads(params: NodesHotThreadsParams, callback: (error: any, response: any, status: any) => void): void; - hotThreads(params: NodesHotThreadsParams): Promise; - info(params: NodesInfoParams, callback: (error: any, response: any, status: any) => void): void; - info(params: NodesInfoParams): Promise; - stats(params: NodesStatsParams, callback: (error: any, response: any, status: any) => void): void; - stats(params: NodesStatsParams): Promise; - } - - export interface NodesHotThreadsParams extends GenericParams { - interval?: TimeSpan; - snapshots?: number; - threads?: number; - ignoreIdleThreads?: boolean; - type?: "cpu" | "wait" | "blocked"; - timeout?: TimeSpan; - nodeId: NameList; - } - - export interface NodesInfoParams extends GenericParams { - flatSettings?: boolean; - human?: boolean; - timeout?: TimeSpan; - nodeId: NameList; - metric?: NameList; - } - - export interface NodesStatsParams extends GenericParams { - completionFields?: NameList; - fielddataFields?: NameList; - fields?: NameList; - groups?: boolean; - human?: boolean; - level?: "indices" | "node" | "shards"; - types?: NameList; - timeout?: TimeSpan; - metric?: NameList; - indexMetric?: NameList; - nodeId?: NameList; - } - - export class Snapshot { - create(params: SnapshotCreateParams, callback: (error: any, response: any, status: any) => void): void; - create(params: SnapshotCreateParams): Promise; - createRepository(params: SnapshotCreateRepositoryParams, callback: (error: any, response: any, status: any) => void): void; - createRepository(params: SnapshotCreateRepositoryParams): Promise; - delete(params: SnapshotDeleteParams, callback: (error: any, response: any, status: any) => void): void; - delete(params: SnapshotDeleteParams): Promise; - deleteRepository(params: SnapshotDeleteRepositoryParams, callback: (error: any, response: any, status: any) => void): void; - deleteRepository(params: SnapshotDeleteRepositoryParams): Promise; - get(params: SnapshotGetParams, callback: (error: any, response: any, status: any) => void): void; - get(params: SnapshotGetParams): Promise; - getRepository(params: SnapshotGetRepositoryParams, callback: (error: any, response: any, status: any) => void): void; - getRepository(params: SnapshotGetRepositoryParams): Promise; - restore(params: SnapshotRestoreParams, callback: (error: any, response: any, status: any) => void): void; - restore(params: SnapshotRestoreParams): Promise; - status(params: SnapshotStatusParams, callback: (error: any, response: any, status: any) => void): void; - status(params: SnapshotStatusParams): Promise; - verifyRepository(params: SnapshotVerifyRepositoryParams, callback: (error: any, response: any, status: any) => void): void; - verifyRepository(params: SnapshotVerifyRepositoryParams): Promise; - } - - export interface SnapshotCreateParams extends GenericParams { - masterTimeout?: TimeSpan; - waitForCompletion?: boolean; - repository: string; - snapshot: string; - } - - export interface SnapshotCreateRepositoryParams extends GenericParams { - masterTimeout?: TimeSpan; - timeout?: TimeSpan; - verify?: boolean; - repository: string; - } - - export interface SnapshotDeleteParams extends GenericParams { - masterTimeout?: TimeSpan; - repository: string; - snapshot: string; - } - - export interface SnapshotDeleteRepositoryParams extends GenericParams { - masterTimeout?: TimeSpan; - timeout?: TimeSpan; - repository: string; - } - - export interface SnapshotGetParams extends GenericParams { - masterTimeout?: TimeSpan; - ignoreUnavailable?: boolean; - repository: string; - snapshot: NameList; - } - - export interface SnapshotGetRepositoryParams extends GenericParams { - masterTimeout?: TimeSpan; - local?: boolean; - repository: NameList; - } - - export interface SnapshotRestoreParams extends GenericParams { - masterTimeout?: TimeSpan; - waitForCompletion?: boolean; - repository: string; - snapshot: string; - } - - export interface SnapshotStatusParams extends GenericParams { - masterTimeout?: TimeSpan; - ignoreUnavailable?: boolean; - repository: string; - snapshot: NameList; - } - - export interface SnapshotVerifyRepositoryParams extends GenericParams { - masterTimeout?: TimeSpan; - timeout?: TimeSpan; - repository: string; - } - - export class Tasks { - cancel(params: TasksCancelParams, callback: (error: any, response: any, status: any) => void): void; - cancel(params: TasksCancelParams): Promise; - get(params: TasksGetParams, callback: (error: any, response: any, status: any) => void): void; - get(params: TasksGetParams): Promise; - list(params: TasksListParams, callback: (error: any, response: any, status: any) => void): void; - list(params: TasksListParams): Promise; - } - - export interface TasksCancelParams extends GenericParams { - nodeId?: NameList; - actions?: NameList; - parentNode?: string; - parentTask?: string; - taskId?: string; - } - - export interface TasksGetParams extends GenericParams { - waitForCompletion?: boolean; - taskId?: string; - } - - export interface TasksListParams extends GenericParams { - nodeId?: NameList; - actions?: NameList; - detailed?: boolean; - parentNode?: string; - parentTask?: string; - waitForCompletion?: boolean; - groupBy?: "nodes" | "parents"; - } + script?: { + inline: string; + lang: string; + } + }; } -declare module "elasticsearch" { - export = Elasticsearch; +export interface ReindexResponse { + took: number; + updated: number; + created: number; + batches: number; + version_conflicts: number; + retries: { + bulk: number; + search: number; + }; + throttled_millis: number; + failures: any[]; +} + +export interface ReindexRethrottleParams extends GenericParams { + requestsPerSecond: number; + taskId: string; +} + +export interface RenderSearchTemplateParams extends GenericParams { + id: string; +} + +export interface ScrollParams extends GenericParams { + scroll: TimeSpan; + scrollId: string; +} + +export interface SearchParams extends GenericParams { + analyzer?: string; + analyzeWildcard?: boolean; + defaultOperator?: DefaultOperator; + df?: string; + explain?: boolean; + storedFields?: NameList; + docvalueFields?: NameList; + fielddataFields?: NameList; + from?: number; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + lenient?: boolean; + lowercaseExpandedTerms?: boolean; + preference?: string; + q?: string; + routing?: NameList; + scroll?: TimeSpan; + searchType?: "query_then_fetch" | "dfs_query_then_fetch"; + size?: number; + sort?: NameList; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + terminateAfter?: number; + stats?: NameList; + suggestField?: string; + suggestMode?: "missing" | "popular" | "always"; + suggestSize?: number; + suggestText?: string; + timeout?: TimeSpan; + trackScores?: boolean; + version?: boolean; + requestCache?: boolean; + index?: NameList; + type?: NameList; +} + +export interface SearchResponse { + took: number; + timed_out: boolean; + _scroll_id?: string; + _shards: ShardsResponse; + hits: { + total: number; + max_score: number; + hits: { + _index: string; + _type: string; + _id: string; + _score: number; + _source: T; + _version?: number; + _explanation?: Explanation; + fields?: any; + highlight?: any; + inner_hits?: any; + }[]; + }; + aggregations?: any; +} + +export interface SearchShardsParams extends GenericParams { + preference?: string; + routing?: string; + local?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index: NameList; + type: NameList; +} + +export interface SearchShardsResponse { + nodes: any; + shards: SearchShardsResponseShard[][]; +} + +export interface SearchShardsResponseShard { + index: string; + node: string; + primary: boolean; + share: number; + state: string; + allocation_id: { + id: string; + }; + relocating_node: any; +} + +export interface SearchTemplateParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + preference?: string; + routing?: NameList; + scroll?: TimeSpan; + searchType?: "query_then_fetch" | "query_and_fetch" | "dfs_query_then_fetch" | "dfs_query_and_fetch"; + index: NameList; + type: NameList; +} + +export interface SuggestParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + preference?: string; + routing?: string; + index: NameList; +} + +export interface TermvectorsParams extends GenericParams { + termStatistics?: boolean; + fieldStatistics?: boolean; + fields?: NameList; + offsets?: boolean; + positions?: boolean; + payloads?: boolean; + preference?: string; + routing?: string; + parent?: string; + realtime?: boolean; + version?: number; + versionType?: VersionType; + index: string; + type: string; + id?: string; +} + +export interface UpdateDocumentParams extends GenericParams { + waitForActiveShards?: string; + fields?: NameList; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + lang?: string; + parent?: string; + refresh?: Refresh; + retryOnConflict?: number; + routing?: string; + timeout?: TimeSpan; + timestamp?: Date | number; + ttl?: TimeSpan; + version?: number; + versionType?: "internal" | "force"; + id: string; + index: string; + type: string; +} + +export interface UpdateDocumentByQueryParams extends GenericParams { + analyzer?: string; + analyzeWildcard?: boolean; + defaultOperator?: DefaultOperator; + df?: string; + explain?: boolean; + storedFields?: NameList; + docvalueFields?: NameList; + fielddataFields?: NameList; + from?: number; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + conflicts?: Conflicts; + expandWildcards?: ExpandWildcards; + lenient?: boolean; + lowercaseExpandedTerms?: boolean; + pipeline?: string; + preference?: string; + q?: string; + routing?: NameList; + scroll?: TimeSpan; + searchType?: "query_then_fetch" | "dfs_query_then_fetch"; + searchTimeout?: TimeSpan; + size?: number; + sort?: NameList; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + terminateAfter?: number; + stats?: NameList; + suggestField?: string; + suggestMode?: "missing" | "popular" | "always"; + suggestSize?: number; + suggestText?: string; + timeout?: TimeSpan; + trackScores?: boolean; + version?: boolean; + versionType?: boolean; + requestCache?: boolean; + refresh?: boolean; + waitForActiveShards?: string; + scrollSize?: number; + waitForCompletion?: boolean; + requestsPerSecond?: number; + index: NameList; + type: NameList; +} + +export interface Cat { + aliases(params: CatAliasesParams, callback: (error: any, response: any) => void): void; + aliases(params: CatAliasesParams): Promise; + allocation(params: CatAllocationParams, callback: (error: any, response: any) => void): void; + allocation(params: CatAllocationParams): Promise; + count(params: CatCountParams, callback: (error: any, response: any) => void): void; + count(params: CatAllocationParams): Promise; + fielddata(params: CatFielddataParams, callback: (error: any, response: any) => void): void; + fielddata(params: CatFielddataParams): Promise; + health(params: CatHealthParams, callback: (error: any, response: any) => void): void; + health(params: CatHealthParams): Promise; + help(params: CatHelpParams, callback: (error: any, response: any) => void): void; + help(params: CatHelpParams): Promise; + indices(params: CatIndicesParams, callback: (error: any, response: any) => void): void; + indices(params: CatIndicesParams): Promise; + master(params: CatCommonParams, callback: (error: any, response: any) => void): void; + master(params: CatCommonParams): Promise; + nodeattrs(params: CatCommonParams, callback: (error: any, response: any) => void): void; + nodeattrs(params: CatCommonParams): Promise; + nodes(params: CatCommonParams, callback: (error: any, response: any) => void): void; + nodes(params: CatCommonParams): Promise; + pendingTasks(params: CatCommonParams, callback: (error: any, response: any) => void): void; + pendingTasks(params: CatCommonParams): Promise; + plugins(params: CatCommonParams, callback: (error: any, response: any) => void): void; + plugins(params: CatCommonParams): Promise; + recovery(params: CatRecoveryParams, callback: (error: any, response: any) => void): void; + recovery(params: CatRecoveryParams): Promise; + repositories(params: CatCommonParams, callback: (error: any, response: any) => void): void; + repositories(params: CatCommonParams): Promise; + segments(params: CatSegmentsParams, callback: (error: any, response: any) => void): void; + segments(params: CatSegmentsParams): Promise; + shards(params: CatShardsParams, callback: (error: any, response: any) => void): void; + shards(params: CatShardsParams): Promise; + snapshots(params: CatSnapshotsParams, callback: (error: any, response: any) => void): void; + snapshots(params: CatSnapshotsParams): Promise; + tasks(params: CatTasksParams, callback: (error: any, response: any) => void): void; + tasks(params: CatTasksParams): Promise; + threadPool(params: CatThreadPoolParams, callback: (error: any, response: any) => void): void; + threadPool(params: CatThreadPoolParams): Promise; +} + +export type CatBytes = "b" | "k" | "kb" | "m" | "mb" | "g" | "gb" | "t" | "tb" | "p" | "pb"; + +export interface CatCommonParams extends GenericParams { + format: string; + local?: boolean; + masterTimeout?: TimeSpan; + h?: NameList; + help?: boolean; + v?: boolean; +} + +export interface CatAliasesParams extends CatCommonParams { + name?: NameList; +} + +export interface CatAllocationParams extends CatCommonParams { + bytes?: CatBytes; + nodeId?: NameList; +} + +export interface CatCountParams extends CatCommonParams { + index?: NameList; +} + +export interface CatFielddataParams extends CatCommonParams { + bytes?: CatBytes; + fields?: NameList; +} + +export interface CatHealthParams extends CatCommonParams { + ts?: boolean; +} + +export interface CatHelpParams extends GenericParams { + help?: boolean; +} + +export interface CatIndicesParams extends CatCommonParams { + bytes?: CatBytes; + health?: "green" | "yellow" | "red"; + pri?: boolean; + index?: NameList; +} + +export interface CatRecoveryParams extends GenericParams { + format: string; + bytes?: CatBytes; + masterTimeout?: TimeSpan; + h?: NameList; + help?: boolean; + v?: boolean; +} + +export interface CatSegmentsParams extends GenericParams { + format: string; + h?: NameList; + help?: boolean; + v?: boolean; + index?: NameList; +} + +export interface CatShardsParams extends CatCommonParams { + index?: NameList; +} + +export interface CatSnapshotsParams extends GenericParams { + format: string; + ignoreUnavailable?: boolean; + masterTimeout?: TimeSpan; + h?: NameList; + help?: boolean; + v?: boolean; + repository?: NameList; +} + +export interface CatTasksParams extends GenericParams { + format: string; + nodeId?: NameList; + actions?: NameList; + detailed?: boolean; + parentNode?: string; + parentTask?: number; + h?: NameList; + help?: boolean; + v?: boolean; +} + +export interface CatThreadPoolParams extends CatCommonParams { + size?: "" | "k" | "m" | "g" | "t" | "p"; + threadPoolPatterns?: NameList; +} + +export interface Cluster { + allocationExplain(params: ClusterAllocationExplainParams, callback: (error: any, response: any) => void): void; + allocationExplain(params: ClusterAllocationExplainParams): Promise; + getSettings(params: ClusterGetSettingsParams, callback: (error: any, response: any) => void): void; + getSettings(params: ClusterGetSettingsParams): Promise; + health(params: ClusterHealthParams, callback: (error: any, response: any) => void): void; + health(params: ClusterHealthParams): Promise; + pendingTasks(params: ClusterPendingTasksParams, callback: (error: any, response: any) => void): void; + pendingTasks(params: ClusterPendingTasksParams): Promise; + putSettings(params: ClusterPutSettingsParams, callback: (error: any, response: any) => void): void; + putSettings(params: ClusterPutSettingsParams): Promise; + reroute(params: ClusterRerouteParams, callback: (error: any, response: any) => void): void; + reroute(params: ClusterRerouteParams): Promise; + state(params: ClusterStateParams, callback: (error: any, response: any) => void): void; + state(params: ClusterStateParams): Promise; + stats(params: ClusterStatsParams, callback: (error: any, response: any) => void): void; + stats(params: ClusterStatsParams): Promise; +} + +export interface ClusterAllocationExplainParams extends GenericParams { + includeYesDecisions?: boolean; + includeDiskInfo?: boolean; +} + +export interface ClusterGetSettingsParams extends GenericParams { + flatSettings?: boolean; + masterTimeout?: TimeSpan; + timeout?: TimeSpan; + includeDefaults?: boolean; +} + +export interface ClusterHealthParams extends GenericParams { + level?: "cluster" | "indices" | "shards"; + local?: boolean; + masterTimeout?: TimeSpan; + waitForActiveShards?: string; + waitForNodes?: string; + waitForEvents?: "immediate" | "urgent" | "high" | "normal" | "low" | "languid"; + waitForRelocatingShards?: boolean; + waitForStatus?: "green" | "yellow" | "red"; + index?: NameList; +} + +export interface ClusterPendingTasksParams extends GenericParams { + local?: boolean; + masterTimeout?: TimeSpan; +} + +export interface ClusterPutSettingsParams extends GenericParams { + flatSettings?: boolean; + masterTimeout?: TimeSpan; + timeout?: TimeSpan; +} + +export interface ClusterRerouteParams extends GenericParams { + dryRun?: boolean; + explain?: boolean; + retryFailed?: boolean; + metric?: NameList; + masterTimeout?: TimeSpan; + timeout?: TimeSpan; +} + +export interface ClusterStateParams extends GenericParams { + local?: boolean; + masterTimeout?: TimeSpan; + flatSettings?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index?: NameList; + metric?: NameList; +} + +export interface ClusterStatsParams extends GenericParams { + flatSettings?: boolean; + human?: boolean; + timeout?: TimeSpan; + nodeId?: NameList; +} + +export class Indices { + analyze(params: IndicesAnalyzeParams, callback: (error: any, response: any, status: any) => void): void; + analyze(params: IndicesAnalyzeParams): Promise; + clearCache(params: IndicesClearCacheParams, callback: (error: any, response: any, status: any) => void): void; + clearCache(params: IndicesClearCacheParams): Promise; + close(params: IndicesCloseParams, callback: (error: any, response: any, status: any) => void): void; + close(params: IndicesCloseParams): Promise; + create(params: IndicesCreateParams, callback: (error: any, response: any, status: any) => void): void; + create(params: IndicesCreateParams): Promise; + delete(params: IndicesDeleteParams, callback: (error: any, response: any, status: any) => void): void; + delete(params: IndicesDeleteParams): Promise; + deleteAlias(params: IndicesDeleteAliasParams, callback: (error: any, response: any, status: any) => void): void; + deleteAlias(params: IndicesDeleteAliasParams): Promise; + deleteTemplate(params: IndicesDeleteTemplateParams, callback: (error: any, response: any, status: any) => void): void; + deleteTemplate(params: IndicesDeleteTemplateParams): Promise; + exists(params: IndicesExistsParams, callback: (error: any, response: any, status: any) => void): void; + exists(params: IndicesExistsParams): Promise; + existsAlias(params: IndicesExistsAliasParams, callback: (error: any, response: any, status: any) => void): void; + existsAlias(params: IndicesExistsAliasParams): Promise; + existsTemplate(params: IndicesExistsTemplateParams, callback: (error: any, response: any, status: any) => void): void; + existsTemplate(params: IndicesExistsTemplateParams): Promise; + existsType(params: IndicesExistsTypeParams, callback: (error: any, response: any, status: any) => void): void; + existsType(params: IndicesExistsTypeParams): Promise; + flush(params: IndicesFlushParams, callback: (error: any, response: any, status: any) => void): void; + flush(params: IndicesFlushParams): Promise; + flushSynced(params: IndicesFlushSyncedParams, callback: (error: any, response: any, status: any) => void): void; + flushSynced(params: IndicesFlushSyncedParams): Promise; + forcemerge(params: IndicesForcemergeParams, callback: (error: any, response: any, status: any) => void): void; + forcemerge(params: IndicesForcemergeParams): Promise; + get(params: IndicesGetParams, callback: (error: any, response: any, status: any) => void): void; + get(params: IndicesGetParams): Promise; + getAlias(params: IndicesGetAliasParams, callback: (error: any, response: any, status: any) => void): void; + getAlias(params: IndicesGetAliasParams): Promise; + getFieldMapping(params: IndicesGetFieldMappingParams, callback: (error: any, response: any, status: any) => void): void; + getFieldMapping(params: IndicesGetFieldMappingParams): Promise; + getMapping(params: IndicesGetMappingParams, callback: (error: any, response: any, status: any) => void): void; + getMapping(params: IndicesGetMappingParams): Promise; + getSettings(params: IndicesGetSettingsParams, callback: (error: any, response: any, status: any) => void): void; + getSettings(params: IndicesGetSettingsParams): Promise; + getTemplate(params: IndicesGetTemplateParams, callback: (error: any, response: any, status: any) => void): void; + getTemplate(params: IndicesGetTemplateParams): Promise; + getUpgrade(params: IndicesGetUpgradeParams, callback: (error: any, response: any, status: any) => void): void; + getUpgrade(params: IndicesGetUpgradeParams): Promise; + open(params: IndicesOpenParams, callback: (error: any, response: any, status: any) => void): void; + open(params: IndicesOpenParams): Promise; + putAlias(params: IndicesPutAliasParams, callback: (error: any, response: any, status: any) => void): void; + putAlias(params: IndicesPutAliasParams): Promise; + putMapping(params: IndicesPutMappingParams, callback: (error: any, response: any, status: any) => void): void; + putMapping(params: IndicesPutMappingParams): Promise; + putSettings(params: IndicesPutSettingsParams, callback: (error: any, response: any, status: any) => void): void; + putSettings(params: IndicesPutSettingsParams): Promise; + putTemplate(params: IndicesPutTemplateParams, callback: (error: any, response: any) => void): void; + putTemplate(params: IndicesPutTemplateParams): Promise; + recovery(params: IndicesRecoveryParams, callback: (error: any, response: any) => void): void; + recovery(params: IndicesRecoveryParams): Promise; + refresh(params: IndicesRefreshParams, callback: (error: any, response: any) => void): void; + refresh(params: IndicesRefreshParams): Promise; + rollover(params: IndicesRolloverParams, callback: (error: any, response: IndicesRolloverResponse) => void): void; + rollover(params: IndicesRolloverParams): Promise; + segments(params: IndicesSegmentsParams, callback: (error: any, response: any) => void): void; + segments(params: IndicesSegmentsParams): Promise; + shardStores(params: IndicesShardStoresParams, callback: (error: any, response: any) => void): void; + shardStores(params: IndicesShardStoresParams): Promise; + shrink(params: IndicesShrinkParams, callback: (error: any, response: any) => void): void; + shrink(params: IndicesShrinkParams): Promise; + stats(params: IndicesStatsParams, callback: (error: any, response: any) => void): void; + stats(params: IndicesStatsParams): Promise; + updateAliases(params: IndicesUpdateAliasesParams, callback: (error: any, response: any) => void): void; + updateAliases(params: IndicesUpdateAliasesParams): Promise; + upgrade(params: IndicesUpgradeParams, callback: (error: any, response: any) => void): void; + upgrade(params: IndicesUpgradeParams): Promise; + validateQuery(params: IndicesValidateQueryParams, callback: (error: any, response: any) => void): void; + validateQuery(params: IndicesValidateQueryParams): Promise; +} + +export interface IndicesAnalyzeParams extends GenericParams { + analyzer?: string; + charFilter?: NameList; + field?: string; + filter?: NameList; + index?: string; + perferLocal?: boolean; + text?: NameList; + tokenizer?: string; + explain?: boolean; + attributes?: NameList; + format?: ""; +} + +export interface IndicesClearCacheParams extends GenericParams { + fieldData?: boolean; + fielddata?: boolean; // yes the docs really have both + fields?: NameList; + query?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index?: NameList; + recycler?: boolean; + request?: boolean; +} + +export interface IndicesCloseParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index: NameList; +} + +export interface IndicesCreateParams extends GenericParams { + waitForActiveShards?: string; + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + updateAllTypes?: boolean; + index: string; +} + +export interface IndicesDeleteParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + index: NameList; +} + +export interface IndicesDeleteAliasParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + index: NameList; + name: NameList; +} + +export interface IndicesDeleteTemplateParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + name: string; +} + +export interface IndicesExistsParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + local?: boolean; + index: NameList; +} + +export interface IndicesExistsAliasParams extends IndicesExistsParams { + name: NameList; +} + +export interface IndicesExistsTemplateParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + name: NameList; +} + +export interface IndicesExistsTypeParams extends IndicesExistsParams { + type: NameList; +} + +export interface IndicesFlushParams extends GenericParams { + force?: boolean; + waitIfOngoing?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index: NameList; +} + +export interface IndicesFlushSyncedParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index: NameList; +} + +export interface IndicesForcemergeParams extends GenericParams { + flush?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + maxNumSegments?: number; + onlyExpungeDeletes?: boolean; + operationThreading?: any; // even the docs don't know what this does + waitForMerge?: boolean; + index: NameList; +} + +export interface IndicesGetParams extends GenericParams { + local?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + flatSettings?: boolean; + human?: boolean; + includeDefaults?: boolean; + index?: NameList; + feature?: NameList; +} + +export interface IndicesGetAliasParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + local?: boolean; + index?: NameList; + name?: NameList; +} + +export interface IndicesGetFieldMappingParams extends GenericParams { + includeDefaults?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + local?: boolean; + index?: NameList; + type?: NameList; + fields?: NameList; +} + +export interface IndicesGetMappingParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + local?: boolean; + index?: NameList; + type?: NameList; +} + +export interface IndicesGetSettingsParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + flatSettings?: boolean; + local?: boolean; + human?: boolean; + includeDefaults?: boolean; + index?: NameList; + name?: NameList; +} + +export interface IndicesGetTemplateParams extends GenericParams { + flatSettings?: boolean; + masterTimeout?: TimeSpan; + local?: boolean; + name?: NameList; +} + +export interface IndicesGetUpgradeParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + human?: boolean; + index?: NameList; +} + +export interface IndicesOpenParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index?: NameList; +} + +export interface IndicesPutAliasParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + index?: NameList; + name: NameList; +} + +export interface IndicesPutMappingParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + updateAllTypes?: boolean; + index: NameList; + type: string; + body: any; +} + +export interface IndicesPutSettingsParams extends GenericParams { + masterTimeout?: TimeSpan; + preserveExisting?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + flatSettings?: boolean; + index: NameList; + body: any; +} + +export interface IndicesPutTemplateParams extends GenericParams { + order?: number; + create?: boolean; + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + flatSettings?: boolean; + name: string; + body: any; +} + +export interface IndicesRecoveryParams extends GenericParams { + detailed?: boolean; + activeOnly?: boolean; + human?: boolean; + index: NameList; +} + +export interface IndicesRefreshParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + force?: boolean; + operationThreading?: any; // even the docs don't know what this does + index: NameList; +} + +export interface IndicesRolloverParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + waitForActiveShards?: number | string; + alias?: string; + newIndex?: string; +} + +export interface IndicesRolloverResponse { + acknowledged: boolean; + shards_acknowledged: boolean; + old_index: string; + new_index: string; + rolled_over: boolean; + dry_run: boolean; + conditions: { [condition: string]: boolean }; +} + +export interface IndicesSegmentsParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + human?: boolean; + operationThreading?: any; // even the docs don't know what this does + verbose?: boolean; + index: NameList; +} + +export interface IndicesShardStoresParams extends GenericParams { + status?: NameList; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + operationThreading?: any; // even the docs don't know what this does + index: NameList; +} + +export interface IndicesShrinkParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + waitForActiveShards?: string | number; + index: string; + target: string; +} + +export interface IndicesStatsParams extends GenericParams { + completionFields?: NameList; + fielddataFields?: NameList; + fields?: NameList; + groups?: NameList; + human?: boolean; + level?: "cluster" | "indices" | "shards"; + types?: NameList; + index: NameList; + metric?: NameList; +} + +export interface IndicesUpdateAliasesParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + body: { + actions: IndicesUpdateAliasesParamsAction[]; + }; +} + +export interface IndicesUpdateAliasesParamsAction { + add?: { + index?: string; + indices?: string[]; + alias: string; + }; + remove?: { + index?: string; + indices?: string[]; + alias: string; + }; + remove_index?: { + index: string; + }; +} + +export interface IndicesUpgradeParams extends GenericParams { + expandWildcards?: ExpandWildcards; + ignoreUnavailable?: boolean; + waitForCompletion?: boolean; + onlyAncientSegments?: boolean; + index: NameList; +} + +export interface IndicesValidateQueryParams extends GenericParams { + explain?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + operationThreading?: any; // even the docs don't know what this does + q?: string; + analyzer?: string; + analyzeWildcard?: boolean; + defaultOperator?: DefaultOperator; + df?: string; + lenient?: boolean; + lowercaseExpandedTerms?: boolean; + rewrite?: boolean; + index: NameList; + type?: NameList; +} + +export class Ingest { + deletePipeline(params: IngestDeletePipelineParams, callback: (error: any, response: any, status: any) => void): void; + deletePipeline(params: IngestDeletePipelineParams): Promise; + getPipeline(params: IngestGetPipelineParams, callback: (error: any, response: any, status: any) => void): void; + getPipeline(params: IngestGetPipelineParams): Promise; + putPipeline(params: IngestPutPipelineParams, callback: (error: any, response: any, status: any) => void): void; + putPipeline(params: IngestPutPipelineParams): Promise; + simulate(params: IngestSimulateParams, callback: (error: any, response: any, status: any) => void): void; + simulate(params: IngestSimulateParams): Promise; +} + +export interface IngestDeletePipelineParams extends GenericParams { + masterTimeout?: number; + timeout?: number; + id: string; +} + +export interface IngestGetPipelineParams extends GenericParams { + masterTimeout?: number; + id: string; +} + +export interface IngestPutPipelineParams extends GenericParams { + masterTimeout?: number; + timeout?: number; + id: string; + body: any; +} + +export interface IngestSimulateParams extends GenericParams { + verbose?: boolean; + id: string; +} + +export class Nodes { + hotThreads(params: NodesHotThreadsParams, callback: (error: any, response: any, status: any) => void): void; + hotThreads(params: NodesHotThreadsParams): Promise; + info(params: NodesInfoParams, callback: (error: any, response: any, status: any) => void): void; + info(params: NodesInfoParams): Promise; + stats(params: NodesStatsParams, callback: (error: any, response: any, status: any) => void): void; + stats(params: NodesStatsParams): Promise; +} + +export interface NodesHotThreadsParams extends GenericParams { + interval?: TimeSpan; + snapshots?: number; + threads?: number; + ignoreIdleThreads?: boolean; + type?: "cpu" | "wait" | "blocked"; + timeout?: TimeSpan; + nodeId: NameList; +} + +export interface NodesInfoParams extends GenericParams { + flatSettings?: boolean; + human?: boolean; + timeout?: TimeSpan; + nodeId: NameList; + metric?: NameList; +} + +export interface NodesStatsParams extends GenericParams { + completionFields?: NameList; + fielddataFields?: NameList; + fields?: NameList; + groups?: boolean; + human?: boolean; + level?: "indices" | "node" | "shards"; + types?: NameList; + timeout?: TimeSpan; + metric?: NameList; + indexMetric?: NameList; + nodeId?: NameList; +} + +export class Snapshot { + create(params: SnapshotCreateParams, callback: (error: any, response: any, status: any) => void): void; + create(params: SnapshotCreateParams): Promise; + createRepository(params: SnapshotCreateRepositoryParams, callback: (error: any, response: any, status: any) => void): void; + createRepository(params: SnapshotCreateRepositoryParams): Promise; + delete(params: SnapshotDeleteParams, callback: (error: any, response: any, status: any) => void): void; + delete(params: SnapshotDeleteParams): Promise; + deleteRepository(params: SnapshotDeleteRepositoryParams, callback: (error: any, response: any, status: any) => void): void; + deleteRepository(params: SnapshotDeleteRepositoryParams): Promise; + get(params: SnapshotGetParams, callback: (error: any, response: any, status: any) => void): void; + get(params: SnapshotGetParams): Promise; + getRepository(params: SnapshotGetRepositoryParams, callback: (error: any, response: any, status: any) => void): void; + getRepository(params: SnapshotGetRepositoryParams): Promise; + restore(params: SnapshotRestoreParams, callback: (error: any, response: any, status: any) => void): void; + restore(params: SnapshotRestoreParams): Promise; + status(params: SnapshotStatusParams, callback: (error: any, response: any, status: any) => void): void; + status(params: SnapshotStatusParams): Promise; + verifyRepository(params: SnapshotVerifyRepositoryParams, callback: (error: any, response: any, status: any) => void): void; + verifyRepository(params: SnapshotVerifyRepositoryParams): Promise; +} + +export interface SnapshotCreateParams extends GenericParams { + masterTimeout?: TimeSpan; + waitForCompletion?: boolean; + repository: string; + snapshot: string; +} + +export interface SnapshotCreateRepositoryParams extends GenericParams { + masterTimeout?: TimeSpan; + timeout?: TimeSpan; + verify?: boolean; + repository: string; +} + +export interface SnapshotDeleteParams extends GenericParams { + masterTimeout?: TimeSpan; + repository: string; + snapshot: string; +} + +export interface SnapshotDeleteRepositoryParams extends GenericParams { + masterTimeout?: TimeSpan; + timeout?: TimeSpan; + repository: string; +} + +export interface SnapshotGetParams extends GenericParams { + masterTimeout?: TimeSpan; + ignoreUnavailable?: boolean; + repository: string; + snapshot: NameList; +} + +export interface SnapshotGetRepositoryParams extends GenericParams { + masterTimeout?: TimeSpan; + local?: boolean; + repository: NameList; +} + +export interface SnapshotRestoreParams extends GenericParams { + masterTimeout?: TimeSpan; + waitForCompletion?: boolean; + repository: string; + snapshot: string; +} + +export interface SnapshotStatusParams extends GenericParams { + masterTimeout?: TimeSpan; + ignoreUnavailable?: boolean; + repository: string; + snapshot: NameList; +} + +export interface SnapshotVerifyRepositoryParams extends GenericParams { + masterTimeout?: TimeSpan; + timeout?: TimeSpan; + repository: string; +} + +export class Tasks { + cancel(params: TasksCancelParams, callback: (error: any, response: any, status: any) => void): void; + cancel(params: TasksCancelParams): Promise; + get(params: TasksGetParams, callback: (error: any, response: any, status: any) => void): void; + get(params: TasksGetParams): Promise; + list(params: TasksListParams, callback: (error: any, response: any, status: any) => void): void; + list(params: TasksListParams): Promise; +} + +export interface TasksCancelParams extends GenericParams { + nodeId?: NameList; + actions?: NameList; + parentNode?: string; + parentTask?: string; + taskId?: string; +} + +export interface TasksGetParams extends GenericParams { + waitForCompletion?: boolean; + taskId?: string; +} + +export interface TasksListParams extends GenericParams { + nodeId?: NameList; + actions?: NameList; + detailed?: boolean; + parentNode?: string; + parentTask?: string; + waitForCompletion?: boolean; + groupBy?: "nodes" | "parents"; +} + +export namespace errors { + class _Abstract extends Error {} + class Generic extends _Abstract {} + class ConnectionFault extends _Abstract {} + class NoConnections extends _Abstract {} + class RequestTimeout extends _Abstract {} + class Serialization extends _Abstract {} + class RequestTypeError extends _Abstract {} + + class MultipleChoices extends _Abstract {} + class MovedPermanently extends _Abstract {} + class SeeOther extends _Abstract {} + class NotModified extends _Abstract {} + class UseProxy extends _Abstract {} + class TemporaryRedirect extends _Abstract {} + class PermanentRedirect extends _Abstract {} + class BadRequest extends _Abstract {} + class AuthenticationException extends _Abstract {} + class PaymentRequired extends _Abstract {} + class AuthorizationException extends _Abstract {} + class NotFound extends _Abstract {} + class MethodNotAllowed extends _Abstract {} + class NotAcceptable extends _Abstract {} + class ProxyAuthenticationRequired extends _Abstract {} + class LengthRequired extends _Abstract {} + class PreconditionFailed extends _Abstract {} + class RequestEntityTooLarge extends _Abstract {} + class RequestURITooLong extends _Abstract {} + class UnsupportedMediaType extends _Abstract {} + class RequestedRangeNotSatisfiable extends _Abstract {} + class ExpectationFailed extends _Abstract {} + class ImATeapot extends _Abstract {} + class TooManyConnectionsFromThisIP extends _Abstract {} + class UpgradeRequired extends _Abstract {} + class TooManyRequests extends _Abstract {} + class BlockedByWindowsParentalControls extends _Abstract {} + class RequestHeaderTooLarge extends _Abstract {} + class HTTPToHTTPS extends _Abstract {} + class ClientClosedRequest extends _Abstract {} + class InternalServerError extends _Abstract {} + class NotImplemented extends _Abstract {} + class BadGateway extends _Abstract {} + class ServiceUnavailable extends _Abstract {} + class GatewayTimeout extends _Abstract {} + class HTTPVersionNotSupported extends _Abstract {} + class VariantAlsoNegotiates extends _Abstract {} + class NotExtended extends _Abstract {} } diff --git a/types/elasticsearch/tsconfig.json b/types/elasticsearch/tsconfig.json index 2d62eac43d..21ac20d7e9 100644 --- a/types/elasticsearch/tsconfig.json +++ b/types/elasticsearch/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -21,4 +21,4 @@ "index.d.ts", "elasticsearch-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/elasticsearch/tslint.json b/types/elasticsearch/tslint.json index a41bf5d19a..f3cb50d5de 100644 --- a/types/elasticsearch/tslint.json +++ b/types/elasticsearch/tslint.json @@ -1,79 +1,9 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "array-type": false, + "no-empty-interface": false, + "max-line-length": false } } From cfff51283f67ca026f527e6366f6e9949c91d3b1 Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Tue, 21 Nov 2017 23:22:46 +0100 Subject: [PATCH 21/90] enable that rule --- types/elasticsearch/index.d.ts | 8 +++++++- types/elasticsearch/tslint.json | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/types/elasticsearch/index.d.ts b/types/elasticsearch/index.d.ts index c728f9e495..fbf37f83fb 100644 --- a/types/elasticsearch/index.d.ts +++ b/types/elasticsearch/index.d.ts @@ -1,6 +1,12 @@ // Type definitions for elasticsearch 5.0 // Project: https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html -// Definitions by: Casper Skydt , Blake Smith , Dave Dunkin , Jeffery Grajkowski , Margus Lamp , Ahmad Ferdous Bin Alam +// Definitions by: Casper Skydt +// Blake Smith +// Dave Dunkin +// Jeffery Grajkowski +// Margus Lamp +// Ahmad Ferdous Bin Alam +// Simon Schick // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 diff --git a/types/elasticsearch/tslint.json b/types/elasticsearch/tslint.json index f3cb50d5de..aacabc1e5a 100644 --- a/types/elasticsearch/tslint.json +++ b/types/elasticsearch/tslint.json @@ -3,7 +3,6 @@ "rules": { "no-unnecessary-generics": false, "array-type": false, - "no-empty-interface": false, - "max-line-length": false + "no-empty-interface": false } } From e4013bda94546eb275412a49398cbadb95d7898c Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Tue, 21 Nov 2017 23:27:54 +0100 Subject: [PATCH 22/90] fix lint even more --- types/elasticsearch/index.d.ts | 10 +++++----- types/elasticsearch/tslint.json | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/types/elasticsearch/index.d.ts b/types/elasticsearch/index.d.ts index fbf37f83fb..b143015d9c 100644 --- a/types/elasticsearch/index.d.ts +++ b/types/elasticsearch/index.d.ts @@ -6,7 +6,7 @@ // Jeffery Grajkowski // Margus Lamp // Ahmad Ferdous Bin Alam -// Simon Schick +// Simon Schick // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -466,7 +466,7 @@ export interface MGetParams extends GenericParams { } export interface MGetResponse { - docs?: GetResponse[]; + docs?: Array>; } export interface MSearchParams extends GenericParams { @@ -477,7 +477,7 @@ export interface MSearchParams extends GenericParams { } export interface MSearchResponse { - responses?: SearchResponse[]; + responses?: Array>; } export interface MSearchTemplateParams extends GenericParams { @@ -627,7 +627,7 @@ export interface SearchResponse { hits: { total: number; max_score: number; - hits: { + hits: Array<{ _index: string; _type: string; _id: string; @@ -638,7 +638,7 @@ export interface SearchResponse { fields?: any; highlight?: any; inner_hits?: any; - }[]; + }>; }; aggregations?: any; } diff --git a/types/elasticsearch/tslint.json b/types/elasticsearch/tslint.json index aacabc1e5a..e9003e412b 100644 --- a/types/elasticsearch/tslint.json +++ b/types/elasticsearch/tslint.json @@ -2,7 +2,6 @@ "extends": "dtslint/dt.json", "rules": { "no-unnecessary-generics": false, - "array-type": false, "no-empty-interface": false } } From 93a41c8fb27c93e2deb4bccfb1fd21486ef84399 Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Tue, 21 Nov 2017 23:38:53 +0100 Subject: [PATCH 23/90] bump dependant package TS version --- types/http-aws-es/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/http-aws-es/index.d.ts b/types/http-aws-es/index.d.ts index c14547a58f..91e12604f8 100644 --- a/types/http-aws-es/index.d.ts +++ b/types/http-aws-es/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/TheDeveloper/http-aws-es#readme // Definitions by: Marco Gonzalez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// From 4ac89406f988df28c08ee3df6f99c7c33eedc7bf Mon Sep 17 00:00:00 2001 From: Cameron Martin Date: Tue, 21 Nov 2017 22:47:52 +0000 Subject: [PATCH 24/90] Made most isXXX methods in babel-traverse be type guards. Most of them are just a 1:1 mapping between isXXX and NodePath, but for the ones that are not (which are all near the bottom of the list of methods) I looked at https://github.com/babel/babel/blob/master/packages/babel-traverse/src/path/lib/virtual-types.js and https://github.com/babel/babel/blob/master/packages/babel-types/src/validators.js to determine what type they are. --- types/babel-traverse/index.d.ts | 356 ++++++++++++++++---------------- 1 file changed, 178 insertions(+), 178 deletions(-) diff --git a/types/babel-traverse/index.d.ts b/types/babel-traverse/index.d.ts index 682550b161..37e7076432 100644 --- a/types/babel-traverse/index.d.ts +++ b/types/babel-traverse/index.d.ts @@ -600,185 +600,185 @@ export class NodePath { addComments(type: string, comments: any[]): void; // ------------------------- isXXX ------------------------- - isArrayExpression(opts?: object): boolean; - isAssignmentExpression(opts?: object): boolean; - isBinaryExpression(opts?: object): boolean; - isDirective(opts?: object): boolean; - isDirectiveLiteral(opts?: object): boolean; - isBlockStatement(opts?: object): boolean; - isBreakStatement(opts?: object): boolean; - isCallExpression(opts?: object): boolean; - isCatchClause(opts?: object): boolean; - isConditionalExpression(opts?: object): boolean; - isContinueStatement(opts?: object): boolean; - isDebuggerStatement(opts?: object): boolean; - isDoWhileStatement(opts?: object): boolean; - isEmptyStatement(opts?: object): boolean; - isExpressionStatement(opts?: object): boolean; - isFile(opts?: object): boolean; - isForInStatement(opts?: object): boolean; - isForStatement(opts?: object): boolean; - isFunctionDeclaration(opts?: object): boolean; - isFunctionExpression(opts?: object): boolean; - isIdentifier(opts?: object): boolean; - isIfStatement(opts?: object): boolean; - isLabeledStatement(opts?: object): boolean; - isStringLiteral(opts?: object): boolean; - isNumericLiteral(opts?: object): boolean; - isNullLiteral(opts?: object): boolean; - isBooleanLiteral(opts?: object): boolean; - isRegExpLiteral(opts?: object): boolean; - isLogicalExpression(opts?: object): boolean; - isMemberExpression(opts?: object): boolean; - isNewExpression(opts?: object): boolean; - isProgram(opts?: object): boolean; - isObjectExpression(opts?: object): boolean; - isObjectMethod(opts?: object): boolean; - isObjectProperty(opts?: object): boolean; - isRestElement(opts?: object): boolean; - isReturnStatement(opts?: object): boolean; - isSequenceExpression(opts?: object): boolean; - isSwitchCase(opts?: object): boolean; - isSwitchStatement(opts?: object): boolean; - isThisExpression(opts?: object): boolean; - isThrowStatement(opts?: object): boolean; - isTryStatement(opts?: object): boolean; - isUnaryExpression(opts?: object): boolean; - isUpdateExpression(opts?: object): boolean; - isVariableDeclaration(opts?: object): boolean; - isVariableDeclarator(opts?: object): boolean; - isWhileStatement(opts?: object): boolean; - isWithStatement(opts?: object): boolean; - isAssignmentPattern(opts?: object): boolean; - isArrayPattern(opts?: object): boolean; - isArrowFunctionExpression(opts?: object): boolean; - isClassBody(opts?: object): boolean; - isClassDeclaration(opts?: object): boolean; - isClassExpression(opts?: object): boolean; - isExportAllDeclaration(opts?: object): boolean; - isExportDefaultDeclaration(opts?: object): boolean; - isExportNamedDeclaration(opts?: object): boolean; - isExportSpecifier(opts?: object): boolean; - isForOfStatement(opts?: object): boolean; - isImportDeclaration(opts?: object): boolean; - isImportDefaultSpecifier(opts?: object): boolean; - isImportNamespaceSpecifier(opts?: object): boolean; - isImportSpecifier(opts?: object): boolean; - isMetaProperty(opts?: object): boolean; - isClassMethod(opts?: object): boolean; - isObjectPattern(opts?: object): boolean; - isSpreadElement(opts?: object): boolean; - isSuper(opts?: object): boolean; - isTaggedTemplateExpression(opts?: object): boolean; - isTemplateElement(opts?: object): boolean; - isTemplateLiteral(opts?: object): boolean; - isYieldExpression(opts?: object): boolean; - isAnyTypeAnnotation(opts?: object): boolean; - isArrayTypeAnnotation(opts?: object): boolean; - isBooleanTypeAnnotation(opts?: object): boolean; - isBooleanLiteralTypeAnnotation(opts?: object): boolean; - isNullLiteralTypeAnnotation(opts?: object): boolean; - isClassImplements(opts?: object): boolean; - isClassProperty(opts?: object): boolean; - isDeclareClass(opts?: object): boolean; - isDeclareFunction(opts?: object): boolean; - isDeclareInterface(opts?: object): boolean; - isDeclareModule(opts?: object): boolean; - isDeclareTypeAlias(opts?: object): boolean; - isDeclareVariable(opts?: object): boolean; - isExistentialTypeParam(opts?: object): boolean; - isFunctionTypeAnnotation(opts?: object): boolean; - isFunctionTypeParam(opts?: object): boolean; - isGenericTypeAnnotation(opts?: object): boolean; - isInterfaceExtends(opts?: object): boolean; - isInterfaceDeclaration(opts?: object): boolean; - isIntersectionTypeAnnotation(opts?: object): boolean; - isMixedTypeAnnotation(opts?: object): boolean; - isNullableTypeAnnotation(opts?: object): boolean; - isNumericLiteralTypeAnnotation(opts?: object): boolean; - isNumberTypeAnnotation(opts?: object): boolean; - isStringLiteralTypeAnnotation(opts?: object): boolean; - isStringTypeAnnotation(opts?: object): boolean; - isThisTypeAnnotation(opts?: object): boolean; - isTupleTypeAnnotation(opts?: object): boolean; - isTypeofTypeAnnotation(opts?: object): boolean; - isTypeAlias(opts?: object): boolean; - isTypeAnnotation(opts?: object): boolean; - isTypeCastExpression(opts?: object): boolean; - isTypeParameterDeclaration(opts?: object): boolean; - isTypeParameterInstantiation(opts?: object): boolean; - isObjectTypeAnnotation(opts?: object): boolean; - isObjectTypeCallProperty(opts?: object): boolean; - isObjectTypeIndexer(opts?: object): boolean; - isObjectTypeProperty(opts?: object): boolean; - isQualifiedTypeIdentifier(opts?: object): boolean; - isUnionTypeAnnotation(opts?: object): boolean; - isVoidTypeAnnotation(opts?: object): boolean; - isJSXAttribute(opts?: object): boolean; - isJSXClosingElement(opts?: object): boolean; - isJSXElement(opts?: object): boolean; - isJSXEmptyExpression(opts?: object): boolean; - isJSXExpressionContainer(opts?: object): boolean; - isJSXIdentifier(opts?: object): boolean; - isJSXMemberExpression(opts?: object): boolean; - isJSXNamespacedName(opts?: object): boolean; - isJSXOpeningElement(opts?: object): boolean; - isJSXSpreadAttribute(opts?: object): boolean; - isJSXText(opts?: object): boolean; - isNoop(opts?: object): boolean; - isParenthesizedExpression(opts?: object): boolean; - isAwaitExpression(opts?: object): boolean; - isBindExpression(opts?: object): boolean; - isDecorator(opts?: object): boolean; - isDoExpression(opts?: object): boolean; - isExportDefaultSpecifier(opts?: object): boolean; - isExportNamespaceSpecifier(opts?: object): boolean; - isRestProperty(opts?: object): boolean; - isSpreadProperty(opts?: object): boolean; - isExpression(opts?: object): boolean; - isBinary(opts?: object): boolean; - isScopable(opts?: object): boolean; - isBlockParent(opts?: object): boolean; - isBlock(opts?: object): boolean; - isStatement(opts?: object): boolean; - isTerminatorless(opts?: object): boolean; - isCompletionStatement(opts?: object): boolean; - isConditional(opts?: object): boolean; - isLoop(opts?: object): boolean; - isWhile(opts?: object): boolean; - isExpressionWrapper(opts?: object): boolean; - isFor(opts?: object): boolean; - isForXStatement(opts?: object): boolean; - isFunction(opts?: object): boolean; - isFunctionParent(opts?: object): boolean; - isPureish(opts?: object): boolean; - isDeclaration(opts?: object): boolean; - isLVal(opts?: object): boolean; - isLiteral(opts?: object): boolean; - isImmutable(opts?: object): boolean; - isUserWhitespacable(opts?: object): boolean; - isMethod(opts?: object): boolean; - isObjectMember(opts?: object): boolean; - isProperty(opts?: object): boolean; - isUnaryLike(opts?: object): boolean; - isPattern(opts?: object): boolean; - isClass(opts?: object): boolean; - isModuleDeclaration(opts?: object): boolean; - isExportDeclaration(opts?: object): boolean; - isModuleSpecifier(opts?: object): boolean; - isFlow(opts?: object): boolean; - isFlowBaseAnnotation(opts?: object): boolean; - isFlowDeclaration(opts?: object): boolean; - isJSX(opts?: object): boolean; - isNumberLiteral(opts?: object): boolean; - isRegexLiteral(opts?: object): boolean; - isReferencedIdentifier(opts?: object): boolean; - isReferencedMemberExpression(opts?: object): boolean; - isBindingIdentifier(opts?: object): boolean; - isScope(opts?: object): boolean; + isArrayExpression(opts?: object): this is NodePath ; + isAssignmentExpression(opts?: object): this is NodePath; + isBinaryExpression(opts?: object): this is NodePath; + isDirective(opts?: object): this is NodePath; + isDirectiveLiteral(opts?: object): this is NodePath; + isBlockStatement(opts?: object): this is NodePath; + isBreakStatement(opts?: object): this is NodePath; + isCallExpression(opts?: object): this is NodePath; + isCatchClause(opts?: object): this is NodePath; + isConditionalExpression(opts?: object): this is NodePath; + isContinueStatement(opts?: object): this is NodePath; + isDebuggerStatement(opts?: object): this is NodePath; + isDoWhileStatement(opts?: object): this is NodePath; + isEmptyStatement(opts?: object): this is NodePath; + isExpressionStatement(opts?: object): this is NodePath; + isFile(opts?: object): this is NodePath; + isForInStatement(opts?: object): this is NodePath; + isForStatement(opts?: object): this is NodePath; + isFunctionDeclaration(opts?: object): this is NodePath; + isFunctionExpression(opts?: object): this is NodePath; + isIdentifier(opts?: object): this is NodePath; + isIfStatement(opts?: object): this is NodePath; + isLabeledStatement(opts?: object): this is NodePath; + isStringLiteral(opts?: object): this is NodePath; + isNumericLiteral(opts?: object): this is NodePath; + isNullLiteral(opts?: object): this is NodePath; + isBooleanLiteral(opts?: object): this is NodePath; + isRegExpLiteral(opts?: object): this is NodePath; + isLogicalExpression(opts?: object): this is NodePath; + isMemberExpression(opts?: object): this is NodePath; + isNewExpression(opts?: object): this is NodePath; + isProgram(opts?: object): this is NodePath; + isObjectExpression(opts?: object): this is NodePath; + isObjectMethod(opts?: object): this is NodePath; + isObjectProperty(opts?: object): this is NodePath; + isRestElement(opts?: object): this is NodePath; + isReturnStatement(opts?: object): this is NodePath; + isSequenceExpression(opts?: object): this is NodePath; + isSwitchCase(opts?: object): this is NodePath; + isSwitchStatement(opts?: object): this is NodePath; + isThisExpression(opts?: object): this is NodePath; + isThrowStatement(opts?: object): this is NodePath; + isTryStatement(opts?: object): this is NodePath; + isUnaryExpression(opts?: object): this is NodePath; + isUpdateExpression(opts?: object): this is NodePath; + isVariableDeclaration(opts?: object): this is NodePath; + isVariableDeclarator(opts?: object): this is NodePath; + isWhileStatement(opts?: object): this is NodePath; + isWithStatement(opts?: object): this is NodePath; + isAssignmentPattern(opts?: object): this is NodePath; + isArrayPattern(opts?: object): this is NodePath; + isArrowFunctionExpression(opts?: object): this is NodePath; + isClassBody(opts?: object): this is NodePath; + isClassDeclaration(opts?: object): this is NodePath; + isClassExpression(opts?: object): this is NodePath; + isExportAllDeclaration(opts?: object): this is NodePath; + isExportDefaultDeclaration(opts?: object): this is NodePath; + isExportNamedDeclaration(opts?: object): this is NodePath; + isExportSpecifier(opts?: object): this is NodePath; + isForOfStatement(opts?: object): this is NodePath; + isImportDeclaration(opts?: object): this is NodePath; + isImportDefaultSpecifier(opts?: object): this is NodePath; + isImportNamespaceSpecifier(opts?: object): this is NodePath; + isImportSpecifier(opts?: object): this is NodePath; + isMetaProperty(opts?: object): this is NodePath; + isClassMethod(opts?: object): this is NodePath; + isObjectPattern(opts?: object): this is NodePath; + isSpreadElement(opts?: object): this is NodePath; + isSuper(opts?: object): this is NodePath; + isTaggedTemplateExpression(opts?: object): this is NodePath; + isTemplateElement(opts?: object): this is NodePath; + isTemplateLiteral(opts?: object): this is NodePath; + isYieldExpression(opts?: object): this is NodePath; + isAnyTypeAnnotation(opts?: object): this is NodePath; + isArrayTypeAnnotation(opts?: object): this is NodePath; + isBooleanTypeAnnotation(opts?: object): this is NodePath; + isBooleanLiteralTypeAnnotation(opts?: object): this is NodePath; + isNullLiteralTypeAnnotation(opts?: object): this is NodePath; + isClassImplements(opts?: object): this is NodePath; + isClassProperty(opts?: object): this is NodePath; + isDeclareClass(opts?: object): this is NodePath; + isDeclareFunction(opts?: object): this is NodePath; + isDeclareInterface(opts?: object): this is NodePath; + isDeclareModule(opts?: object): this is NodePath; + isDeclareTypeAlias(opts?: object): this is NodePath; + isDeclareVariable(opts?: object): this is NodePath; + isExistentialTypeParam(opts?: object): this is NodePath; + isFunctionTypeAnnotation(opts?: object): this is NodePath; + isFunctionTypeParam(opts?: object): this is NodePath; + isGenericTypeAnnotation(opts?: object): this is NodePath; + isInterfaceExtends(opts?: object): this is NodePath; + isInterfaceDeclaration(opts?: object): this is NodePath; + isIntersectionTypeAnnotation(opts?: object): this is NodePath; + isMixedTypeAnnotation(opts?: object): this is NodePath; + isNullableTypeAnnotation(opts?: object): this is NodePath; + isNumericLiteralTypeAnnotation(opts?: object): this is NodePath; + isNumberTypeAnnotation(opts?: object): this is NodePath; + isStringLiteralTypeAnnotation(opts?: object): this is NodePath; + isStringTypeAnnotation(opts?: object): this is NodePath; + isThisTypeAnnotation(opts?: object): this is NodePath; + isTupleTypeAnnotation(opts?: object): this is NodePath; + isTypeofTypeAnnotation(opts?: object): this is NodePath; + isTypeAlias(opts?: object): this is NodePath; + isTypeAnnotation(opts?: object): this is NodePath; + isTypeCastExpression(opts?: object): this is NodePath; + isTypeParameterDeclaration(opts?: object): this is NodePath; + isTypeParameterInstantiation(opts?: object): this is NodePath; + isObjectTypeAnnotation(opts?: object): this is NodePath; + isObjectTypeCallProperty(opts?: object): this is NodePath; + isObjectTypeIndexer(opts?: object): this is NodePath; + isObjectTypeProperty(opts?: object): this is NodePath; + isQualifiedTypeIdentifier(opts?: object): this is NodePath; + isUnionTypeAnnotation(opts?: object): this is NodePath; + isVoidTypeAnnotation(opts?: object): this is NodePath; + isJSXAttribute(opts?: object): this is NodePath; + isJSXClosingElement(opts?: object): this is NodePath; + isJSXElement(opts?: object): this is NodePath; + isJSXEmptyExpression(opts?: object): this is NodePath; + isJSXExpressionContainer(opts?: object): this is NodePath; + isJSXIdentifier(opts?: object): this is NodePath; + isJSXMemberExpression(opts?: object): this is NodePath; + isJSXNamespacedName(opts?: object): this is NodePath; + isJSXOpeningElement(opts?: object): this is NodePath; + isJSXSpreadAttribute(opts?: object): this is NodePath; + isJSXText(opts?: object): this is NodePath; + isNoop(opts?: object): this is NodePath; + isParenthesizedExpression(opts?: object): this is NodePath; + isAwaitExpression(opts?: object): this is NodePath; + isBindExpression(opts?: object): this is NodePath; + isDecorator(opts?: object): this is NodePath; + isDoExpression(opts?: object): this is NodePath; + isExportDefaultSpecifier(opts?: object): this is NodePath; + isExportNamespaceSpecifier(opts?: object): this is NodePath; + isRestProperty(opts?: object): this is NodePath; + isSpreadProperty(opts?: object): this is NodePath; + isExpression(opts?: object): this is NodePath; + isBinary(opts?: object): this is NodePath; + isScopable(opts?: object): this is NodePath; + isBlockParent(opts?: object): this is NodePath; + isBlock(opts?: object): this is NodePath; + isStatement(opts?: object): this is NodePath; + isTerminatorless(opts?: object): this is NodePath; + isCompletionStatement(opts?: object): this is NodePath; + isConditional(opts?: object): this is NodePath; + isLoop(opts?: object): this is NodePath; + isWhile(opts?: object): this is NodePath; + isExpressionWrapper(opts?: object): this is NodePath; + isFor(opts?: object): this is NodePath; + isForXStatement(opts?: object): this is NodePath; + isFunction(opts?: object): this is NodePath; + isFunctionParent(opts?: object): this is NodePath; + isPureish(opts?: object): this is NodePath; + isDeclaration(opts?: object): this is NodePath; + isLVal(opts?: object): this is NodePath; + isLiteral(opts?: object): this is NodePath; + isImmutable(opts?: object): this is NodePath; + isUserWhitespacable(opts?: object): this is NodePath; + isMethod(opts?: object): this is NodePath; + isObjectMember(opts?: object): this is NodePath; + isProperty(opts?: object): this is NodePath; + isUnaryLike(opts?: object): this is NodePath; + isPattern(opts?: object): this is NodePath; + isClass(opts?: object): this is NodePath; + isModuleDeclaration(opts?: object): this is NodePath; + isExportDeclaration(opts?: object): this is NodePath; + isModuleSpecifier(opts?: object): this is NodePath; + isFlow(opts?: object): this is NodePath; + isFlowBaseAnnotation(opts?: object): this is NodePath; + isFlowDeclaration(opts?: object): this is NodePath; + isJSX(opts?: object): this is NodePath; + isNumberLiteral(opts?: object): this is NodePath; + isRegexLiteral(opts?: object): this is NodePath; + isReferencedIdentifier(opts?: object): this is NodePath; + isReferencedMemberExpression(opts?: object): this is NodePath; + isBindingIdentifier(opts?: object): this is NodePath; + isScope(opts?: object): this is NodePath; isReferenced(opts?: object): boolean; - isBlockScoped(opts?: object): boolean; - isVar(opts?: object): boolean; + isBlockScoped(opts?: object): this is NodePath; + isVar(opts?: object): this is NodePath; isUser(opts?: object): boolean; isGenerated(opts?: object): boolean; isPure(opts?: object): boolean; From 0b0d27cd8c053fb902c3b9b1c88cfca3f9cebd72 Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Tue, 21 Nov 2017 23:51:00 +0100 Subject: [PATCH 25/90] sort and add conflict --- types/elasticsearch/index.d.ts | 67 +++++++++++++++++----------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/types/elasticsearch/index.d.ts b/types/elasticsearch/index.d.ts index b143015d9c..1b45a237e5 100644 --- a/types/elasticsearch/index.d.ts +++ b/types/elasticsearch/index.d.ts @@ -1613,46 +1613,47 @@ export namespace errors { class Generic extends _Abstract {} class ConnectionFault extends _Abstract {} class NoConnections extends _Abstract {} - class RequestTimeout extends _Abstract {} class Serialization extends _Abstract {} class RequestTypeError extends _Abstract {} - class MultipleChoices extends _Abstract {} - class MovedPermanently extends _Abstract {} - class SeeOther extends _Abstract {} - class NotModified extends _Abstract {} - class UseProxy extends _Abstract {} - class TemporaryRedirect extends _Abstract {} - class PermanentRedirect extends _Abstract {} - class BadRequest extends _Abstract {} class AuthenticationException extends _Abstract {} - class PaymentRequired extends _Abstract {} class AuthorizationException extends _Abstract {} - class NotFound extends _Abstract {} - class MethodNotAllowed extends _Abstract {} - class NotAcceptable extends _Abstract {} - class ProxyAuthenticationRequired extends _Abstract {} - class LengthRequired extends _Abstract {} - class PreconditionFailed extends _Abstract {} - class RequestEntityTooLarge extends _Abstract {} - class RequestURITooLong extends _Abstract {} - class UnsupportedMediaType extends _Abstract {} - class RequestedRangeNotSatisfiable extends _Abstract {} - class ExpectationFailed extends _Abstract {} - class ImATeapot extends _Abstract {} - class TooManyConnectionsFromThisIP extends _Abstract {} - class UpgradeRequired extends _Abstract {} - class TooManyRequests extends _Abstract {} - class BlockedByWindowsParentalControls extends _Abstract {} - class RequestHeaderTooLarge extends _Abstract {} - class HTTPToHTTPS extends _Abstract {} - class ClientClosedRequest extends _Abstract {} - class InternalServerError extends _Abstract {} - class NotImplemented extends _Abstract {} class BadGateway extends _Abstract {} - class ServiceUnavailable extends _Abstract {} + class BadRequest extends _Abstract {} + class BlockedByWindowsParentalControls extends _Abstract {} + class ClientClosedRequest extends _Abstract {} + class Conflict extends _Abstract {} + class ExpectationFailed extends _Abstract {} class GatewayTimeout extends _Abstract {} + class HTTPToHTTPS extends _Abstract {} class HTTPVersionNotSupported extends _Abstract {} - class VariantAlsoNegotiates extends _Abstract {} + class ImATeapot extends _Abstract {} + class InternalServerError extends _Abstract {} + class LengthRequired extends _Abstract {} + class MethodNotAllowed extends _Abstract {} + class MovedPermanently extends _Abstract {} + class MultipleChoices extends _Abstract {} + class NotAcceptable extends _Abstract {} class NotExtended extends _Abstract {} + class NotFound extends _Abstract {} + class NotImplemented extends _Abstract {} + class NotModified extends _Abstract {} + class PaymentRequired extends _Abstract {} + class PermanentRedirect extends _Abstract {} + class PreconditionFailed extends _Abstract {} + class ProxyAuthenticationRequired extends _Abstract {} + class RequestedRangeNotSatisfiable extends _Abstract {} + class RequestEntityTooLarge extends _Abstract {} + class RequestHeaderTooLarge extends _Abstract {} + class RequestTimeout extends _Abstract {} + class RequestURITooLong extends _Abstract {} + class SeeOther extends _Abstract {} + class ServiceUnavailable extends _Abstract {} + class TemporaryRedirect extends _Abstract {} + class TooManyConnectionsFromThisIP extends _Abstract {} + class TooManyRequests extends _Abstract {} + class UnsupportedMediaType extends _Abstract {} + class UpgradeRequired extends _Abstract {} + class UseProxy extends _Abstract {} + class VariantAlsoNegotiates extends _Abstract {} } From 39d7d3ab396f96c80208e3144fff530135c6e268 Mon Sep 17 00:00:00 2001 From: Jeff Jacobson Date: Tue, 21 Nov 2017 15:38:42 -0800 Subject: [PATCH 26/90] fixed type def --- types/geojson/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/geojson/index.d.ts b/types/geojson/index.d.ts index d6ba411e3f..e6783255eb 100644 --- a/types/geojson/index.d.ts +++ b/types/geojson/index.d.ts @@ -130,7 +130,7 @@ export interface MultiPolygon extends GeometryObject { */ export interface GeometryCollection extends GeometryObject { type: "GeometryCollection"; - geometries: Array; + geometries: Array; } export type GeoJsonProperties = { [name: string]: any; } | null; From 5ddd7d6c05957b30078dff689036e8ddaceef44c Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Wed, 22 Nov 2017 11:22:29 +0100 Subject: [PATCH 27/90] update lolex typings. --- types/lolex/index.d.ts | 82 +++++++++++++++++++++++++------------- types/lolex/lolex-tests.ts | 29 +++++--------- 2 files changed, 64 insertions(+), 47 deletions(-) diff --git a/types/lolex/index.d.ts b/types/lolex/index.d.ts index c0dec4cd56..b033862062 100644 --- a/types/lolex/index.d.ts +++ b/types/lolex/index.d.ts @@ -1,6 +1,8 @@ -// Type definitions for lolex 1.5 +// Type definitions for lolex 2.1 // Project: https://github.com/sinonjs/lolex -// Definitions by: Wim Looman , Josh Goldberg +// Definitions by: Wim Looman +// Josh Goldberg +// Rogier Schouten // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** @@ -34,7 +36,7 @@ type BrowserClock = LolexClock; type NodeClock = LolexClock & { /** * Mimicks process.hrtime(). - * + * * @param prevTime Previous system time to calculate time elapsed. * @returns High resolution real time as [seconds, nanoseconds]. */ @@ -49,7 +51,7 @@ type Clock = BrowserClock | NodeClock; /** * Names of clock methods that may be faked by install. */ -type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date"; +type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick"; /** * Controls the flow of time. @@ -67,7 +69,7 @@ export interface LolexClock { /** * Schedules a callback to be fired once timeout milliseconds have ticked by. - * + * * @param callback Callback to be fired. * @param timeout How many ticks to wait to run the callback. * @param args Any extra arguments to pass to the callback. @@ -77,14 +79,14 @@ export interface LolexClock { /** * Clears a timer, as long as it was created using setTimeout. - * + * * @param id Timer ID or object. */ clearTimeout(id: TTimerId): void; /** * Schedules a callback to be fired every time timeout milliseconds have ticked by. - * + * * @param callback Callback to be fired. * @param timeout How many ticks to wait between callbacks. * @param args Any extra arguments to pass to the callback. @@ -94,14 +96,14 @@ export interface LolexClock { /** * Clears a timer, as long as it was created using setInterval. - * + * * @param id Timer ID or object. */ clearInterval(id: TTimerId): void; /** * Schedules the callback to be fired once 0 milliseconds have ticked by. - * + * * @param callback Callback to be fired. * @remarks You'll still have to call clock.tick() for the callback to fire. * @remarks If called during a tick the callback won't fire until 1 millisecond has ticked by. @@ -110,11 +112,16 @@ export interface LolexClock { /** * Clears a timer, as long as it was created using setImmediate. - * + * * @param id Timer ID or object. */ clearImmediate(id: TTimerId): void; + /** + * Simulates process.nextTick(); + */ + nextTick(callback: () => any): void; + /** * Advances the clock to the the moment of the first scheduled timer, firing it. */ @@ -122,14 +129,14 @@ export interface LolexClock { /** * Advance the clock, firing callbacks if necessary. - * + * * @param time How many ticks to advance by. */ tick(time: number | string): void; /** * Runs all pending timers until there are none remaining. - * + * * @remarks If new timers are added while it is executing they will be run as well. */ runAll(): void; @@ -142,7 +149,7 @@ export interface LolexClock { /** * Simulates a user changing the system clock. - * + * * @param now New system time. * @remarks This affects the current time but it does not in itself cause timers to fire. */ @@ -157,7 +164,7 @@ export interface LolexClock { /** * Creates a clock. - * + * * @param now Current time for the clock. * @param loopLimit Maximum number of timers that will be run when calling runAll() * before assuming that we have an infinite loop and throwing an error @@ -167,23 +174,42 @@ export interface LolexClock { */ export declare function createClock(now?: number | Date, loopLimit?: number): TClock; -/** - * Creates a clock and installs it globally. - * - * @param now Current time for the clock, as with lolex.createClock(). - * @param toFake Names of methods that should be faked. - * @type TClock Type of clock to create. - * @usage lolex.install(["setTimeout", "clearTimeout"]); - */ -export declare function install(now?: number | Date, toFake?: FakeMethod[]): TClock; + +export interface LolexInstallOpts { + /** + * installs lolex onto the specified target context (default: global) + */ + target?: any; + /** + * installs lolex with the specified unix epoch (default: 0) + */ + now?: number; + /** + * an array with explicit function names to hijack. When not set, lolex will automatically fake all methods except nextTick + * e.g., lolex.install({ toFake: ["setTimeout", "nextTick"]}) will fake only setTimeout and nextTick + */ + toFake?: FakeMethod[]; + /** + * the maximum number of timers that will be run when calling runAll() (default: 1000) + */ + loopLimit?: number; + /** + * tells lolex to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by + * 20ms for every 20ms change in the real system time) (default: false) + */ + shouldAdvanceTime?: boolean; + /** + * relevant only when using with shouldAdvanceTime: true. increment mocked time by advanceTimeDelta ms every advanceTimeDelta ms change + * in the real system time (default: 20) + */ + advanceTimeDelta?: number; +} /** - * Creates a clock and installs it onto the context object. - * - * @param context Context to install the clock onto. + * Creates a clock and installs it globally. + * * @param now Current time for the clock, as with lolex.createClock(). * @param toFake Names of methods that should be faked. * @type TClock Type of clock to create. - * @usage lolex.install(context, ["setTimeout", "clearTimeout"]); */ -export declare function install(context?: any, now?: number | Date, toFake?: FakeMethod[]): TClock; +export declare function install(opts: LolexInstallOpts): TClock; diff --git a/types/lolex/lolex-tests.ts b/types/lolex/lolex-tests.ts index 876e4280c5..8039140dc5 100644 --- a/types/lolex/lolex-tests.ts +++ b/types/lolex/lolex-tests.ts @@ -16,25 +16,14 @@ lolex.createClock(new Date()); lolex.createClock(7, 9001); lolex.createClock(new Date(), 9001); -lolex.install(7); -lolex.install(new Date()); -lolex.install(7, ["setTimeout"]); -lolex.install(new Date(), ["setTimeout"]); - -lolex.install(7); -lolex.install(new Date()); -lolex.install(7, ["setTimeout"]); -lolex.install(new Date(), ["setTimeout"]); - -lolex.install({}, 7); -lolex.install({}, new Date()); -lolex.install({}, 7, ["setTimeout"]); -lolex.install({}, new Date(), ["setTimeout"]); - -lolex.install({}, 7); -lolex.install({}, new Date()); -lolex.install({}, 7, ["setTimeout"]); -lolex.install({}, new Date(), ["setTimeout"]); +lolex.install({ + advanceTimeDelta: 20, + loopLimit: 10, + now: 0, + shouldAdvanceTime: true, + target: {}, + toFake: ["setTimeout"] +}); const browserNow: number = browserClock.now; const browserDate: Date = new browserClock.Date(); @@ -80,5 +69,7 @@ nodeClock.setSystemTime(); nodeClock.setSystemTime(7); nodeClock.setSystemTime(new Date()); +nodeClock.nextTick(() => undefined); + browserClock.uninstall(); nodeClock.uninstall(); From 85205b1b8f76dca3fe0827a5242e48f627ff6f96 Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Wed, 22 Nov 2017 11:25:57 +0100 Subject: [PATCH 28/90] bugfix in tsconfig.json - non-existing compiler option. --- types/lolex/tsconfig.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/lolex/tsconfig.json b/types/lolex/tsconfig.json index e9ab242410..d3832ef8ed 100644 --- a/types/lolex/tsconfig.json +++ b/types/lolex/tsconfig.json @@ -8,7 +8,6 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": false, - "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" @@ -21,4 +20,4 @@ "index.d.ts", "lolex-tests.ts" ] -} \ No newline at end of file +} From 3f362978d81d5113ad2a1640e56cdc68ae695087 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Flor=C3=AAncio?= Date: Wed, 22 Nov 2017 12:45:29 +0000 Subject: [PATCH 29/90] Fixed linter errors --- types/node-cache/index.d.ts | 1 - types/node-cache/node-cache-tests.ts | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/types/node-cache/index.d.ts b/types/node-cache/index.d.ts index 00e7316edc..069bd4fb32 100644 --- a/types/node-cache/index.d.ts +++ b/types/node-cache/index.d.ts @@ -257,7 +257,6 @@ declare class NodeCache extends events.EventEmitter implements NodeCache.NodeCac cb?: Callback, ): boolean; - /** * list all keys within this cache * @param cb Callback function diff --git a/types/node-cache/node-cache-tests.ts b/types/node-cache/node-cache-tests.ts index 66c2fb4176..ebf1b88688 100644 --- a/types/node-cache/node-cache-tests.ts +++ b/types/node-cache/node-cache-tests.ts @@ -83,7 +83,7 @@ interface TypeSample { result = cache.getStats(); } -/* tslint:disable void-return no-void-expression */ +/* tslint-:disable void-return no-void-expression { let cache: NodeCache; let result: void; @@ -95,4 +95,4 @@ interface TypeSample { let result: void; result = cache.close(); } -/* tslint:enable void-return */ + tslint-:enable void-return */ From 004b817c7c23daa667d810f72a3deb6fe015648f Mon Sep 17 00:00:00 2001 From: Jochen Becker Date: Wed, 22 Nov 2017 14:48:54 +0100 Subject: [PATCH 30/90] [cordova-plugin-keyboard] Support for deprecated events --- .../cordova-plugin-keyboard-tests.ts | 2 +- types/cordova-plugin-keyboard/index.d.ts | 48 +++++++++---------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts b/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts index 8a707f057d..fa5cf72a30 100644 --- a/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts +++ b/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts @@ -28,4 +28,4 @@ window.addEventListener('keyboardWillShow', () => console.log('keyboardWillShow' window.addEventListener('keyboardWillHide', () => console.log('keyboardWillHide')); -window.addEventListener('keyboardHeightWillChange', (event) => console.log(`keyboardHeightWillChange - keyboard height: ${event.keyboardHeight}`)); +window.addEventListener('keyboardHeightWillChange', (event: CordovaKeyboardEvent) => console.log(`keyboardHeightWillChange - keyboard height: ${event.keyboardHeight}`)); diff --git a/types/cordova-plugin-keyboard/index.d.ts b/types/cordova-plugin-keyboard/index.d.ts index 6298050b2c..af880d732a 100644 --- a/types/cordova-plugin-keyboard/index.d.ts +++ b/types/cordova-plugin-keyboard/index.d.ts @@ -136,7 +136,18 @@ interface Keyboard { * * */ - automaticScrollToTopOnHiding: boolean + automaticScrollToTopOnHiding: boolean, + + /** + * Deprecated Events + */ + onshow(): void, + + onhide(): void, + + onhiding(): void, + + onshowing(): void } interface CordovaKeyboardEvent extends Event { @@ -144,42 +155,31 @@ interface CordovaKeyboardEvent extends Event { keyboardHeight: number; } -interface Window { +interface WindowEventMap { /** - * @param type This event is fired when keyboard fully shown. - * - * @param callback Function is called when keyboard is shown. + * This event is fired when keyboard fully shown. */ - addEventListener(type: 'keyboardDidShow', callback: () => any, useCapture?: boolean): void; + 'keyboardDidShow': Event, /** - * @param type This event is fired when the keyboard is fully closed. - * - * @param callback Function is called when keyboard is closed. + * This event is fired when the keyboard is fully closed. */ - addEventListener(type: 'keyboardDidHide', callback: () => any, useCapture?: boolean): void; + 'keyboardDidHide': Event, /** - * @param type This event fires before keyboard will be shown. - * - * @param callback Function is called when keyboard is about to be shown on the screen. + * This event fires before keyboard will be shown. */ - addEventListener(type: 'keyboardWillShow', callback: () => any, useCapture?: boolean): void; + 'keyboardWillShow': Event, /** - * @param type This event is fired when the keyboard is fully closed. - * - * @param callback Function is called when keyboard is about to be closed. + * This event is fired when the keyboard is fully closed. */ - addEventListener(type: 'keyboardWillHide', callback: () => any, useCapture?: boolean): void; + 'keyboardWillHide': Event, /** - * @param type This event is fired when the keyboard is fully closed. - * - * @param callback Function is called when keyboard is about to be closed. The function is - * passed an InAppBrowserEvent object as a parameter. + * This event is fired when the keyboard is fully closed. */ - addEventListener(type: 'keyboardHeightWillChange', callback: (event: CordovaKeyboardEvent) => any, useCapture?: boolean): void; -} + 'keyboardHeightWillChange': CordovaKeyboardEvent + } declare var Keyboard: Keyboard; From c6798928cb5f078d1ff655e244c448973e7f4523 Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Wed, 22 Nov 2017 16:17:30 +0100 Subject: [PATCH 31/90] Also add 'hrtime' method. --- types/lolex/index.d.ts | 2 +- types/lolex/lolex-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/lolex/index.d.ts b/types/lolex/index.d.ts index b033862062..c0688a5b09 100644 --- a/types/lolex/index.d.ts +++ b/types/lolex/index.d.ts @@ -51,7 +51,7 @@ type Clock = BrowserClock | NodeClock; /** * Names of clock methods that may be faked by install. */ -type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick"; +type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick" | "hrtime"; /** * Controls the flow of time. diff --git a/types/lolex/lolex-tests.ts b/types/lolex/lolex-tests.ts index 8039140dc5..95b6a2be78 100644 --- a/types/lolex/lolex-tests.ts +++ b/types/lolex/lolex-tests.ts @@ -22,7 +22,7 @@ lolex.install({ now: 0, shouldAdvanceTime: true, target: {}, - toFake: ["setTimeout"] + toFake: ["setTimeout", "nextTick", "hrtime"] }); const browserNow: number = browserClock.now; From 2923550d2611e4553c1d03e26a06242e95e658df Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Wed, 22 Nov 2017 16:18:29 +0100 Subject: [PATCH 32/90] Revert "bugfix in tsconfig.json - non-existing compiler option." This reverts commit 85205b1b8f76dca3fe0827a5242e48f627ff6f96. --- types/lolex/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/lolex/tsconfig.json b/types/lolex/tsconfig.json index d3832ef8ed..e9ab242410 100644 --- a/types/lolex/tsconfig.json +++ b/types/lolex/tsconfig.json @@ -8,6 +8,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": false, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" @@ -20,4 +21,4 @@ "index.d.ts", "lolex-tests.ts" ] -} +} \ No newline at end of file From 186e8dd72d1b7f31803bf35ba7565478a64432ca Mon Sep 17 00:00:00 2001 From: Cameron Martin Date: Wed, 22 Nov 2017 19:45:31 +0000 Subject: [PATCH 33/90] Fixed error with isReferencedIdentifier. --- types/babel-traverse/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/babel-traverse/index.d.ts b/types/babel-traverse/index.d.ts index 37e7076432..df420c17bd 100644 --- a/types/babel-traverse/index.d.ts +++ b/types/babel-traverse/index.d.ts @@ -772,7 +772,7 @@ export class NodePath { isJSX(opts?: object): this is NodePath; isNumberLiteral(opts?: object): this is NodePath; isRegexLiteral(opts?: object): this is NodePath; - isReferencedIdentifier(opts?: object): this is NodePath; + isReferencedIdentifier(opts?: object): this is NodePath; isReferencedMemberExpression(opts?: object): this is NodePath; isBindingIdentifier(opts?: object): this is NodePath; isScope(opts?: object): this is NodePath; From 7b9d08ea801e5dea842a8ad3b8377dc56441df1c Mon Sep 17 00:00:00 2001 From: Cameron Martin Date: Wed, 22 Nov 2017 19:48:42 +0000 Subject: [PATCH 34/90] Updated isXX methods of babel-types to be in-line with babel-traverse. --- types/babel-types/index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/babel-types/index.d.ts b/types/babel-types/index.d.ts index 1879c81e85..a49909ed4a 100644 --- a/types/babel-types/index.d.ts +++ b/types/babel-types/index.d.ts @@ -1265,13 +1265,13 @@ export function isJSX(node: object, opts?: object): node is JSX; export function isNumberLiteral(node: object, opts?: object): node is NumericLiteral; export function isRegexLiteral(node: object, opts?: object): node is RegExpLiteral; -export function isReferencedIdentifier(node: object, opts?: object): boolean; -export function isReferencedMemberExpression(node: object, opts?: object): boolean; -export function isBindingIdentifier(node: object, opts?: object): boolean; -export function isScope(node: object, opts?: object): boolean; +export function isReferencedIdentifier(node: object, opts?: object): node is Identifier | JSXIdentifier; +export function isReferencedMemberExpression(node: object, opts?: object): node is MemberExpression; +export function isBindingIdentifier(node: object, opts?: object): node is Identifier; +export function isScope(node: object, opts?: object): node is Scopable; export function isReferenced(node: object, opts?: object): boolean; -export function isBlockScoped(node: object, opts?: object): boolean; -export function isVar(node: object, opts?: object): boolean; +export function isBlockScoped(node: object, opts?: object): node is FunctionDeclaration | ClassDeclaration | VariableDeclaration; +export function isVar(node: object, opts?: object): node is VariableDeclaration; export function isUser(node: object, opts?: object): boolean; export function isGenerated(node: object, opts?: object): boolean; export function isPure(node: object, opts?: object): boolean; From 83146bf4e5fc65acafde5617ff8490b421868c58 Mon Sep 17 00:00:00 2001 From: Yu-Hsin Lu Date: Thu, 23 Nov 2017 14:42:28 +0800 Subject: [PATCH 35/90] Modify data attribute of CheerioElement `data` attribute is a option field. --- types/cheerio/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/cheerio/index.d.ts b/types/cheerio/index.d.ts index 7ea8360849..8250848374 100644 --- a/types/cheerio/index.d.ts +++ b/types/cheerio/index.d.ts @@ -263,7 +263,7 @@ interface CheerioElement { parent: CheerioElement; parentNode: CheerioElement; nodeValue: string; - data: string; + data?: string; } interface CheerioAPI extends CheerioSelector, CheerioStatic { From 6ad9ba8e3c1e881462901da876507641f6bc0615 Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Thu, 23 Nov 2017 09:48:33 +0100 Subject: [PATCH 36/90] review comment fixes --- types/lolex/index.d.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/types/lolex/index.d.ts b/types/lolex/index.d.ts index c0688a5b09..510cb911ec 100644 --- a/types/lolex/index.d.ts +++ b/types/lolex/index.d.ts @@ -120,7 +120,7 @@ export interface LolexClock { /** * Simulates process.nextTick(); */ - nextTick(callback: () => any): void; + nextTick(callback: () => void): void; /** * Advances the clock to the the moment of the first scheduled timer, firing it. @@ -177,29 +177,34 @@ export declare function createClock(now?: number | Date, l export interface LolexInstallOpts { /** - * installs lolex onto the specified target context (default: global) + * Installs lolex onto the specified target context (default: global) */ target?: any; + /** - * installs lolex with the specified unix epoch (default: 0) + * Installs lolex with the specified unix epoch (default: 0) */ now?: number; + /** - * an array with explicit function names to hijack. When not set, lolex will automatically fake all methods except nextTick + * An array with explicit function names to hijack. When not set, lolex will automatically fake all methods except nextTick * e.g., lolex.install({ toFake: ["setTimeout", "nextTick"]}) will fake only setTimeout and nextTick */ toFake?: FakeMethod[]; + /** - * the maximum number of timers that will be run when calling runAll() (default: 1000) + * The maximum number of timers that will be run when calling runAll() (default: 1000) */ loopLimit?: number; + /** - * tells lolex to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by + * Tells lolex to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by * 20ms for every 20ms change in the real system time) (default: false) */ shouldAdvanceTime?: boolean; + /** - * relevant only when using with shouldAdvanceTime: true. increment mocked time by advanceTimeDelta ms every advanceTimeDelta ms change + * Relevant only when using with shouldAdvanceTime: true. increment mocked time by advanceTimeDelta ms every advanceTimeDelta ms change * in the real system time (default: 20) */ advanceTimeDelta?: number; From c68d201b29a92c0b4b622da2cccbf6971c8bf1a8 Mon Sep 17 00:00:00 2001 From: Mark Raymond Date: Thu, 23 Nov 2017 09:59:59 +0000 Subject: [PATCH 37/90] Remove unnecessary `/// `. The redux typings use `export`, not `declare module`, and so don't need /// as well as the import. --- types/redux-immutable-state-invariant/index.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/redux-immutable-state-invariant/index.d.ts b/types/redux-immutable-state-invariant/index.d.ts index b81b6cc47f..6ad2a0e588 100644 --- a/types/redux-immutable-state-invariant/index.d.ts +++ b/types/redux-immutable-state-invariant/index.d.ts @@ -3,8 +3,6 @@ // Definitions by: Remo H. Jansen , Ben Rogers // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - import * as Redux from "redux"; type isImmutableDefault = (value: any) => boolean; From 36e1028c2927efea58781478733e25349906d344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Verg=C3=A9?= Date: Thu, 23 Nov 2017 15:18:37 +0100 Subject: [PATCH 38/90] chart.js: Add missing 'aspectRatio' in ChartOptions --- types/chart.js/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index f4f4bda40d..049488f8db 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -159,6 +159,7 @@ declare namespace Chart { interface ChartOptions { responsive?: boolean; responsiveAnimationDuration?: number; + aspectRatio?: number; maintainAspectRatio?: boolean; events?: string[]; onClick?(event?: MouseEvent, activeElements?: Array<{}>): any; From 00cf286abb4b8842ba73f14e116404a2c24d5713 Mon Sep 17 00:00:00 2001 From: Sami Jaber Date: Thu, 23 Nov 2017 13:24:43 -0500 Subject: [PATCH 39/90] react-loadable - add types of new SSR features --- types/react-loadable/index.d.ts | 65 ++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/types/react-loadable/index.d.ts b/types/react-loadable/index.d.ts index 480ca7765f..f8b4d566c6 100644 --- a/types/react-loadable/index.d.ts +++ b/types/react-loadable/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-loadable 4.0 +// Type definitions for react-loadable 5.3 // Project: https://github.com/thejameskyle/react-loadable#readme // Definitions by: Diogo Franco , Oden S. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -36,6 +36,31 @@ export interface CommonOptions { * After the specified time in milliseconds passes, the component's `timedOut` prop will be set to true. */ timeout?: number | false | null; + + /** + * Optional array of module paths that `Loadable.Capture`'s `report` function will be applied on during + * server-side rendering. This helps the server know which modules were imported/used during SSR. + * ```ts + * Loadable({ + * loader: () => import('./my-component'), + * modules: ['./my-component'], + * }); + * ``` + */ + modules?: string[]; + + /** + * An optional function which returns an array of Webpack module ids which you can get + * with require.resolveWeak. This is used by the client (inside `Loadable.preloadReady`) to + * guarantee each webpack module is preloaded before the first client render. + * ```ts + * Loadable({ + * loader: () => import('./Foo'), + * webpack: () => [require.resolveWeak('./Foo')], + * }); + * ``` + */ + webpack?: () => number[]; } export interface OptionsWithoutRender extends CommonOptions { @@ -112,9 +137,47 @@ export interface LoadableComponent { preload(): void; } +export interface LoadableCaptureProps { + /** + * Function called for every moduleName that is rendered via React Loadable. + */ + report: (moduleName: string) => void; +} + export interface Loadable { (options: Options): React.ComponentType & LoadableComponent; Map(options: OptionsWithMap): React.ComponentType & LoadableComponent; + + /** + * This will call all of the LoadableComponent.preload methods recursively until they are all + * resolved. Allowing you to preload all of your dynamic modules in environments like the server. + * ```ts + * Loadable.preloadAll().then(() => { + * app.listen(3000, () => { + * console.log('Running on http://localhost:3000/'); + * }); + * }); + * ``` + */ + preloadAll(): Promise; + + /** + * Check for modules that are already loaded in the browser and call the matching + * `LoadableComponent.preload` methods. + * ```ts + * window.main = () => { + * Loadable.preloadReady().then(() => { + * ReactDOM.hydrate( + * , + * document.getElementById('app'), + * ); + * }); + * }; + * ``` + * */ + preloadReady(): Promise; + + Capture: React.ComponentType; } declare const LoadableExport: Loadable; From 054b82ad1616eab8efac26a27beaa1a2b7ea295e Mon Sep 17 00:00:00 2001 From: Sami Jaber Date: Thu, 23 Nov 2017 14:23:16 -0500 Subject: [PATCH 40/90] fix JSDoc formatting --- types/react-loadable/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-loadable/index.d.ts b/types/react-loadable/index.d.ts index f8b4d566c6..6220b23ea6 100644 --- a/types/react-loadable/index.d.ts +++ b/types/react-loadable/index.d.ts @@ -174,7 +174,7 @@ export interface Loadable { * }); * }; * ``` - * */ + */ preloadReady(): Promise; Capture: React.ComponentType; From c5174becbcb95abcf53c23d9f0e7ed0f0a58aad5 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 23 Nov 2017 14:51:55 -0500 Subject: [PATCH 41/90] Change dom.remove to include Element --- types/tinymce/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/tinymce/index.d.ts b/types/tinymce/index.d.ts index 65c33f4adb..3719b35784 100644 --- a/types/tinymce/index.d.ts +++ b/types/tinymce/index.d.ts @@ -826,7 +826,7 @@ export namespace dom { parseStyle(cssText: string): {}; - remove(node: string, keepChildren?: boolean): Element | T[]; + remove(node: string | Element, keepChildren?: boolean): Element | T[]; removeAllAttribs(e: Element): void; From ba40bebaf245a4f6cf51f30855e8a35d40460c20 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Fri, 24 Nov 2017 18:18:17 +0900 Subject: [PATCH 42/90] feat: add new configurations --- types/react-swipeable/index.d.ts | 39 ++++++++++--------- .../react-swipeable/react-swipeable-tests.tsx | 2 + types/react-swipeable/tsconfig.json | 6 +-- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/types/react-swipeable/index.d.ts b/types/react-swipeable/index.d.ts index b0036ae119..496f0500cf 100644 --- a/types/react-swipeable/index.d.ts +++ b/types/react-swipeable/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for react-swipeable 4.0 +// Type definitions for react-swipeable 4.2 // Project: https://www.npmjs.com/package/react-swipeable // Definitions by: Giedrius Grabauskas // Konstantin Vasilev +// Hiroki Horiuchi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -10,30 +11,32 @@ import * as React from 'react'; declare class ReactSwipeable extends React.Component {} declare namespace ReactSwipeable { - type OnSwipingCallback = (event: React.TouchEvent, deltaX: number, deltaY: number, absX: number, absY: number, velocity: number) => void; - type OnSwipedCallback = (event: React.TouchEvent, deltaX: number, deltaY: number, isFlick: boolean, velocity: number) => void; - type OnSwipedDirectionCallback = (event: React.TouchEvent, delta: number, isFlick: boolean) => void; - type OnSwipingDirectionCallback = (event: React.TouchEvent, delta: number) => void; - type OnTapCallback = (event: React.TouchEvent) => void; + type OnSwipingCallback = (event: React.TouchEvent, deltaX: number, deltaY: number, absX: number, absY: number, velocity: number) => void; + type OnSwipedCallback = (event: React.TouchEvent, deltaX: number, deltaY: number, isFlick: boolean, velocity: number) => void; + type OnSwipedDirectionCallback = (event: React.TouchEvent, delta: number, isFlick: boolean) => void; + type OnSwipingDirectionCallback = (event: React.TouchEvent, delta: number) => void; + type OnTapCallback = (event: React.TouchEvent) => void; - interface SwipeableProps extends React.ClassAttributes, React.HTMLAttributes { - onSwiped?: OnSwipedCallback; - onSwiping?: OnSwipingCallback; - onSwipingUp?: OnSwipingDirectionCallback; - onSwipingRight?: OnSwipingDirectionCallback; - onSwipingDown?: OnSwipingDirectionCallback; - onSwipingLeft?: OnSwipingDirectionCallback; - onSwipedUp?: OnSwipedDirectionCallback; - onSwipedRight?: OnSwipedDirectionCallback; - onSwipedDown?: OnSwipedDirectionCallback; - onSwipedLeft?: OnSwipedDirectionCallback; - onTap?: OnTapCallback; + interface SwipeableProps extends React.ClassAttributes, React.HTMLAttributes { + onSwiped?: OnSwipedCallback; + onSwiping?: OnSwipingCallback; + onSwipingUp?: OnSwipingDirectionCallback; + onSwipingRight?: OnSwipingDirectionCallback; + onSwipingDown?: OnSwipingDirectionCallback; + onSwipingLeft?: OnSwipingDirectionCallback; + onSwipedUp?: OnSwipedDirectionCallback; + onSwipedRight?: OnSwipedDirectionCallback; + onSwipedDown?: OnSwipedDirectionCallback; + onSwipedLeft?: OnSwipedDirectionCallback; + onTap?: OnTapCallback; flickThreshold?: number; delta?: number; preventDefaultTouchmoveEvent?: boolean; stopPropagation?: boolean; nodeName?: string; trackMouse?: boolean; + disabled?: boolean; + innerRef?: React.Ref; children?: React.ReactNode; } } diff --git a/types/react-swipeable/react-swipeable-tests.tsx b/types/react-swipeable/react-swipeable-tests.tsx index 61093a203e..4fa67abffa 100644 --- a/types/react-swipeable/react-swipeable-tests.tsx +++ b/types/react-swipeable/react-swipeable-tests.tsx @@ -35,6 +35,8 @@ class SampleComponent extends React.PureComponent { stopPropagation nodeName="swipe" trackMouse + disabled + innerRef="swipe-ref" onClick={this.handleClick} >

diff --git a/types/react-swipeable/tsconfig.json b/types/react-swipeable/tsconfig.json index 0d676ade9b..a720949edf 100644 --- a/types/react-swipeable/tsconfig.json +++ b/types/react-swipeable/tsconfig.json @@ -6,8 +6,8 @@ "dom" ], "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": false, + "noImplicitThis": true, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -22,4 +22,4 @@ "index.d.ts", "react-swipeable-tests.tsx" ] -} \ No newline at end of file +} From 75dd3af6069b42c34c51d5cc18285b58308e53a8 Mon Sep 17 00:00:00 2001 From: Gintautas Miselis Date: Fri, 24 Nov 2017 16:31:47 +0000 Subject: [PATCH 43/90] [chai] added missing include methods to Assert --- types/chai/chai-tests.ts | 50 +++++++++++++++ types/chai/index.d.ts | 135 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 184 insertions(+), 1 deletion(-) diff --git a/types/chai/chai-tests.ts b/types/chai/chai-tests.ts index 0076396422..401e5f468a 100644 --- a/types/chai/chai-tests.ts +++ b/types/chai/chai-tests.ts @@ -1357,6 +1357,56 @@ suite('assert', () => { assert.notInclude(undefined, 'bar'); }); + test('deepInclude', () => { + assert.deepInclude('foobar', 'bar'); + assert.deepInclude([1, 2, 3], 3); + assert.deepInclude('foobar', 'baz'); + assert.deepInclude(undefined, 'bar'); + }); + + test('notDeepInclude', () => { + assert.notDeepInclude('foobar', 'baz'); + assert.notDeepInclude([1, 2, 3], 4); + assert.notDeepInclude('foobar', 'bar'); + assert.notDeepInclude(undefined, 'bar'); + }); + + test('nestedInclude', () => { + assert.nestedInclude({'.a': {'b': 'x'}}, {'\\.a.[b]': 'x'}); + assert.nestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'x'}); + }); + + test('notNestedInclude', () => { + assert.notNestedInclude({'.a': {'b': 'x'}}, {'\\.a.b': 'y'}); + assert.notNestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'y'}); + }); + + test('deepNestedInclude', () => { + assert.deepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {x: 1}}); + assert.deepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {x: 1}}); + }); + + test('notDeepNestedInclude', () => { + assert.notDeepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {y: 1}}) + assert.notDeepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {y: 2}}); + }); + + test('ownInclude', () => { + assert.ownInclude({ a: 1 }, { a: 1 }); + }); + + test('notOwnInclude', () => { + assert.notOwnInclude({ a: 1 }, { a: 1 }); + }); + + test('deepOwnInclude', () => { + assert.deepOwnInclude({a: {b: 2}}, {a: {b: 2}}); + }); + + test('notDeepOwnInclude', () => { + assert.notDeepOwnInclude({a: {b: 2}}, {a: {c: 3}}); + }); + test('lengthOf', () => { assert.lengthOf([1, 2, 3], 3); assert.lengthOf('foobar', 6); diff --git a/types/chai/index.d.ts b/types/chai/index.d.ts index 340d69f7cd..faafa3b2a8 100644 --- a/types/chai/index.d.ts +++ b/types/chai/index.d.ts @@ -7,6 +7,7 @@ // Matt Wistrand , // Josh Goldberg // Shaun Luttin +// Gintautas Miselis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // @@ -706,13 +707,145 @@ declare namespace Chai { /** * Asserts that haystack does not include needle. * - * @type T Type of values in haystack. * @param haystack Container array. * @param needle Potential value contained in haystack. * @param message Message to display on error. */ notInclude(haystack: any[], needle: any, message?: string): void; + + /** + * Asserts that haystack includes needle. Can be used to assert the inclusion of a value in an array or a subset of properties in an object. Deep equality is used. + * + * @param haystack Container string. + * @param needle Potential expected substring of haystack. + * @param message Message to display on error. + */ + deepInclude(haystack: string, needle: string, message?: string): void; + + /** + * Asserts that haystack includes needle. Can be used to assert the inclusion of a value in an array or a subset of properties in an object. Deep equality is used. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + deepInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that haystack does not include needle. Can be used to assert the absence of a value in an array or a subset of properties in an object. Deep equality is used. + * + * @param haystack Container string. + * @param needle Potential expected substring of haystack. + * @param message Message to display on error. + */ + notDeepInclude(haystack: string, needle: any, message?: string): void; + + /** + * Asserts that haystack does not include needle. Can be used to assert the absence of a value in an array or a subset of properties in an object. Deep equality is used. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + notDeepInclude(haystack: any[], needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object. + * + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. + * Can be used to assert the inclusion of a subset of properties in an object. + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + nestedInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object. + * + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. + * Can be used to assert the inclusion of a subset of properties in an object. + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + notNestedInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while checking for deep equality + * + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. + * Can be used to assert the inclusion of a subset of properties in an object. + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + deepNestedInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object while checking for deep equality. + * + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. + * Can be used to assert the inclusion of a subset of properties in an object. + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + notDeepNestedInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + ownInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + notOwnInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties and checking for deep + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + deepOwnInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties and checking for deep equality. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + notDeepOwnInclude(haystack: any, needle: any, message?: string): void; + /** * Asserts that value matches the regular expression regexp. * From 05003fe74b33b8b6216ebd2e8a5750208cce0c07 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 24 Nov 2017 13:15:12 -0800 Subject: [PATCH 44/90] Stubbed Node and removed --lib dom from highlight.js --- types/highlight.js/index.d.ts | 6 +++++- types/highlight.js/tsconfig.json | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/types/highlight.js/index.d.ts b/types/highlight.js/index.d.ts index d691811b47..f96be1c06f 100644 --- a/types/highlight.js/index.d.ts +++ b/types/highlight.js/index.d.ts @@ -1,10 +1,14 @@ // Type definitions for highlight.js v9.12 // Project: https://github.com/isagalaev/highlight.js -// Definitions by: Niklas Mollenhauer , Jeremy Hull +// Definitions by: Niklas Mollenhauer +// Jeremy Hull +// Josh Goldberg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace hljs { + interface Node { } + export function highlight( name: string, value: string, diff --git a/types/highlight.js/tsconfig.json b/types/highlight.js/tsconfig.json index 5f5d2ae011..e3627e99ca 100644 --- a/types/highlight.js/tsconfig.json +++ b/types/highlight.js/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", - "dom" + "es6" ], "noImplicitAny": true, "noImplicitThis": true, From c576d719249614327516c3369c1d71475b8c5b08 Mon Sep 17 00:00:00 2001 From: Carlton Colter Date: Fri, 24 Nov 2017 19:44:54 -0500 Subject: [PATCH 45/90] v9 Compatibility Modified to handle deprecations and have comments that give directions to the sdk webpage. Added XrmEnum constants for ease of use. --- types/xrm/index.d.ts | 4596 ++++++++++++++++++++++++------------------ 1 file changed, 2619 insertions(+), 1977 deletions(-) diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index 31bdd6776a..93a09dc19a 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -7,16 +7,28 @@ // Tully H // Scott Durow // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.4 declare var Xrm: Xrm.XrmStatic; -declare function GetGlobalContext(): Xrm.Context; + +/** + * Gets the global context. + * The method provides access to the global context without going through the form context. + * + * It is preferreed to use {@link Xrm.Utility.getGlobalContext Xrm.Utility.getGlobalContext()} instead. + * @see Xrm.Utility.getGlobalContext + */ +declare function GetGlobalContext(): Xrm.GlobalContext; interface Window { Xrm: Xrm.XrmStatic; - GetGlobalContext(): Xrm.Context; + GetGlobalContext(): Xrm.GlobalContext; } +/** + * Xrm Namespace + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference External Link: Client API Reference} + */ declare namespace Xrm { /** * Static xRM object. @@ -24,7 +36,8 @@ declare namespace Xrm { interface XrmStatic { /** * Provides a namespace container for the context, data and ui objects. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} + * @deprecated Deprecated in v9. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ Page: Page; @@ -34,55 +47,89 @@ declare namespace Xrm { /** * Provides a container for useful functions not directly related to the current page. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-utility External Link: Xrm.Utility (Client API reference)} */ Utility: Utility; /** * Provides methods to create and manage records in the mobile clients (for phones tablets). + * @deprecated Use {@link Xrm.WebApi} instead. */ Mobile: Mobile; /** * Provides methods to display a web page in the side pane of web client. * - * @see {@link https://msdn.microsoft.com/en-us/library/mt790281.aspx} for details. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-panel External Link: Xrm.Panel} */ Panel: Panel; /** * Provides properties and methods to use Web API to create and manage records and execute Web API actions and functions in Customer Engagement. * - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi} for details + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi External Link: Xrm.WebApi (Client API reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/use-microsoft-dynamics-365-web-api External Link: Use the Customer Engagement Web API} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/get-started-web-api-client-side-javascript Get started with the Customer Engagement Web API (client-side JavaScript)} */ WebApi: WebApi; /** * Provides methods to use native device capabilities of mobile devices. * - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-device} for details + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-device External Link: Xrm.Device (Client API reference)} */ Device: Device; /** * Provides methods to encode strings. * - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-encoding} for details + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-encoding External Link: Xrm.Encoding (Client API reference)} */ Encoding: Encoding; } /** - * Client Types for Xrm.Page.context.getClient(). + * Client Types for {@link GlobalContext.getClient globalContext.getClient()}. + * @see XrmEnum.Client */ - type Client = "Web" | "Outlook" | "Mobile"; + type Client = "Web" | "Outlook" | "Mobile" | "UnifiedServiceDesk"; /** - * Client States for Xrm.Page.context.getClientState(). + * Client States for {@link GlobalContext.getClientState globalContext.getClientState()}. + * @see XrmEnum.ClientState */ type ClientState = "Online" | "Offline"; /** - * Themes for Xrm.Page.context.getCurrentTheme(). + * Display States for setDisplayState() on {@link Controls.ProcessControl.setDisplayState Processes} and {@link Controls.Tab.setDisplayState Tabs}. + * @see XrmEnum.DisplayState + */ + type DisplayState = "collapsed" | "expanded"; + + /** + * The {@link Entity.save Entity}'s Save Mode + * @see XrmEnum.EntitySaveMode + * @see Entity + * @see Entity.save + */ + type EntitySaveMode = "saveandclose" | "saveandnew"; + + /** + * Form Notification Levels for {@link Ui.setFormNotification formContext.ui.setFormNotification()}. + * @see XrmEnum.FormNotificationLevel + */ + type FormNotificationLevel = "ERROR" | "INFO" | "WARNING"; + + /** + * Submit Mode for {@link Attributes.Attribute.setSubmitMode} Attributes.Attribute.setSubmitMode(). + * @see XrmEnum.SubmitMode + */ + type SubmitMode = "always" | "dirty" | "never"; + + /** + * Themes for {@link GlobalContext.getCurrentTheme globalContext.getCurrentTheme()}. + * Note: getCurrentTheme() does not work with Dynamics CRM for tablets or in the unified interface. + * @see XrmEnum.Theme */ type Theme = "default" | "Office12Blue" | "Office14Silver"; @@ -92,15 +139,13 @@ declare namespace Xrm { interface ClientContext { /** * Returns a value to indicate which client the script is executing in. - * - * @return The client, as either "Web", "Outlook", or "Mobile" + * @returns The client, as either "Web", "Outlook", or "Mobile" */ getClient(): Client; /** * Gets client's current state. - * - * @return The client state, as either "Online" or "Offline" + * @returns The client state, as either "Online" or "Offline" */ getClientState(): ClientState; @@ -266,8 +311,9 @@ declare namespace Xrm { /** * Interface for the xRM application context. + * GetGlobalContext() */ - interface Context { + interface GlobalContext { /** * The client's context instance. */ @@ -285,16 +331,17 @@ declare namespace Xrm { /** * Returns information about the advanced configuration settings for the organization. - * @param setting Name of the configuration setting. + * @param setting Name of the configuration setting. + * @see XrmEnum.AdvancedConfigSettingOption */ getAdvancedConfigSetting(setting: "MaxChildIncidentNumber" | "MaxIncidentMergeNumber"): number; /** * Gets client's base URL for Dynamics CRM * - * @return The client's base URL + * @returns The client's base URL * - * @remarks For Dynamics CRM On-Premises: http(s)://server/org + * @example For Dynamics CRM On-Premises: http(s)://server/org * For Dynamics CRM Online: https://org.crm.dynamics.com * For Dynamics CRM for Outlook (Offline): http://localhost:2525 */ @@ -310,93 +357,103 @@ declare namespace Xrm { */ getCurrentAppProperties(): Async.PromiseLike; + /** + * Returns the URL of the current business app in Customer Engagement. + * @example Online https://[org].crm.dynamics.com/main.aspx?appid=[GUID] + * OnPrem https://[server]/[org]/main.aspx?appid=[GUID] + * @returns A string containing the url of the current business app. + */ + getCurrentAppUrl(): string; + /** * Gets current styling theme. - * - * @return The name of the current theme, as either "default", "Office12Blue", or "Office14Silver" - * - * @remarks This function does not work with Dynamics CRM for tablets. + * Note: This function does not work with Dynamics CRM for tablets or in the unified interface. + * @returns The name of the current theme, as either "default", "Office12Blue", or "Office14Silver" */ getCurrentTheme(): Theme; /** * Gets whether automatic save is enabled. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @return true if automatic saving is enabled, otherwise false. + * @deprecated Deprecated in v9. Use {@link Xrm.OrganizationSettings.isAutoSaveEnabled globalContext.organizationSettings.isAutoSaveEnabled} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @returns true if automatic saving is enabled, otherwise false. */ getIsAutoSaveEnabled(): boolean; /** * Gets organization's LCID (language code). - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @return The organization language code. - * - * @see {@link http://msdn.microsoft.com/en-us/library/ms912047(WinEmbedded.10).aspx|Microsoft Locale ID Values} + * @deprecated Deprecated in v9. Use {@link Xrm.OrganizationSettings.languageId globalContext.organizationSettings.languageId} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @returns The organization language code. + * @see {@link http://msdn.microsoft.com/en-us/library/ms912047(WinEmbedded.10).aspx External Link: Microsoft Locale ID Values} */ getOrgLcid(): number; /** * Gets organization's unique name. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @return The organization's unique name. * - * @remarks This value can be found on the Developer Resources page within Dynamics CRM + * Note: This value can be found on the Developer Resources page within Dynamics CRM. + * @deprecated Deprecated in v9. Use {@link Xrm.OrganizationSettings.uniqueName} globalContext.organizationSettings.uniqueName instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @returns The organization's unique name. */ getOrgUniqueName(): string; /** * Gets query string parameters. - * - * @return The query string parameters, in a dictionary object representing name and value pairs. - * @deprecated: Deprecated in v9 (Still applicable in Web Client). See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} + * @returns The query string parameters, in a dictionary object representing name and value pairs. + * @deprecated Deprecated in v9 (Still applicable in Web Client). + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ getQueryStringParameters(): { [index: string]: any }; /** * Returns the difference between the local time and Coordinated Universal Time (UTC). * - * @return The time zone offset, in minutes. + * @returns The time zone offset, in minutes. */ getTimeZoneOffsetMinutes(): number; /** * Gets user's unique identifier. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @return The user's identifier in Guid format. - * - * @remarks Example: "{B05EC7CE-5D51-DF11-97E0-00155DB232D0}" + * @deprecated Deprecated in v9. Use {@link Xrm.UserSettings.userId globalContext.userSettings.userId} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @returns The user's identifier in Guid format. + * @example Example: "{B05EC7CE-5D51-DF11-97E0-00155DB232D0}" */ getUserId(): string; /** * Gets user's LCID (language code). - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @return The user's language code. + * @deprecated Deprecated in v9. Use {@link Xrm.UserSettings.languageId globalContext.userSetings.languageId} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @returns The user's language code. * - * @see {@link http://msdn.microsoft.com/en-us/library/ms912047(WinEmbedded.10).aspx|Microsoft Locale ID Values} + * @see {@link http://msdn.microsoft.com/en-us/library/ms912047(WinEmbedded.10).aspx External Link: Microsoft Locale ID Values} */ getUserLcid(): number; /** * Gets the name of the current user. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @return The user's name. + * @deprecated Deprecated in v9. Use {@link Xrm.UserSettings.userName globalContext.userSettings.userName} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @returns The user's name. */ getUserName(): string; /** * Gets all user security roles. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @return An array of user role identifiers, in Guid format. - * - * @remarks Example: ["cf4cc7ce-5d51-df11-97e0-00155db232d0"] + * @deprecated Deprecated in v9. Use {@link Xrm.UserSettings.securityRoles globalContext.userSettings.securityRoles} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @returns An array of user role identifiers, in Guid format. + * @example Example: ["cf4cc7ce-5d51-df11-97e0-00155db232d0"] */ getUserRoles(): string[]; /** * Returns the version number of the Dynamics 365 server. * - * @return The version number + * @returns The version number */ getVersion(): string; @@ -409,17 +466,175 @@ declare namespace Xrm { * Prefixes the current organization's unique name to a string; typically a URL path. * * @param sPath Local pathname of the resource. - * @return A path string with the organization name. - * - * @remarks Format: "/"+ OrgName + sPath + * @returns A path string with the organization name. Format: "/"+ OrgName + sPath */ prependOrgName(sPath: string): string; } + namespace Events { + /** + * Interface for save event arguments. + */ + interface SaveEventArguments { + /** + * @summary Gets save mode, as an integer. + * + * @returns The save mode. + * + * @description Gets save mode, as an integer. + * Values returned are: 1 Save + * 2 Save and Close + * 59 Save and New + * 70 AutoSave (Where enabled; can be used with an OnSave handler + * to conditionally disable auto-saving) + * 58 Save as Completed (Activities) + * 5 Deactivate + * 6 Reactivate + * 47 Assign (All user- or team-owned entities) + * 7 Send (Email) + * 16 Qualify (Lead) + * 15 Disqualify (Lead) + */ + getSaveMode(): XrmEnum.SaveMode; + + /** + * Returns a boolean value to indicate if the record's save has been prevented. + * + * @returns true if saving is prevented, otherwise false. + */ + isDefaultPrevented(): boolean; + + /** + * Prevents the save operation from being submitted to the server. + * All remaining "on save" handlers will continue execution. + */ + preventDefault(): void; + } + + /** + * Interface for process stage change event arguments. + */ + interface StageChangeEventArguments { + /** + * Gets the direction of the stage change. + * @returns The direction: "next" or "previous" + */ + getDirection(): ProcessFlow.StageChangeDirection; + + /** + * Gets the destination stage object + * @returns The stage object. For switching between entities, returns the previous stage object + */ + getStage(): ProcessFlow.Stage; + } + + /** + * Interface for process stage selected event arguments. + */ + interface StageSelectedEventArguments { + /** + * Gets the selected stage object + * @returns The stage object + */ + getStage(): ProcessFlow.Stage; + } + + /** + * Interface for the event context. + */ + interface EventContext { + /** + * Gets the Xrm context. + * @returns The Xrm context. + */ + getContext(): GlobalContext; + + /** + * Gets the handler's depth, which is the order in which the handler is executed. + * @returns The depth, a 0-based index. + */ + getDepth(): number; + + /** + * Gets a reference to the object for which event occurred. + * @returns The event source. + */ + getEventSource(): Attributes.Attribute | Controls.Control | Entity; + + /** + * Gets a reference to the currnet form context + * @returns The {@link FormContext form context} + */ + getFormContext(): FormContext; + + /** + * @summary Gets the shared variable with the specified key. + * @param T Generic type parameter. + * @param key The key. + * @returns The shared variable. + * @desc Gets the shared variable with the specified key. + * Used to pass values between handlers of an event. + */ + getSharedVariable(key: string): T; + + /** + * @summary Sets a shared variable. + * @param T Generic type parameter. + * @param key The key. + * @param value The value. + * @desc Sets the shared variable with the specified key. + * Used to pass values between handlers of an event. + */ + setSharedVariable(key: string, value: T): void; + } + + /** + * Interface for a save event context + */ + interface SaveEventContext extends EventContext { + /** + * Gets save-event arguments. + * @returns The event arguments. Returns null for all but the "save" event. + */ + getEventArgs(): SaveEventArguments; + } + + /** + * Interface for a process stage change event context + */ + interface StageChangeEventContext extends EventContext { + /** + * Gets process stage change event arguments. + * @returns The event arguments. + */ + getEventArgs(): StageChangeEventArguments; + } + + interface StageSelectedEventContext extends EventContext { + /** + * Gets process stage selected event arguments. + * @returns The event arguments. + */ + getEventArgs(): StageSelectedEventArguments; + } + + /** + * Type for a context-sensitive handler. + * @param context The context. + */ + type ContextSensitiveHandler = (context: EventContext) => void; + + /** + * Type for a process status change handler. + * @param status The process status. + */ + type ProcessStatusChangeHandler = (status: ProcessFlow.ProcessStatus) => void; + } + /** * Defines save options to control how appointment, recurring appointment, or service activity records are processed. * - * @see {@link https://msdn.microsoft.com/en-us/library/dn481607.aspx#Anchor_2} for details. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data/save External Link: save(Client API reference)} */ interface SaveOptions { /** @@ -430,29 +645,27 @@ declare namespace Xrm { } /** - * Interface for the Xrm.Page.data object. + * Interface for the formContext.data object. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data External Link: formContext.data (Client API reference)} */ interface Data { /** * Asynchronously refreshes data on the form, without reloading the page. - * * @param save true to save the record, after the refresh. - * @return Returns an asynchronous promise. + * @returns Returns an asynchronous promise. */ refresh(save: boolean): Async.PromiseLike; /** * Asynchronously saves the record. - * - * @return Returns an asynchronous promise. + * @returns Returns an asynchronous promise. */ save(): Async.PromiseLike; /** * Asynchronously saves the record with the option to set callback functions to be executed after the save operation is completed. - * * @param saveOptions Options to control how appointment, recurring appointment, or service activity records are processed. - * @return Returns an asynchronous promise. + * @returns Returns an asynchronous promise. */ save(saveOptions: SaveOptions): Async.PromiseLike; @@ -460,158 +673,146 @@ declare namespace Xrm { * Collection of non-entity data on the form. * Items in this collection are of the same type as the attributes collection, but they are not attributes of the form entity. * In V9 this is only available in the Unified Client + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/attributes External Link: Attributes (Client API reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + * @see Attributes */ - attributes: Collection.ItemCollection; + attributes: Collection.ItemCollection; /** - * The record context of the form. + * The record context of the form, {@link Entity formContext.data.entity} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data-entity External Link: formContext.data.entity (Client API reference)} */ - entity: Page.Entity; + entity: Entity; /** - * The process API for Xrm.Page.data. + * The process API for {@link ProcessFlow.ProcessManager formContext.ui.process}. * @remarks This member may be undefined when Process Flows are not used by the current entity. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data-process External Link: formContext.data.process (Client API reference)} */ - process: Page.data.ProcessManager; + process: ProcessFlow.ProcessManager; } /** - * Interface for Page context + * Interface for formContext + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/executioncontext/getformcontext External Link: getFormContext (Client API reference)} */ - interface Page { - /** - * Provides methods to retrieve information specific to an organization, a user, or parameters passed to a page. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - */ - context: Context; - + interface FormContext { /** * Provides methods to work with the form. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data External Link: formContext.data (Client API reference)} */ data: Data; /** * Contains properties and methods to retrieve information about the user interface as well as collections for several subcomponents of the form. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui External Link: formContext.ui (Client API reference)} */ ui: Ui; /** * Gets all attributes. - * - * @return An array of attributes. + * @returns An array of attributes. */ - getAttribute(): Page.Attribute[]; + getAttribute(): Attributes.Attribute[]; /** * Gets an attribute matching attributeName. - * - * @tparam T An Attribute type. + * @param T An Attribute type. * @param attributeName Name of the attribute. - * @return The attribute. + * @returns The attribute. */ - getAttribute(attributeName: string): T; + getAttribute(attributeName: string): T; /** * Gets an attribute matching attributeName. - * * @param attributeName Name of the attribute. - * @return The attribute. + * @returns The attribute. */ - getAttribute(attributeName: string): Page.Attribute; + getAttribute(attributeName: string): Attributes.Attribute; /** * Gets an attribute by index. - * * @param index The attribute index. - * @return The attribute. + * @returns The attribute. */ - getAttribute(index: number): Page.Attribute; + getAttribute(index: number): Attributes.Attribute; /** * Gets an attribute. - * * @param delegateFunction A matching delegate function - * @return An array of attribute. + * @returns An array of attribute. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} */ - getAttribute(delegateFunction: Collection.MatchingDelegate): Page.Attribute[]; + getAttribute(delegateFunction: Collection.MatchingDelegate): Attributes.Attribute[]; /** * Gets all controls. - * - * @return An array of controls. + * @returns An array of controls. */ - getControl(): Page.Control[]; + getControl(): Controls.Control[]; /** * Gets a control matching controlName. - * * @param T A Control type * @param controlName Name of the control. - * - * @return The control. + * @returns The control. */ - getControl(controlName: string): T; + getControl(controlName: string): T; /** * Gets a control matching controlName. - * - * @param controlName Name of the control. - * @return The control. + * @param controlName Name of the control. + * @returns The control. */ - getControl(controlName: string): Page.Control; + getControl(controlName: string): Controls.Control; /** * Gets a control by index. - * * @param T A Control type * @param index The control index. - * - * @return The control. + * @returns The control. */ - getControl(index: number): T; + getControl(index: number): T; /** * Gets a control by index. - * * @param index The control index. - * @return The control. + * @returns The control. */ - getControl(index: number): Page.Control; + getControl(index: number): Controls.Control; /** * Gets a control. - * * @param delegateFunction A matching delegate function. - * @return An array of control. + * @returns An array of control. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} */ - getControl(delegateFunction: Collection.MatchingDelegate): Page.Control[]; + getControl(delegateFunction: Collection.MatchingDelegate): Controls.Control[]; } /** - * Interface for the Xrm.Page.ui object. + * Interface for the formContext.ui object. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui External Link: formContext.ui (Client API reference)} */ interface Ui { /** * Displays a form level notification. Any number of notifications can be displayed and will remain until removed using clearFormNotification. * The height of the notification area is limited so each new message will be added to the top. - * * @param message The text of the notification message. * @param level The level of the notification which defines how the message will be displayed, such as the icon. + * ERROR: Notification will use the system error icon. + * WARNING: Notification will use the system warning icon. + * INFO: Notification will use the system info icon. * @param uniqueId Unique identifier for the notification which is used with clearFormNotification to remove the notification. - * - * @return true if it succeeds, otherwise false. - * - * @remarks Values for level are: ERROR Notification will use the system error icon. - * WARNING Notification will use the system warning icon. - * INFO Notification will use the system info icon. + * @returns true if it succeeds, otherwise false. */ - setFormNotification(message: string, level: Page.ui.FormNotificationLevel, uniqueId: string): boolean; + setFormNotification(message: string, level: FormNotificationLevel, uniqueId: string): boolean; /** * Clears the form notification described by uniqueId. - * * @param uniqueId Unique identifier. - * @return True if it succeeds, otherwise false. + * @returns True if it succeeds, otherwise false. */ clearFormNotification(uniqueId: string): boolean; @@ -622,9 +823,7 @@ declare namespace Xrm { /** * Gets form type. - * - * @return The form type. - * + * @returns The form type. * @remarks Values returned are: 0 Undefined * 1 Create * 2 Update @@ -637,25 +836,20 @@ declare namespace Xrm { /** * Gets view port height. - * - * @return The view port height, in pixels. - * + * @returns The view port height, in pixels. * @remarks This method does not work with Microsoft Dynamics CRM for tablets. */ getViewPortHeight(): number; /** * Gets view port width. - * - * @return The view port width, in pixels. - * + * @returns The view port width, in pixels. * @remarks This method does not work with Microsoft Dynamics CRM for tablets. */ getViewPortWidth(): number; /** * Re-evaluates the ribbon's configured EnableRules. - * * @remarks This method does not work with Microsoft Dynamics CRM for tablets. */ refreshRibbon(): void; @@ -663,36 +857,40 @@ declare namespace Xrm { /** * The business process flow API, used to interact with the business process flow control in a form. */ - process: Page.ui.ProcessManager; + process: Controls.ProcessControl; /** * A reference to the collection of controls on the form. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} */ - controls: Collection.ItemCollection; + controls: Collection.ItemCollection; /** * The form selector API. * * @remarks This API does not exist with Microsoft Dynamics CRM for tablets. */ - formSelector: Page.FormSelector; + formSelector: Controls.FormSelector; /** * The navigation API. * * @remarks This API does not exist with Microsoft Dynamics CRM for tablets. */ - navigation: Page.Navigation; + navigation: Controls.Navigation; /** * A reference to the collection of tabs on the form. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} */ - tabs: Collection.ItemCollection; + tabs: Collection.ItemCollection; /** * A collection of all the quick view controls on a form using the new form rendering engine (also called "turbo forms"). + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui-quickforms ExternalLink: formContext.ui.quickForms (Client API reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui External Link: formContext.ui (Client API reference)} */ - quickForms: Collection.ItemCollection; + quickForms: Collection.ItemCollection; } /** @@ -727,6 +925,7 @@ declare namespace Xrm { /** * Interface for the Xrm.Utility API + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-utility External Link: Xrm.Utility (Client API reference)} */ interface Utility { /** @@ -737,27 +936,28 @@ declare namespace Xrm { /** * Returns the valid state transitions for the specified entity type and state code. * TODO: No info on the return type is available - * @param entityName The logical name of the entity. - * @param stateCode The state code to find out the allowed status transition values. + * @param entityName The logical name of the entity. + * @param stateCode The state code to find out the allowed status transition values. */ getAllowedStatusTransitions(entityName: string, stateCode: number): Async.PromiseLike; /** * Returns the entity metadata for the specified entity. - * @param entityName The logical name of the entity. - * @param attributes The attributes to get metadata for. + * @param entityName The logical name of the entity. + * @param attributes The attributes to get metadata for. */ getEntityMetadata(entityName: string, attributes?: string[]): Async.PromiseLike; /** * The method provides access to the global context without going through the form context. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-utility/getglobalcontext External Link: getGlobalContext (Client API reference)} */ - getGlobalContext(): Context; + getGlobalContext(): GlobalContext; /** * Returns the localized string for a given key associated with the specified web resource. - * @param webResourceName The name of the web resource. - * @param key The key for the localized string. + * @param webResourceName The name of the web resource. + * @param key The key for the localized string. * @returns A localized string. */ getResourceString(webResourceName: string, key: string): string; @@ -766,6 +966,9 @@ declare namespace Xrm { * Invokes an action based on the specified parameters * @param name Name of the process action to invoke. * @param parameters An object containing input parameters for the action. You define an object using key:value pairs of items, where key is of String type. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-utility/invokeprocessaction External Link: invokeProcessAction (Client API reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/customize/actions External Link: Actions overview} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/create-own-actions External Link: Create your own actions} */ invokeProcessAction(name: string, parameters: Collection.Dictionary): Async.PromiseLike; @@ -773,12 +976,13 @@ declare namespace Xrm { * Opens a lookup control to select one or more items. * @param lookupOptions Defines the options for opening the lookup dialog */ - lookupObjects(lookupOptions: LookupOptions): Async.PromiseLike; + lookupObjects(lookupOptions: LookupOptions): Async.PromiseLike; /** * Refreshes the parent grid containing the specified record. + * @param lookupOptions: The lookup value of the parent object to refresh. */ - refreshParentGrid(lookupOptions: Page.LookupValue): void; + refreshParentGrid(lookupOptions: LookupValue): void; /** * Displays a progress dialog with the specified message. @@ -789,8 +993,8 @@ declare namespace Xrm { /** * Displays an alert dialog, with an "OK" button. - * @deprecated: Deprecated in v9. Use Xrm.Navigation. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * + * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openAlertDialog} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} * @param message The message. * @param onCloseCallback The "OK" callback. */ @@ -798,8 +1002,8 @@ declare namespace Xrm { /** * Displays a confirmation dialog, with "OK" and "Cancel" buttons. - * @deprecated: Deprecated in v9. Use Xrm.Navigation. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * + * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openConfirmDialog} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} * @param message The message. * @param yesCloseCallback The "OK" callback. * @param noCloseCallback The "Cancel" callback. @@ -808,30 +1012,31 @@ declare namespace Xrm { /** * Query if 'entityType' is an Activity entity. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @param entityType Type of the entity. - * - * @return true if the entity is an Activity, false if not. + * @deprecated Deprecated in v9. Use {@link Xrm.Utility.getEntityMetadata Xrm.Utility.getEntityMetadata(entityName, ["IsActivity"])} instead. + * @remarks The isActivityType method is synchronous so it was suitable for ribbon rules. + * However, the replacement method, getEntityMetadata, is asynchronous, and is not suitable for ribbon rules. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @param entityType Type of the entity. + * @returns true if the entity is an Activity, false if not. */ isActivityType(entityType: string): boolean; /** * Opens quick create. - * @deprecated: Deprecated in v9. Use Xrm.Navigation. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @param entityLogicalName The logical name of the entity to create. - * @param createFromEntity (Optional) Designates a record that will provide default values - * based on mapped attribute values. - * @param parameters (Optional) A dictionary object that passes extra query string - * parameters to the form. Invalid query string parameters will cause an - * error. - * @return Returns an asynchronous promise. + * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openForm} instead with the option {useQuickCreateForm:true}. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @param entityLogicalName The logical name of the entity to create. + * @param createFromEntity (Optional) Designates a record that will provide default values based on mapped attribute values. + * @param parameters (Optional) A dictionary object that passes extra query string parameters to the form. Invalid query string parameters will cause an error. + * @returns Returns an asynchronous promise. */ - openQuickCreate(entityLogicalName: string, createFromEntity?: Page.LookupValue, parameters?: Utility.OpenParameters): + openQuickCreate(entityLogicalName: string, createFromEntity?: LookupValue, parameters?: Utility.OpenParameters): Async.PromiseLike; /** * Opens an entity form. - * @deprecated: Deprecated in v9. Use Xrm.Navigation. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} + * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openForm} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} * @param name The entity's logical name. * @param id (Optional) The unique identifier for the record. * @param parameters (Optional) A dictionary object that passes extra query string parameters to the form. @@ -841,16 +1046,13 @@ declare namespace Xrm { /** * Opens an HTML Web Resource in a new browser window. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @param webResourceName Name of the HTML web resource. Can be used to pass URL - * parameters. See Remarks. - * @param webResourceData (Optional) Data to pass into the Web Resource's data parameter. - * It is advised to use encodeURIcomponent() to encode the value. + * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openWebResource} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @param webResourceName Name of the HTML web resource. Can be used to pass URL parameters. See Remarks. + * @param webResourceData (Optional) Data to pass into the Web Resource's data parameter. It is advised to use encodeURIcomponent() to encode the value. * @param width (Optional) The width of the new window. * @param height (Optional) The height of the new window. - * - * @return A Window reference, containing the opened Web Resource. - * + * @returns A Window reference, containing the opened Web Resource. * @remarks This function will not work with Microsoft Dynamics CRM for tablets. * Valid WebResource URL Parameters: typename * type @@ -869,39 +1071,41 @@ declare namespace Xrm { interface Mobile { /** * Provides methods to create and manage records in the mobile clients while working in the offline mode. - * - * @see {@link https://msdn.microsoft.com/en-us/library/mt787123.aspx} for details. + * @see {@link https://msdn.microsoft.com/en-us/library/mt787123.aspx External Link: Xrm.Mobile.offline (client-side reference)} + * @deprecated Use {@link Xrm.WebApi.offline} instead. Xrm.WebApi.offline is implemented differently than Xrm.Mobile.offline + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ offline: MobileOffline; } /** * Interface for the Mobile.offline methods to create and manage records in the mobile clients while working in the offline mode. - * - * @see {@link https://msdn.microsoft.com/en-us/library/mt787123.aspx} for details. + * @deprecated Use {@link Xrm.WebApi.offline} instead. Xrm.WebApi.offline is implemented differently than Xrm.Mobile.offline + * @see {@link https://msdn.microsoft.com/en-us/library/mt787123.aspx External Link: Xrm.Mobile.offline (client-side reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ interface MobileOffline { /** * Returns whether an entity is offline enabled. - * * @param entityType The logical name of the entity. - * @return True if the entity is offline enabled; otherwise False. + * @returns True if the entity is offline enabled; otherwise False. + * @deprecated Use {@link Xrm.WebApi.isAvailableOffline} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ isOfflineEnabled(entityType: string): boolean; /** * Creates an entity record in mobile clients while working in the offline mode. - * * @param entityType The logical name of the entity. * @param data A dictionary object containing key : value pairs for the record to create. - * - * @return Returns an asynchronous promise. - * + * @returns Returns an asynchronous promise. * @remarks You cannot create intersect and activity party entities. * Only the following attribute types are supported in offline mode: * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName * Integer, Lookup, Memo, Money, Owner, Picklist, String, State * Status, UniqueIdentifier + * @deprecated Use {@link Xrm.WebApi.createRecord} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ createRecord(entityType: string, data: { [attributeName: string]: any }): Async.PromiseLike; @@ -911,15 +1115,16 @@ declare namespace Xrm { * @param entityType The logical name of the entity. * @param id GUID of the record to retrieve. * @param options (Optional) OData system query options to retrieve your data. Supports $select and $expand - * Example: ?$select=name&$expand=primarycontactid($select=contactid,fullname) - * - * @return Returns an asynchronous promise. - * + * @example Example options + * options: ?$select=name&$expand=primarycontactid($select=contactid,fullname) + * @returns Returns an asynchronous promise. * @remarks Only $select option can be specified within $expand. * Only the following attribute types are supported in offline mode: * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName * Integer, Lookup, Memo, Money, Owner, Picklist, String, State * Status, UniqueIdentifier + * @deprecated Use {@link Xrm.WebApi.retrieveRecord} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ retrieveRecord(entityType: string, id: string, options: string): Async.PromiseLike; @@ -929,13 +1134,11 @@ declare namespace Xrm { * @param entityType The logical name of the entity. * @param options (Optional) The logical name of the enti * @param maxPageSize (Optional) A positive number to indicates the number of entity records to be returned per page. - * If you do not specify this parameter, the default value is passed as 5000. - * If the number of records being retrieved is more than maxPageSize, an @odata.nextLink property - * will be returned, and you can use the value of the @odata.nextLink property with a new GET - * request to return next set of records. - * - * @return Returns an asynchronous promise. - * + * If you do not specify this parameter, the default value is passed as 5000. + * If the number of records being retrieved is more than maxPageSize, an @odata.nextLink property + * will be returned, and you can use the value of the @odata.nextLink property with a new GET + * request to return next set of records. + * @returns Returns an asynchronous promise. * @remarks A maximum of 5000 related records can be retrieved when using $expand. * Only $select option can be specified within $expand. * $skip query option is not supported. @@ -943,50 +1146,50 @@ declare namespace Xrm { * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName * Integer, Lookup, Memo, Money, Owner, Picklist, String, State * Status, UniqueIdentifier + * @deprecated Use {@link Xrm.WebApi.retrieveMultipleRecords} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ retrieveMultipleRecords(entityType: string, options: string, maxPageSize: number): Async.PromiseLike>; /** * Updates an entity record in mobile clients while working in the offline mode. - * * @param entityType The logical name of the entity. * @param id GUID of the record to update. * @param data A dictionary object containing key : value pairs for the record to update. - * - * @return Returns an asynchronous promise. - * + * @returns Returns an asynchronous promise. * @remarks You cannot update intersect and activity party entities. * Only the following attribute types are supported in offline mode: * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName * Integer, Lookup, Memo, Money, Owner, Picklist, String, State * Status, UniqueIdentifier + * @deprecated Use {@link Xrm.WebApi.updateRecord} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ updateRecord(entityType: string, id: string, data: { [attributeName: string]: any }): Async.PromiseLike; /** * Deletes an entity record in mobile clients while working in the offline mode. - * * @param entityType The logical name of the entity. * @param id GUID of the record to delete. - * - * @return Returns an asynchronous promise. - * + * @returns Returns an asynchronous promise. * @remarks You cannot delete intersect and activity party entities. + * @deprecated Use {@link Xrm.WebApi.deleteRecord} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ deleteRecord(entityType: string, id: string): Async.PromiseLike; } /** * Interface for the Xrm.Panel API + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-panel External Link: Xrm.Panel} */ interface Panel { /** * Displays the web page represented by a URL in the static area in the side pane, which appears on all pages in the web client. - * * @param url URL of the page to be loaded in the side pane static area. * @param title Title of the side pane static area. - * * @remarks This method is only supported for the web client. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-panel/loadpanel External Link: loadPanel (Client-side reference)} */ LoadPanel(url: string, title: string): void; } @@ -1017,7 +1220,7 @@ declare namespace Xrm { /** * A lookup value which identifies the record which has been created. */ - savedEntityReference: Page.LookupValue; + savedEntityReference: LookupValue; } /** @@ -1055,7 +1258,8 @@ declare namespace Xrm { * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of which ever callback is executed. */ - then(onFulfilled?: (value: T) => U | PromiseLike, onRejected?: (error: any) => U | PromiseLike): PromiseLike; + then(onFulfilled?: (value: T) => U | PromiseLike, onRejected?: (error: any) => U | PromiseLike): + PromiseLike; then(onFulfilled?: (value: T) => U | PromiseLike, onRejected?: (error: any) => void): PromiseLike; /** @@ -1090,7 +1294,7 @@ declare namespace Xrm { * @param item The item. * @param index Zero-based index of the item array. * - * @return true if the item matches, false if it does not. + * @returns true if the item matches, false if it does not. */ type MatchingDelegate = (item: T, index?: number) => boolean; @@ -1112,385 +1316,1184 @@ declare namespace Xrm { [index: number]: T; } + /** + * Collections are structures to provide access to data that represent an array, but without the ability to modify the data in the array. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections Collections (Client API reference)} + */ type ItemCollection = Dictionary & { /** * Applies an operation to all items in this collection. - * * @param delegate An iterative delegate function */ forEach(delegate: IterativeDelegate): void; /** * Gets the item using a delegate matching function - * * @param delegate A matching delegate function - * - * @return A T[] whose members have been validated by delegate. + * @returns A T[] whose members have been validated by delegate. */ get(delegate: MatchingDelegate): T[]; /** * Gets the item given by the index. - * * @param itemNumber The item number to get. - * - * @return The T in the itemNumber-th place. + * @returns The T in the itemNumber-th place. */ get(itemNumber: number): T; /** * Gets the item given by the index. - * * @param itemNumber The item number to get. - * - * @return The T in the itemNumber-th place. - * - * @see {@link Xrm.Page.Control.getName()} for Control-naming schemes. + * @returns The T in the itemNumber-th place. + * @see {@link Controls.Control.getName Controls.Control.getName()} for Control-naming schemes. */ get(itemNumber: number): TSubType; /** * Gets the item given by the key. - * * @param itemName The item name to get. - * - * @return The T matching the key itemName. - * - * @see {@link Xrm.Page.Control.getName()} for Control-naming schemes. + * @returns The T matching the key itemName. + * @see {@link Controls.Control.getName Controls.Control.getName()} for Control-naming schemes. */ get(itemName: string): T; /** * Gets the item given by the key. - * * @param itemName The item name to get. - * - * @return The T matching the key itemName. - * - * @see {@link Xrm.Page.Control.getName()} for Control-naming schemes. + * @returns The T matching the key itemName. + * @see {@link Controls.Control.getName Controls.Control.getName()} for Control-naming schemes. */ get(attributeName: string): TSubType; /** * Gets the entire array of T. - * - * @return A T[]. + * @returns A T[]. */ get(): T[]; /** * Gets the length of the collection. - * - * @return The length. + * @returns The length. */ getLength(): number; }; } /** - * The Xrm.Page API - * - * @see {@link http://msdn.microsoft.com/en-us/library/gg328255.aspx|Documentation} for details. + * Interface for Page context + * @deprecated Use {@link Xrm.Events.EventContext.getFormContext formContext} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs}a + */ + interface Page extends FormContext { + /** + * Provides methods to retrieve information specific to an organization, a user, or parameters passed to a page. + * @deprecated Deprecated in v9. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + */ + context: GlobalContext; + } + + /** + * Xrm.Page namespace has been deprecated + * @deprecated Use {@link Xrm.Events.EventContext.getFormContext formContext} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ namespace Page { /** - * Requirement Level for Xrm.Page.Attribute.getRequiredLevel() and Xrm.Page.Attribute.setRequiredLevel(). + * @deprecated Use {@link Xrm.Controls.AddControlNotificationOptions} instead. */ - type RequirementLevel = "none" | "recommended" | "required"; + interface AddControlNotificationOptions extends Controls.AddControlNotificationOptions { } + + /** + * Interface to define the actions on a control notification + * @deprecated Use {@link Xrm.Controls.ControlNotificationAction} instead. + */ + interface ControlNotificationAction extends Controls.ControlNotificationAction { } + + /** + * Interface for an entity's form selector item. + * @deprecated Use {@link Xrm.Controls.FormItem} instead. + */ + interface FormItem extends Controls.FormItem { } + + /** + * Interface for the form selector API. + * @deprecated Use {@link Xrm.Controls.FormSelector} instead. + */ + interface FormSelector extends Controls.FormSelector { } + + /** + * Interface for Xrm.Page.ui.navigation. + * @deprecated Use {@link Xrm.Controls.Navigation} instead. + */ + interface Navigation extends Controls.Navigation { } + + /** + * Interface for a navigation item. + * @see UiElement + * @see UiFocusable + * @deprecated Use {@link Xrm.Controls.NavigationItem} instead. + */ + interface NavigationItem extends Controls.NavigationItem { } + + /** + * Constants to use with the addNotification method of form controls + * @deprecated Use {@link Xrm.Controls.NotificationLevel} instead. + */ + type NotificationLevel = Controls.NotificationLevel; + /** + * Requirement Level for Xrm.Page.Attribute.getRequiredLevel() and Xrm.Page.Attribute.setRequiredLevel(). + * @deprecated Use {@link Xrm.Attributes.RequirementLevel} instead. + */ + type RequirementLevel = Attributes.RequirementLevel; /** * Save Modes for Xrm.Page.Entity.save(). + * @deprecated Use {@link Xrm.EntitySaveMode} instead. */ - type SaveMode = "saveandclose" | "saveandnew"; + type SaveMode = EntitySaveMode; /** * Status for Xrm.Page.Stage.getStatus(). + * @deprecated Use {@link Xrm.ProcessFlow.StageStatus} instead. */ - type StageStatus = "active" | "inactive"; + type StageStatus = ProcessFlow.StageStatus; /** * Status for Xrm.Page.Process.getStatus(). + * @deprecated Use {@link Xrm.ProcessFlow.ProcessStatus} instead */ - type ProcessStatus = "active" | "aborted" | "finished"; + type ProcessStatus = ProcessFlow.ProcessStatus; /** * Submit Mode for Xrm.Page.Attribute.getSubmitMode() and Xrm.Page.Attribute.setSubmitMode(). + * @deprecated Use {@link Xrm.SubmitMode} instead. */ - type SubmitMode = "always" | "dirty" | "never"; + type SubmitMode = Xrm.SubmitMode; /** * Control type for Xrm.Page.ui.QuickForm.getControlType(). + * @deprecated Use {@link Xrm.Controls.ControlQuickFormType} instead. + * */ - type ControlQuickFormType = "quickform"; + type ControlQuickFormType = Controls.ControlQuickFormType; /** * Control types for Xrm.Page.Control.getControlType(). + * @deprecated Use {@link Xrm.Controls.ControlType} instead. */ - type ControlType = "standard" | "iframe" | "lookup" | "optionset" | "subgrid" | "webresource" | "notes" | "timercontrol" | "kbsearch" | "timelinewall" | ControlQuickFormType; + type ControlType = Controls.ControlType; /** * Date attribute formats for Xrm.Page.Attribute.getFormat(), used by DateAttribute. + * @deprecated Use {@link Xrm.Attributes.DateAttributeFormat} instead. */ - type DateAttributeFormat = "date" | "datetime"; + type DateAttributeFormat = Attributes.DateAttributeFormat; /** * Integer attribute formats for Xrm.Page.Attribute.getFormat(), used by NumberAttribute. + * @deprecated Use {@link Xrm.Attributes.IntegerAttributeFormat} instead. */ - type IntegerAttributeFormat = "duration" | "none"; + type IntegerAttributeFormat = Attributes.IntegerAttributeFormat; /** * OptionSet attribute formats for Xrm.Page.Attribute.getFormat(), used by OptionSetAttribute. + * @deprecated Use {@link Xrm.Attributes.OptiopnSetAttributeFormat} instead. */ - type OptionSetAttributeFormat = "language" | "timezone"; + type OptionSetAttributeFormat = Attributes.OptionSetAttributeFormat; /** * String attribute formats for Xrm.Page.Attribute.getFormat(), used by StringAttribute. + * @deprecated Use {@link Xrm.Attributes.StringAttributeFormat} instead. */ - type StringAttributeFormat = "email" | "phone" | "text" | "textarea" | "tickersymbol" | "url"; + type StringAttributeFormat = Attributes.StringAttributeFormat; /** * Attribute types for Xrm.ui.ProcessMonitor Xrm.Page.Attribute.setDisplayState(). + * @deprecated Use {@link Xrm.Attributes.AttributeType} instead. */ - type AttributeType = "boolean" | "datetime" | "decimal" | "double" | "integer" | "lookup" | "memo" | "money" | "optionset" | "string"; + type AttributeType = Attributes.AttributeType; /** * Direction types for a process stage change event + * @deprecated Use {@link Xrm.ProcessFlow.StageChangeDirection} instead. */ - type StageChangeDirection = "Next" | "Previous"; + type StageChangeDirection = ProcessFlow.StageChangeDirection; /** * Attribute formats for Xrm.Page.Attribute.getFormat(). + * @deprecated Use {@link Xrm.Attributes.AttributeFormat} instead. */ - type AttributeFormat = DateAttributeFormat | IntegerAttributeFormat | OptionSetAttributeFormat | StringAttributeFormat; + type AttributeFormat = Attributes.AttributeFormat; /** * Interface for a CRM Business Process Flow instance. + * @deprecated Use {@link Xrm.ProcessFlow.Process} instead. */ - interface Process { - /** - * Returns the unique identifier of the process. - * - * @return The identifier for this process, in GUID format. - * - * @remarks Example: "{825CB223-A651-DF11-AA8B-00155DBA3804}". - */ - getId(): string; - - /** - * Returns the name of the process. - * - * @return The name. - */ - getName(): string; - - /** - * Returns an collection of stages in the process. - * - * @return The stages. - */ - getStages(): Collection.ItemCollection; - - /** - * Returns a boolean value to indicate if the process is rendered. - * - * @return true if the process is rendered, false if not. - */ - isRendered(): boolean; - } + interface Process extends ProcessFlow.Process { } /** * Interface for CRM Business Process Flow stages. + * @deprecated Use {@link Xrm.ProcessFlow.Stage} instead. */ - interface Stage { - /** - * Returns an object with a getValue method which will return the integer value of the business process flow - * category. - * - * @return The stage category. - */ - getCategory(): { getValue(): XrmEnum.StageCategory }; + interface Stage extends ProcessFlow.Stage { } - /** - * Returns the logical name of the entity associated with the stage. - * - * @return The entity name. - */ - getEntityName(): string; - - /** - * Returns the unique identifier of the stage. - * - * @return The identifier of the Stage, in GUID format. - * - * @remarks Example: "{825CB223-A651-DF11-AA8B-00155DBA3804}". - */ - getId(): string; - - /** - * Returns the name of the stage. - * - * @return The name. - */ - getName(): string; - - /** - * Returns the status of the stage. - * - * @return The status. - * - * @remarks This method will return either "active" or "inactive". - */ - getStatus(): StageStatus; - - /** - * Returns a collection of steps in the stage. - * - * @return An array of Step. - */ - getSteps(): Step[]; - } - - interface Step { - /** - * Returns the logical name of the attribute associated to the step. - * - * @return The attribute. - * - * @remarks Some steps don’t contain an attribute value. - */ - getAttribute(): string; - - /** - * Returns the name of the step. - * - * @return The name. - */ - getName(): string; - - /** - * Returns whether the step is required in the business process flow. - * - * @return true if required, false if not. - * - * @remarks Returns true if the step is marked as required in the Business Process Flow editor; otherwise, false. - * There is no connection between this value and the values you can change in the Xrm.Page.data.entity - * attribute RequiredLevel methods. - */ - isRequired(): boolean; - } + /** + * Interface for CRM Business Process Flow steps. + * @deprecated Use {@link Xrm.ProcessFlow.Step} instead. + */ + interface Step extends ProcessFlow.Step { } /** * Interface for the event context. + * @deprecated Use {@link Xrm.Events.EventContext} instead. */ - interface EventContext { - /** - * Gets the Xrm context. - * - * @return The Xrm context. - */ - getContext(): Context; - - /** - * Gets the handler's depth, which is the order in which the handler is executed. - * - * @return The depth, a 0-based index. - */ - getDepth(): number; - - /** - * Returns the event arguments for the event context - * Get event args returns null for read operations - * - * @return The event arguments or null - */ - getEventArgs(): SaveEventArguments | StageChangeEventArguments | StageSelectedEventArguments; - - /** - * Gets a reference to the object for which event occurred. - * - * @return The event source. - */ - getEventSource(): Attribute | Control | Entity; - - /** - * Gets a reference to the currnet form context - * - * @return The form context - */ - getFormContext(): Page; - - /** - * Gets the shared variable with the specified key. - * - * @param T Generic type parameter. - * @param key The key. - * - * @return The shared variable. - * - * @remarks Used to pass values between handlers of an event. - */ - getSharedVariable(key: string): T; - - /** - * Sets a shared variable. - * - * @param T Generic type parameter. - * @param key The key. - * @param value The value. - * - * @remarks Used to pass values between handlers of an event. - */ - setSharedVariable(key: string, value: T): void; - } + interface EventContext extends Events.EventContext { } /** * Interface for a save event context + * @deprecated Use {@link Xrm.Events.SaveEventContext} instead. */ - interface SaveEventContext extends EventContext { - /** - * Gets save-event arguments. - * - * @return The event arguments. - * - * @remarks Returns null for all but the "save" event. - */ - getEventArgs(): SaveEventArguments; - } + interface SaveEventContext extends Events.SaveEventContext { } /** * Interface for a process stage change event context + * @deprecated Use {@link Xrm.Events.StageChangeEventContext} instead. */ - interface StageChangeEventContext extends EventContext { - /** - * Gets process stage change event arguments. - * - * @return The event arguments. - * - */ - getEventArgs(): StageChangeEventArguments; - } + interface StageChangeEventContext extends Events.StageChangeEventContext { } - interface StageSelectedEventContext extends EventContext { - /** - * Gets process stage selected event arguments. - * - * @return The event arguments. - * - */ - getEventArgs(): StageSelectedEventArguments; - } + /** + * Interface for a process stage select event context + * @deprecated Use {@link Xrm.Events.StageSelectedEventContext} instead. + */interface StageSelectedEventContext extends Events.StageSelectedEventContext { } /** * Type for a context-sensitive handler. * @param context The context. + * @deprecated Use {@link Xrm.Events.ContextSensitiveHandler} instead. */ - type ContextSensitiveHandler = (context: EventContext) => void; + type ContextSensitiveHandler = Events.ContextSensitiveHandler; /** * Type for a process status change handler. * @param status The process status. + * @deprecated Use {@link Xrm.Events.ProcessStatusChangeHandler} instead. */ - type ProcessStatusChangeHandler = (status: ProcessStatus) => void; + type ProcessStatusChangeHandler = Events.ProcessStatusChangeHandler; + + /** + * Interface for UI elements with labels. + * @deprecated Use {@link Xrm.Controls.UiLabelElement} instead. + */ + interface UiLabelElement extends Controls.UiLabelElement { } + + /** + * Interface for UI elements which can have the visibility value read. + * @deprecated Use {@link Xrm.Controls.UiCanGetVisibleElement} instead. + */ + interface UiCanGetVisibleElement extends Controls.UiCanGetVisibleElement { } + + /** + * Interface for UI elements which can have the visibility value updated. + * @deprecated Use {@link Xrm.Controls.UiCanSetVisibleElement} instead. + */ + interface UiCanSetVisibleElement extends Controls.UiCanSetVisibleElement { } + + /** + * Base interface for standard UI elements. + * @deprecated Use {@link Xrm.Controls.UiStandardElement} instead. + */ + interface UiStandardElement extends Controls.UiStandardElement { } + + /** + * Interface for focusable UI elements. + * @deprecated Use {@link Xrm.Controls.UiFocusable} instead. + */ + interface UiFocusable extends Controls.UiFocusable { } + + /** + * Interface for controls which methods provide immediate feedback or take actions as user types in a control. + * Contains methods which can be used to perform data validations in a control even before the user commits (saves) the value in a form. + * @deprecated Use {@link Xrm.Controls.UiKeyPressable} instead. + */ + interface UiKeyPressable extends Controls.UiKeyPressable { } + + /** + * Interface for Result value of AutoCompleteResultSet + * @deprecated Use {@link Xrm.Controls.AutoCompleteResult} instead. + */ + interface AutoCompleteResult extends Controls.AutoCompleteResult { } + + /** + * Interface for command of AutoCompleteResultSet. This is displayed at the bottom of the auto complete view + * @deprecated Use {@link Xrm.Controls.AutoCompleteCommand} instead. + */ + interface AutoCompleteCommand extends Controls.AutoCompleteCommand { } + + /** + * Interface for showAutoComplete argument + * @deprecated Use {@link Xrm.Controls.AutoCompleteResultSet} instead. + */ + interface AutoCompleteResultSet extends Controls.AutoCompleteResultSet { } + + /** + * Interface for a Lookup value. + * @deprecated Use {@link Xrm.LookupValue} instead. + */ + interface LookupValue extends Xrm.LookupValue { } + + /** + * Interface for an OptionSet value. + * @deprecated Use {@link Xrm.OptionSetValue} instead. + */ + interface OptionSetValue extends Xrm.OptionSetValue { } + + /** + * Interface for a privilege. + * @deprecated Use {@link Xrm.Privilege} instead. + */ + interface Privilege extends Xrm.Privilege { } + + /** + * Interface for an Entity attribute. + * @deprecated Use {@link Xrm.Attributes.Attribute} instead. + */ + interface Attribute extends Attributes.Attribute { } + + /** + * Interface for a Number attribute. + * @see Attribute + * @deprecated Use {@link Xrm.Attributes.NumberAttribute} instead. + */ + interface NumberAttribute extends Attributes.NumberAttribute { } + + /** + * Interface for a String attribute. + * @see Attribute + * @deprecated Use {@link Xrm.Attributes.StringAttribute} instead. + */ + interface StringAttribute extends Attributes.StringAttribute { } + + /** + * Common interface for enumeration attributes (OptionSet and Boolean). + * @see Attribute + * @deprecated Use {@link Xrm.Attributes.EnumAttribute} instead. + */ + interface EnumAttribute extends Attributes.EnumAttribute { } + + /** + * Interface for a Boolean attribute. + * @see EnumAttribute + * @deprecated Use {@link Xrm.Attributes.BooleanAttribute} instead. + */ + interface BooleanAttribute extends Attributes.BooleanAttribute { } + + /** + * Interface for a Date attribute. + * @see Attribute + * @deprecated Use {@link Xrm.Attributes.DateAttribute} instead. + */ + interface DateAttribute extends Attributes.DateAttribute { } + + /** + * Interface an OptionSet attribute. + * @see EnumAttribute + * @deprecated Use {@link Xrm.Attributes.OptionSetAttribute} instead. + */ + interface OptionSetAttribute extends Attributes.OptionSetAttribute { } + + /** + * Interface a Lookup attribute. + * @see Attribute + * @deprecated Use {@link Xrm.Attributes.LookupAttribute} instead. + */ + interface LookupAttribute extends Attributes.LookupAttribute { } + + /** + * Interface for the form's record context, Xrm.Page.data.entity + * @deprecated Use {@link Xrm.Entity} instead. + */ + interface Entity extends Xrm.Entity { } + + /** + * Interface for save event arguments. + * @deprecated Use {@link Xrm.Events.SaveEventContext} instead. + */ + interface SaveEventArguments extends Events.SaveEventContext { } + + /** + * Interface for process stage change event arguments. + * @deprecated Use {@link Xrm.Events.StageChangeEventArguments} instead. + */ + interface StageChangeEventArguments extends Events.StageChangeEventArguments { } + + /** + * Interface for process stage selected event arguments. + * @deprecated Use {@link Xrm.Events.StageSelectedEventArguments} instead. + */ + interface StageSelectedEventArguments extends Events.StageSelectedEventArguments { } + + /** + * Interface for Xrm.Page.ui controls. + * @see UiElement + * @deprecated Use {@link Xrm.Controls.Control} instead. + */ + interface Control extends Controls.Control { } + + /** + * Interface for a standard control. + * @see Control + * @deprecated Use {@link Xrm.Controls.StandardControl} instead. + */ + interface StandardControl extends Controls.StandardControl { } + + /** + * Interface for Auto Lookup Control. + * This is not an Entity Lookup, but a control that supports AutoComplete / KeyPress Events (Text or Number) + * @remarks This interface is not supported for CRM mobile clients (phones or tablets) and the interactive service hub. It is only available for Updated entities. + * @see StandardControl + * @deprecated Use {@link Xrm.Controls.AutoLookupControl} instead. + */ + interface AutoLookupControl extends Controls.AutoLookupControl { } + + /** + * Interface for a String control. + * @see StandardControl + * @deprecated Use {@link Xrm.Controls.StringControl} instead. + */ + interface StringControl extends Controls.StringControl { } + + /** + * Interface for a Number control. + * @see StandardControl + * @deprecated Use {@link Xrm.Controls.NumberControl} instead. + */ + interface NumberControl extends AutoLookupControl { } + + /** + * Interface for a Date control. + * @see StandardControl + * @deprecated Use {@link Xrm.Controls.DateControl} instead. + */ + interface DateControl extends StandardControl { } + + /** + * Interface for a Lookup control. + * @see StandardControl + * @deprecated Use {@link Xrm.Controls.LookupControl} instead. + */ + interface LookupControl extends Controls.LookupControl { } + + /** + * Interface for an OptionSet control. + * @see StandardControl + * @deprecated Use {@link Xrm.Controls.OptionSetControl} instead. + */ + interface OptionSetControl extends Controls.OptionSetControl { } + + /** + * Interface for a CRM grid control. + * + * @see Control + * @deprecated Use {@link Xrm.Controls.GridControl} instead. + */ + interface GridControl extends Controls.GridControl { } + + /** + * Interface for a framed control, which is either a Web Resource or an Iframe. + * @see Control + * @remarks An Iframe control provides additional methods, so use {@link IframeControl} where + * appropriate. Silverlight controls should use {@link SilverlightControl}. + * @deprecated Use {@link Xrm.Controls.FramedControl} instead. + */ + interface FramedControl extends Controls.FramedControl { } + + /** + * Interface for an Iframe control. + * @see FramedControl + * @deprecated Use {@link Xrm.Controls.IframeControl} instead. + */ + interface IframeControl extends Controls.IframeControl { } + + /** + * Interface for a Silverlight control. + * @see Control + * @deprecated Use {@link Xrm.Controls.SilverlightControl} instead. + */ + interface SilverlightControl extends Controls.SilverlightControl { } + + /** + * Interface for a Timeline control. + * @see Control + * @deprecated Use {@link Xrm.Controls.TimelineWall} instead. + */ + interface TimelineWall extends Controls.TimelineWall { } + + /** + * Interface for a form tab. + * @see UiElement + * @see UiFocusable + * @deprecated Use {@link Xrm.Controls.Tab} instead. + */ + interface Tab extends Controls.Tab { } + + /** + * Interface for a form section. + * @see UiElement + * @deprecated Use {@link Xrm.Controls.Section} instead. + */ + interface Section extends Controls.Section { } + + /** + * Module for the Xrm.Page.data API. + * @deprecated Use {@link Xrm.Form.data formContext.data} has been deprecated. + */ + namespace data { + /** + * Interface for the Xrm.Page.data.process API. + * @deprecated Use {@link Xrm.ProcessFlow.ProcessManager} instead. + */ + interface ProcessManager extends ProcessFlow.ProcessManager { + } + + /** + * Called when method to get active processes is complete + * @param status The result of the get active processes operation. + * @remarks Returns object with the following key-value pairs: + * CreatedOn + * ProcessDefinitionID + * ProcessDefinitionName + * ProcessInstanceID + * ProcessInstanceName + * StatusCodeName + * @deprecated Use {@link Xrm.ProcessFlow.GetProcessInstancesDelegate} instead. + */ + type GetProcessInstancesDelegate = ProcessFlow.GetProcessInstancesDelegate; + + /** + * Called when method to set active process is complete + * @param status The result of the set active process operation. + * @remarks Values returned are: success (The operation succeeded.) + * invalid (The processInstanceId isn’t valid or the process isn’t enabled.) + * @deprecated Use {@link Xrm.ProcessFlow.SetProcessInstanceDelegate} instead. + */ + type SetProcessInstanceDelegate = ProcessFlow.SetProcessInstanceDelegate; + + /** + * Called when process change methods have completed. + * @param status The result of the process change operation. + * @remarks Values returned are: success (The operation succeeded.) + * crossEntity (The previous stage is for a different entity.) + * beginning (The active stage is the first stage of the active path.) + * invalid (The operation failed because the selected stage isn’t the same + * as the active stage.) + * unreachable (The stage exists on a different path.) + * @deprecated Use {@link Xrm.ProcessFlow.ProcessCallbackDelegate} instead. + */ + type ProcessCallbackDelegate = ProcessFlow.ProcessCallbackDelegate; + + /** + * Called when process set status method has completed. + * + * @param status The new status of the process instance + * + * @remarks Values returned are: active + * aborted + * finished + * @deprecated Use {@link Xrm.ProcessFlow.ProcessSetStatusDelegate} instead. + */ + type ProcessSetStatusDelegate = ProcessFlow.ProcessSetStatusDelegate; + + /** + * Represents a key-value pair, where the key is the Process Flow's ID, and the value is the name thereof. + * @deprecated Use {@link Xrm.ProcessFlow.ProcessDictionary} instead. + */ + interface ProcessDictionary extends ProcessFlow.ProcessDictionary { } + } + + /** + * Contains properties and methods to retrieve information about the user interface as well as collections for several subcomponents of the form. + * @deprecated Use {@link Xrm.Form.ui formContext.ui} instead. + */ + namespace ui { + /** + * Form Notification Levels for Xrm.Ui.setFormNotification(). + * @deprecated Use {@link Xrm.FormNotificationLevel} instead. + */ + type FormNotificationLevel = Xrm.FormNotificationLevel; + + /** + * Display States for Xrm.ui.ProcessMonitor.setDisplayState(). + * @deprecated Use {@link Xrm.DisplayState} instead. + */ + type DisplayState = Xrm.DisplayState; + + /** + * Interface for Xrm.Page.ui.process API + * @deprecated Use {@link Xrm.Controls.ProcessControl} instead. + */ + interface ProcessManager extends Controls.ProcessControl { } + + /** + * Interface for a grid. Use Grid methods to access information about data in the grid. Grid is returned by the + * GridControl.getGrid method. + * @deprecated Use {@link Xrm.Controls.Grid} instead. + */ + interface Grid extends Controls.Grid { } + + /** + * Interface for a grid row. Use the GridRow.getData method to access the GridRowData. A collection of GridRow is + * returned by Grid.getRows and Grid.getSelectedRows methods. + * In V9 - this is essentailly a form context. + * @deprecated Use {@link Xrm.Controls.Grid.GridRow} instead. + */ + interface GridRow extends Controls.Grid.GridRow { } + + /** + * Interface for grid row data. Use the GridRowData.getEntity method to access the GridEntity. GridRowData is + * returned by the GridRow.getData method. + * @deprecated Use {@link Xrm.Controls.Grid.GridRowData} instead. + */ + interface GridRowData extends Controls.Grid.GridRowData { } + + /** + * Interface for a grid entity. Use the GridEntity methods to access data about the specific records in the rows. + * GridEntity is returned by the GridRowData.getEntity method. + * @deprecated Use {@link Xrm.Controls.Grid.GridRowData} instead.v + */ + interface GridEntity extends Controls.Grid.GridEntity { } + + /** + * Interface for the view selector. Use the ViewSelector methods to get or set information about the view selector + * of the grid control. + * @deprecated Use {@link Xrm.Controls.ViewSelector} instead. + */ + interface ViewSelector extends Controls.ViewSelector { } + + /** + * Interface for a view selector item. This object contains data that identifies a view. Use this as a parameter to + * the ViewSelector.setCurrentView method. + * @deprecated Use {@link Xrm.Controls.ViewSelectorItem} instead. + */ + interface ViewSelectorItem extends Controls.ViewSelectorItem { } + + /** + * Interface for a quick view control instance on a form. + * @see {@link https://msdn.microsoft.com/en-us/library/mt736908.aspx External Link: Xrm.Page.ui quickForms (client-side reference)} + * @deprecated Use {@link Xrm.Controls.ViewSelectorItem} instead. + */ + interface QuickForm extends Controls.QuickFormControl { } + } + } + + /** + * Interface for a Lookup value. + */ + interface LookupValue { + /** + * The identifier. + */ + id: string; + + /** + * The name + */ + name?: string; + + /** + * Type of the entity. + */ + entityType: string; + } + + /** + * Interface for an OptionSet value. + */ + interface OptionSetValue { + /** + * The label text. + */ + text: string; + + /** + * The value, as a number + */ + value: number; + } + + /** + * A collection of types and methods for working with formContext attributes. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/attributes External Link: Attributes (Client API reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + namespace Attributes { + /** + * Requirement Level for {@link Attributes.Attribute.getRequiredLevel Attributes.Attribute.getRequiredLevel()} and + * {@link Attributes.Attribute.setRequiredLevel Attributes.Attribute.setRequiredLevel()}. + * @see XrmEnum.AttributeRequirementLevel + */ + type RequirementLevel = "none" | "recommended" | "required"; + + /** + * Date attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.DateAttribute DateAttribute}. + * @see XrmEnum.DateAttributeFormat + */ + type DateAttributeFormat = "date" | "datetime"; + + /** + * Integer attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.NumberAttribute NumberAttribute}. + * @see XrmEnum.IntegerAttributeFormat + */ + type IntegerAttributeFormat = "duration" | "none"; + + /** + * OptionSet attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.OptionSetAttribute OptionSetAttribute}. + * @see XrmEnum.OptionSetAttributeFormat + */ + type OptionSetAttributeFormat = "language" | "timezone"; + + /** + * String attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.StringAttribute StringAttribute}. + * @see XrmEnum.StringAttributeFormat + */ + type StringAttributeFormat = "email" | "phone" | "text" | "textarea" | "tickersymbol" | "url"; + + /** + * Attribute types for {@link Attributes.Attribute.setDisplayState()}. + * @see XrmEnum.AttributeType + */ + type AttributeType = "boolean" | "datetime" | "decimal" | "double" | "integer" | + "lookup" | "memo" | "money" | "multioptionset" | "optionset" | "string"; + + /** + * Attribute formats for {@link Attributes.Attribute.getFormat Attributes.Attribute.getFormat()}. + * @see XrmEnum.DateAttributeFormat + * @see XrmEnum.IntegerAttributeFormat + * @see XrmEnum.OptionSetAttributeFormat + * @see XrmEnum.StringAttributeFormat + */ + type AttributeFormat = DateAttributeFormat | IntegerAttributeFormat | OptionSetAttributeFormat | StringAttributeFormat; + + /** + * Interface for an Entity attribute. + */ + interface Attribute { + /** + * Adds a handler to be called when the attribute's value is changed. + * @param handler The function reference. + */ + addOnChange(handler: Events.ContextSensitiveHandler): void; + + /** + * Fire all "on change" event handlers. + */ + fireOnChange(): void; + + /** + * Gets attribute type. + * @returns The attribute's type name. + * Values returned are: boolean + * datetime + * decimal + * double + * integer + * lookup + * memo + * money + * optionset + * string + */ + getAttributeType(): string; + + /** + * Gets the attribute format. + * + * @returns The format of the attribute. + * + * @see getAttributeType + * Values returned are: date (datetime) + * datetime (datetime) + * duration (integer) + * email (string) + * language (optionset) + * none (integer) + * phone (string) + * text (string) + * textarea (string) + * tickersymbol (string) + * timezone (optionset) + * url (string) + */ + getFormat(): AttributeFormat; + + /** + * Gets a boolean value indicating whether this Attribute has unsaved changes. + * @returns true if there are unsaved changes, otherwise false. + */ + getIsDirty(): boolean; + + /** + * Gets the logical name of the attribute. + * @returns The logical name. + */ + getName(): string; + + /** + * Gets a reference to the record context of this attribute. + * @returns The parent record context. + */ + getParent(): Entity; + + /** + * Gets the current level of requirement for the attribute. + * @returns The required level, as either "none", "required", or "recommended" + */ + getRequiredLevel(): RequirementLevel; + + /** + * Gets current submit mode for the attribute. + * @returns The submit mode, as either "always", "never", or "dirty" + * @remarks The default value is "dirty" + */ + getSubmitMode(): SubmitMode; + + /** + * Gets the current user's privileges for the attribute. + * @returns The user privileges. + */ + getUserPrivilege(): Privilege; + + /** + * Removes the handler from the "on change" event. + * @param handler The handler. + */ + removeOnChange(handler: Events.ContextSensitiveHandler): void; + + /** + * Sets the required level. + * @param requirementLevel The requirement level, as either "none", "required", or "recommended" + * @see XrmEnum.AttributeRequirementLevel + */ + setRequiredLevel(requirementLevel: RequirementLevel): void; + + /** + * Sets the submit mode. + * @param submitMode The submit mode, as either "always", "never", or "dirty". + * @default submitMode "dirty" + * @see XrmEnum.AttributeRequirementLevel + */ + setSubmitMode(submitMode: SubmitMode): void; + + /** + * A collection of all the controls on the form that interface with this attribute. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + controls: Collection.ItemCollection; + + /** + * Gets the value. + * @returns The value. + */ + getValue(): any; + + /** + * Sets the value. + * @param value The value. + */ + setValue(value: any): void; + } + + /** + * Interface for a Number attribute. + * @see Attribute + */ + interface NumberAttribute extends Attribute { + /** + * Gets the attribute format. + * @returns The format of the attribute. + * Values returned are: duration, none + */ + getFormat(): IntegerAttributeFormat; + + /** + * Gets the maximum value allowed. + * @returns The maximum value allowed. + */ + getMax(): number; + + /** + * Gets the minimum value allowed. + * @returns The minimum value allowed. + */ + getMin(): number; + + /** + * Gets the attribute's configured precision. + * @returns The total number of allowed decimal places. + */ + getPrecision(): number; + + /** + * Gets the value. + * @returns The value. + */ + getValue(): number; + + /** + * Sets the value. + * @param value The value. + * @remarks Attributes on Quick Create Forms will not save values set with this method. + */ + setValue(value: number): void; + + /** + * A collection of all the controls on the form that interface with this attribute. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + controls: Collection.ItemCollection; + } + + /** + * Interface for a String attribute. + * @see Attribute + */ + interface StringAttribute extends Attribute { + /** + * Gets the attribute format. + * @returns The format of the attribute. + * Values returned are: email, phone, text, textarea, tickersymbol, url + */ + getFormat(): StringAttributeFormat; + + /** + * Gets maximum length allowed. + * + * @returns The maximum length allowed. + * + * @remarks The email form's "Description" attribute does not have the this method. + */ + getMaxLength(): number; + + /** + * Gets the value. + * + * @returns The value. + */ + getValue(): string; + + /** + * Sets the value. + * @param value The value. + * @remarks A String field with the {@link Attribute.getFormat|email} format enforces email + * address formatting. Attributes on Quick Create Forms will not save values set + * with this method. + */ + setValue(value: string): void; + + /** + * A collection of all the controls on the form that interface with this attribute. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + controls: Collection.ItemCollection; + } + + /** + * Common interface for enumeration attributes (OptionSet and Boolean). + * @see Attribute + */ + interface EnumAttribute extends Attribute { + /** + * Gets the initial value of the attribute. + * @returns The initial value. + * @remarks Valid for OptionSet and boolean attribute types + */ + getInitialValue(): number | boolean; + } + + /** + * Interface for a Boolean attribute. + * @see EnumAttribute + */ + interface BooleanAttribute extends EnumAttribute { + /** + * Gets the initial value of the attribute. + * @returns The initial value. + * @remarks Valid for OptionSet and boolean attribute types + */ + getInitialValue(): boolean; + + /** + * Gets the value. + * @returns true if it succeeds, false if it fails. + */ + getValue(): boolean; + + /** + * Sets the value. + * @param value The value. + * @remarks Attributes on Quick Create Forms will not save values set with this method. + */ + setValue(value: boolean): void; + } + + /** + * Interface for a Date attribute. + * + * @see Attribute + */ + interface DateAttribute extends Attribute { + /** + * Gets the attribute format. + * + * @returns The format of the attribute. + * Values returned are: date, datetime + */ + getFormat(): DateAttributeFormat; + + /** + * Gets the value. + * @returns The value. + */ + getValue(): Date; + + /** + * Sets the value. + * @param value The value. + * @remarks Attributes on Quick Create Forms will not save values set with this method. + */ + setValue(value: Date): void; + + /** + * A collection of all the controls on the form that interface with this attribute. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + controls: Collection.ItemCollection; + } + + /** + * Interface an OptionSet attribute. + * @see EnumAttribute + */ + interface OptionSetAttribute extends EnumAttribute { + /** + * Gets the attribute format. + * @returns The format of the attribute. + * Values returned are: language, timezone + */ + getFormat(): OptionSetAttributeFormat; + + /** + * Gets the initial value of the attribute. + * @returns The initial value. + * @remarks Valid for OptionSet and boolean attribute types + */ + getInitialValue(): number; + + /** + * Gets the option matching a value. + * @param value The enumeration value of the option desired. + * @returns The option. + */ + getOption(value: number): OptionSetValue; + + /** + * Gets the option matching a label. + * @param label The label of the option desired. + * @returns The option. + */ + getOption(label: string): OptionSetValue; + + /** + * Gets all of the options. + * @returns An array of options. + */ + getOptions(): OptionSetValue[]; + + /** + * Gets selected option. + * @returns The selected option. + */ + getSelectedOption(): OptionSetValue; + + /** + * Gets the label of the currently selected option. + * @returns The current value's label. + */ + getText(): string; + + /** + * Gets the value. + * @returns The value. + */ + getValue(): number; + + /** + * Sets the value. + * @param value The value. + * @remarks The getOptions() method returns option values as strings. You must use parseInt + * to convert them to numbers before you can use those values to set the value of an + * OptionSet attribute. Attributes on Quick Create Forms will not save values set + * with this method. + */ + setValue(value: number): void; + + /** + * A collection of all the controls on the form that interface with this attribute. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + controls: Collection.ItemCollection; + } + + /** + * Interface a Lookup attribute. + * + * @see Attribute + */ + interface LookupAttribute extends Attribute { + /** + * Gets a boolean value indicating whether the Lookup is a multi-value PartyList. + * @returns true the attribute is a PartyList, otherwise false. + */ + getIsPartyList(): boolean; + + /** + * Gets the value. + * @returns An array of LookupValue. + */ + getValue(): LookupValue[]; + + /** + * Sets the value. + * @param value The value. + * @remarks Attributes on Quick Create Forms will not save values set with this method. + */ + setValue(value: LookupValue[]): void; + + /** + * A collection of all the controls on the form that interface with this attribute. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + controls: Collection.ItemCollection; + } + } + + /** + * A collection of types and methods for working with formContext controls. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + namespace Controls { + /** + * Control type for formContext.ui.quickForms.getControlType(). + */ + type ControlQuickFormType = "quickform"; + + /** + * Control types for {@link Controls.Control.getControlType Controls.Control.getControlType()}. + * @see XrmEnum.StandardControlType + */ + type ControlType = "standard" | "iframe" | "lookup" | "optionset" | + "subgrid" | "webresource" | "notes" | "timercontrol" | "kbsearch" | + "timelinewall" | ControlQuickFormType; /** * Interface for UI elements with labels. @@ -1499,7 +2502,7 @@ declare namespace Xrm { /** * Gets the label. * - * @return The label. + * @returns The label. */ getLabel(): string; @@ -1518,7 +2521,7 @@ declare namespace Xrm { /** * Gets the visibility state. * - * @return true if the tab is visible, otherwise false. + * @returns true if the tab is visible, otherwise false. */ getVisible(): boolean; } @@ -1565,10 +2568,11 @@ declare namespace Xrm { /** * Use this to add a function as an event handler for the keypress event so that the function is called when you type a character in the specific text or number field. * For a sample JavaScript code that uses the addOnKeyPress method to configure the auto-completion experience, see Sample: Auto-complete in CRM controls. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} + * @deprecated Deprecated in v9. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} * @param handler The function reference. */ - addOnKeyPress(handler: ContextSensitiveHandler): void; + addOnKeyPress(handler: Events.ContextSensitiveHandler): void; /** * Use this to manually fire an event handler that you created for a specific text or number field to be executed on the keypress event. @@ -1577,11 +2581,12 @@ declare namespace Xrm { /** * Use this to remove an event handler for a text or number field that you added using addOnKeyPress. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} + * @deprecated Deprecated in v9. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} * Remarks: If an anonymous function is set using addOnKeyPress, it can’t be removed using this method. * @param handler The function reference. */ - removeOnKeyPress(handler: ContextSensitiveHandler): void; + removeOnKeyPress(handler: Events.ContextSensitiveHandler): void; } /** @@ -1645,944 +2650,14 @@ declare namespace Xrm { } /** - * Interface for a Lookup value. - */ - interface LookupValue { - /** - * The identifier. - */ - id: string; - - /** - * The name - */ - name?: string; - - /** - * Type of the entity. - */ - entityType: string; - } - - /** - * Interface for an OptionSet value. - */ - interface OptionSetValue { - /** - * The label text. - */ - text: string; - - /** - * The value, as a number - */ - value: number; - } - - /** - * Interface for a privilege. - */ - interface Privilege { - /** - * True if the user can read. - */ - canRead: boolean; - - /** - * True if the user can update. - */ - canUpdate: boolean; - - /** - * True if the user can create. - */ - canCreate: boolean; - } - - /** - * Interface for an Entity attribute. - */ - interface Attribute { - /** - * Adds a handler to be called when the attribute's value is changed. - * - * @param handler The function reference. - */ - addOnChange(handler: ContextSensitiveHandler): void; - - /** - * Fire all "on change" event handlers. - */ - fireOnChange(): void; - - /** - * Gets attribute type. - * - * @return The attribute's type name. - * - * @remarks Values returned are: boolean - * datetime - * decimal - * double - * integer - * lookup - * memo - * money - * optionset - * string - */ - getAttributeType(): string; - - /** - * Gets the attribute format. - * - * @return The format of the attribute. - * - * @see {@link getAttributeType()} - * - * @remarks Values returned are: date (datetime) - * datetime (datetime) - * duration (integer) - * email (string) - * language (optionset) - * none (integer) - * phone (string) - * text (string) - * textarea (string) - * tickersymbol (string) - * timezone (optionset) - * url (string) - */ - getFormat(): AttributeFormat; - - /** - * Gets a boolean value indicating whether this Attribute has unsaved changes. - * - * @return true if there are unsaved changes, otherwise false. - */ - getIsDirty(): boolean; - - /** - * Gets the logical name of the attribute. - * - * @return The logical name. - */ - getName(): string; - - /** - * Gets a reference to the record context of this attribute. - * - * @return The parent record context. - */ - getParent(): Entity; - - /** - * Gets the current level of requirement for the attribute. - * - * @return The required level, as either "none", "required", or "recommended" - */ - getRequiredLevel(): RequirementLevel; - - /** - * Gets current submit mode for the attribute. - * - * @return The submit mode, as either "always", "never", or "dirty" - * - * @remarks The default value is "dirty" - */ - getSubmitMode(): SubmitMode; - - /** - * Gets the current user's privileges for the attribute. - * - * @return The user privileges. - */ - getUserPrivilege(): Privilege; - - /** - * Removes the handler from the "on change" event. - * - * @param handler The handler. - */ - removeOnChange(handler: ContextSensitiveHandler): void; - - /** - * Sets the required level. - * - * @param requirementLevel The requirement level, as either "none", "required", or "recommended" - */ - setRequiredLevel(requirementLevel: RequirementLevel): void; - - /** - * Sets the submit mode. - * - * @param submitMode The submit mode, as either "always", "never", or "dirty". - * - * @remarks The default value is "dirty" - */ - setSubmitMode(submitMode: SubmitMode): void; - - /** - * A collection of all the controls on the form that interface with this attribute. - */ - controls: Collection.ItemCollection; - - /** - * Gets the value. - * - * @return The value. - */ - getValue(): any; - - /** - * Sets the value. - * - * @param value The value. - */ - setValue(value: any): void; - } - - /** - * Interface for a Number attribute. + * Interface for controls. * - * @sa Attribute - */ - interface NumberAttribute extends Attribute { - /** - * Gets the attribute format. - * - * @return The format of the attribute. - * - * @remarks Values returned are: duration - * none - */ - getFormat(): IntegerAttributeFormat; - - /** - * Gets the maximum value allowed. - * - * @return The maximum value allowed. - */ - getMax(): number; - - /** - * Gets the minimum value allowed. - * - * @return The minimum value allowed. - */ - getMin(): number; - - /** - * Gets the attribute's configured precision. - * - * @return The total number of allowed decimal places. - */ - getPrecision(): number; - - /** - * Gets the value. - * - * @return The value. - */ - getValue(): number; - - /** - * Sets the value. - * - * @param value The value. - * - * @remarks Attributes on Quick Create Forms will not save values set with this method. - */ - setValue(value: number): void; - - /** - * A collection of all the controls on the form that interface with this attribute. - */ - controls: Collection.ItemCollection; - } - - /** - * Interface for a String attribute. - * - * @sa Attribute - */ - interface StringAttribute extends Attribute { - /** - * Gets the attribute format. - * - * @return The format of the attribute. - * - * @remarks Values returned are: email - * phone - * text - * textarea - * tickersymbol - * url - */ - getFormat(): StringAttributeFormat; - - /** - * Gets maximum length allowed. - * - * @return The maximum length allowed. - * - * @remarks The email form's "Description" attribute does not have the this method. - */ - getMaxLength(): number; - - /** - * Gets the value. - * - * @return The value. - */ - getValue(): string; - - /** - * Sets the value. - * - * @param value The value. - * - * @remarks A String field with the {@link Attribute.getFormat|email} format enforces email - * address formatting. Attributes on Quick Create Forms will not save values set - * with this method. - */ - setValue(value: string): void; - - /** - * A collection of all the controls on the form that interface with this attribute. - */ - controls: Collection.ItemCollection; - } - - /** - * Common interface for enumeration attributes (OptionSet and Boolean). - * - * @sa Attribute - */ - interface EnumAttribute extends Attribute { - /** - * Gets the initial value of the attribute. - * - * @return The initial value. - * - * @remarks Valid for OptionSet and boolean attribute types - */ - getInitialValue(): number | boolean; - } - - /** - * Interface for a Boolean attribute. - * - * @sa EnumAttribute - */ - interface BooleanAttribute extends EnumAttribute { - /** - * Gets the initial value of the attribute. - * - * @return The initial value. - * - * @remarks Valid for OptionSet and boolean attribute types - */ - getInitialValue(): boolean; - - /** - * Gets the value. - * - * @return true if it succeeds, false if it fails. - */ - getValue(): boolean; - - /** - * Sets the value. - * - * @param value The value. - * - * @remarks Attributes on Quick Create Forms will not save values set with this method. - */ - setValue(value: boolean): void; - } - - /** - * Interface for a Date attribute. - * - * @sa Attribute - */ - interface DateAttribute extends Attribute { - /** - * Gets the attribute format. - * - * @return The format of the attribute. - * - * @remarks Values returned are: date - * datetime - */ - getFormat(): DateAttributeFormat; - - /** - * Gets the value. - * - * @return The value. - */ - getValue(): Date; - - /** - * Sets the value. - * - * @param value The value. - * - * @remarks Attributes on Quick Create Forms will not save values set with this method. - */ - setValue(value: Date): void; - - /** - * A collection of all the controls on the form that interface with this attribute. - */ - controls: Collection.ItemCollection; - } - - /** - * Interface an OptionSet attribute. - * - * @sa EnumAttribute - */ - interface OptionSetAttribute extends EnumAttribute { - /** - * Gets the attribute format. - * - * @return The format of the attribute. - * - * @remarks Values returned are: language - * timezone - */ - getFormat(): OptionSetAttributeFormat; - - /** - * Gets the initial value of the attribute. - * - * @return The initial value. - * - * @remarks Valid for OptionSet and boolean attribute types - */ - getInitialValue(): number; - - /** - * Gets the option matching a value. - * - * @param value The enumeration value of the option desired. - * - * @return The option. - */ - getOption(value: number): OptionSetValue; - - /** - * Gets the option matching a label. - * - * @param label The label of the option desired. - * - * @return The option. - */ - getOption(label: string): OptionSetValue; - - /** - * Gets all of the options. - * - * @return An array of options. - */ - getOptions(): OptionSetValue[]; - - /** - * Gets selected option. - * - * @return The selected option. - */ - getSelectedOption(): OptionSetValue; - - /** - * Gets the label of the currently selected option. - * - * @return The current value's label. - */ - getText(): string; - - /** - * Gets the value. - * - * @return The value. - */ - getValue(): number; - - /** - * Sets the value. - * - * @param value The value. - * - * @remarks The getOptions() method returns option values as strings. You must use parseInt - * to convert them to numbers before you can use those values to set the value of an - * OptionSet attribute. Attributes on Quick Create Forms will not save values set - * with this method. - */ - setValue(value: number): void; - - /** - * A collection of all the controls on the form that interface with this attribute. - */ - controls: Collection.ItemCollection; - } - - /** - * Interface a Lookup attribute. - * - * @sa Attribute - */ - interface LookupAttribute extends Attribute { - /** - * Gets a boolean value indicating whether the Lookup is a multi-value PartyList. - * - * @return true the attribute is a PartyList, otherwise false. - */ - getIsPartyList(): boolean; - - /** - * Gets the value. - * - * @return An array of LookupValue. - */ - getValue(): LookupValue[]; - - /** - * Sets the value. - * - * @param value The value. - * - * @remarks Attributes on Quick Create Forms will not save values set with this method. - */ - setValue(value: LookupValue[]): void; - - /** - * A collection of all the controls on the form that interface with this attribute. - */ - controls: Collection.ItemCollection; - } - - /** - * Interface for the form's record context, Xrm.Page.data.entity - */ - interface Entity { - /** - * Adds a handler to be called when the record is saved. - * - * @param handler The handler. - */ - addOnSave(handler: ContextSensitiveHandler): void; - - /** - * Gets an serialized-XML string representing data that will be passed to the server upon saving - * the record. - * - * @return The XML in string format. - * - * @remarks This function does not work with Microsoft Dynamics CRM for tablets. Example: - * "Contoso55555425 - * 555-1234". - */ - getDataXml(): string; - - /** - * Gets entity's logical name. - * - * @return The logical name. - */ - getEntityName(): string; - - /** - * Gets the record's unique identifier. - * - * @return The identifier, in Guid format. - * - * @remarks Example: "{825CB223-A651-DF11-AA8B-00155DBA3804}". - */ - getId(): string; - - /** - * Gets a boolean value indicating whether the record has unsaved changes. - * - * @return true if there are unsaved changes, otherwise false. - */ - getIsDirty(): boolean; - - /** - * Gets the record's primary attribute value. - * - * @return The primary attribute value. - * - * @remarks The value for this attribute is used when links to the record are displayed. - */ - getPrimaryAttributeValue(): string; - - /** - * Removes the handler from the "on save" event. - * - * @param handler The handler. - */ - removeOnSave(handler: ContextSensitiveHandler): void; - - /** - * Saves the record. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @remarks When using quick create forms in the web application the saveandnew option is not - * applied. It will always work as if saveandclose were used. Quick create forms in - * Microsoft Dynamics CRM for tablets will apply the saveandnew behavior. - */ - save(): void; - - /** - * Saves the record with the given save mode. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @param saveMode (Optional) the save mode to save, as either "saveandclose" or - * "saveandnew". - */ - save(saveMode: SaveMode): void; - - /** - * The collection of attributes for the record. - */ - attributes: Collection.ItemCollection; - } - - /** - * Interface for save event arguments. - */ - interface SaveEventArguments { - /** - * Gets save mode, as an integer. - * - * @return The save mode. - * - * @remarks Values returned are: 1 Save - * 2 Save and Close - * 59 Save and New - * 70 AutoSave (Where enabled; can be used with an OnSave handler - * to conditionally disable auto-saving) - * 58 Save as Completed (Activities) - * 5 Deactivate - * 6 Reactivate - * 47 Assign (All user- or team-owned entities) - * 7 Send (Email) - * 16 Qualify (Lead) - * 15 Disqualify (Lead) - */ - getSaveMode(): XrmEnum.SaveMode; - - /** - * Returns a boolean value to indicate if the record's save has been prevented. - * - * @return true if saving is prevented, otherwise false. - */ - isDefaultPrevented(): boolean; - - /** - * Prevents the save operation from being submitted to the server. - * - * @remarks All remaining "on save" handlers will continue execution. - */ - preventDefault(): void; - } - - /** - * Interface for process stage change event arguments. - */ - interface StageChangeEventArguments { - /** - * Gets the direction of the stage change. - * - * @return The direction. - * - * @remarks Values returned are: "next" or "previous" - */ - getDirection(): StageChangeDirection; - - /** - * Gets the destination stage object - * - * @return The stage object - * - * @remarks For switching between entities, returns the previous stage object - */ - getStage(): Stage; - } - - /** - * Interface for process stage selected event arguments. - */ - interface StageSelectedEventArguments { - /** - * Gets the selected stage object - * - * @return The stage object - */ - getStage(): Stage; - } - - /** - * Module for the Xrm.Page.data API. - */ - namespace data { - /** - * Interface for the Xrm.Page.data.process API. - */ - interface ProcessManager { - /** - * Returns a Process object representing the active process. - * - * @return current active process. - */ - getActiveProcess(): Process; - - /** - * Set a Process as the active process. - * - * @param processId The Id of the process to make the active process. - * @param callbackFunction (Optional) a function to call when the operation is complete. - */ - setActiveProcess(processId: string, callbackFunction?: ProcessCallbackDelegate): void; - - /** - * Returns all process instances for the entity record that the calling user has access to. - * - * @param callbackFunction (Optional) a function to call when the operation is complete. - */ - getProcessInstances(callbackFunction: GetProcessInstancesDelegate): void; - - /** - * Sets a process instance as the active instance - * - * @param processInstanceId The Id of the process instance to make the active instance. - * @param callbackFunction (Optional) a function to call when the operation is complete. - */ - setActiveProcessInstance(processInstanceId: string, callbackFunction: SetProcessInstanceDelegate): void; - - /** - * Returns a Stage object representing the active stage. - * - * @return current active stage. - */ - getActiveStage(): Stage; - - /** - * Set a stage as the active stage. - * - * @param stageId the Id of the stage to make the active stage. - * @param callbackFunction (Optional) a function to call when the operation is complete. - */ - setActiveStage(stageId: string, callbackFunction?: ProcessCallbackDelegate): void; - - /** - * Use this method to get a collection of stages currently in the active path with methods to interact with the - * stages displayed in the business process flow control. The active path represents stages currently rendered in - * the process control based on the branching rules and current data in the record. - * - * @return A collection of all completed stages, the currently active stage, and the predicted set of future stages - * based on satisfied conditions in the branching rule. This may be a subset of the stages returned with - * Xrm.Page.data.process.getActiveProcess because it will only include those stages which represent a valid - * transition from the current stage based on branching that has occurred in the process. - */ - getActivePath(): Collection.ItemCollection; - - /** - * Use this method to asynchronously retrieve the enabled business process flows that the user can switch to for an - * entity. - * - * @param callbackFunction The callback function must accept a parameter that contains an object with - * dictionary properties where the name of the property is the Id of the - * business process flow and the value of the property is the name of the - * business process flow. - * The enabled processes are filtered according to the user’s privileges. The - * list of enabled processes is the same ones a user can see in the UI if they - * want to change the process manually. - */ - getEnabledProcesses(callbackFunction: (enabledProcesses: ProcessDictionary) => void): void; - - /** - * Use this method to get the currently selected stage. - * - * @return The currently selected stage. - */ - getSelectedStage(): Stage; - - /** - * Use this to add a function as an event handler for the OnStageChange event so that it will be called when the - * business process flow stage changes. - * @param handler The function will be added to the bottom of the event - * handler pipeline. The execution context is automatically - * set to be the first parameter passed to the event handler. - * Use a reference to a named function rather than an - * anonymous function if you may later want to remove the - * event handler. - */ - addOnStageChange(handler: ContextSensitiveHandler): void; - - /** - * Use this to add a function as an event handler for the OnProcessStatusChange event so that it will be called when the - * business process flow status changes. - * @param handler The function will be added to the bottom of the event - * handler pipeline. The execution context is automatically - * set to be the first parameter passed to the event handler. - * Use a reference to a named function rather than an - * anonymous function if you may later want to remove the - * event handler. - */ - addOnProcessStatusChange(handler: ProcessStatusChangeHandler): void; - - /** - * Use this to add a function as an event handler for the OnStageSelected event so that it will be called - * when a business process flow stage is selected. - * - * @param handler The function will be added to the bottom of the event - * handler pipeline. The execution context is automatically - * set to be the first parameter passed to the event handler. - * Use a reference to a named function rather than an - * anonymous function if you may later want to remove the - * event handler. - */ - addOnStageSelected(handler: ContextSensitiveHandler): void; - - /** - * Use this to remove a function as an event handler for the OnProcessStatusChange event. - * - * @param handler If an anonymous function is set using the addOnProcessStatusChange method it - * cannot be removed using this method. - */ - removeOnProcessStatusChange(handler: ProcessStatusChangeHandler): void; - - /** - * Use this to remove a function as an event handler for the OnStageChange event. - * - * @param handler If an anonymous function is set using the addOnStageChange method it - * cannot be removed using this method. - */ - removeOnStageChange(handler: ContextSensitiveHandler): void; - - /** - * Use this to remove a function as an event handler for the OnStageChange event. - * - * @param handler If an anonymous function is set using the addOnStageChange method it - * cannot be removed using this method. - */ - removeOnStageSelected(handler: ContextSensitiveHandler): void; - - /** - * Progresses to the next stage. - * - * @param callbackFunction (Optional) A function to call when the operation is complete. - * - */ - moveNext(callbackFunction?: ProcessCallbackDelegate): void; - - /** - * Moves to the previous stage. - * - * @param callbackFunction (Optional) A function to call when the operation is complete. - * . - */ - movePrevious(callbackFunction?: ProcessCallbackDelegate): void; - - /** - * Use this method to get the unique identifier of the process instance - * - * @return The unique identifier of the process instance - */ - getInstanceId(): string; - - /** - * Use this method to get the name of the process instance - * - * @return The name of the process instance - */ - getInstanceName(): string; - - /** - * Use this method to get the current status of the process instance - * - * @return The current status of the process - */ - getStatus(): ProcessStatus; - - /** - * Use this method to set the current status of the process instance - * - * @param status The new status for the process - * @param callbackFunction (Optional) a function to call when the operation is complete. - */ - setStatus(status: ProcessStatus, callbackFunction: ProcessSetStatusDelegate): void; - } - - /** - * Called when method to get active processes is complete - * - * @param status The result of the get active processes operation. - * - * @remarks Returns object with the following key-value pairs: - * CreatedOn - * ProcessDefinitionID - * ProcessDefinitionName - * ProcessInstanceID - * ProcessInstanceName - * StatusCodeName - */ - type GetProcessInstancesDelegate = (object: ProcessDictionary) => void; - - /** - * Called when method to set active process is complete - * - * @param status The result of the set active process operation. - * - * @remarks Values returned are: success (The operation succeeded.) - * invalid (The processInstanceId isn’t valid or the process isn’t enabled.) - */ - type SetProcessInstanceDelegate = (status: string) => void; - - /** - * Called when process change methods have completed. - * - * @param status The result of the process change operation. - * - * @remarks Values returned are: success (The operation succeeded.) - * crossEntity (The previous stage is for a different entity.) - * beginning (The active stage is the first stage of the active path.) - * invalid (The operation failed because the selected stage isn’t the same - * as the active stage.) - * unreachable (The stage exists on a different path.) - */ - type ProcessCallbackDelegate = (status: string) => void; - - /** - * Called when process set status method has completed. - * - * @param status The new status of the process instance - * - * @remarks Values returned are: active - * aborted - * finished - */ - type ProcessSetStatusDelegate = (status: ProcessStatus) => void; - - /** - * Represents a key-value pair, where the key is the Process Flow's ID, and the value is the name thereof. - */ - interface ProcessDictionary { [index: string]: string; } - } - - /** - * Interface for Xrm.Page.ui controls. - * - * @sa UiElement + * @see UiElement */ interface Control extends UiLabelElement, UiCanGetVisibleElement { /** * Gets the controls type. - * - * @return The control type. - * + * @returns The control type. * @remarks Values returned are: standard * iframe * lookup @@ -2600,9 +2675,7 @@ declare namespace Xrm { /** * Gets the name of the control on the form. - * - * @return The name of the control. - * + * @returns The name of the control. * @remarks The name assigned to a control is not determined until the form loads. Changes to * the form may change the name assigned to a given control. * When you use the control getName method the name of the first control will be the @@ -2619,50 +2692,66 @@ declare namespace Xrm { /** * Gets a reference to the Section parent of the control. * - * @return The parent Section. + * @returns The parent Section. */ getParent(): Section; } + /** + * Interface for {@link Ui.navigation formContext.ui.navigation}. + */ + interface Navigation { + /** + * A reference to the collection of available navigation items. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + items: Collection.ItemCollection; + } + + /** + * Interface for a navigation item. + * @see UiElement + * @see UiFocusable + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui-navigation formContext.ui.navigation item (Client API reference)} + */ + interface NavigationItem extends UiStandardElement, UiFocusable { + /** + * Gets the name of the item. + * @returns The identifier. + */ + getId(): string; + } + /** * Interface for a standard control. - * - * @sa Control + * @see Control */ interface StandardControl extends Control, UiStandardElement, UiFocusable { /** * Clears the notification identified by uniqueId. - * * @param uniqueId (Optional) Unique identifier. - * - * @return true if it succeeds, false if it fails. - * + * @returns true if it succeeds, false if it fails. * @remarks If the uniqueId parameter is not used, the current notification shown will be removed. */ clearNotification(uniqueId?: string): boolean; /** * Gets a boolean value, indicating whether the control is disabled. - * - * @return true if it is disabled, otherwise false. + * @returns true if it is disabled, otherwise false. */ getDisabled(): boolean; /** * Sets the state of the control to either enabled, or disabled. - * * @param disabled true to disable, false to enable. */ setDisabled(disabled: boolean): void; /** * Sets a control-local notification message. - * * @param message The message. * @param uniqueId Unique identifier. - * - * @return true if it succeeds, false if it fails. - * + * @returns true if it succeeds, false if it fails. * @remarks When this method is used on Microsoft Dynamics CRM for tablets a red "X" icon * appears next to the control. Tapping on the icon will display the message. */ @@ -2675,28 +2764,25 @@ declare namespace Xrm { /** * Gets the control's bound attribute. - * - * @tparam T An Attribute type. - * - * @return The attribute. + * @template T An Attribute type. + * @returns The attribute. */ - getAttribute(): T; + getAttribute(): T; /** * Gets the control's bound attribute. - * - * @return The attribute. + * @returns The attribute. */ - getAttribute(): Attribute; + getAttribute(): Attributes.Attribute; } /** * Interface for Auto Lookup Control. * This is not an Entity Lookup, but a control that supports AutoComplete / KeyPress Events (Text or Number) - * * @remarks This interface is not supported for CRM mobile clients (phones or tablets) and the interactive service hub. It is only available for Updated entities. - * - * @sa StandardControl + * @deprecated Deprecated in v9. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see StandardControl */ interface AutoLookupControl extends StandardControl, UiKeyPressable { /** @@ -2709,14 +2795,16 @@ declare namespace Xrm { /** * Hides the auto-completion drop-down list configured for a specific text field - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} + * @deprecated Deprecated in v9. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ hideAutoComplete(): void; /** * Shows upt to 10 matching strings in a drop-down list as users press keys to type charactrer in a specific text field. * On selecting an item in the drop-down list, the value in the text field changes to the selected item, the drop-down list disappears, and the OnChange event for the text field is invoked - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} + * @deprecated Deprecated in v9. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} * @param resultSet The results to show */ showAutoComplete(resultSet: AutoCompleteResultSet): void; @@ -2724,55 +2812,47 @@ declare namespace Xrm { /** * Interface for a String control. - * - * @sa StandardControl + * @see StandardControl */ interface StringControl extends AutoLookupControl { /** * Gets the control's bound attribute. - * - * @return The attribute. + * @returns The attribute. */ - getAttribute(): StringAttribute; + getAttribute(): Attributes.StringAttribute; } /** * Interface for a Number control. - * - * @sa StandardControl + * @see StandardControl */ interface NumberControl extends AutoLookupControl { /** * Gets the control's bound attribute. - * - * @return The attribute. + * @returns The attribute. */ - getAttribute(): NumberAttribute; + getAttribute(): Attributes.NumberAttribute; } /** * Interface for a Date control. - * - * @sa StandardControl + * @see StandardControl */ interface DateControl extends StandardControl { /** * Gets the control's bound attribute. - * - * @return The attribute. + * @returns The attribute. */ - getAttribute(): DateAttribute; + getAttribute(): Attributes.DateAttribute; /** * Gets the status of the time-of-day component of the Date control. - * - * @return true if the time is shown, otherwise false. + * @returns true if the time is shown, otherwise false. */ getShowTime(): boolean; /** * Sets the visibility of the time component of the Date control. - * * @param showTimeValue true to show, false to hide the time value. */ setShowTime(showTimeValue: boolean): void; @@ -2780,30 +2860,24 @@ declare namespace Xrm { /** * Interface for a Lookup control. - * - * @sa StandardControl + * @see StandardControl */ interface LookupControl extends StandardControl { /** * Adds a handler to the "pre search" event of the Lookup control. - * * @param handler The handler. */ - addPreSearch(handler: ContextSensitiveHandler): void; + addPreSearch(handler: Events.ContextSensitiveHandler): void; /** * Adds an additional custom filter to the lookup, with the "AND" filter operator. * Can only be used within a "pre search" event handler - * - * @sa addPreSearch - * - * @param filter Specifies the filter, as a serialized FetchXML - * "filter" node. + * @see addPreSearch + * @param filter Specifies the filter, as a serialized FetchXML "filter" node. * @param entityLogicalName (Optional) The logical name of the entity. - * * @remarks If entityLogicalName is not specified, the filter will be applied to all entities * valid for the Lookup control. - * Example filter: + * @example Example filter: * * */ @@ -2811,51 +2885,43 @@ declare namespace Xrm { /** * Adds a custom view for the Lookup dialog. - * * @param viewId Unique identifier for the view, in Guid format. * @param entityName Name of the entity. * @param viewDisplayName Name of the view to display. * @param fetchXml The FetchXML query for the view's contents, serialized as a string. * @param layoutXml The Layout XML, serialized as a string. * @param isDefault true, to treat this view as default. - * * @remarks Cannot be used on "Owner" Lookup controls. * The viewId is never saved to CRM, but must be unique across available views. Generating - * a new value can be accomplished with a {@link http://www.guidgen.com/|Guid generator}. - * Example viewId value: "{00000000-0000-0000-0000-000000000001}" - * Layout XML Reference: {@link http://msdn.microsoft.com/en-us/library/gg334522.aspx}. + * a new value can be accomplished with a {@link http://www.guidgen.com/ Guid generator(external link)}. + * @example Example viewId value: "{00000000-0000-0000-0000-000000000001}" + * @see {@link http://msdn.microsoft.com/en-us/library/gg334522.aspx External Link: Layout XML Reference} */ addCustomView(viewId: string, entityName: string, viewDisplayName: string, fetchXml: string, layoutXml: string, isDefault: boolean): void; /** * Gets the control's bound attribute. - * - * @return The attribute. + * @returns The attribute. */ - getAttribute(): LookupAttribute; + getAttribute(): Attributes.LookupAttribute; /** * Gets the unique identifier of the default view. - * - * @return The default view, in Guid format. - * - * @remarks Example: "{00000000-0000-0000-0000-000000000000}" + * @returns The default view, in Guid format. + * @example Example return: "{00000000-0000-0000-0000-000000000000}" */ getDefaultView(): string; /** * Removes the handler from the "pre search" event of the Lookup control. - * * @param handler The handler. */ removePreSearch(handler: () => void): void; /** * Sets the Lookup's default view. - * * @param viewGuid Unique identifier for the view. - * - * @remarks Example viewGuid value: "{00000000-0000-0000-0000-000000000000}" + * @example Example viewGuid value: "{00000000-0000-0000-0000-000000000000}" */ setDefaultView(viewGuid: string): void; @@ -2873,7 +2939,7 @@ declare namespace Xrm { /** * Interface for an OptionSet control. * - * @sa StandardControl + * @see StandardControl */ interface OptionSetControl extends StandardControl { /** @@ -2895,9 +2961,9 @@ declare namespace Xrm { /** * Gets the control's bound attribute. * - * @return The attribute. + * @returns The attribute. */ - getAttribute(): OptionSetAttribute; + getAttribute(): Attributes.OptionSetAttribute; /** * Removes the option matching the value. @@ -2910,7 +2976,7 @@ declare namespace Xrm { /** * Interface for a CRM grid control. * - * @sa Control + * @see Control */ interface GridControl extends Control { /** @@ -2923,277 +2989,73 @@ declare namespace Xrm { /** * This method returns context information about the GridControl. * - * @return The context type. + * @returns The context type. */ getContextType(): XrmEnum.GridControlContext; /** * Use this method to get the logical name of the entity data displayed in the grid. * - * @return The entity name. + * @returns The entity name. */ getEntityName(): string; /** * Use this method to get access to the Grid available in the GridControl. - * - * @return The grid. + * @returns The grid. */ - getGrid(): ui.Grid; + getGrid(): Grid; /** * Use this method to get access to the ViewSelector available for the GridControl when it is configured to display views. - * - * @return The view selector. + * @returns The view selector. */ - getViewSelector(): ui.ViewSelector; + getViewSelector(): ViewSelector; /** * Refreshes the sub grid. - * * @remarks Not available during the "on load" event of the form. */ refresh(): void; /** * Use this method to remove event handlers from the GridControl's OnLoad event. - * * @param handler The handler. */ removeOnLoad(handler: () => void): void; } /** - * Interface for a framed control, which is either a Web Resource or an Iframe. - * - * @sa Control - * - * @remarks An Iframe control provides additional methods, so use {@link IframeControl} where - * appropriate. Silverlight controls should use {@link SilverlightControl}. + * Interface for a grid. Use Grid methods to access information about data in the grid. Grid is returned by the + * GridControl.getGrid method. */ - interface FramedControl extends Control { + interface Grid { /** - * Gets the DOM element containing the control. - * - * @return The container object. - * - * @remarks Unavailable for Microsoft Dynamics CRM for tablets. + * Returns a collection of every GridRow in the Grid. + * @returns The rows. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} */ - getObject(): HTMLIFrameElement; + getRows(): Collection.ItemCollection; /** - * Gets the URL value of the control. - * - * @return The source URL. - * - * @remarks Unavailable for Microsoft Dynamics CRM for tablets. + * Returns a collection of every selected GridRow in the Grid. + * @returns The selected rows. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} */ - getSrc(): string; + getSelectedRows(): Collection.ItemCollection; /** - * Sets the URL value of the control. - * - * @param src The source URL. - * - * @remarks Unavailable for Microsoft Dynamics CRM for tablets. + * Returns the total number of records in the Grid. + * @returns The total record count. */ - setSrc(src: string): void; + getTotalRecordCount(): number; } - /** - * Interface for an Iframe control. - * - * @sa FramedControl - */ - interface IframeControl extends FramedControl, UiCanSetVisibleElement { - /** - * Gets initial URL defined for the Iframe. - * - * @return The initial URL. - * - * @remarks Unavailable for Microsoft Dynamics CRM for tablets. - */ - getInitialUrl(): string; - } - - /** - * Interface for a Silverlight control. - * - * @sa Control - */ - interface SilverlightControl extends Control { - /** - * Gets the query string value passed to Silverlight. - * - * @return The data. - * - * @remarks Unavailable for Microsoft Dynamics CRM for tablets. - */ - getData(): string; - - /** - * Sets the query string value passed to Silverlight. - * - * @param data The data. - * - * @remarks Unavailable for Microsoft Dynamics CRM for tablets. - */ - setData(data: string): void; - - /** - * Gets the DOM element containing the control. - * - * @return The container object. - * - * @remarks Unavailable for Microsoft Dynamics CRM for tablets. - */ - getObject(): HTMLObjectElement; - } - - /** - * Interface for a Timeline control. - * - * @sa Control - */ - interface TimelineWall extends Control { - /** - * Refreshes the data displayed in a timelinewall and timer control. - * - */ - refresh(): void; - } - - /** - * Interface for a form tab. - * - * @sa UiElement - * @sa UiFocusable - */ - interface Tab extends UiStandardElement, UiFocusable { - /** - * Gets display state of the tab. - * - * @return The display state, as either "expanded" or "collapsed" - */ - getDisplayState(): ui.DisplayState; - - /** - * Gets the name of the tab. - * - * @return The name. - */ - getName(): string; - - /** - * Gets a reference to the Xrm.Page.ui parent of the tab. - * - * @return The parent. - */ - getParent(): Ui; - - /** - * Sets display state of the tab. - * - * @param displayState Display state of the tab, as either "expanded" or "collapsed" - */ - setDisplayState(displayState: ui.DisplayState): void; - - /** - * A reference to the collection of form sections within this tab. - */ - sections: Collection.ItemCollection
; - } - - /** - * Interface for a form section. - * - * @sa UiElement - */ - interface Section extends UiStandardElement { - /** - * Gets the name of the section. - * - * @return The name. - */ - getName(): string; - - /** - * Gets a reference to the Xrm.Page.Tab parent of this item. - * - * @return The parent. - */ - getParent(): Tab; - - /** - * A reference to the collection of controls within this tab. - */ - controls: Collection.ItemCollection; - } - - /** - * Module for Xrm.Page.ui API. - */ - namespace ui { - /** - * Form Notification Levels for Xrm.Ui.setFormNotification(). - */ - type FormNotificationLevel = "ERROR" | "INFO" | "WARNING"; - - /** - * Display States for Xrm.ui.ProcessMonitor.setDisplayState(). - */ - type DisplayState = "collapsed" | "expanded"; - - /** - * Interface for Xrm.Page.ui.process API - */ - interface ProcessManager { - /** - * Sets display state of the process flow control. - * - * @param displayState Display state of the process flow control, as either "expanded" or "collapsed" - */ - setDisplayState(displayState: DisplayState): void; - - /** - * Sets the visibility state. - * - * @param visible true to show, false to hide. - */ - setVisible(visible: boolean): void; - } - - /** - * Interface for a grid. Use Grid methods to access information about data in the grid. Grid is returned by the - * GridControl.getGrid method. - */ - interface Grid { - /** - * Returns a collection of every GridRow in the Grid. - * - * @return The rows. - */ - getRows(): Collection.ItemCollection; - - /** - * Returns a collection of every selected GridRow in the Grid. - * - * @return The selected rows. - */ - getSelectedRows(): Collection.ItemCollection; - - /** - * Returns the total number of records in the Grid. - * - * @return The total record count. - */ - getTotalRecordCount(): number; - } - + namespace Grid { /** * Interface for a grid row. Use the GridRow.getData method to access the GridRowData. A collection of GridRow is * returned by Grid.getRows and Grid.getSelectedRows methods. - * In V9 - this is essentailly a form context. + * In V9 - this is essentailly a form context */ interface GridRow { /** @@ -3203,7 +3065,7 @@ declare namespace Xrm { /** * Returns the GridRowData for the GridRow. * @deprecated Deprecated in V9 - use data field instead - * @return The data. + * @returns The data. */ getData(): GridRowData; } @@ -3215,8 +3077,8 @@ declare namespace Xrm { interface GridRowData { /** * Returns the GridEntity for the GridRowData. - * - * @return The entity. + * @returns The entity. + * @deprecated Use GridRow.data.entity instead of using GridRow.getData().getEntity(). */ getEntity(): GridEntity; } @@ -3224,232 +3086,254 @@ declare namespace Xrm { /** * Interface for a grid entity. Use the GridEntity methods to access data about the specific records in the rows. * GridEntity is returned by the GridRowData.getEntity method. + * + * @deprecated Use GridRow.data.entity instead. */ interface GridEntity { /** * Returns the logical name for the record in the row. * - * @return The entity name. + * @returns The entity name. + * @deprecated Use GridRow.data.entity.getEntityName() instead. */ getEntityName(): string; /** * Returns a LookupValue that references this record. * - * @return The entity reference. + * @returns The entity reference. + * @deprecated Use GridRow.data.entity.getEntityReference() instead. */ getEntityReference(): LookupValue; /** * Returns the id for the record in the row. * - * @return The identifier of the GridEntity, in GUID format. - * - * @remarks Example return: "{00000000-0000-0000-0000-000000000000}" + * @returns The identifier of the GridEntity, in GUID format. + * @example Example return: "{00000000-0000-0000-0000-000000000000}" + * @deprecated Use GridRow.data.entity.getId() instead. */ getId(): string; /** * Returns the primary attribute value for the record in the row. (Commonly the name.) * - * @return The primary attribute value. + * @returns The primary attribute value. + * @deprecated Use GridRow.data.entity.getPrimaryAttributeValue() instead. */ getPrimaryAttributeValue(): string; } - - /** - * Interface for the view selector. Use the ViewSelector methods to get or set information about the view selector - * of the grid control. - */ - interface ViewSelector { - /** - * Use this method to get a reference to the current view. - * - * @return The current view. - */ - getCurrentView(): ViewSelectorItem; - - /** - * Use this method to determine whether the view selector is visible. - * - * @return true if visible, false if not. - */ - isVisible(): boolean; - - /** - * Use this method to set the current view. - * - * @param viewSelectorItem The view selector item. - */ - setCurrentView(viewSelectorItem: ViewSelectorItem): void; - } - - /** - * Interface for a view selector item. This object contains data that identifies a view. Use this as a parameter to - * the ViewSelector.setCurrentView method. - */ - interface ViewSelectorItem { - /** - * Returns a LookupValue that references this view. - * - * @return The entity reference. - */ - getEntityReference(): LookupValue; - } - - /** - * Interface for a quick view control instance on a form. - * - * @see {@link https://msdn.microsoft.com/en-us/library/mt736908.aspx#bkmk_isLoaded} for details. - */ - interface QuickForm extends Control, UiLabelElement, UiCanGetVisibleElement { - /** - * Gets the constituent controls in a quick view control. - * - * @return An array of controls. - * - * @remarks Constituent controls in a quick view control are read only. - */ - getControl(): Control[]; - - /** - * Gets the constituent controls in a quick view control. - * - * @param T A Control type - * @param controlName Name of the control. - * - * @return The control. - * - * @remarks Constituent controls in a quick view control are read only. - */ - getControl(controlName: string): T; - - /** - * Gets the constituent controls in a quick view control. - * - * @param controlName Name of the control. - * - * @return The control. - * - * @remarks Constituent controls in a quick view control are read only. - */ - getControl(controlName: string): Control; - - /** - * Gets a control by index. - * - * @param T A Control type - * @param index The control index. - * - * @return The control. - * - * @remarks Constituent controls in a quick view control are read only. - */ - getControl(index: number): T; - - /** - * Gets a control by index. - * - * @param index The control index. - * - * @return The control. - * - * @remarks Constituent controls in a quick view control are read only. - */ - getControl(index: number): Control; - - /** - * Gets the controls type. - * - * @return Returns a string value that categorizes quick view controls. - */ - getControlType(): ControlQuickFormType; - - /** - * Returns whether the data binding for the constituent controls in a quick view control is complete. - * - * @return True is the data binding for a constituent control is complete, otherwise false. - * because the quick view form that the control is bound to may not have loaded completely. - * As a result, using the getAttribute or any data-related methods on a constituent control might not work. - * The isLoaded method for the quick view control helps determine the data binding status for constituent controls in a quick view control. - * - * @remarks The data binding for the constituent controls in a quick view control may not be complete during the main form OnLoad event - */ - isLoaded(): boolean; - - /** - * Refreshes the data displayed in a quick view control. - */ - refresh(): void; - } } /** - * Interface for a navigation item. - * - * @sa UiElement - * @sa UiFocusable + * Interface for a framed control, which is either a Web Resource or an Iframe. + * @see Control + * @remarks An Iframe control provides additional methods, so use {@link IframeControl} where + * appropriate. Silverlight controls should use {@link SilverlightControl}. */ - interface NavigationItem extends UiStandardElement, UiFocusable { + interface FramedControl extends Control { /** - * Gets the name of the item. - * - * @return The identifier. + * Gets the DOM element containing the control. + * @returns The container object. + * @remarks Unavailable for Microsoft Dynamics CRM for tablets. */ - getId(): string; + getObject(): HTMLIFrameElement; + + /** + * Gets the URL value of the control. + * @returns The source URL. + * @remarks Unavailable for Microsoft Dynamics CRM for tablets. + */ + getSrc(): string; + + /** + * Sets the URL value of the control. + * @param src The source URL. + * @remarks Unavailable for Microsoft Dynamics CRM for tablets. + */ + setSrc(src: string): void; } /** - * Interface for Xrm.Page.ui.navigation. + * Interface for an Iframe control. + * @see FramedControl */ - interface Navigation { + interface IframeControl extends FramedControl, UiCanSetVisibleElement { /** - * A reference to the collection of available navigation items. + * Gets initial URL defined for the Iframe. + * @returns The initial URL. + * @remarks Unavailable for Microsoft Dynamics CRM for tablets. */ - items: Collection.ItemCollection; + getInitialUrl(): string; } /** - * Interface for an entity's form selector item. + * Interface for a quick view control instance on a form. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui-quickforms ExternalLink: formContext.ui.quickForms (Client API reference)} */ - interface FormItem { + interface QuickFormControl extends Control, UiLabelElement, UiCanGetVisibleElement { /** - * Gets the unique identifier of the form. - * - * @return The identifier, in Guid format. + * Gets the constituent controls in a quick view control. + * @returns An array of controls. + * @remarks Constituent controls in a quick view control are read only. */ - getId(): string; + getControl(): Control[]; /** - * Gets the label for the form. - * - * @return The label. + * Gets the constituent controls in a quick view control. + * @param T A Control type + * @param controlName Name of the control. + * @returns The control. + * @remarks Constituent controls in a quick view control are read only. */ - getLabel(): string; + getControl(controlName: string): T; /** - * Navigates the user to this form. + * Gets the constituent controls in a quick view control. + * @param controlName Name of the control. + * @returns The control. + * @remarks Constituent controls in a quick view control are read only. */ - navigate(): void; + getControl(controlName: string): Control; + + /** + * Gets a control by index. + * @param T A Control type + * @param index The control index. + * @returns The control. + * @remarks Constituent controls in a quick view control are read only. + */ + getControl(index: number): T; + + /** + * Gets a control by index. + * @param index The control index. + * @returns The control. + * @remarks Constituent controls in a quick view control are read only. + */ + getControl(index: number): Control; + + /** + * Gets the controls type. + * @returns Returns a string value ("quickform") that categorizes quick view controls. + */ + getControlType(): ControlQuickFormType; + + /** + * Returns whether the data binding for the constituent controls in a quick view control is complete. + * @returns True is the data binding for a constituent control is complete, otherwise false. + * because the quick view form that the control is bound to may not have loaded completely. + * As a result, using the getAttribute or any data-related methods on a constituent control might not work. + * The isLoaded method for the quick view control helps determine the data binding status for constituent controls in a quick view control. + * @remarks The data binding for the constituent controls in a quick view control may not be complete during the main form OnLoad event + */ + isLoaded(): boolean; + + /** + * Refreshes the data displayed in a quick view control. + */ + refresh(): void; } /** - * Interface for the form selector API. + * Interface for a Silverlight control. + * @see Control + * @deprecated The Silverlight WebResource is deprecated on the web client, and is not supported on the new Unified Interface in v9. + * Instead of silverlight, use custom controls created using the HTML web resources with HTML5 to create UI components to visualize and interact with data. */ - interface FormSelector { + interface SilverlightControl extends Control { /** - * Gets current form. - * - * @return The current item. - * - * @remarks When only one form is available this method will return null. + * Gets the query string value passed to Silverlight. + * @returns The data. + * @remarks Unavailable for Microsoft Dynamics CRM for tablets. */ - getCurrentItem(): FormItem; + getData(): string; /** - * A reference to the collection of available forms. + * Sets the query string value passed to Silverlight. + * @param data The data. + * @remarks Unavailable for Microsoft Dynamics CRM for tablets. */ - items: Collection.ItemCollection; + setData(data: string): void; + + /** + * Gets the DOM element containing the control. + * @returns The container object. + * @remarks Unavailable for Microsoft Dynamics CRM for tablets. + */ + getObject(): HTMLObjectElement; + } + + /** + * Interface for a Timeline control. + * @see Control + */ + interface TimelineWall extends Control { + /** + * Refreshes the data displayed in a timelinewall and timer control. + */ + refresh(): void; + } + + /** + * Interface for a form tab. + * @see UiElement + * @see UiFocusable + */ + interface Tab extends UiStandardElement, UiFocusable { + /** + * Gets display state of the tab. + * @returns The display state, as either "expanded" or "collapsed" + */ + getDisplayState(): DisplayState; + + /** + * Gets the name of the tab. + * @returns The name. + */ + getName(): string; + + /** + * Gets a reference to the {@link FormContext.ui formContext.ui} parent of the tab. + * @returns The parent. + */ + getParent(): Ui; + + /** + * Sets display state of the tab. + * @param displayState Display state of the tab, as either "expanded" or "collapsed" + */ + setDisplayState(displayState: DisplayState): void; + + /** + * A reference to the collection of form sections within this tab. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + sections: Collection.ItemCollection
; + } + + /** + * Interface for a form section. + * @see UiElement + */ + interface Section extends UiStandardElement { + /** + * Gets the name of the section. + * @returns The name. + */ + getName(): string; + + /** + * Gets a reference to the parent {@link Tab}. + * @returns The parent. + */ + getParent(): Tab; + + /** + * A reference to the collection of controls within this tab. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + controls: Collection.ItemCollection; } interface AddControlNotificationOptions { @@ -3494,19 +3378,548 @@ declare namespace Xrm { */ actions: Array<() => void>; } + + interface ProcessControl extends UiCanGetVisibleElement, UiCanSetVisibleElement { + /** + * Sets display state of the process flow control. + * @param displayState Display state of the process flow control, as either "expanded" or "collapsed" + */ + setDisplayState(displayState: DisplayState): void; + + /** + * Gets the display state of the process flow control. + */ + getDisplayState(): DisplayState; + + /** + * Reflow the UI of the process control + * @param updateUI Specify true to update the UI of the process control; false otherwise. + * @param parentStage ID of the parent stage. + * @param nextStage ID of the next stage. + */ + reflow(updateUI: boolean, parentStage: string, nextStage: string): void; + } + + /** + * Interface for an entity's form selector item. + */ + interface FormItem { + /** + * Gets the unique identifier of the form. + * @returns The identifier, in Guid format. + */ + getId(): string; + + /** + * Gets the label for the form. + * @returns The label. + */ + getLabel(): string; + + /** + * Navigates the user to this form. + */ + navigate(): void; + } + + /** + * Interface for the form selector API. + */ + interface FormSelector { + /** + * Gets current form. + * @returns The current item. + * @remarks When only one form is available this method will return null. + */ + getCurrentItem(): FormItem; + + /** + * A reference to the collection of available forms. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + items: Collection.ItemCollection; + } + + /** + * Interface for the view selector. Use the ViewSelector methods to get or set information about the view selector + * of the grid control. + */ + interface ViewSelector { + /** + * Use this method to get a reference to the current view. + * @returns The current view. + */ + getCurrentView(): ViewSelectorItem; + + /** + * Use this method to determine whether the view selector is visible. + * @returns true if visible, false if not. + */ + isVisible(): boolean; + + /** + * Use this method to set the current view. + * @param viewSelectorItem The view selector item. + */ + setCurrentView(viewSelectorItem: ViewSelectorItem): void; + } + + /** + * Interface for a view selector item. This object contains data that identifies a view. Use this as a parameter to + * the ViewSelector.setCurrentView method. + */ + interface ViewSelectorItem { + /** + * Returns a LookupValue that references this view. + * @returns The entity reference. + */ + getEntityReference(): LookupValue; + } + } + + /** + * Interface for the form's record context, {@link Data.entity formContext.data.entity} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data-entity External Link: formContext.data.entity (Client API reference)} + */ + interface Entity { + /** + * Adds a handler to be called when the record is saved. + * @param handler The handler. + */ + addOnSave(handler: Events.ContextSensitiveHandler): void; + + /** + * Gets an serialized-XML string representing data that will be passed to the server upon saving the record. + * @returns The XML in string format. + * @remarks This function does not work with Microsoft Dynamics CRM for tablets. + * @example "Contoso55555425 + * 555-1234". + */ + getDataXml(): string; + + /** + * Gets entity's logical name. + * @returns The logical name. + */ + getEntityName(): string; + + /** + * Gets the record's unique identifier. + * @returns The identifier, in Guid format. + * @example Example: "{825CB223-A651-DF11-AA8B-00155DBA3804}". + */ + getId(): string; + + /** + * Gets a boolean value indicating whether the record has unsaved changes. + * @returns true if there are unsaved changes, otherwise false. + */ + getIsDirty(): boolean; + + /** + * Gets the record's primary attribute value. + * @returns The primary attribute value. + * @remarks The value for this attribute is used when links to the record are displayed. + */ + getPrimaryAttributeValue(): string; + + /** + * Removes the handler from the "on save" event. + * @param handler The handler. + */ + removeOnSave(handler: Events.ContextSensitiveHandler): void; + + /** + * Saves the record. + * @deprecated Deprecated in v9. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @remarks When using quick create forms in the web application the saveandnew option is not + * applied. It will always work as if saveandclose were used. Quick create forms in + * Microsoft Dynamics CRM for tablets will apply the saveandnew behavior. + */ + save(): void; + + /** + * Saves the record with the given save mode. + * @deprecated Deprecated in v9. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @param saveMode (Optional) the save mode to save, as either "saveandclose" or "saveandnew". + */ + save(saveMode: EntitySaveMode): void; + + /** + * The collection of attributes for the record. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/attributes External Link: Attributes (Client API reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + attributes: Collection.ItemCollection; + } + + namespace ProcessFlow { + /** + * Direction types for a process stage change event + * @see XrmEnum.StageChangeDirection + */ + type StageChangeDirection = "Next" | "Previous"; + + /** + * Status for {@link ProcessFlow.Stage.getStatus Stage.getStatus()}. + * @see XrmEnum.StageStatus + */ + type StageStatus = "active" | "inactive"; + + /** + * Status for {@link ProcessFlow.Process.getStatus Process.getStatus()}. + * @see XrmEnum.ProcessStatus + */ + type ProcessStatus = "active" | "aborted" | "finished"; + + /** + * Interface for a CRM Business Process Flow instance. + */ + interface Process { + /** + * Returns the unique identifier of the process. + * @returns The identifier for this process, in GUID format. + * @example Example: "{825CB223-A651-DF11-AA8B-00155DBA3804}". + */ + getId(): string; + + /** + * Returns the name of the process. + * @returns The name. + */ + getName(): string; + + /** + * Returns an collection of stages in the process. + * @returns The stages. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + getStages(): Collection.ItemCollection; + + /** + * Returns a boolean value to indicate if the process is rendered. + * @returns true if the process is rendered, false if not. + */ + isRendered(): boolean; + } + + /** + * Interface for CRM Business Process Flow stages. + */ + interface Stage { + /** + * Returns an object with a getValue method which will return the integer value of the business process flow + * category. + * @returns The stage category. + */ + getCategory(): { getValue(): XrmEnum.StageCategory }; + + /** + * Returns the logical name of the entity associated with the stage. + * @returns The entity name. + */ + getEntityName(): string; + + /** + * Returns the unique identifier of the stage. + * @returns The identifier of the Stage, in GUID format. + * @example Example: "{825CB223-A651-DF11-AA8B-00155DBA3804}". + */ + getId(): string; + + /** + * Returns the name of the stage. + * @returns The name. + */ + getName(): string; + + /** + * Returns the status of the stage. + * @returns The status, either "active" or "inactive". + */ + getStatus(): StageStatus; + + /** + * Returns a collection of steps in the stage. + * @returns An array of Step. + */ + getSteps(): Step[]; + } + + interface Step { + /** + * Returns the logical name of the attribute associated to the step. + * @returns The attribute. + * @remarks Some steps don’t contain an attribute value. + */ + getAttribute(): string; + + /** + * Returns the name of the step. + * @returns The name. + */ + getName(): string; + + /** + * Returns whether the step is required in the business process flow. + * @returns true if required, false if not. + * @remarks Returns true if the step is marked as required in the Business Process Flow editor; otherwise, false. + * There is no connection between this value and the values you can change in the formContext.data.entity + * attribute RequiredLevel methods. + */ + isRequired(): boolean; + } + + /** + * Interface for the formContext.data.process API. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data-process External Link: formContext.data.process (Client API reference)} + */ + interface ProcessManager { + /** + * Returns a Process object representing the active process. + * @returns current active process. + */ + getActiveProcess(): Process; + + /** + * Set a Process as the active process. + * @param processId The Id of the process to make the active process. + * @param callbackFunction (Optional) a function to call when the operation is complete. + */ + setActiveProcess(processId: string, callbackFunction?: ProcessCallbackDelegate): void; + + /** + * Returns all process instances for the entity record that the calling user has access to. + * @param callbackFunction (Optional) a function to call when the operation is complete. + */ + getProcessInstances(callbackFunction: GetProcessInstancesDelegate): void; + + /** + * Sets a process instance as the active instance + * @param processInstanceId The Id of the process instance to make the active instance. + * @param callbackFunction (Optional) a function to call when the operation is complete. + */ + setActiveProcessInstance(processInstanceId: string, callbackFunction: SetProcessInstanceDelegate): void; + + /** + * Returns a Stage object representing the active stage. + * @returns current active stage. + */ + getActiveStage(): Stage; + + /** + * Set a stage as the active stage. + * @param stageId the Id of the stage to make the active stage. + * @param callbackFunction (Optional) a function to call when the operation is complete. + */ + setActiveStage(stageId: string, callbackFunction?: ProcessCallbackDelegate): void; + + /** + * Use this method to get a collection of stages currently in the active path with methods to interact with the + * stages displayed in the business process flow control. The active path represents stages currently rendered in + * the process control based on the branching rules and current data in the record. + * @returns A collection of all completed stages, the currently active stage, and the predicted set of future stages + * based on satisfied conditions in the branching rule. This may be a subset of the stages returned with + * formContext.data.process.getActiveProcess because it will only include those stages which represent a valid + * transition from the current stage based on branching that has occurred in the process. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + getActivePath(): Collection.ItemCollection; + + /** + * Use this method to asynchronously retrieve the enabled business process flows that the user can switch to for an + * entity. + * @param callbackFunction The callback function must accept a parameter that contains an object with + * dictionary properties where the name of the property is the Id of the + * business process flow and the value of the property is the name of the + * business process flow. + * The enabled processes are filtered according to the user’s privileges. The + * list of enabled processes is the same ones a user can see in the UI if they + * want to change the process manually. + */ + getEnabledProcesses(callbackFunction: (enabledProcesses: ProcessDictionary) => void): void; + + /** + * Use this method to get the currently selected stage. + * @returns The currently selected stage. + */ + getSelectedStage(): Stage; + + /** + * Use this to add a function as an event handler for the OnStageChange event so that it will be called when the + * business process flow stage changes. + * @param handler The function will be added to the bottom of the event + * handler pipeline. The execution context is automatically + * set to be the first parameter passed to the event handler. + * Use a reference to a named function rather than an + * anonymous function if you may later want to remove the + * event handler. + */ + addOnStageChange(handler: Events.ContextSensitiveHandler): void; + + /** + * Use this to add a function as an event handler for the OnProcessStatusChange event so that it will be called when the + * business process flow status changes. + * @param handler The function will be added to the bottom of the event + * handler pipeline. The execution context is automatically + * set to be the first parameter passed to the event handler. + * Use a reference to a named function rather than an + * anonymous function if you may later want to remove the + * event handler. + */ + addOnProcessStatusChange(handler: Events.ProcessStatusChangeHandler): void; + + /** + * Use this to add a function as an event handler for the OnStageSelected event so that it will be called + * when a business process flow stage is selected. + * @param handler The function will be added to the bottom of the event + * handler pipeline. The execution context is automatically + * set to be the first parameter passed to the event handler. + * Use a reference to a named function rather than an + * anonymous function if you may later want to remove the + * event handler. + */ + addOnStageSelected(handler: Events.ContextSensitiveHandler): void; + + /** + * Use this to remove a function as an event handler for the OnProcessStatusChange event. + * @param handler If an anonymous function is set using the addOnProcessStatusChange method it + * cannot be removed using this method. + */ + removeOnProcessStatusChange(handler: Events.ProcessStatusChangeHandler): void; + + /** + * Use this to remove a function as an event handler for the OnStageChange event. + * @param handler If an anonymous function is set using the addOnStageChange method it + * cannot be removed using this method. + */ + removeOnStageChange(handler: Events.ContextSensitiveHandler): void; + + /** + * Use this to remove a function as an event handler for the OnStageChange event. + * @param handler If an anonymous function is set using the addOnStageChange method it + * cannot be removed using this method. + */ + removeOnStageSelected(handler: Events.ContextSensitiveHandler): void; + + /** + * Progresses to the next stage. + * @param callbackFunction (Optional) A function to call when the operation is complete. + */ + moveNext(callbackFunction?: ProcessCallbackDelegate): void; + + /** + * Moves to the previous stage. + * @param callbackFunction (Optional) A function to call when the operation is complete. + * . + */ + movePrevious(callbackFunction?: ProcessCallbackDelegate): void; + + /** + * Use this method to get the unique identifier of the process instance + * @returns The unique identifier of the process instance + */ + getInstanceId(): string; + + /** + * Use this method to get the name of the process instance + * @returns The name of the process instance + */ + getInstanceName(): string; + + /** + * Use this method to get the current status of the process instance + * @returns The current status of the process + */ + getStatus(): ProcessStatus; + + /** + * Use this method to set the current status of the process instance + * @param status The new status for the process + * @param callbackFunction (Optional) a function to call when the operation is complete. + */ + setStatus(status: ProcessStatus, callbackFunction: ProcessSetStatusDelegate): void; + } + + /** + * Called when method to get active processes is complete + * @param status The result of the get active processes operation. + * @remarks Returns object with the following key-value pairs: + * CreatedOn + * ProcessDefinitionID + * ProcessDefinitionName + * ProcessInstanceID + * ProcessInstanceName + * StatusCodeName + */ + type GetProcessInstancesDelegate = (object: ProcessDictionary) => void; + + /** + * Called when method to set active process is complete + * @param status The result of the set active process operation. + * @remarks Values returned are: success (The operation succeeded.) + * invalid (The processInstanceId isn’t valid or the process isn’t enabled.) + */ + type SetProcessInstanceDelegate = (status: string) => void; + + /** + * Called when process change methods have completed. + * @param status The result of the process change operation. + * @remarks Values returned are: success (The operation succeeded.) + * crossEntity (The previous stage is for a different entity.) + * beginning (The active stage is the first stage of the active path.) + * invalid (The operation failed because the selected stage isn’t the same + * as the active stage.) + * unreachable (The stage exists on a different path.) + */ + type ProcessCallbackDelegate = (status: string) => void; + + /** + * Called when process set status method has completed. + * @param status The new status of the process instance: active, aborted, or finished + */ + type ProcessSetStatusDelegate = (status: ProcessStatus) => void; + + /** + * Represents a key-value pair, where the key is the Process Flow's ID, and the value is the name thereof. + */ + interface ProcessDictionary { + [index: string]: string; + } + } + + /** + * Interface for a user attribute privilege. + */ + interface Privilege { + /** + * True if the user can read. + */ + canRead: boolean; + + /** + * True if the user can update. + */ + canUpdate: boolean; + + /** + * True if the user can create. + */ + canCreate: boolean; } /** * An definition module for URL-based, CRM component parameters. - * - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx} for details. + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} */ namespace Url { /** * Command Bar Display options for Xrm.Url.FormOpenParameters.cmdbar, Xrm.Url.ViewOpenParameters.cmdbar, and Xrm.Utility.FormOpenParameters.cmdbar. */ - type CmdBarDisplay = "true" | "false"; + /** * Navigation Bar Display options for Xrm.Url.FormOpenParameters.navbar, Xrm.Url.ViewOpenParameters.navbar, and Xrm.Utility.FormOpenParameters.navbar. */ @@ -3521,9 +3934,7 @@ declare namespace Xrm { * Interface for defining parameters on a request to open a form with main.aspx (as with * window.open). Useful for parsing the keys and values into a string of the format: * "&key=value". - * - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx} for details. - * + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} * @remarks A member for "pagetype" is not provided. The value "entityrecord" is required in * the URL, for forms. Example: "pagetype=entityrecord" */ @@ -3537,8 +3948,7 @@ declare namespace Xrm { * Additional parameters can be provided to the request. This can only be used to provide * default field values for the form, or pass data to custom parameters that have been * customized for the form. See example below for setting the selected form. - * - * @remarks Example: encodeURIComponent("formid={8c9f3e6f-7839-e211-831e-00155db7d98f}"); + * @example Example: encodeURIComponent("formid={8c9f3e6f-7839-e211-831e-00155db7d98f}"); */ extraqs?: string; @@ -3564,7 +3974,7 @@ declare namespace Xrm { * window.open). Useful for parsing the keys and values into a string of the format: * "&key=value". * - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx} for details. + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} * * @remarks A member for "pagetype" is not provided. The value "entitylist" is required in * the URL, for views. Example: "pagetype=entitylist" @@ -3583,7 +3993,6 @@ declare namespace Xrm { /** * The type of view identified by {@link viewid}. - * * @remarks Accepted values are: 1039 System View * 4230 User View. */ @@ -3610,8 +4019,7 @@ declare namespace Xrm { * Interface for defining parameters of a request to open a dialog with rundialog.aspx (as with * window.open). Useful for parsing the keys and values into a string of the format: * "&key=value". - * - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx} for details. + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} */ interface DialogOpenParameters { /** @@ -3636,7 +4044,7 @@ declare namespace Xrm { * window.open). Useful for parsing out the keys and values into a string of the format: * "&key=value" * - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx} for details. + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} */ interface ReportOpenParameters { /** @@ -3663,7 +4071,7 @@ declare namespace Xrm { /** * The Xrm.Utility API * - * @see {@link http://msdn.microsoft.com/en-us/library/gg328255.aspx|Documentation} for details. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-utility External Link: Xrm.Utility (Client API reference)} */ namespace Utility { /** @@ -3718,8 +4126,7 @@ declare namespace Xrm { /** * Namespace to hold Xrm.Navigation related types - * - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-navigation} for details + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-navigation External Link: Xrm.Navigation (Client API reference)} */ namespace Navigation { interface AlertStrings { @@ -3750,12 +4157,12 @@ declare namespace Xrm { subtitle?: string; /** - * (Optional) The title to be displyed in the confirmation dialog. + * (Optional) The title to be displyed in the confirmation dialog. */ - title: string; + title?: string; /** - * The message to be displyed in the alert dialog. + * The message to be displyed in the alert dialog. */ text: string; } @@ -3773,7 +4180,7 @@ declare namespace Xrm { interface OpenWebresourceOptions extends DialogSizeOptions { /** - * Indicates whether to open the web resource in a new window. + * Indicates whether to open the web resource in a new window. */ openInNewWindow: boolean; } @@ -3839,7 +4246,7 @@ declare namespace Xrm { /** * Designates a record that will provide default values based on mapped attribute values.The lookup object has the following String properties: entityType, id, and name (optional). */ - createFromEntity?: Page.LookupValue; + createFromEntity?: LookupValue; /** * ID of the entity record to display the form for. */ @@ -3925,7 +4332,7 @@ declare namespace Xrm { * 0:OneToMany * 1:ManyToMany */ - relationshipType?: XrmEnum.RelationshipType; // + relationshipType?: XrmEnum.RelationshipType; // /** * Role type in relationship.Specify one of the following values: * 1:Referencing @@ -3941,7 +4348,7 @@ declare namespace Xrm { interface Navigation { /** * Displays an alert dialog containing a message and a button. - * @param alertStrings The strings to be used in the alert dialog. + * @param alertStrings The strings to be used in the alert dialog. * @param alertOptions The height and width options for alert dialog */ openAlertDialog(alertStrings: Navigation.AlertStrings, alertOptions: Navigation.DialogSizeOptions): Async.PromiseLike; @@ -3973,7 +4380,7 @@ declare namespace Xrm { /** * Opens a URL, including file URLs. * @param url URL to open. - * @param openUrlOptions Options to open the URL + * @param openUrlOptions Options to open the URL */ openUrl(url: string, openUrlOptions?: Navigation.DialogSizeOptions): void; @@ -3981,7 +4388,7 @@ declare namespace Xrm { * Opens an HTML web resource. * @param webResourceName Name of the HTML web resource. * @param windowOptions (Optional) Window options for opening the web resource. - * It is advised to use encodeURIcomponent() to encode the value. + * It is advised to use encodeURIcomponent() to encode the value. */ openWebResource(webResourceName: string, windowOptions?: Navigation.OpenWebresourceOptions, data?: string): void; } @@ -3995,6 +4402,9 @@ declare namespace Xrm { */ interface EntityMetadata { ActivityTypeMask: number; + /** + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ Attributes: Collection.ItemCollection; AutoRouteToOwnerQueue: boolean; CanEnableSyncToExternalSearchIndex: boolean; @@ -4050,13 +4460,18 @@ declare namespace Xrm { RecurrenceBaseEntityLogicalName: string; PrimaryImageAttribute: string; } + /** * Type to hold Labels as part of the EntityMetadata */ interface Label { + /** + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ LocalizedLabels: Collection.ItemCollection; UserLocalizedLabel: LocalizedLabel; } + /** * Type to hold a Label as part of the EntityMetadata */ @@ -4064,18 +4479,26 @@ declare namespace Xrm { Label: string; LanguageCode: number; } + /** * Type to hold the Attribute metadata as part of the EntityMetadata */ interface AttributeMetadata { defaultFormValue: number; + /** + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ options: Collection.ItemCollection; logicalName: string; displayName: string; attributeType: XrmEnum.AttributeTypeCode; entityLogicalName: string; + /** + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ optionSet: Collection.ItemCollection; } + /** * Type to hold the optionset metadata as part of the EntityMetadata */ @@ -4095,7 +4518,7 @@ declare namespace Xrm { /** * Namespace to hold Xrm.Device related types - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-device} for details + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-device External Link: Xrm.Device (Client API reference)} */ namespace Device { /** @@ -4186,47 +4609,41 @@ declare namespace Xrm { /** * Interface for Xrm.Device API - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-device} for details + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-device External Link: Xrm.Device (Client API reference)} */ interface Device { /** * Invokes the device microphone to record audio. - * * @returns On success, returns Base64 encoded file */ captureAudio(): Async.PromiseLike; /** * Invokes the device camera to capture an image. - * * @returns On success, returns Base64 encoded file */ captureImage(imageOptions: Device.CaptureImageOptions): Async.PromiseLike; /** * Invokes the device camera to capture video. - * * @returns On success, returns Base64 encoded file */ captureVideo(): Async.PromiseLike; /** * Invokes the device camera to scan the barcode information, such as a product number. - * * @returns On success, Barcode value is returned as a String */ getBarcodeValue(): Async.PromiseLike; /** * Returns the current location using the device geolocation capability. - * * @returns On success, returns current geolocation information */ getCurrentPosition(): Async.PromiseLike; /** * Opens a dialog box to select files from your computer (web client) or mobile device (mobile clients). - * * @returns On success, returns an array of files */ pickFile(pickFileOptions: Device.PickFileOptions): Async.PromiseLike; @@ -4234,23 +4651,19 @@ declare namespace Xrm { /** * Interface for Xrm.Encoding API - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-encoding} for details + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-encoding External Link: Xrm.Encoding (Client API reference)} */ interface Encoding { /** * Applies attribute encoding to a string. - * * @param arg String to be encoded. - * * @returns Encoded string. */ xmlAttributeEncode(arg: string): string; /** * Applies XML encoding to a string. - * * @param arg String to be encoded. - * * @returns Encoded string. */ xmlEncode(arg: string): string; @@ -4258,14 +4671,12 @@ declare namespace Xrm { /** * Provides properties and methods to use Web API to create and manage records and execute Web API actions and functions in Customer Engagement. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi} for details + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi External Link: Xrm.WebApi (Client API reference)} */ - interface WebApi extends WebApiBase { + interface WebApi extends WebApiOffline { /** * Returns a boolean value indicating whether an entity is offline enabled. - * - * @param entityLogicalName Logical name of the entity. For example: "account". - * + * @param entityLogicalName Logical name of the entity. For example: "account". * @returns true if the entity is offline enabled; otherwise false. */ isAvailableOffline(entityLogicalName: string): boolean; @@ -4273,74 +4684,122 @@ declare namespace Xrm { /** * Provides methods to use Web API to create and manage records and execute Web API actions and functions in Customer Engagement when connected to the Customer Engagement server (online mode). */ - online: WebApi; + online: WebApiOnline; /** * Provides methods to create and manage records in the Dynamics 365 Customer Engagement mobile clients while working in the offline mode. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/offline} for details + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/offline} */ - offline: WebApi; + offline: WebApiOffline; } /** - * Interface for the Xrm.WebApi API + * Interface for the Xrm.WebApi.online API + * Execute and ExecuteMultiple are only available when online, not offline. */ - interface WebApiBase { + interface WebApiOnline extends WebApiOffline { + /** + * Execute a single action, function, or CRUD operation. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/execute External Link: execute (Client API reference)} + * @param request Object that will be passed to the Web API endpoint to execute an action, function, or CRUD request. + * The object exposes a getMetadata method that lets you define the metadata for the action, function or CRUD request you want to execute. + * The getMetadata method has the following parameters: + * -boundParameter: (Optional) String. The name of the bound parameter for the action or function to execute. + * Specify undefined if you are executing a CRUD request. + * Specify null if the action or function to execute is not bound to any entity. + * Specify entity logical name or entity set name in case the action or function to execute is bound to one. + * -operationName: (Optional). String. Name of the action, function, or one of the following values if you are executing a CRUD request: "Create", "Retrieve", "RetrieveMultiple", "Update", or "Delete". + * -operationType: (Optional). Number. Indicates the type of operation you are executing; specify one of the following values: + * 0: Action + * 1: Function + * 2: CRUD + * -parameterTypes: Object. The metadata for parameter types. The object has the following attributes: + * -enumProperties: (Optional) Object. The metadata for enum types. The object has two string attributes: name and value + * -structuralProperty: Number. The category of the parameter type. Specify one of the following values: + * 0: Unknown + * 1: PrimitiveType + * 2: ComplexType + * 3: EnumerationType + * 4: Collection + * 5: EntityType + * -typeName: String. The fully qualified name of the parameter type. + */ + execute(request: any): Async.PromiseLike; + + /** + * Execute a collection of action, function, or CRUD operations. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/executemultiple External Link: executeMultiple (Client API reference)} + * @param request An array of one of one of the following types: + * -objects where each object is an action, function, or CRUD request that you want to execute + * against the Web API endpoint. Each object exposes a getMetadata method that lets you define + * the metadata for the action, function or CRUD request you want to execute. This is the same + * object that you pass in the execute method. For information about the object, see execute. + * -change set (an array of objects), where each object in the change set is as defined above. + * In this case, all the request objects specified in the change set will get executed in a + * transaction. + */ + executeMultiple(request: any[]): Async.PromiseLike; + } + + /** + * Interface for the Xrm.WebApi.offline API + */ + interface WebApiOffline { /** * Creates an entity record - * * @param entityLogicalName Logical name of the entity you want to create. For example: "account". * @param record A JSON object defining the attributes and values for the new entity record. - * - * @return On success, returns a promise object containing the attributes specified earlier in the description of the successCallback parameter. + * @returns On success, returns a promise object containing the attributes specified earlier in the description of the successCallback parameter. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/createrecord External Link: createRecord (Client API reference)} */ createRecord(entityLogicalName: string, record: any): Async.PromiseLike; /** * Deletes an entity record. - * * @param entityLogicalName The entity logical name of the record you want to delete. For example: "account". * @param id GUID of the entity record you want to delete. - * - * @return On success, returns a promise object containing the attributes specified earlier in the description of the successCallback parameter. + * @returns On success, returns a promise object containing the attributes specified earlier in the description of the successCallback parameter. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/deleterecord External Link: deleteRecord (Client API reference)} */ deleteRecord(entityLogicalName: string, id: string): Async.PromiseLike; /** * Retrieves an entity record. - * * @param entityLogicalName The entity logical name of the record you want to retrieve. For example: "account". * @param id GUID of the entity record you want to retrieve. - * @param options (Optional) OData system query options, $select and $expand, to retrieve your data. - * -Use the $select system query option to limit the properties returned by including a comma-separated list of property names. - * This is an important performance best practice. If properties aren’t specified using $select, all properties will be returned. - * -Use the $expand system query option to control what data from related entities is returned. - * If you just include the name of the navigation property, you’ll receive all the properties for related records. - * You can limit the properties returned for related records using the $select system query option in parentheses - * after the navigation property name. Use this for both single-valued and collection-valued navigation properties. - * You can also specify multiple query options by using & to separate the query options. For example: - * $select=name&$expand=primarycontactid($select=contactid,fullname) - * - * @return On success, returns a promise containing a JSON object with the retrieved attributes and their values. + * @param options (Optional) OData system query options, $select and $expand, to retrieve your data. + * -Use the $select system query option to limit the properties returned by including a comma-separated + * list of property names. This is an important performance best practice. If properties aren’t + * specified using $select, all properties will be returned. + * -Use the $expand system query option to control what data from related entities is returned. If you + * just include the name of the navigation property, you’ll receive all the properties for related + * records. You can limit the properties returned for related records using the $select system query + * option in parentheses after the navigation property name. Use this for both single-valued and + * collection-valued navigation properties. + * You can also specify multiple query options by using & to separate the query options. + * @example: options example: + * options: $select=name&$expand=primarycontactid($select=contactid,fullname) + * @returns On success, returns a promise containing a JSON object with the retrieved attributes and their values. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/retrieverecord External Link: retrieveRecord (Client API reference)} */ retrieveRecord(entityLogicalName: string, id: string, options: string): Async.PromiseLike; /** * Retrieves a collection of entity records. * @param entityLogicalName The entity logical name of the records you want to retrieve. For example: "account". - * @param options (Optional) OData system query options or FetchXML query to retrieve your data. - * Following system query options are supported: $select, $top, $filter, $expand, and $orderby. - * To specify a FetchXML query, use the fetchXml attribute to specify the query. - * NOTE: You must always use the $select system query option to limit the properties returned for an entity record - * by including a comma-separated list of property names. This is an important performance best practice. - * If properties aren’t specified using $select, all properties will be returned. - * You can specify multiple system query options by using & to separate the query options. - * @param maxPageSize (Optional) Specify a positive number that indicates the number of entity records to be returned per page. - * If you do not specify this parameter, the default value is passed as 5000. - * If the number of records being retrieved is more than the specified maxPageSize value, nextLink attribute in the returned - * Promise object will contain a link to retrieve the next set of entities. + * @param options (Optional) OData system query options or FetchXML query to retrieve your data. + * Following system query options are supported: $select, $top, $filter, $expand, and $orderby. + * To specify a FetchXML query, use the fetchXml attribute to specify the query. + * NOTE: You must always use the $select system query option to limit the properties returned for an entity + * record by including a comma-separated list of property names. This is an important performance best practice. + * If properties aren’t specified using $select, all properties will be returned. * - * @return On success, returns a promise object containing the attributes specified earlier in the description of the successCallback parameter. + * You can specify multiple system query options by using & to separate the query options. + * @param maxPageSize (Optional) Specify a positive number that indicates the number of entity records to be returned per page. + * If you do not specify this parameter, the default value is passed as 5000. If the number of records being retrieved is more than the specified + * maxPageSize value, nextLink attribute in the returned promise object will contain a link to retrieve the next set of entities. + * @returns On success, returns a promise object containing the attributes specified earlier in the description of the successCallback parameter. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/retrievemultiplerecords External Link: retrieveMultipleRecords (Client API reference)} */ retrieveMultipleRecords(entityLogicalName: string, options?: string, maxPageSize?: number): Async.PromiseLike; @@ -4349,30 +4808,10 @@ declare namespace Xrm { * @param entityLogicalName The entity logical name of the record you want to update. For example: "account". * @param id GUID of the entity record you want to update. * @param Data A JSON object containing key: value pairs, where key is the property of the entity and value is the value of the property you want update. - * - * @return On success, returns a promise object containing the attributes specified earlier in the description of the successCallback parameter. + * @returns On success, returns a promise object containing the attributes specified earlier in the description of the successCallback parameter. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/updaterecord External Link: updateRecord (Client API reference)} */ updateRecord(entityLogicalName: string, id: string, data: any): Async.PromiseLike; - - /** - * Execute a single action, function, or CRUD operation. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/execute} for more info - * @param request Object that will be passed to the Web API endpoint to execute an action, function, or CRUD request. - */ - execute(request: any): Async.PromiseLike; - - /** - * Execute a collection of action, function, or CRUD operations. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/executemultiple} for more info - * @param request An array of one of one of the following types: - * -objects where each object is an action, function, or CRUD request that you want to execute - * against the Web API endpoint. Each object exposes a getMetadata method that lets you - * define the metadata for the action, function or CRUD request you want to execute. - * This is the same object that you pass in the execute method. For information about the object, see execute. - * -Change set (an array of objects), where each object in the change set is as defined above. - * In this case, all the request objects specified in the change set will get executed in a transaction. - */ - executeMultiple(request: any[]): Async.PromiseLike; } /** @@ -4414,11 +4853,13 @@ declare namespace Xrm { */ ok: boolean; /** - * Numeric value in the response status code.For example: 200 + * Numeric value in the response status code. + * @example 200 */ status: number; /** - * Description of the response status code.For example: OK + * Description of the response status code. + * @example "OK" */ statusText: string; /** @@ -4442,7 +4883,15 @@ declare namespace XrmEnum { Update = 2, ReadOnly = 3, Disabled = 4, - BulkEdit = 6 + BulkEdit = 6, + /** + * @deprecated QuickCreate has been deprecated + */ + QuickCreate = 5, + /** + * @deprecated ReadOptimized has been deprecated. + */ + ReadOptimized = 11, } /** @@ -4459,7 +4908,7 @@ declare namespace XrmEnum { Assign = 47, Send = 7, Qualify = 16, - Disqualify = 15 + Disqualify = 15, } /** @@ -4472,7 +4921,7 @@ declare namespace XrmEnum { Close = 3, Identify = 4, Research = 5, - Resolve = 6 + Resolve = 6, } /** @@ -4483,7 +4932,7 @@ declare namespace XrmEnum { RibbonContextForm = 1, RibbonContextListing = 2, FormContextUnrelated = 3, - FormContextRelated = 4 + FormContextRelated = 4, } /** @@ -4491,7 +4940,7 @@ declare namespace XrmEnum { */ const enum ViewType { SystemView = 1039, - UserView = 4230 + UserView = 4230, } /** @@ -4518,7 +4967,7 @@ declare namespace XrmEnum { Virtual = 17, BigInt = 18, ManagedProperty = 19, - EntityName = 20 + EntityName = 20, } /** @@ -4528,7 +4977,7 @@ declare namespace XrmEnum { None = 0, SystemRequired = 1, ApplicationRequired = 2, - Recommended = 3 + Recommended = 3, } /** @@ -4536,7 +4985,7 @@ declare namespace XrmEnum { */ const enum OpenFileOptions { Open = 1, - Save = 2 + Save = 2, } /** @@ -4544,7 +4993,7 @@ declare namespace XrmEnum { */ const enum WindowPositions { Center = 1, - Side = 2 + Side = 2, } /** @@ -4552,7 +5001,7 @@ declare namespace XrmEnum { */ const enum RelationshipType { OneToMany = 0, - ManyToMany = 1 + ManyToMany = 1, } /** @@ -4560,13 +5009,206 @@ declare namespace XrmEnum { */ const enum RoleType { Referencing = 1, - AssociationEntity = 2 + AssociationEntity = 2, } const enum ClientFormFactor { Unknown = 1, Desktop = 2, Tablet = 3, - Phone = 4 + Phone = 4, + } + + /** + * Constant Enum: Client Types for {@link GlobalContext.getClient globalContext.getClient()}. + * @see Xrm.Client + */ + const enum Client { + Web = "Web", + Outlook = "Outlook", + Mobile = "Mobile", + UnifiedServiceDesk = "UnifiedServiceDesk", + USD = "UnifiedServiceDesk" + } + + /** + * Constant Enum: Client States for {@link GlobalContext.getClientState globalContext.getClientState()}. + * @see Xrm.ClientState + */ + const enum ClientState { + Online = "Online", + Offline = "Offline" + } + + /** + * Constant Enum: Display States for setDisplayState() on {@link Controls.ProcessControl.setDisplayState Processes} and {@link Controls.Tab.setDisplayState Tabs}. + * @see Xrm.DisplayState + */ + const enum DisplayState { + Expanded = "expanded", + Collapsed = "collapsed" + } + + /** + * Constant Enum: {@link Entity.save Entity} Save Modes + * @see Xrm.EntitySaveMode + * @see Entity + * @see Entity.save + */ + const enum EntitySaveMode { + SaveAndClose = "saveandclose", + SaveAndNew = "saveandnew" + } + + /** + * Constant Enum: Form Notification Levels for {@link Ui.setFormNotification formContext.ui.setFormNotification()}. + * @see Xrm.FormNotificationLevel + */ + const enum FormNotificationLevel { + Error = "ERROR", + Info = "INFO", + Warning = "Warning" + } + + /** + * Constant Enum: Submit Modes for {@link Attributes.Attribute.setSubmitMode} Attributes.Attribute.setSubmitMode(). + * @see Xrm.SubmitMode + */ + const enum SubmitMode { + Always = "always", + Dirty = "dirty", + Never = "never" + } + + /** + * Constant Enum: Themes for {@link GlobalContext.getCurrentTheme globalContext.getCurrentTheme()}. + * Note: getCurrentTheme() does not work with Dynamics CRM for tablets or in the unified interface. + */ + const enum Theme { + Default = "default", + Office12Blue = "Office12Blue", + Office14Silver = "Office14Silver" + } + + /** + * Constant Enum: Settings for {@link GlobalContext.getAdvancedConfigSetting globalContext.getAdvancedConfigSetting(setting)} + */ + const enum AdvancedConfigSettingOption { + MaxChildIncidentNumber = "MaxChildIncidentNumber", + MaxIncidentMergeNumber = "MaxIncidentMergeNumber" + } + + /** + * Constant Enum: Requirement Level for {@link Attributes.Attribute.getRequiredLevel Attributes.Attribute.getRequiredLevel()} and + * {@link Attributes.Attribute.setRequiredLevel Attributes.Attribute.setRequiredLevel()}. + * @see Xrm.Attributes.RequirementLevel + */ + const enum AttributeRequirementLevel { + None = "none", + Recommended = "recommended", + Required = "required" + } + + /** + * Constant Enum: Date attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.DateAttribute DateAttribute}. + * @see Xrm.Attributes.DateAttributeFormat + */ + const enum DateAttributeFormat { + Date = "date", + DateTime = "datetime" + } + + /** + * Constant Enum: Integer attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.NumberAttribute NumberAttribute}. + * @see Xrm.Attributes.IntegerAttributeFormat + */ + const enum IntegerAttributeFormat { + Duration = "duration", + None = "none" + } + + /** + * Constant Enum: OptionSet attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.OptionSetAttribute OptionSetAttribute}. + * @see Xrm.Attributes.OptionSetAttributeFormat + */ + const enum OptionSetAttributeFormat { + Language = "language", + TimeZone = "timezone" + } + + /** + * Constant Enum: String attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.StringAttribute StringAttribute}. + * @see Xrm.Attributes.StringAttributeFormat + */ + const enum StringAttributeFormat { + Email = "email", + Phone = "phone", + Text = "text", + TextArea = "textarea", + TickerSymbol = "tickersymbol", + URL = "url" + } + + /** + * Constant Enum: Attribute types for {@link Attributes.Attribute.setDisplayState()}. + * @see Xrm.Attributes.AttributeType + */ + const enum AttributeType { + Boolean = "boolean", + DateTime = "datetime", + Decimal = "decimal", + Double = "double", + Integer = "integer", + Lookup = "lookup", + Memo = "memo", + Money = "money", + OptionSet = "optionset", + String = "string" + } + + /** + * Constant Enum: Control types for {@link Controls.Control.getControlType Controls.Control.getControlType()}. + * @see Xrm.Controls.ControlType + */ + const enum StandardControlType { + Standard = "standard", + IFrame = "iframe", + Lookup = "lookup", + OptionSet = "optionset", + SubGrid = "subgrid", + WebResource = "webresource", + Notes = "notes", + TimerControl = "timercontrol", + KBSearch = "kbsearch", + TimeLineWall = "timelinewall", + QuickForm = "quickform" + } + + /** + * Constant Enum: Direction types for a process stage change event + * @see ProcessFlow.StageChangeDirection + */ + const enum StageChangeDirection { + Next = "Next", + Previous = "Previous" + } + + /** + * Constant Enum: Status for {@link ProcessFlow.Stage.getStatus Stage.getStatus()}. + * @see ProcessFlow.StageStatus + */ + const enum StageStatus { + Active = "active", + Inactive = "inactive" + } + + /** + * Constant Enum: Status for {@link ProcessFlow.Process.getStatus Process.getStatus()}. + * @see ProcessFlow.ProcessStatus + */ + const enum ProcessStatus { + Active = "active", + Aborted = "aborted", + Finished = "finished" } } From ab9aae1cfb5f475a7838e5475999b6b829d6edb6 Mon Sep 17 00:00:00 2001 From: Carlton Colter Date: Fri, 24 Nov 2017 19:47:42 -0500 Subject: [PATCH 46/90] Modified to allow empty interfaces Empty interfaces need to be allowed. They are being used to allow the use of deprecated items before they are removed from the javascript api. It will help people be able to see what they are using is deprecated and needs to be called differently without the need for us to copy and paste the replicated objects, which largely at this point, most of them are. --- types/xrm/tslint.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/xrm/tslint.json b/types/xrm/tslint.json index f4cc3f2d22..6164356b33 100644 --- a/types/xrm/tslint.json +++ b/types/xrm/tslint.json @@ -18,6 +18,7 @@ "double" ], "jsdoc-format": true, - "no-unnecessary-generics": false + "no-unnecessary-generics": false, + "no-empty-interface": false } } From 170e250976ae92292622e241f0b222652650aeac Mon Sep 17 00:00:00 2001 From: Carlton Colter Date: Fri, 24 Nov 2017 20:04:07 -0500 Subject: [PATCH 47/90] Fixed External Links Fixed a few links. All external links that do not link to an obejct in the definition are tagged with "External Link: " --- types/xrm/index.d.ts | 87 +++++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 42 deletions(-) diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index 93a09dc19a..9914598cad 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -37,7 +37,7 @@ declare namespace Xrm { /** * Provides a namespace container for the context, data and ui objects. * @deprecated Deprecated in v9. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ Page: Page; @@ -69,7 +69,7 @@ declare namespace Xrm { * * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi External Link: Xrm.WebApi (Client API reference)} * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/use-microsoft-dynamics-365-web-api External Link: Use the Customer Engagement Web API} - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/get-started-web-api-client-side-javascript Get started with the Customer Engagement Web API (client-side JavaScript)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/get-started-web-api-client-side-javascript External Link: Get started with the Customer Engagement Web API (client-side JavaScript)} */ WebApi: WebApi; @@ -375,7 +375,7 @@ declare namespace Xrm { /** * Gets whether automatic save is enabled. * @deprecated Deprecated in v9. Use {@link Xrm.OrganizationSettings.isAutoSaveEnabled globalContext.organizationSettings.isAutoSaveEnabled} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @returns true if automatic saving is enabled, otherwise false. */ getIsAutoSaveEnabled(): boolean; @@ -383,7 +383,7 @@ declare namespace Xrm { /** * Gets organization's LCID (language code). * @deprecated Deprecated in v9. Use {@link Xrm.OrganizationSettings.languageId globalContext.organizationSettings.languageId} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @returns The organization language code. * @see {@link http://msdn.microsoft.com/en-us/library/ms912047(WinEmbedded.10).aspx External Link: Microsoft Locale ID Values} */ @@ -394,7 +394,7 @@ declare namespace Xrm { * * Note: This value can be found on the Developer Resources page within Dynamics CRM. * @deprecated Deprecated in v9. Use {@link Xrm.OrganizationSettings.uniqueName} globalContext.organizationSettings.uniqueName instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @returns The organization's unique name. */ getOrgUniqueName(): string; @@ -403,7 +403,7 @@ declare namespace Xrm { * Gets query string parameters. * @returns The query string parameters, in a dictionary object representing name and value pairs. * @deprecated Deprecated in v9 (Still applicable in Web Client). - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ getQueryStringParameters(): { [index: string]: any }; @@ -417,7 +417,7 @@ declare namespace Xrm { /** * Gets user's unique identifier. * @deprecated Deprecated in v9. Use {@link Xrm.UserSettings.userId globalContext.userSettings.userId} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @returns The user's identifier in Guid format. * @example Example: "{B05EC7CE-5D51-DF11-97E0-00155DB232D0}" */ @@ -426,7 +426,7 @@ declare namespace Xrm { /** * Gets user's LCID (language code). * @deprecated Deprecated in v9. Use {@link Xrm.UserSettings.languageId globalContext.userSetings.languageId} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @returns The user's language code. * * @see {@link http://msdn.microsoft.com/en-us/library/ms912047(WinEmbedded.10).aspx External Link: Microsoft Locale ID Values} @@ -436,7 +436,7 @@ declare namespace Xrm { /** * Gets the name of the current user. * @deprecated Deprecated in v9. Use {@link Xrm.UserSettings.userName globalContext.userSettings.userName} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @returns The user's name. */ getUserName(): string; @@ -444,7 +444,7 @@ declare namespace Xrm { /** * Gets all user security roles. * @deprecated Deprecated in v9. Use {@link Xrm.UserSettings.securityRoles globalContext.userSettings.securityRoles} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @returns An array of user role identifiers, in Guid format. * @example Example: ["cf4cc7ce-5d51-df11-97e0-00155db232d0"] */ @@ -541,6 +541,9 @@ declare namespace Xrm { /** * Interface for the event context. + * In the API documentation, this is sometimes refferred to as the executionContext. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/clientapi-execution-context External Link: Client API execution context} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/execution-context External Link: Execution context (Client API reference)} */ interface EventContext { /** @@ -994,7 +997,7 @@ declare namespace Xrm { /** * Displays an alert dialog, with an "OK" button. * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openAlertDialog} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @param message The message. * @param onCloseCallback The "OK" callback. */ @@ -1003,7 +1006,7 @@ declare namespace Xrm { /** * Displays a confirmation dialog, with "OK" and "Cancel" buttons. * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openConfirmDialog} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @param message The message. * @param yesCloseCallback The "OK" callback. * @param noCloseCallback The "Cancel" callback. @@ -1015,7 +1018,7 @@ declare namespace Xrm { * @deprecated Deprecated in v9. Use {@link Xrm.Utility.getEntityMetadata Xrm.Utility.getEntityMetadata(entityName, ["IsActivity"])} instead. * @remarks The isActivityType method is synchronous so it was suitable for ribbon rules. * However, the replacement method, getEntityMetadata, is asynchronous, and is not suitable for ribbon rules. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @param entityType Type of the entity. * @returns true if the entity is an Activity, false if not. */ @@ -1024,7 +1027,7 @@ declare namespace Xrm { /** * Opens quick create. * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openForm} instead with the option {useQuickCreateForm:true}. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @param entityLogicalName The logical name of the entity to create. * @param createFromEntity (Optional) Designates a record that will provide default values based on mapped attribute values. * @param parameters (Optional) A dictionary object that passes extra query string parameters to the form. Invalid query string parameters will cause an error. @@ -1036,7 +1039,7 @@ declare namespace Xrm { /** * Opens an entity form. * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openForm} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @param name The entity's logical name. * @param id (Optional) The unique identifier for the record. * @param parameters (Optional) A dictionary object that passes extra query string parameters to the form. @@ -1047,7 +1050,7 @@ declare namespace Xrm { /** * Opens an HTML Web Resource in a new browser window. * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openWebResource} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @param webResourceName Name of the HTML web resource. Can be used to pass URL parameters. See Remarks. * @param webResourceData (Optional) Data to pass into the Web Resource's data parameter. It is advised to use encodeURIcomponent() to encode the value. * @param width (Optional) The width of the new window. @@ -1073,7 +1076,7 @@ declare namespace Xrm { * Provides methods to create and manage records in the mobile clients while working in the offline mode. * @see {@link https://msdn.microsoft.com/en-us/library/mt787123.aspx External Link: Xrm.Mobile.offline (client-side reference)} * @deprecated Use {@link Xrm.WebApi.offline} instead. Xrm.WebApi.offline is implemented differently than Xrm.Mobile.offline - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ offline: MobileOffline; } @@ -1082,7 +1085,7 @@ declare namespace Xrm { * Interface for the Mobile.offline methods to create and manage records in the mobile clients while working in the offline mode. * @deprecated Use {@link Xrm.WebApi.offline} instead. Xrm.WebApi.offline is implemented differently than Xrm.Mobile.offline * @see {@link https://msdn.microsoft.com/en-us/library/mt787123.aspx External Link: Xrm.Mobile.offline (client-side reference)} - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ interface MobileOffline { /** @@ -1090,7 +1093,7 @@ declare namespace Xrm { * @param entityType The logical name of the entity. * @returns True if the entity is offline enabled; otherwise False. * @deprecated Use {@link Xrm.WebApi.isAvailableOffline} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ isOfflineEnabled(entityType: string): boolean; @@ -1105,7 +1108,7 @@ declare namespace Xrm { * Integer, Lookup, Memo, Money, Owner, Picklist, String, State * Status, UniqueIdentifier * @deprecated Use {@link Xrm.WebApi.createRecord} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ createRecord(entityType: string, data: { [attributeName: string]: any }): Async.PromiseLike; @@ -1124,7 +1127,7 @@ declare namespace Xrm { * Integer, Lookup, Memo, Money, Owner, Picklist, String, State * Status, UniqueIdentifier * @deprecated Use {@link Xrm.WebApi.retrieveRecord} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ retrieveRecord(entityType: string, id: string, options: string): Async.PromiseLike; @@ -1147,7 +1150,7 @@ declare namespace Xrm { * Integer, Lookup, Memo, Money, Owner, Picklist, String, State * Status, UniqueIdentifier * @deprecated Use {@link Xrm.WebApi.retrieveMultipleRecords} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ retrieveMultipleRecords(entityType: string, options: string, maxPageSize: number): Async.PromiseLike>; @@ -1163,7 +1166,7 @@ declare namespace Xrm { * Integer, Lookup, Memo, Money, Owner, Picklist, String, State * Status, UniqueIdentifier * @deprecated Use {@link Xrm.WebApi.updateRecord} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ updateRecord(entityType: string, id: string, data: { [attributeName: string]: any }): Async.PromiseLike; @@ -1174,7 +1177,7 @@ declare namespace Xrm { * @returns Returns an asynchronous promise. * @remarks You cannot delete intersect and activity party entities. * @deprecated Use {@link Xrm.WebApi.deleteRecord} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ deleteRecord(entityType: string, id: string): Async.PromiseLike; } @@ -1318,7 +1321,7 @@ declare namespace Xrm { /** * Collections are structures to provide access to data that represent an array, but without the ability to modify the data in the array. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections Collections (Client API reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} */ type ItemCollection = Dictionary & { /** @@ -1382,13 +1385,13 @@ declare namespace Xrm { /** * Interface for Page context * @deprecated Use {@link Xrm.Events.EventContext.getFormContext formContext} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs}a + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs}a */ interface Page extends FormContext { /** * Provides methods to retrieve information specific to an organization, a user, or parameters passed to a page. * @deprecated Deprecated in v9. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ context: GlobalContext; } @@ -1396,7 +1399,7 @@ declare namespace Xrm { /** * Xrm.Page namespace has been deprecated * @deprecated Use {@link Xrm.Events.EventContext.getFormContext formContext} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ namespace Page { /** @@ -2569,7 +2572,7 @@ declare namespace Xrm { * Use this to add a function as an event handler for the keypress event so that the function is called when you type a character in the specific text or number field. * For a sample JavaScript code that uses the addOnKeyPress method to configure the auto-completion experience, see Sample: Auto-complete in CRM controls. * @deprecated Deprecated in v9. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @param handler The function reference. */ addOnKeyPress(handler: Events.ContextSensitiveHandler): void; @@ -2582,7 +2585,7 @@ declare namespace Xrm { /** * Use this to remove an event handler for a text or number field that you added using addOnKeyPress. * @deprecated Deprecated in v9. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * Remarks: If an anonymous function is set using addOnKeyPress, it can’t be removed using this method. * @param handler The function reference. */ @@ -2712,7 +2715,7 @@ declare namespace Xrm { * Interface for a navigation item. * @see UiElement * @see UiFocusable - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui-navigation formContext.ui.navigation item (Client API reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui-navigation External Link: formContext.ui.navigation item (Client API reference)} */ interface NavigationItem extends UiStandardElement, UiFocusable { /** @@ -2781,7 +2784,7 @@ declare namespace Xrm { * This is not an Entity Lookup, but a control that supports AutoComplete / KeyPress Events (Text or Number) * @remarks This interface is not supported for CRM mobile clients (phones or tablets) and the interactive service hub. It is only available for Updated entities. * @deprecated Deprecated in v9. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @see StandardControl */ interface AutoLookupControl extends StandardControl, UiKeyPressable { @@ -2796,7 +2799,7 @@ declare namespace Xrm { /** * Hides the auto-completion drop-down list configured for a specific text field * @deprecated Deprecated in v9. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ hideAutoComplete(): void; @@ -2804,7 +2807,7 @@ declare namespace Xrm { * Shows upt to 10 matching strings in a drop-down list as users press keys to type charactrer in a specific text field. * On selecting an item in the drop-down list, the value in the text field changes to the selected item, the drop-down list disappears, and the OnChange event for the text field is invoked * @deprecated Deprecated in v9. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @param resultSet The results to show */ showAutoComplete(resultSet: AutoCompleteResultSet): void; @@ -3169,7 +3172,7 @@ declare namespace Xrm { /** * Interface for a quick view control instance on a form. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui-quickforms ExternalLink: formContext.ui.quickForms (Client API reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui-quickforms External Link: formContext.ui.quickForms (Client API reference)} */ interface QuickFormControl extends Control, UiLabelElement, UiCanGetVisibleElement { /** @@ -3532,7 +3535,7 @@ declare namespace Xrm { /** * Saves the record. * @deprecated Deprecated in v9. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @remarks When using quick create forms in the web application the saveandnew option is not * applied. It will always work as if saveandclose were used. Quick create forms in * Microsoft Dynamics CRM for tablets will apply the saveandnew behavior. @@ -3542,7 +3545,7 @@ declare namespace Xrm { /** * Saves the record with the given save mode. * @deprecated Deprecated in v9. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @param saveMode (Optional) the save mode to save, as either "saveandclose" or "saveandnew". */ save(saveMode: EntitySaveMode): void; @@ -3912,7 +3915,7 @@ declare namespace Xrm { /** * An definition module for URL-based, CRM component parameters. - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link: Open forms, views, dialogs, and reports with a URL} */ namespace Url { /** @@ -3934,7 +3937,7 @@ declare namespace Xrm { * Interface for defining parameters on a request to open a form with main.aspx (as with * window.open). Useful for parsing the keys and values into a string of the format: * "&key=value". - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link: Open forms, views, dialogs, and reports with a URL} * @remarks A member for "pagetype" is not provided. The value "entityrecord" is required in * the URL, for forms. Example: "pagetype=entityrecord" */ @@ -3974,7 +3977,7 @@ declare namespace Xrm { * window.open). Useful for parsing the keys and values into a string of the format: * "&key=value". * - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link: Open forms, views, dialogs, and reports with a URL} * * @remarks A member for "pagetype" is not provided. The value "entitylist" is required in * the URL, for views. Example: "pagetype=entitylist" @@ -4019,7 +4022,7 @@ declare namespace Xrm { * Interface for defining parameters of a request to open a dialog with rundialog.aspx (as with * window.open). Useful for parsing the keys and values into a string of the format: * "&key=value". - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link: Open forms, views, dialogs, and reports with a URL} */ interface DialogOpenParameters { /** @@ -4044,7 +4047,7 @@ declare namespace Xrm { * window.open). Useful for parsing out the keys and values into a string of the format: * "&key=value" * - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link: Open forms, views, dialogs, and reports with a URL} */ interface ReportOpenParameters { /** From 346363a0ccf48a12fb281bb710c3623af0a36c07 Mon Sep 17 00:00:00 2001 From: Carlton Colter Date: Fri, 24 Nov 2017 20:09:09 -0500 Subject: [PATCH 48/90] Removed trailing commas Cleanup trailing commas on enums. --- types/xrm/index.d.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index 9914598cad..d76d9caea6 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -4894,7 +4894,7 @@ declare namespace XrmEnum { /** * @deprecated ReadOptimized has been deprecated. */ - ReadOptimized = 11, + ReadOptimized = 11 } /** @@ -4911,7 +4911,7 @@ declare namespace XrmEnum { Assign = 47, Send = 7, Qualify = 16, - Disqualify = 15, + Disqualify = 15 } /** @@ -4924,7 +4924,7 @@ declare namespace XrmEnum { Close = 3, Identify = 4, Research = 5, - Resolve = 6, + Resolve = 6 } /** @@ -4935,7 +4935,7 @@ declare namespace XrmEnum { RibbonContextForm = 1, RibbonContextListing = 2, FormContextUnrelated = 3, - FormContextRelated = 4, + FormContextRelated = 4 } /** @@ -4943,7 +4943,7 @@ declare namespace XrmEnum { */ const enum ViewType { SystemView = 1039, - UserView = 4230, + UserView = 4230 } /** @@ -4970,7 +4970,7 @@ declare namespace XrmEnum { Virtual = 17, BigInt = 18, ManagedProperty = 19, - EntityName = 20, + EntityName = 20 } /** @@ -4980,7 +4980,7 @@ declare namespace XrmEnum { None = 0, SystemRequired = 1, ApplicationRequired = 2, - Recommended = 3, + Recommended = 3 } /** @@ -4988,7 +4988,7 @@ declare namespace XrmEnum { */ const enum OpenFileOptions { Open = 1, - Save = 2, + Save = 2 } /** @@ -4996,7 +4996,7 @@ declare namespace XrmEnum { */ const enum WindowPositions { Center = 1, - Side = 2, + Side = 2 } /** @@ -5004,7 +5004,7 @@ declare namespace XrmEnum { */ const enum RelationshipType { OneToMany = 0, - ManyToMany = 1, + ManyToMany = 1 } /** @@ -5012,14 +5012,14 @@ declare namespace XrmEnum { */ const enum RoleType { Referencing = 1, - AssociationEntity = 2, + AssociationEntity = 2 } const enum ClientFormFactor { Unknown = 1, Desktop = 2, Tablet = 3, - Phone = 4, + Phone = 4 } /** From 0c4d0b2d22c642f6494fa53dd4a871e539778e4c Mon Sep 17 00:00:00 2001 From: Carlton Colter Date: Fri, 24 Nov 2017 22:36:55 -0500 Subject: [PATCH 49/90] Fixed @see to use @link as well tsdoc doesn't support @see that directs to an internal link like jsdoc does. http://usejsdoc.org/tags-see.html tsdoc supports @returns as well as @return. Made some other tsdoc markup changes. --- types/xrm/index.d.ts | 196 +++++++++++++++++++++---------------------- 1 file changed, 98 insertions(+), 98 deletions(-) diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index d76d9caea6..c94bc245fc 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -16,7 +16,7 @@ declare var Xrm: Xrm.XrmStatic; * The method provides access to the global context without going through the form context. * * It is preferreed to use {@link Xrm.Utility.getGlobalContext Xrm.Utility.getGlobalContext()} instead. - * @see Xrm.Utility.getGlobalContext + * @see {@link Xrm.Utility.getGlobalContext} */ declare function GetGlobalContext(): Xrm.GlobalContext; @@ -90,46 +90,46 @@ declare namespace Xrm { /** * Client Types for {@link GlobalContext.getClient globalContext.getClient()}. - * @see XrmEnum.Client + * @see {@link XrmEnum.Client} */ type Client = "Web" | "Outlook" | "Mobile" | "UnifiedServiceDesk"; /** * Client States for {@link GlobalContext.getClientState globalContext.getClientState()}. - * @see XrmEnum.ClientState + * @see {@link XrmEnum.ClientState} */ type ClientState = "Online" | "Offline"; /** * Display States for setDisplayState() on {@link Controls.ProcessControl.setDisplayState Processes} and {@link Controls.Tab.setDisplayState Tabs}. - * @see XrmEnum.DisplayState + * @see {@link XrmEnum.DisplayState} */ type DisplayState = "collapsed" | "expanded"; /** * The {@link Entity.save Entity}'s Save Mode - * @see XrmEnum.EntitySaveMode - * @see Entity - * @see Entity.save + * @see {@link XrmEnum.EntitySaveMode} + * @see {@link Entity} + * @see {@link Entity.save} */ type EntitySaveMode = "saveandclose" | "saveandnew"; /** * Form Notification Levels for {@link Ui.setFormNotification formContext.ui.setFormNotification()}. - * @see XrmEnum.FormNotificationLevel + * @see {@link XrmEnum.FormNotificationLevel} */ type FormNotificationLevel = "ERROR" | "INFO" | "WARNING"; /** * Submit Mode for {@link Attributes.Attribute.setSubmitMode} Attributes.Attribute.setSubmitMode(). - * @see XrmEnum.SubmitMode + * @see {@link XrmEnum.SubmitMode} */ type SubmitMode = "always" | "dirty" | "never"; /** * Themes for {@link GlobalContext.getCurrentTheme globalContext.getCurrentTheme()}. * Note: getCurrentTheme() does not work with Dynamics CRM for tablets or in the unified interface. - * @see XrmEnum.Theme + * @see {@link XrmEnum.Theme} */ type Theme = "default" | "Office12Blue" | "Office14Silver"; @@ -332,7 +332,7 @@ declare namespace Xrm { /** * Returns information about the advanced configuration settings for the organization. * @param setting Name of the configuration setting. - * @see XrmEnum.AdvancedConfigSettingOption + * @see {@link XrmEnum.AdvancedConfigSettingOption} */ getAdvancedConfigSetting(setting: "MaxChildIncidentNumber" | "MaxIncidentMergeNumber"): number; @@ -678,7 +678,7 @@ declare namespace Xrm { * In V9 this is only available in the Unified Client * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/attributes External Link: Attributes (Client API reference)} * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} - * @see Attributes + * @see {@link Attributes} */ attributes: Collection.ItemCollection; @@ -1433,8 +1433,8 @@ declare namespace Xrm { /** * Interface for a navigation item. - * @see UiElement - * @see UiFocusable + * @see {@link UiElement} + * @see {@link UiFocusable} * @deprecated Use {@link Xrm.Controls.NavigationItem} instead. */ interface NavigationItem extends Controls.NavigationItem { } @@ -1665,49 +1665,49 @@ declare namespace Xrm { /** * Interface for a Number attribute. - * @see Attribute + * @see {@link Attribute} * @deprecated Use {@link Xrm.Attributes.NumberAttribute} instead. */ interface NumberAttribute extends Attributes.NumberAttribute { } /** * Interface for a String attribute. - * @see Attribute + * @see {@link Attribute} * @deprecated Use {@link Xrm.Attributes.StringAttribute} instead. */ interface StringAttribute extends Attributes.StringAttribute { } /** * Common interface for enumeration attributes (OptionSet and Boolean). - * @see Attribute + * @see {@link Attribute} * @deprecated Use {@link Xrm.Attributes.EnumAttribute} instead. */ interface EnumAttribute extends Attributes.EnumAttribute { } /** * Interface for a Boolean attribute. - * @see EnumAttribute + * @see {@link EnumAttribute} * @deprecated Use {@link Xrm.Attributes.BooleanAttribute} instead. */ interface BooleanAttribute extends Attributes.BooleanAttribute { } /** * Interface for a Date attribute. - * @see Attribute + * @see {@link Attribute} * @deprecated Use {@link Xrm.Attributes.DateAttribute} instead. */ interface DateAttribute extends Attributes.DateAttribute { } /** * Interface an OptionSet attribute. - * @see EnumAttribute + * @see {@link EnumAttribute} * @deprecated Use {@link Xrm.Attributes.OptionSetAttribute} instead. */ interface OptionSetAttribute extends Attributes.OptionSetAttribute { } /** * Interface a Lookup attribute. - * @see Attribute + * @see {@link Attribute} * @deprecated Use {@link Xrm.Attributes.LookupAttribute} instead. */ interface LookupAttribute extends Attributes.LookupAttribute { } @@ -1738,14 +1738,14 @@ declare namespace Xrm { /** * Interface for Xrm.Page.ui controls. - * @see UiElement + * @see {@link UiElement} * @deprecated Use {@link Xrm.Controls.Control} instead. */ interface Control extends Controls.Control { } /** * Interface for a standard control. - * @see Control + * @see {@link Control} * @deprecated Use {@link Xrm.Controls.StandardControl} instead. */ interface StandardControl extends Controls.StandardControl { } @@ -1754,42 +1754,42 @@ declare namespace Xrm { * Interface for Auto Lookup Control. * This is not an Entity Lookup, but a control that supports AutoComplete / KeyPress Events (Text or Number) * @remarks This interface is not supported for CRM mobile clients (phones or tablets) and the interactive service hub. It is only available for Updated entities. - * @see StandardControl + * @see {@link StandardControl} * @deprecated Use {@link Xrm.Controls.AutoLookupControl} instead. */ interface AutoLookupControl extends Controls.AutoLookupControl { } /** * Interface for a String control. - * @see StandardControl + * @see {@link StandardControl} * @deprecated Use {@link Xrm.Controls.StringControl} instead. */ interface StringControl extends Controls.StringControl { } /** * Interface for a Number control. - * @see StandardControl + * @see {@link StandardControl} * @deprecated Use {@link Xrm.Controls.NumberControl} instead. */ interface NumberControl extends AutoLookupControl { } /** * Interface for a Date control. - * @see StandardControl + * @see {@link StandardControl} * @deprecated Use {@link Xrm.Controls.DateControl} instead. */ interface DateControl extends StandardControl { } /** * Interface for a Lookup control. - * @see StandardControl + * @see {@link StandardControl} * @deprecated Use {@link Xrm.Controls.LookupControl} instead. */ interface LookupControl extends Controls.LookupControl { } /** * Interface for an OptionSet control. - * @see StandardControl + * @see {@link StandardControl} * @deprecated Use {@link Xrm.Controls.OptionSetControl} instead. */ interface OptionSetControl extends Controls.OptionSetControl { } @@ -1797,14 +1797,14 @@ declare namespace Xrm { /** * Interface for a CRM grid control. * - * @see Control + * @see {@link Control} * @deprecated Use {@link Xrm.Controls.GridControl} instead. */ interface GridControl extends Controls.GridControl { } /** * Interface for a framed control, which is either a Web Resource or an Iframe. - * @see Control + * @see {@link Control} * @remarks An Iframe control provides additional methods, so use {@link IframeControl} where * appropriate. Silverlight controls should use {@link SilverlightControl}. * @deprecated Use {@link Xrm.Controls.FramedControl} instead. @@ -1813,36 +1813,36 @@ declare namespace Xrm { /** * Interface for an Iframe control. - * @see FramedControl + * @see {@link FramedControl} * @deprecated Use {@link Xrm.Controls.IframeControl} instead. */ interface IframeControl extends Controls.IframeControl { } /** * Interface for a Silverlight control. - * @see Control + * @see {@link Control} * @deprecated Use {@link Xrm.Controls.SilverlightControl} instead. */ interface SilverlightControl extends Controls.SilverlightControl { } /** * Interface for a Timeline control. - * @see Control + * @see {@link Control} * @deprecated Use {@link Xrm.Controls.TimelineWall} instead. */ interface TimelineWall extends Controls.TimelineWall { } /** * Interface for a form tab. - * @see UiElement - * @see UiFocusable + * @see {@link UiElement} + * @see {@link UiFocusable} * @deprecated Use {@link Xrm.Controls.Tab} instead. */ interface Tab extends Controls.Tab { } /** * Interface for a form section. - * @see UiElement + * @see {@link UiElement} * @deprecated Use {@link Xrm.Controls.Section} instead. */ interface Section extends Controls.Section { } @@ -2033,47 +2033,47 @@ declare namespace Xrm { /** * Requirement Level for {@link Attributes.Attribute.getRequiredLevel Attributes.Attribute.getRequiredLevel()} and * {@link Attributes.Attribute.setRequiredLevel Attributes.Attribute.setRequiredLevel()}. - * @see XrmEnum.AttributeRequirementLevel + * @see {@link XrmEnum.AttributeRequirementLevel} */ type RequirementLevel = "none" | "recommended" | "required"; /** * Date attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.DateAttribute DateAttribute}. - * @see XrmEnum.DateAttributeFormat + * @see {@link XrmEnum.DateAttributeFormat} */ type DateAttributeFormat = "date" | "datetime"; /** * Integer attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.NumberAttribute NumberAttribute}. - * @see XrmEnum.IntegerAttributeFormat + * @see {@link XrmEnum.IntegerAttributeFormat} */ type IntegerAttributeFormat = "duration" | "none"; /** * OptionSet attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.OptionSetAttribute OptionSetAttribute}. - * @see XrmEnum.OptionSetAttributeFormat + * @see {@link XrmEnum.OptionSetAttributeFormat} */ type OptionSetAttributeFormat = "language" | "timezone"; /** * String attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.StringAttribute StringAttribute}. - * @see XrmEnum.StringAttributeFormat + * @see {@link XrmEnum.StringAttributeFormat} */ type StringAttributeFormat = "email" | "phone" | "text" | "textarea" | "tickersymbol" | "url"; /** * Attribute types for {@link Attributes.Attribute.setDisplayState()}. - * @see XrmEnum.AttributeType + * @see {@link XrmEnum.AttributeType} */ type AttributeType = "boolean" | "datetime" | "decimal" | "double" | "integer" | "lookup" | "memo" | "money" | "multioptionset" | "optionset" | "string"; /** * Attribute formats for {@link Attributes.Attribute.getFormat Attributes.Attribute.getFormat()}. - * @see XrmEnum.DateAttributeFormat - * @see XrmEnum.IntegerAttributeFormat - * @see XrmEnum.OptionSetAttributeFormat - * @see XrmEnum.StringAttributeFormat + * @see {@link XrmEnum.DateAttributeFormat} + * @see {@link XrmEnum.IntegerAttributeFormat} + * @see {@link XrmEnum.OptionSetAttributeFormat} + * @see {@link XrmEnum.StringAttributeFormat} */ type AttributeFormat = DateAttributeFormat | IntegerAttributeFormat | OptionSetAttributeFormat | StringAttributeFormat; @@ -2113,7 +2113,7 @@ declare namespace Xrm { * * @returns The format of the attribute. * - * @see getAttributeType + * @see {@link getAttributeType} * Values returned are: date (datetime) * datetime (datetime) * duration (integer) @@ -2175,7 +2175,7 @@ declare namespace Xrm { /** * Sets the required level. * @param requirementLevel The requirement level, as either "none", "required", or "recommended" - * @see XrmEnum.AttributeRequirementLevel + * @see {@link XrmEnum.AttributeRequirementLevel} */ setRequiredLevel(requirementLevel: RequirementLevel): void; @@ -2183,7 +2183,7 @@ declare namespace Xrm { * Sets the submit mode. * @param submitMode The submit mode, as either "always", "never", or "dirty". * @default submitMode "dirty" - * @see XrmEnum.AttributeRequirementLevel + * @see {@link XrmEnum.AttributeRequirementLevel} */ setSubmitMode(submitMode: SubmitMode): void; @@ -2208,7 +2208,7 @@ declare namespace Xrm { /** * Interface for a Number attribute. - * @see Attribute + * @see {@link Attribute} */ interface NumberAttribute extends Attribute { /** @@ -2258,7 +2258,7 @@ declare namespace Xrm { /** * Interface for a String attribute. - * @see Attribute + * @see {@link Attribute} */ interface StringAttribute extends Attribute { /** @@ -2302,7 +2302,7 @@ declare namespace Xrm { /** * Common interface for enumeration attributes (OptionSet and Boolean). - * @see Attribute + * @see {@link Attribute} */ interface EnumAttribute extends Attribute { /** @@ -2315,7 +2315,7 @@ declare namespace Xrm { /** * Interface for a Boolean attribute. - * @see EnumAttribute + * @see {@link EnumAttribute} */ interface BooleanAttribute extends EnumAttribute { /** @@ -2342,7 +2342,7 @@ declare namespace Xrm { /** * Interface for a Date attribute. * - * @see Attribute + * @see {@link Attribute} */ interface DateAttribute extends Attribute { /** @@ -2375,7 +2375,7 @@ declare namespace Xrm { /** * Interface an OptionSet attribute. - * @see EnumAttribute + * @see {@link EnumAttribute} */ interface OptionSetAttribute extends EnumAttribute { /** @@ -2450,7 +2450,7 @@ declare namespace Xrm { /** * Interface a Lookup attribute. * - * @see Attribute + * @see {@link Attribute} */ interface LookupAttribute extends Attribute { /** @@ -2492,7 +2492,7 @@ declare namespace Xrm { /** * Control types for {@link Controls.Control.getControlType Controls.Control.getControlType()}. - * @see XrmEnum.StandardControlType + * @see {@link XrmEnum.StandardControlType} */ type ControlType = "standard" | "iframe" | "lookup" | "optionset" | "subgrid" | "webresource" | "notes" | "timercontrol" | "kbsearch" | @@ -2655,7 +2655,7 @@ declare namespace Xrm { /** * Interface for controls. * - * @see UiElement + * @see {@link UiElement} */ interface Control extends UiLabelElement, UiCanGetVisibleElement { /** @@ -2713,8 +2713,8 @@ declare namespace Xrm { /** * Interface for a navigation item. - * @see UiElement - * @see UiFocusable + * @see {@link UiElement} + * @see {@link UiFocusable} * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui-navigation External Link: formContext.ui.navigation item (Client API reference)} */ interface NavigationItem extends UiStandardElement, UiFocusable { @@ -2727,7 +2727,7 @@ declare namespace Xrm { /** * Interface for a standard control. - * @see Control + * @see {@link Control} */ interface StandardControl extends Control, UiStandardElement, UiFocusable { /** @@ -2785,7 +2785,7 @@ declare namespace Xrm { * @remarks This interface is not supported for CRM mobile clients (phones or tablets) and the interactive service hub. It is only available for Updated entities. * @deprecated Deprecated in v9. * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} - * @see StandardControl + * @see {@link StandardControl} */ interface AutoLookupControl extends StandardControl, UiKeyPressable { /** @@ -2815,7 +2815,7 @@ declare namespace Xrm { /** * Interface for a String control. - * @see StandardControl + * @see {@link StandardControl} */ interface StringControl extends AutoLookupControl { /** @@ -2827,7 +2827,7 @@ declare namespace Xrm { /** * Interface for a Number control. - * @see StandardControl + * @see {@link StandardControl} */ interface NumberControl extends AutoLookupControl { /** @@ -2839,7 +2839,7 @@ declare namespace Xrm { /** * Interface for a Date control. - * @see StandardControl + * @see {@link StandardControl} */ interface DateControl extends StandardControl { /** @@ -2863,7 +2863,7 @@ declare namespace Xrm { /** * Interface for a Lookup control. - * @see StandardControl + * @see {@link StandardControl} */ interface LookupControl extends StandardControl { /** @@ -2875,7 +2875,7 @@ declare namespace Xrm { /** * Adds an additional custom filter to the lookup, with the "AND" filter operator. * Can only be used within a "pre search" event handler - * @see addPreSearch + * @see {@link addPreSearch} * @param filter Specifies the filter, as a serialized FetchXML "filter" node. * @param entityLogicalName (Optional) The logical name of the entity. * @remarks If entityLogicalName is not specified, the filter will be applied to all entities @@ -2942,7 +2942,7 @@ declare namespace Xrm { /** * Interface for an OptionSet control. * - * @see StandardControl + * @see {@link StandardControl} */ interface OptionSetControl extends StandardControl { /** @@ -2979,7 +2979,7 @@ declare namespace Xrm { /** * Interface for a CRM grid control. * - * @see Control + * @see {@link Control} */ interface GridControl extends Control { /** @@ -3130,7 +3130,7 @@ declare namespace Xrm { /** * Interface for a framed control, which is either a Web Resource or an Iframe. - * @see Control + * @see {@link Control} * @remarks An Iframe control provides additional methods, so use {@link IframeControl} where * appropriate. Silverlight controls should use {@link SilverlightControl}. */ @@ -3159,7 +3159,7 @@ declare namespace Xrm { /** * Interface for an Iframe control. - * @see FramedControl + * @see {@link FramedControl} */ interface IframeControl extends FramedControl, UiCanSetVisibleElement { /** @@ -3240,7 +3240,7 @@ declare namespace Xrm { /** * Interface for a Silverlight control. - * @see Control + * @see {@link Control} * @deprecated The Silverlight WebResource is deprecated on the web client, and is not supported on the new Unified Interface in v9. * Instead of silverlight, use custom controls created using the HTML web resources with HTML5 to create UI components to visualize and interact with data. */ @@ -3269,7 +3269,7 @@ declare namespace Xrm { /** * Interface for a Timeline control. - * @see Control + * @see {@link Control} */ interface TimelineWall extends Control { /** @@ -3280,8 +3280,8 @@ declare namespace Xrm { /** * Interface for a form tab. - * @see UiElement - * @see UiFocusable + * @see {@link UiElement} + * @see {@link UiFocusable} */ interface Tab extends UiStandardElement, UiFocusable { /** @@ -3317,7 +3317,7 @@ declare namespace Xrm { /** * Interface for a form section. - * @see UiElement + * @see {@link UiElement} */ interface Section extends UiStandardElement { /** @@ -3561,19 +3561,19 @@ declare namespace Xrm { namespace ProcessFlow { /** * Direction types for a process stage change event - * @see XrmEnum.StageChangeDirection + * @see {@link XrmEnum.StageChangeDirection} */ type StageChangeDirection = "Next" | "Previous"; /** * Status for {@link ProcessFlow.Stage.getStatus Stage.getStatus()}. - * @see XrmEnum.StageStatus + * @see {@link XrmEnum.StageStatus} */ type StageStatus = "active" | "inactive"; /** * Status for {@link ProcessFlow.Process.getStatus Process.getStatus()}. - * @see XrmEnum.ProcessStatus + * @see {@link XrmEnum.ProcessStatus} */ type ProcessStatus = "active" | "aborted" | "finished"; @@ -5024,7 +5024,7 @@ declare namespace XrmEnum { /** * Constant Enum: Client Types for {@link GlobalContext.getClient globalContext.getClient()}. - * @see Xrm.Client + * @see {@link Xrm.Client} */ const enum Client { Web = "Web", @@ -5036,7 +5036,7 @@ declare namespace XrmEnum { /** * Constant Enum: Client States for {@link GlobalContext.getClientState globalContext.getClientState()}. - * @see Xrm.ClientState + * @see {@link Xrm.ClientState} */ const enum ClientState { Online = "Online", @@ -5045,7 +5045,7 @@ declare namespace XrmEnum { /** * Constant Enum: Display States for setDisplayState() on {@link Controls.ProcessControl.setDisplayState Processes} and {@link Controls.Tab.setDisplayState Tabs}. - * @see Xrm.DisplayState + * @see {@link Xrm.DisplayState} */ const enum DisplayState { Expanded = "expanded", @@ -5054,9 +5054,9 @@ declare namespace XrmEnum { /** * Constant Enum: {@link Entity.save Entity} Save Modes - * @see Xrm.EntitySaveMode - * @see Entity - * @see Entity.save + * @see {@link Xrm.EntitySaveMode} + * @see {@link Entity} + * @see {@link Entity.save} */ const enum EntitySaveMode { SaveAndClose = "saveandclose", @@ -5065,7 +5065,7 @@ declare namespace XrmEnum { /** * Constant Enum: Form Notification Levels for {@link Ui.setFormNotification formContext.ui.setFormNotification()}. - * @see Xrm.FormNotificationLevel + * @see {@link Xrm.FormNotificationLevel} */ const enum FormNotificationLevel { Error = "ERROR", @@ -5075,7 +5075,7 @@ declare namespace XrmEnum { /** * Constant Enum: Submit Modes for {@link Attributes.Attribute.setSubmitMode} Attributes.Attribute.setSubmitMode(). - * @see Xrm.SubmitMode + * @see {@link Xrm.SubmitMode} */ const enum SubmitMode { Always = "always", @@ -5104,7 +5104,7 @@ declare namespace XrmEnum { /** * Constant Enum: Requirement Level for {@link Attributes.Attribute.getRequiredLevel Attributes.Attribute.getRequiredLevel()} and * {@link Attributes.Attribute.setRequiredLevel Attributes.Attribute.setRequiredLevel()}. - * @see Xrm.Attributes.RequirementLevel + * @see {@link Xrm.Attributes.RequirementLevel} */ const enum AttributeRequirementLevel { None = "none", @@ -5114,7 +5114,7 @@ declare namespace XrmEnum { /** * Constant Enum: Date attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.DateAttribute DateAttribute}. - * @see Xrm.Attributes.DateAttributeFormat + * @see {@link Xrm.Attributes.DateAttributeFormat} */ const enum DateAttributeFormat { Date = "date", @@ -5123,7 +5123,7 @@ declare namespace XrmEnum { /** * Constant Enum: Integer attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.NumberAttribute NumberAttribute}. - * @see Xrm.Attributes.IntegerAttributeFormat + * @see {@link Xrm.Attributes.IntegerAttributeFormat} */ const enum IntegerAttributeFormat { Duration = "duration", @@ -5132,7 +5132,7 @@ declare namespace XrmEnum { /** * Constant Enum: OptionSet attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.OptionSetAttribute OptionSetAttribute}. - * @see Xrm.Attributes.OptionSetAttributeFormat + * @see {@link Xrm.Attributes.OptionSetAttributeFormat} */ const enum OptionSetAttributeFormat { Language = "language", @@ -5141,7 +5141,7 @@ declare namespace XrmEnum { /** * Constant Enum: String attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.StringAttribute StringAttribute}. - * @see Xrm.Attributes.StringAttributeFormat + * @see {@link Xrm.Attributes.StringAttributeFormat} */ const enum StringAttributeFormat { Email = "email", @@ -5154,7 +5154,7 @@ declare namespace XrmEnum { /** * Constant Enum: Attribute types for {@link Attributes.Attribute.setDisplayState()}. - * @see Xrm.Attributes.AttributeType + * @see {@link Xrm.Attributes.AttributeType} */ const enum AttributeType { Boolean = "boolean", @@ -5171,7 +5171,7 @@ declare namespace XrmEnum { /** * Constant Enum: Control types for {@link Controls.Control.getControlType Controls.Control.getControlType()}. - * @see Xrm.Controls.ControlType + * @see {@link Xrm.Controls.ControlType} */ const enum StandardControlType { Standard = "standard", @@ -5189,7 +5189,7 @@ declare namespace XrmEnum { /** * Constant Enum: Direction types for a process stage change event - * @see ProcessFlow.StageChangeDirection + * @see {@link ProcessFlow.StageChangeDirection} */ const enum StageChangeDirection { Next = "Next", @@ -5198,7 +5198,7 @@ declare namespace XrmEnum { /** * Constant Enum: Status for {@link ProcessFlow.Stage.getStatus Stage.getStatus()}. - * @see ProcessFlow.StageStatus + * @see {@link ProcessFlow.StageStatus} */ const enum StageStatus { Active = "active", @@ -5207,7 +5207,7 @@ declare namespace XrmEnum { /** * Constant Enum: Status for {@link ProcessFlow.Process.getStatus Process.getStatus()}. - * @see ProcessFlow.ProcessStatus + * @see {@link ProcessFlow.ProcessStatus} */ const enum ProcessStatus { Active = "active", From 9bdb3afa3b64d219800dce567fc700a3b4fe5c98 Mon Sep 17 00:00:00 2001 From: zwh8800 Date: Sat, 25 Nov 2017 15:39:28 +0800 Subject: [PATCH 50/90] fix @types/puppeteer $eval type error --- types/puppeteer/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/puppeteer/index.d.ts b/types/puppeteer/index.d.ts index b6220485fb..b1f214aa7b 100644 --- a/types/puppeteer/index.d.ts +++ b/types/puppeteer/index.d.ts @@ -667,7 +667,8 @@ export interface FrameBase { */ $eval( selector: string, - fn: (...args: any[]) => void + fn: (ele: ElementHandle | null, ...args: any[]) => any, + ...args: any[] ): Promise; /** @@ -680,7 +681,7 @@ export interface FrameBase { */ $$eval( selector: string, - fn: (...args: any[]) => void, + fn: (eles: ElementHandle[], ...args: any[]) => any, ...args: any[] ): Promise; From 1cfcf9cf86133649435a589a6a360bcd4c889446 Mon Sep 17 00:00:00 2001 From: Nicolas Beck Date: Sat, 25 Nov 2017 09:15:44 +0100 Subject: [PATCH 51/90] fixed type of drawerLabel prop according to the docs and my own test 'string' is also allowed as drawerLabel --- types/react-navigation/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 8883d98da4..cd528e82e8 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -349,7 +349,8 @@ export interface NavigationDrawerScreenOptions extends NavigationScreenOptions { any > | null)); drawerLabel?: - React.ReactElement + string + | React.ReactElement | ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement< any > | null)); From aa7f42d55d629b5ff14de02a4c2d61cb220e852c Mon Sep 17 00:00:00 2001 From: zwh8800 Date: Sat, 25 Nov 2017 22:43:01 +0800 Subject: [PATCH 52/90] rename ele to element --- types/puppeteer/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/puppeteer/index.d.ts b/types/puppeteer/index.d.ts index b1f214aa7b..311d2c47b7 100644 --- a/types/puppeteer/index.d.ts +++ b/types/puppeteer/index.d.ts @@ -667,7 +667,7 @@ export interface FrameBase { */ $eval( selector: string, - fn: (ele: ElementHandle | null, ...args: any[]) => any, + fn: (element: ElementHandle | null, ...args: any[]) => any, ...args: any[] ): Promise; @@ -681,7 +681,7 @@ export interface FrameBase { */ $$eval( selector: string, - fn: (eles: ElementHandle[], ...args: any[]) => any, + fn: (elements: ElementHandle[], ...args: any[]) => any, ...args: any[] ): Promise; From 483c3f154bb4b65b254baccce694ad7280219069 Mon Sep 17 00:00:00 2001 From: Guangda Zhang Date: Sat, 25 Nov 2017 09:50:33 -0800 Subject: [PATCH 53/90] Add ajax and ajaxOptions to adapter --- types/ember-data/index.d.ts | 8 ++++++++ types/ember-data/test/adapter.ts | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/types/ember-data/index.d.ts b/types/ember-data/index.d.ts index bf273f2f20..35a291634b 100644 --- a/types/ember-data/index.d.ts +++ b/types/ember-data/index.d.ts @@ -1032,6 +1032,14 @@ declare namespace DS { * should use the REST adapter. */ class RESTAdapter extends Adapter implements BuildURLMixin { + /** + * Takes a URL, an HTTP method and a hash of data, and makes an HTTP request. + */ + ajax(url: string, type: string, options: object): Promise; + /** + * Generate ajax options + */ + ajaxOptions(url: string, type: string, options: object): object; /** * By default, the RESTAdapter will send the query params sorted alphabetically to the * server. diff --git a/types/ember-data/test/adapter.ts b/types/ember-data/test/adapter.ts index d648f73310..b8d0bed62f 100644 --- a/types/ember-data/test/adapter.ts +++ b/types/ember-data/test/adapter.ts @@ -23,3 +23,24 @@ const AuthTokenHeader = DS.JSONAPIAdapter.extend({ }; }) }); + +const UseAjax = DS.JSONAPIAdapter.extend({ + query(store: DS.Store, type: string, query: object) { + const url = 'https://api.example.com/my-api'; + return this.ajax(url, 'POST', { + param: 'foo' + }); + } +}); + +const UseAjaxOptions = DS.JSONAPIAdapter.extend({ + query(store: DS.Store, type: string, query: object) { + const url = 'https://api.example.com/my-api'; + const options = this.ajaxOptions(url, 'DELETE', { + foo: 'bar' + }); + return Ember.$.ajax(url, { + ...options + }); + } +}); From d72fc5bf61228bacbc1bc574005d8b62aaae902b Mon Sep 17 00:00:00 2001 From: amzac Date: Sat, 25 Nov 2017 20:23:25 +0100 Subject: [PATCH 54/90] Fix Nightwatch getTitle type + this contexts --- types/nightwatch/index.d.ts | 24 ++++++++++++------------ types/nightwatch/nightwatch-tests.ts | 3 +++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/types/nightwatch/index.d.ts b/types/nightwatch/index.d.ts index 3a7e81d0fa..1607a8a2f4 100644 --- a/types/nightwatch/index.d.ts +++ b/types/nightwatch/index.d.ts @@ -887,7 +887,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The value of the attribute */ - getAttribute(selector: string, attribute: string, callback?: (result: NightwatchCallbackResult) => void): this; + getAttribute(selector: string, attribute: string, callback?: (this:NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Retrieve a single cookie visible to the current page. The cookie is returned as a cookie JSON object, as defined here. @@ -906,7 +906,7 @@ export interface NightwatchAPI { * @param callback: The callback function which will receive the response as an argument. * @returns The cookie object as a selenium cookie JSON object or null if the cookie wasn't found. */ - getCookie(name: string, callback?: (result: NightwatchCallbackResult) => void): this; + getCookie(name: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Retrieve all cookies visible to the current page. The cookies are returned as an array of cookie JSON object, @@ -924,7 +924,7 @@ export interface NightwatchAPI { * @param callback: The callback function which will receive the response as an argument. * @returns A list of cookies */ - getCookies(callback?: (result: NightwatchCallbackResult) => void): this; + getCookies(callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Retrieve the value of a css property for a given DOM element. Uses elementIdCssProperty protocol command. @@ -944,7 +944,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The value of the css property */ - getCssProperty(selector: string, cssProperty: string, callback?: (result: NightwatchCallbackResult) => void): this; + getCssProperty(selector: string, cssProperty: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Determine an element's size in pixels. Uses elementIdSize protocol command. @@ -964,7 +964,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The width and height of the element in pixels */ - getElementSize(selector: string, callback?: (result: NightwatchCallbackResult) => void): this; + getElementSize(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Determine an element's location on the page. The point (0, 0) refers to the upper-left corner of the page. @@ -985,7 +985,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The X and Y coordinates for the element on the page */ - getLocation(selector: string, callback?: (result: NightwatchCallbackResult) => void): this; + getLocation(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Determine an element's location on the screen once it has been scrolled into view. Uses elementIdLocationInView protocol command. @@ -1005,7 +1005,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The X and Y coordinates for the element on the page. */ - getLocationInView(selector: string, callback?: (result: NightwatchCallbackResult) => void): this; + getLocationInView(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Gets a log from selenium @@ -1059,7 +1059,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The element's tag name, as a lowercase string. */ - getTagName(selector: string, callback?: (result: NightwatchCallbackResult) => void): this; + getTagName(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Returns the visible text for the element. Uses elementIdText protocol command. @@ -1078,7 +1078,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The element's visible text. */ - getText(selector: string, callback?: (result: NightwatchCallbackResult) => void): this; + getText(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Returns the title of the current page. Uses title protocol command. @@ -1095,7 +1095,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The page title. */ - getTitle(callback?: (result: NightwatchCallbackResult) => void): this; + getTitle(callback?: (this: NightwatchAPI, result?: string) => void): this; /** * Returns a form element current value. Uses elementIdValue protocol command. @@ -1114,7 +1114,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The element's value. */ - getValue(selector: string, callback?: (result: NightwatchCallbackResult) => void): this; + getValue(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * This command is an alias to url and also a convenience method when called without any arguments in the sense that it performs a call to .url() with passing the value of launch_url @@ -1180,7 +1180,7 @@ export interface NightwatchAPI { * @param selector: The CSS/Xpath selector used to locate the element. * @param callback: Optional callback function to be called when the command finishes. */ - isVisible(selector: string, callback?: (result: NightwatchCallbackResult) => void): this; + isVisible(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Maximizes the current window. diff --git a/types/nightwatch/nightwatch-tests.ts b/types/nightwatch/nightwatch-tests.ts index a40c8c466a..3b0f1bf187 100644 --- a/types/nightwatch/nightwatch-tests.ts +++ b/types/nightwatch/nightwatch-tests.ts @@ -7,6 +7,9 @@ const test: NightwatchTests = { .waitForElementVisible('body', 1000) .setValue('input[type=text]', 'nightwatch') .waitForElementVisible('button[name=btnG]', 1000) + .getTitle(function(result){ + this.assert.equal(typeof result, 'string'); + }) .click('button[name=btnG]') .pause(1000) .assert.containsText('#main', 'Night Watch') From af47b2bfc58bc86044fe1562b573e1f3927587ea Mon Sep 17 00:00:00 2001 From: amzac Date: Sat, 25 Nov 2017 21:00:13 +0100 Subject: [PATCH 55/90] Fix tslint... --- types/nightwatch/index.d.ts | 7 +--- types/nightwatch/tslint.json | 76 +++++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 8 deletions(-) diff --git a/types/nightwatch/index.d.ts b/types/nightwatch/index.d.ts index 1607a8a2f4..cd2ec9e912 100644 --- a/types/nightwatch/index.d.ts +++ b/types/nightwatch/index.d.ts @@ -4,7 +4,6 @@ // Connor Schlesiger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/* tslint:disable:max-line-length */ export interface NightwatchCustomPageObjects { page: {}; @@ -633,7 +632,6 @@ export interface NightwatchTypedCallbackResult { state: Error | string; } -// tslint:disable-next-line:no-empty-interface export interface NightwatchCallbackResult extends NightwatchTypedCallbackResult { } @@ -1305,7 +1303,7 @@ export interface NightwatchAPI { * callback providing a done callback function for completion as the first argument. Two parameters: allows for asynchronous execution * with the "api" object passed in as the first argument, followed by the done callback. */ - perform(callback: (done?: () => void) => void): this; // tslint:disable-line:unified-signatures + perform(callback: (done?: () => void) => void): this; /** * Resizes the current window. @@ -2144,10 +2142,8 @@ export interface NightwatchAPI { launch_url: string; } -/* tslint:disable-next-line:no-empty-interface */ export interface NightwatchCustomCommands {} -/* tslint:disable-next-line:no-empty-interface */ export interface NightwatchCustomAssertions {} export interface NightwatchBrowser extends NightwatchAPI, NightwatchCustomCommands, NightwatchCustomAssertions, NightwatchCustomPageObjects { } @@ -2200,4 +2196,3 @@ export interface Nightwatch { client: NightwatchClient; } -/* tslint:enable:max-line-length */ diff --git a/types/nightwatch/tslint.json b/types/nightwatch/tslint.json index b1439230db..a41bf5d19a 100644 --- a/types/nightwatch/tslint.json +++ b/types/nightwatch/tslint.json @@ -1,7 +1,79 @@ { "extends": "dtslint/dt.json", "rules": { - // TODO - "no-any-union": false + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false } } From 77a37a7faba9b7598d07313a590bfc617b195764 Mon Sep 17 00:00:00 2001 From: Karlis Gangis Date: Sat, 25 Nov 2017 22:07:37 +0200 Subject: [PATCH 56/90] react-redux: fix Options generic type arguments in connect() --- types/react-redux/index.d.ts | 10 +++++----- types/react-redux/react-redux-tests.tsx | 10 +++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index 8e2556ec6c..2a015389da 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -120,28 +120,28 @@ export interface Connect { mapStateToProps: MapStateToPropsParam, mapDispatchToProps: null | undefined, mergeProps: null | undefined, - options: Options + options: Options ): InferableComponentEnhancerWithProps & TStateProps, TOwnProps>; - ( + ( mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsParam, mergeProps: null | undefined, - options: Options + options: Options<{}, TStateProps, TOwnProps> ): InferableComponentEnhancerWithProps; ( mapStateToProps: MapStateToPropsParam, mapDispatchToProps: MapDispatchToPropsParam, mergeProps: null | undefined, - options: Options + options: Options ): InferableComponentEnhancerWithProps; ( mapStateToProps: MapStateToPropsParam, mapDispatchToProps: MapDispatchToPropsParam, mergeProps: MergeProps, - options: Options + options: Options ): InferableComponentEnhancerWithProps; } diff --git a/types/react-redux/react-redux-tests.tsx b/types/react-redux/react-redux-tests.tsx index af77473473..393c4d09da 100644 --- a/types/react-redux/react-redux-tests.tsx +++ b/types/react-redux/react-redux-tests.tsx @@ -247,22 +247,26 @@ namespace MapStateAndDispatchAndMerge { } namespace MapStateAndOptions { + interface State { state: string; } interface OwnProps { foo: string } interface StateProps { bar: number } interface DispatchProps { dispatch: Dispatch } class TestComponent extends Component {} - const mapStateToProps = () => ({ + const mapStateToProps = (state: State) => ({ bar: 1 }) - const Test = connect( + const areStatePropsEqual = (next: StateProps, current: StateProps) => true; + + const Test = connect( mapStateToProps, null, null, { - pure: true + pure: true, + areStatePropsEqual, } )(TestComponent) From a0c5e8a72c253cfb51790a2f7388a7558b07d6bd Mon Sep 17 00:00:00 2001 From: amzac Date: Sat, 25 Nov 2017 21:47:40 +0100 Subject: [PATCH 57/90] Fix lint review --- types/nightwatch/index.d.ts | 37 +++++++++----- types/nightwatch/nightwatch-tests.ts | 2 +- types/nightwatch/tslint.json | 74 ---------------------------- 3 files changed, 25 insertions(+), 88 deletions(-) diff --git a/types/nightwatch/index.d.ts b/types/nightwatch/index.d.ts index cd2ec9e912..a32a07b3dd 100644 --- a/types/nightwatch/index.d.ts +++ b/types/nightwatch/index.d.ts @@ -4,7 +4,6 @@ // Connor Schlesiger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - export interface NightwatchCustomPageObjects { page: {}; } @@ -632,6 +631,7 @@ export interface NightwatchTypedCallbackResult { state: Error | string; } +// tslint:disable-next-line:no-empty-interface export interface NightwatchCallbackResult extends NightwatchTypedCallbackResult { } @@ -885,7 +885,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The value of the attribute */ - getAttribute(selector: string, attribute: string, callback?: (this:NightwatchAPI, result: NightwatchCallbackResult) => void): this; + getAttribute(selector: string, attribute: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Retrieve a single cookie visible to the current page. The cookie is returned as a cookie JSON object, as defined here. @@ -1303,7 +1303,7 @@ export interface NightwatchAPI { * callback providing a done callback function for completion as the first argument. Two parameters: allows for asynchronous execution * with the "api" object passed in as the first argument, followed by the done callback. */ - perform(callback: (done?: () => void) => void): this; + perform(callback: (done?: () => void) => void): this; // tslint:disable-line:unified-signatures /** * Resizes the current window. @@ -1557,7 +1557,9 @@ export interface NightwatchAPI { * ``` * @param selector: The selector (CSS / Xpath) used to locate the element. * @param time: The number of milliseconds to wait. The runner performs repeated checks every 500 ms. - * @param abortOnFailure: By the default if the element is not found the test will fail. Set this to false if you wish for the test to continue even if the assertion fails. To set this globally you can define a property `abortOnNightwatchAssertionsFailure` in your globals. + * @param abortOnFailure: By the default if the element is not found the test will fail. + * Set this to false if you wish for the test to continue even if the assertion fails. + * To set this globally you can define a property `abortOnNightwatchAssertionsFailure` in your globals. * @param callback: Optional callback function to be called when the command finishes. * @param message: Optional message to be shown in the output; the message supports two placeholders: %s for current selector and %d for the time (e.g. Element %s was not in the page for %d ms). */ @@ -1845,7 +1847,8 @@ export interface NightwatchAPI { /** * Send a sequence of key strokes to the active element. The sequence is defined in the same format as the sendKeys command. * An object map with available keys and their respective UTF-8 characters, as defined on W3C WebDriver draft spec, is loaded onto the main Nightwatch instance as client.Keys. - * Rather than the setValue, the modifiers are not released at the end of the call. The state of the modifier keys is kept between calls, so mouse interactions can be performed while modifier keys are depressed. + * Rather than the setValue, the modifiers are not released at the end of the call. + * The state of the modifier keys is kept between calls, so mouse interactions can be performed while modifier keys are depressed. * @param keysToSend: The keys sequence to be sent. * @param callback: Optional callback function to be called when the command finishes. */ @@ -1860,8 +1863,10 @@ export interface NightwatchAPI { mouseButtonClick(button: string, callback?: () => void): this; /** - * Click and hold the left mouse button (at the coordinates set by the last moveto command). Note that the next mouse-related command that should follow is mouseButtonUp . Any other mouse command (such as click or another call to buttondown) will yield undefined behaviour. - * Can be used for implementing drag-and-drop. The button can be (0, 1, 2) or ('left', 'middle', 'right'). It defaults to left mouse button, and if you don't pass in a button but do pass in a callback, it will handle it correctly. + * Click and hold the left mouse button (at the coordinates set by the last moveto command). Note that the next mouse-related command that should follow is mouseButtonUp . + * Any other mouse command (such as click or another call to buttondown) will yield undefined behaviour. + * Can be used for implementing drag-and-drop. The button can be (0, 1, 2) or ('left', 'middle', 'right'). + * It defaults to left mouse button, and if you don't pass in a button but do pass in a callback, it will handle it correctly. * @param button: The mouse button * @param callback: Optional callback function to be called when the command finishes. */ @@ -1869,14 +1874,16 @@ export interface NightwatchAPI { /** * Releases the mouse button previously held (where the mouse is currently at). Must be called once for every mouseButtonDown command issued. - * Can be used for implementing drag-and-drop. The button can be (0, 1, 2) or ('left', 'middle', 'right'). It defaults to left mouse button, and if you don't pass in a button but do pass in a callback, it will handle it correctly. + * Can be used for implementing drag-and-drop. The button can be (0, 1, 2) or ('left', 'middle', 'right'). + * It defaults to left mouse button, and if you don't pass in a button but do pass in a callback, it will handle it correctly. * @param button: The mouse button * @param callback: Optional callback function to be called when the command finishes. */ mouseButtonUp(button: string, callback?: () => void): this; /** - * Move the mouse by an offset of the specificed element. If no element is specified, the move is relative to the current mouse cursor. If an element is provided but no offset, the mouse will be moved to the center of the element. + * Move the mouse by an offset of the specificed element. If no element is specified, the move is relative to the current mouse cursor. + * If an element is provided but no offset, the mouse will be moved to the center of the element. * If the element is not visible, it will be scrolled into view. * @param element: Opaque ID assigned to the element to move to. If not specified or is null, the offset is relative to current position of the mouse. * @param xofset: X offset to move to, relative to the top-left corner of the element. If not specified, the mouse will move to the middle of the element. @@ -1995,14 +2002,16 @@ export interface NightwatchAPI { /** * Configure the amount of time that a particular type of operation can execute for before they are aborted and a |Timeout| error is returned to the client. - * @param typeOfOperation: The type of operation to set the timeout for. Valid values are: "script" for script timeouts, "implicit" for modifying the implicit wait timeout and "page load" for setting a page load timeout. + * @param typeOfOperation: The type of operation to set the timeout for. + * Valid values are: "script" for script timeouts, "implicit" for modifying the implicit wait timeout and "page load" for setting a page load timeout. * @param ms: The amount of time, in milliseconds, that time-limited commands are permitted to run. * @param callback: Optional callback function to be called when the command finishes. */ timeouts(typeOfOperation: string, ms: number, callback?: () => void): this; /** - * Set the amount of time, in milliseconds, that asynchronous scripts executed by /session/:sessionId/execute_async are permitted to run before they are aborted and a |Timeout| error is returned to the client. + * Set the amount of time, in milliseconds, that asynchronous scripts executed by /session/:sessionId/execute_async are permitted + * to run before they are aborted and a |Timeout| error is returned to the client. * @param ms: The amount of time, in milliseconds, that time-limited commands are permitted to run. * @param callback: Optional callback function to be called when the command finishes. */ @@ -2085,7 +2094,8 @@ export interface NightwatchAPI { windowMaximize(handleOrName?: string, callback?: () => void): this; /** - * Change or get the position of the specified window. If the second argument is a function it will be used as a callback and the call will perform a get request to retrieve the existing window position. + * Change or get the position of the specified window. If the second argument is a function it will be used as a callback and the call + * will perform a get request to retrieve the existing window position. * @param windowHandle: * @param: offsetX: * @param: offsetY: @@ -2142,8 +2152,10 @@ export interface NightwatchAPI { launch_url: string; } +/* tslint:disable-next-line:no-empty-interface */ export interface NightwatchCustomCommands {} +/* tslint:disable-next-line:no-empty-interface */ export interface NightwatchCustomAssertions {} export interface NightwatchBrowser extends NightwatchAPI, NightwatchCustomCommands, NightwatchCustomAssertions, NightwatchCustomPageObjects { } @@ -2195,4 +2207,3 @@ export interface Nightwatch { api: NightwatchAPI; client: NightwatchClient; } - diff --git a/types/nightwatch/nightwatch-tests.ts b/types/nightwatch/nightwatch-tests.ts index 3b0f1bf187..548dcee9bd 100644 --- a/types/nightwatch/nightwatch-tests.ts +++ b/types/nightwatch/nightwatch-tests.ts @@ -7,7 +7,7 @@ const test: NightwatchTests = { .waitForElementVisible('body', 1000) .setValue('input[type=text]', 'nightwatch') .waitForElementVisible('button[name=btnG]', 1000) - .getTitle(function(result){ + .getTitle(function(result) { this.assert.equal(typeof result, 'string'); }) .click('button[name=btnG]') diff --git a/types/nightwatch/tslint.json b/types/nightwatch/tslint.json index a41bf5d19a..495d29983d 100644 --- a/types/nightwatch/tslint.json +++ b/types/nightwatch/tslint.json @@ -1,79 +1,5 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false } } From a8967e924799d1171053e63e7eac71db81db7adb Mon Sep 17 00:00:00 2001 From: Carlton Colter Date: Sat, 25 Nov 2017 16:00:07 -0500 Subject: [PATCH 58/90] Fixed @link references Fixed @link references --- types/xrm/index.d.ts | 522 ++++++++++++++++++++++--------------------- 1 file changed, 273 insertions(+), 249 deletions(-) diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index c94bc245fc..ab9adfd1fa 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -82,20 +82,19 @@ declare namespace Xrm { /** * Provides methods to encode strings. - * * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-encoding External Link: Xrm.Encoding (Client API reference)} */ Encoding: Encoding; } /** - * Client Types for {@link GlobalContext.getClient globalContext.getClient()}. + * Client Types for {@link ClientContext.getClient clientContext.getClient()}. * @see {@link XrmEnum.Client} */ type Client = "Web" | "Outlook" | "Mobile" | "UnifiedServiceDesk"; /** - * Client States for {@link GlobalContext.getClientState globalContext.getClientState()}. + * Client States for {@link ClientContext.getClientState clientContext.getClientState()}. * @see {@link XrmEnum.ClientState} */ type ClientState = "Online" | "Offline"; @@ -128,7 +127,7 @@ declare namespace Xrm { /** * Themes for {@link GlobalContext.getCurrentTheme globalContext.getCurrentTheme()}. - * Note: getCurrentTheme() does not work with Dynamics CRM for tablets or in the unified interface. + * @remarks getCurrentTheme() does not work with Dynamics CRM for tablets or in the unified interface. * @see {@link XrmEnum.Theme} */ type Theme = "default" | "Office12Blue" | "Office14Silver"; @@ -338,12 +337,11 @@ declare namespace Xrm { /** * Gets client's base URL for Dynamics CRM - * * @returns The client's base URL - * - * @example For Dynamics CRM On-Premises: http(s)://server/org - * For Dynamics CRM Online: https://org.crm.dynamics.com - * For Dynamics CRM for Outlook (Offline): http://localhost:2525 + * @example + * * For Dynamics CRM On-Premises: http(s)://server/org + * * For Dynamics CRM Online: https://org.crm.dynamics.com + * * For Dynamics CRM for Outlook (Offline): http://localhost:2525 */ getClientUrl(): string; @@ -359,15 +357,16 @@ declare namespace Xrm { /** * Returns the URL of the current business app in Customer Engagement. - * @example Online https://[org].crm.dynamics.com/main.aspx?appid=[GUID] - * OnPrem https://[server]/[org]/main.aspx?appid=[GUID] + * @example + * * Online https://**org**.crm.dynamics.com/main.aspx?appid=**GUID** + * * OnPrem https://**server**\/**org**\/main.aspx?appid=**GUID** * @returns A string containing the url of the current business app. */ getCurrentAppUrl(): string; /** * Gets current styling theme. - * Note: This function does not work with Dynamics CRM for tablets or in the unified interface. + * @remarks This function does not work with Dynamics CRM for tablets or in the unified interface. * @returns The name of the current theme, as either "default", "Office12Blue", or "Office14Silver" */ getCurrentTheme(): Theme; @@ -391,8 +390,7 @@ declare namespace Xrm { /** * Gets organization's unique name. - * - * Note: This value can be found on the Developer Resources page within Dynamics CRM. + * @remarks This value can be found on the Developer Resources page within Dynamics CRM. * @deprecated Deprecated in v9. Use {@link Xrm.OrganizationSettings.uniqueName} globalContext.organizationSettings.uniqueName instead. * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @returns The organization's unique name. @@ -409,7 +407,6 @@ declare namespace Xrm { /** * Returns the difference between the local time and Coordinated Universal Time (UTC). - * * @returns The time zone offset, in minutes. */ getTimeZoneOffsetMinutes(): number; @@ -428,7 +425,6 @@ declare namespace Xrm { * @deprecated Deprecated in v9. Use {@link Xrm.UserSettings.languageId globalContext.userSetings.languageId} instead. * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @returns The user's language code. - * * @see {@link http://msdn.microsoft.com/en-us/library/ms912047(WinEmbedded.10).aspx External Link: Microsoft Locale ID Values} */ getUserLcid(): number; @@ -452,7 +448,6 @@ declare namespace Xrm { /** * Returns the version number of the Dynamics 365 server. - * * @returns The version number */ getVersion(): string; @@ -464,7 +459,6 @@ declare namespace Xrm { /** * Prefixes the current organization's unique name to a string; typically a URL path. - * * @param sPath Local pathname of the resource. * @returns A path string with the organization name. Format: "/"+ OrgName + sPath */ @@ -478,28 +472,25 @@ declare namespace Xrm { interface SaveEventArguments { /** * @summary Gets save mode, as an integer. - * * @returns The save mode. - * - * @description Gets save mode, as an integer. - * Values returned are: 1 Save - * 2 Save and Close - * 59 Save and New - * 70 AutoSave (Where enabled; can be used with an OnSave handler - * to conditionally disable auto-saving) - * 58 Save as Completed (Activities) - * 5 Deactivate - * 6 Reactivate - * 47 Assign (All user- or team-owned entities) - * 7 Send (Email) - * 16 Qualify (Lead) - * 15 Disqualify (Lead) + * @description Gets save mode, as an integer.
+ * **Values returned are**: + * * 1 Save + * * 2 Save and Close + * * 59 Save and New + * * 70 AutoSave (Where enabled; can be used with an OnSave handler to conditionally disable auto-saving) + * * 58 Save as Completed (Activities) + * * 5 Deactivate + * * 6 Reactivate + * * 47 Assign (All user- or team-owned entities) + * * 7 Send (Email) + * * 16 Qualify (Lead) + * * 15 Disqualify (Lead) */ getSaveMode(): XrmEnum.SaveMode; /** * Returns a boolean value to indicate if the record's save has been prevented. - * * @returns true if saving is prevented, otherwise false. */ isDefaultPrevented(): boolean; @@ -649,6 +640,7 @@ declare namespace Xrm { /** * Interface for the formContext.data object. + * @note NTOE NOTE * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data External Link: formContext.data (Client API reference)} */ interface Data { @@ -827,13 +819,14 @@ declare namespace Xrm { /** * Gets form type. * @returns The form type. - * @remarks Values returned are: 0 Undefined - * 1 Create - * 2 Update - * 3 Read Only - * 4 Disabled - * 6 Bulk Edit - * Deprecated values are 5 (Quick Create), and 11 (Read Optimized) + * @remarks **Values returned are**: + * * 0 Undefined + * * 1 Create + * * 2 Update + * * 3 Read Only + * * 4 Disabled + * * 6 Bulk Edit + * * Deprecated values are 5 (Quick Create), and 11 (Read Optimized) */ getFormType(): XrmEnum.FormType; @@ -870,14 +863,12 @@ declare namespace Xrm { /** * The form selector API. - * * @remarks This API does not exist with Microsoft Dynamics CRM for tablets. */ formSelector: Controls.FormSelector; /** * The navigation API. - * * @remarks This API does not exist with Microsoft Dynamics CRM for tablets. */ navigation: Controls.Navigation; @@ -946,8 +937,8 @@ declare namespace Xrm { /** * Returns the entity metadata for the specified entity. - * @param entityName The logical name of the entity. - * @param attributes The attributes to get metadata for. + * @param entityName The logical name of the entity. + * @param attributes The attributes to get metadata for. */ getEntityMetadata(entityName: string, attributes?: string[]): Async.PromiseLike; @@ -959,8 +950,8 @@ declare namespace Xrm { /** * Returns the localized string for a given key associated with the specified web resource. - * @param webResourceName The name of the web resource. - * @param key The key for the localized string. + * @param webResourceName The name of the web resource. + * @param key The key for the localized string. * @returns A localized string. */ getResourceString(webResourceName: string, key: string): string; @@ -1056,14 +1047,15 @@ declare namespace Xrm { * @param width (Optional) The width of the new window. * @param height (Optional) The height of the new window. * @returns A Window reference, containing the opened Web Resource. - * @remarks This function will not work with Microsoft Dynamics CRM for tablets. - * Valid WebResource URL Parameters: typename - * type - * id - * orgname - * userlcid - * data (identical to this method's webResourceData parameter) - * formid + * @remarks This function will not work with Microsoft Dynamics CRM for tablets.
+ * **Valid WebResource URL Parameters**: + * * typename + * * type + * * id + * * orgname + * * userlcid + * * data (identical to this method's webResourceData parameter) + * * formid */ openWebResource(webResourceName: string, webResourceData?: string, width?: number, height?: number): Window; } @@ -1102,10 +1094,10 @@ declare namespace Xrm { * @param entityType The logical name of the entity. * @param data A dictionary object containing key : value pairs for the record to create. * @returns Returns an asynchronous promise. - * @remarks You cannot create intersect and activity party entities. - * Only the following attribute types are supported in offline mode: - * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName - * Integer, Lookup, Memo, Money, Owner, Picklist, String, State + * @remarks You cannot create intersect and activity party entities.
+ * Only the following attribute types are supported in offline mode:
+ * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName
+ * Integer, Lookup, Memo, Money, Owner, Picklist, String, State
* Status, UniqueIdentifier * @deprecated Use {@link Xrm.WebApi.createRecord} instead. * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} @@ -1121,10 +1113,10 @@ declare namespace Xrm { * @example Example options * options: ?$select=name&$expand=primarycontactid($select=contactid,fullname) * @returns Returns an asynchronous promise. - * @remarks Only $select option can be specified within $expand. - * Only the following attribute types are supported in offline mode: - * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName - * Integer, Lookup, Memo, Money, Owner, Picklist, String, State + * @remarks Only $select option can be specified within $expand.
+ * Only the following attribute types are supported in offline mode:
+ * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName
+ * Integer, Lookup, Memo, Money, Owner, Picklist, String, State
* Status, UniqueIdentifier * @deprecated Use {@link Xrm.WebApi.retrieveRecord} instead. * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} @@ -1137,17 +1129,17 @@ declare namespace Xrm { * @param entityType The logical name of the entity. * @param options (Optional) The logical name of the enti * @param maxPageSize (Optional) A positive number to indicates the number of entity records to be returned per page. - * If you do not specify this parameter, the default value is passed as 5000. - * If the number of records being retrieved is more than maxPageSize, an @odata.nextLink property - * will be returned, and you can use the value of the @odata.nextLink property with a new GET - * request to return next set of records. + * * If you do not specify this parameter, the default value is passed as 5000. + * * If the number of records being retrieved is more than maxPageSize, an @odata.nextLink property + * will be returned, and you can use the value of the @odata.nextLink property with a new GET + * request to return next set of records. * @returns Returns an asynchronous promise. * @remarks A maximum of 5000 related records can be retrieved when using $expand. - * Only $select option can be specified within $expand. - * $skip query option is not supported. - * Only the following attribute types are supported in offline mode: - * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName - * Integer, Lookup, Memo, Money, Owner, Picklist, String, State + * * Only $select option can be specified within $expand. + * * $skip query option is not supported. + * * Only the following attribute types are supported in offline mode:
+ * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName
+ * Integer, Lookup, Memo, Money, Owner, Picklist, String, State
* Status, UniqueIdentifier * @deprecated Use {@link Xrm.WebApi.retrieveMultipleRecords} instead. * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} @@ -1160,10 +1152,10 @@ declare namespace Xrm { * @param id GUID of the record to update. * @param data A dictionary object containing key : value pairs for the record to update. * @returns Returns an asynchronous promise. - * @remarks You cannot update intersect and activity party entities. - * Only the following attribute types are supported in offline mode: - * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName - * Integer, Lookup, Memo, Money, Owner, Picklist, String, State + * @remarks You cannot update intersect and activity party entities.
+ * Only the following attribute types are supported in offline mode:
+ * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName
+ * Integer, Lookup, Memo, Money, Owner, Picklist, String, State
* Status, UniqueIdentifier * @deprecated Use {@link Xrm.WebApi.updateRecord} instead. * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} @@ -1293,17 +1285,14 @@ declare namespace Xrm { namespace Collection { /** * Called for each item in an array - * * @param item The item. * @param index Zero-based index of the item array. - * * @returns true if the item matches, false if it does not. */ type MatchingDelegate = (item: T, index?: number) => boolean; /** * Called for each item in an array - * * @param item The item. * @param index Zero-based index of the item array. */ @@ -1311,7 +1300,6 @@ declare namespace Xrm { /** * Interface for an item collection. - * * @param T Generic type parameter. */ interface Dictionary { @@ -1862,13 +1850,13 @@ declare namespace Xrm { /** * Called when method to get active processes is complete * @param status The result of the get active processes operation. - * @remarks Returns object with the following key-value pairs: - * CreatedOn - * ProcessDefinitionID - * ProcessDefinitionName - * ProcessInstanceID - * ProcessInstanceName - * StatusCodeName + * @remarks **Returns object with the following key-value pairs**: + * * CreatedOn + * * ProcessDefinitionID + * * ProcessDefinitionName + * * ProcessInstanceID + * * ProcessInstanceName + * * StatusCodeName * @deprecated Use {@link Xrm.ProcessFlow.GetProcessInstancesDelegate} instead. */ type GetProcessInstancesDelegate = ProcessFlow.GetProcessInstancesDelegate; @@ -1876,8 +1864,9 @@ declare namespace Xrm { /** * Called when method to set active process is complete * @param status The result of the set active process operation. - * @remarks Values returned are: success (The operation succeeded.) - * invalid (The processInstanceId isn’t valid or the process isn’t enabled.) + * @remarks **Values returned are**: + * * success (The operation succeeded.) + * * invalid (The processInstanceId isn’t valid or the process isn’t enabled.) * @deprecated Use {@link Xrm.ProcessFlow.SetProcessInstanceDelegate} instead. */ type SetProcessInstanceDelegate = ProcessFlow.SetProcessInstanceDelegate; @@ -1885,24 +1874,23 @@ declare namespace Xrm { /** * Called when process change methods have completed. * @param status The result of the process change operation. - * @remarks Values returned are: success (The operation succeeded.) - * crossEntity (The previous stage is for a different entity.) - * beginning (The active stage is the first stage of the active path.) - * invalid (The operation failed because the selected stage isn’t the same - * as the active stage.) - * unreachable (The stage exists on a different path.) + * @remarks **Values returned are**: + * * success (The operation succeeded.) + * * crossEntity (The previous stage is for a different entity.) + * * beginning (The active stage is the first stage of the active path.) + * * invalid (The operation failed because the selected stage isn’t the same as the active stage.) + * * unreachable (The stage exists on a different path.) * @deprecated Use {@link Xrm.ProcessFlow.ProcessCallbackDelegate} instead. */ type ProcessCallbackDelegate = ProcessFlow.ProcessCallbackDelegate; /** * Called when process set status method has completed. - * * @param status The new status of the process instance - * - * @remarks Values returned are: active - * aborted - * finished + * @remarks **Values returned are**: + * * active + * * aborted + * * finished * @deprecated Use {@link Xrm.ProcessFlow.ProcessSetStatusDelegate} instead. */ type ProcessSetStatusDelegate = ProcessFlow.ProcessSetStatusDelegate; @@ -2094,38 +2082,38 @@ declare namespace Xrm { /** * Gets attribute type. - * @returns The attribute's type name. - * Values returned are: boolean - * datetime - * decimal - * double - * integer - * lookup - * memo - * money - * optionset - * string + * @returns The attribute's type name.

+ * **Values returned are**: + * * boolean + * * datetime + * * decimal + * * double + * * integer + * * lookup + * * memo + * * money + * * optionset + * * string */ getAttributeType(): string; /** * Gets the attribute format. - * - * @returns The format of the attribute. - * + * @returns The format of the attribute.

+ * **Values returned are**: + * * date (datetime) + * * datetime (datetime) + * * duration (integer) + * * email (string) + * * language (optionset) + * * none (integer) + * * phone (string) + * * text (string) + * * textarea (string) + * * tickersymbol (string) + * * timezone (optionset) + * * url (string) * @see {@link getAttributeType} - * Values returned are: date (datetime) - * datetime (datetime) - * duration (integer) - * email (string) - * language (optionset) - * none (integer) - * phone (string) - * text (string) - * textarea (string) - * tickersymbol (string) - * timezone (optionset) - * url (string) */ getFormat(): AttributeFormat; @@ -2270,9 +2258,7 @@ declare namespace Xrm { /** * Gets maximum length allowed. - * * @returns The maximum length allowed. - * * @remarks The email form's "Description" attribute does not have the this method. */ getMaxLength(): number; @@ -2504,14 +2490,12 @@ declare namespace Xrm { interface UiLabelElement { /** * Gets the label. - * * @returns The label. */ getLabel(): string; /** * Sets the label. - * * @param label The label. */ setLabel(label: string): void; @@ -2523,7 +2507,6 @@ declare namespace Xrm { interface UiCanGetVisibleElement { /** * Gets the visibility state. - * * @returns true if the tab is visible, otherwise false. */ getVisible(): boolean; @@ -2535,7 +2518,6 @@ declare namespace Xrm { interface UiCanSetVisibleElement { /** * Sets the visibility state. - * * @param visible true to show, false to hide. */ setVisible(visible: boolean): void; @@ -2547,7 +2529,6 @@ declare namespace Xrm { interface UiStandardElement extends UiCanGetVisibleElement, UiLabelElement { /** * Sets the visibility state. - * * @param visible true to show, false to hide. */ setVisible(visible: boolean): void; @@ -2660,19 +2641,20 @@ declare namespace Xrm { interface Control extends UiLabelElement, UiCanGetVisibleElement { /** * Gets the controls type. - * @returns The control type. - * @remarks Values returned are: standard - * iframe - * lookup - * optionset - * subgrid - * webresource - * notes - * timercontrol - * kbsearch (CRM Online Only, use parature.d.ts) - * quickform (see ui.QuickForm) - * customcontrol: . (A custom control for mobile phone and tablet clients). - * customsubgrid: . (A custom dataset control for mobile phone and tablet clients). + * @returns The control type.

+ * **Values returned are**: + * * standard + * * iframe + * * lookup + * * optionset + * * subgrid + * * webresource + * * notes + * * timercontrol + * * kbsearch (CRM Online Only, use parature.d.ts) + * * quickform (see ui.QuickForm) + * * customcontrol: . (A custom control for mobile phone and tablet clients). + * * customsubgrid: . (A custom dataset control for mobile phone and tablet clients). */ getControlType(): ControlType | string; @@ -2694,7 +2676,6 @@ declare namespace Xrm { /** * Gets a reference to the Section parent of the control. - * * @returns The parent Section. */ getParent(): Section; @@ -3816,7 +3797,6 @@ declare namespace Xrm { /** * Moves to the previous stage. * @param callbackFunction (Optional) A function to call when the operation is complete. - * . */ movePrevious(callbackFunction?: ProcessCallbackDelegate): void; @@ -3849,33 +3829,34 @@ declare namespace Xrm { /** * Called when method to get active processes is complete * @param status The result of the get active processes operation. - * @remarks Returns object with the following key-value pairs: - * CreatedOn - * ProcessDefinitionID - * ProcessDefinitionName - * ProcessInstanceID - * ProcessInstanceName - * StatusCodeName + * @remarks **Returns object with the following key-value pairs**: + * * CreatedOn + * * ProcessDefinitionID + * * ProcessDefinitionName + * * ProcessInstanceID + * * ProcessInstanceName + * * StatusCodeName */ type GetProcessInstancesDelegate = (object: ProcessDictionary) => void; /** * Called when method to set active process is complete * @param status The result of the set active process operation. - * @remarks Values returned are: success (The operation succeeded.) - * invalid (The processInstanceId isn’t valid or the process isn’t enabled.) + * @remarks **Values returned are**: + * * success (The operation succeeded.) + * * invalid (The processInstanceId isn’t valid or the process isn’t enabled.) */ type SetProcessInstanceDelegate = (status: string) => void; /** * Called when process change methods have completed. * @param status The result of the process change operation. - * @remarks Values returned are: success (The operation succeeded.) - * crossEntity (The previous stage is for a different entity.) - * beginning (The active stage is the first stage of the active path.) - * invalid (The operation failed because the selected stage isn’t the same - * as the active stage.) - * unreachable (The stage exists on a different path.) + * @remarks **Values returned are**: + * * success (The operation succeeded.) + * * crossEntity (The previous stage is for a different entity.) + * * beginning (The active stage is the first stage of the active path.) + * * invalid (The operation failed because the selected stage isn’t the same as the active stage.) + * * unreachable (The stage exists on a different path.) */ type ProcessCallbackDelegate = (status: string) => void; @@ -3920,16 +3901,19 @@ declare namespace Xrm { namespace Url { /** * Command Bar Display options for Xrm.Url.FormOpenParameters.cmdbar, Xrm.Url.ViewOpenParameters.cmdbar, and Xrm.Utility.FormOpenParameters.cmdbar. + * @see {@link XrmEnum.CmdBarDisplay} */ type CmdBarDisplay = "true" | "false"; /** * Navigation Bar Display options for Xrm.Url.FormOpenParameters.navbar, Xrm.Url.ViewOpenParameters.navbar, and Xrm.Utility.FormOpenParameters.navbar. + * @see {@link XrmEnum.NavBarDisplay} */ type NavBarDisplay = "entity" | "off" | "on"; /** * Report Open Action options for Xrm.Url.ReportOpenParameters.actions. + * @see {@link XrmEnum.ReportAction} */ type ReportAction = "filter" | "run"; @@ -3957,17 +3941,18 @@ declare namespace Xrm { /** * Controls whether the command bar is displayed. - * Accepted values are: "true" (The command bar is displayed.) - * "false" (The command bar is not displayed.) + * @remarks **Accepted values are**: + * * "true" (The command bar is displayed.) + * * "false" (The command bar is not displayed.) */ cmdbar?: CmdBarDisplay; /** * Controls whether the Navigation bar is displayed on the form. - * Accepted values are: "on" (The navigation bar is displayed.) - * "off" (The navigation bar is not displayed.) - * "entity" (On an entity form, only the navigation options for related - * entities are available.) + * @remarks **Accepted values are**: + * * "on" (The navigation bar is displayed.) + * * "off" (The navigation bar is not displayed.) + * * "entity" (On an entity form, only the navigation options for related entities are available.) */ navbar?: NavBarDisplay; } @@ -3976,9 +3961,7 @@ declare namespace Xrm { * Interface for defining parameters on a request to open a view with main.aspx (as with * window.open). Useful for parsing the keys and values into a string of the format: * "&key=value". - * * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link: Open forms, views, dialogs, and reports with a URL} - * * @remarks A member for "pagetype" is not provided. The value "entitylist" is required in * the URL, for views. Example: "pagetype=entitylist" */ @@ -3996,24 +3979,26 @@ declare namespace Xrm { /** * The type of view identified by {@link viewid}. - * @remarks Accepted values are: 1039 System View - * 4230 User View. + * @remarks **Accepted values are**: + * * 1039 System View + * * 4230 User View. */ viewtype: XrmEnum.ViewType; /** * Controls whether the command bar is displayed. - * Accepted values are: "true" (The command bar is displayed.) - * "false" (The command bar is not displayed.) + * @remarks **Accepted values are**: + * * "true" (The command bar is displayed.) + * * "false" (The command bar is not displayed.) */ cmdbar?: CmdBarDisplay; /** * Controls whether the Navigation bar is displayed on the form. - * Accepted values are: "on" (The navigation bar is displayed.) - * "off" (The navigation bar is not displayed.) - * "entity" (On an entity form, only the navigation options for related - * entities are available.) + * @remarks **Accepted values are**: + * * "on" (The navigation bar is displayed.) + * * "off" (The navigation bar is not displayed.) + * * "entity" (On an entity form, only the navigation options for related entities are available.) */ navbar?: NavBarDisplay; } @@ -4052,9 +4037,9 @@ declare namespace Xrm { interface ReportOpenParameters { /** * The action to perform, as either "run" or "filter". - * - * @remarks "run" Executes the report with default filters. - * "filter" Presents the user with the filter editor, and a "Run Report" button. + * @remarks **Actions**: + * * "run" Executes the report with default filters. + * * "filter" Presents the user with the filter editor, and a "Run Report" button. */ action: ReportAction; @@ -4101,17 +4086,18 @@ declare namespace Xrm { /** * Controls whether the Navigation bar is displayed on the form. - * Accepted values are: "on" (The navigation bar is displayed.) - * "off" (The navigation bar is not displayed.) - * "entity" (On an entity form, only the navigation options for related - * entities are available.) + * @remarks **Accepted values are**: + * * "on" (The navigation bar is displayed.) + * * "off" (The navigation bar is not displayed.) + * * "entity" (On an entity form, only the navigation options for related entities are available.) */ navbar?: Url.NavBarDisplay; /** * Controls whether the command bar is displayed. - * Accepted values are: "true" (The command bar is displayed.) - * "false" (The command bar is not displayed.) + * @remarks **Accepted values are**: + * * "true" (The command bar is displayed.) + * * "false" (The command bar is not displayed.) */ cmdbar?: Url.CmdBarDisplay; } @@ -4276,9 +4262,9 @@ declare namespace Xrm { isOfflineSyncError?: boolean; /** * Controls whether the navigation bar is displayed and whether application navigation is available using the areas and subareas defined in the sitemap.Valid vlaues are: "on", "off", or "entity". - * on: The navigation bar is displayed.This is the default behavior if the navBar parameter is not used. - * off: The navigation bar is not displayed.People can navigate using other user interface elements or the back and forward buttons. - * entity: On an entity form, only the navigation options for related entities are available.After navigating to a related entity, a back button is displayed in the navigation bar to allow returning to the original record. + * * on: The navigation bar is displayed.This is the default behavior if the navBar parameter is not used. + * * off: The navigation bar is not displayed.People can navigate using other user interface elements or the back and forward buttons. + * * entity: On an entity form, only the navigation options for related entities are available.After navigating to a related entity, a back button is displayed in the navigation bar to allow returning to the original record. */ navBar?: Url.NavBarDisplay; /** @@ -4287,8 +4273,8 @@ declare namespace Xrm { openInNewWindow?: boolean; /** * Specify one of the following values for the window position of the form on the screen: - * 1:center - * 2:side + * * 1:center + * * 2:side */ windowPosition?: XrmEnum.WindowPositions; /** @@ -4332,14 +4318,14 @@ declare namespace Xrm { navigationPropertyName?: string; /** * Relationship type.Specify one of the following values: - * 0:OneToMany - * 1:ManyToMany + * * 0:OneToMany + * * 1:ManyToMany */ relationshipType?: XrmEnum.RelationshipType; // /** * Role type in relationship.Specify one of the following values: - * 1:Referencing - * 2:AssociationEntity + * * 1:Referencing + * * 2:AssociationEntity */ roleType?: XrmEnum.RoleType; } @@ -4588,6 +4574,7 @@ declare namespace Xrm { /** * Posible file types for Xrm.Device.pickFile options + * @see {@link XrmEnum.DevicePickFileType} */ type PickFileTypes = "audio" | "video" | "image"; @@ -4704,28 +4691,28 @@ declare namespace Xrm { /** * Execute a single action, function, or CRUD operation. * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/execute External Link: execute (Client API reference)} - * @param request Object that will be passed to the Web API endpoint to execute an action, function, or CRUD request. - * The object exposes a getMetadata method that lets you define the metadata for the action, function or CRUD request you want to execute. - * The getMetadata method has the following parameters: - * -boundParameter: (Optional) String. The name of the bound parameter for the action or function to execute. - * Specify undefined if you are executing a CRUD request. - * Specify null if the action or function to execute is not bound to any entity. - * Specify entity logical name or entity set name in case the action or function to execute is bound to one. - * -operationName: (Optional). String. Name of the action, function, or one of the following values if you are executing a CRUD request: "Create", "Retrieve", "RetrieveMultiple", "Update", or "Delete". - * -operationType: (Optional). Number. Indicates the type of operation you are executing; specify one of the following values: - * 0: Action - * 1: Function - * 2: CRUD - * -parameterTypes: Object. The metadata for parameter types. The object has the following attributes: - * -enumProperties: (Optional) Object. The metadata for enum types. The object has two string attributes: name and value - * -structuralProperty: Number. The category of the parameter type. Specify one of the following values: - * 0: Unknown - * 1: PrimitiveType - * 2: ComplexType - * 3: EnumerationType - * 4: Collection - * 5: EntityType - * -typeName: String. The fully qualified name of the parameter type. + * @param request Object that will be passed to the Web API endpoint to execute an action, function, or CRUD request. + * @remarks The object exposes a getMetadata method that lets you define the metadata for the action, function or CRUD request you want to execute.
+ * **The getMetadata method has the following parameters**: + * - boundParameter: (Optional) String. The name of the bound parameter for the action or function to execute. + * * Specify undefined if you are executing a CRUD request. + * * Specify null if the action or function to execute is not bound to any entity. + * * Specify entity logical name or entity set name in case the action or function to execute is bound to one. + * - operationName: (Optional). String. Name of the action, function, or one of the following values if you are executing a CRUD request: "Create", "Retrieve", "RetrieveMultiple", "Update", or "Delete". + * - operationType: (Optional). Number. Indicates the type of operation you are executing; specify one of the following values: + * * 0: Action + * * 1: Function + * * 2: CRUD + * - parameterTypes: Object. The metadata for parameter types. The object has the following attributes: + * - enumProperties: (Optional) Object. The metadata for enum types. The object has two string attributes: name and value + * - structuralProperty: Number. The category of the parameter type. Specify one of the following values: + * * 0: Unknown + * * 1: PrimitiveType + * * 2: ComplexType + * * 3: EnumerationType + * * 4: Collection + * * 5: EntityType + * - typeName: String. The fully qualified name of the parameter type. */ execute(request: any): Async.PromiseLike; @@ -4733,13 +4720,13 @@ declare namespace Xrm { * Execute a collection of action, function, or CRUD operations. * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/executemultiple External Link: executeMultiple (Client API reference)} * @param request An array of one of one of the following types: - * -objects where each object is an action, function, or CRUD request that you want to execute - * against the Web API endpoint. Each object exposes a getMetadata method that lets you define - * the metadata for the action, function or CRUD request you want to execute. This is the same - * object that you pass in the execute method. For information about the object, see execute. - * -change set (an array of objects), where each object in the change set is as defined above. - * In this case, all the request objects specified in the change set will get executed in a - * transaction. + * -objects where each object is an action, function, or CRUD request that you want to execute + * * against the Web API endpoint. Each object exposes a getMetadata method that lets you define + * the metadata for the action, function or CRUD request you want to execute. This is the same + * object that you pass in the execute method. For information about the object, see execute. + * -change set (an array of objects), where each object in the change set is as defined above. + * * In this case, all the request objects specified in the change set will get executed in a + * transaction. */ executeMultiple(request: any[]): Async.PromiseLike; } @@ -4770,18 +4757,18 @@ declare namespace Xrm { * Retrieves an entity record. * @param entityLogicalName The entity logical name of the record you want to retrieve. For example: "account". * @param id GUID of the entity record you want to retrieve. - * @param options (Optional) OData system query options, $select and $expand, to retrieve your data. - * -Use the $select system query option to limit the properties returned by including a comma-separated - * list of property names. This is an important performance best practice. If properties aren’t - * specified using $select, all properties will be returned. - * -Use the $expand system query option to control what data from related entities is returned. If you - * just include the name of the navigation property, you’ll receive all the properties for related - * records. You can limit the properties returned for related records using the $select system query - * option in parentheses after the navigation property name. Use this for both single-valued and - * collection-valued navigation properties. - * You can also specify multiple query options by using & to separate the query options. - * @example: options example: - * options: $select=name&$expand=primarycontactid($select=contactid,fullname) + * @param options (Optional) OData system query options, $select and $expand, to retrieve your data. + * - Use the $select system query option to limit the properties returned by including a comma-separated + * list of property names. This is an important performance best practice. If properties aren’t + * specified using $select, all properties will be returned. + * - Use the $expand system query option to control what data from related entities is returned. If you + * just include the name of the navigation property, you’ll receive all the properties for related + * records. You can limit the properties returned for related records using the $select system query + * option in parentheses after the navigation property name. Use this for both single-valued and + * collection-valued navigation properties. + * - You can also specify multiple query options by using & to separate the query options. + * @example options example: + * options: $select=name&$expand=primarycontactid($select=contactid,fullname) * @returns On success, returns a promise containing a JSON object with the retrieved attributes and their values. * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/retrieverecord External Link: retrieveRecord (Client API reference)} */ @@ -4790,16 +4777,15 @@ declare namespace Xrm { /** * Retrieves a collection of entity records. * @param entityLogicalName The entity logical name of the records you want to retrieve. For example: "account". - * @param options (Optional) OData system query options or FetchXML query to retrieve your data. - * Following system query options are supported: $select, $top, $filter, $expand, and $orderby. - * To specify a FetchXML query, use the fetchXml attribute to specify the query. - * NOTE: You must always use the $select system query option to limit the properties returned for an entity - * record by including a comma-separated list of property names. This is an important performance best practice. - * If properties aren’t specified using $select, all properties will be returned. - * - * You can specify multiple system query options by using & to separate the query options. - * @param maxPageSize (Optional) Specify a positive number that indicates the number of entity records to be returned per page. - * If you do not specify this parameter, the default value is passed as 5000. If the number of records being retrieved is more than the specified + * @param options (Optional) OData system query options or FetchXML query to retrieve your data. + * * Following system query options are supported: $select, $top, $filter, $expand, and $orderby. + * * To specify a FetchXML query, use the fetchXml attribute to specify the query. + * * NOTE: You must always use the $select system query option to limit the properties returned for an entity + * record by including a comma-separated list of property names. This is an important performance best practice. + * * If properties aren’t specified using $select, all properties will be returned. + * * You can specify multiple system query options by using & to separate the query options. + * @param maxPageSize (Optional) Specify a positive number that indicates the number of entity records to be returned per page. + * * If you do not specify this parameter, the default value is passed as 5000. If the number of records being retrieved is more than the specified * maxPageSize value, nextLink attribute in the returned promise object will contain a link to retrieve the next set of entities. * @returns On success, returns a promise object containing the attributes specified earlier in the description of the successCallback parameter. * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/retrievemultiplerecords External Link: retrieveMultipleRecords (Client API reference)} @@ -5085,7 +5071,7 @@ declare namespace XrmEnum { /** * Constant Enum: Themes for {@link GlobalContext.getCurrentTheme globalContext.getCurrentTheme()}. - * Note: getCurrentTheme() does not work with Dynamics CRM for tablets or in the unified interface. + * @remarks getCurrentTheme() does not work with Dynamics CRM for tablets or in the unified interface. */ const enum Theme { Default = "default", @@ -5214,4 +5200,42 @@ declare namespace XrmEnum { Aborted = "aborted", Finished = "finished" } + + /** + * Constant Enum: Command Bar Display options for Xrm.Url.FormOpenParameters.cmdbar, Xrm.Url.ViewOpenParameters.cmdbar, and Xrm.Utility.FormOpenParameters.cmdbar. + * @see {@link Xrm.Url.CmdBarDisplay} + */ + const enum CmdBarDisplay { + True = "true", + False = "false" + } + + /** + * Constant Enum: Navigation Bar Display options for Xrm.Url.FormOpenParameters.navbar, Xrm.Url.ViewOpenParameters.navbar, and Xrm.Utility.FormOpenParameters.navbar. + * @see {@link Xrm.Url.NavBarDisplay} + */ + const enum NavBarDisplay { + Entity = "entity", + On = "on", + Off = "off" + } + + /** + * Constant Enum: Report Open Action options for Xrm.Url.ReportOpenParameters.actions. + * @see {@link Xrm.Url.ReportAction} + */ + const enum ReportAction { + Filter = "filter", + Run = "run" + } + + /** + * Constant Enum: Posible file types for Xrm.Device.pickFile options + * @see {@link Xrm.Device.PickFileTypes} + */ + const enum DevicePickFileType { + Audio = "audio", + Video = "vidoe", + Image = "image" + } } From c1fb697564f821cd1bf53b054e97a28d3c0d52ec Mon Sep 17 00:00:00 2001 From: Carlton Colter Date: Sat, 25 Nov 2017 16:06:03 -0500 Subject: [PATCH 59/90] GlobalContext changed to ClientContext GlobalContext changed to ClientContext in remaining constant @link tags --- types/xrm/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index ab9adfd1fa..59eb452db8 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -5009,7 +5009,7 @@ declare namespace XrmEnum { } /** - * Constant Enum: Client Types for {@link GlobalContext.getClient globalContext.getClient()}. + * Constant Enum: Client Types for {@link ClientContext.getClient clientContext.getClient()}. * @see {@link Xrm.Client} */ const enum Client { @@ -5021,7 +5021,7 @@ declare namespace XrmEnum { } /** - * Constant Enum: Client States for {@link GlobalContext.getClientState globalContext.getClientState()}. + * Constant Enum: Client States for {@link ClientContext.getClientState clientContext.getClientState()}. * @see {@link Xrm.ClientState} */ const enum ClientState { From ef1bff7d81423e45b07c5dcc93c526944ea148de Mon Sep 17 00:00:00 2001 From: Guangda Zhang Date: Sat, 25 Nov 2017 20:56:09 -0800 Subject: [PATCH 60/90] optional third parameters --- types/ember-data/index.d.ts | 4 ++-- types/ember-data/test/adapter.ts | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/types/ember-data/index.d.ts b/types/ember-data/index.d.ts index 35a291634b..758b7fbde1 100644 --- a/types/ember-data/index.d.ts +++ b/types/ember-data/index.d.ts @@ -1035,11 +1035,11 @@ declare namespace DS { /** * Takes a URL, an HTTP method and a hash of data, and makes an HTTP request. */ - ajax(url: string, type: string, options: object): Promise; + ajax(url: string, type: string, options?: object): Promise; /** * Generate ajax options */ - ajaxOptions(url: string, type: string, options: object): object; + ajaxOptions(url: string, type: string, options?: object): object; /** * By default, the RESTAdapter will send the query params sorted alphabetically to the * server. diff --git a/types/ember-data/test/adapter.ts b/types/ember-data/test/adapter.ts index b8d0bed62f..5d9d45fd4b 100644 --- a/types/ember-data/test/adapter.ts +++ b/types/ember-data/test/adapter.ts @@ -44,3 +44,13 @@ const UseAjaxOptions = DS.JSONAPIAdapter.extend({ }); } }); + +const UseAjaxOptionsWithOptionalThirdParams = DS.JSONAPIAdapter.extend({ + query(store: DS.Store, type: string, query: object) { + const url = 'https://api.example.com/my-api'; + const options = this.ajaxOptions(url, 'DELETE'); + return Ember.$.ajax(url, { + ...options + }); + } +}); From 0bd13cce3f66140ffba1e01f541780549b35ba3d Mon Sep 17 00:00:00 2001 From: izackhub Date: Sun, 26 Nov 2017 14:23:04 +0100 Subject: [PATCH 61/90] [index.d.ts]: added new declaration Since the library itself is titled 'is_js' on npm, this would solve the problem of the definitions not being found or having to rename the package folder. --- types/is/index.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/is/index.d.ts b/types/is/index.d.ts index 3c0e279eea..b61bd6deee 100644 --- a/types/is/index.d.ts +++ b/types/is/index.d.ts @@ -1320,4 +1320,8 @@ declare var is: Is; declare module 'is' { export = is; -} \ No newline at end of file +} + +declare module 'is_js' { + export = is; +} From 92629c37be2403dc19f0b3f0dc784cf7d6b31eea Mon Sep 17 00:00:00 2001 From: Mathias Teier Date: Sun, 26 Nov 2017 18:02:33 +0100 Subject: [PATCH 62/90] FIX: Added missing get_retain Flag to ISubscribeOptions --- types/autobahn/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/autobahn/index.d.ts b/types/autobahn/index.d.ts index 7f01a53e3a..969c703478 100644 --- a/types/autobahn/index.d.ts +++ b/types/autobahn/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for AutobahnJS v0.9.7 // Project: http://autobahn.ws/js/ -// Definitions by: Elad Zelingher , Andy Hawkins , Wladimir Totino +// Definitions by: Elad Zelingher , Andy Hawkins , Wladimir Totino , Mathias Teier // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -179,6 +179,7 @@ declare namespace autobahn { interface ISubscribeOptions { match?: string; + get_retained?: boolean; } interface IRegisterOptions { From 59ce8d03df4ceb81fa3d81e1937fa513323afd2d Mon Sep 17 00:00:00 2001 From: Peter Bartha Date: Sun, 26 Nov 2017 21:07:32 +0100 Subject: [PATCH 63/90] Change properties of argument options --- types/codemirror/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/codemirror/index.d.ts b/types/codemirror/index.d.ts index 24e905b8e2..8089bfb2aa 100644 --- a/types/codemirror/index.d.ts +++ b/types/codemirror/index.d.ts @@ -536,13 +536,13 @@ declare namespace CodeMirror { setCursor(pos: CodeMirror.Position): void; /** Set a single selection range. anchor and head should be {line, ch} objects. head defaults to anchor when not given. */ - setSelection(anchor: CodeMirror.Position, head: CodeMirror.Position, options?: { bias: number, clearRedo: boolean, origin: string, scroll: boolean }): void; + setSelection(anchor: CodeMirror.Position, head: CodeMirror.Position, options?: { bias?: number, origin?: string, scroll?: boolean }): void; /** Sets a new set of selections. There must be at least one selection in the given array. When primary is a number, it determines which selection is the primary one. When it is not given, the primary index is taken from the previous selection, or set to the last range if the previous selection had less ranges than the new one. Supports the same options as setSelection. */ - setSelections(ranges: Array<{ anchor: CodeMirror.Position, head: CodeMirror.Position }>, primary?: number, options?: { bias: number, clearRedo: boolean, origin: string, scroll: boolean }): void; + setSelections(ranges: Array<{ anchor: CodeMirror.Position, head: CodeMirror.Position }>, primary?: number, options?: { bias?: number, origin?: string, scroll?: boolean }): void; /** Similar to setSelection , but will, if shift is held or the extending flag is set, move the head of the selection while leaving the anchor at its current place. From 65c7acb1c03d3c40183705a0b9a7201c1aeb3595 Mon Sep 17 00:00:00 2001 From: Josh Holmer Date: Sun, 26 Nov 2017 18:35:40 -0500 Subject: [PATCH 64/90] Add initial typings for react-toastr --- types/react-toastr/index.d.ts | 20 ++++++++++++++++++ types/react-toastr/react-toastr-tests.tsx | 22 ++++++++++++++++++++ types/react-toastr/tsconfig.json | 25 +++++++++++++++++++++++ types/react-toastr/tslint.json | 1 + 4 files changed, 68 insertions(+) create mode 100644 types/react-toastr/index.d.ts create mode 100644 types/react-toastr/react-toastr-tests.tsx create mode 100644 types/react-toastr/tsconfig.json create mode 100644 types/react-toastr/tslint.json diff --git a/types/react-toastr/index.d.ts b/types/react-toastr/index.d.ts new file mode 100644 index 0000000000..2de77a6d7e --- /dev/null +++ b/types/react-toastr/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for react-toastr 3.0 +// Project: https://github.com/tomchentw/react-toastr +// Definitions by: Josh Holmer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { Component, ReactHTML } from 'react'; + +export class ToastContainer extends Component<{ + toastMessageFactory: any; + className?: string; +}> { + error: (message: string, title: string, optionsOverride?: {}) => void; + info: (message: string, title: string, optionsOverride?: {}) => void; + success: (message: string, title: string, optionsOverride?: {}) => void; + warning: (message: string, title: string, optionsOverride?: {}) => void; + clear: () => void; +} +export const ToastMessageAnimated: keyof ReactHTML; +export const ToastMessagejQuery: keyof ReactHTML; diff --git a/types/react-toastr/react-toastr-tests.tsx b/types/react-toastr/react-toastr-tests.tsx new file mode 100644 index 0000000000..75d6527730 --- /dev/null +++ b/types/react-toastr/react-toastr-tests.tsx @@ -0,0 +1,22 @@ +import * as React from 'react'; +import { ToastContainer, ToastMessageAnimated } from 'react-toastr'; + +const toastMessageFactory = React.createFactory(ToastMessageAnimated); + +class Test extends React.Component { + ref: ToastContainer; + + toastRef = (ref: ToastContainer) => { + this.ref = ref; + } + + render() { + return ( + + ); + } +} diff --git a/types/react-toastr/tsconfig.json b/types/react-toastr/tsconfig.json new file mode 100644 index 0000000000..1fbbfde4af --- /dev/null +++ b/types/react-toastr/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-toastr-tests.tsx" + ] +} diff --git a/types/react-toastr/tslint.json b/types/react-toastr/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-toastr/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From c8a445c4f1fa33cceee217e4439a54107338a154 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Mon, 27 Nov 2017 13:22:27 +0900 Subject: [PATCH 65/90] feat: add generic type test --- types/react-swipeable/index.d.ts | 4 ++-- types/react-swipeable/react-swipeable-tests.tsx | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/types/react-swipeable/index.d.ts b/types/react-swipeable/index.d.ts index 496f0500cf..1608258c64 100644 --- a/types/react-swipeable/index.d.ts +++ b/types/react-swipeable/index.d.ts @@ -8,7 +8,7 @@ import * as React from 'react'; -declare class ReactSwipeable extends React.Component {} +declare class ReactSwipeable extends React.Component> {} declare namespace ReactSwipeable { type OnSwipingCallback = (event: React.TouchEvent, deltaX: number, deltaY: number, absX: number, absY: number, velocity: number) => void; @@ -17,7 +17,7 @@ declare namespace ReactSwipeable { type OnSwipingDirectionCallback = (event: React.TouchEvent, delta: number) => void; type OnTapCallback = (event: React.TouchEvent) => void; - interface SwipeableProps extends React.ClassAttributes, React.HTMLAttributes { + interface SwipeableProps extends React.ClassAttributes>, React.HTMLAttributes { onSwiped?: OnSwipedCallback; onSwiping?: OnSwipingCallback; onSwipingUp?: OnSwipingDirectionCallback; diff --git a/types/react-swipeable/react-swipeable-tests.tsx b/types/react-swipeable/react-swipeable-tests.tsx index 4fa67abffa..d39f1a1b11 100644 --- a/types/react-swipeable/react-swipeable-tests.tsx +++ b/types/react-swipeable/react-swipeable-tests.tsx @@ -46,3 +46,16 @@ class SampleComponent extends React.PureComponent { ); } } + +class DivSwipeable extends Swipeable {} +const TestComponent: React.StatelessComponent<{}> = (_) => { + const handleSwiped = (event: React.TouchEvent) => {}; + return ( + +
this is sample code.
+
+ ); +}; From c78315abf325ce1f5e10b3ec18a9bb09c3d156d0 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Mon, 27 Nov 2017 13:34:14 +0900 Subject: [PATCH 66/90] fix: tslint error --- types/react-swipeable/react-swipeable-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-swipeable/react-swipeable-tests.tsx b/types/react-swipeable/react-swipeable-tests.tsx index d39f1a1b11..ed5df52e54 100644 --- a/types/react-swipeable/react-swipeable-tests.tsx +++ b/types/react-swipeable/react-swipeable-tests.tsx @@ -48,7 +48,7 @@ class SampleComponent extends React.PureComponent { } class DivSwipeable extends Swipeable {} -const TestComponent: React.StatelessComponent<{}> = (_) => { +const TestComponent: React.StatelessComponent = (_) => { const handleSwiped = (event: React.TouchEvent) => {}; return ( Date: Mon, 27 Nov 2017 02:21:54 -0500 Subject: [PATCH 67/90] GoogleAuth.signIn return Promise by the google reference for this client api, https://developers.google.com/api-client-library/javascript/reference/referencedocs#googleauthsigninoptions, GoogleAuth.signIn should return Promise. --- types/gapi.auth2/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/gapi.auth2/index.d.ts b/types/gapi.auth2/index.d.ts index 4cdef77a80..7dbdb222c3 100644 --- a/types/gapi.auth2/index.d.ts +++ b/types/gapi.auth2/index.d.ts @@ -27,7 +27,7 @@ declare namespace gapi.auth2 { * Signs in the user using the specified options. * If no option specified here, fallback to the options specified to gapi.auth2.init(). */ - signIn(options?: SigninOptions | SigninOptionsBuilder): any; + signIn(options?: SigninOptions | SigninOptionsBuilder): Promise; /** * Signs out all accounts from the application. From b6f4c866ce172223dcae77d34fdb2cd328686c06 Mon Sep 17 00:00:00 2001 From: Andre Wiggins Date: Mon, 27 Nov 2017 02:39:02 -0800 Subject: [PATCH 68/90] Expand gzip-size types for 4.1 --- types/gzip-size/gzip-size-tests.ts | 11 ++++++++- types/gzip-size/index.d.ts | 39 ++++++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/types/gzip-size/gzip-size-tests.ts b/types/gzip-size/gzip-size-tests.ts index f07d99bd50..f840c39239 100644 --- a/types/gzip-size/gzip-size-tests.ts +++ b/types/gzip-size/gzip-size-tests.ts @@ -1,7 +1,16 @@ -import gzipSize = require('gzip-size'); +import * as fs from 'fs'; +import * as gzipSize from 'gzip-size'; const string = 'Lorem ipsum dolor sit amet.'; console.log(string.length); +gzipSize(string).then(size => console.log(size)); + console.log(gzipSize.sync(string)); + +const stream = fs.createReadStream("index.d.ts"); +const gstream = stream.pipe(gzipSize.stream()).on("gzip-size", size => console.log(size)); +console.log(gstream.gzipSize); // Could be a number or undefined. Recommended to use "gzip-size" event instead + +gzipSize.file("index.d.ts").then(size => console.log(size)); diff --git a/types/gzip-size/index.d.ts b/types/gzip-size/index.d.ts index cab8ec225b..66251e0da8 100644 --- a/types/gzip-size/index.d.ts +++ b/types/gzip-size/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for gzip-size 4.0 +// Type definitions for gzip-size 4.1 // Project: https://github.com/sindresorhus/gzip-size // Definitions by: York Yao // Jimi van der Woning +// Andre Wiggins // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -9,11 +10,45 @@ import * as stream from 'stream'; import * as zlib from 'zlib'; +interface GzipSizeStream extends stream.PassThrough { + on(event: string, listener: (...args: any[]) => void): this; + on(event: "gzip-size", listener: (size: number) => void): this; + + /** + * Contains the gzip size of the stream after it is finished. + * Since this happens asynchronously, it is recommended you use + * the `.on("gzip-size", size => console.log(size))` method instead + */ + gzipSize?: number; +} + +/** + * Returns a Promise for the size. + * @param input A string or Buffer to determine the gzip size of + * @param options Any zlib option + */ declare function gzipSize(input: string | Buffer, options?: zlib.ZlibOptions): Promise; declare namespace gzipSize { + /** + * Returns the size synchronously + * @param input A string or Buffer to determine the gzip size of + * @param options Any zlib option + */ function sync(input: string | Buffer, options?: zlib.ZlibOptions): number; - function stream(options?: zlib.ZlibOptions): stream.PassThrough; + + /** + * Returns a stream.PassThrough. The stream emits a gzip-size event and has a gzipSize property. + * @param options Any zlib option + */ + function stream(options?: zlib.ZlibOptions): GzipSizeStream; + + /** + * Returns a Promise for the size of the file. + * @param path The path to the file + * @param options Any zlib option + */ + function file(path: string, options?: zlib.ZlibOptions): Promise; } export = gzipSize; From b7274857170a6bc986a1ada05e0ed8064f692dd5 Mon Sep 17 00:00:00 2001 From: Mike Woudenberg Date: Mon, 27 Nov 2017 10:55:21 +0100 Subject: [PATCH 69/90] Adds key to location method and adds timeout property to options --- types/cypress/cypress-tests.ts | 2 ++ types/cypress/index.d.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/cypress/cypress-tests.ts b/types/cypress/cypress-tests.ts index 806443474a..9502f1a63d 100644 --- a/types/cypress/cypress-tests.ts +++ b/types/cypress/cypress-tests.ts @@ -12,6 +12,8 @@ cy .get('.query-button') .contains('Save Form').should('have.class', 'btn'); +cy.location('host'); + cy .get('form') .find('input') diff --git a/types/cypress/index.d.ts b/types/cypress/index.d.ts index 808c765e24..f76aad4afb 100644 --- a/types/cypress/index.d.ts +++ b/types/cypress/index.d.ts @@ -249,7 +249,8 @@ declare namespace Cypress { /** * @see https://on.cypress.io/api/location */ - location(options?: Loggable): Chainable; + location(options?: LoggableTimeoutable): Chainable; + location(key: string, options?: LoggableTimeoutable): Chainable; /** * @see https://on.cypress.io/api/log From 4f999a5974494b4c1c328ca53aa5c0328779416f Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Mon, 27 Nov 2017 06:49:17 -0700 Subject: [PATCH 70/90] ember-data: add an overload for `pushPayload`. --- types/ember-data/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/ember-data/index.d.ts b/types/ember-data/index.d.ts index bf273f2f20..1a874e5c64 100644 --- a/types/ember-data/index.d.ts +++ b/types/ember-data/index.d.ts @@ -993,6 +993,7 @@ declare namespace DS { * Push some raw data into the store. */ pushPayload(modelName: string, inputPayload: {}): any; + pushPayload(inputPayload: {}): any; /** * `normalize` converts a json payload into the normalized form that * [push](#method_push) expects. From 65398844556f3335c3eb66e13194bc3553c86f1c Mon Sep 17 00:00:00 2001 From: mmatessi Date: Mon, 27 Nov 2017 14:54:28 +0100 Subject: [PATCH 71/90] Added missing types of Plotly --- types/plotly.js/index.d.ts | 249 +++++++++++++++++++++++++++++-------- 1 file changed, 198 insertions(+), 51 deletions(-) diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index a34dbf2ab8..1ca736a46f 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -94,23 +94,30 @@ export function downloadImage(root: Root, opts: DownloadImgopts): Promise; autosize: boolean; showlegend: boolean; - xaxis: Partial; - yaxis: Partial; - yaxis2: Partial; - yaxis3: Partial; - yaxis4: Partial; - yaxis5: Partial; - yaxis6: Partial; - yaxis7: Partial; - yaxis8: Partial; - yaxis9: Partial; + paper_bgcolor: Color; + plot_bgcolor: Color; + separators: string; + hidesources: boolean; + xaxis: Partial; + yaxis: Partial; + yaxis2: Partial; + yaxis3: Partial; + yaxis4: Partial; + yaxis5: Partial; + yaxis6: Partial; + yaxis7: Partial; + yaxis8: Partial; + yaxis9: Partial; margin: Partial; height: number; width: number; - hovermode: "closest" | "x" | "y" | false; - 'xaxis.range': [Datum, Datum]; + hovermode: 'closest' | 'x' | 'y' | false; + hoverlabel: Partial