diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index b2890573ce..5a49eaea18 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -764,6 +764,11 @@ declare namespace algoliasearch { * https://github.com/algolia/algoliasearch-client-js#client-options */ hosts?: { read?: string[]; write?: string[] }; + /** + * enable the experimental feature: caching requests instead of responses + * see https://github.com/algolia/algoliasearch-client-javascript/pull/694 + */ + _useRequestCache?: boolean } /** * Interface describing options available for gettings the logs diff --git a/types/algoliasearch/lite/index.d.ts b/types/algoliasearch/lite/index.d.ts index a567a917a8..acd2b30988 100644 --- a/types/algoliasearch/lite/index.d.ts +++ b/types/algoliasearch/lite/index.d.ts @@ -180,6 +180,11 @@ declare namespace algoliasearch { * https://github.com/algolia/algoliasearch-client-js#client-options */ hosts?: { read?: string[]; write?: string[] }; + /** + * enable the experimental feature: caching requests instead of responses + * see https://github.com/algolia/algoliasearch-client-javascript/pull/694 + */ + _useRequestCache?: boolean } interface BrowseResponse { cursor?: string; diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index 1dff1a0451..5d7dd7cbb8 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -214,11 +214,18 @@ mod.factory({ name1(foo: any) {}, name2: ['foo', (foo: any) => {}] }); -mod.filter('name', ($scope: ng.IScope) => {}); -mod.filter('name', ['$scope', ($scope: ng.IScope) => {}]); +mod.filter('name', ($scope: ng.IScope) => () => {}); +mod.filter('name', ['$scope', ($scope: ng.IScope) => () => {}]); mod.filter({ - name1(foo: any) {}, - name2: ['foo', (foo: any) => {}] + name1(foo: any) { return () => {}; }, + name2: ['foo', (foo: any) => () => {}], +}); +const customStatefulFilter: ng.IFilterFunction = (s) => 1; +mod.filter('name', () => customStatefulFilter); +mod.filter('name', ['$scope', () => customStatefulFilter]); +mod.filter({ + name1: () => customStatefulFilter, + name2: ['foo', () => customStatefulFilter], }); mod.provider('name', ($scope: ng.IScope) => ({ $get: () => { } })); mod.provider('name', TestProvider); diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts index 6b82a2bcb4..c05ee388a8 100644 --- a/types/angular/index.d.ts +++ b/types/angular/index.d.ts @@ -250,8 +250,8 @@ declare namespace angular { */ factory(name: string, $getFn: Injectable): IModule; factory(object: {[name: string]: Injectable}): IModule; - filter(name: string, filterFactoryFunction: Injectable): IModule; - filter(object: {[name: string]: Injectable}): IModule; + filter(name: string, filterFactoryFunction: Injectable): IModule; + filter(object: {[name: string]: Injectable}): IModule; provider(name: string, serviceProviderFactory: IServiceProviderFactory): IModule; provider(name: string, serviceProviderConstructor: IServiceProviderClass): IModule; provider(name: string, inlineAnnotatedConstructor: any[]): IModule; @@ -2237,4 +2237,13 @@ declare namespace angular { interface IHttpParamSerializer { (obj: Object): string; } + + interface IFilterFunction extends Function { + /** + * By default, filters are only run once the input value changes. By marking the filter as `$stateful`, the filter will be run on every `$digest` to update the output. **This is strongly discouraged.** + * See https://docs.angularjs.org/guide/filter#stateful-filters + */ + $stateful?: boolean; + } + type FilterFactory = (...I: any[]) => IFilterFunction; } diff --git a/types/archiver/archiver-tests.ts b/types/archiver/archiver-tests.ts index dbb1df1de7..d61950b657 100644 --- a/types/archiver/archiver-tests.ts +++ b/types/archiver/archiver-tests.ts @@ -67,3 +67,15 @@ archiver.use(() => {}); archiver.finalize(); archiver.symlink('./path', './target'); + +function fakeHandler(err: Archiver.ArchiverError) { + console.log(err.code); + console.log(err.message); + console.log(err.stack); + console.log(err.data); +} + +const fakeError = new Archiver.ArchiverError('code', 'foo'); + +archiver.on('error', fakeHandler); +archiver.on('warning', fakeHandler); diff --git a/types/archiver/index.d.ts b/types/archiver/index.d.ts index d33e8ec6dd..a9cafca24b 100644 --- a/types/archiver/index.d.ts +++ b/types/archiver/index.d.ts @@ -24,9 +24,26 @@ declare namespace archiver { mode?: number; } + interface ProgressData { + entries: { + total: number; + processed: number; + }; + fs: { + totalBytes: number; + processedBytes: number; + }; + } + /** A function that lets you either opt out of including an entry (by returning false), or modify the contents of an entry as it is added (by returning an EntryData) */ type EntryDataFunction = (entry: EntryData) => false | EntryData; + class ArchiverError extends Error { + code: string; // Since archiver format support is modular, we cannot enumerate all possible error codes, as the modules can throw arbitrary ones. + data: any; + constructor(code: string, data: any); + } + interface Archiver extends stream.Transform { abort(): this; append(source: stream.Readable | Buffer | string, name?: EntryData): this; @@ -44,6 +61,13 @@ declare namespace archiver { use(plugin: Function): this; symlink(filepath: string, target: string): this; + + on(event: 'error' | 'warning', listener: (error: ArchiverError) => void): this; + on(event: 'data', listener: (data: EntryData) => void): this; + on(event: 'progress', listener: (progress: ProgressData) => void): this; + on(event: 'close' | 'drain' | 'finish', listener: () => void): this; + on(event: 'pipe' | 'unpipe', listener: (src: stream.Readable) => void): this; + on(event: string, listener: (...args: any[]) => void): this; } type ArchiverOptions = CoreOptions & TransformOptions & ZipOptions & TarOptions; diff --git a/types/asap/asap-tests.ts b/types/asap/asap-tests.ts new file mode 100644 index 0000000000..3ffb3d97bb --- /dev/null +++ b/types/asap/asap-tests.ts @@ -0,0 +1,36 @@ +import asap = require("asap"); +import rawAsap = require("asap/raw"); + +class Callable { + call(): void { + "'Callable' invoked"; + } +} +function f(): void { + "'f' invoked"; +} + +// $ExpectType void +asap(f); + +// $ExpectType void +asap((): void => { + "'arrow' invoked"; +}); + +// $ExpectType void +asap(new Callable()); + +// $ExpectType void +rawAsap(f); + +// $ExpectType void +rawAsap((): void => { + "'arrow' invoked"; +}); + +// $ExpectType void +rawAsap(new Callable()); + +// $ExpectType void +rawAsap.requestFlush(); diff --git a/types/asap/index.d.ts b/types/asap/index.d.ts new file mode 100644 index 0000000000..c5fc69aee3 --- /dev/null +++ b/types/asap/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for asap 2.0 +// Project: https://github.com/kriskowal/asap +// Definitions by: fpascutti +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface Task { + call(...args: any[]): any; +} + +/** + * Executes a task as soon as possible. + * @param task Function or any object that implements `call()`. + */ +declare function asap(task: Task): void; +export = asap; diff --git a/types/asap/raw.d.ts b/types/asap/raw.d.ts new file mode 100644 index 0000000000..c587a9c5b2 --- /dev/null +++ b/types/asap/raw.d.ts @@ -0,0 +1,16 @@ +interface Task { + call(...args: any[]): any; +} + +/** + * Executes a task as soon as possible. + * @param task Function or any object that implements `call()`. + */ +declare function rawAsap(task: Task): void; +declare namespace rawAsap { + /** + * Flushes the event queue. + */ + function requestFlush(): void; +} +export = rawAsap; diff --git a/types/asap/tsconfig.json b/types/asap/tsconfig.json new file mode 100644 index 0000000000..ea8a3d1091 --- /dev/null +++ b/types/asap/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "asap-tests.ts", + "index.d.ts", + "raw.d.ts" + ] +} diff --git a/types/asap/tslint.json b/types/asap/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/asap/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/cesium/index.d.ts b/types/cesium/index.d.ts index 21b80f7d05..967c124bac 100644 --- a/types/cesium/index.d.ts +++ b/types/cesium/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cesium 1.44 +// Type definitions for cesium 1.46 // Project: http://cesiumjs.org // Definitions by: Aigars Zeiza // Harry Nicholls @@ -1437,10 +1437,10 @@ declare namespace Cesium { } class TerrainData { + credits: Credit[]; waterMask: Uint8Array | HTMLImageElement | HTMLCanvasElement; interpolateHeight(rectangle: Rectangle, longitude: number, latitude: number): number; isChildAvailable(thisX: number, thisY: number, childX: number, childY: number): boolean; - createMesh(tilingScheme: TilingScheme, x: number, y: number, level: number): Promise; upsample(tilingScheme: TilingScheme, thisX: number, thisY: number, thisLevel: number, descendantX: number, descendantY: number, descendantLevel: number): Promise; wasCreatedByUpsampling(): boolean; } @@ -1459,7 +1459,7 @@ declare namespace Cesium { } abstract class TerrainProvider { - availability: any; // TileAvailability + availability: TileAvailability; credit: Credit; errorEvent: Event; hasVertexNormals: boolean; @@ -1475,6 +1475,15 @@ declare namespace Cesium { requestTileGeometry(x: number, y: number, level: number, throttleRequests?: boolean): Promise; } + class TileAvailability { + constructor(tilingScheme: TilingScheme, maximumLevel: number); + addAvailableTileRange(level: number, startX: number, startY: number, endX: number, endY: number): void; + computeBestAvailableLevelOverRectangle(rectangle: Rectangle): number; + computeChildMaskForTile(level: number, x: number, y: number): number; + computeMaximumLevelAtPosition(position: Cartographic): number; + isTileAvailable(level: number, x: number, y: number): boolean; + } + class TileProviderError { provider: ImageryProvider | TerrainProvider; message: string; @@ -3007,23 +3016,84 @@ declare namespace Cesium { destroy(): void; } + class GoogleEarthEnterpriseMetadata { + imageryPresent: boolean; + key: ArrayBuffer; + negativeAltitudeExponentBias: number; + negativeAltitudeThreshold: number; + protoImagery: boolean; + readonly proxy: Proxy; + readonly readyPromise: Promise; + readonly resource: Resource; + terrainPresent: boolean; + readonly url: string; + constructor(resourceOrUrl: Resource | string); + static quadKeyToTileXY(quadkey: string): {x: number, y: number, level: number}; + static tileXYToQuadKey(x: number, y: number, level: number): string; + } + class GoogleEarthEnterpriseImageryProvider extends ImageryProvider { - url: string; - path: string; - channel: number; - version: number; - requestType: string; + readonly url: string; constructor(options: { - url: string; + url: Resource | string; + metadata: GoogleEarthEnterpriseMetadata; + ellipsoid?: Ellipsoid; + tileDiscardPolicy?: TileDiscardPolicy; + credit?: Credit | string; + }); + } + + class GoogleEarthEnterpriseMapsProvider extends ImageryProvider { + readonly channel: number; + readonly path: string; + readonly requestType: string; + readonly url: string; + readonly version: number; + static logoUrl: string; + constructor(options: { + url: Resource | string; channel: number; path?: string; maximumLevel?: number; tileDiscardPolicy?: TileDiscardPolicy; ellipsoid?: Ellipsoid; - proxy?: Proxy }); } + class GoogleEarthEnterpriseTerrainData extends TerrainData { + constructor(options: { + buffer: ArrayBuffer; + negativeAltitudeExponentBias: number; + negativeElevationThreshold: number; + childTileMask?: number; + createdByUpsampling?: boolean; + credits?: Credit[]; + }); + } + + class GoogleEarthEnterpriseTerrainProvider { + static heightmapTerrainQuality: number; + availability: TileAvailability; + credit: Credit; + errorEvent: Event; + hasVertexNormals: boolean; + hasWaterMask: boolean; + ready: boolean; + readonly readyPromise: Promise; + tilingScheme: TilingScheme; + constructor(options: { + url: Resource | string; + metadata: GoogleEarthEnterpriseMetadata; + ellipsoid?: Ellipsoid; + credit?: Credit | string; + }) + static getEstimatedLevelZeroGeometricErrorForAHeightmap(ellipsoid: Ellipsoid, tileImageWidth: number, numberOfTilesAtLevelZero: number): number; + static getRegularGridIndices(width: number, height: number): Uint16Array; + getLevelMaximumGeometricError(level: number): number; + getTileDataAvailable(x: number, y: number, level: number): boolean; + requestTileGeometry(x: number, y: number, level: number, request?: Request): Promise; + } + class GridImageryProvider extends ImageryProvider { constructor(options?: { tilingScheme?: TilingScheme; diff --git a/types/create-react-class/create-react-class-tests.ts b/types/create-react-class/create-react-class-tests.ts index f8d8b132c7..3d7536d722 100644 --- a/types/create-react-class/create-react-class-tests.ts +++ b/types/create-react-class/create-react-class-tests.ts @@ -56,7 +56,7 @@ const ClassicComponent: React.ClassicComponentClass = createReactClass, nextProps, nextState) { const newFoo: string = nextProps.foo; const newBar: number = nextState.bar; - return newFoo !== this.props.foo && newBar !== this.state!.bar; + return newFoo !== this.props.foo && newBar !== this.state.bar; }, statics: { test: 1 diff --git a/types/cytoscape/cytoscape-tests.ts b/types/cytoscape/cytoscape-tests.ts index 10a38145de..17eba79fd5 100644 --- a/types/cytoscape/cytoscape-tests.ts +++ b/types/cytoscape/cytoscape-tests.ts @@ -343,17 +343,29 @@ const positions = oneOf({a: {x: 100, y: 100}}, (node: cytoscape.NodeCollection): // TODO: cy.style +// $ExpectType string cy.png({ - output: oneOf('base64uri', 'base64', 'blob', undefined), + output: oneOf('base64uri', 'base64', undefined), bg: oneOf('#ffffff', undefined), full: true, scale: 2, maxWidth: 100, maxHeight: 100 }); +// $ExpectType Blob +cy.png({ + output: 'blob', + bg: oneOf('#ffffff', undefined), + full: true, + scale: 2, + maxWidth: 100, + maxHeight: 100 +}); + aliases(cy.jpg, cy.jpeg); +// $ExpectType string cy.jpg({ - output: oneOf('base64uri', 'base64', 'blob', undefined), + output: oneOf('base64uri', 'base64', undefined), bg: oneOf('#ffffff', undefined), full: true, scale: 2, @@ -361,6 +373,17 @@ cy.jpg({ maxHeight: 100, quality: 0.5 }); +// $ExpectType Blob +cy.jpg({ + output: 'blob', + bg: oneOf('#ffffff', undefined), + full: true, + scale: 2, + maxWidth: 100, + maxHeight: 100, + quality: 0.5 +}); + cy.json(cy.json()); // Types possible to call methods diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index 1fcdcb0f08..282a90c7a4 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -1052,10 +1052,6 @@ declare namespace cytoscape { * http://js.cytoscape.org/#core/export */ interface ExportOptions { - /** - * output Whether the output should be 'base64uri' (default), 'base64', or 'blob'. - */ - output?: "base64uri" | "base64" | "blob"; /** * The background colour of the image (transparent by default). */ @@ -1077,6 +1073,18 @@ declare namespace cytoscape { */ maxHeight?: number; } + interface ExportStringOptions extends ExportOptions { + /** + * output Whether the output should be 'base64uri' (default), 'base64', or 'blob'. + */ + output?: "base64uri" | "base64"; + } + interface ExportBlobOptions extends ExportOptions { + /** + * output Whether the output should be 'base64uri' (default), 'base64', or 'blob'. + */ + output?: "blob"; + } interface ExportJpgOptions extends ExportOptions { /** @@ -1086,22 +1094,29 @@ declare namespace cytoscape { */ quality?: number; } + interface ExportJpgStringOptions extends ExportJpgOptions, ExportStringOptions { + } + interface ExportJpgBlobOptions extends ExportJpgOptions, ExportBlobOptions { + } interface CoreExport { /** * Export the current graph view as a PNG image in Base64 representation. */ - png(options?: ExportOptions): string; + png(options?: ExportStringOptions): string; + png(options?: ExportBlobOptions): Blob; /** * Export the current graph view as a JPG image in Base64 representation. */ - jpg(options?: ExportJpgOptions): string; + jpg(options?: ExportJpgStringOptions): string; + jpg(options?: ExportJpgBlobOptions): Blob; /** * Export the current graph view as a JPG image in Base64 representation. */ - jpeg(options?: ExportJpgOptions): string; + jpeg(options?: ExportJpgStringOptions): string; + jpeg(options?: ExportJpgBlobOptions): Blob; /** * Export the graph as JSON, the same format used at initialisation. diff --git a/types/datatables.net/datatables.net-tests.ts b/types/datatables.net/datatables.net-tests.ts index 423dcaf4c9..d22e878d34 100644 --- a/types/datatables.net/datatables.net-tests.ts +++ b/types/datatables.net/datatables.net-tests.ts @@ -1002,6 +1002,9 @@ const static_6 = new $.fn.dataTable.Api("selector"); const version: boolean = $.fn.dataTable.versionCheck("1.10.0"); const isDataTable: boolean = $.fn.dataTable.isDataTable("selector"); +const isDataTable_3: boolean = $.fn.dataTable.isDataTable(dt.row("selector").node()); +const isDataTable_2: boolean = $.fn.dataTable.isDataTable($("selector")); +const isDataTable_4: boolean = $.fn.dataTable.isDataTable($("selector").dataTable().api()); const escapeRegex: string = $.fn.dataTable.util.escapeRegex(""); const throttle_1 = $.fn.dataTable.util.throttle((data) => { diff --git a/types/datatables.net/index.d.ts b/types/datatables.net/index.d.ts index a8f63a999e..ae7edf755a 100644 --- a/types/datatables.net/index.d.ts +++ b/types/datatables.net/index.d.ts @@ -1094,13 +1094,13 @@ declare namespace DataTables { (): JQueryDataTables; /** - * Check is a table node is a DataTable or not + * Check if a table node is a DataTable already or not. * * Usage: * $.fn.dataTable.isDataTable("selector"); - * @param table Selector string for table + * @param table The table to check. */ - isDataTable(table: string): boolean; + isDataTable(table: string | Node | JQuery | Api): boolean; /** * Helpers for `columns.render`. diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index 188643dc28..5c1c1bfae6 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -962,11 +962,11 @@ declare class Dockerode { pull(repoTag: string, options: {}, callback: Callback, auth?: {}): Dockerode.Image; pull(repoTag: string, options: {}, auth?: {}): Promise; - run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, createOptions: {}, startOptions: {}, callback: Callback): events.EventEmitter; - run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, startOptions: {}, callback: Callback): events.EventEmitter; - run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, callback: Callback): events.EventEmitter; - run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, createOptions: {}, callback: Callback): events.EventEmitter; - run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, createOptions?: {}, startOptions?: {}): Promise; + run(image: string, cmd: string[], outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], createOptions: {}, startOptions: {}, callback: Callback): events.EventEmitter; + run(image: string, cmd: string[], outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], startOptions: {}, callback: Callback): events.EventEmitter; + run(image: string, cmd: string[], outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], callback: Callback): events.EventEmitter; + run(image: string, cmd: string[], outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], createOptions: {}, callback: Callback): events.EventEmitter; + run(image: string, cmd: string[], outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], createOptions?: {}, startOptions?: {}): Promise; swarmInit(options: {}, callback: Callback): void; swarmInit(options: {}): Promise; diff --git a/types/ember__test-helpers/ember__test-helpers-tests.ts b/types/ember__test-helpers/ember__test-helpers-tests.ts new file mode 100644 index 0000000000..9fe9e4c297 --- /dev/null +++ b/types/ember__test-helpers/ember__test-helpers-tests.ts @@ -0,0 +1,95 @@ +/// + +import { test } from 'qunit'; +import Application from '@ember/application'; +import hbs from 'htmlbars-inline-precompile'; +import { + click, + doubleClick, + tap, + focus, + blur, + triggerEvent, + triggerKeyEvent, + fillIn, + render, + find, + findAll, + getRootElement, + pauseTest, + resumeTest, + waitFor, + waitUntil, + settled, + isSettled, + getSettledState, + visit, + currentURL, + currentRouteName, + setApplication +} from '@ember/test-helpers'; + +const MyApp = Application.extend({ modulePrefix: 'my-app' }); + +setApplication(MyApp.create()); + +test('DOM interactions', async () => { + await render(hbs`
Hello, world
`); + + await click('.message'); + await doubleClick('.message'); + await tap('.message'); + await focus('.message'); + await blur('.message'); + await triggerEvent('.message', 'custom-event'); + await triggerKeyEvent('.message', 'keydown', 'Enter', { ctrlKey: true }); + await fillIn('.message', 'content'); + + const messageElement = find('.message')!; + await click(messageElement); + await doubleClick(messageElement); + await tap(messageElement); + await focus(messageElement); + await blur(messageElement); + await triggerEvent(messageElement, 'custom-event'); + await triggerKeyEvent(messageElement, 'keydown', 'Enter', { ctrlKey: true }); + await fillIn(messageElement, 'content'); + + const allMessages = findAll('.message'); + for (const element of allMessages) { + await click(element); + } + + const root = getRootElement(); + await click(root); +}); + +test('routing helpers', async (assert) => { + await visit('/foo'); + + assert.equal(currentURL(), '/foo'); + assert.equal(currentRouteName(), 'foo'); +}); + +test('pause and resume', async () => { + await pauseTest(); + setTimeout(resumeTest, 1000); +}); + +test('wait helpers', async (assert) => { + await render(hbs`
Hello
`); + + await waitFor('.message', { count: 1, timeout: 10, timeoutMessage: 'uh oh' }); + await waitUntil(() => 'hello', { timeout: 1000, timeoutMessage: 'boom' }); + + await settled(); + assert.ok(isSettled()); + + const { + hasPendingRequests, + hasPendingTimers, + hasPendingWaiters, + hasRunLoop, + pendingRequestCount + } = getSettledState(); +}); diff --git a/types/ember__test-helpers/index.d.ts b/types/ember__test-helpers/index.d.ts new file mode 100644 index 0000000000..067222b425 --- /dev/null +++ b/types/ember__test-helpers/index.d.ts @@ -0,0 +1,220 @@ +// Type definitions for @ember/test-helpers 0.7 +// Project: https://github.com/emberjs/ember-test-helpers +// Definitions by: Dan Freeman +// James C. Davis +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/// + +declare module '@ember/test-helpers' { + // DOM Interaction Helpers + + export type Target = string | Element; + + export { default as click } from '@ember/test-helpers/dom/click'; + export { default as doubleClick } from '@ember/test-helpers/dom/double-click'; + export { default as tap } from '@ember/test-helpers/dom/tap'; + export { default as focus } from '@ember/test-helpers/dom/focus'; + export { default as blur } from '@ember/test-helpers/dom/blur'; + export { default as triggerEvent } from '@ember/test-helpers/dom/trigger-event'; + export { default as triggerKeyEvent } from '@ember/test-helpers/dom/trigger-key-event'; + export { default as fillIn } from '@ember/test-helpers/dom/fill-in'; + + // DOM Query Helpers + + export { default as find } from '@ember/test-helpers/dom/find'; + export { default as findAll } from '@ember/test-helpers/dom/find-all'; + export { default as getRootElement } from '@ember/test-helpers/dom/get-root-element'; + + // Routing Helpers + + export { visit, currentRouteName, currentURL } from '@ember/test-helpers/setup-application-context'; + + // Rendering Helpers + + export { render, clearRender } from '@ember/test-helpers/setup-rendering-context'; + + // Wait Helpers + + export { default as waitFor } from '@ember/test-helpers/dom/wait-for'; + export { default as waitUntil } from '@ember/test-helpers/wait-until'; + export { default as settled, isSettled, getSettledState } from '@ember/test-helpers/settled'; + + // Pause Helpers + + export { pauseTest, resumeTest } from '@ember/test-helpers/setup-context'; + + // Test Framework APIs + + export { setResolver, getResolver } from '@ember/test-helpers/resolver'; + export { default as setupContext, getContext, setContext, unsetContext } from '@ember/test-helpers/setup-context'; + export { default as teardownContext } from '@ember/test-helpers/teardown-context'; + export { default as setupRenderingContext } from '@ember/test-helpers/setup-rendering-context'; + export { default as teardownRenderingContext } from '@ember/test-helpers/teardown-rendering-context'; + export { getApplication, setApplication } from '@ember/test-helpers/application'; + export { default as setupApplicationContext } from '@ember/test-helpers/setup-application-context'; + export { default as teardownApplicationContext } from '@ember/test-helpers/teardown-application-context'; + export { default as validateErrorHandler } from '@ember/test-helpers/validate-error-handler'; +} + +declare module '@ember/test-helpers/dom/click' { + import { Target } from '@ember/test-helpers'; + + export default function(target: Target): Promise; +} + +declare module '@ember/test-helpers/dom/double-click' { + import { Target } from '@ember/test-helpers'; + + export default function(target: Target): Promise; +} + +declare module '@ember/test-helpers/dom/tap' { + import { Target } from '@ember/test-helpers'; + + export default function(target: Target): Promise; +} + +declare module '@ember/test-helpers/dom/focus' { + import { Target } from '@ember/test-helpers'; + + export default function(target: Target): Promise; +} + +declare module '@ember/test-helpers/dom/blur' { + import { Target } from '@ember/test-helpers'; + + export default function(target: Target): Promise; +} + +declare module '@ember/test-helpers/dom/trigger-event' { + import { Target } from '@ember/test-helpers'; + + export default function(target: Target, eventType: string, options?: object): Promise; +} + +declare module '@ember/test-helpers/dom/trigger-key-event' { + import { Target } from '@ember/test-helpers'; + + export type KeyEvent = 'keydown' | 'keyup' | 'keypress'; + + export interface KeyModifiers { + ctrlKey?: boolean; + altKey?: boolean; + shiftKey?: boolean; + metaKey?: boolean; + } + + export default function(target: Target, eventType: KeyEvent, key: number | string, modifiers?: KeyModifiers): Promise; +} + +declare module '@ember/test-helpers/dom/fill-in' { + import { Target } from '@ember/test-helpers'; + + export default function(target: Target, text: string): Promise; +} + +declare module '@ember/test-helpers/dom/find' { + export default function(selector: string): Element | null; +} + +declare module '@ember/test-helpers/dom/find-all' { + export default function(selector: string): Element[]; +} + +declare module '@ember/test-helpers/dom/get-root-element' { + export default function(): Element; +} + +declare module '@ember/test-helpers/setup-application-context' { + export default function(context: Context): Promise; + export function visit(url: string): Promise; + export function currentRouteName(): string; + export function currentURL(): string; +} + +declare module '@ember/test-helpers/setup-rendering-context' { + import { TemplateFactory } from 'htmlbars-inline-precompile'; + + export default function(context: Context): Promise; + export function render(template: TemplateFactory): Promise; + export function clearRender(): Promise; +} + +declare module '@ember/test-helpers/dom/wait-for' { + export interface Options { + timeout?: number; + count?: number; + timeoutMessage?: string; + } + + export default function(selector: string, options?: Options): Promise; +} + +declare module '@ember/test-helpers/wait-until' { + export interface Options { + timeout?: number; + timeoutMessage?: string; + } + + export default function(callback: () => T, options?: Options): Promise; +} + +declare module '@ember/test-helpers/settled' { + export interface SettledState { + hasRunLoop: boolean; + hasPendingTimers: boolean; + hasPendingWaiters: boolean; + hasPendingRequests: boolean; + pendingRequestCount: number; + } + + export default function(): Promise; + export function isSettled(): boolean; + export function getSettledState(): SettledState; +} + +declare module '@ember/test-helpers/setup-context' { + import Resolver from '@ember/application/resolver'; + + export default function(context: C, options?: { resolver?: Resolver }): Promise; + export function getContext(): object; + export function setContext(context: object): void; + export function unsetContext(): void; + + export function pauseTest(): Promise; + export function resumeTest(): void; +} + +declare module '@ember/test-helpers/resolver' { + import Resolver from '@ember/application/resolver'; + + export function setResolver(resolver: Resolver): void; + export function getResolver(): Resolver; +} + +declare module '@ember/test-helpers/teardown-context' { + export default function(context: object): Promise; +} + +declare module '@ember/test-helpers/teardown-rendering-context' { + export default function(context: object): Promise; +} + +declare module '@ember/test-helpers/teardown-application-context' { + export default function(context: object): Promise; +} + +declare module '@ember/test-helpers/validate-error-handler' { + import Error from '@ember/error'; + + export default function(callback?: (error: Error) => void): { isValid: boolean, message: string }; +} + +declare module '@ember/test-helpers/application' { + import Application from '@ember/application'; + + export function getApplication(): Application; + export function setApplication(application: Application): void; +} diff --git a/types/ember__test-helpers/tsconfig.json b/types/ember__test-helpers/tsconfig.json new file mode 100644 index 0000000000..de0efdd984 --- /dev/null +++ b/types/ember__test-helpers/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "paths": { + "@ember/test-helpers": ["ember__test-helpers"] + } + }, + "files": [ + "index.d.ts", + "ember__test-helpers-tests.ts" + ] +} diff --git a/types/ember__test-helpers/tslint.json b/types/ember__test-helpers/tslint.json new file mode 100644 index 0000000000..4c4fc86ace --- /dev/null +++ b/types/ember__test-helpers/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "strict-export-declare-modifiers": false + } +} diff --git a/types/expo/expo-tests.tsx b/types/expo/expo-tests.tsx index fa329ea8e3..4f51cb0050 100644 --- a/types/expo/expo-tests.tsx +++ b/types/expo/expo-tests.tsx @@ -373,9 +373,9 @@ async () => { }; async () => { - const result = await ImageManipulator.manipulate('url', { + const result = await ImageManipulator.manipulate('url', [{ rotate: 90 - }, { + }], { compress: 0.75 }); diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index dd7057b007..3e86549492 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -1513,6 +1513,27 @@ export namespace Gyroscope { * ImageManipulator */ export namespace ImageManipulator { + type Action = Resize | Rotate | Flip | Crop; + + interface Resize { + resize: { width: number, height: number }; + } + + interface Rotate { + rotate: number; + } + + interface Flip { + flip?: { vertical?: boolean; horizontal?: boolean }; + } + + interface Crop { + originX: number; + originY: number; + width: number; + height: number; + } + interface ImageResult { uri: string; width: number; @@ -1527,21 +1548,7 @@ export namespace ImageManipulator { format?: 'jpeg' | 'png'; } - interface CropParameters { - originX: number; - originY: number; - width: number; - height: number; - } - - interface ImageManipulationOptions { - resize?: { width?: number; height?: number }; - rotate?: number; - flip?: { vertical?: boolean; horizontal?: boolean }; - crop?: CropParameters; - } - - function manipulate(uri: string, actions: ImageManipulationOptions, saveOptions?: SaveOptions): Promise; + function manipulate(uri: string, actions: Action[], saveOptions?: SaveOptions): Promise; } /** diff --git a/types/fabric/fabric-impl.d.ts b/types/fabric/fabric-impl.d.ts index 07c1227706..4d01868b59 100644 --- a/types/fabric/fabric-impl.d.ts +++ b/types/fabric/fabric-impl.d.ts @@ -1867,7 +1867,7 @@ export class Image { * @param [callback] Callback to invoke when image is created (newly created image is passed as a first argument) * @param [imgOptions] Options object */ - static fromURL(url: string, callback?: (image: Image) => void, objObjects?: IObjectOptions): Image; + static fromURL(url: string, callback?: (image: Image) => void, imgOptions?: IImageOptions): Image; /** * Creates an instance of fabric.Image from its object representation * @param object Object to create an instance from diff --git a/types/jquery-gray/index.d.ts b/types/jquery-gray/index.d.ts new file mode 100644 index 0000000000..2d48831bc2 --- /dev/null +++ b/types/jquery-gray/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for JQuery Gray 1.6 +// Project: https://github.com/karlhorky/gray +// Definitions by: Anderson Friaça +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +export type Classes = Partial<{ + fade: string; +}>; + +export type Options = Partial<{ + fade: boolean; + classes: Classes; +}>; + +declare global { + interface JQuery { + gray(options?: Options): JQuery; + toggleClass(className: 'grayscale-off'): JQuery; + } +} diff --git a/types/jquery-gray/jquery-gray-tests.ts b/types/jquery-gray/jquery-gray-tests.ts new file mode 100644 index 0000000000..2e2027354f --- /dev/null +++ b/types/jquery-gray/jquery-gray-tests.ts @@ -0,0 +1,16 @@ +import { Options } from "jquery-gray"; + +// basic usage +$('.images').gray(); + +$('.images').toggleClass('grayscale-off'); + +// with options +const options: Options = { + fade: true, + classes: { + fade: 'grayscale-fade' + } +}; + +$('.images').gray(options); diff --git a/types/jquery-gray/tsconfig.json b/types/jquery-gray/tsconfig.json new file mode 100644 index 0000000000..81d0dced36 --- /dev/null +++ b/types/jquery-gray/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, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "jquery-gray-tests.ts" + ] +} \ No newline at end of file diff --git a/types/jquery-gray/tslint.json b/types/jquery-gray/tslint.json new file mode 100644 index 0000000000..d04fe2e1fa --- /dev/null +++ b/types/jquery-gray/tslint.json @@ -0,0 +1 @@ +{"extends": "dtslint/dt.json"} \ No newline at end of file diff --git a/types/json-editor/index.d.ts b/types/json-editor/index.d.ts index 280c17e70f..947dfad4bb 100644 --- a/types/json-editor/index.d.ts +++ b/types/json-editor/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for json-editor // Project: https://github.com/jdorn/json-editor // Definitions by: York Yao +// Felipe Provenzano // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped type JSONEditorOptions = { @@ -75,7 +76,7 @@ type JSONEditorOptions = { /** * The CSS theme to use. */ - theme?: "barebones" | "html" | "bootstrap2" | "bootstrap3" | "foundation3" | "foundation4" | "foundation5" | "foundation6" | "jqueryui"; + theme?: "barebones" | "html" | "bootstrap2" | "bootstrap3" | "bootstrap4" | "foundation3" | "foundation4" | "foundation5" | "foundation6" | "jqueryui"; /** * If true, only required properties will be included by default. */ diff --git a/types/knex/index.d.ts b/types/knex/index.d.ts index 624fde2d01..20418e1fac 100644 --- a/types/knex/index.d.ts +++ b/types/knex/index.d.ts @@ -155,7 +155,7 @@ declare namespace Knex { pluck(column: string): QueryBuilder; insert(data: any, returning?: string | string[]): QueryBuilder; - modify(callback: QueryCallback, ...args: any[]): QueryBuilder; + modify(callback: QueryCallbackWithArgs, ...args: any[]): QueryBuilder; update(data: any, returning?: string | string[]): QueryBuilder; update(columnName: string, value: Value, returning?: string | string[]): QueryBuilder; returning(column: string | string[]): QueryBuilder; @@ -360,6 +360,8 @@ declare namespace Knex { // type QueryCallback = (this: QueryBuilder, builder: QueryBuilder) => void; + type QueryCallbackWithArgs = (this: QueryBuilder, builder: QueryBuilder, ...args: any[]) => void; + interface QueryBuilder extends QueryInterface, ChainableInterface { or: QueryBuilder; and: QueryBuilder; diff --git a/types/knex/knex-tests.ts b/types/knex/knex-tests.ts index 9167ad3f77..ebd392aea3 100644 --- a/types/knex/knex-tests.ts +++ b/types/knex/knex-tests.ts @@ -1045,10 +1045,10 @@ knex('users') }).unionAll(function(builder) { let self: Knex.QueryBuilder = this; self = builder; - }).modify(function(builder) { + }).modify(function(builder, aBool) { let self: Knex.QueryBuilder = this; self = builder; - }); + }, true); // // Migrations diff --git a/types/micro-cors/index.d.ts b/types/micro-cors/index.d.ts new file mode 100644 index 0000000000..eb91dde7f2 --- /dev/null +++ b/types/micro-cors/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for micro-cors 0.1 +// Project: https://github.com/possibilities/micro-cors#readme +// Definitions by: Callum Denby +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import { RequestHandler } from "micro"; + +interface Options { + maxAge?: string; + origin?: string; + allowHeaders?: string[]; + allowMethods?: string[]; + exposeHeaders?: string[]; +} + +declare function micro_cors(options?: Options): (handler: RequestHandler) => RequestHandler; + +export = micro_cors; diff --git a/types/micro-cors/micro-cors-tests.ts b/types/micro-cors/micro-cors-tests.ts new file mode 100644 index 0000000000..b69b157c03 --- /dev/null +++ b/types/micro-cors/micro-cors-tests.ts @@ -0,0 +1,18 @@ +import cors = require('micro-cors'); +import micro from 'micro'; + +const handler = cors(); + +cors({ allowMethods: ['PUT', 'POST'] }); + +cors({ + maxAge: '1000', + origin: '*', + allowHeaders: [], + allowMethods: [], + exposeHeaders: [] +}); + +handler(async (req, res) => {}); +handler((req, res) => {}); +micro(handler((req, res) => {})); diff --git a/types/micro-cors/tsconfig.json b/types/micro-cors/tsconfig.json new file mode 100644 index 0000000000..e44b2c9151 --- /dev/null +++ b/types/micro-cors/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "micro-cors-tests.ts" + ] +} diff --git a/types/micro-cors/tslint.json b/types/micro-cors/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/micro-cors/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/mocha/index.d.ts b/types/mocha/index.d.ts index 5f0aa3baf6..8708c8902b 100644 --- a/types/mocha/index.d.ts +++ b/types/mocha/index.d.ts @@ -9,9 +9,6 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -export = Mocha; -export as namespace Mocha; - /** * Mocha API * @@ -2623,234 +2620,365 @@ declare namespace Mocha { // #endregion } -declare global { - // #region Test interface augmentations +// #region Test interface augmentations - /** - * Triggers root suite execution. - * - * - _Only available if flag --delay is passed into Mocha._ - * - _Only available when invoked via the mocha CLI._ - * - * @see https://mochajs.org/api/global.html#runWithSuite - */ - function run(): void; +/** + * Triggers root suite execution. + * + * - _Only available if flag --delay is passed into Mocha._ + * - _Only available when invoked via the mocha CLI._ + * + * @see https://mochajs.org/api/global.html#runWithSuite + */ +declare function run(): void; - /** - * Execute before running tests. - * - * - _Only available when invoked via the mocha CLI._ - * - * @see https://mochajs.org/api/global.html#before - */ - var before: Mocha.HookFunction; +/** + * Execute before running tests. + * + * - _Only available when invoked via the mocha CLI._ + * + * @see https://mochajs.org/api/global.html#before + */ +declare var before: Mocha.HookFunction; - /** - * Execute before running tests. - * - * - _Only available when invoked via the mocha CLI._ - * - * @see https://mochajs.org/api/global.html#before - */ - var suiteSetup: Mocha.HookFunction; +/** + * Execute before running tests. + * + * - _Only available when invoked via the mocha CLI._ + * + * @see https://mochajs.org/api/global.html#before + */ +declare var suiteSetup: Mocha.HookFunction; - /** - * Execute after running tests. - * - * - _Only available when invoked via the mocha CLI._ - * - * @see https://mochajs.org/api/global.html#after - */ - var after: Mocha.HookFunction; +/** + * Execute after running tests. + * + * - _Only available when invoked via the mocha CLI._ + * + * @see https://mochajs.org/api/global.html#after + */ +declare var after: Mocha.HookFunction; - /** - * Execute after running tests. - * - * - _Only available when invoked via the mocha CLI._ - * - * @see https://mochajs.org/api/global.html#after - */ - var suiteTeardown: Mocha.HookFunction; +/** + * Execute after running tests. + * + * - _Only available when invoked via the mocha CLI._ + * + * @see https://mochajs.org/api/global.html#after + */ +declare var suiteTeardown: Mocha.HookFunction; - /** - * Execute before each test case. - * - * - _Only available when invoked via the mocha CLI._ - * - * @see https://mochajs.org/api/global.html#beforeEach - */ - var beforeEach: Mocha.HookFunction; +/** + * Execute before each test case. + * + * - _Only available when invoked via the mocha CLI._ + * + * @see https://mochajs.org/api/global.html#beforeEach + */ +declare var beforeEach: Mocha.HookFunction; - /** - * Execute before each test case. - * - * - _Only available when invoked via the mocha CLI._ - * - * @see https://mochajs.org/api/global.html#beforeEach - */ - var setup: Mocha.HookFunction; +/** + * Execute before each test case. + * + * - _Only available when invoked via the mocha CLI._ + * + * @see https://mochajs.org/api/global.html#beforeEach + */ +declare var setup: Mocha.HookFunction; - /** - * Execute after each test case. - * - * - _Only available when invoked via the mocha CLI._ - * - * @see https://mochajs.org/api/global.html#afterEach - */ - var afterEach: Mocha.HookFunction; +/** + * Execute after each test case. + * + * - _Only available when invoked via the mocha CLI._ + * + * @see https://mochajs.org/api/global.html#afterEach + */ +declare var afterEach: Mocha.HookFunction; - /** - * Execute after each test case. - * - * - _Only available when invoked via the mocha CLI._ - * - * @see https://mochajs.org/api/global.html#afterEach - */ - var teardown: Mocha.HookFunction; +/** + * Execute after each test case. + * + * - _Only available when invoked via the mocha CLI._ + * + * @see https://mochajs.org/api/global.html#afterEach + */ +declare var teardown: Mocha.HookFunction; - /** - * Describe a "suite" containing nested suites and tests. - * - * - _Only available when invoked via the mocha CLI._ - */ - var describe: Mocha.SuiteFunction; +/** + * Describe a "suite" containing nested suites and tests. + * + * - _Only available when invoked via the mocha CLI._ + */ +declare var describe: Mocha.SuiteFunction; - /** - * Describe a "suite" containing nested suites and tests. - * - * - _Only available when invoked via the mocha CLI._ - */ - var context: Mocha.SuiteFunction; +/** + * Describe a "suite" containing nested suites and tests. + * + * - _Only available when invoked via the mocha CLI._ + */ +declare var context: Mocha.SuiteFunction; - /** - * Describe a "suite" containing nested suites and tests. - * - * - _Only available when invoked via the mocha CLI._ - */ - var suite: Mocha.SuiteFunction; +/** + * Describe a "suite" containing nested suites and tests. + * + * - _Only available when invoked via the mocha CLI._ + */ +declare var suite: Mocha.SuiteFunction; - /** - * Pending suite. - * - * - _Only available when invoked via the mocha CLI._ - */ - var xdescribe: Mocha.PendingSuiteFunction; +/** + * Pending suite. + * + * - _Only available when invoked via the mocha CLI._ + */ +declare var xdescribe: Mocha.PendingSuiteFunction; - /** - * Pending suite. - * - * - _Only available when invoked via the mocha CLI._ - */ - var xcontext: Mocha.PendingSuiteFunction; +/** + * Pending suite. + * + * - _Only available when invoked via the mocha CLI._ + */ +declare var xcontext: Mocha.PendingSuiteFunction; - /** - * Describes a test case. - * - * - _Only available when invoked via the mocha CLI._ - */ - var it: Mocha.TestFunction; +/** + * Describes a test case. + * + * - _Only available when invoked via the mocha CLI._ + */ +declare var it: Mocha.TestFunction; - /** - * Describes a test case. - * - * - _Only available when invoked via the mocha CLI._ - */ - var specify: Mocha.TestFunction; +/** + * Describes a test case. + * + * - _Only available when invoked via the mocha CLI._ + */ +declare var specify: Mocha.TestFunction; - /** - * Describes a test case. - * - * - _Only available when invoked via the mocha CLI._ - */ - var test: Mocha.TestFunction; +/** + * Describes a test case. + * + * - _Only available when invoked via the mocha CLI._ + */ +declare var test: Mocha.TestFunction; - /** - * Describes a pending test case. - * - * - _Only available when invoked via the mocha CLI._ - */ - var xit: Mocha.PendingTestFunction; +/** + * Describes a pending test case. + * + * - _Only available when invoked via the mocha CLI._ + */ +declare var xit: Mocha.PendingTestFunction; - /** - * Describes a pending test case. - * - * - _Only available when invoked via the mocha CLI._ - */ - var xspecify: Mocha.PendingTestFunction; +/** + * Describes a pending test case. + * + * - _Only available when invoked via the mocha CLI._ + */ +declare var xspecify: Mocha.PendingTestFunction; - // #endregion Test interface augmentations +// #endregion Test interface augmentations - // #region Reporter augmentations +// #region Reporter augmentations - // Forward declaration for `HTMLLIElement` from lib.dom.d.ts. - // Required by Mocha.reporters.HTML. - // NOTE: Mocha *must not* have a direct dependency on DOM types. +// Forward declaration for `HTMLLIElement` from lib.dom.d.ts. +// Required by Mocha.reporters.HTML. +// NOTE: Mocha *must not* have a direct dependency on DOM types. +// tslint:disable-next-line no-empty-interface +interface HTMLLIElement { } + +// Augments the DOM `Window` object when lib.dom.d.ts is loaded. +// tslint:disable-next-line no-empty-interface +interface Window extends Mocha.MochaGlobals { } + +declare namespace NodeJS { + // Forward declaration for `NodeJS.EventEmitter` from node.d.ts. + // Required by Mocha.Runnable, Mocha.Runner, and Mocha.Suite. + // NOTE: Mocha *must not* have a direct dependency on @types/node. // tslint:disable-next-line no-empty-interface - interface HTMLLIElement { } + interface EventEmitter { } - // Augments the DOM `Window` object when lib.dom.d.ts is loaded. + // Augments NodeJS's `global` object when node.d.ts is loaded // tslint:disable-next-line no-empty-interface - interface Window extends Mocha.MochaGlobals { } + interface Global extends Mocha.MochaGlobals { } +} - namespace NodeJS { - // Forward declaration for `NodeJS.EventEmitter` from node.d.ts. - // Required by Mocha.Runnable, Mocha.Runner, and Mocha.Suite. - // NOTE: Mocha *must not* have a direct dependency on @types/node. - // tslint:disable-next-line no-empty-interface - interface EventEmitter { } +// #endregion Reporter augmentations - // Augments NodeJS's `global` object when node.d.ts is loaded - // tslint:disable-next-line no-empty-interface - interface Global extends Mocha.MochaGlobals { } - } +// #region Browser augmentations - // #endregion Reporter augmentations - - // #region Browser augmentations +/** + * Mocha global. + * + * - _Only supported in the browser._ + */ +declare const mocha: BrowserMocha; +interface BrowserMocha extends Mocha { /** - * Mocha global. + * Function to allow assertion libraries to throw errors directly into mocha. + * This is useful when running tests in a browser because window.onerror will + * only receive the 'message' attribute of the Error. * * - _Only supported in the browser._ */ - const mocha: BrowserMocha; - - interface BrowserMocha extends Mocha { - /** - * Function to allow assertion libraries to throw errors directly into mocha. - * This is useful when running tests in a browser because window.onerror will - * only receive the 'message' attribute of the Error. - * - * - _Only supported in the browser._ - */ - throwError(err: any): never; - - /** - * Setup mocha with the given settings options. - * - * - _Only supported in the browser._ - */ - setup(opts?: Mocha.Interface | MochaSetupOptions): this; - } + throwError(err: any): never; /** - * Options to pass to `mocha.setup` in the browser. + * Setup mocha with the given settings options. + * + * - _Only supported in the browser._ */ - interface MochaSetupOptions extends Mocha.MochaOptions { - // TODO: This does not seem to be supported according to the source. Should it be removed? - require?: string[]; - fullTrace?: boolean; - } + setup(opts?: Mocha.Interface | MochaSetupOptions): this; +} + +/** + * Options to pass to `mocha.setup` in the browser. + */ +interface MochaSetupOptions extends Mocha.MochaOptions { + /** @deprecated This is not used by Mocha. Use `files` instead. */ + require?: string[]; + fullTrace?: boolean; +} + +// #endregion Browser augmentations + +// #region Deprecations + +/** @deprecated use `Mocha.Done` instead. */ +type MochaDone = Mocha.Done; + +/** @deprecated use `Mocha.ReporterConstructor` instead. */ +type ReporterConstructor = Mocha.ReporterConstructor; + +// #endregion Deprecations + +declare module "mocha" { + export = Mocha; +} + +declare module "mocha/lib/ms" { + export = milliseconds; + /** + * Parse the given `str` and return milliseconds. + * + * @see {@link https://mochajs.org/api/module-milliseconds.html} + * @see {@link https://mochajs.org/api/module-milliseconds.html#~parse} + */ + function milliseconds(val: string): number; + + /** + * Format for `ms`. + * + * @see {@link https://mochajs.org/api/module-milliseconds.html} + * @see {@link https://mochajs.org/api/module-milliseconds.html#~format} + */ + function milliseconds(val: number): string; +} + +declare module "mocha/lib/interfaces/common" { + export = common; + + function common(suites: Mocha.Suite[], context: Mocha.MochaGlobals, mocha: Mocha): common.CommonFunctions; + + namespace common { + interface CommonFunctions { + /** + * This is only present if flag --delay is passed into Mocha. It triggers + * root suite execution. + */ + runWithSuite(suite: Mocha.Suite): () => void; + + /** + * Execute before running tests. + */ + before(fn?: Mocha.Func | Mocha.AsyncFunc): void; + + /** + * Execute before running tests. + */ + before(name: string, fn?: Mocha.Func | Mocha.AsyncFunc): void; + + /** + * Execute after running tests. + */ + after(fn?: Mocha.Func | Mocha.AsyncFunc): void; + + /** + * Execute after running tests. + */ + after(name: string, fn?: Mocha.Func | Mocha.AsyncFunc): void; + + /** + * Execute before each test case. + */ + beforeEach(fn?: Mocha.Func | Mocha.AsyncFunc): void; + + /** + * Execute before each test case. + */ + beforeEach(name: string, fn?: Mocha.Func | Mocha.AsyncFunc): void; + + /** + * Execute after each test case. + */ + afterEach(fn?: Mocha.Func | Mocha.AsyncFunc): void; + + /** + * Execute after each test case. + */ + afterEach(name: string, fn?: Mocha.Func | Mocha.AsyncFunc): void; + + suite: SuiteFunctions; + test: TestFunctions; + } + + interface CreateOptions { + /** Title of suite */ + title: string; + + /** Suite function */ + fn?: (this: Mocha.Suite) => void; + + /** Is suite pending? */ + pending?: boolean; + + /** Filepath where this Suite resides */ + file?: string; + + /** Is suite exclusive? */ + isOnly?: boolean; + } + + interface SuiteFunctions { + /** + * Create an exclusive Suite; convenience function + */ + only(opts: CreateOptions): Mocha.Suite; - // #endregion Browser augmentations + /** + * Create a Suite, but skip it; convenience function + */ + skip(opts: CreateOptions): Mocha.Suite; - // #region Deprecations + /** + * Creates a suite. + */ + create(opts: CreateOptions): Mocha.Suite; + } - /** @deprecated use `Mocha.Done` instead. */ - type MochaDone = Mocha.Done; + interface TestFunctions { + /** + * Exclusive test-case. + */ + only(mocha: Mocha, test: Mocha.Test): Mocha.Test; - /** @deprecated use `Mocha.ReporterConstructor` instead. */ - type ReporterConstructor = Mocha.ReporterConstructor; + /** + * Pending test case. + */ + skip(title: string): void; - // #endregion Deprecations + /** + * Number of retry attempts + */ + retries(n: number): void; + } + } } diff --git a/types/mocha/lib/interfaces/common.d.ts b/types/mocha/lib/interfaces/common.d.ts deleted file mode 100644 index 9756482354..0000000000 --- a/types/mocha/lib/interfaces/common.d.ts +++ /dev/null @@ -1,109 +0,0 @@ -import Mocha = require("../../"); - -export = common; - -declare function common(suites: Mocha.Suite[], context: Mocha.MochaGlobals, mocha: Mocha): common.CommonFunctions; - -declare namespace common { - interface CommonFunctions { - /** - * This is only present if flag --delay is passed into Mocha. It triggers - * root suite execution. - */ - runWithSuite(suite: Mocha.Suite): () => void; - - /** - * Execute before running tests. - */ - before(fn?: Mocha.Func | Mocha.AsyncFunc): void; - - /** - * Execute before running tests. - */ - before(name: string, fn?: Mocha.Func | Mocha.AsyncFunc): void; - - /** - * Execute after running tests. - */ - after(fn?: Mocha.Func | Mocha.AsyncFunc): void; - - /** - * Execute after running tests. - */ - after(name: string, fn?: Mocha.Func | Mocha.AsyncFunc): void; - - /** - * Execute before each test case. - */ - beforeEach(fn?: Mocha.Func | Mocha.AsyncFunc): void; - - /** - * Execute before each test case. - */ - beforeEach(name: string, fn?: Mocha.Func | Mocha.AsyncFunc): void; - - /** - * Execute after each test case. - */ - afterEach(fn?: Mocha.Func | Mocha.AsyncFunc): void; - - /** - * Execute after each test case. - */ - afterEach(name: string, fn?: Mocha.Func | Mocha.AsyncFunc): void; - - suite: SuiteFunctions; - test: TestFunctions; - } - - interface CreateOptions { - /** Title of suite */ - title: string; - - /** Suite function */ - fn?: (this: Mocha.Suite) => void; - - /** Is suite pending? */ - pending?: boolean; - - /** Filepath where this Suite resides */ - file?: string; - - /** Is suite exclusive? */ - isOnly?: boolean; - } - - interface SuiteFunctions { - /** - * Create an exclusive Suite; convenience function - */ - only(opts: CreateOptions): Mocha.Suite; - - /** - * Create a Suite, but skip it; convenience function - */ - skip(opts: CreateOptions): Mocha.Suite; - - /** - * Creates a suite. - */ - create(opts: CreateOptions): Mocha.Suite; - } - - interface TestFunctions { - /** - * Exclusive test-case. - */ - only(mocha: Mocha, test: Mocha.Test): Mocha.Test; - - /** - * Pending test case. - */ - skip(title: string): void; - - /** - * Number of retry attempts - */ - retries(n: number): void; - } -} diff --git a/types/mocha/lib/ms.d.ts b/types/mocha/lib/ms.d.ts deleted file mode 100644 index 3b89a55fc5..0000000000 --- a/types/mocha/lib/ms.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export = milliseconds; - -/** - * Parse the given `str` and return milliseconds. - * - * @see {@link https://mochajs.org/api/module-milliseconds.html} - * @see {@link https://mochajs.org/api/module-milliseconds.html#~parse} - */ -declare function milliseconds(val: string): number; - -/** - * Format for `ms`. - * - * @see {@link https://mochajs.org/api/module-milliseconds.html} - * @see {@link https://mochajs.org/api/module-milliseconds.html#~format} - */ -declare function milliseconds(val: number): string; diff --git a/types/mocha/tsconfig.json b/types/mocha/tsconfig.json index f26091927f..6e88356fe4 100644 --- a/types/mocha/tsconfig.json +++ b/types/mocha/tsconfig.json @@ -19,8 +19,6 @@ }, "files": [ "index.d.ts", - "lib/ms.d.ts", - "lib/interfaces/common.d.ts", "mocha-tests.ts" ] } \ No newline at end of file diff --git a/types/mongodb-memory-server/index.d.ts b/types/mongodb-memory-server/index.d.ts new file mode 100644 index 0000000000..bfb14ed97d --- /dev/null +++ b/types/mongodb-memory-server/index.d.ts @@ -0,0 +1,153 @@ +// Type definitions for mongodb-memory-server 1.8 +// Project: https://github.com/nodkz/mongodb-memory-server +// Definitions by: Dmitry Rogozhny +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +/// + +import { ChildProcess } from "child_process"; + +import MongoMemoryServer = _MongoMemoryServer.MongoMemoryServer; +import MongoInstance = _MongoInstance.MongodbInstance; +import MongoBinary = _MongoBinary.MongoBinary; + +export default MongoMemoryServer; +export { MongoMemoryServer, MongoInstance, MongoBinary }; + +// exports from the ./util/MongoBinary.js.flow file +declare namespace _MongoBinary { + interface MongoBinaryCache { + [version: string]: string; + } + + interface MongoBinaryOpts { + version?: string; + downloadDir?: string; + platform?: string; + arch?: string; + debug?: boolean | ((...args: any[]) => any); + } + + // disable error for a class with all static functions, + // so the TypeScript declaration would map the implementation with flow types for easier support. + // tslint:disable-next-line:no-unnecessary-class + class MongoBinary { + static cache: MongoBinaryCache; + + static getPath(opts?: MongoBinaryOpts): Promise; + static hasValidBinPath(files: string[]): boolean; + } +} + +// exports from the ./util/MongoInstance.js.flow file +declare namespace _MongoInstance { + interface MongodOps { + // instance options + instance: { + port: number, + storageEngine?: string, + dbPath: string, + debug?: boolean | ((...args: any[]) => any), + }; + + // mongo binary options + binary?: _MongoBinary.MongoBinaryOpts; + + // child process spawn options + spawn?: { + cwd?: string, + env?: object, + argv0?: string, + stdio?: string | any[], + detached?: boolean, + uid?: number, + gid?: number, + shell?: boolean | string, + }; + + debug?: boolean | ((...args: any[]) => any); + } + + class MongodbInstance { + static childProcessList: ChildProcess[]; + + opts: MongodOps; + debug: ((...args: any[]) => any); + childProcess: ChildProcess; + killerProcess: ChildProcess; + instanceReady: ((...args: any[]) => any); + instanceFailed: ((...args: any[]) => any); + + static run(opts: MongodOps): Promise; + + constructor(opts: MongodOps); + + prepareCommandArgs(): string[]; + run(): Promise; + kill(): Promise; + getPid(): number | undefined; + _launchMongod(mongoBin: string): ChildProcess; + _launchKiller(parentPid: number, childPid: number): ChildProcess; + errorHandler(err: string): void; + closeHandler(code: number): void; + stderrHandler(message: string | Buffer): void; + stdoutHandler(message: string | Buffer): void; + } +} + +// exports from the MongoMemoryServer.js.flow file +declare namespace _MongoMemoryServer { + interface MongoMemoryServerOptsT { + instance: { + port?: number, + dbPath?: string, + dbName?: string, + storageEngine?: string, + debug?: boolean | ((...args: any[]) => any), + }; + binary: { + version?: string, + downloadDir?: string, + platform?: string, + arch?: string, + debug?: boolean | ((...args: any[]) => any), + }; + debug?: boolean; + spawn: any; + autoStart?: boolean; + } + + interface MongoInstanceDataT { + port: number; + dbPath: string; + dbName: string; + uri: string; + storageEngine: string; + instance: _MongoInstance.MongodbInstance; + childProcess: ChildProcess; + tmpDir?: { + name: string, + removeCallback: ((...args: any[]) => any), + }; + } + + class MongoMemoryServer { + isRunning: boolean; + runningInstance: Promise | undefined; + opts: MongoMemoryServerOptsT; + debug: ((...args: any[]) => any); + + constructor(opts?: Partial); + + start(): Promise; + _startUpInstance(): Promise; + stop(): Promise; + getInstanceData(): Promise; + getUri(otherDbName?: string | boolean): Promise; + getConnectionString(otherDbName?: string | boolean): Promise; + getPort(): Promise; + getDbPath(): Promise; + getDbName(): Promise; + } +} diff --git a/types/mongodb-memory-server/mongodb-memory-server-tests.ts b/types/mongodb-memory-server/mongodb-memory-server-tests.ts new file mode 100644 index 0000000000..62abb2651b --- /dev/null +++ b/types/mongodb-memory-server/mongodb-memory-server-tests.ts @@ -0,0 +1,15 @@ +import MongodbMemoryServer from 'mongodb-memory-server'; + +// Simple server start example from https://www.npmjs.com/package/mongodb-memory-server +async function simpleServerStart() { + const mongod = new MongodbMemoryServer(); + + const uri = await mongod.getConnectionString(); + const port = await mongod.getPort(); + const dbPath = await mongod.getDbPath(); + const dbName = await mongod.getDbName(); + + // you may stop mongod manually + mongod.stop(); + // or it will be stopped automatically when you exit from script +} diff --git a/types/mongodb-memory-server/tsconfig.json b/types/mongodb-memory-server/tsconfig.json new file mode 100644 index 0000000000..29046ccb01 --- /dev/null +++ b/types/mongodb-memory-server/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "mongodb-memory-server-tests.ts" + ] +} diff --git a/types/mongodb-memory-server/tslint.json b/types/mongodb-memory-server/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mongodb-memory-server/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index 12927d1f34..d3c5b550b0 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for MongoDB v3.0 +// Type definitions for MongoDB v3.1 // Project: https://github.com/mongodb/node-mongodb-native/tree/3.0.0 // Definitions by: Federico Caselli // Alan Marcell @@ -11,10 +11,11 @@ // Julien Chaumond // Dan Aprahamian // Denys Bushulyak +// Bastien Arata // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -// Documentation : http://mongodb.github.io/node-mongodb-native/3.0/api/ +// Documentation : http://mongodb.github.io/node-mongodb-native/3.1/api/ /// /// @@ -27,34 +28,34 @@ export function connect(uri: string, options?: MongoClientOptions): Promise; export function connect(uri: string, callback: MongoCallback): void; export function connect(uri: string, options: MongoClientOptions, callback: MongoCallback): void; -export { Binary, Double, Long, Decimal128, MaxKey, MinKey, ObjectID, ObjectId, Timestamp, DBRef } from 'bson'; +export { Binary, DBRef, Decimal128, Double, Long, MaxKey, MinKey, ObjectID, ObjectId, Timestamp } from 'bson'; -// Class documentation : http://mongodb.github.io/node-mongodb-native/3.0/api/MongoClient.html +// Class documentation : http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html export class MongoClient extends EventEmitter { constructor(uri: string, options?: MongoClientOptions); - /** http://mongodb.github.io/node-mongodb-native/3.0/api/MongoClient.html#.connect */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#.connect */ static connect(uri: string, callback: MongoCallback): void; static connect(uri: string, options?: MongoClientOptions): Promise; static connect(uri: string, options: MongoClientOptions, callback: MongoCallback): void; /** * @deprecated - * http://mongodb.github.io/node-mongodb-native/3.0/api/MongoClient.html#connect + * http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#connect */ connect(): Promise; connect(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/MongoClient.html#close */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#close */ close(callback: MongoCallback): void; close(force?: boolean): Promise; close(force: boolean, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/MongoClient.html#db */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#db */ db(dbName?: string, options?: MongoClientCommonOption): Db - /** http://mongodb.github.io/node-mongodb-native/3.0/api/MongoClient.html#isConnected */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#isConnected */ isConnected(options?: MongoClientCommonOption): boolean; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/MongoClient.html#logout */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#logout */ logout(callback: MongoCallback): void; logout(options?: { dbName?: string }): Promise; logout(options: { dbName?: string }, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/MongoClient.html#startSession */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#startSession */ startSession(options?: any): ClientSession; } @@ -75,14 +76,14 @@ export interface MongoCallback { (error: MongoError, result: T): void; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/MongoError.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/MongoError.html */ export class MongoError extends Error { constructor(message: string); static create(options: Object): MongoError; code?: number; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/MongoClient.html#.connect */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#.connect */ export interface MongoClientOptions extends DbCreateOptions, ServerOptions, @@ -102,7 +103,9 @@ export interface MongoClientOptions extends auth?: { user: string; password: string; - } + }, + // Determines whether or not to use the new url parser + useNewUrlParser?: boolean } export interface SSLOptions { @@ -143,7 +146,7 @@ export interface HighAvailabilityOptions { domainsEnabled?: boolean; } -// See http://mongodb.github.io/node-mongodb-native/3.0/api/ReadPreference.html +// See http://mongodb.github.io/node-mongodb-native/3.1/api/ReadPreference.html export class ReadPreference { constructor(mode: string, tags: Object); mode: string; @@ -158,7 +161,7 @@ export class ReadPreference { static isValid(mode: string): boolean; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html */ export interface DbCreateOptions extends CommonOptions { // If the database authentication is dependent on another databaseName. authSource?: string; @@ -191,7 +194,7 @@ export interface DbCreateOptions extends CommonOptions { bufferMaxEntries?: number; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Server.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Server.html */ export interface SocketOptions { // Reconnect on error. default:false autoReconnect?: boolean; @@ -205,7 +208,7 @@ export interface SocketOptions { socketTimeoutMS?: number; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Server.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Server.html */ export interface ServerOptions extends SSLOptions { // Default: 30; reconnectTries?: number; @@ -220,14 +223,14 @@ export interface ServerOptions extends SSLOptions { domainsEnabled?: boolean; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Mongos.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Mongos.html */ export interface MongosOptions extends SSLOptions, HighAvailabilityOptions { // Default: 15; Cutoff latency point in MS for MongoS proxy selection acceptableLatencyMS?: number; socketOptions?: SocketOptions; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/ReplSet.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/ReplSet.html */ export interface ReplSetOptions extends SSLOptions, HighAvailabilityOptions { // The max staleness to secondary reads (values under 10 seconds cannot be guaranteed); maxStalenessSeconds?: number; @@ -241,7 +244,7 @@ export interface ReplSetOptions extends SSLOptions, HighAvailabilityOptions { export type ProfilingLevel = 'off' | 'slow_only' | 'all'; -// Class documentation : http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html +// Class documentation : http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html export class Db extends EventEmitter { constructor(databaseName: string, serverConfig: Server | ReplSet | Mongos, options?: DbCreateOptions); @@ -253,69 +256,69 @@ export class Db extends EventEmitter { slaveOk: boolean; writeConcern: any; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#addUser */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#addUser */ addUser(username: string, password: string, callback: MongoCallback): void; addUser(username: string, password: string, options?: DbAddUserOptions): Promise; addUser(username: string, password: string, options: DbAddUserOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#admin */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#admin */ admin(): Admin; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#collection */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#collection */ collection(name: string): Collection; collection(name: string, callback: MongoCallback>): Collection; collection(name: string, options: DbCollectionOptions, callback: MongoCallback>): Collection; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#collections */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#collections */ collections(): Promise[]>; collections(callback: MongoCallback[]>): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#command */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#command */ command(command: Object, callback: MongoCallback): void; command(command: Object, options?: { readPreference: ReadPreference | string }): Promise; command(command: Object, options: { readPreference: ReadPreference | string }, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#createCollection */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#createCollection */ createCollection(name: string, callback: MongoCallback>): void; createCollection(name: string, options?: CollectionCreateOptions): Promise>; createCollection(name: string, options: CollectionCreateOptions, callback: MongoCallback>): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#createIndex */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#createIndex */ createIndex(name: string, fieldOrSpec: string | Object, callback: MongoCallback): void; createIndex(name: string, fieldOrSpec: string | Object, options?: IndexOptions): Promise; createIndex(name: string, fieldOrSpec: string | Object, options: IndexOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#dropCollection */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#dropCollection */ dropCollection(name: string): Promise; dropCollection(name: string, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#dropDatabase */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#dropDatabase */ dropDatabase(): Promise; dropDatabase(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#executeDbAdminCommand */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#executeDbAdminCommand */ executeDbAdminCommand(command: Object, callback: MongoCallback): void; executeDbAdminCommand(command: Object, options?: { readPreference?: ReadPreference | string, maxTimeMS?: number }): Promise; executeDbAdminCommand(command: Object, options: { readPreference?: ReadPreference | string, maxTimeMS?: number }, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#indexInformation */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#indexInformation */ indexInformation(name: string, callback: MongoCallback): void; indexInformation(name: string, options?: { full?: boolean, readPreference?: ReadPreference | string }): Promise; indexInformation(name: string, options: { full?: boolean, readPreference?: ReadPreference | string }, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#listCollections */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#listCollections */ listCollections(filter?: Object, options?: { batchSize?: number, readPreference?: ReadPreference | string }): CommandCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#profilingInfo */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#profilingInfo */ /** @deprecated Query the system.profile collection directly. */ profilingInfo(callback: MongoCallback): void; profilingInfo(options?: { session?: ClientSession }): Promise; profilingInfo(options: { session?: ClientSession }, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#profilingLevel */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#profilingLevel */ profilingLevel(callback: MongoCallback): void; profilingLevel(options?: { session?: ClientSession }): Promise; profilingLevel(options: { session?: ClientSession }, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#removeUser */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#removeUser */ removeUser(username: string, callback: MongoCallback): void; removeUser(username: string, options?: CommonOptions): Promise; removeUser(username: string, options: CommonOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#renameCollection */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#renameCollection */ renameCollection(fromCollection: string, toCollection: string, callback: MongoCallback>): void; renameCollection(fromCollection: string, toCollection: string, options?: { dropTarget?: boolean }): Promise>; renameCollection(fromCollection: string, toCollection: string, options: { dropTarget?: boolean }, callback: MongoCallback>): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#setProfilingLevel */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#setProfilingLevel */ setProfilingLevel(level: ProfilingLevel, callback: MongoCallback): void; setProfilingLevel(level: ProfilingLevel, options?: { session?: ClientSession }): Promise; setProfilingLevel(level: ProfilingLevel, options: { session?: ClientSession }, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#stats */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#stats */ stats(callback: MongoCallback): void; stats(options?: { scale?: number }): Promise; stats(options: { scale?: number }, callback: MongoCallback): void; @@ -332,34 +335,34 @@ export interface CommonOptions { session?: ClientSession; } -// Deprecated http://mongodb.github.io/node-mongodb-native/3.0/api/Server.html +// Deprecated http://mongodb.github.io/node-mongodb-native/3.1/api/Server.html export class Server extends EventEmitter { constructor(host: string, port: number, options?: ServerOptions); connections(): Array; } -// Deprecated http://mongodb.github.io/node-mongodb-native/3.0/api/ReplSet.html +// Deprecated http://mongodb.github.io/node-mongodb-native/3.1/api/ReplSet.html export class ReplSet extends EventEmitter { constructor(servers: Array, options?: ReplSetOptions); connections(): Array; } -// Deprecated http://mongodb.github.io/node-mongodb-native/3.0/api/ReplSet.html +// Deprecated http://mongodb.github.io/node-mongodb-native/3.1/api/ReplSet.html export class Mongos extends EventEmitter { constructor(servers: Array, options?: MongosOptions); connections(): Array; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#addUser */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#addUser */ export interface DbAddUserOptions extends CommonOptions { customData?: Object; roles?: Object[]; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#createCollection */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#createCollection */ export interface CollectionCreateOptions extends CommonOptions { raw?: boolean; pkFactory?: Object; @@ -381,7 +384,7 @@ export interface CollectionCreateOptions extends CommonOptions { collation?: object; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#collection */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#collection */ export interface DbCollectionOptions extends CommonOptions { raw?: boolean; pkFactory?: Object; @@ -391,7 +394,7 @@ export interface DbCollectionOptions extends CommonOptions { readConcern?: { level: Object }; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html#createIndex */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#createIndex */ export interface IndexOptions extends CommonOptions { // Creates an unique index. unique?: boolean; @@ -419,57 +422,57 @@ export interface IndexOptions extends CommonOptions { default_language?: string } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Admin.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Admin.html */ export interface Admin { - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Admin.html#addUser */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Admin.html#addUser */ addUser(username: string, password: string, callback: MongoCallback): void; addUser(username: string, password: string, options?: AddUserOptions): Promise; addUser(username: string, password: string, options: AddUserOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Admin.html#buildInfo */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Admin.html#buildInfo */ buildInfo(): Promise; buildInfo(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Admin.html#command */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Admin.html#command */ command(command: Object, callback: MongoCallback): void; command(command: Object, options?: { readPreference?: ReadPreference | string, maxTimeMS?: number }): Promise; command(command: Object, options: { readPreference?: ReadPreference | string, maxTimeMS?: number }, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Admin.html#listDatabases */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Admin.html#listDatabases */ listDatabases(): Promise; listDatabases(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Admin.html#ping */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Admin.html#ping */ ping(): Promise; ping(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Admin.html#removeUser */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Admin.html#removeUser */ removeUser(username: string, callback: MongoCallback): void; removeUser(username: string, options?: FSyncOptions): Promise; removeUser(username: string, options: FSyncOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Admin.html#replSetGetStatus */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Admin.html#replSetGetStatus */ replSetGetStatus(): Promise; replSetGetStatus(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Admin.html#serverInfo */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Admin.html#serverInfo */ serverInfo(): Promise; serverInfo(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Admin.html#serverStatus */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Admin.html#serverStatus */ serverStatus(): Promise; serverStatus(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Admin.html#validateCollection */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Admin.html#validateCollection */ validateCollection(collectionNme: string, callback: MongoCallback): void; validateCollection(collectionNme: string, options?: Object): Promise; validateCollection(collectionNme: string, options: Object, callback: MongoCallback): void; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Admin.html#addUser */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Admin.html#addUser */ export interface AddUserOptions extends CommonOptions { fsync: boolean; customData?: Object; roles?: Object[] } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Admin.html#removeUser */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Admin.html#removeUser */ export interface FSyncOptions extends CommonOptions { fsync?: boolean } -// Documentation : http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html +// Documentation : http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html export interface Collection { // Get the collection name. collectionName: string; @@ -482,176 +485,177 @@ export interface Collection { // Get current index hint for collection. hint: any; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#aggregate */ + aggregate(callback: MongoCallback>): AggregationCursor; aggregate(pipeline: Object[], callback: MongoCallback>): AggregationCursor; - aggregate(pipeline: Object[], options?: CollectionAggregationOptions, callback?: MongoCallback>): AggregationCursor; + aggregate(pipeline?: Object[], options?: CollectionAggregationOptions, callback?: MongoCallback>): AggregationCursor; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#bulkWrite */ bulkWrite(operations: Object[], callback: MongoCallback): void; - bulkWrite(operations: Object[], options?: CollectionBluckWriteOptions): Promise; - bulkWrite(operations: Object[], options: CollectionBluckWriteOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#count */ + bulkWrite(operations: Object[], options?: CollectionBulkWriteOptions): Promise; + bulkWrite(operations: Object[], options: CollectionBulkWriteOptions, callback: MongoCallback): void; + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#count */ count(callback: MongoCallback): void; count(query: Object, callback: MongoCallback): void; count(query?: Object, options?: MongoCountPreferences): Promise; count(query: Object, options: MongoCountPreferences, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#createIndex */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#createIndex */ createIndex(fieldOrSpec: string | any, callback: MongoCallback): void; createIndex(fieldOrSpec: string | any, options?: IndexOptions): Promise; createIndex(fieldOrSpec: string | any, options: IndexOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#createIndexes and http://docs.mongodb.org/manual/reference/command/createIndexes/ */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#createIndexes and http://docs.mongodb.org/manual/reference/command/createIndexes/ */ createIndexes(indexSpecs: Object[], callback: MongoCallback): void; createIndexes(indexSpecs: Object[], options?: {session?: ClientSession}): Promise; createIndexes(indexSpecs: Object[], options: {session?: ClientSession}, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#deleteMany */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#deleteMany */ deleteMany(filter: FilterQuery, callback: MongoCallback): void; deleteMany(filter: FilterQuery, options?: CommonOptions): Promise; deleteMany(filter: FilterQuery, options: CommonOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#deleteOne */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#deleteOne */ deleteOne(filter: FilterQuery, callback: MongoCallback): void; deleteOne(filter: FilterQuery, options?: CommonOptions & { bypassDocumentValidation?: boolean }): Promise; deleteOne(filter: FilterQuery, options: CommonOptions & { bypassDocumentValidation?: boolean }, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#distinct */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#distinct */ distinct(key: string, query: Object, callback: MongoCallback): void; distinct(key: string, query: Object, options?: { readPreference?: ReadPreference | string, maxTimeMS?: number, session?: ClientSession }): Promise; distinct(key: string, query: Object, options: { readPreference?: ReadPreference | string, maxTimeMS?: number, session?: ClientSession }, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#drop */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#drop */ drop(options?: {session: ClientSession}): Promise; drop(callback: MongoCallback): void; drop(options: {session: ClientSession}, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#dropIndex */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#dropIndex */ dropIndex(indexName: string, callback: MongoCallback): void; dropIndex(indexName: string, options?: CommonOptions & { maxTimeMS?: number }): Promise; dropIndex(indexName: string, options: CommonOptions & { maxTimeMS?: number }, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#dropIndexes */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#dropIndexes */ dropIndexes(options?: {session?: ClientSession, maxTimeMS?: number}): Promise; dropIndexes(callback?: MongoCallback): void; dropIndexes(options: {session?: ClientSession, maxTimeMS?: number}, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#find */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#find */ find(query?: FilterQuery): Cursor; /** @deprecated */ find(query: FilterQuery, options?: FindOneOptions): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#findOne */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOne */ findOne(filter: FilterQuery, callback: MongoCallback): void; findOne(filter: FilterQuery, options?: FindOneOptions): Promise; findOne(filter: FilterQuery, options: FindOneOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#findOneAndDelete */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOneAndDelete */ findOneAndDelete(filter: FilterQuery, callback: MongoCallback>): void; findOneAndDelete(filter: FilterQuery, options?: { projection?: Object, sort?: Object, maxTimeMS?: number, session?: ClientSession }): Promise>; findOneAndDelete(filter: FilterQuery, options: { projection?: Object, sort?: Object, maxTimeMS?: number, session?: ClientSession }, callback: MongoCallback>): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#findOneAndReplace */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOneAndReplace */ findOneAndReplace(filter: FilterQuery, replacement: Object, callback: MongoCallback>): void; findOneAndReplace(filter: FilterQuery, replacement: Object, options?: FindOneAndReplaceOption): Promise>; findOneAndReplace(filter: FilterQuery, replacement: Object, options: FindOneAndReplaceOption, callback: MongoCallback>): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#findOneAndUpdate */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOneAndUpdate */ findOneAndUpdate(filter: FilterQuery, update: Object, callback: MongoCallback>): void; findOneAndUpdate(filter: FilterQuery, update: Object, options?: FindOneAndReplaceOption): Promise>; findOneAndUpdate(filter: FilterQuery, update: Object, options: FindOneAndReplaceOption, callback: MongoCallback>): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#geoHaystackSearch */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#geoHaystackSearch */ geoHaystackSearch(x: number, y: number, callback: MongoCallback): void; geoHaystackSearch(x: number, y: number, options?: GeoHaystackSearchOptions): Promise; geoHaystackSearch(x: number, y: number, options: GeoHaystackSearchOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#geoNear */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#geoNear */ geoNear(x: number, y: number, callback: MongoCallback): void; geoNear(x: number, y: number, options?: GeoNearOptions): Promise; geoNear(x: number, y: number, options: GeoNearOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#group */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#group */ group(keys: Object | Array | Function | Code, condition: Object, initial: Object, reduce: Function | Code, finalize: Function | Code, command: boolean, callback: MongoCallback): void; group(keys: Object | Array | Function | Code, condition: Object, initial: Object, reduce: Function | Code, finalize: Function | Code, command: boolean, options?: { readPreference?: ReadPreference | string }): Promise; group(keys: Object | Array | Function | Code, condition: Object, initial: Object, reduce: Function | Code, finalize: Function | Code, command: boolean, options: { readPreference?: ReadPreference | string }, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#indexes */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#indexes */ indexes(options?: {session: ClientSession}): Promise; indexes(callback: MongoCallback): void; indexes(options: {session?: ClientSession}, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#indexExists */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#indexExists */ indexExists(indexes: string | string[], callback: MongoCallback): void; indexExists(indexes: string | string[], options?: {session: ClientSession}): Promise; indexExists(indexes: string | string[], options: {session: ClientSession}, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#indexInformation */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#indexInformation */ indexInformation(callback: MongoCallback): void; indexInformation(options?: { full: boolean, session: ClientSession }): Promise; indexInformation(options: { full: boolean, session: ClientSession }, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#initializeOrderedBulkOp */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#initializeOrderedBulkOp */ initializeOrderedBulkOp(options?: CommonOptions): OrderedBulkOperation; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#initializeUnorderedBulkOp */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#initializeUnorderedBulkOp */ initializeUnorderedBulkOp(options?: CommonOptions): UnorderedBulkOperation; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#insertOne */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#insertOne */ /** @deprecated Use insertOne, insertMany or bulkWrite */ insert(docs: Object, callback: MongoCallback): void; /** @deprecated Use insertOne, insertMany or bulkWrite */ insert(docs: Object, options?: CollectionInsertOneOptions): Promise; /** @deprecated Use insertOne, insertMany or bulkWrite */ insert(docs: Object, options: CollectionInsertOneOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#insertMany */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#insertMany */ insertMany(docs: Object[], callback: MongoCallback): void; insertMany(docs: Object[], options?: CollectionInsertManyOptions): Promise; insertMany(docs: Object[], options: CollectionInsertManyOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#insertOne */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#insertOne */ insertOne(docs: Object, callback: MongoCallback): void; insertOne(docs: Object, options?: CollectionInsertOneOptions): Promise; insertOne(docs: Object, options: CollectionInsertOneOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#isCapped */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#isCapped */ isCapped(options?: {session: ClientSession}): Promise; isCapped(callback: MongoCallback): void; isCapped(options: {session: ClientSession}, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#listIndexes */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#listIndexes */ listIndexes(options?: { batchSize?: number, readPreference?: ReadPreference | string, session?: ClientSession }): CommandCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#mapReduce */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#mapReduce */ mapReduce(map: Function | string, reduce: Function | string, callback: MongoCallback): void; mapReduce(map: Function | string, reduce: Function | string, options?: MapReduceOptions): Promise; mapReduce(map: Function | string, reduce: Function | string, options: MapReduceOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#options */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#options */ options(options?: {session: ClientSession}): Promise; options(callback: MongoCallback): void; options(options: {session: ClientSession}, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#parallelCollectionScan */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#parallelCollectionScan */ parallelCollectionScan(callback: MongoCallback[]>): void; parallelCollectionScan(options?: ParallelCollectionScanOptions): Promise[]>; parallelCollectionScan(options: ParallelCollectionScanOptions, callback: MongoCallback[]>): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#reIndex */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#reIndex */ reIndex(options?: {session: ClientSession}): Promise; reIndex(callback: MongoCallback): void; reIndex(options: {session: ClientSession}, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#remove */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#remove */ /** @deprecated Use use deleteOne, deleteMany or bulkWrite */ remove(selector: Object, callback: MongoCallback): void; /** @deprecated Use use deleteOne, deleteMany or bulkWrite */ remove(selector: Object, options?: CommonOptions & { single?: boolean }): Promise; /** @deprecated Use use deleteOne, deleteMany or bulkWrite */ remove(selector: Object, options?: CommonOptions & { single?: boolean }, callback?: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#rename */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#rename */ rename(newName: string, callback: MongoCallback>): void; rename(newName: string, options?: { dropTarget?: boolean, session?: ClientSession }): Promise>; rename(newName: string, options: { dropTarget?: boolean, session?: ClientSession }, callback: MongoCallback>): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#replaceOne */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#replaceOne */ replaceOne(filter: FilterQuery, doc: Object, callback: MongoCallback): void; replaceOne(filter: FilterQuery, doc: Object, options?: ReplaceOneOptions): Promise; replaceOne(filter: FilterQuery, doc: Object, options: ReplaceOneOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#save */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#save */ /** @deprecated Use insertOne, insertMany, updateOne or updateMany */ save(doc: Object, callback: MongoCallback): void; /** @deprecated Use insertOne, insertMany, updateOne or updateMany */ save(doc: Object, options?: CommonOptions): Promise; /** @deprecated Use insertOne, insertMany, updateOne or updateMany */ save(doc: Object, options: CommonOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#stats */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#stats */ stats(callback: MongoCallback): void; stats(options?: { scale: number, session?: ClientSession }): Promise; stats(options: { scale: number, session?: ClientSession }, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#update */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#update */ /** @deprecated use updateOne, updateMany or bulkWrite */ update(filter: FilterQuery, update: Object, callback: MongoCallback): void; /** @deprecated use updateOne, updateMany or bulkWrite */ update(filter: FilterQuery, update: Object, options?: ReplaceOneOptions & { multi?: boolean }): Promise; /** @deprecated use updateOne, updateMany or bulkWrite */ update(filter: FilterQuery, update: Object, options: ReplaceOneOptions & { multi?: boolean }, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#updateMany */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#updateMany */ updateMany(filter: FilterQuery, update: Object, callback: MongoCallback): void; updateMany(filter: FilterQuery, update: Object, options?: CommonOptions & { upsert?: boolean }): Promise; updateMany(filter: FilterQuery, update: Object, options: CommonOptions & { upsert?: boolean }, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#updateOne */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#updateOne */ updateOne(filter: FilterQuery, update: Object, callback: MongoCallback): void; updateOne(filter: FilterQuery, update: Object, options?: ReplaceOneOptions): Promise; updateOne(filter: FilterQuery, update: Object, options: ReplaceOneOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#watch */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#watch */ watch(pipeline?: Object[], options?: ChangeStreamOptions & { session?: ClientSession }): ChangeStream; } @@ -870,7 +874,7 @@ export interface WiredTigerData { }; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#aggregate */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#aggregate */ export interface CollectionAggregationOptions { readPreference?: ReadPreference | string; // Return the query as cursor, on 2.6 > it returns as a real cursor @@ -896,7 +900,7 @@ export interface CollectionAggregationOptions { } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#insertMany */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#insertMany */ export interface CollectionInsertManyOptions extends CommonOptions { // Serialize functions on any object. serializeFunctions?: boolean; @@ -908,17 +912,19 @@ export interface CollectionInsertManyOptions extends CommonOptions { ordered?: boolean; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#bulkWrite */ -export interface CollectionBluckWriteOptions extends CommonOptions { +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#bulkWrite */ +export interface CollectionBulkWriteOptions extends CommonOptions { // Serialize functions on any object. serializeFunctions?: boolean; // Execute write operation in ordered or unordered fashion. ordered?: boolean; // Allow driver to bypass schema validation in MongoDB 3.2 or higher. bypassDocumentValidation?: boolean; + //Force server to assign _id values instead of driver. + forceServerObjectId?: boolean; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#~BulkWriteOpResult */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#~BulkWriteOpResult */ export interface BulkWriteOpResultObject { insertedCount?: number; matchedCount?: number; @@ -930,7 +936,7 @@ export interface BulkWriteOpResultObject { result?: any; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#count */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#count */ export interface MongoCountPreferences { // The limit of documents to count. limit?: number; @@ -944,7 +950,7 @@ export interface MongoCountPreferences { session?: ClientSession; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#~deleteWriteOpResult */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#~deleteWriteOpResult */ export interface DeleteWriteOpResultObject { //The raw result returned from MongoDB, field will vary depending on server version. result: { @@ -959,7 +965,7 @@ export interface DeleteWriteOpResultObject { deletedCount?: number; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#~findAndModifyWriteOpResult */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#~findAndModifyWriteOpResult */ export interface FindAndModifyWriteOpResultObject { //Document returned from findAndModify command. value?: TSchema; @@ -969,7 +975,7 @@ export interface FindAndModifyWriteOpResultObject { ok?: number; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#findOneAndReplace */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOneAndReplace */ export interface FindOneAndReplaceOption { projection?: Object; sort?: Object; @@ -979,7 +985,7 @@ export interface FindOneAndReplaceOption { session?: ClientSession; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#geoHaystackSearch */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#geoHaystackSearch */ export interface GeoHaystackSearchOptions { readPreference?: ReadPreference | string; maxDistance?: number; @@ -988,7 +994,7 @@ export interface GeoHaystackSearchOptions { session?: ClientSession; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#geoNear */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#geoNear */ export interface GeoNearOptions { readPreference?: ReadPreference | string; num?: number; @@ -1001,27 +1007,27 @@ export interface GeoNearOptions { includeLocs?: boolean; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Code.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Code.html */ export class Code { constructor(code: string | Function, scope?: Object) code: string | Function; scope: any; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/OrderedBulkOperation.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/OrderedBulkOperation.html */ export interface OrderedBulkOperation { length: number; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/OrderedBulkOperation.html#execute */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/OrderedBulkOperation.html#execute */ execute(callback: MongoCallback): void; execute(options?: FSyncOptions): Promise; execute(options: FSyncOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/OrderedBulkOperation.html#find */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/OrderedBulkOperation.html#find */ find(selector: Object): FindOperatorsOrdered; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/OrderedBulkOperation.html#insert */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/OrderedBulkOperation.html#insert */ insert(doc: Object): OrderedBulkOperation; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/BulkWriteResult.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/BulkWriteResult.html */ export interface BulkWriteResult { ok: number; nInserted: number; @@ -1042,7 +1048,7 @@ export interface BulkWriteResult { hasWriteErrors(): boolean; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/WriteError.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/WriteError.html */ export interface WriteError { //Write concern error code. code: number; @@ -1052,7 +1058,7 @@ export interface WriteError { errmsg: string; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/WriteConcernError.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/WriteConcernError.html */ export interface WriteConcernError { //Write concern error code. code: number; @@ -1060,7 +1066,7 @@ export interface WriteConcernError { errmsg: string; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/FindOperatorsOrdered.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/FindOperatorsOrdered.html */ export interface FindOperatorsOrdered { delete(): OrderedBulkOperation; deleteOne(): OrderedBulkOperation; @@ -1070,21 +1076,21 @@ export interface FindOperatorsOrdered { upsert(): FindOperatorsOrdered; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/UnorderedBulkOperation.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/UnorderedBulkOperation.html */ export interface UnorderedBulkOperation { - /** http://mongodb.github.io/node-mongodb-native/3.0/api/lib_bulk_unordered.js.html line 339 */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/lib_bulk_unordered.js.html line 339 */ length: number; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/UnorderedBulkOperation.html#execute */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/UnorderedBulkOperation.html#execute */ execute(callback: MongoCallback): void; execute(options?: FSyncOptions): Promise; execute(options: FSyncOptions, callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/UnorderedBulkOperation.html#find */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/UnorderedBulkOperation.html#find */ find(selector: Object): FindOperatorsUnordered; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/UnorderedBulkOperation.html#insert */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/UnorderedBulkOperation.html#insert */ insert(doc: Object): UnorderedBulkOperation; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/FindOperatorsUnordered.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/FindOperatorsUnordered.html */ export interface FindOperatorsUnordered { length: number; remove(): UnorderedBulkOperation; @@ -1095,7 +1101,7 @@ export interface FindOperatorsUnordered { upsert(): FindOperatorsUnordered; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#findOne */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOne */ export interface FindOneOptions { limit?: number; sort?: Array | Object; @@ -1125,7 +1131,7 @@ export interface FindOneOptions { session?: ClientSession; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#~insertWriteOpResult */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#~insertWriteOpResult */ export interface InsertWriteOpResult { insertedCount: number; ops: Array; @@ -1134,7 +1140,7 @@ export interface InsertWriteOpResult { result: { ok: number, n: number } } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#insertOne */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#insertOne */ export interface CollectionInsertOneOptions extends CommonOptions { // Serialize functions on any object. serializeFunctions?: boolean; @@ -1144,7 +1150,7 @@ export interface CollectionInsertOneOptions extends CommonOptions { bypassDocumentValidation?: boolean } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#~insertOneWriteOpResult */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#~insertOneWriteOpResult */ export interface InsertOneWriteOpResult { insertedCount: number; ops: Array; @@ -1153,7 +1159,7 @@ export interface InsertOneWriteOpResult { result: { ok: number, n: number } } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#parallelCollectionScan */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#parallelCollectionScan */ export interface ParallelCollectionScanOptions { readPreference?: ReadPreference | string; batchSize?: number; @@ -1162,13 +1168,13 @@ export interface ParallelCollectionScanOptions { session?: ClientSession; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#replaceOne */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#replaceOne */ export interface ReplaceOneOptions extends CommonOptions { upsert?: boolean; bypassDocumentValidation?: boolean; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#~updateWriteOpResult */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#~updateWriteOpResult */ export interface UpdateWriteOpResult { result: { ok: number, n: number, nModified: number }; connection: any; @@ -1183,7 +1189,7 @@ export interface ReplaceWriteOpResult extends UpdateWriteOpResult { ops: Array } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#mapReduce */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#mapReduce */ export interface MapReduceOptions { readPreference?: ReadPreference | string; out?: Object; @@ -1199,106 +1205,106 @@ export interface MapReduceOptions { session?: ClientSession; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#~WriteOpResult */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#~WriteOpResult */ export interface WriteOpResult { ops: Array; connection: any; result: any; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#~resultCallback */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#~resultCallback */ export type CursorResult = any | void | boolean; type Default = any; -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html */ export class Cursor extends Readable { sortValue: string; timeout: boolean; readPreference: ReadPreference; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#addCursorFlag */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#addCursorFlag */ addCursorFlag(flag: string, value: boolean): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#addQueryModifier */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#addQueryModifier */ addQueryModifier(name: string, value: boolean): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#batchSize */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#batchSize */ batchSize(value: number): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#clone */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#clone */ clone(): Cursor; // still returns the same type - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#close */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#close */ close(): Promise; close(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#collation */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#collation */ collation(value: Object): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#comment */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#comment */ comment(value: string): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#count */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#count */ count(callback: MongoCallback): void; count(applySkipLimit: boolean, callback: MongoCallback): void; count(options: CursorCommentOptions, callback: MongoCallback): void; count(applySkipLimit: boolean, options: CursorCommentOptions, callback: MongoCallback): void; count(applySkipLimit?: boolean, options?: CursorCommentOptions): Promise; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#explain */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#explain */ explain(): Promise; explain(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#filter */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#filter */ filter(filter: Object): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#forEach */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#forEach */ forEach(iterator: IteratorCallback, callback: EndCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#hasNext */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#hasNext */ hasNext(): Promise; hasNext(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#hint */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#hint */ hint(hint: Object): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#isClosed */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#isClosed */ isClosed(): boolean; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#limit */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#limit */ limit(value: number): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#map */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#map */ map(transform: (document: T) => U): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#max */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#max */ max(max: number): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#maxAwaitTimeMS */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#maxAwaitTimeMS */ maxAwaitTimeMS(value: number): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#maxScan */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#maxScan */ maxScan(maxScan: Object): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#maxTimeMS */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#maxTimeMS */ maxTimeMS(value: number): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#min */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#min */ min(min: number): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#next */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#next */ next(): Promise; next(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#project */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#project */ project(value: Object): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#read */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#read */ read(size: number): string | Buffer | void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#next */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#next */ returnKey(returnKey: Object): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#rewind */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#rewind */ rewind(): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#setCursorOption */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#setCursorOption */ setCursorOption(field: string, value: Object): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#setReadPreference */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#setReadPreference */ setReadPreference(readPreference: string | ReadPreference): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#showRecordId */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#showRecordId */ showRecordId(showRecordId: Object): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#skip */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#skip */ skip(value: number): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#snapshot */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#snapshot */ snapshot(snapshot: Object): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#sort */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#sort */ sort(keyOrList: string | Object[] | Object, direction?: number): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#stream */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#stream */ stream(options?: { transform?: Function }): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#toArray */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#toArray */ toArray(): Promise; toArray(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#unshift */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#unshift */ unshift(stream: Buffer | string): void; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#count */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#count */ export interface CursorCommentOptions { skip?: number; limit?: number; @@ -1307,123 +1313,123 @@ export interface CursorCommentOptions { readPreference?: ReadPreference | string; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#~iteratorCallback */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#~iteratorCallback */ export interface IteratorCallback { (doc: T): void; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#~endCallback */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#~endCallback */ export interface EndCallback { (error: MongoError): void; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#~resultCallback */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#~resultCallback */ export type AggregationCursorResult = any | void; -/** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html */ export class AggregationCursor extends Readable { - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#batchSize */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#batchSize */ batchSize(value: number): AggregationCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#clone */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#clone */ clone(): AggregationCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#close */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#close */ close(): Promise; close(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#each */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#each */ each(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#explain */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#explain */ explain(): Promise; explain(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#geoNear */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#geoNear */ geoNear(document: Object): AggregationCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#group */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#group */ group(document: Object): AggregationCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#isClosed */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#isClosed */ isClosed(): boolean; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#limit */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#limit */ limit(value: number): AggregationCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#match */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#match */ match(document: Object): AggregationCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#maxTimeMS */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#maxTimeMS */ maxTimeMS(value: number): AggregationCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#next */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#next */ next(): Promise; next(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#out */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#out */ out(destination: string): AggregationCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#project */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#project */ project(document: Object): AggregationCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#read */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#read */ read(size: number): string | Buffer | void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#redact */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#redact */ redact(document: Object): AggregationCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#rewind */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#rewind */ rewind(): AggregationCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#setEncoding */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#setEncoding */ skip(value: number): AggregationCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#sort */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#sort */ sort(document: Object): AggregationCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#toArray */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#toArray */ toArray(): Promise; toArray(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#unshift */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#unshift */ unshift(stream: Buffer | string): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/AggregationCursor.html#unwind */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/AggregationCursor.html#unwind */ unwind(field: string): AggregationCursor; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/CommandCursor.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html */ export class CommandCursor extends Readable { - /** http://mongodb.github.io/node-mongodb-native/3.0/api/CommandCursor.html#batchSize */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#batchSize */ batchSize(value: number): CommandCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/CommandCursor.html#clone */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#clone */ clone(): CommandCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/CommandCursor.html#close */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#close */ close(): Promise; close(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/CommandCursor.html#each */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#each */ each(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/CommandCursor.html#isClosed */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#isClosed */ isClosed(): boolean; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/CommandCursor.html#maxTimeMS */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#maxTimeMS */ maxTimeMS(value: number): CommandCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/CommandCursor.html#next */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#next */ next(): Promise; next(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/CommandCursor.html#read */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#read */ read(size: number): string | Buffer | void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/CommandCursor.html#rewind */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#rewind */ rewind(): CommandCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/CommandCursor.html#setReadPreference */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#setReadPreference */ setReadPreference(readPreference: string | ReadPreference): CommandCursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/CommandCursor.html#toArray */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#toArray */ toArray(): Promise; toArray(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/CommandCursor.html#unshift */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#unshift */ unshift(stream: Buffer | string): void; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucket.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucket.html */ export class GridFSBucket { constructor(db: Db, options?: GridFSBucketOptions); - /** http://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucket.html#delete */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucket.html#delete */ delete(id: ObjectID, callback?: GridFSBucketErrorCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucket.html#drop */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucket.html#drop */ drop(callback?: GridFSBucketErrorCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucket.html#find */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucket.html#find */ find(filter?: Object, options?: GridFSBucketFindOptions): Cursor; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucket.html#openDownloadStream */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucket.html#openDownloadStream */ openDownloadStream(id: ObjectID, options?: { start: number, end: number }): GridFSBucketReadStream; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucket.html#openDownloadStreamByName */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucket.html#openDownloadStreamByName */ openDownloadStreamByName(filename: string, options?: { revision: number, start: number, end: number }): GridFSBucketReadStream; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucket.html#openUploadStream */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucket.html#openUploadStream */ openUploadStream(filename: string, options?: GridFSBucketOpenUploadStreamOptions): GridFSBucketWriteStream; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucket.html#openUploadStreamWithId */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucket.html#openUploadStreamWithId */ openUploadStreamWithId(id: GridFSBucketWriteStreamId, filename: string, options?: GridFSBucketOpenUploadStreamOptions): GridFSBucketWriteStream; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucket.html#rename */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucket.html#rename */ rename(id: ObjectID, filename: string, callback?: GridFSBucketErrorCallback): void; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucket.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucket.html */ export interface GridFSBucketOptions { bucketName?: string; chunkSizeBytes?: number; @@ -1431,12 +1437,12 @@ export interface GridFSBucketOptions { ReadPreference?: Object; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucket.html#~errorCallback */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucket.html#~errorCallback */ export interface GridFSBucketErrorCallback { (err?: MongoError): void; } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucket.html#find */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucket.html#find */ export interface GridFSBucketFindOptions { batchSize?: number; limit?: number; @@ -1446,7 +1452,7 @@ export interface GridFSBucketFindOptions { sort?: Object; } -/** https://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucket.html#openUploadStream */ +/** https://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucket.html#openUploadStream */ export interface GridFSBucketOpenUploadStreamOptions { chunkSizeBytes?: number, metadata?: Object, @@ -1454,13 +1460,13 @@ export interface GridFSBucketOpenUploadStreamOptions { aliases?: Array } -/** https://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucketReadStream.html */ +/** https://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucketReadStream.html */ export class GridFSBucketReadStream extends Readable { id: ObjectID; constructor(chunks: Collection, files: Collection, readPreference: Object, filter: Object, options?: GridFSBucketReadStreamOptions); } -/** https://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucketReadStream.html */ +/** https://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucketReadStream.html */ export interface GridFSBucketReadStreamOptions { sort?: number, skip?: number, @@ -1468,13 +1474,13 @@ export interface GridFSBucketReadStreamOptions { end?: number } -/** https://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucketWriteStream.html */ +/** https://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucketWriteStream.html */ export class GridFSBucketWriteStream extends Writable { id: GridFSBucketWriteStreamId; constructor(bucket: GridFSBucket, filename: string, options?: GridFSBucketWriteStreamOptions); } -/** https://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucketWriteStream.html */ +/** https://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucketWriteStream.html */ export interface GridFSBucketWriteStreamOptions { id?: GridFSBucketWriteStreamId, chunkSizeBytes?: number, @@ -1483,26 +1489,26 @@ export interface GridFSBucketWriteStreamOptions { j?: number } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/ChangeStream.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html */ export class ChangeStream extends Readable { constructor(changeDomain: Db | Collection, pipeline: Object[], options?: ChangeStreamOptions); - /** http://mongodb.github.io/node-mongodb-native/3.0/api/ChangeStream.html#close */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#close */ close(): Promise; close(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/ChangeStream.html#hasNext */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#hasNext */ hasNext(): Promise; hasNext(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/ChangeStream.html#isClosed */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#isClosed */ isClosed(): boolean; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/ChangeStream.html#next */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#next */ next(): Promise; next(callback: MongoCallback): void; - /** http://mongodb.github.io/node-mongodb-native/3.0/api/ChangeStream.html#stream */ + /** http://mongodb.github.io/node-mongodb-native/3.1/api/ChangeStream.html#stream */ stream(options?: { transform: Function }): Cursor; } @@ -1532,7 +1538,7 @@ export interface LoggerState { date: number } -/** http://mongodb.github.io/node-mongodb-native/3.0/api/Logger.html */ +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Logger.html */ export class Logger { constructor(className: string, options?: LoggerOptions) // Log a message at the debug level diff --git a/types/mongodb/mongodb-tests.ts b/types/mongodb/mongodb-tests.ts index a5a27bd671..0657b2e741 100644 --- a/types/mongodb/mongodb-tests.ts +++ b/types/mongodb/mongodb-tests.ts @@ -27,7 +27,8 @@ let options: mongodb.MongoClientOptions = { sslCert: new Buffer(999), sslKey: new Buffer(999), sslPass: new Buffer(999), - promoteBuffers: false + promoteBuffers: false, + useNewUrlParser: false } MongoClient.connect('mongodb://127.0.0.1:27017/test', options, function (err: mongodb.MongoError, client: mongodb.MongoClient) { if (err) throw err; @@ -121,6 +122,31 @@ MongoClient.connect('mongodb://127.0.0.1:27017/test', options, function (err: mo let payment: { total: number }; type payment = typeof payment; let cursor: mongodb.AggregationCursor = collection.aggregate([{}]) + + collection.aggregate([{ $match: { bar: 1 } }, { $limit: 10 }]) + collection.aggregate([{ $match: { bar: 1 } }]).limit(10) + collection.aggregate([]).match({ bar: 1 }).limit(10) + collection.aggregate().match({ bar: 1 }).limit(10) + + collection.aggregate( + [{ $match: { bar: 1 } }], + function (err: mongodb.MongoError, cursor: mongodb.AggregationCursor) { + cursor.limit(10) + } + ) + + collection.aggregate( + [], + function (err: mongodb.MongoError, cursor: mongodb.AggregationCursor) { + cursor.match({ bar: 1 }).limit(10) + } + ) + + collection.aggregate( + function (err: mongodb.MongoError, cursor: mongodb.AggregationCursor) { + cursor.match({ bar: 1 }).limit(10) + } + ) } // test for new typings diff --git a/types/mssql/index.d.ts b/types/mssql/index.d.ts index 272abb5e39..109a515515 100644 --- a/types/mssql/index.d.ts +++ b/types/mssql/index.d.ts @@ -1,6 +1,12 @@ // Type definitions for mssql 4.0.5 // Project: https://www.npmjs.com/package/mssql -// Definitions by: COLSA Corporation , Ben Farr , Vitor Buzinaro , Matt Richardson , Jørgen Elgaard Larsen , Peter Keuter +// Definitions by: COLSA Corporation +// Ben Farr +// Vitor Buzinaro +// Matt Richardson +// Jørgen Elgaard Larsen +// Peter Keuter +// David Gasperoni // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -311,8 +317,10 @@ export declare class PreparedStatement extends events.EventEmitter { public output(name: string, type: (() => ISqlType) | ISqlType): PreparedStatement; public prepare(statement?: string): Promise; public prepare(statement?: string, callback?: (err?: Error) => void): PreparedStatement; - public execute(values: Object): Promise; - public execute(values: Object, callback: (err?: Error) => void): Request; + public execute(values: Object): Promise>; + public execute(values: Object): Promise>; + public execute(values: Object, callback: (err?: Error, result?: IProcedureResult) => void): Request; + public execute(values: Object, callback: (err?: Error, result?: IProcedureResult) => void): Request; public unprepare(): Promise; public unprepare(callback: (err?: Error) => void): PreparedStatement; } diff --git a/types/next/document.d.ts b/types/next/document.d.ts index 0955877d61..0b21fb53c8 100644 --- a/types/next/document.d.ts +++ b/types/next/document.d.ts @@ -42,13 +42,21 @@ export interface DocumentProps { head?: Array>; errorHtml?: string; styles?: Array>; - [key: string]: any; } -export class Head extends React.Component {} +export interface HeadProps { + nonce?: string; + [key: string]: any; +} + +export interface NextScriptProps { + nonce?: string; +} + +export class Head extends React.Component {} export class Main extends React.Component {} -export class NextScript extends React.Component {} +export class NextScript extends React.Component {} export default class extends React.Component { static getInitialProps(ctx: NextDocumentContext): Promise | DocumentProps; } diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 27ffa974fd..904209dd2d 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -5,6 +5,7 @@ // James Hegedus // Resi Respati // Scott Jones +// Joao Vieira // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 diff --git a/types/next/test/next-document-tests.tsx b/types/next/test/next-document-tests.tsx index f727262b0e..40f01adfef 100644 --- a/types/next/test/next-document-tests.tsx +++ b/types/next/test/next-document-tests.tsx @@ -11,6 +11,13 @@ const basicResults = ( ); +const withNonce = ( + + + + +); + class MyDoc extends Document { static async getInitialProps({ renderPage }: NextDocumentContext) { // without callback diff --git a/types/nock/index.d.ts b/types/nock/index.d.ts index 90eae08189..afebacf1e5 100644 --- a/types/nock/index.d.ts +++ b/types/nock/index.d.ts @@ -1,17 +1,20 @@ -// Type definitions for nock v9.1.3 +// Type definitions for nock v9.3.3 // Project: https://github.com/node-nock/nock // Definitions by: bonnici // Horiuchi_H // afharo // Matt R. Wilson // Garanzha Dmitriy +// GP // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// +import { Url } from 'url'; + export = nock; -declare function nock(basePath: string | RegExp, options?: nock.Options): nock.Scope; +declare function nock(basePath: string | RegExp | Url, options?: nock.Options): nock.Scope; declare namespace nock { export function cleanAll(): void; diff --git a/types/nock/nock-tests.ts b/types/nock/nock-tests.ts index 7ed4ecc25d..06f8458bcb 100644 --- a/types/nock/nock-tests.ts +++ b/types/nock/nock-tests.ts @@ -1,5 +1,6 @@ import nock = require('nock'); import * as fs from 'fs'; +import { URL } from 'url'; var scope: nock.Scope; var inst: nock.Interceptor; @@ -144,6 +145,11 @@ var couchdb = nock('http://myapp.iriscouch.com') email: 'pedro.teixeira@gmail.com' }); +// Using URL as input +var scope = nock(new URL('https://example.org/')) + .get('/resource') + .reply(200, 'url matched'); + // Specifying hostname var scope = nock('http://www.example.com') .get('/resource') diff --git a/types/node/index.d.ts b/types/node/index.d.ts index f7699a7361..1ee69fa60e 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -5894,10 +5894,10 @@ declare module "crypto" { export function pseudoRandomBytes(size: number): Buffer; export function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; - export function randomFillSync(buffer: ArrayBufferView, offset?: number, size?: number): ArrayBufferView; - export function randomFill(buffer: ArrayBufferView, callback: (err: Error | null, buf: ArrayBufferView) => void): void; - export function randomFill(buffer: ArrayBufferView, offset: number, callback: (err: Error | null, buf: ArrayBufferView) => void): void; - export function randomFill(buffer: ArrayBufferView, offset: number, size: number, callback: (err: Error | null, buf: ArrayBufferView) => void): void; + export function randomFillSync(buffer: T, offset?: number, size?: number): T; + export function randomFill(buffer: T, callback: (err: Error | null, buf: T) => void): void; + export function randomFill(buffer: T, offset: number, callback: (err: Error | null, buf: T) => void): void; + export function randomFill(buffer: T, offset: number, size: number, callback: (err: Error | null, buf: T) => void): void; export interface ScryptOptions { N?: number; diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index e3ba81475e..9c8014cc6d 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -2460,54 +2460,29 @@ declare namespace Office { * * The following application-specific actions apply when writing data to a selection. * - * - Word + * + * + * + * + * + * + * + * * - * - If there is no selection and the insertion point is at a valid location, the specified `data` is inserted at the insertion point as follows: + * + * + * + * + * + * + * * - * - If `data` is a string, the specified text is inserted. + * + * * - * - If `data` is an array of arrays ("matrix") or a TableData object, a new Word table is inserted. + * + *
WordIf there is no selection and the insertion point is at a valid location, the specified `data` is inserted at the insertion pointIf `data` is a string, the specified text is inserted.
If `data` is an array of arrays ("matrix") or a TableData object, a new Word table is inserted.
If `data` is HTML, the specified HTML is inserted. (Important: If any of the HTML you insert is invalid, Word won't raise an error. Word will insert as much of the HTML as it can and omits any invalid data).
If `data` is Office Open XML, the specified XML is inserted.
If `data` is a base64 encoded image stream, the specified image is inserted.
If there is a selectionIt will be replaced with the specified `data` following the same rules as above.
Insert imagesInserted images are placed inline. The imageLeft and imageTop parameters are ignored. The image aspect ratio is always locked. If only one of the imageWidth and imageHeight parameter is given, the other value will be automatically scaled to keep the original aspect ratio.
ExcelIf a single cell is selectedIf `data` is a string, the specified text is inserted as the value of the current cell.
If `data` is an array of arrays ("matrix"), the specified set of rows and columns are inserted, if no other data in surrounding cells will be overwritten.
If `data` is a TableData object, a new Excel table with the specified set of rows and headers is inserted, if no other data in surrounding cells will be overwritten.
If multiple cells are selectedIf the shape does not match the shape of `data`, an error is returned.
If the shape of the selection exactly matches the shape of `data`, the values of the selected cells are updated based on the values in `data`.
Insert imagesInserted images are floating. The position imageLeft and imageTop parameters are relative to currently selected cell(s). Negative imageLeft and imageTop values are allowed and possibly readjusted by Excel to position the image inside a worksheet. Image aspect ratio is locked unless both imageWidth and imageHeight parameters are provided. If only one of the imageWidth and imageHeight parameter is given, the other value will be automatically scaled to keep the original aspect ratio.
All other casesAn error is returned.
Excel OnlineIn addition to the behaviors described for Excel above, these limits apply when writing data in Excel OnlineThe total number of cells you can write to a worksheet with the `data` parameter can't exceed 20,000 in a single call to this method.
The number of formatting groups passed to the `cellFormat` parameter can't exceed 100. A single formatting group consists of a set of formatting applied to a specified range of cells.
PowerPointInsert imageInserted images are floating. The position imageLeft and imageTop parameters are optional but if provided, both should be present. If a single value is provided, it will be ignored. Negative imageLeft and imageTop values are allowed and can position an image outside of a slide. If no optional parameter is given and slide has a placeholder, the image will replace the placeholder in the slide. Image aspect ratio will be locked unless both imageWidth and imageHeight parameters are provided. If only one of the imageWidth and imageHeight parameter is given, the other value will be automatically scaled to keep the original aspect ratio.
* - * - If `data` is HTML, the specified HTML is inserted. (Important: If any of the HTML you insert is invalid, Word won't raise an error. Word will insert as much of the HTML as it can and omits any invalid data). - * - * - If `data` is Office Open XML, the specified XML is inserted. - * - * - If `data` is a base64 encoded image stream, the specified image is inserted. - * - * - If there is a selection, it will be replaced with the specified `data` following the same rules as above. - * - * - Insert images: Inserted images are placed inline. The imageLeft and imageTop parameters are ignored. The image aspect ratio is always locked. If only one of the imageWidth and imageHeight parameter is given, the other value will be automatically scaled to keep the original aspect ratio. - * - * - Excel - * - * - If a single cell is selected: - * - * - If `data` is a string, the specified text is inserted as the value of the current cell. - * - * - If `data` is an array of arrays ("matrix"), the specified set of rows and columns are inserted, if no other data in surrounding cells will be overwritten. - * - * - If `data` is a TableData object, a new Excel table with the specified set of rows and headers is inserted, if no other data in surrounding cells will be overwritten. - * - * - If multiple cells are selected and the shape does not match the shape of `data`, an error is returned. - * - * - If multiple cells are selected and the shape of the selection exactly matches the shape of `data`, the values of the selected cells are updated based on the values in `data`. - * - * - Insert images: Inserted images are floating. The position imageLeft and imageTop parameters are relative to currently selected cell(s). Negative imageLeft and imageTop values are allowed and possibly readjusted by Excel to position the image inside a worksheet. Image aspect ratio is locked unless both imageWidth and imageHeight parameters are provided. If only one of the imageWidth and imageHeight parameter is given, the other value will be automatically scaled to keep the original aspect ratio. - * - * - In all other cases, an error is returned. - * - * - Excel Online - * - * - In addition to the behaviors described for Excel above, the following limits apply when writing data in Excel Online. - * - * - The total number of cells you can write to a worksheet with the `data` parameter can't exceed 20,000 in a single call to this method. - * - * - The number of formatting groups passed to the `cellFormat` parameter can't exceed 100. A single formatting group consists of a set of formatting applied to a specified range of cells. - * - * - PowerPoint - * - * - Inserted images are floating. The position imageLeft and imageTop parameters are optional but if provided, both should be present. If a single value is provided, it will be ignored. Negative imageLeft and imageTop values are allowed and can position an image outside of a slide. If no optional parameter is given and slide has a placeholder, the image will replace the placeholder in the slide. Image aspect ratio will be locked unless both imageWidth and imageHeight parameters are provided. If only one of the imageWidth and imageHeight parameter is given, the other value will be automatically scaled to keep the original aspect ratio. - * * @param data The data to be set. Either a string or {@link Office.CoercionType} value, 2d array or TableData object. * * The possible CoercionTypes that can be used for the data parameter, or for the coercionType option, vary by host: @@ -3173,9 +3148,9 @@ declare namespace Office { * * * Office.Table.Headers - * + * Specifies only the header row. * - * + *
* * The `format:` property specifies values that correspond to a subset of the settings available in the Format Cells dialog box in Excel (Right-click > Format Cells or Home > Format > Format Cells). * @@ -6390,6 +6365,160 @@ declare namespace Office { */ Subject } + /** + * The AppointmentForm namespace is used to access the currently selected appointment. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}Restricted
Applicable Outlook modeCompose or read
+ */ + interface AppointmentForm { + /** + * Gets an object that provides methods for manipulating the body of an item. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeCompose or read
+ */ + body: string; + /** + * Gets or sets the date and time that the appointment is to end. + * + * The end property is expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the end property value to the client's local date and time. + * + * *Read mode* + * + * The end property returns a Date object. + * + * *Compose mode* + * + * The end property returns a Time object. + * + * When you use the Time.setAsync method to set the end time, you should use the convertToUtcClientTime method to convert the local time on the client to UTC for the server. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeCompose or read
+ */ + end: Date; + /** + * Gets or sets the location of an appointment. + * + * *Read mode* + * + * The location property returns a string that contains the location of the appointment. + * + * *Compose mode* + * + * The location property returns a Location object that provides methods that are used to get and set the location of the appointment. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeCompose or read
+ */ + location: string; + /** + * Provides access to the optional attendees of an event. The type of object and level of access depends on the mode of the current item. + * + * *Read mode* + * + * The optionalAttendees property returns an array that contains an EmailAddressDetails object for each optional attendee to the meeting. + * + * *Compose mode* + * + * The optionalAttendees property returns a Recipients object that provides methods to get or update the optional attendees for a meeting. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeCompose or read
+ */ + optionalAttendees: string[] | EmailAddressDetails[]; + resources: string[]; + /** + * Provides access to the required attendees of an event. The type of object and level of access depends on the mode of the current item. + * + * *Read mode* + * + * The requiredAttendees property returns an array that contains an EmailAddressDetails object for each required attendee to the meeting. + * + * *Compose mode* + * + * The requiredAttendees property returns a Recipients object that provides methods to get or update the required attendees for a meeting. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeCompose or read
+ */ + requiredAttendees: string[] | EmailAddressDetails[]; + /** + * Gets or sets the date and time that the appointment is to begin. + * + * The start property is expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the value to the client's local date and time. + * + * *Read mode* + * + * The start property returns a Date object. + * + * *Compose mode* + * + * The start property returns a Time object. + * + * When you use the Time.setAsync method to set the start time, you should use the convertToUtcClientTime method to convert the local time on the client to UTC for the server. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeCompose or read
+ */ + start: Date; + /** + * Gets or sets the description that appears in the subject field of an item. + * + * The subject property gets or sets the entire subject of the item, as sent by the email server. + * + * *Read mode* + * + * The subject property returns a string. Use the normalizedSubject property to get the subject minus any leading prefixes such as RE: and FW:. + * + * *Compose mode* + * + * The subject property returns a Subject object that provides methods to get and set the subject. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeCompose or read
+ */ + subject: string; + } /** * Represents an attachment on an item from the server. Read mode only. * @@ -7117,77 +7246,6 @@ declare namespace Office { * Important: This is an internal Outlook object, not directly exposed through existing interfaces. You should treat this as a mode of `Office.context.mailbox.item`. Refer to the Object Model pages for more information. */ interface AppointmentCompose extends Appointment, ItemCompose { - /** - * Gets or sets the date and time that the appointment is to end. - * - * The end property is an {@link Office.Time} object expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the end property value to the client's local date and time. - * - * When you use the Time.setAsync method to set the end time, you should use the convertToUtcClientTime method to convert the local time on the client to UTC for the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Organizer
- */ - end: Time; - /** - * Gets or sets the {@link Office.Location} of an appointment. The location property returns a Location object that provides methods that are used to get and set the location of the appointment. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Organizer
- */ - location: Location; - /** - * Provides access to the optional attendees of an event. The type of object and level of access depends on the mode of the current item. The optionalAttendees property returns an {@link Office.Recipients} object that provides methods to get or update the optional attendees for a meeting. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Organizer
- */ - optionalAttendees: Recipients; - /** - * Provides access to the required attendees of an event. The type of object and level of access depends on the mode of the current item. The requiredAttendees property returns an {@link Office.Recipients} object that provides methods to get or update the required attendees for a meeting. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Organizer
- */ - requiredAttendees: Recipients; - /** - * Gets or sets the date and time that the appointment is to begin. - * - * The start property is an {@link Office.Time} object expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the value to the client's local date and time. - * - * When you use the Time.setAsync method to set the start time, you should use the convertToUtcClientTime method to convert the local time on the client to UTC for the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Organizer
- */ - start: Time; - - // Repeated Item fields // - /** * Gets an object that provides methods for manipulating the body of an item. * @@ -7226,6 +7284,22 @@ declare namespace Office { * Note: This member is not supported in Outlook for iOS or Outlook for Android. */ dateTimeModifed: Date; + /** + * Gets or sets the date and time that the appointment is to end. + * + * The end property is an {@link Office.Time} object expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the end property value to the client's local date and time. + * + * When you use the Time.setAsync method to set the end time, you should use the convertToUtcClientTime method to convert the local time on the client to UTC for the server. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Organizer
+ */ + end: Time; /** * Gets the type of item that an instance represents. * @@ -7240,6 +7314,18 @@ declare namespace Office { * Applicable Outlook modeAppointment Organizer */ itemType: Office.MailboxEnums.ItemType; + /** + * Gets or sets the {@link Office.Location} of an appointment. The location property returns a Location object that provides methods that are used to get and set the location of the appointment. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Organizer
+ */ + location: Location; /** * Gets the notification messages for an item. * @@ -7252,7 +7338,18 @@ declare namespace Office { * Applicable Outlook modeAppointment Organizer */ notificationMessages: Office.NotificationMessages; - + /** + * Provides access to the optional attendees of an event. The type of object and level of access depends on the mode of the current item. The optionalAttendees property returns an {@link Office.Recipients} object that provides methods to get or update the optional attendees for a meeting. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Organizer
+ */ + optionalAttendees: Recipients; /** * Gets or sets the recurrence pattern of an appointment. * @@ -7272,8 +7369,19 @@ declare namespace Office { * * @beta */ - recurrence: Office.Recurrence; - + recurrence: Recurrence; + /** + * Provides access to the required attendees of an event. The type of object and level of access depends on the mode of the current item. The requiredAttendees property returns an {@link Office.Recipients} object that provides methods to get or update the required attendees for a meeting. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Organizer
+ */ + requiredAttendees: Recipients; /** * Gets the id of the series that an instance belongs to. * @@ -7294,124 +7402,23 @@ declare namespace Office { * @beta */ seriesId: string; - /** - * Adds an event handler for a supported event. - * - * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. - * - * [Api set: Mailbox Preview] + * Gets or sets the date and time that the appointment is to begin. * - * @remarks - * - * + * The start property is an {@link Office.Time} object expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the value to the client's local date and time. * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Organizer
- * - * In addition to this signature, the method also has the following signature: - * - * `addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void;` - * - * @param eventType The event that should invoke the handler. - * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - * @param options Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. - * - * @beta - */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; - - /** - * Adds an event handler for a supported event. - * - * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. - * - * [Api set: Mailbox Preview] + * When you use the Time.setAsync method to set the start time, you should use the convertToUtcClientTime method to convert the local time on the client to UTC for the server. + * + * [Api set: Mailbox 1.0] * * @remarks * * * *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Organizer
- * - * @param eventType The event that should invoke the handler. - * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. - * - * @beta */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void; - - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Organizer
- * - * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. - * @param userContext Optional. Developers can provide any object they wish to access in the callback function. This object can be accessed by the asyncResult.asyncContext property in the callback function. - */ - loadCustomPropertiesAsync(callback: (result: AsyncResult) => void, userContext?: any): void; - - /** - * Removes an event handler for a supported event. - * - * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Organizer
- * - * In addition to this signature, the method also has the following signature: - * - * `removeHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void;` - * - * @param eventType The event that should invoke the handler. - * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. - * @param options Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. - * - * @beta - */ - removeHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; - - /** - * Removes an event handler for a supported event. - * - * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Organizer
- * - * @param eventType The event that should invoke the handler. - * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. - * - * @beta - */ - removeHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void; - - /** + start: Time; + /** * Gets or sets the description that appears in the subject field of an item. * * The subject property gets or sets the entire subject of the item, as sent by the email server. @@ -7523,7 +7530,52 @@ declare namespace Office { * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type asyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: AsyncResult) => void): void; - + /** + * Adds an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Organizer
+ * + * In addition to this signature, the method also has the following signature: + * + * `addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;` + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * + * @beta + */ + addHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + /** + * Adds an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Organizer
+ * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * + * @beta + */ + addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -7626,7 +7678,6 @@ declare namespace Office { * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: AsyncResult) => void): void; - /** * Closes the current item that is being composed * @@ -7713,6 +7764,25 @@ declare namespace Office { * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. */ getSelectedDataAsync(coerciontype: Office.CoercionType, callback: (result: AsyncResult) => void): void; + /** + * Asynchronously loads custom properties for this add-in on the selected item. + * + * Custom properties are stored as key/value pairs on a per-app, per-item basis. This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. + * + * The custom properties are provided as a CustomProperties object in the asyncResult.value property. This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to the server. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Organizer
+ * + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param userContext Optional. Developers can provide any object they wish to access in the callback function. This object can be accessed by the asyncResult.asyncContext property in the callback function. + */ + loadCustomPropertiesAsync(callback: (result: AsyncResult) => void, userContext?: any): void; /** * Removes an attachment from a message or appointment. * @@ -7799,7 +7869,52 @@ declare namespace Office { * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ removeAttachmentAsync(attachmentIndex: string, callback: (result: AsyncResult) => void): void; - + /** + * Removes an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Organizer
+ * + * In addition to this signature, the method also has the following signature: + * + * `removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;` + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * + * @beta + */ + removeHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + /** + * Removes an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Organizer
+ * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * + * @beta + */ + removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -8011,6 +8126,7 @@ declare namespace Office { */ setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void; } + /** * The appointment attendee mode of {@link Office.Item | Office.context.mailbox.item}. * @@ -8018,93 +8134,21 @@ declare namespace Office { */ interface AppointmentRead extends Appointment, ItemRead { /** - * Gets the date and time that the appointment is to end. - * - * The end property is a Date object expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the end property value to the client's local date and time. - * - * When you use the Time.setAsync method to set the end time, you should use the convertToUtcClientTime method to convert the local time on the client to UTC for the server. + * Gets an array of attachments for the item. * * [Api set: Mailbox 1.0] * * @remarks - * + * * * *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
+ * + * Note: Certain types of files are blocked by Outlook due to potential security issues and are therefore not returned. For more information, see {@link https://support.office.com/article/Blocked-attachments-in-Outlook-434752E1-02D3-4E90-9124-8B81E49A8519 | Blocked attachments in Outlook}. + * */ - end: Date; + attachments: Office.AttachmentDetails[]; /** - * Gets the location of an appointment. - * - * The location property returns a string that contains the location of the appointment. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
- */ - location: string; - /** - * Provides access to the optional attendees of an event. The type of object and level of access depends on the mode of the current item. - * - * The optionalAttendees property returns an array that contains an {@link Office.EmailAddressDetails} object for each optional attendee to the meeting. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
- */ - optionalAttendees: EmailAddressDetails[]; - /** - * Gets the email address of the meeting organizer for a specified meeting. Read mode only. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
- */ - organizer: EmailAddressDetails; - /** - * Provides access to the required attendees of an event. The type of object and level of access depends on the mode of the current item. - * - * The requiredAttendees property returns an array that contains an {@link Office.EmailAddressDetails} object for each required attendee to the meeting. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
- */ - requiredAttendees: EmailAddressDetails[]; - /** - * Gets the date and time that the appointment is to begin. - * - * The start property is a Date object expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the value to the client's local date and time. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
- */ - start: Date; - - // Repeated Item Fields // - - /** * Gets an object that provides methods for manipulating the body of an item. * * [Api set: Mailbox 1.1] @@ -8142,6 +8186,74 @@ declare namespace Office { * Note: This member is not supported in Outlook for iOS or Outlook for Android. */ dateTimeModifed: Date; + /** + * Gets the date and time that the appointment is to end. + * + * The end property is a Date object expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the end property value to the client's local date and time. + * + * When you use the Time.setAsync method to set the end time, you should use the convertToUtcClientTime method to convert the local time on the client to UTC for the server. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
+ */ + end: Date; + /** + * Gets the Exchange Web Services item class of the selected item. + * + * + * You can create custom message classes that extends a default message class, for example, a custom appointment message class IPM.Appointment.Contoso. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
+ * + * The itemClass property specifies the message class of the selected item. The following are the default message classes for the message or appointment item. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
TypeDescriptionItem Class
Appointment itemsThese are calendar items of the item class IPM.Appointment or IPM.Appointment.Occurence.IPM.Appointment,IPM.Appointment.Occurence
Message itemsThese include email messages that have the default message class IPM.Note, and meeting requests, responses, and cancellations, that use IPM.Schedule.Meeting as the base message class.IPM.Note,IPM.Schedule.Meeting.Request,IPM.Schedule.Meeting.Neg,IPM.Schedule.Meeting.Pos,IPM.Schedule.Meeting.Tent,IPM.Schedule.Meeting.Canceled
+ * + */ + itemClass: string; + /** + * Gets the Exchange Web Services item identifier for the current item. + * + * The itemId property is not available in compose mode. If an item identifier is required, the saveAsync method can be used to save the item to the store, which will return the item identifier in the AsyncResult.value parameter in the callback function. + * + * Note: The identifier returned by the itemId property is the same as the Exchange Web Services item identifier. The itemId property is not identical to the Outlook Entry ID or the ID used by the Outlook REST API. Before making REST API calls using this value, it should be converted using Office.context.mailbox.convertToRestId. For more details, see Use the Outlook REST APIs from an Outlook add-in. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
+ */ + itemId: string; /** * Gets the type of item that an instance represents. * @@ -8156,6 +8268,34 @@ declare namespace Office { * Applicable Outlook modeAppointment Attendee */ itemType: Office.MailboxEnums.ItemType; + /** + * Gets the location of an appointment. + * + * The location property returns a string that contains the location of the appointment. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
+ */ + location: string; + /** + * Gets the subject of an item, with all prefixes removed (including RE: and FWD:). + * + * The normalizedSubject property gets the subject of the item, with any standard prefixes (such as RE: and FW:) that are added by email programs. To get the subject of the item with the prefixes intact, use the subject property. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
+ */ + normalizedSubject: string; /** * Gets the notification messages for an item. * @@ -8168,7 +8308,32 @@ declare namespace Office { * Applicable Outlook modeAppointment Attendee */ notificationMessages: Office.NotificationMessages; - + /** + * Provides access to the optional attendees of an event. The type of object and level of access depends on the mode of the current item. + * + * The optionalAttendees property returns an array that contains an {@link Office.EmailAddressDetails} object for each optional attendee to the meeting. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
+ */ + optionalAttendees: EmailAddressDetails[]; + /** + * Gets the email address of the meeting organizer for a specified meeting. Read mode only. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
+ */ + organizer: EmailAddressDetails; /** * Gets the recurrence pattern of an appointment. Gets the recurrence pattern of a meeting request. * @@ -8188,8 +8353,35 @@ declare namespace Office { * * @beta */ - recurrence: Office.Recurrence; - + recurrence: Recurrence; + /** + * Provides access to the required attendees of an event. The type of object and level of access depends on the mode of the current item. + * + * The requiredAttendees property returns an array that contains an {@link Office.EmailAddressDetails} object for each required attendee to the meeting. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
+ */ + requiredAttendees: EmailAddressDetails[]; + /** + * Gets the date and time that the appointment is to begin. + * + * The start property is a Date object expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the value to the client's local date and time. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
+ */ + start: Date; /** * Gets the id of the series that an instance belongs to. * @@ -8210,6 +8402,22 @@ declare namespace Office { * @beta */ seriesId: string; + /** + * Gets the description that appears in the subject field of an item. + * + * The subject property gets or sets the entire subject of the item, as sent by the email server. + * + * The subject property returns a string. Use the normalizedSubject property to get the subject minus any leading prefixes such as RE: and FW:. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
+ */ + subject: string; /** * Adds an event handler for a supported event. @@ -8257,174 +8465,7 @@ declare namespace Office { * * @beta */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void; - - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
- * - * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. - * @param userContext Optional. Developers can provide any object they wish to access in the callback function. This object can be accessed by the asyncResult.asyncContext property in the callback function. - */ - loadCustomPropertiesAsync(callback: (result: AsyncResult) => void, userContext?: any): void; - - /** - * Removes an event handler for a supported event. - * - * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
- * - * In addition to this signature, the method also has the following signature: - * - * `removeHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void;` - * - * @param eventType The event that should invoke the handler. - * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. - * @param options Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. - * - * @beta - */ - removeHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; - - /** - * Removes an event handler for a supported event. - * - * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
- * - * @param eventType The event that should invoke the handler. - * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. - * - * @beta - */ - removeHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void; - - /** - * Gets an array of attachments for the item. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
- * - * Note: Certain types of files are blocked by Outlook due to potential security issues and are therefore not returned. For more information, see {@link https://support.office.com/article/Blocked-attachments-in-Outlook-434752E1-02D3-4E90-9124-8B81E49A8519 | Blocked attachments in Outlook}. - * - */ - attachments: AttachmentDetails[]; - /** - * Gets the Exchange Web Services item class of the selected item. - * - * - * You can create custom message classes that extends a default message class, for example, a custom appointment message class IPM.Appointment.Contoso. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
- * - * The itemClass property specifies the message class of the selected item. The following are the default message classes for the message or appointment item. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
TypeDescriptionItem Class
Appointment itemsThese are calendar items of the item class IPM.Appointment or IPM.Appointment.Occurence.IPM.Appointment,IPM.Appointment.Occurence
Message itemsThese include email messages that have the default message class IPM.Note, and meeting requests, responses, and cancellations, that use IPM.Schedule.Meeting as the base message class.IPM.Note,IPM.Schedule.Meeting.Request,IPM.Schedule.Meeting.Neg,IPM.Schedule.Meeting.Pos,IPM.Schedule.Meeting.Tent,IPM.Schedule.Meeting.Canceled
- * - */ - itemClass: string; - - /** - * Gets the Exchange Web Services item identifier for the current item. - * - * The itemId property is not available in compose mode. If an item identifier is required, the saveAsync method can be used to save the item to the store, which will return the item identifier in the AsyncResult.value parameter in the callback function. - * - * Note: The identifier returned by the itemId property is the same as the Exchange Web Services item identifier. The itemId property is not identical to the Outlook Entry ID or the ID used by the Outlook REST API. Before making REST API calls using this value, it should be converted using Office.context.mailbox.convertToRestId. For more details, see Use the Outlook REST APIs from an Outlook add-in. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
- */ - itemId: string; - /** - * Gets the subject of an item, with all prefixes removed (including RE: and FWD:). - * - * The normalizedSubject property gets the subject of the item, with any standard prefixes (such as RE: and FW:) that are added by email programs. To get the subject of the item with the prefixes intact, use the subject property. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
- */ - normalizedSubject: string; - /** - * Gets the description that appears in the subject field of an item. - * - * The subject property gets or sets the entire subject of the item, as sent by the email server. - * - * The subject property returns a string. Use the normalizedSubject property to get the subject minus any leading prefixes such as RE: and FW:. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
- */ - subject: string; + addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; /** * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the selected appointment. * @@ -8691,161 +8732,72 @@ declare namespace Office { * Applicable Outlook modeAppointment Attendee */ getSelectedRegExMatches(): any; - } + /** + * Asynchronously loads custom properties for this add-in on the selected item. + * + * Custom properties are stored as key/value pairs on a per-app, per-item basis. This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. + * + * The custom properties are provided as a CustomProperties object in the asyncResult.value property. This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to the server. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
+ * + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param userContext Optional. Developers can provide any object they wish to access in the callback function. This object can be accessed by the asyncResult.asyncContext property in the callback function. + */ + loadCustomPropertiesAsync(callback: (result: AsyncResult) => void, userContext?: any): void; - /** - * The AppointmentForm namespace is used to access the currently selected appointment. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}Restricted
Applicable Outlook modeCompose or read
- */ - interface AppointmentForm { - /** - * Gets an object that provides methods for manipulating the body of an item. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeCompose or read
- */ - body: string; - /** - * Gets or sets the date and time that the appointment is to end. - * - * The end property is expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the end property value to the client's local date and time. - * - * *Read mode* - * - * The end property returns a Date object. - * - * *Compose mode* - * - * The end property returns a Time object. - * - * When you use the Time.setAsync method to set the end time, you should use the convertToUtcClientTime method to convert the local time on the client to UTC for the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeCompose or read
- */ - end: Date; - /** - * Gets or sets the location of an appointment. - * - * *Read mode* - * - * The location property returns a string that contains the location of the appointment. - * - * *Compose mode* - * - * The location property returns a Location object that provides methods that are used to get and set the location of the appointment. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeCompose or read
- */ - location: string; - /** - * Provides access to the optional attendees of an event. The type of object and level of access depends on the mode of the current item. - * - * *Read mode* - * - * The optionalAttendees property returns an array that contains an EmailAddressDetails object for each optional attendee to the meeting. - * - * *Compose mode* - * - * The optionalAttendees property returns a Recipients object that provides methods to get or update the optional attendees for a meeting. - * - * [Api set: Mailbox 1.0] + /** + * Removes an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] * * @remarks * * * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeCompose or read
+ * Applicable Outlook modeAppointment Attendee + * + * In addition to this signature, the method also has the following signature: + * + * `removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;` + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * + * @beta */ - optionalAttendees: string[] | EmailAddressDetails[]; - resources: string[]; - /** - * Provides access to the required attendees of an event. The type of object and level of access depends on the mode of the current item. - * - * *Read mode* - * - * The requiredAttendees property returns an array that contains an EmailAddressDetails object for each required attendee to the meeting. - * - * *Compose mode* - * - * The requiredAttendees property returns a Recipients object that provides methods to get or update the required attendees for a meeting. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeCompose or read
- */ - requiredAttendees: string[] | EmailAddressDetails[]; - /** - * Gets or sets the date and time that the appointment is to begin. - * - * The start property is expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the value to the client's local date and time. - * - * *Read mode* - * - * The start property returns a Date object. - * - * *Compose mode* - * - * The start property returns a Time object. - * - * When you use the Time.setAsync method to set the start time, you should use the convertToUtcClientTime method to convert the local time on the client to UTC for the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeCompose or read
- */ - start: Date; - /** - * Gets or sets the description that appears in the subject field of an item. - * - * The subject property gets or sets the entire subject of the item, as sent by the email server. - * - * *Read mode* - * - * The subject property returns a string. Use the normalizedSubject property to get the subject minus any leading prefixes such as RE: and FW:. - * - * *Compose mode* - * - * The subject property returns a Subject object that provides methods to get and set the subject. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeCompose or read
- */ - subject: string; + removeHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + /** + * Removes an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeAppointment Attendee
+ * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * + * @beta + */ + removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; } /** @@ -9707,7 +9659,7 @@ declare namespace Office { * Note: Certain types of files are blocked by Outlook due to potential security issues and are therefore not returned. For more information, see {@link https://support.office.com/article/Blocked-attachments-in-Outlook-434752E1-02D3-4E90-9124-8B81E49A8519 | Blocked attachments in Outlook}. * */ - attachments: AttachmentDetails[]; + attachments: Office.AttachmentDetails[]; /** * Gets the Exchange Web Services item class of the selected item. * @@ -10098,6 +10050,18 @@ declare namespace Office { * Applicable Outlook modeMessage Compose */ bcc: Recipients; + /** + * Gets an object that provides methods for manipulating the body of an item. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Compose
+ */ + body: Office.Body; /** * Provides access to the Cc (carbon copy) recipients of a message. The type of object and level of access depends on the mode of the current item. * @@ -10112,53 +10076,6 @@ declare namespace Office { * Applicable Outlook modeMessage Compose */ cc: Recipients; - /** - * Gets the email address of the sender of a message. - * - * The from and sender properties represent the same person unless the message is sent by a delegate. In that case, the from property represents the delegator, and the sender property represents the delegate. - * - * The from property returns a From object that provides a method to get the from value. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Compose
- * - * @beta - */ - from: From; - /** - * Provides access to the recipients on the To line of a message. The type of object and level of access depends on the mode of the current item. - * - * The to property returns a Recipients object that provides methods to get or update the recipients on the To line of the message. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Compose
- */ - to: Recipients; - - // Repeated Item Fields // - - /** - * Gets an object that provides methods for manipulating the body of an item. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Compose
- */ - body: Office.Body; /** * Gets the date and time that an item was created. Read mode only. * @@ -10185,6 +10102,24 @@ declare namespace Office { * Note: This member is not supported in Outlook for iOS or Outlook for Android. */ dateTimeModifed: Date; + /** + * Gets the email address of the sender of a message. + * + * The from and sender properties represent the same person unless the message is sent by a delegate. In that case, the from property represents the delegator, and the sender property represents the delegate. + * + * The from property returns a From object that provides a method to get the from value. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Compose
+ * + * @beta + */ + from: Office.From; /** * Gets the type of item that an instance represents. * @@ -10211,7 +10146,6 @@ declare namespace Office { * Applicable Outlook modeMessage Compose */ notificationMessages: Office.NotificationMessages; - /** * Gets or sets the recurrence pattern of an appointment. Gets the recurrence pattern of a meeting request. Read and compose modes for appointment items. Read mode for meeting request items. * @@ -10231,8 +10165,7 @@ declare namespace Office { * * @beta */ - recurrence: Office.Recurrence; - + recurrence: Recurrence; /** * Gets the id of the series that an instance belongs to. * @@ -10253,124 +10186,7 @@ declare namespace Office { * @beta */ seriesId: string; - /** - * Adds an event handler for a supported event. - * - * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Compose
- * - * In addition to this signature, the method also has the following signature: - * - * `addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void;` - * - * @param eventType The event that should invoke the handler. - * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - * @param options Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. - * - * @beta - */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; - - /** - * Adds an event handler for a supported event. - * - * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Compose
- * - * @param eventType The event that should invoke the handler. - * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. - * - * @beta - */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void; - - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Compose
- * - * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. - * @param userContext Optional. Developers can provide any object they wish to access in the callback function. This object can be accessed by the asyncResult.asyncContext property in the callback function. - */ - loadCustomPropertiesAsync(callback: (result: AsyncResult) => void, userContext?: any): void; - - /** - * Removes an event handler for a supported event. - * - * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Compose
- * - * In addition to this signature, the method also has the following signature: - * - * `removeHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void;` - * - * @param eventType The event that should invoke the handler. - * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. - * @param options Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. - * - * @beta - */ - removeHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; - - /** - * Removes an event handler for a supported event. - * - * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Compose
- * - * @param eventType The event that should invoke the handler. - * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. - * - * @beta - */ - removeHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void; - - /** * Gets or sets the description that appears in the subject field of an item. * * The subject property gets or sets the entire subject of the item, as sent by the email server. @@ -10386,6 +10202,21 @@ declare namespace Office { * Applicable Outlook modeMessage Compose */ subject: Subject; + /** + * Provides access to the recipients on the To line of a message. The type of object and level of access depends on the mode of the current item. + * + * The to property returns a Recipients object that provides methods to get or update the recipients on the To line of the message. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Compose
+ */ + to: Recipients; + /** * Adds a file to a message or appointment as an attachment. * @@ -10406,7 +10237,7 @@ declare namespace Office { * * `addFileAttachmentAsync(uri: string, attachmentName: string): void;` * - * `addFileAttachmentAsync(uri: string, attachmentName: string, options: Office.AsyncContextOptions): void;` + * `addFileAttachmentAsync(uri: string, attachmentName: string, options: AsyncContextOptions): void;` * * `addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: AsyncResult) => void): void;` * @@ -10417,7 +10248,7 @@ declare namespace Office { * inInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the attachment list. * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type asyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -10460,7 +10291,7 @@ declare namespace Office { * asyncContext: Developers can provide any object they wish to access in the callback method. * inInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the attachment list. */ - addFileAttachmentAsync(uri: string, attachmentName: string, options: Office.AsyncContextOptions): void; + addFileAttachmentAsync(uri: string, attachmentName: string, options: AsyncContextOptions): void; /** * Adds a file to a message or appointment as an attachment. * @@ -10482,7 +10313,52 @@ declare namespace Office { * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type asyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: AsyncResult) => void): void; - + /** + * Adds an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Compose
+ * + * In addition to this signature, the method also has the following signature: + * + * `addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;` + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * + * @beta + */ + addHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + /** + * Adds an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Compose
+ * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * + * @beta + */ + addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -10585,7 +10461,6 @@ declare namespace Office { * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: AsyncResult) => void): void; - /** * Closes the current item that is being composed * @@ -10672,6 +10547,25 @@ declare namespace Office { * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. */ getSelectedDataAsync(coerciontype: Office.CoercionType, options: Office.AsyncContextOptions, callback: (result: AsyncResult) => void): void; + /** + * Asynchronously loads custom properties for this add-in on the selected item. + * + * Custom properties are stored as key/value pairs on a per-app, per-item basis. This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. + * + * The custom properties are provided as a CustomProperties object in the asyncResult.value property. This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to the server. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Compose
+ * + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param userContext Optional. Developers can provide any object they wish to access in the callback function. This object can be accessed by the asyncResult.asyncContext property in the callback function. + */ + loadCustomPropertiesAsync(callback: (result: AsyncResult) => void, userContext?: any): void; /** * Removes an attachment from a message or appointment. * @@ -10758,7 +10652,52 @@ declare namespace Office { * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ removeAttachmentAsync(attachmentIndex: string, callback: (result: AsyncResult) => void): void; - + /** + * Removes an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Compose
+ * + * In addition to this signature, the method also has the following signature: + * + * `removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;` + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * + * @beta + */ + removeHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + /** + * Removes an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Compose
+ * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * + * @beta + */ + removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -10976,6 +10915,33 @@ declare namespace Office { * Important: This is an internal Outlook object, not directly exposed through existing interfaces. You should treat this as a mode of Office.context.mailbox.item. Refer to the Object Model pages for more information. */ interface MessageRead extends Message, ItemRead { + /** + * Gets an array of attachments for the item. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
+ * + * Note: Certain types of files are blocked by Outlook due to potential security issues and are therefore not returned. For more information, see {@link https://support.office.com/article/Blocked-attachments-in-Outlook-434752E1-02D3-4E90-9124-8B81E49A8519 | Blocked attachments in Outlook}. + * + */ + attachments: Office.AttachmentDetails[]; + /** + * Gets an object that provides methods for manipulating the body of an item. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
+ */ + body: Office.Body; /** * Provides access to the Cc (carbon copy) recipients of a message. The type of object and level of access depends on the mode of the current item. * @@ -10990,6 +10956,32 @@ declare namespace Office { * Applicable Outlook modeMessage Read */ cc: EmailAddressDetails[]; + /** + * Gets the date and time that an item was created. Read mode only. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
+ */ + dateTimeCreated: Date; + /** + * Gets the date and time that an item was last modified. Read mode only. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
+ * + * Note: This member is not supported in Outlook for iOS or Outlook for Android. + */ + dateTimeModifed: Date; /** * Gets the email address of the sender of a message. * @@ -11020,277 +11012,6 @@ declare namespace Office { * Applicable Outlook modeMessage Read */ internetMessageId: string; - /** - * Gets the email address of the sender of an email message. - * - * The from and sender properties represent the same person unless the message is sent by a delegate. In that case, the from property represents the delegator, and the sender property represents the delegate. - * - * Note: The recipientType property of the EmailAddressDetails object in the sender property is undefined. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
- */ - sender: EmailAddressDetails; - /** - * Provides access to the recipients on the To line of a message. The type of object and level of access depends on the mode of the current item. - * - * The to property returns an array that contains an EmailAddressDetails object for each recipient listed on the To line of the message. The collection is limited to a maximum of 100 members. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
- */ - to: EmailAddressDetails[]; - - // Repeated Item Fields // - - /** - * Gets an object that provides methods for manipulating the body of an item. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
- */ - body: Office.Body; - /** - * Gets the date and time that an item was created. Read mode only. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
- */ - dateTimeCreated: Date; - /** - * Gets the date and time that an item was last modified. Read mode only. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
- * - * Note: This member is not supported in Outlook for iOS or Outlook for Android. - */ - dateTimeModifed: Date; - /** - * Gets the type of item that an instance represents. - * - * The itemType property returns one of the ItemType enumeration values, indicating whether the item object instance is a message or an appointment. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
- */ - itemType: Office.MailboxEnums.ItemType; - /** - * Gets the notification messages for an item. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeCompose or read
- */ - notificationMessages: Office.NotificationMessages; - - /** - * Gets the recurrence pattern of an appointment. Gets the recurrence pattern of a meeting request. Read and compose modes for appointment items. Read mode for meeting request items. - * - * The recurrence property returns a recurrence object for recurring appointments or meetings requests if an item is a series or an instance in a series. null is returned for single appointments and meeting requests of single appointments. undefined is returned for messages that are not meeting requests. - * - * Note: Meeting requests have an itemClass value of IPM.Schedule.Meeting.Request. - * - * Note: If the recurrence object is null, this indicates that the object is a single appointment or a meeting request of a single appointment and NOT a part of a series. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
- * - * @beta - */ - recurrence: Office.Recurrence; - - /** - * Gets the id of the series that an instance belongs to. - * - * In OWA and Outlook, the seriesId returns the Exchange Web Services (EWS) ID of the parent (series) item that this item belongs to. However, in iOS and Android, the seriesId returns the REST ID of the parent item. - * - * Note: The identifier returned by the seriesId property is the same as the Exchange Web Services item identifier. The seriesId property is not identical to the Outlook IDs used by the Outlook REST API. Before making REST API calls using this value, it should be converted using Office.context.mailbox.convertToRestId. For more details, see {@link https://docs.microsoft.com/outlook/add-ins/use-rest-api | Use the Outlook REST APIs from an Outlook add-in}. - * - * The seriesId property returns null for items that do not have parent items such as single appointments, series items, or meeting requests and returns undefined for any other items that are not meeting requests. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
- * - * @beta - */ - seriesId: string; - - /** - * Adds an event handler for a supported event. - * - * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
- * - * In addition to this signature, the method also has the following signature: - * - * `addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void;` - * - * @param eventType The event that should invoke the handler. - * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - * @param options Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. - * - * @beta - */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; - - /** - * Adds an event handler for a supported event. - * - * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
- * - * @param eventType The event that should invoke the handler. - * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. - * - * @beta - */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void; - - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
- * - * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. - * @param userContext Optional. Developers can provide any object they wish to access in the callback function. This object can be accessed by the asyncResult.asyncContext property in the callback function. - */ - loadCustomPropertiesAsync(callback: (result: AsyncResult) => void, userContext?: any): void; - - /** - * Removes an event handler for a supported event. - * - * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
- * - * In addition to this signature, the method also has the following signature: - * - * `removeHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void;` - * - * @param eventType The event that should invoke the handler. - * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. - * @param options Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. - * - * @beta - */ - removeHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; - - /** - * Removes an event handler for a supported event. - * - * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
- * - * @param eventType The event that should invoke the handler. - * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. - * - * @beta - */ - removeHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void; - - /** - * Gets an array of attachments for the item. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
- * - * Note: Certain types of files are blocked by Outlook due to potential security issues and are therefore not returned. For more information, see {@link https://support.office.com/article/Blocked-attachments-in-Outlook-434752E1-02D3-4E90-9124-8B81E49A8519 | Blocked attachments in Outlook}. - * - */ - attachments: AttachmentDetails[]; /** * Gets the Exchange Web Services item class of the selected item. * @@ -11342,6 +11063,20 @@ declare namespace Office { * Applicable Outlook modeMessage Read */ itemId: string; + /** + * Gets the type of item that an instance represents. + * + * The itemType property returns one of the ItemType enumeration values, indicating whether the item object instance is a message or an appointment. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
+ */ + itemType: Office.MailboxEnums.ItemType; /** * Gets the subject of an item, with all prefixes removed (including RE: and FWD:). * @@ -11356,6 +11091,74 @@ declare namespace Office { * Applicable Outlook modeMessage Read */ normalizedSubject: string; + /** + * Gets the notification messages for an item. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeCompose or read
+ */ + notificationMessages: Office.NotificationMessages; + /** + * Gets the recurrence pattern of an appointment. Gets the recurrence pattern of a meeting request. Read and compose modes for appointment items. Read mode for meeting request items. + * + * The recurrence property returns a recurrence object for recurring appointments or meetings requests if an item is a series or an instance in a series. null is returned for single appointments and meeting requests of single appointments. undefined is returned for messages that are not meeting requests. + * + * Note: Meeting requests have an itemClass value of IPM.Schedule.Meeting.Request. + * + * Note: If the recurrence object is null, this indicates that the object is a single appointment or a meeting request of a single appointment and NOT a part of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
+ * + * @beta + */ + recurrence: Recurrence; + /** + * Gets the id of the series that an instance belongs to. + * + * In OWA and Outlook, the seriesId returns the Exchange Web Services (EWS) ID of the parent (series) item that this item belongs to. However, in iOS and Android, the seriesId returns the REST ID of the parent item. + * + * Note: The identifier returned by the seriesId property is the same as the Exchange Web Services item identifier. The seriesId property is not identical to the Outlook IDs used by the Outlook REST API. Before making REST API calls using this value, it should be converted using Office.context.mailbox.convertToRestId. For more details, see {@link https://docs.microsoft.com/outlook/add-ins/use-rest-api | Use the Outlook REST APIs from an Outlook add-in}. + * + * The seriesId property returns null for items that do not have parent items such as single appointments, series items, or meeting requests and returns undefined for any other items that are not meeting requests. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
+ * + * @beta + */ + seriesId: string; + /** + * Gets the email address of the sender of an email message. + * + * The from and sender properties represent the same person unless the message is sent by a delegate. In that case, the from property represents the delegator, and the sender property represents the delegate. + * + * Note: The recipientType property of the EmailAddressDetails object in the sender property is undefined. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
+ */ + sender: EmailAddressDetails; /** * Gets the description that appears in the subject field of an item. * @@ -11372,6 +11175,68 @@ declare namespace Office { * Applicable Outlook modeMessage Read */ subject: string; + /** + * Provides access to the recipients on the To line of a message. The type of object and level of access depends on the mode of the current item. + * + * The to property returns an array that contains an EmailAddressDetails object for each recipient listed on the To line of the message. The collection is limited to a maximum of 100 members. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
+ */ + to: EmailAddressDetails[]; + + /** + * Adds an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
+ * + * In addition to this signature, the method also has the following signature: + * + * `addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;` + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * + * @beta + */ + addHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + + /** + * Adds an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
+ * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * + * @beta + */ + addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; /** * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the selected appointment. * @@ -11639,6 +11504,71 @@ declare namespace Office { * Applicable Outlook modeMessage Read */ getSelectedRegExMatches(): any; + /** + * Asynchronously loads custom properties for this add-in on the selected item. + * + * Custom properties are stored as key/value pairs on a per-app, per-item basis. This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. + * + * The custom properties are provided as a CustomProperties object in the asyncResult.value property. This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to the server. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
+ * + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param userContext Optional. Developers can provide any object they wish to access in the callback function. This object can be accessed by the asyncResult.asyncContext property in the callback function. + */ + loadCustomPropertiesAsync(callback: (result: AsyncResult) => void, userContext?: any): void; + /** + * Removes an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
+ * + * In addition to this signature, the method also has the following signature: + * + * `removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;` + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * + * @beta + */ + removeHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + /** + * Removes an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
Applicable Outlook modeMessage Read
+ * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * + * @beta + */ + removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; } /** diff --git a/types/overwatch-api/index.d.ts b/types/overwatch-api/index.d.ts index 8eaac311c8..bd7af1dcf0 100644 --- a/types/overwatch-api/index.d.ts +++ b/types/overwatch-api/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for overwatch-api 0.4 +// Type definitions for overwatch-api 0.5 // Project: https://github.com/alfg/overwatch-api -// Definitions by: JoshuaHall +// Definitions by: Joshua Hall // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -70,6 +70,7 @@ export interface OverwatchApiResponse { username: string; level: number; portrait: string; + private: boolean; } export interface ProfileApiResponse extends OverwatchApiResponse { diff --git a/types/overwatch-api/overwatch-api-tests.ts b/types/overwatch-api/overwatch-api-tests.ts index bd4df128a0..9364e87780 100644 --- a/types/overwatch-api/overwatch-api-tests.ts +++ b/types/overwatch-api/overwatch-api-tests.ts @@ -1,4 +1,4 @@ -import { getProfile, OverwatchPlatform, OverwatchServerRegion, ProfileApiResponse, owl } from 'overwatch-api'; +import { getProfile, OverwatchPlatform, OverwatchServerRegion, ProfileApiResponse, owl, getStats, StatsApiResponse, CompetitiveTopHeroData } from 'overwatch-api'; const platform: OverwatchPlatform = 'pc'; const region: OverwatchServerRegion = 'us'; @@ -6,10 +6,36 @@ const battleTag = 'sparK#12434'; getProfile(platform, region, battleTag, (err: Error | null, data: ProfileApiResponse) => { if (err === null) { - console.log(`Username: ${data.username}`); - console.log(`Level: ${data.level}`); - console.log(`Rank: ${data.competitive.rank} SR`); - console.log(`Win Rate in Competitive: ${data.games.competitive.win_rate}`); + if (data.private) { + console.log(`Profile for battletag ${battleTag} is private, cannot retrieve profile`); + } else { + console.log(`Username: ${data.username}`); + console.log(`Level: ${data.level}`); + console.log(`Rank: ${data.competitive.rank} SR`); + console.log(`Win Rate in Competitive: ${data.games.competitive.win_rate}`); + } + } else { + console.log(err); + } +}); + +getStats(platform, region, battleTag, (err: Error | null, data: StatsApiResponse) => { + if (err === null) { + if (data.private) { + console.log(`Profile for battletag ${battleTag} is private, cannot retrieve stats`); + } else { + console.log(`Username: ${data.username}`); + console.log(`Level: ${data.level}`); + console.log(`Competitive Stats`); + const topHeroesComp: CompetitiveTopHeroData = data.stats.top_heroes.competitive; + console.log(`Hero with most games won: ${topHeroesComp.games_won[0].hero}`); + console.log(`Hero with highest winrate: ${topHeroesComp.win_rate[0].hero}`); + console.log(`Hero with most time played ${topHeroesComp.played[0].hero}\n`); + + for (const stat of data.stats.game.competitive) { + console.log(`${stat.title}: ${stat.value}`); + } + } } else { console.log(err); } diff --git a/types/physijs/index.d.ts b/types/physijs/index.d.ts index 86ea3b9f38..79698c4697 100644 --- a/types/physijs/index.d.ts +++ b/types/physijs/index.d.ts @@ -143,8 +143,8 @@ declare namespace Physijs { onSimulationResume():void; removeConstraint(constraint:Constraint):void; execute(cmd:string, params:any):void; - add(object:THREE.Object3D):void; - remove(object:THREE.Object3D):void; + add(object:THREE.Object3D):this; + remove(object:THREE.Object3D):this; setFixedTimeStep(fixedTimeStep:number):void; setGravity(gravity:THREE.Vector3):void; simulate(timeStep?:number, maxSubSteps?:number):boolean; diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index 854960025d..39ecb64d37 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -355,7 +355,7 @@ export interface ModeBarButton { // Data -export type Datum = string | number | Date; +export type Datum = string | number | Date | null; export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array; export type Dash = 'solid' | 'dot' | 'dash' | 'longdash' | 'dashdot' | 'longdashdot'; diff --git a/types/qlik-engineapi/index.d.ts b/types/qlik-engineapi/index.d.ts index f0f95301c3..ccb16bbda6 100644 --- a/types/qlik-engineapi/index.d.ts +++ b/types/qlik-engineapi/index.d.ts @@ -4412,12 +4412,7 @@ declare namespace EngineAPI { /** * NxCellRows... */ - interface INxCellRows { - /** - * Array of data. - */ - NxCellRows: INxCell[]; - } + type INxCellRows = INxCell[]; /** * INxDataPage... @@ -8715,7 +8710,7 @@ declare namespace EngineAPI { /** * Information on the measure. */ - qMeasureInfo: INxMeasureInfo; + qMeasureInfo: INxMeasureInfo[]; /** * Sort order of the columns in the hypercube. diff --git a/types/qrcode.react/index.d.ts b/types/qrcode.react/index.d.ts index f730ee7581..d38d8ce89b 100644 --- a/types/qrcode.react/index.d.ts +++ b/types/qrcode.react/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for qrcode.react 0.6 +// Type definitions for qrcode.react 0.8 // Project: https://github.com/zpao/qrcode.react // Definitions by: Mleko // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -13,6 +13,7 @@ declare namespace qrcode { bgColor?: string; fgColor?: string; level?: "L"|"M"|"Q"|"H"; + renderAs?: "svg" | "canvas"; } type QRCode = React.ComponentClass; diff --git a/types/qrcode.react/qrcode.react-tests.tsx b/types/qrcode.react/qrcode.react-tests.tsx index 25136d1a97..b91c1e7944 100644 --- a/types/qrcode.react/qrcode.react-tests.tsx +++ b/types/qrcode.react/qrcode.react-tests.tsx @@ -9,4 +9,5 @@ const qrcodes = [ , , , + , ]; diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index 1ec7cc1e26..206f8abeaa 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -110,6 +110,8 @@ export interface OnDropData { node: InternalTreeNode; dragNode: InternalTreeNode; dragNodesKeys: string[]; + dropPosition: number; + dropToGap?: boolean; } export interface OnDragEndData { diff --git a/types/react-custom-scrollbars/index.d.ts b/types/react-custom-scrollbars/index.d.ts index 7f60cc8a2a..f21ec7adba 100644 --- a/types/react-custom-scrollbars/index.d.ts +++ b/types/react-custom-scrollbars/index.d.ts @@ -44,8 +44,8 @@ declare module "react-custom-scrollbars" { universal?: boolean; autoHeight?: boolean; - autoHeightMin?: number; - autoHeightMax?: number; + autoHeightMin?: number | string; + autoHeightMax?: number | string; } export default class Scrollbars extends React.Component { diff --git a/types/react-datepicker/index.d.ts b/types/react-datepicker/index.d.ts index 75fc9c47bb..5f48988dd4 100644 --- a/types/react-datepicker/index.d.ts +++ b/types/react-datepicker/index.d.ts @@ -5,12 +5,14 @@ // Greg Smith , // Platon Pronko // Roy Xue -// Koala Human +// Koala Human +// Sean Kelley // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 import * as React from "react"; import * as moment from "moment"; +import * as Popper from "popper.js"; export interface ReactDatePickerProps { adjustDateOnChange?: boolean; @@ -18,7 +20,7 @@ export interface ReactDatePickerProps { autoComplete?: string; autoFocus?: boolean; calendarClassName?: string; - children?: any; + children?: React.ReactNode; className?: string; customInput?: React.ReactNode; customInputRef?: string; @@ -29,24 +31,27 @@ export interface ReactDatePickerProps { disabledKeyboardNavigation?: boolean; dropdownMode?: 'scroll' | 'select'; endDate?: moment.Moment; - excludeDates?: any[]; + excludeDates?: moment.Moment[]; + excludeTimes?: moment.Moment[]; filterDate?(date: moment.Moment): boolean; fixedHeight?: boolean; forceShowMonthNavigation?: boolean; formatWeekNumber?(date: moment.Moment): string | number; - highlightDates?: any[]; + highlightDates?: moment.Moment[]; id?: string; - includeDates?: any[]; - includeTimes?: any[]; + includeDates?: moment.Moment[]; + includeTimes?: moment.Moment[]; inline?: boolean; isClearable?: boolean; locale?: string; maxDate?: moment.Moment; + maxTime?: moment.Moment; minDate?: moment.Moment; + minTime?: moment.Moment; monthsShown?: number; name?: string; onBlur?(event: React.FocusEvent): void; - onChange(date: moment.Moment | null, event: React.SyntheticEvent | undefined): any; + onChange(date: moment.Moment | null, event: React.SyntheticEvent | undefined): void; onChangeRaw?(event: React.FocusEvent): void; onClickOutside?(event: React.MouseEvent): void; onFocus?(event: React.FocusEvent): void; @@ -60,41 +65,38 @@ export interface ReactDatePickerProps { placeholderText?: string; popperClassName?: string; popperContainer?(props: { children: React.ReactNode[] }): React.ReactNode; - popperModifiers?: any; + popperModifiers?: Popper.Modifiers; popperPlacement?: string; preventOpenOnFocus?: boolean; readOnly?: boolean; required?: boolean; - scrollableYearDropdown?: boolean; scrollableMonthYearDropdown?: boolean; + scrollableYearDropdown?: boolean; selected?: moment.Moment | null; selectsEnd?: boolean; selectsStart?: boolean; + shouldCloseOnSelect?: boolean; showDisabledMonthNavigation?: boolean; showMonthDropdown?: boolean; showMonthYearDropdown?: boolean; + showTimeSelect?: boolean; + showTimeSelectOnly?: boolean; showWeekNumbers?: boolean; showYearDropdown?: boolean; startDate?: moment.Moment; startOpen?: boolean; tabIndex?: number; + timeFormat?: string; + timeIntervals?: number; title?: string; todayButton?: string; - useWeekdaysShort?: boolean; useShortMonthInDropdown?: boolean; + useWeekdaysShort?: boolean; utcOffset?: number; value?: string; weekLabel?: string; withPortal?: boolean; yearDropdownItemNumber?: number; - shouldCloseOnSelect?: boolean; - showTimeSelect?: boolean; - showTimeSelectOnly?: boolean; - timeFormat?: string; - timeIntervals?: number; - minTime?: moment.Moment; - maxTime?: moment.Moment; - excludeTimes?: any[]; } declare const ReactDatePicker: React.ClassicComponentClass; export default ReactDatePicker; diff --git a/types/react-datepicker/package.json b/types/react-datepicker/package.json index 19e5fb0d14..fc763e4d4b 100644 --- a/types/react-datepicker/package.json +++ b/types/react-datepicker/package.json @@ -1,6 +1,7 @@ { "private": true, "dependencies": { - "moment": ">=2.14.0" + "moment": ">=2.14.0", + "popper.js": "^1.14.1" } } diff --git a/types/react-datepicker/react-datepicker-tests.tsx b/types/react-datepicker/react-datepicker-tests.tsx index 8f450adcab..1414672684 100644 --- a/types/react-datepicker/react-datepicker-tests.tsx +++ b/types/react-datepicker/react-datepicker-tests.tsx @@ -1,36 +1,18 @@ import * as React from 'react'; -import moment = require('moment'); +import * as moment from 'moment'; import DatePicker from 'react-datepicker'; -class ReactDatePicker extends React.Component<{}, { startDate: moment.Moment; displayName: string; }> { - constructor(props: {}) { - super(props); - this.handleChange = this.handleChange.bind(this); - } - state = { - startDate: moment(), - displayName: 'Example' - }; - - handleChange = function(date?: moment.Moment | null) { - this.setState({ - startDate: date - }); - }; - - handleYearChange = (date: moment.Moment) => { - this.setState({ - startDate: date - }); - } - - render() { - return ( - - ); - } -} + {}} + onYearChange={(date: moment.Moment) => {}} + popperModifiers={{ + flip: { + enabled: false + } + }} + includeTimes={[moment()]} +> +
+ +; diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 75bc217615..b58f3778ae 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -18,6 +18,7 @@ // Edward Sammut Alessi // Jérémy Magrin // Luca Campana +// Ullrich Schaefer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -1165,9 +1166,12 @@ export function withNavigation( Component: React.ComponentType ): React.ComponentType }>; +export interface NavigationFocusInjectedProps extends NavigationInjectedProps { + isFocused: boolean; +} export function withNavigationFocus( - Component: React.ComponentType -): React.ComponentType; + Component: React.ComponentType +): React.ComponentType }>; /** * SafeAreaView Component diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 38aa495240..40aa75cbc3 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -42,6 +42,8 @@ import { NavigationContainerComponent, withNavigation, NavigationInjectedProps, + withNavigationFocus, + NavigationFocusInjectedProps } from 'react-navigation'; // Constants @@ -532,3 +534,19 @@ const BackButtonWithNavigation = withNavigation(MyBackButton); const BackButtonInstance = { const backButtonRef = ref; }} />; + +// Test withNavigationFocus + +interface MyFocusedComponentProps { expectsFocus: boolean; } +class MyFocusedComponent extends React.Component { + render() { + return