diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 8c7f823a07..120db09a19 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1567,7 +1567,7 @@ /types/hapi/v12/ @jasonswearingen /types/hapi/v15/ @jasonswearingen /types/hapi/v16/ @jasonswearingen @AJamesPhillips -/types/hapi/ @BorntraegerMarc @rafaelsouzaf @jhsimms @SimonSchick +/types/hapi/ @rafaelsouzaf @jhsimms @SimonSchick /types/hapi-auth-basic/ @AJamesPhillips @saboya /types/hapi-auth-jwt2/v7/ @warrenseymour /types/hapi-auth-jwt2/ @warrenseymour @SimonSchick @@ -3576,8 +3576,8 @@ /types/react-native-vector-icons/ @iRoachie @timwangdev /types/react-native-version-number/ @VincentLanglet /types/react-native-video/ @huhuanming -/types/react-navigation/v1/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @robertohuertasm @YourGamesBeOver @ArmandoAssuncao @cliedeman @Slessi -/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @robertohuertasm @YourGamesBeOver @ArmandoAssuncao @cliedeman @Slessi @magrinj @TizioFittizio @stigi +/types/react-navigation/v1/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @Slessi +/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @Slessi @magrinj @TizioFittizio @stigi /types/react-notification-system/ @GiedriusGrabauskas @DeividasBakanas @LKay @sztobar /types/react-notification-system-redux/ @LKay /types/react-notify-toast/ @klaascuvelier diff --git a/notNeededPackages.json b/notNeededPackages.json index 8b56dbd9b5..4e66976014 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -156,12 +156,6 @@ "sourceRepoURL": "https://github.com/brianloveswords/base64url", "asOfVersion": "2.0.0" }, - { - "libraryName": "better-scroll", - "typingsPackageName": "better-scroll", - "sourceRepoURL": "https://github.com/ustbhuangyi/better-scroll", - "asOfVersion": "1.5.0" - }, { "libraryName": "BigInteger.js", "typingsPackageName": "big-integer", @@ -570,6 +564,12 @@ "sourceRepoURL": "https://github.com/acdlite/flux-standard-action", "asOfVersion": "1.1.0" }, + { + "libraryName": "fork-ts-checker-webpack-plugin", + "typingsPackageName": "fork-ts-checker-webpack-plugin", + "sourceRepoURL": "https://github.com/Realytics/fork-ts-checker-webpack-plugin", + "asOfVersion": "0.4.5" + }, { "libraryName": "Foundation Sites", "typingsPackageName": "foundation-sites", @@ -1530,6 +1530,12 @@ "sourceRepoURL": "https://github.com/samchon/tstl", "asOfVersion": "1.5.7" }, + { + "libraryName": "typed.js", + "typingsPackageName": "typed.js", + "sourceRepoURL": "https://github.com/mattboldt/typed.js", + "asOfVersion": "2.0.9" + }, { "libraryName": "TypeScript", "typingsPackageName": "typescript", diff --git a/package.json b/package.json index c5b1b03057..09fe064d48 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "definitely-typed", - "version": "0.0.2", + "version": "0.0.3", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped", "repository": { "type": "git", diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index 5a49eaea18..0c2d244b05 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -1776,6 +1776,14 @@ declare namespace algoliasearch { facets?: { [facetName: string]: { [facetValue: string]: number }; }; + facets_stats?: { + [facetName: string]: { + avg: number, + max: number, + min: number, + sum: number, + }; + }; } interface MultiResponse { diff --git a/types/algoliasearch/lite/index.d.ts b/types/algoliasearch/lite/index.d.ts index acd2b30988..4f068d5647 100644 --- a/types/algoliasearch/lite/index.d.ts +++ b/types/algoliasearch/lite/index.d.ts @@ -4,6 +4,7 @@ // Haroen Viaene // Aurélien Hervé // Samuel Vaillant +// Claas Brüggemann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -570,6 +571,14 @@ declare namespace algoliasearch { facets?: { [facetName: string]: { [facetValue: string]: number }; }; + facets_stats?: { + [facetName: string]: { + avg: number, + max: number, + min: number, + sum: number, + }; + }; } interface MultiResponse { diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index f2aad6bb59..44f8539af2 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -311,8 +311,10 @@ namespace TestQ { } const abcObject: AbcObject = null; const abcObjectPromise: angular.IPromise = null; + const abcObjectPromiseLike: PromiseLike = null; const efObject: EfObject = null; const efObjectPromise: angular.IPromise = null; + const efObjectPromiseLike: PromiseLike = null; const ghObject: GhObject = null; const ghObjectPromise: angular.IPromise = null; @@ -404,6 +406,7 @@ namespace TestQ { result = $q.when(abcObject); result = $q.when(abcObjectPromise); + result = $q.when(abcObjectPromiseLike); result = $q.when(efObject, (result: EfObject) => abcObject); result = $q.when(efObject, (result: EfObject) => abcObject, (any) => any); @@ -416,10 +419,21 @@ namespace TestQ { resultOther = $q.when(efObjectPromise, (result: EfObject) => abcObject, (any) => ghObjectPromise); resultOther = $q.when(efObjectPromise, (result: EfObject) => abcObject, (any) => ghObjectPromise, (any) => any); + result = $q.when(efObjectPromiseLike, (result: EfObject) => abcObject); + resultOther = $q.when(efObjectPromiseLike, (result: EfObject) => abcObject, (any) => ghObject); + resultOther = $q.when(efObjectPromiseLike, (result: EfObject) => abcObject, (any) => ghObject); + resultOther = $q.when(efObjectPromiseLike, (result: EfObject) => abcObject, (any) => ghObject, (any) => any); + resultOther = $q.when(efObjectPromiseLike, (result: EfObject) => abcObject, (any) => ghObjectPromise); + resultOther = $q.when(efObjectPromiseLike, (result: EfObject) => abcObject, (any) => ghObjectPromise, (any) => any); + result = $q.when(efObject, (result: EfObject) => abcObjectPromise); result = $q.when(efObject, (result: EfObject) => abcObjectPromise, (any) => any); result = $q.when(efObject, (result: EfObject) => abcObjectPromise, (any) => any, (any) => any); + result = $q.when(efObject, (result: EfObject) => abcObjectPromiseLike); + result = $q.when(efObject, (result: EfObject) => abcObjectPromiseLike, (any) => any); + result = $q.when(efObject, (result: EfObject) => abcObjectPromiseLike, (any) => any, (any) => any); + result = $q.when(efObjectPromise, (result: EfObject) => abcObjectPromise); resultOther = $q.when(efObjectPromise, (result: EfObject) => abcObjectPromise, (any) => ghObject); resultOther = $q.when(efObjectPromise, (result: EfObject) => abcObjectPromise, (any) => ghObject, (any) => any); diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts index 450d381b6d..99977b57b5 100644 --- a/types/angular/index.d.ts +++ b/types/angular/index.d.ts @@ -1137,12 +1137,12 @@ declare namespace angular { * * @param value Value or a promise */ - resolve(value: IPromise|T): IPromise; + resolve(value: PromiseLike|T): IPromise; /** * @deprecated Since TS 2.4, inference is stricter and no longer produces the desired type when T1 !== T2. * To use resolve with two different types, pass a union type to the single-type-argument overload. */ - resolve(value: IPromise|T2): IPromise; + resolve(value: PromiseLike|T2): IPromise; /** * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. */ @@ -1152,11 +1152,11 @@ declare namespace angular { * * @param value Value or a promise */ - when(value: IPromise|T): IPromise; - when(value: IPromise|T2): IPromise; - when(value: IPromise|T, successCallback: (promiseValue: T) => IPromise|TResult): IPromise; - when(value: T, successCallback: (promiseValue: T) => IPromise|TResult, errorCallback: null | undefined | ((reason: any) => any), notifyCallback?: (state: any) => any): IPromise; - when(value: IPromise, successCallback: (promiseValue: T) => IPromise|TResult, errorCallback: (reason: any) => TResult2 | IPromise, notifyCallback?: (state: any) => any): IPromise; + when(value: PromiseLike|T): IPromise; + when(value: PromiseLike|T2): IPromise; + when(value: PromiseLike|T, successCallback: (promiseValue: T) => PromiseLike|TResult): IPromise; + when(value: T, successCallback: (promiseValue: T) => PromiseLike|TResult, errorCallback: null | undefined | ((reason: any) => any), notifyCallback?: (state: any) => any): IPromise; + when(value: PromiseLike, successCallback: (promiseValue: T) => PromiseLike|TResult, errorCallback: (reason: any) => TResult2 | PromiseLike, notifyCallback?: (state: any) => any): IPromise; /** * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. */ diff --git a/types/applicationinsights-js/applicationinsights-js-tests.ts b/types/applicationinsights-js/applicationinsights-js-tests.ts index 49c68181f8..6588c3fcd3 100644 --- a/types/applicationinsights-js/applicationinsights-js-tests.ts +++ b/types/applicationinsights-js/applicationinsights-js-tests.ts @@ -17,17 +17,24 @@ const config: Microsoft.ApplicationInsights.IConfig = { autoTrackPageVisitTime: true, disableExceptionTracking: false, disableAjaxTracking: false, + disableFetchTracking: true, overridePageViewDuration: false, maxAjaxCallsPerView: -1, disableDataLossAnalysis: true, disableCorrelationHeaders: true, + correlationHeaderExcludedDomains: [], disableFlushOnBeforeUnload: false, enableSessionStorageBuffer: false, cookieDomain: "", isCookieUseDisabled: true, isRetryDisabled: true, - isPerfAnalyzerEnabled: true, - isStorageUseDisabled: true + url: "url", + isStorageUseDisabled: true, + isBeaconApiDisabled: false, + sdkExtension: "sdkExtension", + isBrowserLinkTrackingEnabled: false, + appId: "appId", + enableCorsCorrelation: false }; appInsights = { @@ -175,3 +182,8 @@ const traceObj = new Microsoft.ApplicationInsights.Telemetry.Trace("message", nu const traceData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.Trace.dataType, traceObj); const traceEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(traceData, Microsoft.ApplicationInsights.Telemetry.Trace.envelopeType); context.track(traceEnvelope); + +// UtilHelpers +let Util: typeof Microsoft.ApplicationInsights.UtilHelpers; + +Util.newId(); diff --git a/types/applicationinsights-js/index.d.ts b/types/applicationinsights-js/index.d.ts index 4214837ddf..517324cde4 100644 --- a/types/applicationinsights-js/index.d.ts +++ b/types/applicationinsights-js/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for ApplicationInsights-JS 1.0 // Project: https://github.com/Microsoft/ApplicationInsights-JS // Definitions by: Kamil Szostak +// Mark Wolff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module AI { @@ -560,19 +561,24 @@ declare module Microsoft.ApplicationInsights { samplingPercentage?: number; autoTrackPageVisitTime?: boolean; disableAjaxTracking?: boolean; + disableFetchTracking?: boolean; overridePageViewDuration?: boolean; maxAjaxCallsPerView?: number; disableDataLossAnalysis?: boolean; disableCorrelationHeaders?: boolean; + correlationHeaderExcludedDomains?: string[]; disableFlushOnBeforeUnload?: boolean; enableSessionStorageBuffer?: boolean; isCookieUseDisabled?: boolean; cookieDomain?: string; isRetryDisabled?: boolean; - isPerfAnalyzerEnabled?: boolean; url?: string; isStorageUseDisabled?: boolean; isBeaconApiDisabled?: boolean; + sdkExtension?: string; + isBrowserLinkTrackingEnabled?: boolean; + appId?: string; + enableCorsCorrelation?: boolean; } /** @@ -793,10 +799,18 @@ declare module Microsoft.ApplicationInsights { */ _onerror(message: string, url: string, lineNumber: number, columnNumber: number, error: Error): any; } + + class UtilHelpers { + /** + * Generate a random ID string + */ + static newId(): string; + } } declare module 'applicationinsights-js' { const AppInsights: Microsoft.ApplicationInsights.IAppInsights; + const Util: typeof Microsoft.ApplicationInsights.UtilHelpers; } declare var appInsights: Microsoft.ApplicationInsights.IAppInsights; diff --git a/types/auth0-js/index.d.ts b/types/auth0-js/index.d.ts index e66cd5f712..033a4bcbde 100644 --- a/types/auth0-js/index.d.ts +++ b/types/auth0-js/index.d.ts @@ -762,6 +762,7 @@ export interface AuthorizeOptions { audience?: string; language?: string; prompt?: string; + mode?: "login" | "signUp"; } export interface CheckSessionOptions extends AuthorizeOptions { diff --git a/types/auth0-lock/auth0-lock-tests.ts b/types/auth0-lock/auth0-lock-tests.ts index 618e4d562e..4b5c60e716 100644 --- a/types/auth0-lock/auth0-lock-tests.ts +++ b/types/auth0-lock/auth0-lock-tests.ts @@ -90,6 +90,7 @@ const themeOptions : Auth0LockConstructorOptions = { icon: 'http://baz.com/icon.png' } }, + hideMainScreenTitle: false, labeledSubmitButton: false, logo: "https://example.com/assets/logo.png", primaryColor: "green" diff --git a/types/auth0-lock/index.d.ts b/types/auth0-lock/index.d.ts index da1820352f..622ac3d36c 100644 --- a/types/auth0-lock/index.d.ts +++ b/types/auth0-lock/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Brian Caruso // Dan Caddigan // Larry Faudree +// Will Caulfield // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -75,6 +76,7 @@ interface Auth0LockThemeButtonOptions { interface Auth0LockThemeOptions { authButtons?: Auth0LockThemeButtonOptions; + hideMainScreenTitle?: boolean; labeledSubmitButton?: boolean; logo?: string; primaryColor?: string; diff --git a/types/better-queue/better-queue-tests.ts b/types/better-queue/better-queue-tests.ts new file mode 100644 index 0000000000..4a1aa4771e --- /dev/null +++ b/types/better-queue/better-queue-tests.ts @@ -0,0 +1,131 @@ +import Queue = require('better-queue'); + +interface TestTask { + taskId: string; + taskPayload: any; +} + +interface TestResult { + some: string; +} + +new Queue((task) => { + const test = task.anything; + console.log(task); +}); + +new Queue((task: TestTask[]) => { + const test = task[0].taskId; + console.log(task); +}); + +new Queue((task: TestTask, cb) => { + const id = task.taskId; + cb(null, 'result'); + cb(); +}, {}); + +new Queue({ + process(task: TestTask, cb) { + const id = task.taskId; + cb(null, { some: 'prop' }); + }, + filter(task, cb) { + const id = task.taskId; + cb(null, task); + }, + merge(oldTask, newTask, cb) { + const oldId = oldTask.taskId; + const newId = newTask.taskId; + cb(null, newTask); + }, + priority(task, cb) { + const id = task.taskId; + cb(null, 10); + }, + precondition(cb) { + cb(null, true); + }, + afterProcessDelay: 1000, + autoResume: true, + batchDelay: 123, + batchDelayTimeout: 123, + batchSize: 123, + cancelIfRunning: true, + concurrent: 123, + failTaskOnProcessException: true, + filo: true, + id: 'taskId', + maxRetries: 1, + maxTimeout: 1, + retryDelay: 1, + storeMaxRetries: 1, + storeRetryTimeout: 1, + preconditionRetryTimeout: 1, + store: 'test' +}); + +new Queue({ + process(task: TestTask[], cb) { + const firstId = task[0].taskId; + cb(null, { some: 'prop' }); + } +}); + +new Queue(() => { }, { + id(task, cb) { + const id = task.taskId; + cb(null, 'taskId'); + } +}); + +new Queue(() => { }, { + store: { + type: 'test' + } +}); + +const q = new Queue(() => {}); + +const testTask = {taskId: '', taskPayload: ''}; + +q.push(testTask); +q.push(testTask, (error, result) => {}); + +q.cancel('id', () => {}); + +class TestStore implements Queue.Store { + connect(cb: (error: any, length: number) => void) { + cb(null, 1); + } + + getTask(taskId: any, cb: (error: any, task: TestTask) => void) { + cb(null, { taskId: '', taskPayload: '' }); + } + + deleteTask(taskId: any, cb: () => void) { + cb(); + } + + putTask(taskId: any, task: TestTask, priority: number, cb: (error: any) => void) { + cb(null); + } + + takeFirstN(n: number, cb: (error: any, lockId: string) => void) { + cb(null, ''); + } + + takeLastN(n: number, cb: (error: any, lockId: string) => void) { + cb(null, ''); + } + + getLock(lockId: string, cb: (error: any, tasks: { [taskId: string]: TestTask }) => void) { + cb(null, { + id: { taskId: 'id', taskPayload: 'payload' } + }); + } + + releaseLock(lockId: string, cb: (error: any) => void) { + cb(null); + } +} diff --git a/types/better-queue/index.d.ts b/types/better-queue/index.d.ts new file mode 100644 index 0000000000..69861c5132 --- /dev/null +++ b/types/better-queue/index.d.ts @@ -0,0 +1,136 @@ +// Type definitions for better-queue 3.8 +// Project: https://github.com/diamondio/better-queue +// Definitions by: Ostap Nagovitsyn +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/* =================== USAGE =================== + import * as Queue from "better-queue"; + var queue = new Queue(...); + =============================================== */ + +/// + +declare class BetterQueue extends NodeJS.EventEmitter { + constructor(options: BetterQueue.QueueOptions); + constructor(process: BetterQueue.ProcessFunction, options?: Partial>); + + push(task: T, cb?: (err: any, result: K) => void): BetterQueue.Ticket; + + cancel(taskId: any, cb?: () => void): void; + + pause(): void; + + resume(): void; + + destroy(cb: () => void): void; + + use(store: BetterQueue.Store): void; + + getStats(): BetterQueue.QueueStats; + + resetStats(): void; + + on(event: 'task_finish', listener: (taskId: any, result: K) => void): this; + on(event: 'task_failed', listener: (taskId: any, errorMessage: string) => void): this; + on(event: 'task_progress', listener: (taskId: any, completed: number, total: number) => void): this; + on(event: BetterQueue.QueueEvent, listener: (...args: any[]) => void): this; +} + +declare namespace BetterQueue { + interface QueueOptions { + process: ProcessFunction; + filter?(task: T, cb: (error: any, task: T) => void): void; + merge?(oldTask: T, newTask: T, cb: (error: any, mergedTask: T) => void): void; + priority?(task: T, cb: (error: any, priority: number) => void): void; + precondition?(cb: (error: any, passOrFail: boolean) => void): void; + id?: keyof T | ((task: T, cb: (error: any, id: keyof T) => void) => void); + cancelIfRunning?: boolean; + autoResume?: boolean; + failTaskOnProcessException?: boolean; + filo?: boolean; + batchSize?: number; + batchDelay?: number; + batchDelayTimeout?: number; + concurrent?: number; + maxTimeout?: number; + afterProcessDelay?: number; + maxRetries?: number; + retryDelay?: number; + storeMaxRetries?: number; + storeRetryTimeout?: number; + preconditionRetryTimeout?: number; + store?: string | StoreOptions | Store; + } + + // TODO reflect task types somehow (task: T | T[]) + type ProcessFunction = (task: any, cb: ProcessFunctionCb) => void; + + type ProcessFunctionCb = (error?: any, result?: K) => void; + + type QueueEvent = + 'task_queued' + | 'task_accepted' + | 'task_started' + | 'task_finish' + | 'task_failed' + | 'task_progress' + | 'batch_finish' + | 'batch_failed' + | 'batch_progress' + | 'error'; + + type TicketEvent = + 'accept' + | 'queued' + | 'started' + | 'progress' + | 'finish' + | 'failed' + | 'error'; + + interface Store { + connect(cb: (error: any, length: number) => void): void; + + getTask(taskId: any, cb: (error: any, task: T) => void): void; + + deleteTask(taskId: any, cb: () => void): void; + + putTask(taskId: any, task: T, priority: number, cb: (error: any) => void): void; + + takeFirstN(n: number, cb: (error: any, lockId: string) => void): void; + + takeLastN(n: number, cb: (error: any, lockId: string) => void): void; + + getLock(lockId: string, cb: (error: any, tasks: { [taskId: string]: T }) => void): void; + + releaseLock(lockId: string, cb: (error: any) => void): void; + } + + interface StoreOptions { + type: string; + // store-specific options + [key: string]: any; + } + + class Ticket extends NodeJS.EventEmitter { + on(event: TicketEvent, listener: (...args: any[]) => void): this; + } + + interface TickerProgress { + eta: string; + pct: number; + complete: number; + total: number; + message: string; + } + + interface QueueStats { + total: number; + average: number; + successRate: number; + peak: number; + } +} + +export = BetterQueue; diff --git a/types/fork-ts-checker-webpack-plugin/tsconfig.json b/types/better-queue/tsconfig.json similarity index 90% rename from types/fork-ts-checker-webpack-plugin/tsconfig.json rename to types/better-queue/tsconfig.json index cfd6ee81db..4677f6a711 100644 --- a/types/fork-ts-checker-webpack-plugin/tsconfig.json +++ b/types/better-queue/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "fork-ts-checker-webpack-plugin-tests.ts" + "better-queue-tests.ts" ] } diff --git a/types/fork-ts-checker-webpack-plugin/tslint.json b/types/better-queue/tslint.json similarity index 100% rename from types/fork-ts-checker-webpack-plugin/tslint.json rename to types/better-queue/tslint.json diff --git a/types/better-scroll/better-scroll-tests.ts b/types/better-scroll/better-scroll-tests.ts new file mode 100644 index 0000000000..282e6185ab --- /dev/null +++ b/types/better-scroll/better-scroll-tests.ts @@ -0,0 +1,68 @@ +import BScroll from 'better-scroll'; + +const BScroll1 = new BScroll('#wrapper'); +const BScroll2 = new BScroll('#wrapper', { scrollX: false, scrollY: false }); +const BScroll3 = new BScroll('#wrapper', { + snap: true, + wheel: false, + scrollbar: false, + pullDownRefresh: false, +}); +const BScroll4 = new BScroll('#wrapper', { + wheel: { + selectedIndex: 0, + }, +}); +const BScroll6 = new BScroll('#wrapper', { + snap: { + loop: false, + el: document.querySelector('div-test') as Element, + threshold: 0.1, + stepX: 100, + stepY: 100, + listenFlick: true, + }, +}); +const BScroll7 = new BScroll('#wrapper', { + scrollbar: { + fade: true, + }, +}); + +const BScroll8 = new BScroll('#wrapper', { + pullDownRefresh: { + threshold: 50, + stop: 20, + }, +}); + +BScroll1.refresh(); +BScroll1.scrollTo(0, 100); +BScroll1.scrollTo(0, 100, 200); + +BScroll1.scrollToElement('selectedElement'); +BScroll1.scrollToElement('selectedElement', 250); + +BScroll1.scrollToElement(document.getElementById('selectedElement') as HTMLElement); +BScroll1.scrollToElement(document.getElementById('selectedElement') as HTMLElement, 250); + +BScroll2.on('scrollStart', () => { console.log('scroll started'); }); + +const BScroll9 = new BScroll(document.getElementById('wrapper') as HTMLElement); +const BScroll10 = new BScroll(document.getElementById('wrapper') as HTMLElement, { freeScroll: true }); +const BScroll11 = new BScroll(document.getElementById('wrapper') as HTMLElement, { + preventDefaultException: { + tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/, + }, +}); +const BScroll12 = new BScroll(document.getElementById('wrapper') as HTMLElement, { + preventDefaultException: { + className: /(^|\s)test(\s|$)/, + }, +}); + +const BScroll13 = new BScroll(document.getElementById('wrapper') as HTMLElement, { + swipeBounceTime: 1000, +}); + +const BScroll14 = new BScroll('#wrapper', { disableMouse: true, disableTouch: false }); diff --git a/types/better-scroll/index.d.ts b/types/better-scroll/index.d.ts new file mode 100644 index 0000000000..326dd2c3a0 --- /dev/null +++ b/types/better-scroll/index.d.ts @@ -0,0 +1,238 @@ +// Type definitions for better-scroll 1.12 +// Project: https://github.com/ustbhuangyi/better-scroll +// Definitions by: cloudstone +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// TypeScript Version: 2.2 +export interface WheelOption { + selectedIndex: number; + rotate: number; + adjustTime: number; + wheelWrapperClass: string; + wheelItemClass: string; +} + +export interface PageOption { + x: number; + y: number; + pageX: number; + pageY: number; +} + +export interface SlideOption { + loop: boolean; + el: Element; + threshold: number; + stepX: number; + stepY: number; + speed: number; + listenFlick: boolean; +} + +export interface ScrollBarOption { + fade: boolean; +} + +export interface PullDownOption { + threshold: number; + stop: number; +} + +export interface PullUpOption { + threshold: number; +} + +export interface BounceObjectOption { + top?: boolean; + bottom?: boolean; + left?: boolean; + right?: boolean; +} + +export interface EaseOption { + swipe?: { + style: string; + fn: (t: number) => number; + }; + swipeBounce?: { + style: string; + fn: (t: number) => number; + }; + bounce?: { + style: string; + fn: (t: number) => number; + }; +} + +export interface BsOption { + startX: number; + startY: number; + scrollX: boolean; + scrollY: boolean; + freeScroll: boolean; + directionLockThreshold: number; + eventPassthrough: string | boolean; + click: boolean; + tap: boolean; + bounce: boolean | BounceObjectOption; + bounceTime: number; + momentum: boolean; + momentumLimitTime: number; + momentumLimitDistance: number; + swipeTime: number; + swipeBounceTime: number; + deceleration: number; + flickLimitTime: number; + flickLimitDistance: number; + resizePolling: number; + probeType: number; + preventDefault: boolean; + preventDefaultException: object; + HWCompositing: boolean; + useTransition: boolean; + useTransform: boolean; + bindToWrapper: boolean; + disableMouse: boolean; + disableTouch: boolean; + observeDOM: boolean; + autoBlur: boolean; + stopPropagation: boolean; + /** + * for picker + * wheel: { + * selectedIndex: 0, + * rotate: 25, + * adjustTime: 400 + * } + */ + wheel: Partial | boolean; + /** + * for slide + * snap: { + * loop: boolean, + * el: domEl, + * threshold: 0.1, + * stepX: 100, + * stepY: 100, + * listenFlick: true + * } + */ + snap: Partial | boolean; + /** + * for scrollbar + * scrollbar: { + * fade: true + * } + */ + scrollbar: Partial | boolean; + /** + * for pull down and refresh + * pullDownRefresh: { + * threshold: 50, + * stop: 20 + * } + */ + pullDownRefresh: Partial | boolean; + /** + * for pull up and load + * pullUpLoad: { + * threshold: 50 + * } + */ + pullUpLoad: Partial | boolean; +} + +export interface Position { + x: number; + y: number; +} + +export default class BScroll { + constructor(element: Element | string, options?: Partial); + + x: number; + y: number; + maxScrollX: number; + maxScrollY: number; + movingDirectionX: number; + movingDirectionY: number; + directionX: number; + directionY: number; + enabled: boolean; + isInTransition: boolean; + isAnimating: boolean; + options: BsOption; + + refresh(): void; + + enable(): void; + + disable(): void; + + scrollBy(x: number, y: number, time?: number, easing?: object): void; + + scrollTo(x: number, y: number, time?: number, easing?: object): void; + + scrollToElement(el: HTMLElement | string, time?: number, offsetX?: number | boolean, offsetY?: number | boolean, easing?: object): void; + + stop(): void; + + destroy(): void; + + goToPage(x: number, y: number, time?: number, easing?: object): void; + + next(time?: number, easing?: object): void; + + prev(time?: number, easing?: object): void; + + getCurrentPage(): PageOption; + + wheelTo(index: number): void; + + getSelectedIndex(): number; + + finishPullDown(): void; + + finishPullUp(): void; + + on( + type: + 'beforeScrollStart' | + 'scrollStart' | + 'scrollCancel' | + 'beforeScrollStart' | + 'flick' | + 'refresh' | + 'destroy' | + 'pullingDown' | + 'pullingUp', + fn: () => any + ): void; + + on( + type: + 'scroll' | + 'scrollEnd' | + 'touchEnd', + fn: (pos: Position) => any + ): void; + + off( + type: + 'beforeScrollStart' | + 'scrollStart' | + 'scroll' | + 'scrollCancel' | + 'beforeScrollStart' | + 'scrollEnd' | + 'touchEnd' | + 'flick' | + 'refresh' | + 'destroy' | + 'pullingDown' | + 'pullingUp', + fn: (...args: any[]) => void + ): void; + + trigger(type: string): void; +} diff --git a/types/better-scroll/tsconfig.json b/types/better-scroll/tsconfig.json new file mode 100644 index 0000000000..26f43ee3bd --- /dev/null +++ b/types/better-scroll/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "better-scroll-tests.ts" + ] +} diff --git a/types/better-scroll/tslint.json b/types/better-scroll/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/better-scroll/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/bloomfilter/bloomfilter-tests.ts b/types/bloomfilter/bloomfilter-tests.ts index 96ee0443b6..05f6c5210a 100644 --- a/types/bloomfilter/bloomfilter-tests.ts +++ b/types/bloomfilter/bloomfilter-tests.ts @@ -4,8 +4,14 @@ function test_bloomfilter() { const k = 2; const bloomFilter = new BloomFilter(m, k); - const array: Int32Array[] = bloomFilter.buckets; + const array: Int32Array = bloomFilter.buckets; const length: number = bloomFilter.buckets.length; bloomFilter.add('someString'); const test: boolean = bloomFilter.test('someString'); + + const buckets: Int32Array = bloomFilter.buckets; + const bloom2 = new BloomFilter(buckets, k); + + const a: Int32Array = new Int32Array(16); + a[3]; } diff --git a/types/bloomfilter/index.d.ts b/types/bloomfilter/index.d.ts index 00ed408c6d..980a96be55 100644 --- a/types/bloomfilter/index.d.ts +++ b/types/bloomfilter/index.d.ts @@ -1,14 +1,29 @@ -// Type definitions for BloomFilter 0.1 +// Type definitions for BloomFilter 0.0 // Project: https://github.com/jasondavies/bloomfilter.js // Definitions by: slawiko // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export class BloomFilter { - buckets: Int32Array[]; + buckets: Int32Array; - constructor(m: number, k: number); + /** + * Create a new empty bloom filter of size m with hashes k or + * provide buckets as a number[] or Int32Array to deserialize a bloom filter + * @param mOrBucketsArray number of bits (will be rounded up to nearest 32), or buckets + * to deserialize into a filled bloomfilter + * @param k number of hashes + */ + constructor(m: number | number[] | Int32Array, k: number); + /** + * Add a value to a bloom filter + * @param value + */ add(value: any): void; + /** + * Test whether a value exists in a bloom filter. (False positives are + * possible, false negatives are not.) + */ test(value: any): boolean; } diff --git a/types/bluebird-global/bluebird-global-tests.ts b/types/bluebird-global/bluebird-global-tests.ts index 0464b188cd..b6bbb915e2 100644 --- a/types/bluebird-global/bluebird-global-tests.ts +++ b/types/bluebird-global/bluebird-global-tests.ts @@ -40,3 +40,7 @@ function testPromiseRejection() { return value.toUpperCase(); }); } + +function testGithubTicket28081Regression() { + Promise.resolve([3]).map((n: number) => true); +} diff --git a/types/bluebird-global/index.d.ts b/types/bluebird-global/index.d.ts index 0d8ac4eeb3..7f38f981f1 100644 --- a/types/bluebird-global/index.d.ts +++ b/types/bluebird-global/index.d.ts @@ -67,52 +67,52 @@ declare global { * Patch all instance method */ interface Promise { - all: typeof Bluebird.prototype.all; - any: typeof Bluebird.prototype.any; - asCallback: typeof Bluebird.prototype.asCallback; - bind: typeof Bluebird.prototype.bind; - call: typeof Bluebird.prototype.call; - cancel: typeof Bluebird.prototype.cancel; - // catch: typeof Bluebird.prototype.catch; - caught: typeof Bluebird.prototype.caught; - delay: typeof Bluebird.prototype.delay; - disposer: typeof Bluebird.prototype.disposer; - done: typeof Bluebird.prototype.done; - each: typeof Bluebird.prototype.each; - error: typeof Bluebird.prototype.error; - filter: typeof Bluebird.prototype.filter; - // finally: typeof Bluebird.prototype.finally; - get: typeof Bluebird.prototype.get; - isCancelled: typeof Bluebird.prototype.isCancelled; - isFulfilled: typeof Bluebird.prototype.isFulfilled; - isPending: typeof Bluebird.prototype.isPending; - isRejected: typeof Bluebird.prototype.isRejected; - isResolved: typeof Bluebird.prototype.isResolved; - lastly: typeof Bluebird.prototype.lastly; - map: typeof Bluebird.prototype.map; - mapSeries: typeof Bluebird.prototype.mapSeries; - nodeify: typeof Bluebird.prototype.nodeify; - props: typeof Bluebird.prototype.props; - race: typeof Bluebird.prototype.race; - reason: typeof Bluebird.prototype.reason; - reduce: typeof Bluebird.prototype.reduce; - reflect: typeof Bluebird.prototype.reflect; - return: typeof Bluebird.prototype.return; - some: typeof Bluebird.prototype.some; - spread: typeof Bluebird.prototype.spread; - suppressUnhandledRejections: typeof Bluebird.prototype.suppressUnhandledRejections; - tap: typeof Bluebird.prototype.tap; - tapCatch: typeof Bluebird.prototype.tapCatch; - // then: typeof Bluebird.prototype.then; - thenReturn: typeof Bluebird.prototype.thenReturn; - thenThrow: typeof Bluebird.prototype.thenThrow; - catchReturn: typeof Bluebird.prototype.catchReturn; - catchThrow: typeof Bluebird.prototype.catchThrow; - throw: typeof Bluebird.prototype.throw; - timeout: typeof Bluebird.prototype.timeout; - toJSON: typeof Bluebird.prototype.toJSON; - toString: typeof Bluebird.prototype.toString; - value: typeof Bluebird.prototype.value; + all: Bluebird["all"]; + any: Bluebird["any"]; + asCallback: Bluebird["asCallback"]; + bind: Bluebird["bind"]; + call: Bluebird["call"]; + cancel: Bluebird["cancel"]; + // catch: Bluebird["catch"]; + caught: Bluebird["caught"]; + delay: Bluebird["delay"]; + disposer: Bluebird["disposer"]; + done: Bluebird["done"]; + each: Bluebird["each"]; + error: Bluebird["error"]; + filter: Bluebird["filter"]; + // finally: Bluebird["finally"]; + get: Bluebird["get"]; + isCancelled: Bluebird["isCancelled"]; + isFulfilled: Bluebird["isFulfilled"]; + isPending: Bluebird["isPending"]; + isRejected: Bluebird["isRejected"]; + isResolved: Bluebird["isResolved"]; + lastly: Bluebird["lastly"]; + map: Bluebird["map"]; + mapSeries: Bluebird["mapSeries"]; + nodeify: Bluebird["nodeify"]; + props: Bluebird["props"]; + race: Bluebird["race"]; + reason: Bluebird["reason"]; + reduce: Bluebird["reduce"]; + reflect: Bluebird["reflect"]; + return: Bluebird["return"]; + some: Bluebird["some"]; + spread: Bluebird["spread"]; + suppressUnhandledRejections: Bluebird["suppressUnhandledRejections"]; + tap: Bluebird["tap"]; + tapCatch: Bluebird["tapCatch"]; + // then: Bluebird["then"]; + thenReturn: Bluebird["thenReturn"]; + thenThrow: Bluebird["thenThrow"]; + catchReturn: Bluebird["catchReturn"]; + catchThrow: Bluebird["catchThrow"]; + throw: Bluebird["throw"]; + timeout: Bluebird["timeout"]; + toJSON: Bluebird["toJSON"]; + toString: Bluebird["toString"]; + value: Bluebird["value"]; /* * Copy&paste ::then and ::catch from lib.es2015.promise.d.ts, because Bluebird's typings are not diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index a11ae0257a..ac820290f2 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -9,6 +9,7 @@ // David Koblas // Bond Akinmade // Wuha Team +// Alec Brunelle // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/bull/v2/index.d.ts b/types/bull/v2/index.d.ts index 3c89655101..4ea3f82df7 100644 --- a/types/bull/v2/index.d.ts +++ b/types/bull/v2/index.d.ts @@ -54,6 +54,24 @@ declare module "bull" { * since pubsub does not give any guarantees. */ finished(): Promise; + + /** + * Moves a job to the `completed` queue. Pulls a job from 'waiting' to + * 'active' and returns a tuple containing the next jobs data and id. If no + * job is in the `waiting` queue, returns null. + * @param returnValue The jobs success message. + * @param ignoreLock True when wanting to ignore the redis lock on this job. + * @returns Contains the next jobs data and id or null if job left in 'waiting' queue. + */ + moveToCompleted(returnValue: string, ignoreLock: boolean): Promise; + + /** + * Moves a job to the failed queue. + * @param errorInfo The jobs error message. + * @param ignoreLock True when wanting to ignore the redis lock on this job. + * @returns void + */ + moveToFailed(errorInfo: ErrorMessage, ignoreLock: boolean): Promise; } export interface Backoff { @@ -204,7 +222,7 @@ declare module "bull" { * Returns a promise that will return the job instance associated with the jobId parameter. * If the specified job cannot be located, the promise callback parameter will be set to null. */ - getJob(jobId: string): Promise; + getJob(jobId: string): Promise; /** * Tells the queue remove all jobs created outside of a grace period in milliseconds. @@ -217,6 +235,18 @@ declare module "bull" { * 'ready', 'error', 'activ', 'progress', 'completed', 'failed', 'paused', 'resumed', 'cleaned' */ on(eventName: string, callback: EventCallback): void; + + /** + * Moves the next job from 'waiting' to 'active'. + * Sets the processedOn timestamp to the current datetime. + * @param jobId If specified, will move a specific job from 'waiting' to 'active', + * @returns Returns the job moved from waiting to active queue. + */ + getNextJob:(jobId?: string) => Promise; + } + + interface ErrorMessage { + message: string; } interface EventCallback { diff --git a/types/c3/c3-tests.ts b/types/c3/c3-tests.ts index f2e630cd09..6d7ea67287 100644 --- a/types/c3/c3-tests.ts +++ b/types/c3/c3-tests.ts @@ -452,6 +452,7 @@ function gauge_examples() { max: 100, units: " %", width: 10, + fullCircle: true, } }); } diff --git a/types/c3/index.d.ts b/types/c3/index.d.ts index 6c466458e3..0d94347ca3 100644 --- a/types/c3/index.d.ts +++ b/types/c3/index.d.ts @@ -276,6 +276,12 @@ export interface ChartConfiguration { * Set width of gauge chart. */ width?: number; + /** + * Whether this should be displayed + * as a full circle instead of a + * half circle. + */ + fullCircle?: boolean; }; spline?: { diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index 09230f6702..4e82fb9ff5 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -14,6 +14,7 @@ // Slavik Nychkalo // Francesco Benedetto // Alexandros Dorodoulis +// Manuel Heidrich // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -31,7 +32,7 @@ declare class Chart { stop: () => {}; resize: () => {}; clear: () => {}; - toBase64: () => string; + toBase64Image: () => string; generateLegend: () => {}; getElementAtEvent: (e: any) => {}; getElementsAtEvent: (e: any) => Array<{}>; diff --git a/types/chartmogul-node/chartmogul-node-tests.ts b/types/chartmogul-node/chartmogul-node-tests.ts new file mode 100644 index 0000000000..3a09a7597c --- /dev/null +++ b/types/chartmogul-node/chartmogul-node-tests.ts @@ -0,0 +1,277 @@ +import * as ChartMogul from 'chartmogul-node'; + +const config = new ChartMogul.Config("token", "secret", "baseURL"); +config.retries = 10; +config.getAccountToken(); // $ExpectType string +config.getSecretKey(); // $ExpectType string +config.VERSION; // $ExpectType string + +ChartMogul.Ping.ping(config); // $ExpectType Promise + +// $ExpectType Promise +ChartMogul.DataSource.create(config, { + name: "" +}); + +// $ExpectType Promise +ChartMogul.DataSource.retrieve(config, ""); + +// $ExpectType Promise<{}> +ChartMogul.DataSource.destroy(config, ""); + +// $ExpectType Promise +ChartMogul.DataSource.all(config, { + name: "" +}); + +ChartMogul.DataSource.all(config).then(data => { + data.data_sources[0]; // $ExpectType DataSource + data.data_sources[0].name; // $ExpectType string +}); + +// $ExpectType Promise +ChartMogul.Customer.create(config, { + data_source_uuid: "", + name: "", + external_id: "", + attributes: { + tags: ["important", "Prio1"], + custom: [ + {type: "String", key: "channel", value: "Facebook", source: "integration"}, + {type: "Integer", key: "age", value: 18} + ] + } +}); + +// $ExpectType Promise +ChartMogul.Customer.retrieve(config, ""); + +// $ExpectType Promise +ChartMogul.Customer.modify(config, "", {}); + +// $ExpectType Promise<{}> +ChartMogul.Customer.destroy(config, ""); + +// $ExpectType Promise> +ChartMogul.Customer.all(config, { + data_source_uuid: "" +}); + +ChartMogul.Customer.all(config).then(data => { + data.entries[0]; // $ExpectType Customer + data.entries[0].attributes!.stripe!['something']; // $ExpectType any + data.page!; // $ExpectType number +}); + +// $ExpectType Promise> +ChartMogul.Customer.search(config, { + email: "" +}); +// $ExpectType Promise<{}> +ChartMogul.Customer.merge(config, { + from: {customer_uuid: ""}, + into: {customer_uuid: ""} +}); +// $ExpectType Promise +ChartMogul.Customer.attributes(config, ""); + +// $ExpectType Promise +ChartMogul.Plan.create(config, { + data_source_uuid: "", + name: "", + interval_count: 1, + interval_unit: "", + external_id: "" +}); + +// $ExpectType Promise +ChartMogul.Plan.retrieve(config, ""); + +// $ExpectType Promise +ChartMogul.Plan.modify(config, "", { + name: "" +}); + +// $ExpectType Promise<{}> +ChartMogul.Plan.destroy(config, ""); + +ChartMogul.Plan.all(config, { + page: 1 +}).then(data => { + data.plans[0]; // $ExpectType Plan + data.plans[0].name!; // $ExpectType string + data.page!; // $ExpectType number +}); + +// $ExpectType Promise +ChartMogul.Invoice.retrieve(config, ""); + +// $ExpectType Promise +ChartMogul.Invoice.create(config, "", { + invoices: [ + { + external_id: "" + } + ] +}); + +// $ExpectType Promise<{}> +ChartMogul.Invoice.destroy(config, ""); +ChartMogul.Invoice.all(config, { + external_id: "" +}).then(data => { + data.invoices[0]; // $ExpectType Invoice + data.invoices[0].uuid!; // $ExpectType string + data.page!; // $ExpectType number +}); + +ChartMogul.Invoice.all(config, "", { + page: 1 +}).then(data => { + data.customer_uuid!; // $ExpectType string + data.invoices[0]; // $ExpectType Invoice + data.invoices[0].uuid!; // $ExpectType string + data.page!; // $ExpectType number +}); + +// $ExpectType Promise +ChartMogul.Transaction.create(config, "", { + type: "", + date: "", + result: "" +}); + +ChartMogul.Subscription.all(config, "", { + page: 1 +}).then(data => { + data.customer_uuid!; // $ExpectType string + data.subscriptions[0]; // $ExpectType Subscription + data.subscriptions[0].uuid; // $ExpectType string + data.current_page!; // $ExpectType number +}); + +ChartMogul.Subscription.cancel(config, "", { + cancelled_at: "" +}).then(data => { + data.customer_uuid; // $ExpectType string +}); + +// $ExpectType Promise> +ChartMogul.Tag.add(config, "", { + email: "", + tags: [""] +}); + +// $ExpectType Promise +ChartMogul.Tag.add(config, "", { + tags: [""] +}); + +// $ExpectType Promise +ChartMogul.Tag.remove(config, "", { + tags: [""] +}); + +// $ExpectType Promise +ChartMogul.CustomAttribute.add(config, "", { + custom: [ + {type: "", key: "", value: 0} + ] +}); +// $ExpectType Promise> +ChartMogul.CustomAttribute.add(config, "", { + email: "", + custom: [ + {type: "", key: "", value: 0} + ] +}); + +// $ExpectType Promise +ChartMogul.CustomAttribute.update(config, "", { + custom: { + pro: true, + channel: "" + } +}); + +ChartMogul.CustomAttribute.remove(config, "", { + custom: [""] +}).then(data => { + data.custom["key"]; // $ExpectType any +}); + +// $ExpectType Promise +ChartMogul.Metrics.all(config, { + 'start-date': '2015-01-01', + 'end-date': '2015-11-24', + interval: '', + geo: '', + plans: '' +}); + +// $ExpectType Promise> +ChartMogul.Metrics.mrr(config, { + 'start-date': '2015-01-01', + 'end-date': '2015-11-01' +}); + +// $ExpectType Promise> +ChartMogul.Metrics.arr(config, { + 'start-date': '2015-01-01', + 'end-date': '2015-11-01' +}); + +// $ExpectType Promise> +ChartMogul.Metrics.arpa(config, { + 'start-date': '2015-01-01', + 'end-date': '2015-11-01' +}); + +// $ExpectType Promise> +ChartMogul.Metrics.asp(config, { + 'start-date': '2015-01-01', + 'end-date': '2015-11-01' +}); + +// $ExpectType Promise> +ChartMogul.Metrics.customerCount(config, { + 'start-date': '2015-01-01', + 'end-date': '2015-11-01' +}); + +// $ExpectType Promise> +ChartMogul.Metrics.customerChurnRate(config, { + 'start-date': '2015-01-01', + 'end-date': '2015-11-01', + geo: '', + plans: '' +}); + +// $ExpectType Promise> +ChartMogul.Metrics.mrrChurnRate(config, { + 'start-date': '2015-01-01', + 'end-date': '2015-11-01' +}); + +ChartMogul.Metrics.ltv(config, { + 'start-date': '2015-01-01', + 'end-date': '2015-11-01' +}).then(data => { + data.entries[0].ltv; // $ExpectType number + data.summary; // $ExpectType Summary + data.summary.current; // $ExpectType number +}); + +// $ExpectType Promise> +ChartMogul.Metrics.Customer.subscriptions(config, "", { + page: 1 +}); + +ChartMogul.Metrics.Customer.activities(config, "", { + page: 1 +}).then(data => { + data.entries; // $ExpectType MetricsActivity[] + data.entries[0]; // $ExpectType MetricsActivity + data.entries[0]['activity-mrr']; // $ExpectType number + data.page!; // $ExpectType number +}); diff --git a/types/chartmogul-node/common.d.ts b/types/chartmogul-node/common.d.ts new file mode 100644 index 0000000000..ced10f98d7 --- /dev/null +++ b/types/chartmogul-node/common.d.ts @@ -0,0 +1,28 @@ +export interface Map { + [key: string]: any +} +export interface CursorParams { + page?: number; + per_page?: number; +} +export type Strings = string[]; + +export interface Cursor { + page?: number; + per_page?: number; + has_more?: boolean; + current_page?: number; + total_pages?: number; +} +export interface Entries extends Cursor { + entries: T[] +} +interface Summary { + current: number; + previous: number; + ['percentage-change']: number; +} +export interface EntriesSummary { + entries: T[]; + summary: Summary; +} \ No newline at end of file diff --git a/types/chartmogul-node/index.d.ts b/types/chartmogul-node/index.d.ts new file mode 100644 index 0000000000..c4bdce5aca --- /dev/null +++ b/types/chartmogul-node/index.d.ts @@ -0,0 +1,410 @@ +// Type definitions for chartmogul-node 1.0 +// Project: https://github.com/chartmogul/chartmogul-node +// Definitions by: ChartMogul +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Map, Cursor, CursorParams, Strings, Entries, EntriesSummary } from './common'; + +export class Config { + VERSION: string; + API_BASE: string; + retries: number; + + constructor(token: string, secret: string, base?: string); + getAccountToken(): string; + getSecretKey(): string; +} + +export namespace Ping { + function ping(config: Config): Promise; +} + +export namespace DataSource { + interface DataSource { + uuid?: string; + name: string; + created_at?: string; + status?: string; + system?: string; + } + interface DataSources { + data_sources: DataSource[]; + } + interface ListDataSourcesParams { + name?: string; + system?: string; + } + + function create(config: Config, data: DataSource): Promise; + function retrieve(config: Config, uuid: string): Promise; + function destroy(config: Config, uuid: string): Promise<{}>; + function all(config: Config, params?: ListDataSourcesParams): Promise; +} + +export namespace Customer { + interface Customer { + id?: number; + data_source_uuid?: string; + data_source_uuids?: Strings; + uuid?: string; + external_id?: string; + external_ids?: Strings; + name?: string; + email?: string; + status?: string; + ['customer-since']?: string; + attributes?: Attributes; + address?: { + address_zip?: string; + city?: string; + state?: string; + country?: string; + }; + mrr?: number; + arr?: number; + ['billing-system-url']?: string; + ['chartmogul-url']?: string; + ['billing-system-type']?: string; + currency?: string; + ['currency-sign']?: string; + company?: string; + country?: string; + state?: string; + city?: string; + zip?: string; + lead_created_at?: string; + free_trial_started_at?: string; + } + interface NewCustomer { + data_source_uuid: string; + external_id: string; + name: string; + email?: string; + company?: string; + country?: string; + state?: string; + city?: string; + zip?: string; + lead_created_at?: string; + free_trial_started_at?: string; + attributes?: NewAttributes; + } + interface UpdateCustomer { + name?: string; + email?: string; + company?: string; + country?: string; + state?: string; + city?: string; + zip?: string; + lead_created_at?: string; + free_trial_started_at?: string; + attributes?: NewAttributes; + } + interface NewAttributes { + tags?: Strings; + custom?: NewCustomAttributes[]; + } + interface NewCustomAttributes { + type?: string; + key: string; + value: any; + source?: string; + } + interface Attributes { + tags?: Strings; + stripe?: Map; + clearbit?: Map; + custom?: Map; + } + interface ListCustomersParams extends CursorParams { + data_source_uuid?: string; + status?: string; + system?: string; + external_id?: string; + } + interface SearchCustomersParams extends CursorParams { + email: string; + } + interface MergeID { + customer_uuid?: string; + external_id?: string; + } + interface MergeCustomersParams { + from: MergeID; + into: MergeID; + } + + function create(config: Config, data: NewCustomer): Promise; + function retrieve(config: Config, uuid: string): Promise; + function modify(config: Config, uuid: string, data: UpdateCustomer): Promise; + function destroy(config: Config, uuid: string): Promise<{}>; + function all(config: Config, params?: ListCustomersParams): Promise>; + function search(config: Config, params?: SearchCustomersParams): Promise>; + function merge(config: Config, params?: MergeCustomersParams): Promise<{}>; + function attributes(config: Config, uuid: string): Promise; +} + +export namespace Plan { + interface Plan { + uuid?: string; + data_source_uuid?: string; + external_id?: string; + name?: string; + interval_count?: number; + interval_unit?: string; + } + interface ListPlansParams extends CursorParams { + data_source_uuid?: string; + system?: string; + external_id?: string; + } + interface Plans extends Cursor { + plans: Plan[]; + } + + function create(config: Config, data: Plan): Promise; + function retrieve(config: Config, uuid: string): Promise; + function modify(config: Config, uuid: string, data: Plan): Promise; + function destroy(config: Config, uuid: string): Promise<{}>; + function all(config: Config, params?: ListPlansParams): Promise; +} + +export namespace Invoice { + interface Invoice { + uuid?: string; + customer_uuid?: string; + currency?: string; + data_source_uuid?: string; + date?: string; + due_date?: string; + external_id?: string; + line_items?: LineItem[]; + transactions?: Transaction[]; + } + interface LineItem { + uuid?: string; + account_code?: string; + amount_in_cents?: number; + cancelled_at?: string; + description?: string; + discount_amount_in_cents?: number; + discount_code?: string; + external_id?: string; + plan_uuid?: string; + prorated?: boolean; + quantity?: number; + service_period_end?: string; + service_period_start?: string; + subscription_external_id?: string; + subscription_uuid?: string; + tax_amount_in_cents?: number; + transaction_fees_in_cents?: number; + type?: string; + } + interface Transaction { + uuid?: string; + date?: string; + external_id?: string; + result?: string; + type?: string; + } + interface ListInvoicesParams extends CursorParams { + data_source_uuid?: string; + customer_uuid?: string; + external_id?: string; + } + interface Invoices extends Cursor { + customer_uuid?: string; + invoices: Invoice[]; + } + + function create(config: Config, uuid: string, data: { + invoices: Invoice[] + }): Promise; + function retrieve(config: Config, uuid: string): Promise; + function destroy(config: Config, uuid: string): Promise<{}>; + function all(config: Config, uuid: string, params?: ListInvoicesParams): Promise; + function all(config: Config, params?: ListInvoicesParams): Promise; +} + +export namespace Transaction { + interface Transaction { + uuid?: string; + date: string; + external_id?: string; + result: string; + type: string; + } + + function create(config: Config, uuid: string, data: Transaction): Promise; +} + +export namespace Subscription { + interface Subscription { + uuid: string; + external_id: string; + customer_uuid: string; + plan_uuid: string; + cancellation_dates: Strings; + data_source_uuid: string; + } + interface CancelSubscriptionParams { + cancelled_at?: string; + cancellation_dates?: Strings; + } + interface Subscriptions extends Cursor { + customer_uuid?: string; + subscriptions: Subscription[]; + } + + function all(config: Config, uuid: string, data: CursorParams): Promise; + function cancel(config: Config, uuid: string, data: CancelSubscriptionParams): Promise; +} + +export namespace Tag { + interface Tags { + tags: Strings; + } + interface TagsWithEmail { + email: string; + tags: Strings; + } + function add(config: Config, uuid: string, data: TagsWithEmail): Promise>; + function add(config: Config, uuid: string, data: Tags): Promise; + function remove(config: Config, uuid: string, data: Tags): Promise; +} + +export namespace CustomAttribute { + import NewCustomAttributes = Customer.NewCustomAttributes; + + interface CustomAttributes { + custom: Map; + } + function add(config: Config, uuid: string, data: { + email: string; + custom: NewCustomAttributes[]; + }): Promise>; + function add(config: Config, uuid: string, data: { + custom: NewCustomAttributes[]; + }): Promise; + function update(config: Config, uuid: string, data: CustomAttributes): Promise; + function remove(config: Config, uuid: string, data: { + custom: Strings; + }): Promise; +} + +export namespace Metrics { + interface Params extends ParamsNoInterval { + interval?: string; + } + interface ParamsNoInterval { + ['start-date']: string; + ['end-date']: string; + geo?: string; + plans?: string; + } + interface All { + entries: { + date: string; + ['customer-churn-rate']: number; + ['mrr-churn-rate']: number; + ltv: number; + customers: number; + asp: number; + arpa: number; + arr: number; + mrr: number; + }; + } + + interface MRR { + date: string; + mrr: number; + ['mrr-new-business']: number; + ['mrr-expansion']: number; + ['mrr-contraction']: number; + ['mrr-churn']: number; + ['mrr-reactivation']: number; + } + interface ARR { + date: string; + arr: number; + } + interface ARPA { + date: string; + arpa: number; + } + interface ASP { + date: string; + asp: number; + } + interface CustomerCount { + date: string; + customers: number; + } + interface CustomerChurnRate { + date: string; + ['customer-churn-rate']: number; + } + interface MRRChurnRate { + date: string; + ['mrr-churn-rate']: number; + } + interface LTV { + date: string; + ltv: number; + } + + function all(config: Config, params: Params): Promise; + function mrr(config: Config, params: Params): Promise>; + function arr(config: Config, params: Params): Promise>; + function asp(config: Config, params: Params): Promise>; + function arpa(config: Config, params: Params): Promise>; + function customerCount(config: Config, params: Params): Promise>; + function customerChurnRate(config: Config, params: ParamsNoInterval): Promise>; + function mrrChurnRate(config: Config, params: ParamsNoInterval): Promise>; + function ltv(config: Config, params: ParamsNoInterval): Promise>; + + namespace Customer { + interface MetricsSubscription { + id: number; + external_id: string; + plan: string; + quantity: number; + mrr: number; + arr: number; + status: string; + ['billing-cycle']: string; + ['billing-cycle-count']: number; + ['start-date']: string; + ['end-date']: string; + currency: string; + ['currency-sign']: string; + } + interface MetricsActivity { + id: number; + date: string; + ['activity-arr']: number; + ['activity-mrr']: number; + ['activity-mrr-movement']: number; + currency: string; + ['currency-sign']: string; + description: string; + type: string; + } + + function subscriptions(config: Config, uuid: string, params?: CursorParams): Promise>; + function activities(config: Config, uuid: string, params?: CursorParams): Promise>; + } +} + +export class ChartMogulError extends Error { + response: any; + httpStatus: number; +} +export class ConfigurationError extends ChartMogulError {} +export class ForbiddenError extends ChartMogulError {} +export class NotFoundError extends ChartMogulError {} +export class ResourceInvalidError extends ChartMogulError {} +export class SchemaInvalidError extends ChartMogulError {} diff --git a/types/chartmogul-node/tsconfig.json b/types/chartmogul-node/tsconfig.json new file mode 100644 index 0000000000..3b24d48da8 --- /dev/null +++ b/types/chartmogul-node/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", + "chartmogul-node-tests.ts" + ] +} diff --git a/types/chartmogul-node/tslint.json b/types/chartmogul-node/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/chartmogul-node/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/cheerio/index.d.ts b/types/cheerio/index.d.ts index d264f4b8da..cb8031705e 100644 --- a/types/cheerio/index.d.ts +++ b/types/cheerio/index.d.ts @@ -214,6 +214,7 @@ interface CheerioOptionsInterface { recognizeCDATA?: boolean; recognizeSelfClosing?: boolean; normalizeWhitespace?: boolean; + ignoreWhitespace?: boolean; } interface CheerioSelector { diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index 6dbf118947..49f079e159 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -4959,6 +4959,7 @@ declare namespace chrome.runtime { export interface ConnectInfo { name?: string; + includeTlsChannelId?: boolean; } export interface InstalledDetails { diff --git a/types/codemirror/index.d.ts b/types/codemirror/index.d.ts index 6dbfef6e60..5ece4f497e 100644 --- a/types/codemirror/index.d.ts +++ b/types/codemirror/index.d.ts @@ -15,7 +15,7 @@ declare function CodeMirror(callback: (host: HTMLElement) => void , options?: Co declare namespace CodeMirror { export var Doc : CodeMirror.DocConstructor; export var Pos: CodeMirror.PositionConstructor; - export var Pass: any; + export var Pass: {toString(): "CodeMirror.PASS"}; function countColumn(line: string, index: number | null, tabSize: number): number; function fromTextArea(host: HTMLTextAreaElement, options?: EditorConfiguration): CodeMirror.EditorFromTextArea; @@ -129,6 +129,10 @@ declare namespace CodeMirror { state: any; } + interface KeyMap { + [keyName: string]: false | string | ((instance: Editor) => void | typeof Pass); + } + interface Editor { /** Tells you whether the editor currently has focus. */ @@ -159,11 +163,11 @@ declare namespace CodeMirror { Maps added in this way have a higher precedence than the extraKeys and keyMap options, and between them, the maps added earlier have a lower precedence than those added later, unless the bottom argument was passed, in which case they end up below other keymaps added with this method. */ - addKeyMap(map: any, bottom?: boolean): void; + addKeyMap(map: string | KeyMap, bottom?: boolean): void; /** Disable a keymap added with addKeyMap.Either pass in the keymap object itself , or a string, which will be compared against the name property of the active keymaps. */ - removeKeyMap(map: any): void; + removeKeyMap(map: string | KeyMap): void; /** Enable a highlighting overlay.This is a stateless mini - mode that can be used to add extra highlighting. For example, the search add - on uses it to highlight the term that's currently being searched. @@ -716,8 +720,9 @@ declare namespace CodeMirror { } interface EditorChangeCancellable extends CodeMirror.EditorChange { - /** may be used to modify the change. All three arguments to update are optional, and can be left off to leave the existing value for that field intact. */ - update(from?: CodeMirror.Position, to?: CodeMirror.Position, text?: string[]): void; + /** may be used to modify the change. All three arguments to update are optional, and can be left off to leave the existing value for that field intact. + If the change came from undo/redo, `update` is undefined and the change cannot be modified. */ + update?(from?: CodeMirror.Position, to?: CodeMirror.Position, text?: string[]): void; cancel(): void; } @@ -780,7 +785,7 @@ declare namespace CodeMirror { keyMap?: string; /** Can be used to specify extra keybindings for the editor, alongside the ones defined by keyMap. Should be either null, or a valid keymap value. */ - extraKeys?: any; + extraKeys?: string | KeyMap; /** Whether CodeMirror should scroll or wrap for long lines. Defaults to false (scroll). */ lineWrapping?: boolean; diff --git a/types/codemirror/test/index.ts b/types/codemirror/test/index.ts index 39c601f159..bd2aefac88 100644 --- a/types/codemirror/test/index.ts +++ b/types/codemirror/test/index.ts @@ -4,7 +4,18 @@ var myCodeMirror: CodeMirror.Editor = CodeMirror(document.body); var myCodeMirror2: CodeMirror.Editor = CodeMirror(document.body, { value: "function myScript(){return 100;}\n", - mode: "javascript" + mode: "javascript", + extraKeys: { + Enter: (cm) => { console.log("save"); }, + Esc: (cm) => { return CodeMirror.Pass; } + } +}); + +// $ExpectError +var myCodeMirror2_1: CodeMirror.Editor = CodeMirror(document.body, { + extraKeys: { + "Shift-Enter": (cm) => { return 42; } // not a valid return value + } }); var range = myCodeMirror2.findWordAt(CodeMirror.Pos(0, 2)); @@ -13,9 +24,9 @@ var head = range.head; var from = range.from(); var to = range.to(); -var myTextArea: HTMLTextAreaElement; +var myTextArea: HTMLTextAreaElement = undefined!; var myCodeMirror3: CodeMirror.Editor = CodeMirror(function (elt) { - myTextArea.parentNode.replaceChild(elt, myTextArea); + myTextArea.parentNode!.replaceChild(elt, myTextArea); }, { value: myTextArea.value }); var myCodeMirror4: CodeMirror.Editor = CodeMirror.fromTextArea(myTextArea); @@ -67,6 +78,15 @@ myCodeMirror.on( (instance: CodeMirror.Editor, line: CodeMirror.LineHandle, element: HTMLElement) => { } ); +myCodeMirror.on( + "beforeChange", + (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeCancellable) => { + // $ExpectError + change.update(); + if (change.update != null) change.update(); + } +); + CodeMirror.registerHelper("lint", "javascript", {}); myCodeMirror.isReadOnly(); diff --git a/types/codemirror/tsconfig.json b/types/codemirror/tsconfig.json index 2ff349d98e..a2c6a52430 100644 --- a/types/codemirror/tsconfig.json +++ b/types/codemirror/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/copy-webpack-plugin/index.d.ts b/types/copy-webpack-plugin/index.d.ts index eedf42f450..59c1b8d0cb 100644 --- a/types/copy-webpack-plugin/index.d.ts +++ b/types/copy-webpack-plugin/index.d.ts @@ -61,7 +61,7 @@ interface CopyWebpackPluginConfiguration { } interface CopyWebpackPlugin { - new (patterns?: CopyPattern[], options?: CopyWebpackPluginConfiguration): Plugin + new (patterns?: (string | CopyPattern)[], options?: CopyWebpackPluginConfiguration): Plugin } declare const copyWebpackPlugin: CopyWebpackPlugin diff --git a/types/d3-hierarchy/d3-hierarchy-tests.ts b/types/d3-hierarchy/d3-hierarchy-tests.ts index b75b9fbbd0..16b372993d 100644 --- a/types/d3-hierarchy/d3-hierarchy-tests.ts +++ b/types/d3-hierarchy/d3-hierarchy-tests.ts @@ -13,8 +13,10 @@ import * as d3Hierarchy from 'd3-hierarchy'; // ----------------------------------------------------------------------- let num: number; +let numOrUndefined: number | undefined; let size: [number, number]; -let idString: string; +let sizeOrNull: [number, number] | null; +let idString: string | undefined; // ----------------------------------------------------------------------- // Hierarchy @@ -47,16 +49,20 @@ let hierarchyRootDatum: HierarchyDatum = { ] }; -let hierarchyNodeArray: Array>; +let hierarchyNodeArray: Array> = []; +let hierarchyNodeArrayOrUndefined: Array> | undefined; let hierarchyNode: d3Hierarchy.HierarchyNode; -let hierarchyPointNodeArray: Array>; +let hierarchyPointNodeArray: Array> = []; +let hierarchyPointNodeArrayOrUndefined: Array> | undefined; let hierarchyPointNode: d3Hierarchy.HierarchyPointNode; -let hierarchyRectangularNodeArray: Array>; +let hierarchyRectangularNodeArray: Array> = []; +let hierarchyRectangularNodeArrayOrUndefined: Array> | undefined; let hierarchyRectangularNode: d3Hierarchy.HierarchyRectangularNode; -let hierarchyCircularNodeArray: Array>; +let hierarchyCircularNodeArray: Array> = []; +let hierarchyCircularNodeArrayOrUndefined: Array> | undefined; let hierarchyCircularNode: d3Hierarchy.HierarchyCircularNode; // Create Hierarchy Layout Root Node ===================================== @@ -65,6 +71,10 @@ let hierarchyRootNode: d3Hierarchy.HierarchyNode; hierarchyRootNode = d3Hierarchy.hierarchy(hierarchyRootDatum); +hierarchyRootNode = d3Hierarchy.hierarchy(hierarchyRootDatum, (d) => { + return d.children; +}); + hierarchyRootNode = d3Hierarchy.hierarchy(hierarchyRootDatum, (d) => { return d.children || null; }); @@ -79,10 +89,11 @@ num = hierarchyRootNode.height; // children, parent ------------------------------------------------------ -hierarchyNodeArray = hierarchyRootNode.children; +hierarchyNodeArrayOrUndefined = hierarchyRootNode.children; -let parentNode: d3Hierarchy.HierarchyNode; +let parentNode: d3Hierarchy.HierarchyNode | null; parentNode = hierarchyNodeArray.length ? hierarchyNodeArray[0].parent : null; +parentNode = hierarchyNodeArray[0].parent; // id -------------------------------------------------------------------- @@ -93,17 +104,17 @@ idString = hierarchyRootNode.id; const ancestors: Array> = hierarchyRootNode.ancestors(); const descendants: Array> = hierarchyRootNode.descendants(); -// leaves() --------------------------------------------------------------- +// leaves() -------------------------------------------------------------- hierarchyNodeArray = hierarchyRootNode.leaves(); -// path() ------------------------------------------------------------------- +// path() ---------------------------------------------------------------- hierarchyNode = descendants[descendants.length - 1]; const path: Array> = hierarchyRootNode.path(hierarchyNode); -// links() and HierarchyLink<...> ------------------------------------------ +// links() and HierarchyLink<...> ---------------------------------------- let links: Array>; @@ -115,26 +126,26 @@ link = links[0]; hierarchyNode = link.source; hierarchyNode = link.target; -// sum() and value ---------------------------------------------------------- +// sum() and value ------------------------------------------------------- hierarchyRootNode = hierarchyRootNode.sum((d) => d.val); -num = hierarchyRootNode.value; +numOrUndefined = hierarchyRootNode.value; -// count() and value ---------------------------------------------------------- +// count() and value ----------------------------------------------------- hierarchyRootNode = hierarchyRootNode.count(); -num = hierarchyRootNode.value; +numOrUndefined = hierarchyRootNode.value; -// sort --------------------------------------------------------------------- +// sort ------------------------------------------------------------------ hierarchyRootNode = hierarchyRootNode.sort((a, b) => { console.log('Raw values in data of a and b:', a.data.val, ' and ', b.data.val); // a and b are of type HierarchyNode - return b.height - a.height || b.value - a.value; + return b.height - a.height || b.value! - a.value!; }); -// each(), eachAfter(), eachBefore() ---------------------------------------- +// each(), eachAfter(), eachBefore() ------------------------------------- hierarchyRootNode = hierarchyRootNode.each((node) => { console.log('Raw value of node:', node.data.val); // node type is HierarchyNode @@ -151,7 +162,7 @@ hierarchyRootNode = hierarchyRootNode.eachBefore((node) => { console.log('Aggregated value of node:', node.value); // node type is HierarchyNode }); -// copy() -------------------------------------------------------------------- +// copy() ---------------------------------------------------------------- let copiedHierarchyNode: d3Hierarchy.HierarchyNode; copiedHierarchyNode = hierarchyRootNode.copy(); @@ -161,12 +172,12 @@ copiedHierarchyNode = hierarchyRootNode.copy(); // ----------------------------------------------------------------------- interface HierarchyDatumWithParentId extends HierarchyDatum { - parentId: string; + parentId: string | null; } interface TabularHierarchyDatum { name: string; - parentId: string; + parentId: string | null; val: number; } @@ -178,7 +189,7 @@ tabularData = [ { name: 'n121', parentId: 'n12', val: 30 } ]; -let idStringAccessor: (d: TabularHierarchyDatum, i?: number, data?: TabularHierarchyDatum[]) => (string | null | '' | undefined); +let idStringAccessor: (d: TabularHierarchyDatum, i: number, data: TabularHierarchyDatum[]) => (string | null | '' | undefined); // Create Stratify Operator --------------------------------------------- @@ -217,7 +228,8 @@ idStringAccessor = stratificatorizer.parentId(); // Use Stratify Operator ------------------------------------------------ -const stratifiedRootNode: d3Hierarchy.HierarchyNode = stratificatorizer(tabularData); +const stratifiedRootNode: d3Hierarchy.HierarchyNode = stratificatorizer(tabularData); +const pId: string | null = stratifiedRootNode.data.parentId; // ----------------------------------------------------------------------- // Cluster @@ -235,12 +247,12 @@ clusterLayout = d3Hierarchy.cluster(); clusterLayout = clusterLayout.size([200, 200]); -size = clusterLayout.size(); +sizeOrNull = clusterLayout.size(); // nodeSize() ------------------------------------------------------------ clusterLayout = clusterLayout.nodeSize([10, 10]); -size = clusterLayout.nodeSize(); +sizeOrNull = clusterLayout.nodeSize(); // separation() ---------------------------------------------------------- @@ -272,10 +284,11 @@ num = clusterRootNode.height; // children, parent ------------------------------------------------------ -hierarchyPointNodeArray = clusterRootNode.children; +hierarchyPointNodeArrayOrUndefined = clusterRootNode.children; -let parentPointNode: d3Hierarchy.HierarchyPointNode; +let parentPointNode: d3Hierarchy.HierarchyPointNode | null; parentPointNode = hierarchyPointNodeArray.length ? hierarchyPointNodeArray[0].parent : null; +parentPointNode = hierarchyPointNodeArray[0].parent; // id -------------------------------------------------------------------- @@ -286,17 +299,17 @@ idString = clusterRootNode.id; const pointNodeAncestors: Array> = clusterRootNode.ancestors(); const pointNodeDescendants: Array> = clusterRootNode.descendants(); -// leaves() --------------------------------------------------------------- +// leaves() -------------------------------------------------------------- hierarchyPointNodeArray = clusterRootNode.leaves(); -// path() ------------------------------------------------------------------- +// path() ---------------------------------------------------------------- hierarchyPointNode = pointNodeDescendants[pointNodeDescendants.length - 1]; const clusterPath: Array> = clusterRootNode.path(hierarchyPointNode); -// links() and HierarchyPointLink<...> ------------------------------------------ +// links() and HierarchyPointLink<...> ----------------------------------- let pointLinks: Array>; @@ -308,27 +321,27 @@ pointLink = pointLinks[0]; hierarchyPointNode = pointLink.source; hierarchyPointNode = pointLink.target; -// sum() and value ---------------------------------------------------------- +// sum() and value ------------------------------------------------------- clusterRootNode = clusterRootNode.sum((d) => d.val); -num = clusterRootNode.value; +numOrUndefined = clusterRootNode.value; -// count() and value ---------------------------------------------------------- +// count() and value ----------------------------------------------------- clusterRootNode = clusterRootNode.count(); -num = clusterRootNode.value; +numOrUndefined = clusterRootNode.value; -// sort --------------------------------------------------------------------- +// sort ------------------------------------------------------------------ clusterRootNode = clusterRootNode.sort((a, b) => { console.log('x-coordinates of a:', a.x, ' and b:', b.x); // a and b are of type HierarchyPointNode console.log('Raw values in data of a and b:', a.data.val, ' and ', b.data.val); // a and b are of type HierarchyPointNode - return b.height - a.height || b.value - a.value; + return b.height - a.height || b.value! - a.value!; }); -// each(), eachAfter(), eachBefore() ---------------------------------------- +// each(), eachAfter(), eachBefore() ------------------------------------- clusterRootNode = clusterRootNode.each((node) => { console.log('ParentId:', node.data.parentId); // node type is HierarchyPointNode @@ -345,7 +358,7 @@ clusterRootNode = clusterRootNode.eachBefore((node) => { console.log('X-coordinate of node:', node.x); // node type is HierarchyPointNode }); -// copy() -------------------------------------------------------------------- +// copy() ---------------------------------------------------------------- let copiedClusterNode: d3Hierarchy.HierarchyPointNode; copiedClusterNode = clusterRootNode.copy(); @@ -354,24 +367,24 @@ copiedClusterNode = clusterRootNode.copy(); // Tree // ----------------------------------------------------------------------- -// Create tree layout generator ======================================= +// Create tree layout generator ========================================== let treeLayout: d3Hierarchy.TreeLayout; treeLayout = d3Hierarchy.tree(); -// Configure tree layout generator ==================================== +// Configure tree layout generator ======================================= // size() ---------------------------------------------------------------- treeLayout = treeLayout.size([200, 200]); -size = treeLayout.size(); +sizeOrNull = treeLayout.size(); // nodeSize() ------------------------------------------------------------ treeLayout = treeLayout.nodeSize([10, 10]); -size = treeLayout.nodeSize(); +sizeOrNull = treeLayout.nodeSize(); // separation() ---------------------------------------------------------- @@ -424,13 +437,13 @@ treemapLayout = treemapLayout.size([400, 200]); size = treemapLayout.size(); -// round() ------------------------------------------------------------ +// round() --------------------------------------------------------------- treemapLayout = treemapLayout.round(true); let roundFlag: boolean = treemapLayout.round(); -// padding() ---------------------------------------------------------------- +// padding() ------------------------------------------------------------- treemapLayout = treemapLayout.padding(1); treemapLayout = treemapLayout.padding((node) => { @@ -440,7 +453,7 @@ treemapLayout = treemapLayout.padding((node) => { numberRectangularNodeAccessor = treemapLayout.padding(); -// paddingInner() ---------------------------------------------------------------- +// paddingInner() -------------------------------------------------------- treemapLayout = treemapLayout.paddingInner(1); treemapLayout = treemapLayout.paddingInner((node) => { @@ -450,7 +463,7 @@ treemapLayout = treemapLayout.paddingInner((node) => { numberRectangularNodeAccessor = treemapLayout.paddingInner(); -// paddingOuter() ---------------------------------------------------------------- +// paddingOuter() -------------------------------------------------------- treemapLayout = treemapLayout.paddingOuter(1); treemapLayout = treemapLayout.paddingOuter((node) => { @@ -460,7 +473,7 @@ treemapLayout = treemapLayout.paddingOuter((node) => { numberRectangularNodeAccessor = treemapLayout.paddingOuter(); -// paddingTop() ---------------------------------------------------------------- +// paddingTop() ---------------------------------------------------------- treemapLayout = treemapLayout.paddingTop(1); treemapLayout = treemapLayout.paddingTop((node) => { @@ -470,7 +483,7 @@ treemapLayout = treemapLayout.paddingTop((node) => { numberRectangularNodeAccessor = treemapLayout.paddingTop(); -// paddingRight() ---------------------------------------------------------------- +// paddingRight() -------------------------------------------------------- treemapLayout = treemapLayout.paddingRight(1); treemapLayout = treemapLayout.paddingRight((node) => { @@ -480,7 +493,7 @@ treemapLayout = treemapLayout.paddingRight((node) => { numberRectangularNodeAccessor = treemapLayout.paddingRight(); -// paddingBottom() ---------------------------------------------------------------- +// paddingBottom() ------------------------------------------------------- treemapLayout = treemapLayout.paddingBottom(1); treemapLayout = treemapLayout.paddingBottom((node) => { @@ -490,7 +503,7 @@ treemapLayout = treemapLayout.paddingBottom((node) => { numberRectangularNodeAccessor = treemapLayout.paddingBottom(); -// paddingLeft() ---------------------------------------------------------------- +// paddingLeft() --------------------------------------------------------- treemapLayout = treemapLayout.paddingLeft(1); treemapLayout = treemapLayout.paddingLeft((node) => { @@ -530,7 +543,7 @@ tilingFactoryFn = d3Hierarchy.treemapResquarify.ratio(2); treemapLayout.tile(d3Hierarchy.treemapResquarify.ratio(2)); -// Use HierarchyRectangularNode ================================================ +// Use HierarchyRectangularNode ========================================== // x and y coordinates --------------------------------------------------- @@ -547,10 +560,11 @@ num = treemapRootNode.height; // children, parent ------------------------------------------------------ -hierarchyRectangularNodeArray = treemapRootNode.children; +hierarchyRectangularNodeArrayOrUndefined = treemapRootNode.children; -let parentRectangularNode: d3Hierarchy.HierarchyRectangularNode; +let parentRectangularNode: d3Hierarchy.HierarchyRectangularNode | null; parentRectangularNode = hierarchyRectangularNodeArray.length ? hierarchyRectangularNodeArray[0].parent : null; +parentRectangularNode = hierarchyRectangularNodeArray[0].parent; // id -------------------------------------------------------------------- @@ -561,17 +575,17 @@ idString = treemapRootNode.id; const rectangularNodeAncestors: Array> = treemapRootNode.ancestors(); const rectangularNodeDescendants: Array> = treemapRootNode.descendants(); -// leaves() --------------------------------------------------------------- +// leaves() -------------------------------------------------------------- hierarchyRectangularNodeArray = treemapRootNode.leaves(); -// path() ------------------------------------------------------------------- +// path() ---------------------------------------------------------------- hierarchyRectangularNode = rectangularNodeDescendants[rectangularNodeDescendants.length - 1]; const treemapPath: Array> = treemapRootNode.path(hierarchyRectangularNode); -// links() and HierarchyRectangularLink<...> ------------------------------------------ +// links() and HierarchyRectangularLink<...> ----------------------------- let rectangularLinks: Array>; @@ -583,26 +597,26 @@ rectangularLink = rectangularLinks[0]; hierarchyRectangularNode = rectangularLink.source; hierarchyRectangularNode = rectangularLink.target; -// sum() and value ---------------------------------------------------------- +// sum() and value ------------------------------------------------------- treemapRootNode = treemapRootNode.sum((d) => d.val); -num = treemapRootNode.value; +numOrUndefined = treemapRootNode.value; -// count() and value ---------------------------------------------------------- +// count() and value ----------------------------------------------------- treemapRootNode = treemapRootNode.count(); -num = treemapRootNode.value; -// sort --------------------------------------------------------------------- +numOrUndefined = treemapRootNode.value; +// sort ------------------------------------------------------------------ treemapRootNode = treemapRootNode.sort((a, b) => { console.log('x0-coordinates of a:', a.x0, ' and b:', b.x0); // a and b are of type HierarchyRectangularNode console.log('Raw values in data of a and b:', a.data.val, ' and ', b.data.val); // a and b are of type HierarchyRectangularNode - return b.height - a.height || b.value - a.value; + return b.height - a.height || b.value! - a.value!; }); -// each(), eachAfter(), eachBefore() ---------------------------------------- +// each(), eachAfter(), eachBefore() ------------------------------------- treemapRootNode = treemapRootNode.each((node) => { console.log('ParentId:', node.data.parentId); // node type is HierarchyRectangularNode @@ -619,7 +633,7 @@ treemapRootNode = treemapRootNode.eachBefore((node) => { console.log('X0-coordinate of node:', node.x0); // node type is HierarchyRectangularNode }); -// copy() -------------------------------------------------------------------- +// copy() ---------------------------------------------------------------- let copiedTreemapNode: d3Hierarchy.HierarchyRectangularNode; copiedTreemapNode = treemapRootNode.copy(); @@ -628,13 +642,13 @@ copiedTreemapNode = treemapRootNode.copy(); // Partition // ----------------------------------------------------------------------- -// Create partition layout generator ======================================= +// Create partition layout generator ===================================== let partitionLayout: d3Hierarchy.PartitionLayout; partitionLayout = d3Hierarchy.partition(); -// Configure partition layout generator ==================================== +// Configure partition layout generator ================================== // size() ---------------------------------------------------------------- @@ -642,19 +656,19 @@ partitionLayout = partitionLayout.size([400, 200]); size = partitionLayout.size(); -// round() ------------------------------------------------------------ +// round() --------------------------------------------------------------- partitionLayout = partitionLayout.round(true); roundFlag = partitionLayout.round(); -// padding() ---------------------------------------------------------------- +// padding() ------------------------------------------------------------- partitionLayout = partitionLayout.padding(1); num = partitionLayout.padding(); -// Use partition layout generator ========================================== +// Use partition layout generator ======================================== let partitionRootNode: d3Hierarchy.HierarchyRectangularNode; @@ -664,15 +678,17 @@ partitionRootNode = partitionLayout(stratifiedRootNode); // Pack // ----------------------------------------------------------------------- -let numberCircularNodeAccessor: (node: d3Hierarchy.HierarchyCircularNode) => number; +type CircularAccessor = (node: d3Hierarchy.HierarchyCircularNode) => number; +let numberCircularNodeAccessor: CircularAccessor; +let numberCircularNodeAccessorOrNull: CircularAccessor | null; -// Create pack layout generator ======================================= +// Create pack layout generator ========================================== let packLayout: d3Hierarchy.PackLayout; packLayout = d3Hierarchy.pack(); -// Configure pack layout generator ==================================== +// Configure pack layout generator ======================================= // size() ---------------------------------------------------------------- @@ -680,37 +696,39 @@ packLayout = packLayout.size([400, 400]); size = packLayout.size(); -// radius() ------------------------------------------------------------ +// radius() -------------------------------------------------------------- + +packLayout = packLayout.radius(null); packLayout = packLayout.radius((node) => { console.log('Radius property of node before completing accessor: ', node.r); // node is of type HierarchyCircularNode console.log('Parent id of node: ', node.data.parentId); // node is of type HierarchyCircularNode - return node.value; + return node.value!; }); -numberCircularNodeAccessor = packLayout.radius(); +numberCircularNodeAccessorOrNull = packLayout.radius(); -// padding() ---------------------------------------------------------------- +// padding() ------------------------------------------------------------- packLayout = packLayout.padding(1); packLayout = packLayout.padding((node) => { console.log('Radius property of node: ', node.r); // node is of type HierarchyCircularNode console.log('Parent id of node: ', node.data.parentId); // node is of type HierarchyCircularNode - return node.value > 10 ? 2 : 1; + return node.value! > 10 ? 2 : 1; }); numberCircularNodeAccessor = packLayout.padding(); -// Use partition layout generator ========================================== +// Use partition layout generator ======================================== let packRootNode: d3Hierarchy.HierarchyCircularNode; packRootNode = packLayout(stratifiedRootNode); -// Use HierarchyCircularNode ================================================ +// Use HierarchyCircularNode ============================================= -// x and y coordinates and radius r ------------------------------------------ +// x and y coordinates and radius r -------------------------------------- num = packRootNode.x; num = packRootNode.y; @@ -724,10 +742,11 @@ num = packRootNode.height; // children, parent ------------------------------------------------------ -hierarchyCircularNodeArray = packRootNode.children; +hierarchyCircularNodeArrayOrUndefined = packRootNode.children; -let parentCircularNode: d3Hierarchy.HierarchyCircularNode; +let parentCircularNode: d3Hierarchy.HierarchyCircularNode | null; parentCircularNode = hierarchyCircularNodeArray.length ? hierarchyCircularNodeArray[0].parent : null; +parentCircularNode = hierarchyCircularNodeArray[0].parent; // id -------------------------------------------------------------------- @@ -738,17 +757,17 @@ idString = packRootNode.id; const circularNodeAncestors: Array> = packRootNode.ancestors(); const circularNodeDescendants: Array> = packRootNode.descendants(); -// leaves() --------------------------------------------------------------- +// leaves() -------------------------------------------------------------- hierarchyCircularNodeArray = packRootNode.leaves(); -// path() ------------------------------------------------------------------- +// path() ---------------------------------------------------------------- hierarchyCircularNode = circularNodeDescendants[circularNodeDescendants.length - 1]; const packPath: Array> = packRootNode.path(hierarchyCircularNode); -// links() and HierarchyRectangularLink<...> ------------------------------------------ +// links() and HierarchyRectangularLink<...> ----------------------------- let circularLinks: Array>; @@ -760,26 +779,27 @@ circularLink = circularLinks[0]; hierarchyCircularNode = circularLink.source; hierarchyCircularNode = circularLink.target; -// sum() and value ---------------------------------------------------------- +// sum() and value ------------------------------------------------------- packRootNode = packRootNode.sum((d) => d.val); -num = packRootNode.value; +numOrUndefined = packRootNode.value; -// count() and value ---------------------------------------------------------- +// count() and value ----------------------------------------------------- packRootNode = packRootNode.count(); -num = packRootNode.value; -// sort --------------------------------------------------------------------- +numOrUndefined = packRootNode.value; + +// sort ------------------------------------------------------------------ packRootNode = packRootNode.sort((a, b) => { console.log('radius of a:', a.r, ' and b:', b.r); // a and b are of type HierarchyCircularNode console.log('Raw values in data of a and b:', a.data.val, ' and ', b.data.val); // a and b are of type HierarchyCircularNode - return b.height - a.height || b.value - a.value; + return b.height - a.height || b.value! - a.value!; }); -// each(), eachAfter(), eachBefore() ---------------------------------------- +// each(), eachAfter(), eachBefore() ------------------------------------- packRootNode = packRootNode.each((node) => { console.log('ParentId:', node.data.parentId); // node type is HierarchyCircularNode @@ -796,7 +816,7 @@ packRootNode = packRootNode.eachBefore((node) => { console.log('Radius of node:', node.r); // node type is HierarchyCircularNode }); -// copy() -------------------------------------------------------------------- +// copy() ---------------------------------------------------------------- let copiedPackNode: d3Hierarchy.HierarchyCircularNode; copiedPackNode = packRootNode.copy(); diff --git a/types/d3-hierarchy/index.d.ts b/types/d3-hierarchy/index.d.ts index bdb7b652d5..0ec823cc78 100644 --- a/types/d3-hierarchy/index.d.ts +++ b/types/d3-hierarchy/index.d.ts @@ -154,7 +154,7 @@ export interface HierarchyNode { * Must return an array of data representing the children, and return null or undefined if the current datum has no children. * If children is not specified, it defaults to: `(d) => d.children`. */ -export function hierarchy(data: Datum, children?: (d: Datum) => (Datum[] | null)): HierarchyNode; +export function hierarchy(data: Datum, children?: (d: Datum) => (Datum[] | null | undefined)): HierarchyNode; // ----------------------------------------------------------------------- // Stratify @@ -182,7 +182,7 @@ export interface StratifyOperator { * * @param id The id accessor. */ - id(id: (d: Datum, i?: number, data?: Datum[]) => (string | null | '' | undefined)): this; + id(id: (d: Datum, i: number, data: Datum[]) => (string | null | '' | undefined)): this; /** * Returns the current parent id accessor, which defaults to: `(d) => d.parentId`. @@ -197,7 +197,7 @@ export interface StratifyOperator { * * @param parentId The parent id accessor. */ - parentId(parentId: (d: Datum, i?: number, data?: Datum[]) => (string | null | '' | undefined)): this; + parentId(parentId: (d: Datum, i: number, data: Datum[]) => (string | null | '' | undefined)): this; } /** @@ -576,7 +576,7 @@ export interface TreemapLayout { */ export function treemap(): TreemapLayout; -// Tiling functions ----------------------------------------------------------------------- +// Tiling functions ------------------------------------------------------ /** * Recursively partitions the specified nodes into an approximately-balanced binary tree, @@ -748,7 +748,7 @@ export interface PackLayout { * * @param radius The specified radius accessor. */ - radius(radius: (node: HierarchyCircularNode) => number): this; + radius(radius: null | ((node: HierarchyCircularNode) => number)): this; /** * Returns the current size, which defaults to [1, 1]. diff --git a/types/d3-hierarchy/tsconfig.json b/types/d3-hierarchy/tsconfig.json index 7fbc1fb5df..da64c5832c 100644 --- a/types/d3-hierarchy/tsconfig.json +++ b/types/d3-hierarchy/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/d3-shape/d3-shape-tests.ts b/types/d3-shape/d3-shape-tests.ts index e668d152f8..8ad3e4809a 100644 --- a/types/d3-shape/d3-shape-tests.ts +++ b/types/d3-shape/d3-shape-tests.ts @@ -1184,7 +1184,7 @@ interface SymbolDatum { let customSymbol: d3Shape.SymbolType; customSymbol = { - draw(context: CanvasPathMethods, size: number): void { + draw(context: d3Shape.CanvasPath_D3Shape, size: number): void { // draw custom symbol using canvas path methods } }; diff --git a/types/d3-shape/index.d.ts b/types/d3-shape/index.d.ts index 47e5c10feb..83222d0ff0 100644 --- a/types/d3-shape/index.d.ts +++ b/types/d3-shape/index.d.ts @@ -7,6 +7,27 @@ import { Path } from 'd3-path'; +// ----------------------------------------------------------------------------------- +// Shared Types and Interfaces +// ----------------------------------------------------------------------------------- + +/** + * @deprecated + * This interface is used to bridge the gap between two incompatible versions of TypeScript (see [#25944](https://github.com/Microsoft/TypeScript/pull/25944)). + * Use `CanvasPathMethods` instead with TS <= 3.0 and `CanvasPath` with TS >= 3.1. + */ +export interface CanvasPath_D3Shape { + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + closePath(): void; + ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + lineTo(x: number, y: number): void; + moveTo(x: number, y: number): void; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + rect(x: number, y: number, w: number, h: number): void; +} + // ----------------------------------------------------------------------------------- // Arc Generator // ----------------------------------------------------------------------------------- @@ -2264,13 +2285,13 @@ export function linkRadial(): LinkRadial { + const xhr = new dav.transport.Basic( + new dav.Credentials({ + username: 'xxx', + password: 'xxx' + }) + ); + + dav.createAccount({ server: 'http://dav.example.com', xhr }) + .then((account) => { + account.calendars.forEach(() => { + }); + }); + const client = new dav.Client(xhr); + + client.createAccount({ + server: 'http://dav.example.com', + accountType: 'carddav' + }).then((account) => { + account.addressBooks.forEach(() => { + }); + }); +})(); + +(() => { + const client = new dav.Client( + new dav.transport.Basic( + new dav.Credentials({ + username: 'xxx', + password: 'xxx' + }) + ), + { + baseUrl: 'https://mail.mozilla.com' + } + ); + + const req = dav.request.basic({ + method: 'PUT', + data: 'BEGIN:VCALENDAR\nEND:VCALENDAR', + etag: '12345' + }); + + client.send(req, '/calendars/123.ics') + .then(() => { }); +})(); + +(() => { + const xhr = new dav.transport.Basic( + new dav.Credentials({ + username: 'xxx', + password: 'xxx' + }) + ); + + const req = dav.request.basic({ + method: 'PUT', + data: 'BEGIN:VCALENDAR\nEND:VCALENDAR', + etag: '12345' + }); + + xhr.send(req, 'https://mail.mozilla.com/calendars/123.ics') + .then(() => { + }); +})(); + +dav.debug.enabled = true; + +(() => { + const xhr = new dav.transport.Basic( + new dav.Credentials({ + username: 'Killer BOB', + password: 'blacklodge' + }) + ); + + const client = new dav.Client(xhr, { baseUrl: 'https://mail.mozilla.com' }); + + const url = 'https://mail.mozilla.com/'; + const req = dav.request.basic({ + method: 'PUT', + data: 'BEGIN:VCALENDAR\nEND:VCALENDAR', + etag: 'abc123' + }); + + const sandbox = dav.createSandbox(); + client.send(req, url, { sandbox }); + xhr.send(req, url, { sandbox }); + + client.createAccount({ sandbox: {}, server: 'http://dav.example.com' }); + dav.createAccount({ + sandbox: {}, + server: 'http://dav.example.com', + xhr + }); + + let calendar = new dav.Calendar(); + client.createCalendarObject(calendar, { + data: 'BEGIN:VCALENDAR\nEND:VCALENDAR', + filename: 'test.ics' + }); + dav.createCalendarObject( + calendar, + { + data: 'BEGIN:VCALENDAR\nEND:VCALENDAR', + filename: 'test.ics', + xhr + }); + + let object = new dav.CalendarObject(); + client.updateCalendarObject(object); + dav.updateCalendarObject( + object, + { + xhr + } + ); + + object = new dav.CalendarObject(); + client.deleteCalendarObject(object); + dav.deleteCalendarObject( + object, + { + xhr + } + ); + + calendar = new dav.Calendar(); + client.syncCalendar(calendar, { syncMethod: 'webdav' }); + dav.syncCalendar( + calendar, + { + syncMethod: 'webdav', + xhr + } + ); + + let account = new dav.Account(); + client.syncCaldavAccount(account, { syncMethod: 'webdav' }); + dav.syncCaldavAccount( + account, + { + syncMethod: 'webdav', + xhr + } + ); + + let addressBook = new dav.AddressBook(); + client.createCard(addressBook, { + data: 'BEGIN:VCARD\nEND:VCARD', + filename: 'test.vcf' + }); + dav.createCard(addressBook, + { + data: 'BEGIN:VCARD\nEND:VCARD', + filename: 'test.vcf', + xhr + }); + + let vcard = new dav.VCard(); + client.updateCard(vcard); + dav.updateCard( + vcard, + { + xhr + } + ); + vcard = new dav.VCard(); + client.deleteCard(vcard); + dav.deleteCard( + vcard, + { + xhr + }); + + addressBook = new dav.AddressBook(); + client.syncAddressBook(addressBook, { + syncMethod: 'basic' + }); + + dav.syncAddressBook( + addressBook, + { + syncMethod: 'basic', + xhr + }); + + account = new dav.Account(); + client.syncCarddavAccount(account, { syncMethod: 'basic' }); + + dav.syncCarddavAccount( + account, + { + syncMethod: 'basic', + xhr + }); +})(); + +(() => { + const xhr = new dav.transport.Basic( + new dav.Credentials({ username: 'admin', password: 'admin' }) + ); + + const req: dav.Request = { + method: 'GET', + transformRequest: (xhr: any) => xhr + }; + + const sandbox = dav.createSandbox(); + xhr.send(req, 'http://127.0.0.1:1337', { sandbox }); + sandbox.requestList; + + xhr.send(req, 'http://127.0.0.1:1337'); +})(); + +(() => { + const credentials = new dav.Credentials({ + clientId: '605300196874-1ki833poa7uqabmh3hq' + + '6u1onlqlsi54h.apps.googleusercontent.com', + clientSecret: 'jQTKlOhF-RclGaGJot3HIcVf', + redirectUrl: 'https://oauth.gaiamobile.org/authenticated', + tokenUrl: 'https://accounts.google.com/o/oauth2/token', + authorizationCode: 'gareth' + }); + + const xhr = new dav.transport.OAuth2(credentials); + + const req = { method: 'GET' }; + + credentials.accessToken = 'EXPIRED'; + credentials.refreshToken = '1/oPHTPFgECWFPrs7KgHdis24u6Xl4E4EnRrkkiwLfzdk'; + credentials.expiration = Date.now() - 1; + + xhr.send(req, 'http://127.0.0.1:1337', { + retry: false + }); + + credentials.accessToken = 'Little Bear'; + credentials.refreshToken = 'spicy tamales'; + const expiration = credentials.expiration = Date.now() + 60 * 60 * 1000; + + credentials.accessToken = 'EXPIRED'; + credentials.refreshToken = 'raspberry pie'; + credentials.expiration = Date.now() + 60 * 60 * 1000; + + credentials.accessToken = 'EXPIRED'; + credentials.refreshToken = 'soda'; +})(); diff --git a/types/dav/index.d.ts b/types/dav/index.d.ts new file mode 100644 index 0000000000..063cc38e60 --- /dev/null +++ b/types/dav/index.d.ts @@ -0,0 +1,804 @@ +// Type definitions for dav 1.7 +// Project: https://github.com/lambdabaa/dav/ +// Definitions by: ToastHawaii +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +export let version: string; + +/** + * Perform an initial download of a caldav or carddav account's data. + * @param options + * @returns a Promise which will be fulfilled with a dav.Account object. + */ +export function createAccount(options: CreateAccountOptions): Promise; + +export interface CreateAccountOptions { + /** + * one of 'caldav' or 'carddav'. Defaults to 'caldav'. + */ + accountType?: "caldav" | "carddav"; + + /** + * list of caldav filters to send with request. + */ + filters?: object[]; + + /** + * whether or not to load dav collections. + */ + loadCollections?: boolean; + + /** + * whether or not to load dav objects. + */ + loadObjects?: boolean; + + /** + * request sandox. + */ + sandbox?: Sandbox | {}; + + /** + * some url for server (needn't be base url). + */ + server: string; + + /** + * VTIMEZONE calendar object. + */ + timezone?: string; + + /** + * request sender. + */ + + xhr?: transport.Transport; +} + +/** + * Create a calendar object on the parameter calendar. + * @param calendar the calendar to put the object on. + * @param options + * @returns a Promise which will be fulfilled when the calendar has been created. + */ +export function createCalendarObject(calendar: Calendar, options: CreateCalendarObjectOptions): Promise; + +export interface CreateCalendarObjectOptions { + /** + * rfc 5545 VCALENDAR object. + */ + data: string; + + /** + * name for the calendar ics file. + */ + filename: string; + + /** + * request sandbox. + */ + sandbox?: Sandbox; + + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Persist updates to the parameter calendar object to the server. + * @param calendarObject updated calendar object. + * @param options + * @returns a Promise which will be fulfilled when the calendar has been updated. + */ +export function updateCalendarObject(calendarObject: CalendarObject, options: UpdateCalendarObjectOptions): Promise; + +export interface UpdateCalendarObjectOptions { + /** + * request sandbox. + */ + sandbox?: Sandbox; + + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Delete the parameter calendar object on the server. + * @param calendarObject target calendar object. + * @param options + * @returns a Promise which will be fulfilled when the calendar has been deleted. + */ +export function deleteCalendarObject(calendarObject: CalendarObject, options: DeleteCalendarObjectOptions): Promise; + +export interface DeleteCalendarObjectOptions { + /** + * request sandbox. + */ + sandbox?: Sandbox; + + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Fetch changes from the remote server to the parameter calendar. + * @param calendar the calendar to fetch changes for. + * @param options + * @returns a Promise which will be fulfilled with an updated dav.Calendar object once sync is complete. + */ +export function syncCalendar(calendar: Calendar, options: SyncCalendarOptions): Promise; + +export interface SyncCalendarOptions { + /** + * list of caldav filters to send with request. + */ + filters?: object[]; + + /** + * request sandbox. + */ + sandbox?: Sandbox; + + /** + * either 'basic' or 'webdav'. If unspecified, will try to do webdav sync + * and failover to basic sync if rfc 6578 is not supported by the server. + */ + syncMethod?: "basic" | "webdav"; + + /** + * VTIMEZONE calendar object. + */ + timezone?: string; + + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Fetch changes from the remote server to the account's calendars. + * @param account the calendar account to sync. + * @param options + * @returns a Promise which will be fulfilled with an updated dav.Account object once sync is complete. + */ +export function syncCaldavAccount(account: Account, options: SyncCaldavAccountOptions): Promise; + +export interface SyncCaldavAccountOptions { + /** + * list of caldav filters to send with request. + */ + filters?: object[]; + + /** + * request sandbox. + */ + sandbox?: Sandbox; + + /** + * either 'basic' or 'webdav'. If unspecified, will try to do webdav sync + * and failover to basic sync if rfc 6578 is not supported by the server. + */ + syncMethod?: "basic" | "webdav"; + + /** + * VTIMEZONE calendar object. + */ + timezone?: string; + + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Create a vcard object on the parameter address book. + * @param addressBook the address book to put the object on. + * @param options + * @returns a Promise which will be fulfilled when the vcard has been created. + */ +export function createCard(addressBook: AddressBook, options: CreateCardOptions): Promise; + +export interface CreateCardOptions { + /** + * VCARD object. + */ + data: string; + /** + * name for the vcard vcf file. + */ + filename: string; + + /** + * request sandbox. + */ + sandbox?: Sandbox; + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Persist updates to the parameter vcard object to the server. + * @param card updated vcard object. + * @param options + * @returns a Promise which will be fulfilled when the vcard has been updated. + */ +export function updateCard(card: VCard, options: UpdateCardOptions): Promise; + +export interface UpdateCardOptions { + /** + * request sandbox. + */ + sandbox?: Sandbox; + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Delete the parameter vcard object on the server. + * @param card target vcard object. + * @param options + * @returns a Promise which will be fulfilled when the vcard has been deleted. + */ +export function deleteCard(card: VCard, options: DeleteCardOptions): Promise; + +export interface DeleteCardOptions { + /** + * request sandbox. + */ + sandbox?: Sandbox; + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Fetch changes from the remote server to the parameter address books. + * @param addressBook the address book to fetch changes for. + * @param options + * @returns a Promise which will be fulfilled with an updated AddressBook object once sync is complete. + */ +export function syncAddressBook(addressBook: AddressBook, options: SyncAddressBookOptions): Promise; + +export interface SyncAddressBookOptions { + /** + * request sandbox. + */ + sandbox?: Sandbox; + /** + * either 'basic' or 'webdav'.If unspecified, will try to do webdav sync + * and failover to basic sync if rfc 6578 is not supported by the server. + */ + syncMethod?: "basic" | "webdav"; + + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Fetch changes from the remote server to the account's address books. + * @param account the address book account to sync. + * @param options + * @returns a Promise which will be fulfilled with an updated Account object once sync is complete. + */ +export function syncCarddavAccount(account: Account, options: SyncCarddavAccountOptions): Promise; + +export interface SyncCarddavAccountOptions { + /** + * list of caldav filters to send with request. + */ + filters?: object[]; + + /** + * request sandbox. + */ + sandbox?: Sandbox; + + /** + * either 'basic' or 'webdav'. If unspecified, will try to do webdav sync + * and failover to basic sync if rfc 6578 is not supported by the server. + */ + syncMethod?: "basic" | "webdav"; + + /** + * VTIMEZONE calendar object. + */ + timezone?: string; + + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Create a request sandbox. + */ +export class Sandbox { + constructor(); + + requestList: any[]; + + add(request: any): void; + + /** + * abort sandboxed requests as a group. + */ + abort(): void; +} + +/** + * @deprecated + */ +export function createSandbox(): Sandbox; + +export namespace transport { + class Transport { + /** + * @param credentials user authorization. + */ + constructor(credentials: Credentials); + + send(request: Request, url: string, options?: TransportOptions): Promise; + } + + interface TransportOptions { + /** + * request sandbox. + */ + sandbox?: Sandbox; + + retry?: boolean; + } + + class Basic extends Transport { + /** + * Create a new Basic object. This sends dav requests using http basic authentication. + * @param credentials user authorization. + */ + constructor(credentials: Credentials); + + /** + * + * @param request object with request info. + * @param url + * @param options + * @return a promise that will be resolved with an xhr request after + * its readyState is 4 or the result of applying an optional request + * `transformResponse` function to the xhr object after its readyState + * is 4. + */ + send(request: Request, url: string, options?: TransportOptions): Promise; + } + + /** + * Create a new OAuth2 object.This sends dav requests authorized via rfc 6749 oauth2. + * @param credentials user authorization. + */ + class OAuth2 extends Transport { + constructor(credentials: Credentials); + + /** + * + * @param request object with request info. + * @param url + * @param options + * @return a promise that will be resolved with an xhr request after + * its readyState is 4 or the result of applying an optional request + * `transformResponse` function to the xhr object after its readyState + * is 4. + */ + send(request: Request, url: string, options?: TransportOptions): Promise; + } +} + +export namespace request { + /** + * + * @param options + * @returns + */ + function addressBookQuery(options: AddressBookQueryOptions): string; + + interface AddressBookQueryOptions { + /** + * value for Depth header. + */ + depth?: string; + + /** + * list of props to request. + */ + props: object[]; + } + + /** + * + * @param options + * @returns + */ + function basic(options: BasicOptions): Request; + + interface BasicOptions { + /** + * put request body. + */ + data: string; + + /** + * http method. + */ + method: string; + + /** + * cached calendar object etag. + */ + etag: string; + } + + /** + * + * @param options + * @returns + */ + function calendarQuery(options: CalendarQueryOptions): string; + + interface CalendarQueryOptions { + /** + * value for Depth header. + */ + depth?: string; + + /** + * list of filters to send with request. + */ + filters: object[]; + + /** + * list of props to request. + */ + props: object[]; + + /** + * VTIMEZONE calendar object. + */ + timezone: string; + } + + /** + * + * @param options + * @returns + */ + function propfind(options: PropfindOptions): string; + + interface PropfindOptions { + /** + * value for Depth header. + */ + depth?: string; + + /** + * list of props to request. + */ + props: object[]; + } + + /** + * + * @param options + * @returns + */ + function syncCollection(options: SyncCollectionOptions): string; + + interface SyncCollectionOptions { + /** + * option value for Depth header. + */ + depth?: string; + + /** + * list of props to request. + */ + props: object[]; + + /** + * indicates scope of the sync report request. + */ + syncLevel: number; + + /** + * synchronization token provided by the server. + */ + syncToken: string; + } +} + +export class Client { + /** + * Create a new Client object. The client interface allows consumers to set + * their credentials and transport once and then make authorized requests + * without passing them to each request. Each of the other, public API + * methods should be available on Client objects. + * @param xhr request sender. + * @param options + */ + constructor(xhr: transport.Transport, options?: ClientOptions); + + /** + * Send a request using this client's transport (and perhaps baseUrl). + * @param req dav request. + * @param options + * @return a promise that will be resolved with an xhr request after + * its readyState is 4 or the result of applying an optional request + * `transformResponse` function to the xhr object after its readyState + * is 4. + */ + send(req: Request, uri: string, options?: ClientSendOptions): Promise; + + /** + * Perform an initial download of a caldav or carddav account's data. + * @param options + * @returns a Promise which will be fulfilled with a dav.Account object. + */ + createAccount(options?: CreateAccountOptions): Promise; + + /** + * Create a calendar object on the parameter calendar. + * @param calendar the calendar to put the object on. + * @param options + * @returns a Promise which will be fulfilled when the calendar has been created. + */ + createCalendarObject(calendar: Calendar, options?: CreateCalendarObjectOptions): Promise; + + /** + * Persist updates to the parameter calendar object to the server. + * @param calendarObject updated calendar object. + * @param options + * @returns a Promise which will be fulfilled when the calendar has been updated. + */ + updateCalendarObject(calendarObject: CalendarObject, options?: UpdateCalendarObjectOptions): Promise; + + /** + * Delete the parameter calendar object on the server. + * @param calendarObject target calendar object. + * @param options + * @returns a Promise which will be fulfilled when the calendar has been deleted. + */ + deleteCalendarObject(calendarObject: CalendarObject, options?: DeleteCalendarObjectOptions): Promise; + + /** + * Fetch changes from the remote server to the parameter calendar. + * @param calendar the calendar to fetch changes for. + * @param options + * @returns a Promise which will be fulfilled with an updated dav.Calendar object once sync is complete. + */ + syncCalendar(calendar: Calendar, options?: SyncCalendarOptions): Promise; + + /** + * Fetch changes from the remote server to the account's calendars. + * @param account the calendar account to sync. + * @param options + * @returns a Promise which will be fulfilled with an updated dav.Account object once sync is complete. + */ + syncCaldavAccount(account: Account, options?: SyncCaldavAccountOptions): Promise; + + /** + * Create a vcard object on the parameter address book. + * @param addressBook the address book to put the object on. + * @param options + * @returns a Promise which will be fulfilled when the vcard has been created. + */ + createCard(addressBook: AddressBook, options?: CreateCardOptions): Promise; + + /** + * Persist updates to the parameter vcard object to the server. + * @param card updated vcard object. + * @param options + * @returns a Promise which will be fulfilled when the vcard has been updated. + */ + updateCard(card: VCard, options?: UpdateCardOptions): Promise; + + /** + * + * Delete the parameter vcard object on the server. + * @param card target vcard object. + * @param options + * @returns a Promise which will be fulfilled when the vcard has been deleted. + */ + deleteCard(card: VCard, options?: DeleteCardOptions): Promise; + + /** + * Fetch changes from the remote server to the parameter address books. + * @param addressBook the address book to fetch changes for. + * @param options + * @returns a Promise which will be fulfilled with an updated AddressBook object once sync is complete. + */ + syncAddressBook(addressBook: AddressBook, options?: SyncAddressBookOptions): Promise; + + /** + * Fetch changes from the remote server to the account's address books. + * @param account the address book account to sync. + * @param options + * @returns a Promise which will be fulfilled with an updated Account object once sync is complete. + */ + syncCarddavAccount(account: Account, options?: SyncCarddavAccountOptions): Promise; +} + +export interface ClientOptions { + /** + * root url to resolve relative request urls with. + */ + baseUrl: string; +} + +export interface ClientSendOptions { + /** + * request sandbox. + */ + sandbox?: Sandbox; + /** + * relative url for request. + */ + url?: string; +} + +export type Partial = { + [P in keyof T]?: T[P]; +}; + +export class Account { + constructor(options?: AccountOptions); + server: string; + credentials: Credentials; + rootUrl: string; + principalUrl: string; + homeUrl: string; + calendars: Calendar[]; + addressBooks: AddressBook[]; +} + +export type AccountOptions = Partial; + +export class Credentials { + constructor(options?: CredentialsOptions); + + /** + * username (perhaps email) for calendar user. + */ + username: string; + + /** + * plaintext password for calendar user. + */ + password: string; + + /** + * oauth client id. + */ + clientId: string; + + /** + * oauth client secret. + */ + clientSecret: string; + + /** + * oauth code. + */ + authorizationCode: string; + + /** + * oauth redirect url. + */ + redirectUrl: string; + + /** + * oauth token url. + */ + tokenUrl: string; + + /** + * oauth access token. + */ + accessToken: string; + + /** + * oauth refresh token. + */ + refreshToken: string; + + /** + * unix time for access token expiration. + */ + expiration: number; +} +export type CredentialsOptions = Partial; + +export class DAVCollection { + constructor(options: DAVCollectionOptions); + data: string; + objects: T[]; + account: Account; + ctag: string; + description: string; + displayName: string; + reports: string[]; + resourcetype: string; + syncToken: string; + url: string; +} +export type DAVCollectionOptions = Partial>; + +export class AddressBook extends DAVCollection { + constructor(options?: AddressBookOptions); +} +export type AddressBookOptions = Partial; + +export class Calendar extends DAVCollection { + constructor(options?: CalendarOptions); + + components: string[]; + timezone: string; +} +export type CalendarOptions = Partial; + +export class DAVObject { + constructor(options: DAVObjectOptions); + data: string; + etag: string; + url: string; +} +export type DAVObjectOptions = Partial; + +export class CalendarObject extends DAVObject { + constructor(options?: CalendarObjectOptions); + calendar: Calendar; + calendarData: string; +} +export type CalendarObjectOptions = Partial; + +export class VCard extends DAVObject { + constructor(options?: VCardOptions); + addressBook: AddressBook; + addressData: string; +} + +export type VCardOptions = Partial; + +export class Request { + constructor(options?: RequestOptions); + method: string; + requestData?: string; + transformRequest?: (xhr: any) => any; + transformResponse?: (xhr: any) => any; + onerror?: (error: Error) => any; +} + +export type RequestOptions = Partial; + +export namespace debug { + let enabled: boolean; +} + +export namespace ns { + const CALENDAR_SERVER = 'http://calendarserver.org/ns/'; + const CALDAV_APPLE = 'http://apple.com/ns/ical/'; + const CALDAV = 'urn:ietf:params:xml:ns:caldav'; + const CARDDAV = 'urn:ietf:params:xml:ns:carddav'; + const DAV = 'DAV:'; +} diff --git a/types/dav/tsconfig.json b/types/dav/tsconfig.json new file mode 100644 index 0000000000..344edfe56a --- /dev/null +++ b/types/dav/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", + "dav-tests.ts" + ] +} \ No newline at end of file diff --git a/types/dav/tslint.json b/types/dav/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/dav/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/dd-trace/dd-trace-tests.ts b/types/dd-trace/dd-trace-tests.ts index 18f5daae10..007ccc30a4 100644 --- a/types/dd-trace/dd-trace-tests.ts +++ b/types/dd-trace/dd-trace-tests.ts @@ -1,7 +1,7 @@ -import * as ddTrace from 'dd-trace'; +import * as tracer from 'dd-trace'; import SpanContext = require('dd-trace/src/opentracing/span_context'); -const tracer = ddTrace.init({ +tracer.init({ service: 'MyLovelyService', hostname: 'localhost', port: 8126, @@ -14,7 +14,7 @@ const tracer = ddTrace.init({ tracer .trace('web.request', { service: 'my_service', - childOf: new SpanContext({ traceId: 1337, spanId: 42 }), + childOf: new SpanContext({ traceId: 1337, spanId: 42 }), // Childof must be an instance of this type. See: https://github.com/DataDog/dd-trace-js/blob/master/src/opentracing/tracer.js#L99 tags: { env: 'dev' } @@ -23,3 +23,13 @@ tracer span.setTag('my_tag', 'my_value'); span.finish(); }); + +const parentScope = tracer.scopeManager().active(); +const span = tracer.startSpan('memcached', { + childOf: parentScope && parentScope.span(), + tags: { + 'service.name': 'my-memcached', + 'resource.name': 'get', + 'span.type': 'memcached', + }, +}); diff --git a/types/dd-trace/index.d.ts b/types/dd-trace/index.d.ts index 11bcdb42f2..a6bbe7dde9 100644 --- a/types/dd-trace/index.d.ts +++ b/types/dd-trace/index.d.ts @@ -1,11 +1,11 @@ -// Type definitions for dd-trace-js 0.2 +// Type definitions for dd-trace-js 0.5 // Project: https://github.com/DataDog/dd-trace-js // Definitions by: Colin Bradley +// Eloy Durán // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import Tracer = require('./src/opentracing/tracer'); -import Span = require('./src/opentracing/span'); -import SpanContext = require('./src/opentracing/span_context'); +import { Tracer, Span, SpanContext } from "opentracing"; +import DatadogSpanContext = require('./src/opentracing/span_context'); declare var trace: TraceProxy; export = trace; @@ -42,6 +42,11 @@ declare class TraceProxy extends Tracer { * @returns The current span or null if outside a trace context. */ currentSpan(): Span | null; + + /** + * Get the scope manager to manager context propagation for the tracer. + */ + scopeManager(): ScopeManager; } interface TracerOptions { @@ -139,11 +144,44 @@ interface TraceOptions { /** * The parent span or span context for the new span. Generally this is not needed as it will be * fetched from the current context. + * If creating your own, this must be an instance of DatadogSpanContext from ./src/opentracing/span_context + * See: https://github.com/DataDog/dd-trace-js/blob/master/src/opentracing/tracer.js#L99 */ - childOf?: Span | SpanContext; + childOf?: Span | SpanContext | DatadogSpanContext; /** * Global tags that should be assigned to every span. */ tags?: { [key: string]: any } | string; } + +declare class ScopeManager { + /** + * Get the current active scope or null if there is none. + * + * @todo The dd-trace source returns null, but opentracing's childOf span + * option is typed as taking undefined or a scope, so using undefined + * here instead. + */ + active(): Scope | undefined; + + /** + * Activate a new scope wrapping the provided span. + * + * @param span The span for which to activate the new scope. + * @param finishSpanOnClose Whether to automatically finish the span when the scope is closed. + */ + activate(span: Span, finishSpanOnClose?: boolean): Scope; +} + +declare class Scope { + /** + * Get the span wrapped by this scope. + */ + span(): Span; + + /** + * Close the scope, and finish the span if the scope was created with `finishSpanOnClose` set to true. + */ + close(): void; +} diff --git a/types/styled-system/package.json b/types/dd-trace/package.json similarity index 58% rename from types/styled-system/package.json rename to types/dd-trace/package.json index da1a3181d0..90deb3c97b 100644 --- a/types/styled-system/package.json +++ b/types/dd-trace/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "styled-components": "^3.3.2" + "opentracing": ">=0.14.1" } } diff --git a/types/dd-trace/src/opentracing/reference.d.ts b/types/dd-trace/src/opentracing/reference.d.ts deleted file mode 100644 index 57def49166..0000000000 --- a/types/dd-trace/src/opentracing/reference.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import Span = require('./span'); -import SpanContext = require('./span_context'); - -declare class Reference { - /** - * @return The Reference type (e.g., REFERENCE_CHILD_OF or - * REFERENCE_FOLLOWS_FROM). - */ - type(): string; - - /** - * @return The SpanContext being referred to (e.g., the - * parent in a REFERENCE_CHILD_OF Reference). - */ - referencedContext(): SpanContext; - - /** - * Initialize a new Reference instance. - * - * @param type - the Reference type constant (e.g., - * REFERENCE_CHILD_OF or REFERENCE_FOLLOWS_FROM). - * @param referencedContext - the SpanContext being referred - * to. As a convenience, a Span instance may be passed in instead - * (in which case its .context() is used here). - */ - constructor(type: string, referencedContext: SpanContext | Span); -} - -export = Reference; \ No newline at end of file diff --git a/types/dd-trace/src/opentracing/span.d.ts b/types/dd-trace/src/opentracing/span.d.ts deleted file mode 100644 index e61a611efd..0000000000 --- a/types/dd-trace/src/opentracing/span.d.ts +++ /dev/null @@ -1,120 +0,0 @@ -import Tracer = require('./tracer'); -import SpanContext = require('./span_context'); - -declare class Span { - /** - * Returns the SpanContext object associated with this Span. - */ - context(): SpanContext; - - /** - * Returns the Tracer object used to create this Span. - */ - tracer(): Tracer; - - /** - * Sets the string name for the logical operation this span represents. - */ - setOperationName(name: string): this; - - /** - * Sets a key:value pair on this Span that also propagates to future - * children of the associated Span. - * - * setBaggageItem() enables powerful functionality given a full-stack - * opentracing integration (e.g., arbitrary application data from a web - * client can make it, transparently, all the way into the depths of a - * storage system), and with it some powerful costs: use this feature with - * care. - * - * IMPORTANT NOTE #1: setBaggageItem() will only propagate baggage items to - * *future* causal descendants of the associated Span. - * - * IMPORTANT NOTE #2: Use this thoughtfully and with care. Every key and - * value is copied into every local *and remote* child of the associated - * Span, and that can add up to a lot of network and cpu overhead. - */ - setBaggageItem(key: string, value: string): this; - - /** - * Returns the value for a baggage item given its key. - * - * @param key - * The key for the given trace attribute. - * @return String value for the given key, or undefined if the key does not - * correspond to a set trace attribute. - */ - getBaggageItem(key: string): string | undefined; - - /** - * Adds a single tag to the span. See `addTags()` for details. - */ - setTag(key: string, value: any): this; - - /** - * Adds the given key value pairs to the set of span tags. - * - * Multiple calls to addTags() results in the tags being the superset of - * all calls. - * - * The behavior of setting the same key multiple times on the same span - * is undefined. - * - * The supported type of the values is implementation-dependent. - * Implementations are expected to safely handle all types of values but - * may choose to ignore unrecognized / unhandle-able values (e.g. objects - * with cyclic references, function objects). - */ - addTags(keyValueMap: { - [key: string]: any; - }): this; - - /** - * Add a log record to this Span, optionally at a user-provided timestamp. - * - * For example: - * - * span.log({ - * size: rpc.size(), // numeric value - * URI: rpc.URI(), // string value - * payload: rpc.payload(), // Object value - * "keys can be arbitrary strings": rpc.foo(), - * }); - * - * span.log({ - * "error.description": someError.description(), - * }, someError.timestampMillis()); - * - * @param keyValuePairs - * An object mapping string keys to arbitrary value types. All - * Tracer implementations should support bool, string, and numeric - * value types, and some may also support Object values. - * @param timestamp - * An optional parameter specifying the timestamp in milliseconds - * since the Unix epoch. Fractional values are allowed so that - * timestamps with sub-millisecond accuracy can be represented. If - * not specified, the implementation is expected to use its notion - * of the current time of the call. - */ - - log(keyValuePairs: { - [key: string]: any; - }, timestamp?: number): this; - - /** - * Sets the end timestamp and finalizes Span state. - * - * With the exception of calls to Span.context() (which are always allowed), - * finish() must be the last call made to any span instance, and to do - * otherwise leads to undefined behavior. - * - * @param finishTime - * Optional finish time in milliseconds as a Unix timestamp. Decimal - * values are supported for timestamps with sub-millisecond accuracy. - * If not specified, the current time (as defined by the - * implementation) will be used. - */ - finish(finishTime?: number): void; -} - -export = Span; diff --git a/types/dd-trace/src/opentracing/span_context.d.ts b/types/dd-trace/src/opentracing/span_context.d.ts index 4e3b532649..d966771c2f 100644 --- a/types/dd-trace/src/opentracing/span_context.d.ts +++ b/types/dd-trace/src/opentracing/span_context.d.ts @@ -1,38 +1,28 @@ -/** - * SpanContext represents Span state that must propagate to descendant Spans - * and across process boundaries. - * - * SpanContext is logically divided into two pieces: the user-level "Baggage" - * (see setBaggageItem and getBaggageItem) that propagates across Span - * boundaries and any Tracer-implementation-specific fields that are needed to - * identify or otherwise contextualize the associated Span instance (e.g., a - * tuple). - */ -declare class SpanContext { +import { SpanContext } from 'opentracing'; + +declare class DatadogSpanContext extends SpanContext { /** - * Use to create references to parent spans. + * Used to create references to parent spans. + * See: https://github.com/DataDog/dd-trace-js/blob/master/src/opentracing/tracer.js#L99 */ constructor(props: SpanContextLike); +} - public traceId: number; +interface SpanContextLike { + traceId: number; - public spanId: number; + spanId: number; - public parentId?: number | null; + parentId?: number | null; - public sampled?: boolean; + sampled?: boolean; - public baggageItems?: { [key: string]: string }; + baggageItems?: { [key: string]: string }; - public trace?: { + trace?: { started: number[], finished: number[] } } -interface SpanContextLike { - traceId: number; - spanId: number; -} - -export = SpanContext; +export = DatadogSpanContext; diff --git a/types/dd-trace/src/opentracing/span_options.d.ts b/types/dd-trace/src/opentracing/span_options.d.ts deleted file mode 100644 index 054d9024d1..0000000000 --- a/types/dd-trace/src/opentracing/span_options.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import Span = require('./span'); -import Reference = require('./reference'); -import SpanContext = require('./span_context'); - -interface SpanOptions { - /** - * a parent SpanContext (or Span, for convenience) that the newly-started - * span will be the child of (per REFERENCE_CHILD_OF). If specified, - * `references` must be unspecified. - */ - childOf?: Span | SpanContext; - - /** - * an array of Reference instances, each pointing to a causal parent - * SpanContext. If specified, `fields.childOf` must be unspecified. - */ - references?: Reference[]; - - /** - * set of key-value pairs which will be set as tags on the newly created - * Span. Ownership of the object is passed to the created span for - * efficiency reasons (the caller should not modify this object after - * calling startSpan). - */ - tags?: { - [key: string]: any; - }; - - /** - * a manually specified start time for the created Span object. The time - * should be specified in milliseconds as Unix timestamp. Decimal value are - * supported to represent time values with sub-millisecond accuracy. - */ - startTime?: number; -} - -export = SpanOptions; diff --git a/types/dd-trace/src/opentracing/tracer.d.ts b/types/dd-trace/src/opentracing/tracer.d.ts deleted file mode 100644 index a40559dbcd..0000000000 --- a/types/dd-trace/src/opentracing/tracer.d.ts +++ /dev/null @@ -1,91 +0,0 @@ -import SpanOptions = require('./span_options'); -import Span = require('./span'); -import SpanContext = require('./span_context'); - -/** - * Tracer is the entry-point between the instrumentation API and the tracing - * implementation. - */ -declare class Tracer { - /** - * Starts and returns a new Span representing a logical unit of work. - * - * For example: - * - * // Start a new (parentless) root Span: - * var parent = Tracer.startSpan('DoWork'); - * - * // Start a new (child) Span: - * var child = Tracer.startSpan('load-from-db', { - * childOf: parent.context(), - * }); - * - * // Start a new async (FollowsFrom) Span: - * var child = Tracer.startSpan('async-cache-write', { - * references: [ - * opentracing.followsFrom(parent.context()) - * ], - * }); - * - * @param name - the name of the operation (REQUIRED). - * @param options - options for the newly created span. - * @return A new Span object. - */ - startSpan(name: string, options?: SpanOptions): Span; - - /** - * Injects the given SpanContext instance for cross-process propagation - * within `carrier`. The expected type of `carrier` depends on the value of - * `format. - * - * OpenTracing defines a common set of `format` values (see - * FORMAT_TEXT_MAP, FORMAT_HTTP_HEADERS, and FORMAT_BINARY), and each has - * an expected carrier type. - * - * Consider this pseudocode example: - * - * var clientSpan = ...; - * ... - * // Inject clientSpan into a text carrier. - * var headersCarrier = {}; - * Tracer.inject(clientSpan.context(), Tracer.FORMAT_HTTP_HEADERS, headersCarrier); - * // Incorporate the textCarrier into the outbound HTTP request header - * // map. - * Object.assign(outboundHTTPReq.headers, headersCarrier); - * // ... send the httpReq - * - * @param spanContext - the SpanContext to inject into the - * carrier object. As a convenience, a Span instance may be passed - * in instead (in which case its .context() is used for the - * inject()). - * @param format - the format of the carrier. - * @param carrier - see the documentation for the chosen `format` - * for a description of the carrier object. - */ - inject(spanContext: SpanContext | Span, format: string, carrier: any): void; - - /** - * Returns a SpanContext instance extracted from `carrier` in the given - * `format`. - * - * OpenTracing defines a common set of `format` values (see - * FORMAT_TEXT_MAP, FORMAT_HTTP_HEADERS, and FORMAT_BINARY), and each has - * an expected carrier type. - * - * Consider this pseudocode example: - * - * // Use the inbound HTTP request's headers as a text map carrier. - * var headersCarrier = inboundHTTPReq.headers; - * var wireCtx = Tracer.extract(Tracer.FORMAT_HTTP_HEADERS, headersCarrier); - * var serverSpan = Tracer.startSpan('...', { childOf : wireCtx }); - * - * @param format - the format of the carrier. - * @param carrier - the type of the carrier object is determined by - * the format. - * @return The extracted SpanContext, or null if no such SpanContext could - * be found in `carrier` - */ - extract(format: string, carrier: any): SpanContext | null; -} - -export = Tracer; diff --git a/types/dialogflow/dialogflow-tests.ts b/types/dialogflow/dialogflow-tests.ts new file mode 100644 index 0000000000..42d905839e --- /dev/null +++ b/types/dialogflow/dialogflow-tests.ts @@ -0,0 +1,10 @@ +import * as dialogflow from "dialogflow"; + +const agentsClient = new dialogflow.AgentsClient(); +const contextsClient = new dialogflow.ContextsClient(); +const entityTypesClient = new dialogflow.EntityTypesClient(); +const intentsClient = new dialogflow.IntentsClient(); +const sessionEntityTypesClient = new dialogflow.SessionEntityTypesClient(); +const sessionsClient = new dialogflow.SessionsClient(); + +// TODO: Add real significant tests diff --git a/types/dialogflow/index.d.ts b/types/dialogflow/index.d.ts new file mode 100644 index 0000000000..c847b662c2 --- /dev/null +++ b/types/dialogflow/index.d.ts @@ -0,0 +1,927 @@ +// Type definitions for dialogflow 0.6 +// Project: https://github.com/dialogflow/dialogflow-nodejs-client-v2#readme +// Definitions by: Daniel Dyla +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +export namespace v2 { + class AgentsClient { + constructor(options?: ClientOptions); + + servicePath: string; + port: number; + scopes: string[]; + + getProjectId(): Promise; + getProjectId(callback?: (error: Error, id: string) => string): void; + + getAgent( + request: GetAgentRequest, + options?: gax.CallOptions, + cb?: (err: Error, agent: Agent) => void + ): Promise<[Agent]>; + searchAgents( + request: SearchAgentRequest, + options?: gax.CallOptions, + cb?: ( + err: Error, + agents: Agent[], + arg3: any, + response: any + ) => void + ): Promise; + searchAgentsStream( + request: SearchAgentRequest, + options?: gax.CallOptions + ): any; + trainAgent( + request: TrainAgentRequest, + options?: gax.CallOptions, + cb?: (err: Error, operation: gax.Operation) => void + ): Promise<[gax.Operation]>; + exportAgent( + request: ExportAgentRequest, + options?: gax.CallOptions, + cb?: (err: Error, operation: gax.Operation) => void + ): Promise<[gax.Operation]>; + importAgent( + request: ImportAgentRequest, + options?: gax.CallOptions, + cb?: (err: Error, operation: gax.Operation) => void + ): Promise<[gax.Operation]>; + restoreAgent( + request: RestoreAgentRequest, + options?: gax.CallOptions, + cb?: (err: Error, operation: gax.Operation) => void + ): Promise<[gax.Operation]>; + } + + class ContextsClient { + constructor(options?: ClientOptions); + + servicePath: string; + port: number; + scopes: string[]; + + getProjectId(): Promise; + getProjectId(callback?: (error: Error, id: string) => string): void; + + listContexts( + request: ListContextsRequest, + options?: gax.CallOptions + ): Promise<[Context[]]>; + listContextsStream( + request: ListContextsRequest, + options?: gax.CallOptions + ): any; + getContext( + request: GetContextRequest, + options?: gax.CallOptions + ): Promise<[Context]>; + createContext( + request: CreateContextReqeust, + options?: gax.CallOptions + ): Promise<[Context]>; + updateContext( + request: UpdateContextRequest, + options?: gax.CallOptions + ): Promise<[Context]>; + deleteContext( + request: DeleteContextRequest, + options?: gax.CallOptions + ): Promise; + deleteAllContexts( + request: DeleteAllContextsRequest, + options?: gax.CallOptions + ): Promise; + + sessionPath(project: string, session: string): string; + contextPath(project: string, session: string, context: string): string; + + matchProjectFromContextName(name: string): string; + matchSessionFromContextName(name: string): string; + matchContextFromContextName(name: string): string; + + matchProjectFromSessionName(name: string): string; + matchSessionFromSessionName(name: string): string; + } + + class EntityTypesClient { + constructor(options?: ClientOptions); + + servicePath: string; + port: number; + scopes: string[]; + + getProjectId(): Promise; + getProjectId(callback?: (error: Error, id: string) => string): void; + + listEntityTypes( + request: ListEntityTypesRequest, + options?: gax.CallOptions + ): Promise<[EntityType[]]>; + + listEntityTypesStream( + request: ListEntityTypesRequest, + options?: gax.CallOptions + ): any; + + getEntityType( + request: GetEntityTypeRequest, + options?: gax.CallOptions + ): Promise<[EntityType]>; + createEntityType( + request: CreateEntityTypeRequest, + options?: gax.CallOptions + ): Promise<[EntityType]>; + updateEntityType( + request: UpdateEntityTypeRequest, + options?: gax.CallOptions + ): Promise<[EntityType]>; + deleteEntityType( + request: DeleteEntityTypeRequest, + options?: gax.CallOptions + ): Promise; + + // TODO: add batch style calls + // batchUpdateEntityTypes + // batchDeleteEntityTypes + // batchCreateEntities + // batchUpdateEntities + // batchDeleteEntities + + projectAgentPath(project: string): string; + entityTypePath(project: string, entityType: string): string; + matchProjectFromProjectAgentName(entityTypeName: string): string; + matchProjectFromEntityTypeName(entityTypeName: string): string; + matchEntityTypeFromEntityTypeName(entityTypeName: string): string; + } + + class IntentsClient { + constructor(options?: ClientOptions); + + servicePath: string; + port: number; + scopes: string[]; + + getProjectId(): Promise; + getProjectId(callback?: (error: Error, id: string) => string): void; + + listIntents( + request: ListIntentsRequest, + options?: gax.CallOptions + ): Promise<[Intent[]]>; + getIntent( + request: GetIntentRequest, + options?: gax.CallOptions + ): Promise<[Intent]>; + createIntent( + request: CreateIntentRequest, + options?: gax.CallOptions + ): Promise<[Intent]>; + updateIntent( + request: UpdateIntentRequest, + options?: gax.CallOptions + ): Promise<[Intent]>; + deleteIntent( + request: DeleteIntentRequest, + options?: gax.CallOptions + ): Promise; + + // TODO: add batch style calls + // batchUpdateIntents(request: BatchUpdateIntentsRequest): void; + // batchDeleteIntents(request: BatchDeleteIntentsRequest): void; + + projectAgentPath(project: string): string; + intentPath(project: string, intent: string): string; + agentPath(project: string, agent: string): string; + + matchProjectFromProjectAgentName(projectAgentName: string): string; + matchProjectFromIntentName(intentName: string): string; + matchIntentFromIntentName(intentName: string): string; + matchProjectFromAgentName(agentName: string): string; + matchAgentFromAgentName(agentName: string): string; + } + + class SessionEntityTypesClient { + constructor(options?: ClientOptions); + + servicePath: string; + port: number; + scopes: string[]; + + getProjectId(): Promise; + getProjectId(callback?: (error: Error, id: string) => string): void; + + // TODO: add Session Entity Types service methods + } + + class SessionsClient { + constructor(options?: ClientOptions); + + servicePath: string; + port: number; + scopes: string[]; + + getProjectId(): Promise; + getProjectId(callback?: (error: Error, id: string) => string): void; + + detectIntent( + request: DetectIntentRequest, + options?: gax.CallOptions + ): Promise; + streamingDetectIntent(options?: gax.CallOptions): Promise; + + sessionPath(projectId: string, sessionId: string): string; + } +} + +export namespace v2beta1 { + class AgentsClient extends v2.AgentsClient {} + class ContextsClient extends v2.ContextsClient { + environmentSessionPath( + project: string, + environment: string, + user: string, + session: string + ): string; + + environmentContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ): string; + + matchProjectFromEnvironmentSessionName( + environmentSessionName: string + ): string; + matchEnvironmentFromEnvironmentSessionName( + environmentSessionName: string + ): string; + matchUserFromEnvironmentSessionName( + environmentSessionName: string + ): string; + matchSessionFromEnvironmentSessionName( + environmentSessionName: string + ): string; + + matchProjectFromEnvironmentContextName( + environmentContextName: string + ): string; + matchEnvironmentFromEnvironmentContextName( + environmentContextName: string + ): string; + matchUserFromEnvironmentContextName( + environmentContextName: string + ): string; + matchSessionFromEnvironmentContextName( + environmentContextName: string + ): string; + matchContextFromEnvironmentContextName( + environmentContextName: string + ): string; + } + class EntityTypesClient extends v2.EntityTypesClient {} + class IntentsClient extends v2.IntentsClient {} + class SessionEntityTypesClient extends v2.SessionEntityTypesClient {} + class SessionsClient extends v2.SessionsClient { + environmentSessionPath( + project: string, + environment: string, + user: string, + session: string + ): string; + + matchProjectFromEnvironmentSessionName( + environmentSessionName: string + ): string; + matchEnvironmentFromEnvironmentSessionName( + environmentSessionName: string + ): string; + matchUserFromEnvironmentSessionName( + environmentSessionName: string + ): string; + matchSessionFromEnvironmentSessionName( + environmentSessionName: string + ): string; + } +} + +export class AgentsClient extends v2.AgentsClient {} +export class ContextsClient extends v2.ContextsClient {} +export class EntityTypesClient extends v2.EntityTypesClient {} +export class IntentsClient extends v2.IntentsClient {} +export class SessionEntityTypesClient extends v2.SessionEntityTypesClient {} +export class SessionsClient extends v2.SessionsClient {} + +export namespace entities { + namespace DateTimeVariants { + interface DateTime { + date_time: string; + } + + interface DateTimePeriod { + startDateTime: DateTime; + endDateTime: DateTime; + } + + interface DatePeriod { + startDate: Date; + endDate: Date; + } + interface TimePeriod { + startTime: string; + endTime: string; + } + } + + type DateTime = + | string + | DateTimeVariants.DatePeriod + | DateTimeVariants.TimePeriod + | DateTimeVariants.DateTime + | DateTimeVariants.DateTimePeriod; + + interface Duration { + unit: string; + amount: number; + } + + type Date = string; + + type Time = string; +} + +export namespace gax { + interface BackoffSettings { + initialRetryDelayMillis: number; + retryDelayMultiplier: number; + maxRetryDelayMillis: number; + initialRpcTimeoutMillis: number; + maxRpcTimeoutMillis: number; + totalTimeoutMillis: number; + } + + interface RetryOptions { + retryCodes: string[]; + backoffSettings: BackoffSettings; + } + + interface CallOptions { + timeout?: number; + retry?: RetryOptions; + autoPaginate?: boolean; + pageToken?: any; + isBundling?: boolean; + longrunning?: BackoffSettings; + promise?: PromiseConstructor; + } + + interface Operation { + grpcOp: longrunning.Operation; + longrunningDescriptor: any; + backoffSettings: BackoffSettings; + callOptions?: CallOptions; + } +} + +export namespace longrunning { + type Operation = + | UnfinishedOperation + | FailedOperation + | SuccessfulOperation; + + interface BaseOperation { + name: string; + metadata: any; + done: boolean; + } + + interface UnfinishedOperation extends BaseOperation { + done: false; + } + + interface FailedOperation extends BaseOperation { + done: true; + error: Status; + } + + interface SuccessfulOperation extends BaseOperation { + done: true; + response: any; + } + + interface Status { + code: number; + message: string; + details: any[]; + } +} + +export interface GetAgentRequest { + parent: string; +} + +export interface SearchAgentRequest { + parent: string; + pageSize?: number; +} + +export interface TrainAgentRequest { + parent: string; +} + +export interface ExportAgentRequest { + parent: string; + agentUri?: string; +} + +export interface ImportAgentRequest { + parent: string; + agentUri?: string; + agentContent?: string; +} + +export interface RestoreAgentRequest { + parent: string; + agentUri?: string; + agentContent?: string; +} + +export interface ListContextsRequest { + parent: string; + pageSize?: number; +} + +export interface GetContextRequest { + name: string; +} + +export interface CreateContextReqeust { + parent: string; + context: Context; +} + +export interface UpdateContextRequest { + context: Context; + updatemask?: any; +} + +export interface DeleteContextRequest { + name: string; +} + +export interface DeleteAllContextsRequest { + parent: string; +} + +export interface ListEntityTypesRequest { + parent: string; + languageCode?: string; + pageSize?: number; +} + +export interface GetEntityTypeRequest { + name: string; + languageCode?: string; +} + +export interface CreateEntityTypeRequest { + parent: string; + entityType: EntityType; +} + +export interface UpdateEntityTypeRequest { + entityType: EntityType; + languageCode?: string; + /** @link https://github.com/google/protobuf/blob/master/src/google/protobuf/field_mask.proto */ + updateMask?: any; +} + +export interface DeleteEntityTypeRequest { + name: string; +} + +export interface ListIntentsRequest { + parent: string; + languageCode?: string; + intentView?: IntentView; + pageSize?: number; +} + +export interface GetIntentRequest { + name: string; + languageCode?: string; + intentView?: IntentView; +} + +export interface CreateIntentRequest { + parent: string; + intent: Intent; + languageCode?: string; + intentView?: IntentView; +} + +export interface UpdateIntentRequest { + intent: Intent; + languageCode?: string; + updateMask?: any; + intentView?: IntentView; +} + +export interface DeleteIntentRequest { + name: string; +} + +export interface DetectIntentRequest { + session: string; + queryInput: QueryInput; + queryParams?: QueryParams; + inputAudio?: any; +} + +export interface DetectIntentResponse { + responseId: string; + queryResult: QueryResult; + webhookStatus: Status; +} + +export interface QueryResult { + queryText: string; + laugnageCode: string; + speechRecognitionConfidence: number; + action: string; + parameters: any; + allRequiredParamsSent: boolean; + fulfillmentText: string; + fulfillmentMessages: Message[]; + webhookSource: string; + webhookPayload: any; + outputContexts: Context[]; + intent: Intent; + intentDetectionConfidence: number; + diagnosticInfo: any; +} + +export interface Status { + code: StatusCode; + message: string; + details: any[]; +} + +export enum StatusCode { + // Not an error; returned on success + // + // HTTP Mapping: 200 OK + OK = 0, + + // The operation was cancelled, typically by the caller. + // + // HTTP Mapping: 499 Client Closed Request + CANCELLED = 1, + + // Unknown error. For example, this error may be returned when + // a `Status` value received from another address space belongs to + // an error space that is not known in this address space. Also + // errors raised by APIs that do not return enough error information + // may be converted to this error. + // + // HTTP Mapping: 500 Internal Server Error + UNKNOWN = 2, + + // The client specified an invalid argument. Note that this differs + // from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments + // that are problematic regardless of the state of the system + // (e.g., a malformed file name). + // + // HTTP Mapping: 400 Bad Request + INVALID_ARGUMENT = 3, + + // The deadline expired before the operation could complete. For operations + // that change the state of the system, this error may be returned + // even if the operation has completed successfully. For example, a + // successful response from a server could have been delayed long + // enough for the deadline to expire. + // + // HTTP Mapping: 504 Gateway Timeout + DEADLINE_EXCEEDED = 4, + + // Some requested entity (e.g., file or directory) was not found. + // + // Note to server developers: if a request is denied for an entire class + // of users, such as gradual feature rollout or undocumented whitelist, + // `NOT_FOUND` may be used. If a request is denied for some users within + // a class of users, such as user-based access control, `PERMISSION_DENIED` + // must be used. + // + // HTTP Mapping: 404 Not Found + NOT_FOUND = 5, + + // The entity that a client attempted to create (e.g., file or directory) + // already exists. + // + // HTTP Mapping: 409 Conflict + ALREADY_EXISTS = 6, + + // The caller does not have permission to execute the specified + // operation. `PERMISSION_DENIED` must not be used for rejections + // caused by exhausting some resource (use `RESOURCE_EXHAUSTED` + // instead for those errors). `PERMISSION_DENIED` must not be + // used if the caller can not be identified (use `UNAUTHENTICATED` + // instead for those errors). This error code does not imply the + // request is valid or the requested entity exists or satisfies + // other pre-conditions. + // + // HTTP Mapping: 403 Forbidden + PERMISSION_DENIED = 7, + + // The request does not have valid authentication credentials for the + // operation. + // + // HTTP Mapping: 401 Unauthorized + UNAUTHENTICATED = 16, + + // Some resource has been exhausted, perhaps a per-user quota, or + // perhaps the entire file system is out of space. + // + // HTTP Mapping: 429 Too Many Requests + RESOURCE_EXHAUSTED = 8, + + // The operation was rejected because the system is not in a state + // required for the operation's execution. For example, the directory + // to be deleted is non-empty, an rmdir operation is applied to + // a non-directory, etc. + // + // Service implementors can use the following guidelines to decide + // between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: + // (a) Use `UNAVAILABLE` if the client can retry just the failing call. + // (b) Use `ABORTED` if the client should retry at a higher level + // (e.g., when a client-specified test-and-set fails, indicating the + // client should restart a read-modify-write sequence). + // (c) Use `FAILED_PRECONDITION` if the client should not retry until + // the system state has been explicitly fixed. E.g., if an "rmdir" + // fails because the directory is non-empty, `FAILED_PRECONDITION` + // should be returned since the client should not retry unless + // the files are deleted from the directory. + // + // HTTP Mapping: 400 Bad Request + FAILED_PRECONDITION = 9, + + // The operation was aborted, typically due to a concurrency issue such as + // a sequencer check failure or transaction abort. + // + // See the guidelines above for deciding between `FAILED_PRECONDITION`, + // `ABORTED`, and `UNAVAILABLE`. + // + // HTTP Mapping: 409 Conflict + ABORTED = 10, + + // The operation was attempted past the valid range. E.g., seeking or + // reading past end-of-file. + // + // Unlike `INVALID_ARGUMENT`, this error indicates a problem that may + // be fixed if the system state changes. For example, a 32-bit file + // system will generate `INVALID_ARGUMENT` if asked to read at an + // offset that is not in the range [0,2^32-1], but it will generate + // `OUT_OF_RANGE` if asked to read from an offset past the current + // file size. + // + // There is a fair bit of overlap between `FAILED_PRECONDITION` and + // `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific + // error) when it applies so that callers who are iterating through + // a space can easily look for an `OUT_OF_RANGE` error to detect when + // they are done. + // + // HTTP Mapping: 400 Bad Request + OUT_OF_RANGE = 11, + + // The operation is not implemented or is not supported/enabled in this + // service. + // + // HTTP Mapping: 501 Not Implemented + UNIMPLEMENTED = 12, + + // Internal errors. This means that some invariants expected by the + // underlying system have been broken. This error code is reserved + // for serious errors. + // + // HTTP Mapping: 500 Internal Server Error + INTERNAL = 13, + + // The service is currently unavailable. This is most likely a + // transient condition, which can be corrected by retrying with + // a backoff. + // + // See the guidelines above for deciding between `FAILED_PRECONDITION`, + // `ABORTED`, and `UNAVAILABLE`. + // + // HTTP Mapping: 503 Service Unavailable + UNAVAILABLE = 14, + + // Unrecoverable data loss or corruption. + // + // HTTP Mapping: 500 Internal Server Error + DATA_LOSS = 15 +} + +export interface Agent { + parent: string; + displayName: string; + defaultLanguageCode: string; + supportedLanguageCodes?: string[]; + timeZone: string; + description?: string; + avatarUri?: string; + enableLogging?: boolean; + matchMode?: MatchMode; + classificationThreshold?: number; +} + +export interface Context { + name: string; + lifespanCount?: number; + parameters?: any; +} + +export interface EntityType { + name: string; + entities: EntitySynonyms[]; + displayName: string; + kind: EntityKind; + autoExpansionMode: EntityAutoExpansionMode; +} + +export enum MatchMode { + MATCH_MODE_UNSPECIFIED = "MATCH_MODE_UNSPECIFIED", + MATCH_MODE_HYBRID = "MATCH_MODE_HYBRID", + MATCH_MODE_ML_ONLY = "MATCH_MODE_ML_ONLY" +} + +export interface Credentials { + clientEmail?: string; + privateKey?: string; +} + +export interface ClientOptions { + credentials?: Credentials; + email?: string; + keyFilename?: string; + port?: number; + projectId?: string; + promise?: PromiseConstructor; + servicePath?: string; +} + +export interface EntitySynonyms { + synonyms: string[]; + value: string; +} + +export enum EntityKind { + KIND_MAP = "KIND_MAP", + KIND_LIST = "KIND_LIST" +} + +export enum EntityAutoExpansionMode { + AUTO_EXPANSION_MODE_DEFAULT = "AUTO_EXPANSION_MODE_DEFAULT", + AUTO_EXPANSION_MODE_UNSPECIFIED = "AUTO_EXPANSION_MODE_UNSPECIFIED" +} + +export enum IntentView { + INTENT_VIEW_UNSPECIFIED = "INTENT_VIEW_UNSPECIFIED", + INTENT_VIEW_FULL = "INTENT_VIEW_FULL" +} + +export interface Intent { + name: string; + displayName: string; + webhookState: string; + priority?: number; + isFallback?: boolean; + mlEnabled?: boolean; + inputContextNames?: string[]; + events?: string[]; + trainingPhrases?: TrainingPhrase[]; + action?: string; + outputContexts?: Context[]; + resetContexts?: boolean; + parameters?: Parameter[]; + messages?: Message[]; + defaultResponsePlatforms?: string[]; + rootFollowupIntentName: string; + parentFollowupIntentName: string; + followupIntentInfo?: FollowupIntentInfo[]; +} + +export interface TrainingPhrase { + name: string; + type: string; + parts: Part[]; + timesAddedCount?: number; +} + +export interface Part { + text: string; + entityType?: string; + alias?: string; + userDefined?: boolean; +} + +export interface Parameter { + name: string; + displayName: string; + value?: string; + defaultValue?: string; + entityTypeDisplayName?: string; + mandatory?: boolean; + prompts?: string[]; + isList?: boolean; +} + +export interface FollowupIntentInfo { + followupIntentName: string; + parentFollowupIntentName: string; +} + +export interface Message { + platform?: string; + text?: Text; + card?: Card; + payload?: any; +} + +export interface Text { + text: string[]; +} + +export interface Card { + title?: string; + subtitle?: string; + imageUri?: string; + buttons?: Button[]; +} + +export interface Button { + text?: string; + postback?: string; +} + +export interface EventInput { + name: string; + languageCode: string; + parameters?: any; +} + +export interface TextInput { + text: string; + languageCode: string; +} + +export interface QueryInput { + text?: TextInput; + event?: EventInput; +} + +export interface QueryParams { + timeZone?: string; + geoLocation?: LatLong; + contexts?: Context[]; + resetContexts?: boolean; + sessionEntityTypes?: SessionEntityType[]; + payload?: any; +} + +export interface LatLong { + latitude: number; + longitude: number; +} + +export interface SessionEntityType { + name: string; + entityOverrideMode: string; + entities: Entity[]; +} + +export interface Entity { + value: string; + synonyms: string[]; +} + +export interface WebhookRequest { + session: string; + responseId: string; + + queryResult: QueryResult; + originalDetectIntentRequest?: any; +} + +export interface WebhookResponse { + fulfillmentText?: string; + fulfillmentMessages?: Message[]; + source?: string; + payload?: any; + outputContexts?: Context[]; + followupEventInput?: EventInput; +} diff --git a/types/dialogflow/tsconfig.json b/types/dialogflow/tsconfig.json new file mode 100644 index 0000000000..366cf28866 --- /dev/null +++ b/types/dialogflow/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", + "dialogflow-tests.ts" + ] +} diff --git a/types/dialogflow/tslint.json b/types/dialogflow/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/dialogflow/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/dom-clipboard-api/dom-clipboard-api-tests.ts b/types/dom-clipboard-api/dom-clipboard-api-tests.ts new file mode 100644 index 0000000000..9b0731d8f4 --- /dev/null +++ b/types/dom-clipboard-api/dom-clipboard-api-tests.ts @@ -0,0 +1,16 @@ +const clipboard = navigator.clipboard; + +let text: string; + +clipboard.writeText('foo'); +clipboard.readText().then((val) => { + text = val; +}); + +const transfer = new DataTransfer(); +transfer.setData('text/plain', 'foo'); + +clipboard.write(transfer); +clipboard.read().then((tf) => { + text = tf.getData('text/plain'); +}); diff --git a/types/dom-clipboard-api/index.d.ts b/types/dom-clipboard-api/index.d.ts new file mode 100644 index 0000000000..1af5f2c60a --- /dev/null +++ b/types/dom-clipboard-api/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for w3c Clipboard API 1.0 +// Project: https://w3c.github.io/clipboard-apis/ +// Definitions by: James Garbutt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface Clipboard extends EventTarget { + read(): Promise; + readText(): Promise; + write(data: DataTransfer): Promise; + writeText(data: string): Promise; +} + +interface Navigator { + readonly clipboard: Clipboard; +} diff --git a/types/dom-clipboard-api/tsconfig.json b/types/dom-clipboard-api/tsconfig.json new file mode 100644 index 0000000000..230c5f16f6 --- /dev/null +++ b/types/dom-clipboard-api/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "dom-clipboard-api-tests.ts" + ] +} diff --git a/types/dom-clipboard-api/tslint.json b/types/dom-clipboard-api/tslint.json new file mode 100644 index 0000000000..495d29983d --- /dev/null +++ b/types/dom-clipboard-api/tslint.json @@ -0,0 +1,5 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + } +} diff --git a/types/echarts/index.d.ts b/types/echarts/index.d.ts index 15892864e5..dc525231e6 100644 --- a/types/echarts/index.d.ts +++ b/types/echarts/index.d.ts @@ -1,122 +1,414 @@ -// Type definitions for echarts +// Type definitions for echarts 4.1.0 // Project: http://echarts.baidu.com/ // Definitions by: Xie Jingyang // AntiMoron // Liveangela +// Ovilia // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 declare namespace echarts { - function init(dom: HTMLDivElement | HTMLCanvasElement, theme?: object | string, opts?: { - devicePixelRatio?: number - renderer?: string - width?: number | string - height?: number | string - }): ECharts; + /** + * Creates an ECharts instance, and returns an echartsInstance. You shall + * not initialize multiple ECharts instances on a single container. + * + * @param {HTMLDivElement | HTMLCanvasElement} dom Instance container, + * usually is a `div` element with height and width defined. + * @param {object | string} [theme] Theme to be applied. + * This can be a configuring object of a theme, or a theme name + * registered through [echarts.registerTheme](https://echarts.apache.org/api.html#echarts.registerTheme). + * @param {object} [opts] Chart configurations. + * @param {number} [opts.devicePixelRatio] Ratio of one physical pixel to + * the size of one device independent pixels. Browser's + * `window.devicePixelRatio` is used by default. + * @param {string} [opts.renderer] Supports `'canvas'` or `'svg'`. + * See [Render by Canvas or SVG](https://echarts.apache.org/tutorial.html#Render%20by%20Canvas%20or%20SVG). + * @param {number} [opts.width] Specify width explicitly, in pixel. + * If setting to `null`/`undefined`/`'auto'`, width of `dom` + * (instance container) will be used. + * @param {number} [opts.height] Specify height explicitly, in pixel. + * If setting to `null`/`undefined`/`'auto'`, height of `dom` + * (instance container) will be used. + */ + function init( + dom: HTMLDivElement | HTMLCanvasElement, + theme?: object | string, + opts?: { + devicePixelRatio?: number + renderer?: string + width?: number | string + height?: number | string + } + ): ECharts - const graphic: Graphic; + /** + * Connects interaction of multiple chart series. For example: + * + ```js + // set group id of each instance respectively. + chart1.group = 'group1'; + chart2.group = 'group1'; + echarts.connect('group1'); + // or incoming instance array that need to be linked. + echarts.connect([chart1, chart2]); + ``` + * + * @param group Group id in string, or array of chart instance. + */ + function connect(group: string | ECharts[]): void - interface Graphic { - clipPointsByRect(points: number[][], rect: ERectangle): number[][]; - clipRectByRect(targetRect: ERectangle, rect: ERectangle): ERectangle; - LinearGradient: { new(x: number, y: number, x2: number, y2: number, colorStops: object[], globalCoord?: boolean): LinearGradient } - } + /** + * Disconnects interaction of multiple chart series. To have one single + * instance to be removed, you can set `group` of chart instance to be null. + * + * @param {string} group Group id in string. + */ + function disConnect(group: string): void - function connect(group: string | string[]): void; + /** + * Destroys chart instance, after which the instance cannot be used any + * more. + * + * @param target Chart instance or container. + */ + function dispose(target: ECharts | HTMLDivElement | HTMLCanvasElement) + : void - function disConnect(group: string): void; + /** + * Returns chart instance of dom container. + * + * @param target Chart container. + */ + function getInstanceByDom(target: HTMLDivElement | HTMLCanvasElement) + : ECharts - function dispose(target: ECharts | HTMLDivElement | HTMLCanvasElement): void; + /** + * Registers available maps. This can only be used after including + * [geo](https://echarts.apache.org/option.html#geo) + * component or chart series of + * [map](https://echarts.apache.org/option.html#series-map). + * + * @param {string} mapName Map name, referring to `map` value set in + * [geo](https://echarts.apache.org/option.html#geo) + * component or + * [map](https://echarts.apache.org/option.html#series-map). + * @param {object} geoJson Data in GeoJson format. See + * [http://geojson.org/](http://geojson.org/) for more format information. + * @param {object} [specialAreas] Zoomed part of a specific area in the map + * for better visual effect. + * See [USA Population Estimates example](https://ecomfe.github.io/echarts-examples/public/editor.html?c=map-usa). + */ + function registerMap( + mapName: string, + geoJson: object, + specialAreas?: object + ): void - function getInstanceByDom(target: HTMLDivElement | HTMLCanvasElement): ECharts; - - function registerMap(mapName: string, geoJson: object, specialAreas?: object): void; - - function registerTheme(themeName: string, theme: object): void; + /** + * Registers a theme, should be specified when + * [initialize the chart instance](https://echarts.apache.org/api.html#echarts.init). + * + * @param {string} themeName Theme name. + * @param {object} theme Theme configurations. + */ + function registerTheme(themeName: string, theme: object): void interface MapObj { - /** geoJson data for map */ + /** + * geoJson data for map + */ geoJson: object, - /** special areas fro map */ + /** + * special areas fro map + */ specialAreas: object } - function getMap(mapName: string): MapObj; + /** + * Get a registed map. + * + * @param {string} mapName Map name. + * @return {MapObj} Map data. + */ + function getMap(mapName: string): MapObj - interface LinearGradient { - colorStops: object[]; - global: boolean; - type: string; - x: number - x2: number - y: number - y2: number + /** + * Util methods about graphics. + */ + const graphic: Graphic; + + interface Graphic { + /** + * Clip the given points by the given rectangular. + * + * @param {number[][]} points The points to be clipped, + * like [[23, 44], [12, 15], ...]. + * @param {ERectangle} rect The rectangular that is used to clip points. + */ + clipPointsByRect(points: number[][], rect: ERectangle): number[][]; + + /** + * Clip the first input rectangular by the second input rectangular. + * + * @param {ERectangle} targetRect The rectangular to be clipped. + * @param {ERectangle} rect The rectangular that is used to clip + * targetRect. + */ + clipRectByRect(targetRect: ERectangle, rect: ERectangle): ERectangle; } interface ECharts { + /** + * Group name to be used in chart connection + */ group: string - setOption(option: EChartOption, notMerge?: boolean, notRefreshImmediately?: boolean): void + /** + * Configuration item, data, universal interface, all parameters and + * data can all be modified through `setOption`. ECharts will merge + * new parameters and data, and then refresh chart. + * + * @param {EChartOption} option Configuration item and data. Please + * refer to [configuration item manual](https://echarts.apache.org/option.html) + * for more information. + * @param {boolean} [notMerge=false] Whether not to merge with previous + * `option` + * @param {boolean} [lazyUpdate=false] Whether not to update chart + * immediately + */ + setOption( + option: EChartOption, + notMerge?: boolean, + lazyUpdate?: boolean + ) : void + /** + * Configuration item, data, universal interface, all parameters and + * data can all be modified through `setOption`. ECharts will merge + * new parameters and data, and then refresh chart. + * + * @param {EChartOption} option Configuration item and data. Please + * refer to [configuration item manual](https://echarts.apache.org/option.html) + * for more information. + * @param {EChartsOptionConfig} [opts] Options about how to setOption + */ + setOption(option: EChartOption, opts?: EChartsOptionConfig): void + + /** + * Gets width of ECharts instance container. + * + * @return {number} Width. + */ getWidth(): number + /** + * Gets height of ECharts instance container. + * + * @return {number} Height. + */ getHeight(): number + /** + * Gets DOM element of ECharts instance container. + * + * @return {HTMLCanvasElement|HTMLDivElement} DOM container. + */ getDom(): HTMLCanvasElement | HTMLDivElement - getOption(): object + /** + * Gets `option` object maintained in current instance, which contains + * configuration item and data merged from previous `setOption` + * operations by users, along with user interaction states. + * For example, switching of legend, zooming area of data zoom, + * and so on. Therefore, a new instance that is exactly the same + * can be recovered from this option. + */ + getOption(): EChartOption - resize(): void + /** + * Resizes chart, which should be called manually when container size + * changes. When `opts` is not provided, DOM size is used. + * + * @param {EChartsResizeOption} opts Specify parameters explicitly. + */ + resize(opts?: EChartsResizeOption): void + /** + * Triggers chart action, like chart switch `legendToggleSelect`, + * zoom data area `dataZoom`, show tooltip `showTip` and so on. + * See [action](https://echarts.apache.org/api.html#action) and + * [events](https://echarts.apache.org/api.html#events) + * for more information. + * + * @param payload Trigger multiple actions through `batch` attribute. + */ dispatchAction(payload: object): void + /** + * Binds event-handling function. + * There are two kinds of events in ECharts, one of which is mouse + * events, which will be triggered when the mouse clicks certain + * element in the chart, the other kind will be triggered after + * `dispatchAction` is called. Every action has a corresponding + * event. + * If event is triggered externally by `dispatchAction`, and there + * is batch attribute in action to trigger batch action, then the + * corresponding response event parameters be in batch. + * + * @param {string} eventName Event names are all in lower-cases, + * for example, `'click'`, `'mousemove'`, `'legendselected'` + * @param {Function} handler Event-handling function, whose format + * is as following: + ```js + (event: object) + ``` + * @param {object} [context] context of callback function, what + * `this` refers to. + */ on(eventName: string, handler: Function, context?: object): void + /** + * Unbind event-handler function. + * + * @param {string} eventName Event names are all in lower-cases, + * for example, `'click'`, `'mousemove'`, `'legendselected'` + * @param {Function} [handler] The function to be unbound could be + * passed. Otherwise, all event functions of this type will be + * unbound. + */ off(eventName: string, handler?: Function): void - showLoading(type?: string, opts?: object): void + /** + * Convert a point from logical coordinate (e.g., in geo, cartesian, + * graph, ...) to pixel coordinate. + * + * @param {EChartsConvertFinder} finder Indicate in which coordinate + * system conversion is performed. + * Generally, index or id or name can be used to specify + * coordinate system. + * @param {string | any[]} value The value to be converted. + */ + convertToPixel(finder: EChartsConvertFinder, value: string | any[]) + : string | any[] + /** + * Convert a point from pixel coordinate to logical coordinate + * (e.g., in geo, cartesian, graph, ...). + * + * @param {EChartsConvertFinder} finder Indicate in which coordinate + * system conversion is performed. + * Generally, index or id or name can be used to specify + * coordinate system. + * @param {string | any[]} value The value to be converted. + */ + convertFromPixel(finder: EChartsConvertFinder, value: any[] | string) + : any[] | string + + /** + * Determine whether the given point is in the given coordinate systems or series. + * + * @param {EChartsConvertFinder} finder Indicate in which coordinate + * system conversion is performed. + * Generally, index or id or name can be used to specify + * coordinate system. + * @param {string | any[]} value The value to be judged, in pixel + * coordinate system. + */ + containPixel(finder: EChartsConvertFinder, value: any[]): boolean + + /** + * Shows loading animation. You can call this interface manually before + * data is loaded, and call `hideLoading` to hide loading animation + * after data is loaded. + * + * @param {string} [type='default'] + * @param {EChartsLoadingOption} [opts] + */ + showLoading(type?: string, opts?: EChartsLoadingOption): void + + /** + * Hides animation loading effect. + */ hideLoading(): void + /** + * Exports chart image; returns a base64 URL; can be set to `src` of + * `Image`. + * + * @param opts Options. + */ getDataURL(opts: { - /** 导出的格式,可选 png, jpeg */ + // Exporting format, can be either png, or jpeg type?: string, - /** 导出的图片分辨率比例,默认为 1。*/ + // Resolution ratio of exporting image, 1 by default. pixelRatio?: number, - /** 导出的图片背景色,默认使用 option 里的 backgroundColor */ - backgroundColor?: string + // Background color of exporting image, use backgroundColor in + // option by default. + backgroundColor?: string, + // Excluded components list. e.g. ['toolbox'] + excludeComponents?: string[] }): string + /** + * Exports connected chart image; returns a base64 url; can be set to + * `src` of `Image`. Position of charts in exported image are + * related to that of the container. + * + * @param opts Options. + */ getConnectedDataURL(opts: { - /** 导出的格式,可选 png, jpeg */ + // Exporting format, can be either png, or jpeg type: string, - /** 导出的图片分辨率比例,默认为 1。 */ + // Resolution ratio of exporting image, 1 by default. pixelRatio: number, - /** 导出的图片背景色,默认使用 option 里的 backgroundColor */ - backgroundColor: string + // Background color of exporting image, use backgroundColor in + // option by default. + backgroundColor: string, + // Excluded components list. e.g. ['toolbox'] + excludeComponents?: string[] }): string + /** + * The method is used in rendering millions of data + * (e.g. rendering geo data). In these scenario, the entire size of + * data is probably up to 10 or 100 MB, even using binary format. + * So chunked load data and rendering is required. When using + * `appendData`, the graphic elements that have been rendered will + * not be cleared, but keep rendering new graphic elements. + * + * @param opts Data options. + */ + appendData(opts: { + // Specify which series the data will be appended to. + seriesIndex?: string, + // The data to be appended. + data?: any[]|TypedArray, + }): void + + /** + * Clears current instance; removes all components and charts in + * current instance. + */ clear(): void + /** + * Returns whether current instance has been disposed. + * + * @return {boolean} Whether has been disposed. + */ isDisposed(): boolean + /** + * Disposes instance. Once disposed, the instance can not be used again. + */ dispose(): void - - /** 转换逻辑点到像素 */ - convertToPixel(finder: ConvertFinder | string, value: string | any[]): string | any[] - - convertFromPixel(finder: ConvertFinder | string, value: any[] | string): any[] | string - - containPixel(finder: ConvertFinder | string, - /** 要被判断的点,为像素坐标值,以 echarts 实例的 dom 节点的左上角为坐标 [0, 0] 点。*/ - value: any[]): boolean - - getModel(): { - getComponent(finder: string): any; - } } - interface ConvertFinder { + type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array + | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array + | Float64Array; + + interface EChartsConvertFinder { seriesIndex?: number, seriesId?: string, seriesName?: string, @@ -193,6 +485,29 @@ declare namespace echarts { zAxis3D?: object } + interface EChartsOptionConfig { + notMerge?: boolean, + lazyUpdate?: boolean, + silent?: boolean + } + + interface EChartsResizeOption { + /** + * Chart width. + */ + width?: number | string, + + /** + * Chart height. + */ + height?: number | string, + + /** + * Specify whether or not to prevent triggering events. + */ + silent?: boolean + } + interface EChartTitleOption { show?: boolean; text?: string; @@ -219,6 +534,38 @@ declare namespace echarts { shadowOffsetX?: number, shadowOffsetY?: number, } + + interface EChartsLoadingOption { + /** + * Loading text. + * @default 'loading' + */ + text?: string, + + /** + * Loading circle color. + * @default '#c23531' + */ + color?: string, + + /** + * Loading text color. + * @default '#000' + */ + textColor?: string, + + /** + * Mask background color. + * @default 'rgba(255, 255, 255, 0.8)' + */ + maskColor?: string, + + /** + * Zlevel of loading. If not 0, it creates a new canvas for loading. + * @default 0 + */ + zlevel?: 0 + } } declare module 'echarts' { diff --git a/types/emoji-mart/dist-es/components/category.d.ts b/types/emoji-mart/dist-es/components/category.d.ts index 8cd4ceefbb..efa52e9988 100644 --- a/types/emoji-mart/dist-es/components/category.d.ts +++ b/types/emoji-mart/dist-es/components/category.d.ts @@ -1,12 +1,11 @@ import React = require('react'); -import { EmojiData } from '..'; - -import { Emoji, EmojiProps, I18n } from '.'; +import { Emoji, EmojiData, EmojiProps, I18n, CategoryName } from '..'; export interface Props { emojis?: Array; hasStickyPosition?: boolean; + id: CategoryName; name: string; native: boolean; perLine: number; diff --git a/types/emoji-mart/dist-es/components/emoji.d.ts b/types/emoji-mart/dist-es/components/emoji.d.ts deleted file mode 100644 index 030ff7ce12..0000000000 --- a/types/emoji-mart/dist-es/components/emoji.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import React = require('react'); - -import { EmojiData, EmojiSkin } from '..'; - -export type BackgroundImageFn = (set: EmojiSet, sheetSize: EmojiSheetSize) => string; -export type EmojiSet = 'apple'|'google'|'twitter'|'emojione'|'messenger'|'facebook'; -export type EmojiSheetSize = 16|20|32|64; - -export interface Props { - onOver?(emoji: EmojiData, e: React.MouseEvent): void; - onLeave?(emoji: EmojiData, e: React.MouseEvent): void; - onClick?(emoji: EmojiData, e: React.MouseEvent): void; - /** defaults to returning a png from unpkg.com-hosted emoji-datasource-${set} */ - backgroundImageFn?: BackgroundImageFn; - native?: boolean; - forceSize?: boolean; - tooltip?: boolean; - /** defaults to 1 */ - skin?: EmojiSkin; - /** defaults to 64 */ - sheetSize?: EmojiSheetSize; - /** defaults to 'apple' */ - set?: EmojiSet; - size: number; - emoji: string|EmojiData; -} - -// tslint:disable-next-line strict-export-declare-modifiers -declare const Emoji: React.SFC; - -export { Emoji as default }; diff --git a/types/emoji-mart/dist-es/components/emoji/emoji.d.ts b/types/emoji-mart/dist-es/components/emoji/emoji.d.ts new file mode 100644 index 0000000000..d86d2b686f --- /dev/null +++ b/types/emoji-mart/dist-es/components/emoji/emoji.d.ts @@ -0,0 +1,8 @@ +import React = require('react'); + +import { EmojiProps } from '../..'; + +// tslint:disable-next-line strict-export-declare-modifiers +declare const Emoji: React.StatelessComponent; + +export { Emoji as default }; diff --git a/types/emoji-mart/dist-es/components/emoji/nimble-emoji.d.ts b/types/emoji-mart/dist-es/components/emoji/nimble-emoji.d.ts new file mode 100644 index 0000000000..77888f5a94 --- /dev/null +++ b/types/emoji-mart/dist-es/components/emoji/nimble-emoji.d.ts @@ -0,0 +1,12 @@ +import React = require('react'); + +import { EmojiProps, Data } from '../..'; + +export interface NimbleEmojiProps extends EmojiProps { + data: Data; +} + +// tslint:disable-next-line strict-export-declare-modifiers +declare const NimbleEmoji: React.SFC; + +export { NimbleEmoji as default }; diff --git a/types/emoji-mart/dist-es/components/index.d.ts b/types/emoji-mart/dist-es/components/index.d.ts index 6fc29ecd54..3f05ca5c82 100644 --- a/types/emoji-mart/dist-es/components/index.d.ts +++ b/types/emoji-mart/dist-es/components/index.d.ts @@ -1,4 +1,6 @@ // The other exports on the components folder are not public API export { default as Category, Props as CategoryProps } from './category'; -export { default as Emoji, Props as EmojiProps, BackgroundImageFn, EmojiSet, EmojiSheetSize } from './emoji'; -export { default as Picker, Props as PickerProps, I18n, PartialI18n, CustomEmoji } from './picker'; +export { default as Emoji } from './emoji/emoji'; +export { default as NimbleEmoji, NimbleEmojiProps } from './emoji/nimble-emoji'; +export { default as Picker } from './picker/picker'; +export { default as NimblePicker, NimblePickerProps } from './picker/nimble-picker'; diff --git a/types/emoji-mart/dist-es/components/picker.d.ts b/types/emoji-mart/dist-es/components/picker.d.ts deleted file mode 100644 index 9f9132df05..0000000000 --- a/types/emoji-mart/dist-es/components/picker.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -import React = require('react'); - -import { EmojiData, EmojiSkin } from '..'; - -import { Category, Emoji, EmojiProps, BackgroundImageFn, EmojiSet, EmojiSheetSize } from '.'; - -// tslint:disable-next-line interface-name -export interface I18n { - search: string; - categories: Record<'search'|'recent'|'people'|'nature'|'foods'|'activity'|'places'|'objects'|'symbols'|'flags'|'custom', string>; - notfound: string; -} - -export type PartialI18n = Partial & { categories: Partial}>; - -export interface CustomEmoji { - // id is overridden by short_names[0] - name: string; - /** Must contain at least one name. The first name is used as the unique id. */ - short_names: string[]; - emoticons?: string[]; - keywords?: string[]; - imageUrl: string; -} - -export interface Props { - /** NOTE: default is not preventable */ - onClick?(emoji: EmojiData, e: React.MouseEvent): void; - perLine?: number; - emojiSize?: number; - i18n?: PartialI18n; - style?: React.CSSProperties; - title?: string; - emoji?: string; - color?: string; - set?: EmojiSet; - skin?: EmojiSkin; - native?: boolean; - backgroundImageFn?: BackgroundImageFn; - sheetSize?: EmojiSheetSize; - emojisToShowFilter?(emoji: EmojiData): boolean; - showPreview?: boolean; - emojiTooltip?: boolean; - include?: string[]; - exclude?: string[]; - recent?: string[]; - autoFocus?: boolean; - /** NOTE: custom emoji are copied into a singleton object on every new mount */ - custom: CustomEmoji[]; -} - -export default class Picker extends React.PureComponent { - // everything inside it is supposed to be private -} diff --git a/types/emoji-mart/dist-es/components/picker/nimble-picker.d.ts b/types/emoji-mart/dist-es/components/picker/nimble-picker.d.ts new file mode 100644 index 0000000000..cc564b2a5e --- /dev/null +++ b/types/emoji-mart/dist-es/components/picker/nimble-picker.d.ts @@ -0,0 +1,11 @@ +import React = require('react'); + +import { Data, PickerProps } from '../..'; + +export interface NimblePickerProps extends PickerProps { + data: Data; +} + +export default class NimblePicker extends React.PureComponent { + // everything inside it is supposed to be private +} diff --git a/types/emoji-mart/dist-es/components/picker/picker.d.ts b/types/emoji-mart/dist-es/components/picker/picker.d.ts new file mode 100644 index 0000000000..01f8a41f8b --- /dev/null +++ b/types/emoji-mart/dist-es/components/picker/picker.d.ts @@ -0,0 +1,7 @@ +import React = require('react'); + +import { PickerProps } from '../..'; + +export default class Picker extends React.PureComponent { + // everything inside it is supposed to be private +} diff --git a/types/emoji-mart/dist-es/index.d.ts b/types/emoji-mart/dist-es/index.d.ts index e49d37fcf6..bb0c79be3e 100644 --- a/types/emoji-mart/dist-es/index.d.ts +++ b/types/emoji-mart/dist-es/index.d.ts @@ -1,15 +1,30 @@ -export { default as emojiIndex, EmojiData, EmojiSkin } from './utils/emoji-index'; export { default as store, StoreHandlers } from './utils/store'; export { default as frequently } from './utils/frequently'; +export { Data } from './utils/data'; + +export { + PickerProps, + EmojiProps, + I18n, + PartialI18n, + CategoryName +} from './utils/shared-props'; + +export { + emojiIndex, + nimbleEmojiIndex, + EmojiData, + CustomEmoji, + EmojiSkin +} from './utils/emoji-index'; export { Picker, - PickerProps, - I18n, - PartialI18n, - CustomEmoji, + NimblePicker, + NimblePickerProps, Emoji, - EmojiProps, + NimbleEmoji, + NimbleEmojiProps, Category, CategoryProps } from './components'; diff --git a/types/emoji-mart/dist-es/utils/data.d.ts b/types/emoji-mart/dist-es/utils/data.d.ts new file mode 100644 index 0000000000..ad1bc0d229 --- /dev/null +++ b/types/emoji-mart/dist-es/utils/data.d.ts @@ -0,0 +1,73 @@ +export interface Data { + compressed: boolean; + categories: Category[]; + emojis: { [key: string]: Emoji }; + aliases: { [key: string]: string }; +} + +export interface Category { + id: string; + name: string; + emojis: string[]; +} + +export interface Emoji { + name?: string; + a?: string; + unified?: string; + b?: string; + non_qualified?: string; + c?: string; + has_img_apple?: boolean; + d?: boolean; + has_img_google?: boolean; + e?: boolean; + has_img_twitter?: boolean; + f?: boolean; + has_img_emojione?: boolean; + g?: boolean; + has_img_facebook?: boolean; + h?: boolean; + has_img_messenger?: boolean; + i?: boolean; + keywords?: string[]; + j?: string[]; + sheet?: number[]; + k?: number[]; + emoticons?: string[]; + l?: string[]; + text?: string; + m?: string; + short_names?: string[]; + n?: string[]; + added_in?: number; + o?: number; + sheet_x?: number; + sheet_y?: number; + skin_variations?: { [key: string]: SkinVariation }; + obsoleted_by?: string; + obsoletes?: string; +} + +export interface SkinVariation { + unified: string; + non_qualified: null | string; + image: string; + sheet_x: number; + sheet_y: number; + added_in: string; + has_img_apple: boolean; + has_img_google: boolean; + has_img_twitter: boolean; + has_img_emojione: boolean; + has_img_facebook: boolean; + has_img_messenger: boolean; + obsoleted_by?: string; + obsoletes?: string; +} + +export function buildSearch(emoji: Emoji): string; + +export function compress(emoji: Emoji): void; + +export function uncompress(data: Data): void; diff --git a/types/emoji-mart/dist-es/utils/emoji-index.d.ts b/types/emoji-mart/dist-es/utils/emoji-index.d.ts deleted file mode 100644 index c6499e663c..0000000000 --- a/types/emoji-mart/dist-es/utils/emoji-index.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -export type EmojiSkin = 1|2|3|4|5|6; - -export interface EmojiData { - id: string; - name: string; - colons: string; - /** Reverse mapping to keyof emoticons */ - emoticons: string[]; - unified: string; - skin: EmojiSkin|null; - native: string; -} - -// tslint:disable-next-line strict-export-declare-modifiers -declare const _default: { - search(query: ''): null - search(query: string): EmojiData|null - - emojis: { [emoji: string]: EmojiData } - - /** Mapping of string to keyof emojis */ - emoticons: { [emoticon: string]: string } -}; - -export { _default as default }; diff --git a/types/emoji-mart/dist-es/utils/emoji-index/emoji-index.d.ts b/types/emoji-mart/dist-es/utils/emoji-index/emoji-index.d.ts new file mode 100644 index 0000000000..0d1d6b8881 --- /dev/null +++ b/types/emoji-mart/dist-es/utils/emoji-index/emoji-index.d.ts @@ -0,0 +1,14 @@ +import { EmojiData } from './nimble-emoji-index'; + +// tslint:disable-next-line strict-export-declare-modifiers +declare const _default: { + search(query: ''): null; + search(query: string): EmojiData|null; + + emojis: { [emoji: string]: EmojiData }; + + /** Mapping of string to keyof emojis */ + emoticons: { [emoticon: string]: string }; +}; + +export { _default as default }; diff --git a/types/emoji-mart/dist-es/utils/emoji-index/index.d.ts b/types/emoji-mart/dist-es/utils/emoji-index/index.d.ts new file mode 100644 index 0000000000..576a5d0cb7 --- /dev/null +++ b/types/emoji-mart/dist-es/utils/emoji-index/index.d.ts @@ -0,0 +1,2 @@ +export { default as emojiIndex } from './emoji-index'; +export { default as nimbleEmojiIndex, EmojiData, CustomEmoji, EmojiSkin } from './nimble-emoji-index'; diff --git a/types/emoji-mart/dist-es/utils/emoji-index/nimble-emoji-index.d.ts b/types/emoji-mart/dist-es/utils/emoji-index/nimble-emoji-index.d.ts new file mode 100644 index 0000000000..010c313d19 --- /dev/null +++ b/types/emoji-mart/dist-es/utils/emoji-index/nimble-emoji-index.d.ts @@ -0,0 +1,40 @@ +import { Data } from "../data"; + +import { CategoryName } from '../shared-props'; + +export type EmojiSkin = 1 | 2 | 3 | 4 | 5 | 6; + +export interface BaseEmoji { + id: string; + name: string; + colons: string; + /** Reverse mapping to keyof emoticons */ + emoticons: string[]; + unified: string; + skin: EmojiSkin | null; + native: string; +} + +export interface CustomEmoji { + // id is overridden by short_names[0] + id?: string; + // colons is overridden by :id: + colons?: string; + name: string; + /** Must contain at least one name. The first name is used as the unique id. */ + short_names: string[]; + emoticons?: string[]; + keywords?: string[]; + imageUrl: string; +} + +export type EmojiData = BaseEmoji | CustomEmoji; + +export default class NimbleEmojiIndex { + constructor(data: Data); + search(query: ''): null; + search(query: string): EmojiData[]|null; + emojis: { [emoji: string]: EmojiData }; + /** Mapping of string to keyof emojis */ + emoticons: { [emoticon: string]: string }; +} diff --git a/types/emoji-mart/dist-es/utils/shared-props.d.ts b/types/emoji-mart/dist-es/utils/shared-props.d.ts new file mode 100644 index 0000000000..c091e24556 --- /dev/null +++ b/types/emoji-mart/dist-es/utils/shared-props.d.ts @@ -0,0 +1,83 @@ +import React = require('react'); + +import { EmojiData, EmojiSkin, CustomEmoji } from './emoji-index/nimble-emoji-index'; + +export type BackgroundImageFn = (set: EmojiSet, sheetSize: EmojiSheetSize) => string; +export type EmojiSet = 'apple' | 'google' | 'twitter' | 'emojione' | 'messenger' | 'facebook'; +export type EmojiSheetSize = 16 | 20 | 32 | 64; + +export interface EmojiProps { + onOver?(emoji: EmojiData, e: React.MouseEvent): void; + onLeave?(emoji: EmojiData, e: React.MouseEvent): void; + onClick?(emoji: EmojiData, e: React.MouseEvent): void; + fallback?(emoji: EmojiData, props: EmojiProps): React.Component; + /** defaults to returning a png from unpkg.com-hosted emoji-datasource-${set} */ + backgroundImageFn?: BackgroundImageFn; + native?: boolean; + forceSize?: boolean; + tooltip?: boolean; + /** defaults to 1 */ + skin?: EmojiSkin; + /** defaults to 64 */ + sheetSize?: EmojiSheetSize; + /** defaults to 52 */ + sheetColumns?: number; + /** defaults to 52 */ + sheetRows?: number; + /** defaults to 'apple' */ + set?: EmojiSet; + size: number; + emoji: string | EmojiData; + html?: boolean; + /** data is omitted here as it should be used for NimbleEmoji only - not emoji */ +} + +export type CategoryName = 'search' | 'recent' | 'people' | 'nature' | 'foods' | 'activity' | 'places' | 'objects' | 'symbols' | 'flags' | 'custom'; + +// tslint:disable-next-line interface-name +export interface I18n { + search: string; + categories: Record; + notfound: string; + skintext: string; +} + +export type PartialI18n = Partial & { categories: Partial }>; + +export interface CustomIcons { + categories: Record React.Component>; +} + +export interface PickerProps { + /** NOTE: default is not preventable */ + onClick?(emoji: EmojiData, e: React.MouseEvent): void; + onSelect?(emoji: EmojiData): void; + onSkinChange?(skin: EmojiSkin): void; + perLine?: number; + emojiSize?: number; + i18n?: PartialI18n; + style?: React.CSSProperties; + title?: string; + emoji?: string; + color?: string; + set?: EmojiSet; + skin?: EmojiSkin; + defaultSkin?: EmojiSkin; + native?: boolean; + backgroundImageFn?: BackgroundImageFn; + sheetSize?: EmojiSheetSize; + emojisToShowFilter?(emoji: EmojiData): boolean; + showPreview?: boolean; + showSkinTones?: boolean; + emojiTooltip?: boolean; + include?: CategoryName[]; + exclude?: CategoryName[]; + recent?: string[]; + autoFocus?: boolean; + /** NOTE: custom emoji are copied into a singleton object on every new mount */ + custom: CustomEmoji[]; + skinEmoji?: string; + notFound?(): React.Component; + notFoundEmoji?: string; + icons?: CustomIcons; +} diff --git a/types/emoji-mart/emoji-mart-tests.tsx b/types/emoji-mart/emoji-mart-tests.tsx index 7b7b8d0471..56b05453a9 100644 --- a/types/emoji-mart/emoji-mart-tests.tsx +++ b/types/emoji-mart/emoji-mart-tests.tsx @@ -1,4 +1,4 @@ -// Port of https://github.com/missive/emoji-mart/blob/master/src/components/emoji.js +// Port of https://github.com/missive/emoji-mart/blob/v2.8.0/stories/index.js import React = require('react'); diff --git a/types/emoji-mart/index.d.ts b/types/emoji-mart/index.d.ts index 22c17731f3..38acd9e021 100644 --- a/types/emoji-mart/index.d.ts +++ b/types/emoji-mart/index.d.ts @@ -1,9 +1,8 @@ -// Type definitions for emoji-mart 2.2 +// Type definitions for emoji-mart 2.8 // Project: https://github.com/missive/emoji-mart // Definitions by: Diogo Franco +// Nick Winans // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -// These definitions should work with 2.3, but the tests doesn't pass on 2.3. - export * from './dist-es'; diff --git a/types/emoji-mart/tsconfig.json b/types/emoji-mart/tsconfig.json index 6ecc944e77..d929a3cc01 100644 --- a/types/emoji-mart/tsconfig.json +++ b/types/emoji-mart/tsconfig.json @@ -20,11 +20,17 @@ "files": [ "index.d.ts", "dist-es/components/category.d.ts", - "dist-es/components/emoji.d.ts", + "dist-es/components/emoji/emoji.d.ts", + "dist-es/components/emoji/nimble-emoji.d.ts", "dist-es/components/index.d.ts", - "dist-es/components/picker.d.ts", - "dist-es/utils/emoji-index.d.ts", + "dist-es/components/picker/picker.d.ts", + "dist-es/components/picker/nimble-picker.d.ts", + "dist-es/utils/emoji-index/emoji-index.d.ts", + "dist-es/utils/emoji-index/nimble-emoji-index.d.ts", + "dist-es/utils/emoji-index/index.d.ts", + "dist-es/utils/data.d.ts", "dist-es/utils/frequently.d.ts", + "dist-es/utils/shared-props.d.ts", "dist-es/utils/store.d.ts", "dist-es/index.d.ts", "emoji-mart-tests.tsx" diff --git a/types/esri-leaflet/index.d.ts b/types/esri-leaflet/index.d.ts index 3dbd351cb5..df1a9c3752 100644 --- a/types/esri-leaflet/index.d.ts +++ b/types/esri-leaflet/index.d.ts @@ -44,6 +44,7 @@ declare module 'leaflet' { | 'GrayLabels' | 'DarkGrayLabels' | 'ImageryLabels' + | 'ImageryClarity' | 'ImageryTransportation' | 'ShadedReliefLabels' | 'TerrainLabels'; diff --git a/types/evaporate/index.d.ts b/types/evaporate/index.d.ts index 92f02c9c73..8e959f6b64 100644 --- a/types/evaporate/index.d.ts +++ b/types/evaporate/index.d.ts @@ -52,7 +52,7 @@ declare namespace Evaporate { customAuthMethod?: null | (( signParams: string, signHeaders: string, - stringToSign: () => string | undefined, + stringToSign: string, signatureDateTime: string, canonicalRequest: string ) => Promise); diff --git a/types/expo/expo-tests.tsx b/types/expo/expo-tests.tsx index 210c3400a9..0098a14489 100644 --- a/types/expo/expo-tests.tsx +++ b/types/expo/expo-tests.tsx @@ -374,9 +374,12 @@ async () => { }; async () => { - const result = await ImageManipulator.manipulate('url', [{ - rotate: 90 - }], { + const result = await ImageManipulator.manipulate('url', [ + { rotate: 90 }, + { resize: { width: 300 } }, + { resize: { height: 300 } }, + { resize: { height: 300, width: 300 } }, + ], { compress: 0.75 }); diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index 8ad088763d..868afd5e56 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -1519,7 +1519,7 @@ export namespace ImageManipulator { type Action = Resize | Rotate | Flip | Crop; interface Resize { - resize: { width: number, height: number }; + resize: { width?: number, height?: number }; } interface Rotate { diff --git a/types/express-fileupload/index.d.ts b/types/express-fileupload/index.d.ts index 89331c066a..060476b109 100644 --- a/types/express-fileupload/index.d.ts +++ b/types/express-fileupload/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for express-fileupload 0.1 +// Type definitions for express-fileupload 0.4 // Project: https://github.com/richardgirges/express-fileupload#readme // Definitions by: Gintautas Miselis +// Sefa Ilkimen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -28,13 +29,16 @@ declare namespace fileUpload { encoding: string; mimetype: string; data: Buffer; + truncated: boolean; mv(path: string, callback: (err: any) => void): void; + mv(path: string): Promise; } interface Options { debug?: boolean; safeFileNames?: boolean; preserveExtension?: boolean | string | number; + abortOnLimit?: boolean; [property: string]: any; } } diff --git a/types/faker/index.d.ts b/types/faker/index.d.ts index 552e7d3eeb..248a0ba96c 100644 --- a/types/faker/index.d.ts +++ b/types/faker/index.d.ts @@ -11,7 +11,8 @@ declare const fakerStatic: Faker.FakerStatic; declare namespace Faker { interface FakerStatic { locale: string; - + setLocale(locale: string): void; + address: { zipCode(format?: string): string; city(format?: number): string; diff --git a/types/ffi-napi/ffi-napi-tests.ts b/types/ffi-napi/ffi-napi-tests.ts new file mode 100644 index 0000000000..5965e23e12 --- /dev/null +++ b/types/ffi-napi/ffi-napi-tests.ts @@ -0,0 +1,106 @@ +import ffi = require('ffi-napi'); +import ref = require('ref-napi'); +import Struct = require('ref-struct-di'); +import Union = require('ref-union-di'); +import TArray = require('ref-array-di'); + +{ + const sqlite3 = ref.types.void; + const sqlite3Ptr = ref.refType(sqlite3); + const sqlite3PtrPtr = ref.refType(sqlite3Ptr); + const stringPtr = ref.refType(ref.types.CString); + + const libsqlite3 = ffi.Library('libsqlite3', { + sqlite3_open: [ 'int', [ 'string', sqlite3PtrPtr ] ], + sqlite3_close: [ 'int', [ sqlite3PtrPtr ] ], + sqlite3_exec: [ 'int', [ sqlite3PtrPtr, 'string', 'pointer', 'pointer', stringPtr ] ], + sqlite3_changes: [ 'int', [ sqlite3PtrPtr ]] + }); + + const dbPtrPtr = ref.alloc(sqlite3PtrPtr); + libsqlite3.sqlite3_open("test.sqlite3", dbPtrPtr); +} +{ + const func = ffi.ForeignFunction(new Buffer(10), 'int', [ 'int' ]); + func(-5); + func.async(-5, (err: any, res: any) => {}); +} +{ + const funcPtr = ffi.Callback('int', [ 'int' ], Math.abs); + const func = ffi.ForeignFunction(funcPtr, 'int', [ 'int' ]); +} +{ + const printfPointer = ffi.DynamicLibrary().get('printf'); + const printfGen = ffi.VariadicForeignFunction(printfPointer, 'void', [ 'string' ]); + printfGen()('Hello World!\n'); + printfGen('int')('This is an int: %d\n', 10); + printfGen('string')('This is a string: %s\n', 'hello'); +} +{ + ref.address(new Buffer(1)); + const intBuf = ref.alloc(ref.types.int); + const intWith4 = ref.alloc(ref.types.int, 4); + const buf0 = ref.allocCString('hello world'); + const type = ref.coerceType('int **'); + const val = ref.deref(intBuf); +} +{ + ref.isNull(new Buffer(1)); +} +{ + const str = ref.readCString(new Buffer('hello\0world\0'), 0); + const buf = ref.alloc('int64'); + ref.writeInt64BE(buf, 0, '9223372036854775807'); + const val = ref.readInt64BE(buf, 0); +} +{ + const voidPtrType = ref.refType(ref.types.void); + const buf = ref.alloc('int64'); + ref.writeInt64LE(buf, 0, '9223372036854775807'); +} +{ + const S1 = Struct({ a: ref.types.int }); + const S2 = new Struct({ a: 'int' }); +} +{ + const P = new Struct(); + P.defineProperty('a', ref.types.int); + P.defineProperty('d', 'long'); +} +{ + const SimpleStruct = Struct({ + first : ref.types.byte, + last : ref.types.byte + }); + + const ss = new SimpleStruct({ first: 50, last: 100 }); + ss.first += 200; +} +{ + const ST = Struct(); + const test: ref.Type = ST.fields['t'].type; +} +{ + const CharArray = TArray('char'); + const b = new Buffer('hello', 'ascii'); + const a = new CharArray(b); +} +{ + const Int32Array = TArray(ref.types.int32); + const input = [1, 4, 91, 123123, 5123512, 0, -1]; + const a = new Int32Array(input); +} +{ + const int = ref.types.int; + const IntArray = TArray(int); + + const buf = new Buffer(int.size * 3); + int.set(buf, int.size * 0, 5); + int.set(buf, int.size * 1, 8); + int.set(buf, int.size * 2, 0); + + const array = IntArray.untilZeros(buf); +} +{ + const refCharArr = TArray('char')([1, 3, 5], 2).ref(); +} diff --git a/types/ffi-napi/index.d.ts b/types/ffi-napi/index.d.ts new file mode 100644 index 0000000000..6cfd439e13 --- /dev/null +++ b/types/ffi-napi/index.d.ts @@ -0,0 +1,186 @@ +// Type definitions for node-ffi-napi 2.4 +// Project: https://github.com/node-ffi/node-ffi +// Definitions by: Keerthi Niranjan , Kiran Niranjan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// + + +import ref = require('ref-napi'); +import StructType = require('ref-struct-di'); + +/** Provides a friendly API on-top of `DynamicLibrary` and `ForeignFunction`. */ +export interface Library { + /** The extension to use on libraries. */ + EXT: string; + + /** + * @param libFile name of library + * @param funcs hash of [retType, [...argType], opts?: {abi?, async?, varargs?}] + * @param lib hash that will be extended + */ + new (libFile: string, funcs?: {[key: string]: any[]}, lib?: object): any; + + /** + * @param libFile name of library + * @param funcs hash of [retType, [...argType], opts?: {abi?, async?, varargs?}] + * @param lib hash that will be extended + */ + (libFile: string, funcs?: {[key: string]: any[]}, lib?: object): any; +} +export const Library: Library; + +/** Get value of errno. */ +export function errno(): number; + +export interface Function extends ref.Type { + /** The type of return value. */ + retType: ref.Type; + /** The type of arguments. */ + argTypes: ref.Type[]; + /** Is set for node-ffi functions. */ + ffi_type: Buffer; + abi: number; + + /** Get a `Callback` pointer of this function type. */ + toPointer(fn: (...args: any[]) => any): Buffer; + /** Get a `ForeignFunction` of this function type. */ + toFunction(buf: Buffer): ForeignFunction; +} + +/** Creates and returns a type for a C function pointer. */ +export const Function: { + new (retType: ref.Type | string, argTypes: any[], abi?: number): Function; + (retType: ref.Type | string, argTypes: any[], abi?: number): Function; +}; + +export interface ForeignFunction { + (...args: any[]): any; + async(...args: any[]): void; +} + +/** + * Represents a foreign function in another library. Manages all of the aspects + * of function execution, including marshalling the data parameters for the + * function into native types and also unmarshalling the return from function + * execution. + */ +export const ForeignFunction: { + new (ptr: Buffer, retType: ref.Type | string, argTypes: any[], abi?: number): ForeignFunction; + (ptr: Buffer, retType: ref.Type | string, argTypes: any[], abi?: number): ForeignFunction; +}; + +export interface VariadicForeignFunction { + /** + * What gets returned is another function that needs to be invoked with the rest + * of the variadic types that are being invoked from the function. + */ + (...args: any[]): ForeignFunction; + + /** + * Return type as a property of the function generator to + * allow for monkey patching the return value in the very rare case where the + * return type is variadic as well + */ + returnType: any; +} + +/** + * For when you want to call to a C function with variable amount of arguments. + * i.e. `printf`. + * + * This function takes care of caching and reusing `ForeignFunction` instances that + * contain the same ffi_type argument signature. + */ +export const VariadicForeignFunction: { + new (ptr: Buffer, ret: ref.Type | string, fixedArgs: any[], abi?: number): VariadicForeignFunction; + (ptr: Buffer, ret: ref.Type | string, fixedArgs: any[], abi?: number): VariadicForeignFunction; +}; + +export interface DynamicLibrary { + /** Close library, returns the result of the `dlclose` system function. */ + close(): number; + /** Get a symbol from this library. */ + get(symbol: string): Buffer; + /** Get the result of the `dlerror` system function. */ + error(): string; +} + +/** + * This class loads and fetches function pointers for dynamic libraries + * (.so, .dylib, etc). After the libray's function pointer is acquired, then you + * call `get(symbol)` to retreive a pointer to an exported symbol. You need to + * call `get___` on the pointer to dereference it into its actual value, or + * turn the pointer into a callable function with `ForeignFunction`. + */ +export const DynamicLibrary: { + FLAGS: { + RTLD_LAZY: number; + RTLD_NOW: number; + RTLD_LOCAL: number; + RTLD_GLOBAL: number; + RTLD_NOLOAD: number; + RTLD_NODELETE: number; + RTLD_NEXT: Buffer; + RTLD_DEFAUL: Buffer; + } + + new (path?: string, mode?: number): DynamicLibrary; + (path?: string, mode?: number): DynamicLibrary; +}; + +/** + * Turns a JavaScript function into a C function pointer. + * The function pointer may be used in other C functions that + * accept C callback functions. + */ +export interface Callback { + new (retType: any, argTypes: any[], abi: number, fn: any): Buffer; + new (retType: any, argTypes: any[], fn: any): Buffer; + (retType: any, argTypes: any[], abi: number, fn: any): Buffer; + (retType: any, argTypes: any[], fn: any): Buffer; +} +export const Callback: Callback; + +export const ffiType: { + /** Get a `ffi_type *` Buffer appropriate for the given type. */ + (type: ref.Type | string): Buffer + FFI_TYPE: StructType; +}; + +export function CIF(retType: any, types: any[], abi?: any): Buffer; +export function CIF_var(retType: any, types: any[], numFixedArgs: number, abi?: any): Buffer; +export const HAS_OBJC: boolean; +export const FFI_TYPES: {[key: string]: Buffer}; +export const FFI_OK: number; +export const FFI_BAD_TYPEDEF: number; +export const FFI_BAD_ABI: number; +export const FFI_DEFAULT_ABI: number; +export const FFI_FIRST_ABI: number; +export const FFI_LAST_ABI: number; +export const FFI_SYSV: number; +export const FFI_UNIX64: number; +export const RTLD_LAZY: number; +export const RTLD_NOW: number; +export const RTLD_LOCAL: number; +export const RTLD_GLOBAL: number; +export const RTLD_NOLOAD: number; +export const RTLD_NODELETE: number; +export const RTLD_NEXT: Buffer; +export const RTLD_DEFAULT: Buffer; +export const LIB_EXT: string; +export const FFI_TYPE: StructType; + +/** Default types. */ +export const types: { + void: ref.Type; int64: ref.Type; ushort: ref.Type; + int: ref.Type; uint64: ref.Type; float: ref.Type; + uint: ref.Type; long: ref.Type; double: ref.Type; + int8: ref.Type; ulong: ref.Type; Object: ref.Type; + uint8: ref.Type; longlong: ref.Type; CString: ref.Type; + int16: ref.Type; ulonglong: ref.Type; bool: ref.Type; + uint16: ref.Type; char: ref.Type; byte: ref.Type; + int32: ref.Type; uchar: ref.Type; size_t: ref.Type; + uint32: ref.Type; short: ref.Type; +}; diff --git a/types/ffi-napi/node-ffi-napi-buffer.d.ts b/types/ffi-napi/node-ffi-napi-buffer.d.ts new file mode 100644 index 0000000000..fa817e1662 --- /dev/null +++ b/types/ffi-napi/node-ffi-napi-buffer.d.ts @@ -0,0 +1,50 @@ +// DefinitelyTyped: partial + +interface Buffer { + /** Shorthand for `ref.address`. */ + address(): number; + /** Shorthand for `ref.deref`. */ + deref(): any; + /** Shorthand for `ref.isNull`. */ + isNull(): boolean; + /** Shorthand for `ref.readCString`. */ + readCString(offset?: number): string; + /** Shorthand for `ref.readInt64BE`. */ + readInt64BE(offset?: number): string; + /** Shorthand for `ref.readInt64LE`. */ + readInt64LE(offset?: number): string; + /** Shorthand for `ref.readObject`. */ + readObject(offset?: number): string; + /** Shorthand for `ref.readPointer`. */ + readPointer(offset?: number): string; + /** Shorthand for `ref.readUInt64BE`. */ + readUInt64BE(offset?: number): string; + /** Shorthand for `ref.readUInt64LE`. */ + readUInt64LE(offset?: number): string; + /** Shorthand for `ref.ref`. */ + ref(): Buffer; + /** Shorthand for `ref.reinterpret`. */ + reinterpret(size: number, offset?: number): Buffer; + /** Shorthand for `ref.reinterpretUntilZeros`. */ + reinterpretUntilZeros(size: number, offset?: number): Buffer; + /** Shorthand for `ref.writeCString`. */ + writeCString(offset: number, input: string, encoding?: string): void; + /** Shorthand for `ref.writeInt64BE`. */ + writeInt64BE(offset: number, input: number | string): any; + /** Shorthand for `ref.writeInt64LE`. */ + writeInt64LE(offset: number, input: number | string): any; + /** Shorthand for `ref.writeObject`. */ + writeObject(offset: number, object: object): void; + /** Shorthand for `ref.writePointer`. */ + writePointer(offset: number, pointer: Buffer): void; + /** Shorthand for `ref.writeUInt64BE`. */ + writeUInt64BE(offset: number, input: number | string): any; + /** Shorthand for `ref.writeUInt64LE`. */ + writeUInt64LE(offset: number, input: number | string): any; + + /** + * Generate string for inspecting. + * String includes the hex-encoded memory address of the Buffer instance. + */ + inspect(): string; +} diff --git a/types/ffi-napi/tsconfig.json b/types/ffi-napi/tsconfig.json new file mode 100644 index 0000000000..c914c55679 --- /dev/null +++ b/types/ffi-napi/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": [ + "index.d.ts", + "node-ffi-napi-buffer.d.ts", + "ffi-napi-tests.ts" + ] +} diff --git a/types/ffi-napi/tslint.json b/types/ffi-napi/tslint.json new file mode 100644 index 0000000000..c5fa24ca82 --- /dev/null +++ b/types/ffi-napi/tslint.json @@ -0,0 +1,8 @@ +{ + "extends": "dtslint/dt.json", + + "rules": { + "no-consecutive-blank-lines": [true, 3], + "ban-types": [false] + } +} diff --git a/types/fibjs/declare/DgramSocket.d.ts b/types/fibjs/declare/DgramSocket.d.ts index 6618ae9c1c..22486d5832 100644 --- a/types/fibjs/declare/DgramSocket.d.ts +++ b/types/fibjs/declare/DgramSocket.d.ts @@ -45,7 +45,7 @@ declare class Class_DgramSocket extends Class_EventEmitter { * * @async */ - bind(opts: Object): void; + bind(opts: object): void; /** * diff --git a/types/fibjs/declare/Digest.d.ts b/types/fibjs/declare/Digest.d.ts index d440f31486..71c62f0386 100644 --- a/types/fibjs/declare/Digest.d.ts +++ b/types/fibjs/declare/Digest.d.ts @@ -52,23 +52,13 @@ declare class Class_Digest extends Class__object { /** * * @brief 计算并返回摘要 - * @param data 二进制数据块,此数据块将在计算前更新进摘要 - * @return 返回摘要的二进制数据 + * @param codec 指定编码格式,允许值为:"buffer", "hex", "base64", "utf8", 或者系统支持的字符集 + * @return 返回指定编码的摘要表示 * * * */ - digest(data: Class_Buffer): Class_Buffer; - - /** - * - * @brief 计算并返回摘要 - * @return 返回摘要的二进制数据 - * - * - * - */ - digest(): Class_Buffer; + digest(codec?: string/** = "buffer"*/): any; } /** endof class */ diff --git a/types/fibjs/declare/EventEmitter.d.ts b/types/fibjs/declare/EventEmitter.d.ts index 608b6f2edb..0008b2faa3 100644 --- a/types/fibjs/declare/EventEmitter.d.ts +++ b/types/fibjs/declare/EventEmitter.d.ts @@ -56,7 +56,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - on(ev: string, func: Function): Object; + on(ev: string, func: Function): object; /** * @@ -67,7 +67,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - on(map: Object): Object; + on(map: object): object; /** * @@ -79,7 +79,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - addListener(ev: string, func: Function): Object; + addListener(ev: string, func: Function): object; /** * @@ -90,7 +90,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - addListener(map: Object): Object; + addListener(map: object): object; /** * @@ -102,7 +102,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - prependListener(ev: string, func: Function): Object; + prependListener(ev: string, func: Function): object; /** * @@ -113,7 +113,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - prependListener(map: Object): Object; + prependListener(map: object): object; /** * @@ -125,7 +125,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - once(ev: string, func: Function): Object; + once(ev: string, func: Function): object; /** * @@ -136,7 +136,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - once(map: Object): Object; + once(map: object): object; /** * @@ -148,7 +148,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - prependOnceListener(ev: string, func: Function): Object; + prependOnceListener(ev: string, func: Function): object; /** * @@ -159,7 +159,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - prependOnceListener(map: Object): Object; + prependOnceListener(map: object): object; /** * @@ -171,7 +171,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - off(ev: string, func: Function): Object; + off(ev: string, func: Function): object; /** * @@ -182,7 +182,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - off(ev: string): Object; + off(ev: string): object; /** * @@ -193,7 +193,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - off(map: Object): Object; + off(map: object): object; /** * @@ -205,7 +205,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - removeListener(ev: string, func: Function): Object; + removeListener(ev: string, func: Function): object; /** * @@ -216,7 +216,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - removeListener(ev: string): Object; + removeListener(ev: string): object; /** * @@ -227,7 +227,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - removeListener(map: Object): Object; + removeListener(map: object): object; /** * @@ -238,7 +238,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - removeAllListeners(evs?: any[]/** = v8::Array::New(isolate)*/): Object; + removeAllListeners(evs?: any[]/** = v8::Array::New(isolate)*/): object; /** * diff --git a/types/fibjs/declare/EventInfo.d.ts b/types/fibjs/declare/EventInfo.d.ts index a7c43a70a7..f60190d315 100644 --- a/types/fibjs/declare/EventInfo.d.ts +++ b/types/fibjs/declare/EventInfo.d.ts @@ -70,7 +70,7 @@ declare class Class_EventInfo extends Class__object { * @type Object */ - target: Object + target: object diff --git a/types/fibjs/declare/Handler.d.ts b/types/fibjs/declare/Handler.d.ts index ae7af823a2..df2ef6463f 100644 --- a/types/fibjs/declare/Handler.d.ts +++ b/types/fibjs/declare/Handler.d.ts @@ -44,7 +44,7 @@ declare class Class_Handler extends Class__object { * * */ - constructor(map: Object); + constructor(map: object); /** * diff --git a/types/fibjs/declare/HandlerEx.d.ts b/types/fibjs/declare/HandlerEx.d.ts index 504ab42c1a..22bca1ce76 100644 --- a/types/fibjs/declare/HandlerEx.d.ts +++ b/types/fibjs/declare/HandlerEx.d.ts @@ -81,7 +81,7 @@ declare class Class_HandlerEx extends Class_Handler { * * */ - onerror(hdlrs: Object): void; + onerror(hdlrs: object): void; } /** endof class */ diff --git a/types/fibjs/declare/HeapSnapshot.d.ts b/types/fibjs/declare/HeapSnapshot.d.ts index c65282165c..0a10a6b68f 100644 --- a/types/fibjs/declare/HeapSnapshot.d.ts +++ b/types/fibjs/declare/HeapSnapshot.d.ts @@ -71,7 +71,7 @@ declare class Class_HeapSnapshot extends Class__object { * * */ - diff(before: Class_HeapSnapshot): Object; + diff(before: Class_HeapSnapshot): object; /** * diff --git a/types/fibjs/declare/HttpClient.d.ts b/types/fibjs/declare/HttpClient.d.ts index 580e90c70c..7c9f6c073f 100644 --- a/types/fibjs/declare/HttpClient.d.ts +++ b/types/fibjs/declare/HttpClient.d.ts @@ -96,6 +96,30 @@ declare class Class_HttpClient extends Class__object { userAgent: string + /** + * class prop + * + * + * @brief 查询和设置 keep-alive 最大缓存连接数,缺省 128 + * + * + * @type Integer + */ + + poolSize: number + + /** + * class prop + * + * + * @brief 查询和设置 keep-alive 缓存连接超时时间,缺省 10000 ms + * + * + * @type Integer + */ + + poolTimeout: number + /** @@ -139,7 +163,7 @@ declare class Class_HttpClient extends Class__object { * * @async */ - request(method: string, url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + request(method: string, url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -161,7 +185,7 @@ declare class Class_HttpClient extends Class__object { * * @async */ - get(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + get(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -183,7 +207,7 @@ declare class Class_HttpClient extends Class__object { * * @async */ - post(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + post(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -205,7 +229,7 @@ declare class Class_HttpClient extends Class__object { * * @async */ - del(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + del(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -227,7 +251,7 @@ declare class Class_HttpClient extends Class__object { * * @async */ - put(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + put(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -249,7 +273,7 @@ declare class Class_HttpClient extends Class__object { * * @async */ - patch(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + patch(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; } /** endof class */ diff --git a/types/fibjs/declare/HttpCollection.d.ts b/types/fibjs/declare/HttpCollection.d.ts index 5aa34c40bb..1936011e1d 100644 --- a/types/fibjs/declare/HttpCollection.d.ts +++ b/types/fibjs/declare/HttpCollection.d.ts @@ -75,7 +75,7 @@ declare class Class_HttpCollection extends Class__object { * * */ - add(map: Object): void; + add(map: object): void; /** * @@ -96,7 +96,7 @@ declare class Class_HttpCollection extends Class__object { * * */ - set(map: Object): void; + set(map: object): void; /** * diff --git a/types/fibjs/declare/HttpCookie.d.ts b/types/fibjs/declare/HttpCookie.d.ts index 5be7604293..b7c3980150 100644 --- a/types/fibjs/declare/HttpCookie.d.ts +++ b/types/fibjs/declare/HttpCookie.d.ts @@ -118,7 +118,7 @@ declare class Class_HttpCookie extends Class__object { * * */ - constructor(opts?: Object/** = v8::Object::New(isolate)*/); + constructor(opts?: object/** = v8::Object::New(isolate)*/); /** * @@ -130,7 +130,7 @@ declare class Class_HttpCookie extends Class__object { * * */ - constructor(name: string, value: string, opts?: Object/** = v8::Object::New(isolate)*/); + constructor(name: string, value: string, opts?: object/** = v8::Object::New(isolate)*/); /** * diff --git a/types/fibjs/declare/HttpMessage.d.ts b/types/fibjs/declare/HttpMessage.d.ts index 89ef9c96c6..1d64ba5c5f 100644 --- a/types/fibjs/declare/HttpMessage.d.ts +++ b/types/fibjs/declare/HttpMessage.d.ts @@ -151,7 +151,7 @@ declare class Class_HttpMessage extends Class_Message { * * */ - addHeader(map: Object): void; + addHeader(map: object): void; /** * @@ -172,7 +172,7 @@ declare class Class_HttpMessage extends Class_Message { * * */ - setHeader(map: Object): void; + setHeader(map: object): void; /** * diff --git a/types/fibjs/declare/HttpResponse.d.ts b/types/fibjs/declare/HttpResponse.d.ts index 4ecf06866d..7f69b8509a 100644 --- a/types/fibjs/declare/HttpResponse.d.ts +++ b/types/fibjs/declare/HttpResponse.d.ts @@ -80,7 +80,7 @@ declare class Class_HttpResponse extends Class_HttpMessage { * * */ - writeHead(statusCode: number, statusMessage: string, headers?: Object/** = v8::Object::New(isolate)*/): void; + writeHead(statusCode: number, statusMessage: string, headers?: object/** = v8::Object::New(isolate)*/): void; /** * @@ -91,7 +91,7 @@ declare class Class_HttpResponse extends Class_HttpMessage { * * */ - writeHead(statusCode: number, headers?: Object/** = v8::Object::New(isolate)*/): void; + writeHead(statusCode: number, headers?: object/** = v8::Object::New(isolate)*/): void; /** * diff --git a/types/fibjs/declare/HttpServer.d.ts b/types/fibjs/declare/HttpServer.d.ts index 157c951ea8..75ba24c290 100644 --- a/types/fibjs/declare/HttpServer.d.ts +++ b/types/fibjs/declare/HttpServer.d.ts @@ -143,7 +143,7 @@ declare class Class_HttpServer extends Class_TcpServer { * * */ - onerror(hdlrs: Object): void; + onerror(hdlrs: object): void; /** * diff --git a/types/fibjs/declare/LevelDB.d.ts b/types/fibjs/declare/LevelDB.d.ts index feb6ce2b6b..c9721bf337 100644 --- a/types/fibjs/declare/LevelDB.d.ts +++ b/types/fibjs/declare/LevelDB.d.ts @@ -78,7 +78,7 @@ declare class Class_LevelDB extends Class__object { * * */ - mset(map: Object): void; + mset(map: object): void; /** * diff --git a/types/fibjs/declare/LruCache.d.ts b/types/fibjs/declare/LruCache.d.ts index 884bb65d26..f68ac413cd 100644 --- a/types/fibjs/declare/LruCache.d.ts +++ b/types/fibjs/declare/LruCache.d.ts @@ -134,7 +134,7 @@ declare class Class_LruCache extends Class_EventEmitter { * * */ - set(map: Object): void; + set(map: object): void; /** * diff --git a/types/fibjs/declare/MongoCollection.d.ts b/types/fibjs/declare/MongoCollection.d.ts index 4b1f07478b..e721feabcd 100644 --- a/types/fibjs/declare/MongoCollection.d.ts +++ b/types/fibjs/declare/MongoCollection.d.ts @@ -36,7 +36,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - find(query?: Object/** = v8::Object::New(isolate)*/, projection?: Object/** = v8::Object::New(isolate)*/): Class_MongoCursor; + find(query?: object/** = v8::Object::New(isolate)*/, projection?: object/** = v8::Object::New(isolate)*/): Class_MongoCursor; /** * @@ -48,7 +48,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - findOne(query?: Object/** = v8::Object::New(isolate)*/, projection?: Object/** = v8::Object::New(isolate)*/): Object; + findOne(query?: object/** = v8::Object::New(isolate)*/, projection?: object/** = v8::Object::New(isolate)*/): object; /** * @@ -59,7 +59,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - findAndModify(query: Object): Object; + findAndModify(query: object): object; /** * @@ -79,7 +79,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - insert(document: Object): void; + insert(document: object): void; /** * @@ -89,7 +89,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - save(document: Object): void; + save(document: object): void; /** * @@ -102,7 +102,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - update(query: Object, document: Object, upsert?: boolean/** = false*/, multi?: boolean/** = false*/): void; + update(query: object, document: object, upsert?: boolean/** = false*/, multi?: boolean/** = false*/): void; /** * @@ -114,7 +114,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - update(query: Object, document: Object, options: Object): void; + update(query: object, document: object, options: object): void; /** * @@ -124,7 +124,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - remove(query: Object): void; + remove(query: object): void; /** * @@ -135,7 +135,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - runCommand(cmd: Object): Object; + runCommand(cmd: object): object; /** * @@ -147,7 +147,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - runCommand(cmd: string, arg?: Object/** = v8::Object::New(isolate)*/): Object; + runCommand(cmd: string, arg?: object/** = v8::Object::New(isolate)*/): object; /** * @@ -166,7 +166,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - ensureIndex(keys: Object, options?: Object/** = v8::Object::New(isolate)*/): void; + ensureIndex(keys: object, options?: object/** = v8::Object::New(isolate)*/): void; /** * @@ -176,7 +176,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - reIndex(): Object; + reIndex(): object; /** * @@ -187,7 +187,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - dropIndex(name: string): Object; + dropIndex(name: string): object; /** * @@ -197,7 +197,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - dropIndexes(): Object; + dropIndexes(): object; /** * diff --git a/types/fibjs/declare/MongoCursor.d.ts b/types/fibjs/declare/MongoCursor.d.ts index d9e26b833f..2dc99b5e96 100644 --- a/types/fibjs/declare/MongoCursor.d.ts +++ b/types/fibjs/declare/MongoCursor.d.ts @@ -57,7 +57,7 @@ declare class Class_MongoCursor extends Class__object { * * */ - sort(opts: Object): Class_MongoCursor; + sort(opts: object): Class_MongoCursor; /** * @@ -77,7 +77,7 @@ declare class Class_MongoCursor extends Class__object { * * */ - next(): Object; + next(): object; /** * @@ -140,7 +140,7 @@ declare class Class_MongoCursor extends Class__object { * * */ - hint(opts: Object): Class_MongoCursor; + hint(opts: object): Class_MongoCursor; } /** endof class */ diff --git a/types/fibjs/declare/MongoDB.d.ts b/types/fibjs/declare/MongoDB.d.ts index c0bf5432bd..11bcf1456d 100644 --- a/types/fibjs/declare/MongoDB.d.ts +++ b/types/fibjs/declare/MongoDB.d.ts @@ -46,7 +46,7 @@ declare class Class_MongoDB extends Class__object { * * */ - runCommand(cmd: Object): Object; + runCommand(cmd: object): object; /** * @@ -58,7 +58,7 @@ declare class Class_MongoDB extends Class__object { * * */ - runCommand(cmd: string, arg: any): Object; + runCommand(cmd: string, arg: any): object; /** * diff --git a/types/fibjs/declare/PKey.d.ts b/types/fibjs/declare/PKey.d.ts index 0c3f939e3e..297cfb2a13 100644 --- a/types/fibjs/declare/PKey.d.ts +++ b/types/fibjs/declare/PKey.d.ts @@ -144,7 +144,7 @@ declare class Class_PKey extends Class__object { * * */ - constructor(jsonKey: Object); + constructor(jsonKey: object); /** * @@ -258,7 +258,7 @@ declare class Class_PKey extends Class__object { * * */ - importKey(jsonKey: Object): void; + importKey(jsonKey: object): void; /** * @@ -299,7 +299,7 @@ declare class Class_PKey extends Class__object { * * */ - exportJson(): Object; + exportJson(): object; /** * diff --git a/types/fibjs/declare/Redis.d.ts b/types/fibjs/declare/Redis.d.ts index 4c5201d62c..384e0e4d80 100644 --- a/types/fibjs/declare/Redis.d.ts +++ b/types/fibjs/declare/Redis.d.ts @@ -90,7 +90,7 @@ declare class Class_Redis extends Class__object { * * */ - mset(kvs: Object): void; + mset(kvs: object): void; /** * @@ -108,7 +108,7 @@ declare class Class_Redis extends Class__object { * * */ - msetNX(kvs: Object): void; + msetNX(kvs: object): void; /** * @@ -383,7 +383,7 @@ declare class Class_Redis extends Class__object { * * */ - sub(map: Object): void; + sub(map: object): void; /** * @@ -424,7 +424,7 @@ declare class Class_Redis extends Class__object { * * */ - unsub(map: Object): void; + unsub(map: object): void; /** * @@ -445,7 +445,7 @@ declare class Class_Redis extends Class__object { * * */ - psub(map: Object): void; + psub(map: object): void; /** * @@ -486,7 +486,7 @@ declare class Class_Redis extends Class__object { * * */ - unpsub(map: Object): void; + unpsub(map: object): void; /** * diff --git a/types/fibjs/declare/RedisHash.d.ts b/types/fibjs/declare/RedisHash.d.ts index 0c8c9ea362..0c16eef47d 100644 --- a/types/fibjs/declare/RedisHash.d.ts +++ b/types/fibjs/declare/RedisHash.d.ts @@ -53,7 +53,7 @@ declare class Class_RedisHash extends Class__object { * * */ - mset(kvs: Object): void; + mset(kvs: object): void; /** * diff --git a/types/fibjs/declare/RedisSortedSet.d.ts b/types/fibjs/declare/RedisSortedSet.d.ts index ed2bcfaf5c..1769fb0a79 100644 --- a/types/fibjs/declare/RedisSortedSet.d.ts +++ b/types/fibjs/declare/RedisSortedSet.d.ts @@ -34,7 +34,7 @@ declare class Class_RedisSortedSet extends Class__object { * * */ - add(sms: Object): number; + add(sms: object): number; /** * diff --git a/types/fibjs/declare/Routing.d.ts b/types/fibjs/declare/Routing.d.ts index c06bc4e887..aef820feae 100644 --- a/types/fibjs/declare/Routing.d.ts +++ b/types/fibjs/declare/Routing.d.ts @@ -34,7 +34,7 @@ declare class Class_Routing extends Class_Handler { * * */ - constructor(map?: Object/** = v8::Object::New(isolate)*/); + constructor(map?: object/** = v8::Object::New(isolate)*/); /** * @@ -45,7 +45,7 @@ declare class Class_Routing extends Class_Handler { * * */ - constructor(method: string, map: Object); + constructor(method: string, map: object); /** * @@ -67,7 +67,7 @@ declare class Class_Routing extends Class_Handler { * * */ - append(map: Object): Class_Routing; + append(map: object): Class_Routing; /** * @@ -103,7 +103,7 @@ declare class Class_Routing extends Class_Handler { * * */ - all(map: Object): Class_Routing; + all(map: object): Class_Routing; /** * @@ -126,7 +126,7 @@ declare class Class_Routing extends Class_Handler { * * */ - get(map: Object): Class_Routing; + get(map: object): Class_Routing; /** * @@ -149,7 +149,7 @@ declare class Class_Routing extends Class_Handler { * * */ - post(map: Object): Class_Routing; + post(map: object): Class_Routing; /** * @@ -172,7 +172,7 @@ declare class Class_Routing extends Class_Handler { * * */ - del(map: Object): Class_Routing; + del(map: object): Class_Routing; /** * @@ -195,7 +195,7 @@ declare class Class_Routing extends Class_Handler { * * */ - put(map: Object): Class_Routing; + put(map: object): Class_Routing; /** * @@ -218,7 +218,7 @@ declare class Class_Routing extends Class_Handler { * * */ - patch(map: Object): Class_Routing; + patch(map: object): Class_Routing; /** * @@ -241,7 +241,7 @@ declare class Class_Routing extends Class_Handler { * * */ - find(map: Object): Class_Routing; + find(map: object): Class_Routing; /** * diff --git a/types/fibjs/declare/SandBox.d.ts b/types/fibjs/declare/SandBox.d.ts index 31f9dc53ce..fc3152b232 100644 --- a/types/fibjs/declare/SandBox.d.ts +++ b/types/fibjs/declare/SandBox.d.ts @@ -34,7 +34,20 @@ declare class Class_SandBox extends Class__object { * @type Object */ - global: Object + global: object + + /** + * class prop + * + * + * @brief 查询沙箱中现存的所有模块的字典对象 + * + * + * @readonly + * @type Object + */ + + modules: object @@ -46,7 +59,7 @@ declare class Class_SandBox extends Class__object { * * */ - constructor(mods: Object); + constructor(mods: object); /** * @@ -57,7 +70,7 @@ declare class Class_SandBox extends Class__object { * * */ - constructor(mods: Object, require: Function); + constructor(mods: object, require: Function); /** * @@ -68,7 +81,7 @@ declare class Class_SandBox extends Class__object { * * */ - constructor(mods: Object, global: Object); + constructor(mods: object, global: object); /** * @@ -80,7 +93,7 @@ declare class Class_SandBox extends Class__object { * * */ - constructor(mods: Object, require: Function, global: Object); + constructor(mods: object, require: Function, global: object); /** * @@ -101,7 +114,7 @@ declare class Class_SandBox extends Class__object { * * */ - add(mods: Object): void; + add(mods: object): void; /** * @@ -125,6 +138,17 @@ declare class Class_SandBox extends Class__object { */ remove(id: string): void; + /** + * + * @brief 从沙箱中检测基础模块是否存在 + * @param id 指定要检测的模块名称,此路径与当前运行脚本无关,必须为绝对路径或者模块名 + * @return 是否存在 + * + * + * + */ + has(id: string): boolean; + /** * * @brief 复制当前沙箱,新沙箱包含当前沙箱的模块,以及相同的名称和 require 函数 @@ -135,6 +159,22 @@ declare class Class_SandBox extends Class__object { */ clone(): Class_SandBox; + /** + * + * @brief 冻结当前沙箱,冻结后的沙箱,对 global 所做的修改将被忽略 + * + * + */ + freeze(): void; + + /** + * + * @brief 重新加载沙箱内的模块,此操作只会重新初始化模块,复位模块内的变量,不更新模块代码 + * + * + */ + refresh(): void; + /** * * @brief 运行一个脚本 @@ -170,6 +210,44 @@ declare class Class_SandBox extends Class__object { */ require(id: string, base: string): any; + /** + * + * @brief 对指定的 extname 添加 compiler, extname 不可为系统内置扩展名 (包括 {'.js', '.json', '.jsc', '.wasm'}), compiler 需返回有效的 javascript 脚本. + * + * ```JavaScript + * var vm = require('vm'); + * var sbox = new vm.SandBox({ + * }); + * + * // 编译 typescript 脚本为 js 并加载 + * sbox.setModuleCompiler('.ts', tsCompiler); + * var mod_ts = sbox.require('./a.ts'); + * + * // 编译 coffee 脚本为 js 并加载 + * sbox.setModuleCompiler('.coffee', cafeCompiler); + * var mod_coffee = sbox.require('./a.coffee'); + * + * // 编译 jsx 脚本为 js 并加载 + * sbox.setModuleCompiler('.jsx', reactCompiler); + * var mod_react = sbox.require('./a.jsx'); + * + * // 编译 yml 脚本为自定义的内容(如 API 集合) 并加载 + * sbox.setModuleCompiler('.yml', yaml2Rest) + * sbox.setModuleCompiler('.yaml', yaml2Rest) + * + * // 编译 markdown 为自定义的内容(如 html 字符串或 XmlDocument 对象) 并加载 + * sbox.setModuleCompiler('.md', mdCompiler) + * sbox.setModuleCompiler('.markdown', mdCompiler) + * ``` + * + * @param extname 指定的 extname, 必须以 '.' 开头, 且为非系统内置扩展名 + * @param compiler 编译回调函数, 所有带 extname 的文件仅会 require 一次. 该回调函数格式为 `compiler(buf, requireInfo)`, buf 为读取到的文件 Buffer, requireInfo 结构为 `{filename: string}`. + * + * + * + */ + setModuleCompiler(extname: string, compiler: Function): void; + } /** endof class */ /** endof `module Or Internal Object` */ diff --git a/types/fibjs/declare/Service.d.ts b/types/fibjs/declare/Service.d.ts index 6ca8feab53..7816e2d8bc 100644 --- a/types/fibjs/declare/Service.d.ts +++ b/types/fibjs/declare/Service.d.ts @@ -84,7 +84,7 @@ declare class Class_Service extends Class_EventEmitter { * * */ - constructor(name: string, worker: Function, event?: Object/** = v8::Object::New(isolate)*/); + constructor(name: string, worker: Function, event?: object/** = v8::Object::New(isolate)*/); /** * diff --git a/types/fibjs/declare/UrlObject.d.ts b/types/fibjs/declare/UrlObject.d.ts index 578d3b5079..5baa5b2d7d 100644 --- a/types/fibjs/declare/UrlObject.d.ts +++ b/types/fibjs/declare/UrlObject.d.ts @@ -216,7 +216,7 @@ declare class Class_UrlObject extends Class__object { * * */ - constructor(args: Object); + constructor(args: object); /** * @@ -250,7 +250,7 @@ declare class Class_UrlObject extends Class__object { * * */ - format(args: Object): void; + format(args: object): void; /** * diff --git a/types/fibjs/declare/Worker.d.ts b/types/fibjs/declare/Worker.d.ts index 1bbc793b85..c427f6f41c 100644 --- a/types/fibjs/declare/Worker.d.ts +++ b/types/fibjs/declare/Worker.d.ts @@ -47,7 +47,7 @@ declare class Class_Worker extends Class_EventEmitter { * * */ - constructor(path: string, opts?: Object/** = v8::Object::New(isolate)*/); + constructor(path: string, opts?: object/** = v8::Object::New(isolate)*/); /** * diff --git a/types/fibjs/declare/X509Req.d.ts b/types/fibjs/declare/X509Req.d.ts index 6317e9afa1..502c078402 100644 --- a/types/fibjs/declare/X509Req.d.ts +++ b/types/fibjs/declare/X509Req.d.ts @@ -146,7 +146,7 @@ declare class Class_X509Req extends Class__object { * * @async */ - sign(issuer: string, key: Class_PKey, opts?: Object/** = v8::Object::New(isolate)*/): Class_X509Cert; + sign(issuer: string, key: Class_PKey, opts?: object/** = v8::Object::New(isolate)*/): Class_X509Cert; } /** endof class */ diff --git a/types/fibjs/declare/bson.d.ts b/types/fibjs/declare/bson.d.ts index 920a1ace79..f9eeab19cb 100644 --- a/types/fibjs/declare/bson.d.ts +++ b/types/fibjs/declare/bson.d.ts @@ -217,7 +217,7 @@ declare module "bson" { * * */ - export function encode(data: Object): Class_Buffer; + export function encode(data: object): Class_Buffer; /** * @@ -228,7 +228,7 @@ declare module "bson" { * * */ - export function decode(data: Class_Buffer): Object; + export function decode(data: Class_Buffer): object; } /** end of `module bson` */ export = bson diff --git a/types/fibjs/declare/console.d.ts b/types/fibjs/declare/console.d.ts index 7a657ecd93..43f8603c2e 100644 --- a/types/fibjs/declare/console.d.ts +++ b/types/fibjs/declare/console.d.ts @@ -391,7 +391,7 @@ declare module "console" { * * */ - export function add(cfg: Object): void; + export function add(cfg: object): void; /** * diff --git a/types/fibjs/declare/dgram.d.ts b/types/fibjs/declare/dgram.d.ts index e925eac7af..0d3ccd20a9 100644 --- a/types/fibjs/declare/dgram.d.ts +++ b/types/fibjs/declare/dgram.d.ts @@ -238,7 +238,7 @@ declare module "dgram" { * * */ - export function createSocket(opts: Object): Class_DgramSocket; + export function createSocket(opts: object): Class_DgramSocket; /** * @@ -260,7 +260,7 @@ declare module "dgram" { * * */ - export function createSocket(opts: Object, callback: Function): Class_DgramSocket; + export function createSocket(opts: object, callback: Function): Class_DgramSocket; /** * diff --git a/types/fibjs/declare/fs.d.ts b/types/fibjs/declare/fs.d.ts index ec22c54c3d..b0971e3ee5 100644 --- a/types/fibjs/declare/fs.d.ts +++ b/types/fibjs/declare/fs.d.ts @@ -647,6 +647,27 @@ declare module "fs" { */ export function appendFile(fname: string, data: Class_Buffer): void; + /** + * + * @brief 设置 zip 虚拟文件映射 + * @param fname 指定映射路径 + * @param data 指定映射的 zip 文件数据 + * + * + * + */ + export function setZipFS(fname: string, data: Class_Buffer): void; + + /** + * + * @brief 清除 zip 虚拟文件映射 + * @param fname 指定映射路径,缺省清除全部缓存 + * + * + * + */ + export function clearZipFS(fname?: string/** = ""*/): void; + } /** end of `module fs` */ export = fs } diff --git a/types/fibjs/declare/global.d.ts b/types/fibjs/declare/global.d.ts index 3c58e8289c..19d539d932 100644 --- a/types/fibjs/declare/global.d.ts +++ b/types/fibjs/declare/global.d.ts @@ -379,7 +379,7 @@ declare module "global" { * * */ - export function setTimeout(callback: Function, timeout: number, ...args: any[]): Class_Timer; + export function setTimeout(callback: Function, timeout?: number/** = 1*/, ...args: any[]): Class_Timer; /** * diff --git a/types/fibjs/declare/gui.d.ts b/types/fibjs/declare/gui.d.ts index e2522b8331..60768a9d93 100644 --- a/types/fibjs/declare/gui.d.ts +++ b/types/fibjs/declare/gui.d.ts @@ -293,7 +293,7 @@ declare module "gui" { * * */ - export function open(url: string, opt?: Object/** = v8::Object::New(isolate)*/): Class_WebView; + export function open(url: string, opt?: object/** = v8::Object::New(isolate)*/): Class_WebView; } /** end of `module gui` */ export = gui diff --git a/types/fibjs/declare/http.d.ts b/types/fibjs/declare/http.d.ts index 2712b08370..000f4a6b79 100644 --- a/types/fibjs/declare/http.d.ts +++ b/types/fibjs/declare/http.d.ts @@ -196,7 +196,7 @@ /** module Or Internal Object */ /** - * @brief 超文本传输协议模块,用以支持 http 协议处理 + * @brief 超文本传输协议模块,用以支持 http 协议处理,模块别名:https * @detail */ declare module "http" { @@ -205,6 +205,14 @@ declare module "http" { module http { + /** + * + * @brief 返回标准的 HTTP 响应状态码的集合,以及各自的简短描述。 + * + * + */ + export const STATUS_CODES: any[]; + /** * * @brief 返回http客户端的 HttpCookie 对象列表 @@ -253,6 +261,22 @@ declare module "http" { */ export const userAgent: string; + /** + * + * @brief 查询和设置 keep-alive 最大缓存连接数,缺省 128 + * + * + */ + export const poolSize: number; + + /** + * + * @brief 查询和设置 keep-alive 缓存连接超时时间,缺省 10000 ms + * + * + */ + export const poolTimeout: number; + /** * @@ -333,7 +357,7 @@ declare module "http" { * * */ - export function fileHandler(root: string, mimes?: Object/** = v8::Object::New(isolate)*/, autoIndex?: boolean/** = false*/): Class_Handler; + export function fileHandler(root: string, mimes?: object/** = v8::Object::New(isolate)*/, autoIndex?: boolean/** = false*/): Class_Handler; /** * @@ -368,7 +392,7 @@ declare module "http" { * * @async */ - export function request(method: string, url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + export function request(method: string, url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -390,7 +414,7 @@ declare module "http" { * * @async */ - export function get(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + export function get(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -412,7 +436,7 @@ declare module "http" { * * @async */ - export function post(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + export function post(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -434,7 +458,7 @@ declare module "http" { * * @async */ - export function del(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + export function del(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -456,7 +480,7 @@ declare module "http" { * * @async */ - export function put(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + export function put(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -478,7 +502,7 @@ declare module "http" { * * @async */ - export function patch(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + export function patch(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; } /** end of `module http` */ export = http diff --git a/types/fibjs/declare/index.d.ts b/types/fibjs/declare/index.d.ts index 53be0766e3..df0e02e683 100644 --- a/types/fibjs/declare/index.d.ts +++ b/types/fibjs/declare/index.d.ts @@ -14,54 +14,54 @@ -/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// /// /// /// /// -/// -/// -/// -/// -/// -/// -/// /// -/// -/// -/// -/// -/// /// -/// /// -/// /// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// /// +/// +/// +/// +/// +/// +/// /// -/// -/// -/// +/// +/// /// /// /// -/// /// -/// -/// -/// +/// import _Global from 'global'; import _Process from 'process'; diff --git a/types/fibjs/declare/net.d.ts b/types/fibjs/declare/net.d.ts index 831b958124..8c2bf58055 100644 --- a/types/fibjs/declare/net.d.ts +++ b/types/fibjs/declare/net.d.ts @@ -284,7 +284,7 @@ declare module "net" { * * */ - export function info(): Object; + export function info(): object; /** * diff --git a/types/fibjs/declare/os.d.ts b/types/fibjs/declare/os.d.ts index d98d2b58d5..977fc4c6ce 100644 --- a/types/fibjs/declare/os.d.ts +++ b/types/fibjs/declare/os.d.ts @@ -380,7 +380,7 @@ declare module "os" { * * */ - export function userInfo(options?: Object/** = v8::Object::New(isolate)*/): Object; + export function userInfo(options?: object/** = v8::Object::New(isolate)*/): object; /** * @@ -390,7 +390,7 @@ declare module "os" { * * */ - export function networkInterfaces(): Object; + export function networkInterfaces(): object; /** * @@ -470,7 +470,7 @@ declare module "os" { * * */ - export function memoryUsage(): Object; + export function memoryUsage(): object; } /** end of `module os` */ export = os diff --git a/types/fibjs/declare/path.d.ts b/types/fibjs/declare/path.d.ts index 2764664778..9b6ae9cfec 100644 --- a/types/fibjs/declare/path.d.ts +++ b/types/fibjs/declare/path.d.ts @@ -341,6 +341,19 @@ declare module "path" { */ export function resolve(...ps: any[]): string; + /** + * + * @brief 求 _from 到 to 的相对路径 + * + * @param _from 源路径 + * @param to 目标路径 + * @return 返回得到的相对路径 + * + * + * + */ + export function relative(_from: string, to: string): string; + /** * * @brief 转换成 namespace-prefixed 路径。只在 windows 有效,其他系统直接返回。 diff --git a/types/fibjs/declare/path_posix.d.ts b/types/fibjs/declare/path_posix.d.ts index e28fbfee0a..bfeea21068 100644 --- a/types/fibjs/declare/path_posix.d.ts +++ b/types/fibjs/declare/path_posix.d.ts @@ -341,6 +341,19 @@ declare module "path_posix" { */ export function resolve(...ps: any[]): string; + /** + * + * @brief 求 _from 到 to 的相对路径 + * + * @param _from 源路径 + * @param to 目标路径 + * @return 返回得到的相对路径 + * + * + * + */ + export function relative(_from: string, to: string): string; + /** * * @brief 转换成 namespace-prefixed 路径。只在 windows 有效,其他系统直接返回。 diff --git a/types/fibjs/declare/path_win32.d.ts b/types/fibjs/declare/path_win32.d.ts index 80f236ba50..25ce64db09 100644 --- a/types/fibjs/declare/path_win32.d.ts +++ b/types/fibjs/declare/path_win32.d.ts @@ -341,6 +341,19 @@ declare module "path_win32" { */ export function resolve(...ps: any[]): string; + /** + * + * @brief 求 _from 到 to 的相对路径 + * + * @param _from 源路径 + * @param to 目标路径 + * @return 返回得到的相对路径 + * + * + * + */ + export function relative(_from: string, to: string): string; + /** * * @brief 转换成 namespace-prefixed 路径。只在 windows 有效,其他系统直接返回。 diff --git a/types/fibjs/declare/process.d.ts b/types/fibjs/declare/process.d.ts index 669eff12d2..1e6e1c8739 100644 --- a/types/fibjs/declare/process.d.ts +++ b/types/fibjs/declare/process.d.ts @@ -416,7 +416,7 @@ declare module "process" { * * */ - export function memoryUsage(): Object; + export function memoryUsage(): object; /** * @@ -448,7 +448,7 @@ declare module "process" { * * */ - export function open(command: string, args: any[], opts?: Object/** = v8::Object::New(isolate)*/): Class_SubProcess; + export function open(command: string, args: any[], opts?: object/** = v8::Object::New(isolate)*/): Class_SubProcess; /** * @@ -468,7 +468,7 @@ declare module "process" { * * */ - export function open(command: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_SubProcess; + export function open(command: string, opts?: object/** = v8::Object::New(isolate)*/): Class_SubProcess; /** * @@ -489,7 +489,7 @@ declare module "process" { * * */ - export function start(command: string, args: any[], opts?: Object/** = v8::Object::New(isolate)*/): Class_SubProcess; + export function start(command: string, args: any[], opts?: object/** = v8::Object::New(isolate)*/): Class_SubProcess; /** * @@ -509,7 +509,7 @@ declare module "process" { * * */ - export function start(command: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_SubProcess; + export function start(command: string, opts?: object/** = v8::Object::New(isolate)*/): Class_SubProcess; /** * @@ -530,7 +530,7 @@ declare module "process" { * * */ - export function run(command: string, args: any[], opts?: Object/** = v8::Object::New(isolate)*/): number; + export function run(command: string, args: any[], opts?: object/** = v8::Object::New(isolate)*/): number; /** * @@ -550,7 +550,7 @@ declare module "process" { * * */ - export function run(command: string, opts?: Object/** = v8::Object::New(isolate)*/): number; + export function run(command: string, opts?: object/** = v8::Object::New(isolate)*/): number; } /** end of `module process` */ export = process diff --git a/types/fibjs/declare/profiler.d.ts b/types/fibjs/declare/profiler.d.ts index 36a89b2644..5d3459ddbb 100644 --- a/types/fibjs/declare/profiler.d.ts +++ b/types/fibjs/declare/profiler.d.ts @@ -416,7 +416,7 @@ declare module "profiler" { * * */ - export function diff(test: Function): Object; + export function diff(test: Function): object; /** * diff --git a/types/fibjs/declare/querystring.d.ts b/types/fibjs/declare/querystring.d.ts index 9010d119e5..bd939a0621 100644 --- a/types/fibjs/declare/querystring.d.ts +++ b/types/fibjs/declare/querystring.d.ts @@ -242,7 +242,7 @@ declare module "querystring" { * * */ - export function parse(str: string, sep?: string/** = "&"*/, eq?: string/** = "="*/, opt?: Object/** = v8::Object::New(isolate)*/): Class_HttpCollection; + export function parse(str: string, sep?: string/** = "&"*/, eq?: string/** = "="*/, opt?: object/** = v8::Object::New(isolate)*/): Class_HttpCollection; /** * @@ -256,7 +256,7 @@ declare module "querystring" { * * */ - export function stringify(obj: Object, sep?: string/** = "&"*/, eq?: string/** = "="*/, opt?: Object/** = v8::Object::New(isolate)*/): string; + export function stringify(obj: object, sep?: string/** = "&"*/, eq?: string/** = "="*/, opt?: object/** = v8::Object::New(isolate)*/): string; } /** end of `module querystring` */ export = querystring diff --git a/types/fibjs/declare/ssl.d.ts b/types/fibjs/declare/ssl.d.ts index 2799f59be3..e331eeb691 100644 --- a/types/fibjs/declare/ssl.d.ts +++ b/types/fibjs/declare/ssl.d.ts @@ -196,7 +196,7 @@ /** module Or Internal Object */ /** - * @brief ssl/tls 模块 + * @brief ssl/tls 模块,模块别名:tls * @detail */ declare module "ssl" { diff --git a/types/fibjs/declare/timers.d.ts b/types/fibjs/declare/timers.d.ts index 7469a7ea68..8de6e72812 100644 --- a/types/fibjs/declare/timers.d.ts +++ b/types/fibjs/declare/timers.d.ts @@ -219,7 +219,7 @@ declare module "timers" { * * */ - export function setTimeout(callback: Function, timeout: number, ...args: any[]): Class_Timer; + export function setTimeout(callback: Function, timeout?: number/** = 1*/, ...args: any[]): Class_Timer; /** * @@ -313,6 +313,19 @@ declare module "timers" { */ export function clearImmediate(t: any): void; + /** + * + * @brief 调用给定的函数,并在超时时间到期时中断函数运行 + * @param func 指定要运行的函数 + * @param timeout 指定超时时间 + * @param args 额外的参数,传入到指定的 callback 内,可选。 + * @return 返回 func 的运行结果 + * + * + * + */ + export function call(func: Function, timeout: number, ...args: any[]): any; + } /** end of `module timers` */ export = timers } diff --git a/types/fibjs/declare/url.d.ts b/types/fibjs/declare/url.d.ts index 7728d433a2..545b516cd2 100644 --- a/types/fibjs/declare/url.d.ts +++ b/types/fibjs/declare/url.d.ts @@ -217,7 +217,7 @@ declare module "url" { * * */ - export function format(args: Object): string; + export function format(args: object): string; /** * diff --git a/types/fibjs/declare/util.d.ts b/types/fibjs/declare/util.d.ts index 6998b4aab1..1b38c49399 100644 --- a/types/fibjs/declare/util.d.ts +++ b/types/fibjs/declare/util.d.ts @@ -274,7 +274,7 @@ declare module "util" { * * */ - export function inspect(obj: Object, options?: Object/** = v8::Object::New(isolate)*/): string; + export function inspect(obj: object, options?: object/** = v8::Object::New(isolate)*/): string; /** * @@ -637,6 +637,17 @@ declare module "util" { */ export function clone(v: any): any; + /** + * + * @brief 深度冻结一个对象,被冻结后的对象及其包含的对象都将不允许修改 + * + * @param v 指定要冻结的对象 + * + * + * + */ + export function deepFreeze(v: any): void; + /** * * @brief 将一个或者多个对象的键值扩展到指定对象 @@ -674,7 +685,7 @@ declare module "util" { * * */ - export function pick(v: any, ...objs: any[]): Object; + export function pick(v: any, ...objs: any[]): object; /** * @@ -687,7 +698,7 @@ declare module "util" { * * */ - export function omit(v: any, ...keys: any[]): Object; + export function omit(v: any, ...keys: any[]): object; /** * @@ -937,22 +948,25 @@ declare module "util" { * * ```JavaScript * { - * "fibjs": "0.1.0", - * "svn": 1753, - * "build": "Dec 10 2013 21:44:17", + * "fibjs": "0.25.0", + * "clang": "9.1", + * "date": "Jun 12 2018 07:22:40", * "vender": { - * "ev": "4.11", - * "exif": "0.6.21", - * "gd": "2.1.0-alpha", + * "ev": "4.24", + * "expat": "2.2.5", + * "gd": "2.2.4", * "jpeg": "8.3", - * "log4cpp": "1.0", + * "leveldb": "1.17", * "mongo": "0.7", * "pcre": "8.21", * "png": "1.5.4", - * "sqlite": "3.8.1", + * "mbedtls": "2.6.1", + * "snappy": "1.1.2", + * "sqlite": "3.23.0", * "tiff": "3.9.5", * "uuid": "1.6.2", - * "v8": "3.23.17 (candidate)", + * "v8": "6.7.288.20", + * "v8-snapshot": true, * "zlib": "1.2.7", * "zmq": "3.1" * } @@ -963,7 +977,7 @@ declare module "util" { * * */ - export function buildInfo(): Object; + export function buildInfo(): object; } /** end of `module util` */ export = util diff --git a/types/fibjs/declare/zlib.d.ts b/types/fibjs/declare/zlib.d.ts index 049d70f365..693dcf81bf 100644 --- a/types/fibjs/declare/zlib.d.ts +++ b/types/fibjs/declare/zlib.d.ts @@ -264,11 +264,12 @@ declare module "zlib" { * * @brief 创建一个 gunzip 流对象 * @param to 用于存储处理结果的流 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * @return 返回封装过的流对象 * * */ - export function createGunzip(to: Class_Stream): Class_Stream; + export function createGunzip(to: Class_Stream, maxSize?: number/** = -1*/): Class_Stream; /** * @@ -284,21 +285,23 @@ declare module "zlib" { * * @brief 创建一个 inflate 流对象 * @param to 用于存储处理结果的流 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * @return 返回封装过的流对象 * * */ - export function createInflate(to: Class_Stream): Class_Stream; + export function createInflate(to: Class_Stream, maxSize?: number/** = -1*/): Class_Stream; /** * * @brief 创建一个 inflateRaw 流对象 * @param to 用于存储处理结果的流 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * @return 返回封装过的流对象 * * */ - export function createInflateRaw(to: Class_Stream): Class_Stream; + export function createInflateRaw(to: Class_Stream, maxSize?: number/** = -1*/): Class_Stream; /** * @@ -340,34 +343,37 @@ declare module "zlib" { * * @brief 解压缩 deflate 算法压缩的数据(zlib格式) * @param data 给定压缩后的数据 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * @return 返回解压缩后的二进制数据 * * * @async */ - export function inflate(data: Class_Buffer): Class_Buffer; + export function inflate(data: Class_Buffer, maxSize?: number/** = -1*/): Class_Buffer; /** * * @brief 解压缩 deflate 算法压缩的数据到流对象中(zlib格式) * @param data 给定要解压缩的数据 * @param stm 指定存储解压缩数据的流 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * * * @async */ - export function inflateTo(data: Class_Buffer, stm: Class_Stream): void; + export function inflateTo(data: Class_Buffer, stm: Class_Stream, maxSize?: number/** = -1*/): void; /** * * @brief 解压缩源流中 deflate 算法压缩的数据到流对象中(zlib格式) * @param src 给定要解压缩的数据所在的流 * @param stm 指定存储解压缩数据的流 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * * * @async */ - export function inflateTo(src: Class_Stream, stm: Class_Stream): void; + export function inflateTo(src: Class_Stream, stm: Class_Stream, maxSize?: number/** = -1*/): void; /** * @@ -406,34 +412,37 @@ declare module "zlib" { * * @brief 解压缩 gzip 算法压缩的数据 * @param data 给定压缩后的数据 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * @return 返回解压缩后的二进制数据 * * * @async */ - export function gunzip(data: Class_Buffer): Class_Buffer; + export function gunzip(data: Class_Buffer, maxSize?: number/** = -1*/): Class_Buffer; /** * * @brief 解压缩 gzip 算法压缩的数据到流对象中 * @param data 给定要解压缩的数据 * @param stm 指定存储解压缩数据的流 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * * * @async */ - export function gunzipTo(data: Class_Buffer, stm: Class_Stream): void; + export function gunzipTo(data: Class_Buffer, stm: Class_Stream, maxSize?: number/** = -1*/): void; /** * * @brief 解压缩源流中 gzip 算法压缩的数据到流对象中 * @param src 给定要解压缩的数据所在的流 * @param stm 指定存储解压缩数据的流 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * * * @async */ - export function gunzipTo(src: Class_Stream, stm: Class_Stream): void; + export function gunzipTo(src: Class_Stream, stm: Class_Stream, maxSize?: number/** = -1*/): void; /** * @@ -475,34 +484,37 @@ declare module "zlib" { * * @brief 解压缩 deflate 算法压缩的数据(inflateRaw) * @param data 给定压缩后的数据 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * @return 返回解压缩后的二进制数据 * * * @async */ - export function inflateRaw(data: Class_Buffer): Class_Buffer; + export function inflateRaw(data: Class_Buffer, maxSize?: number/** = -1*/): Class_Buffer; /** * * @brief 解压缩 deflate 算法压缩的数据到流对象中(inflateRaw) * @param data 给定要解压缩的数据 * @param stm 指定存储解压缩数据的流 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * * * @async */ - export function inflateRawTo(data: Class_Buffer, stm: Class_Stream): void; + export function inflateRawTo(data: Class_Buffer, stm: Class_Stream, maxSize?: number/** = -1*/): void; /** * * @brief 解压缩源流中 deflate 算法压缩的数据到流对象中(inflateRaw) * @param src 给定要解压缩的数据所在的流 * @param stm 指定存储解压缩数据的流 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * * * @async */ - export function inflateRawTo(src: Class_Stream, stm: Class_Stream): void; + export function inflateRawTo(src: Class_Stream, stm: Class_Stream, maxSize?: number/** = -1*/): void; } /** end of `module zlib` */ export = zlib diff --git a/types/fibjs/index.d.ts b/types/fibjs/index.d.ts index 0b4ef29975..02201fd904 100644 --- a/types/fibjs/index.d.ts +++ b/types/fibjs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for fibjs 0.25 +// Type definitions for fibjs 0.26 // Project: https://github.com/fibjs/fibjs // Definitions by: richardo2016 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/fork-ts-checker-webpack-plugin/fork-ts-checker-webpack-plugin-tests.ts b/types/fork-ts-checker-webpack-plugin/fork-ts-checker-webpack-plugin-tests.ts deleted file mode 100644 index 7f28a37597..0000000000 --- a/types/fork-ts-checker-webpack-plugin/fork-ts-checker-webpack-plugin-tests.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Configuration } from 'webpack'; -import * as ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'; - -let config: Configuration = { - plugins: [ - new ForkTsCheckerWebpackPlugin() - ] -}; - -config = { - plugins: [ - new ForkTsCheckerWebpackPlugin({}) - ] -}; - -config = { - plugins: [ - new ForkTsCheckerWebpackPlugin({ - vue: true - }) - ] -}; - -config = { - plugins: [ - new ForkTsCheckerWebpackPlugin({ - logger: { - error: message => console.error(message), - warn: message => console.warn(message), - info: message => console.info(message), - } - }) - ] -}; - -export default config; diff --git a/types/fork-ts-checker-webpack-plugin/index.d.ts b/types/fork-ts-checker-webpack-plugin/index.d.ts deleted file mode 100644 index 715b1fe41b..0000000000 --- a/types/fork-ts-checker-webpack-plugin/index.d.ts +++ /dev/null @@ -1,110 +0,0 @@ -// Type definitions for fork-ts-checker-webpack-plugin 0.4 -// Project: https://github.com/Realytics/fork-ts-checker-webpack-plugin#readme -// Definitions by: JounQin -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// - -import { RuleFailure } from 'tslint'; -import { Diagnostic } from 'typescript'; -import { Plugin } from 'webpack'; - -declare namespace ForkTsCheckerWebpackPlugin { - type ErrorType = 'diagnostic' | 'lint'; - type Severity = 'error' | 'warning'; - - interface NormalizedMessageJson { - type: ErrorType; - code: string | number; - severity: Severity; - content: string; - file: string; - line: number; - character: number; - } - - class NormalizedMessage { - static TYPE_DIAGNOSTIC: ErrorType; - static TYPE_LINT: ErrorType; - static SEVERITY_ERROR: Severity; - static SEVERITY_WARNING: Severity; - type: ErrorType; - code: string | number; - severity: Severity; - content: string; - file: string; - line: number; - character: number; - constructor(data: NormalizedMessageJson); - static createFromDiagnostic(diagnostic: Diagnostic): NormalizedMessage; - static createFromLint(lint: RuleFailure): NormalizedMessage; - static createFromJSON(json: NormalizedMessageJson): NormalizedMessage; - static compare( - messageA: NormalizedMessage, - messageB: NormalizedMessage, - ): number; - static equals( - messageA: NormalizedMessage, - messageB: NormalizedMessage, - ): boolean; - static deduplicate(messages: NormalizedMessage[]): NormalizedMessage[]; - static compareTypes(typeA: ErrorType, typeB: ErrorType): number; - static compareSeverities( - severityA: Severity, - severityB: Severity, - ): number; - static compareOptionalStrings(stringA: string, stringB: string): number; - static compareNumbers(numberA: number, numberB: number): number; - toJSON(): NormalizedMessageJson; - getType(): ErrorType; - isDiagnosticType(): boolean; - isLintType(): boolean; - getCode(): string | number; - getFormattedCode(): string | number; - getSeverity(): Severity; - isErrorSeverity(): boolean; - isWarningSeverity(): boolean; - getContent(): string; - getFile(): string; - getLine(): number; - getCharacter(): number; - } - - type Formatter = (message: NormalizedMessage, useColors: boolean) => string; - - interface Logger { - error(message?: any): void; - warn(message?: any): void; - info(message?: any): void; - } - - interface Options { - tsconfig?: string; - tslint?: string | true; - watch?: string | string[]; - async?: boolean; - ignoreDiagnostics?: number[]; - ignoreLints?: string[]; - colors?: boolean; - logger?: Logger; - formatter?: 'default' | 'codeframe' | Formatter; - formatterOptions?: { - highlightCode?: boolean - linesAbove?: number - linesBelow?: number - forceColor?: boolean - }; - silent?: boolean; - checkSyntacticErrors?: boolean; - memoryLimit?: number; - workers?: number; - vue?: boolean; - } -} - -declare class ForkTsCheckerWebpackPlugin extends Plugin { - constructor(options?: ForkTsCheckerWebpackPlugin.Options); -} - -export = ForkTsCheckerWebpackPlugin; diff --git a/types/gc-stats/gc-stats-tests.ts b/types/gc-stats/gc-stats-tests.ts new file mode 100644 index 0000000000..bf44e20175 --- /dev/null +++ b/types/gc-stats/gc-stats-tests.ts @@ -0,0 +1,11 @@ +import GCStats = require("gc-stats"); +import { GCStatistics } from "gc-stats"; + +const gcStats = GCStats(); + +gcStats.on("stats", (stats: GCStatistics) => { + const { gctype: gcType, startTime, endTime, before, after, diff } = stats; + const beforeMallocedMemory = before.mallocedMemory; + const afterMallocedMemory = after.mallocedMemory; + const diffMallocedMemory = diff.mallocedMemory; +}); diff --git a/types/gc-stats/index.d.ts b/types/gc-stats/index.d.ts new file mode 100644 index 0000000000..917aedf5b9 --- /dev/null +++ b/types/gc-stats/index.d.ts @@ -0,0 +1,34 @@ +// Type definitions for gc-stats 1.2 +// Project: https://github.com/dainis/node-gcstats#readme +// Definitions by: Vitor Fernandes +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { EventEmitter } from "events"; + +declare namespace GCStats { + interface MemoryStatistics { + totalHeapSize: number; + totalHeapExecutableSize: number; + usedHeapSize: number; + heapSizeLimit: number; + totalPhysicalSize: number; + totalAvailableSize: number; + mallocedMemory: number; + peakMallocedMemory: number; + } + + interface GCStatistics { + startTime: number; + endTime: number; + pause: number; + pauseMS: number; + gctype: 1 | 2 | 4 | 8 | 15; + before: MemoryStatistics; + after: MemoryStatistics; + diff: MemoryStatistics; + } +} + +declare function GCStats(): EventEmitter; + +export = GCStats; diff --git a/types/gc-stats/tsconfig.json b/types/gc-stats/tsconfig.json new file mode 100644 index 0000000000..67fda0ff67 --- /dev/null +++ b/types/gc-stats/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", + "gc-stats-tests.ts" + ] +} diff --git a/types/gc-stats/tslint.json b/types/gc-stats/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/gc-stats/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/get-port/get-port-tests.ts b/types/get-port/get-port-tests.ts index b6e59890d6..53a9e8e69b 100644 --- a/types/get-port/get-port-tests.ts +++ b/types/get-port/get-port-tests.ts @@ -7,3 +7,7 @@ getPort().then(port => { getPort({ port: 3000 }).then(port => { console.log(port); }); + +getPort({ port: [3000, 3001] }).then(port => { + console.log(port); +}); diff --git a/types/get-port/index.d.ts b/types/get-port/index.d.ts index 3f62b90c86..f8adb4851e 100644 --- a/types/get-port/index.d.ts +++ b/types/get-port/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for get-port 3.2 +// Type definitions for get-port 4.0 // Project: https://github.com/sindresorhus/get-port // Definitions by: York Yao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "get-port" { - var getPort: (options?: { port?: number, host?: string }) => PromiseLike + var getPort: (options?: { port?: number | ReadonlyArray, host?: string }) => PromiseLike export = getPort; } diff --git a/types/google-cloud__storage/google-cloud__storage-tests.ts b/types/google-cloud__storage/google-cloud__storage-tests.ts index cd0bcaaab2..1db3e73284 100644 --- a/types/google-cloud__storage/google-cloud__storage-tests.ts +++ b/types/google-cloud__storage/google-cloud__storage-tests.ts @@ -26,7 +26,7 @@ import { WriteStreamOptions, UploadOptions } from "@google-cloud/storage"; -import CloudStorage = require("@google-cloud/storage"); +import Storage = require("@google-cloud/storage"); /** * Test the storage service. @@ -38,7 +38,7 @@ export class TestStorage { }; // import Storage class - static gcs = CloudStorage(); + static gcs = new Storage(); constructor() { // nothing to do @@ -263,3 +263,330 @@ testStorage.iam.setPolicy({ testStorage.iam.testPermissions('storage.buckets.delete'); testStorage.iam.testPermissions(['storage.buckets.delete', 'storage.buckets.get']); + +// Example from https://cloud.google.com/storage/docs/creating-buckets#storage-create-bucket-code_samples +{ + // Creates a client + const storage = new Storage(); + + const bucketName = 'Name of a bucket, e.g. my-bucket'; + + // Creates a new bucket + storage + .createBucket(bucketName, { + location: 'ASIA', + storageClass: 'COLDLINE', + }) + .then(() => { + console.log(`Bucket ${bucketName} created.`); + }) + .catch(err => { + console.error('ERROR:', err); + }); +} + +// Example from https://cloud.google.com/storage/docs/listing-buckets#storage-list-buckets-nodejs +{ + // Creates a client + const storage = new Storage(); + + // Lists all buckets in the current project + storage + .getBuckets() + .then(results => { + const buckets = results[0]; + + console.log('Buckets:'); + buckets.forEach(bucket => { + console.log(bucket.name); + }); + }) + .catch(err => { + console.error('ERROR:', err); + }); +} + +// Example from https://cloud.google.com/storage/docs/moving-buckets#storage-create-bucket-nodejs +{ + // Creates a client + const storage = new Storage(); + + const bucketName = 'Name of a bucket, e.g. my-bucket'; + + // Creates a new bucket + storage + .createBucket(bucketName, { + location: 'ASIA', + storageClass: 'COLDLINE', + }) + .then(() => { + console.log(`Bucket ${bucketName} created.`); + }) + .catch(err => { + console.error('ERROR:', err); + }); +} + +// Example from https://cloud.google.com/storage/docs/deleting-buckets +{ + // Creates a client + const storage = new Storage(); + + const bucketName = 'Name of a bucket, e.g. my-bucket'; + + // Deletes the bucket + storage + .bucket(bucketName) + .delete() + .then(() => { + console.log(`Bucket ${bucketName} deleted.`); + }) + .catch(err => { + console.error('ERROR:', err); + }); +} + +// Example from https://cloud.google.com/storage/docs/uploading-objects +{ + // Creates a client + const storage = new Storage(); + + const bucketName = 'Name of a bucket, e.g. my-bucket'; + const filename = 'Local file to upload, e.g. ./local/path/to/file.txt'; + + // Uploads a local file to the bucket + storage + .bucket(bucketName) + .upload(filename, { + // Support for HTTP requests made with `Accept-Encoding: gzip` + gzip: true, + metadata: { + // Enable long-lived HTTP caching headers + // Use only if the contents of the file will never change + // (If the contents will change, use cacheControl: 'no-cache') + cacheControl: 'public, max-age=31536000', + }, + }) + .then(() => { + console.log(`${filename} uploaded to ${bucketName}.`); + }) + .catch(err => { + console.error('ERROR:', err); + }); +} + +// Example from https://cloud.google.com/storage/docs/listing-objects +{ + // Creates a client + const storage = new Storage(); + + const bucketName = 'Name of a bucket, e.g. my-bucket'; + + // Lists files in the bucket + storage + .bucket(bucketName) + .getFiles() + .then(results => { + const files = results[0]; + + console.log('Files:'); + files.forEach(file => { + console.log(file.name); + }); + }) + .catch(err => { + console.error('ERROR:', err); + }); +} + +// Example from https://cloud.google.com/storage/docs/listing-objects +{ + // Creates a client + const storage = new Storage(); + + const bucketName = 'Name of a bucket, e.g. my-bucket'; + const prefix = 'Prefix by which to filter, e.g. public/'; + const delimiter = 'Delimiter to use, e.g. /'; + + /** + * This can be used to list all blobs in a "folder", e.g. "public/". + * + * The delimiter argument can be used to restrict the results to only the + * "files" in the given "folder". Without the delimiter, the entire tree under + * the prefix is returned. For example, given these blobs: + * + * /a/1.txt + * /a/b/2.txt + * + * If you just specify prefix = '/a', you'll get back: + * + * /a/1.txt + * /a/b/2.txt + * + * However, if you specify prefix='/a' and delimiter='/', you'll get back: + * + * /a/1.txt + */ + const options = { + prefix, + delimiter + }; + + // Lists files in the bucket, filtered by a prefix + storage + .bucket(bucketName) + .getFiles(options) + .then(results => { + const files = results[0]; + + console.log('Files:'); + files.forEach(file => { + console.log(file.name); + }); + }) + .catch(err => { + console.error('ERROR:', err); + }); +} + +// Example from https://cloud.google.com/storage/docs/downloading-objects#storage-download-object-nodejs +{ + // Creates a client + const storage = new Storage(); + + const bucketName = 'Name of a bucket, e.g. my-bucket'; + const srcFilename = 'Remote file to download, e.g. file.txt'; + const destFilename = 'Local destination for file, e.g. ./local/path/to/file.txt'; + + const options = { + // The path to which the file should be downloaded, e.g. "./file.txt" + destination: destFilename, + }; + + // Downloads the file + storage + .bucket(bucketName) + .file(srcFilename) + .download(options) + .then(() => { + console.log( + `gs://${bucketName}/${srcFilename} downloaded to ${destFilename}.` + ); + }) + .catch(err => { + console.error('ERROR:', err); + }); +} + +// Example from https://cloud.google.com/storage/docs/renaming-copying-moving-objects +{ + // Creates a client + const storage = new Storage(); + + const bucketName = 'Name of a bucket, e.g. my-bucket'; + const srcFilename = 'File to move, e.g. file.txt'; + const destFilename = 'Destination for file, e.g. moved.txt'; + + // Moves the file within the bucket + storage + .bucket(bucketName) + .file(srcFilename) + .move(destFilename) + .then(() => { + console.log( + `gs://${bucketName}/${srcFilename} moved to gs://${bucketName}/${destFilename}.` + ); + }) + .catch(err => { + console.error('ERROR:', err); + }); +} + +// Example from https://cloud.google.com/storage/docs/renaming-copying-moving-objects +{ + // Creates a client + const storage = new Storage(); + + const srcBucketName = 'Name of the source bucket, e.g. my-bucket'; + const srcFilename = 'Name of the source file, e.g. file.txt'; + const destBucketName = 'Name of the destination bucket, e.g. my-other-bucket'; + const destFilename = 'Destination name of file, e.g. file.txt'; + + // Copies the file to the other bucket + storage + .bucket(srcBucketName) + .file(srcFilename) + .copy(storage.bucket(destBucketName).file(destFilename)) + .then(() => { + console.log( + `gs://${srcBucketName}/${srcFilename} copied to gs://${destBucketName}/${destFilename}.` + ); + }) + .catch(err => { + console.error('ERROR:', err); + }); +} + +// Example from https://cloud.google.com/storage/docs/viewing-editing-metadata +{ + // Creates a client + const storage = new Storage(); + + const bucketName = 'Name of a bucket, e.g. my-bucket'; + const filename = 'File to access, e.g. file.txt'; + + // Gets the metadata for the file + storage + .bucket(bucketName) + .file(filename) + .getMetadata() + .then(results => { + const metadata = results[0]; + + console.log(`File: ${metadata.name}`); + console.log(`Bucket: ${metadata.bucket}`); + console.log(`Storage class: ${metadata.storageClass}`); + console.log(`Self link: ${metadata.selfLink}`); + console.log(`ID: ${metadata.id}`); + console.log(`Size: ${metadata.size}`); + console.log(`Updated: ${metadata.updated}`); + console.log(`Generation: ${metadata.generation}`); + console.log(`Metageneration: ${metadata.metageneration}`); + console.log(`Etag: ${metadata.etag}`); + console.log(`Owner: ${metadata.owner}`); + console.log(`Component count: ${metadata.component_count}`); + console.log(`Crc32c: ${metadata.crc32c}`); + console.log(`md5Hash: ${metadata.md5Hash}`); + console.log(`Cache-control: ${metadata.cacheControl}`); + console.log(`Content-type: ${metadata.contentType}`); + console.log(`Content-disposition: ${metadata.contentDisposition}`); + console.log(`Content-encoding: ${metadata.contentEncoding}`); + console.log(`Content-language: ${metadata.contentLanguage}`); + console.log(`Metadata: ${metadata.metadata}`); + console.log(`Media link: ${metadata.mediaLink}`); + }) + .catch(err => { + console.error('ERROR:', err); + }); +} + +// Example from https://cloud.google.com/storage/docs/deleting-objects +{ + // Creates a client + const storage = new Storage(); + + const bucketName = 'Name of a bucket, e.g. my-bucket'; + const filename = 'File to delete, e.g. file.txt'; + + // Deletes the file from the bucket + storage + .bucket(bucketName) + .file(filename) + .delete() + .then(() => { + console.log(`gs://${bucketName}/${filename} deleted.`); + }) + .catch(err => { + console.error('ERROR:', err); + }); +} diff --git a/types/google-cloud__storage/index.d.ts b/types/google-cloud__storage/index.d.ts index 8d7cf6c45d..18ac093c5d 100644 --- a/types/google-cloud__storage/index.d.ts +++ b/types/google-cloud__storage/index.d.ts @@ -55,6 +55,8 @@ declare namespace Storage { versioning?: { enabled?: boolean }; + // Note: This is not documented, but it is used in examples (https://cloud.google.com/nodejs/docs/reference/storage/1.7.x/Storage) + storageClass?: 'COLDLINE' | 'DURABLE_REDUCED_AVAILABILITY' | 'MULTI_REGIONAL' | 'NEARLINE' | 'REGIONAL'; } /** @@ -202,6 +204,8 @@ declare namespace Storage { bucket?: string; cacheControl?: string; componentCount?: number; + // Note: this property is accessed in one of the examples + component_count?: number; contentDisposition?: string; contentEncoding?: string; contentLanguage?: string; @@ -407,22 +411,6 @@ declare namespace Storage { validation?: string | boolean; } - /** - * The Storage class allows you interact with Google Cloud Storage. - */ - class Storage { - constructor(config?: ConfigurationObject); - acl: Acl; - bucket(name: string | Bucket): Bucket; - channel(id: string, resourceId: string): Channel; - createBucket(name: string, metadata?: BucketConfig): Promise<[Bucket, ApiResponse]>; - getBuckets(query?: BucketQuery): Promise<[Bucket[]]>; - getBucketsStream(query?: BucketQuery): Promise<[ReadStream]>; - Channel: (storage: Storage, id: string, resourceId: string) => Channel; - File: (bucket: Bucket, name: string, opts: BucketFileOptions) => File; - Bucket: (storage: Storage, name: string) => Bucket; - } - /** * This class allows you interact with Google Cloud Storage. */ @@ -460,6 +448,20 @@ declare namespace Storage { } } -declare function Storage(config?: Storage.ConfigurationObject): Storage.Storage; +/** + * The Storage class allows you interact with Google Cloud Storage. + */ +declare class Storage { + constructor(config?: Storage.ConfigurationObject); + acl: Storage.Acl; + bucket(name: string | Storage.Bucket): Storage.Bucket; + channel(id: string, resourceId: string): Storage.Channel; + createBucket(name: string, metadata?: Storage.BucketConfig): Promise<[Storage.Bucket, Storage.ApiResponse]>; + getBuckets(query?: Storage.BucketQuery): Promise<[Storage.Bucket[]]>; + getBucketsStream(query?: Storage.BucketQuery): Promise<[ReadStream]>; + Channel: (storage: Storage, id: string, resourceId: string) => Storage.Channel; + File: (bucket: Storage.Bucket, name: string, opts: Storage.BucketFileOptions) => Storage.File; + Bucket: (storage: Storage, name: string) => Storage.Bucket; +} export = Storage; diff --git a/types/graphql-resolve-batch/graphql-resolve-batch-tests.ts b/types/graphql-resolve-batch/graphql-resolve-batch-tests.ts index 9043cdaf0e..51f8964423 100644 --- a/types/graphql-resolve-batch/graphql-resolve-batch-tests.ts +++ b/types/graphql-resolve-batch/graphql-resolve-batch-tests.ts @@ -95,13 +95,15 @@ const withSourceAndArgsAndContextTyped = createBatchResolver< SomeTestResult, SomeTestArgs, SomeTestContext ->(async (sources, args, context) => { +>(async (sources, args, context, info) => { // $ExpectType ReadonlyArray const verifySources = sources; // $ExpectType string const verifyArgs = args.someArg; // $ExpectType string const verifyContext = context.someContextProp; + // $ExpectType GraphQLResolveInfo + const verifyInfo = info; const result = await asyncBatchFunction(sources); return result; diff --git a/types/graphql-resolve-batch/index.d.ts b/types/graphql-resolve-batch/index.d.ts index ea90a83555..9908b7082a 100644 --- a/types/graphql-resolve-batch/index.d.ts +++ b/types/graphql-resolve-batch/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 +import { GraphQLResolveInfo } from 'graphql'; + /** * Creates a GraphQL.js field resolver that batches together multiple resolves * together that share the *exact* same GraphQL field selection. @@ -45,5 +47,6 @@ export type ResolverFunction = ( export type BatchResolveFunction = ( sources: ReadonlyArray, args: TArgs, - context: TContext + context: TContext, + info: GraphQLResolveInfo ) => TReturn[] | Promise; diff --git a/types/gulp-jsonmin/gulp-jsonmin-tests.ts b/types/gulp-jsonmin/gulp-jsonmin-tests.ts new file mode 100644 index 0000000000..5c0cf66cc3 --- /dev/null +++ b/types/gulp-jsonmin/gulp-jsonmin-tests.ts @@ -0,0 +1,5 @@ +import * as GulpJsonmin from 'gulp-jsonmin'; + +GulpJsonmin(); +GulpJsonmin({}); +GulpJsonmin({ verbose: true }); diff --git a/types/gulp-jsonmin/index.d.ts b/types/gulp-jsonmin/index.d.ts new file mode 100644 index 0000000000..16a4347dd2 --- /dev/null +++ b/types/gulp-jsonmin/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for gulp-jsonmin 1.1 +// Project: https://github.com/englercj/gulp-jsonmin +// Definitions by: Romain Faust +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { Transform } from 'stream'; + +declare function jsonmin(options?: jsonmin.Options): Transform; + +declare namespace jsonmin { + interface Options { + verbose?: boolean; + } +} + +export = jsonmin; diff --git a/types/gulp-jsonmin/tsconfig.json b/types/gulp-jsonmin/tsconfig.json new file mode 100644 index 0000000000..7f1244285f --- /dev/null +++ b/types/gulp-jsonmin/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", + "gulp-jsonmin-tests.ts" + ] +} diff --git a/types/gulp-jsonmin/tslint.json b/types/gulp-jsonmin/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/gulp-jsonmin/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index 23aaf3608c..3d3b69b959 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -1,7 +1,6 @@ // Type definitions for hapi 17.0 // Project: https://github.com/hapijs/hapi -// Definitions by: Marc Bornträger -// Rafael Souza Fijalkowski +// Definitions by: Rafael Souza Fijalkowski // Justin Simms // Simon Schick // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -3790,7 +3789,7 @@ export class Server extends Podium { * * path - the route path. * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-servertablehost) */ - table(host?: string): Array<{settings: ServerRoute; method: Util.HTTP_METHODS_PARTIAL_LOWERCASE, path: string}>; // TODO I am not sure if the ServerRoute is the object expected here + table(host?: string): RequestRoute[]; } /* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/types/hapi/test/server/server-table.ts b/types/hapi/test/server/server-table.ts index ab14938be4..79726118b5 100644 --- a/types/hapi/test/server/server-table.ts +++ b/types/hapi/test/server/server-table.ts @@ -19,4 +19,11 @@ server.route({ server.start(); const table = server.table(); console.log(table); +console.log(table[0].method); +console.log(table[0].path); +console.log(table[0].vhost); +console.log(table[0].realm); +console.log(table[0].settings); +console.log(table[0].fingerprint); +console.log(table[0].auth); console.log('Server started at: ' + server.info.uri); diff --git a/types/hexo-util/index.d.ts b/types/hexo-util/index.d.ts index aed429f0ce..5a6be7f5a2 100644 --- a/types/hexo-util/index.d.ts +++ b/types/hexo-util/index.d.ts @@ -7,7 +7,7 @@ /// import { Transform } from "stream"; -import { SpawnOptions } from 'child_process'; +import { SpawnOptions, StdioOptions } from 'child_process'; export class CacheStream extends Transform { destroy(): void; @@ -79,11 +79,11 @@ export interface hexoSpawnDisableEncodingOptions extends SpawnOptions { } export interface hexoSpawnOverrideStdioOptions extends hexoSpawnOptions { - stdio: any[] | string; + stdio: StdioOptions; } export interface hexoSpawnDisableEncodingAndOverrideStdioOptions extends hexoSpawnDisableEncodingOptions { - stdio: any[] | string; + stdio: StdioOptions; } export function spawn(command: string, args: string[], options: hexoSpawnDisableEncodingAndOverrideStdioOptions): Promise; diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index f24004fadb..a71e07c925 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -474,6 +474,26 @@ declare namespace Highcharts { skipNullPoints?: boolean; } + interface AnimationOptions { + /** + * The animation duration in milliseconds. + */ + duration: number; + /** + * The name of an easing function as defined on the Math object. + */ + easing?: string; + /** + * A callback function to exectute when the animation finishes. + */ + complete?: () => void; + /** + * A callback function to execute on each step of each attribute or CSS property that's being animated. + * The first argument contains information about the animation and progress. + */ + step?: () => void; + } + interface AxisTitle { /** * Alignment of the title relative to the axis values. Possible values are 'low', 'middle' or 'high'. @@ -5692,6 +5712,46 @@ declare namespace Highcharts { y?: number | null; } + interface TimeOptions { + /** + * A custom Date class for advanced date handling. For example, JDate can be hooked in to handle Jalali dates. + * @default undefined + * @since 4.0.4 + */ + Date?: Date; + /** + * A callback to return the time zone offset for a given datetime. It takes the timestamp in terms of milliseconds since + * January 1 1970, and returns the timezone offset in minutes. This provides a hook for drawing time based charts in + * specific time zones using their local DST crossover dates, with the help of external libraries. + * @default undefined + * @since 4.1.0 + */ + getTimezoneOffset?: (timestamp: Date) => number; + /** + * Requires moment.js. If the timezone option is specified, it creates a default getTimezoneOffset function that looks + * up the specified timezone in moment.js. If moment.js is not included, this throws a Highcharts error in the console, + * but does not crash the chart. + * @default undefined + * @since 5.0.7 + */ + timezone?: string; + /** + * The timezone offset in minutes. Positive values are west, negative values are east of UTC, as in the ECMAScript + * getTimezoneOffset method. Use this to display UTC based data in a predefined time zone. + * @default 0 + * @since 3.0.8 + */ + timezoneOffset?: number; + /** + * Whether to use UTC time for axis scaling, tickmark placement and time display in Highcharts.dateFormat. + * Advantages of using UTC is that the time displays equally regardless of the user agent's time zone settings. + * Local time can be used when the data is loaded in real time or when correct Daylight Saving Time transitions are required. + * @default undefined + * @since 6.0.5 + */ + useUTC?: boolean; + } + interface TitleOptions { /** * The horizontal alignment of the title. Can be one of 'left', 'center' and 'right'. @@ -6118,6 +6178,10 @@ declare namespace Highcharts { * The chart's subtitle */ subtitle?: SubtitleOptions; + /** + * The chart's time options + */ + time?: TimeOptions; /** * The chart's main title. */ @@ -6487,9 +6551,10 @@ declare namespace Highcharts { * @param [boolean] redraw Whether to redraw the chart. Defaults to true. * @param [boolean] oneToOne When true, the series, xAxis and yAxis collections will be updated one to one, and * items will be either added or removed to match the new updated options. Defaults to false. + * @param [(boolean | AnimationOptions)] animation Whether to apply animation, and optionally animation configuration. * @since 5.0.0 */ - update(options: Options, redraw?: boolean, oneToOne?: boolean): void; + update(options: Options, redraw?: boolean, oneToOne?: boolean, animation?: boolean | AnimationOptions): void; /** * This method is deprecated as of 2.0.1. Updating the chart position after a move operation is no longer necessary. * @since 1.2.5 diff --git a/types/highcharts/test/index.ts b/types/highcharts/test/index.ts index 1d6e921461..bafb4a7516 100644 --- a/types/highcharts/test/index.ts +++ b/types/highcharts/test/index.ts @@ -2457,6 +2457,10 @@ function test_ChartObject() { chart.update( {}); chart.update( {}, true); chart.update( {}, true, true); + chart.update( {}, true, true, true); + chart.update( {}, true, true, { + duration: 3000, + }); } function test_ElementObject() { diff --git a/types/i18n-js/index.d.ts b/types/i18n-js/index.d.ts index 4800125087..70a197772d 100644 --- a/types/i18n-js/index.d.ts +++ b/types/i18n-js/index.d.ts @@ -70,6 +70,8 @@ declare namespace I18n { } function toCurrency(num: number, options?: ToCurrencyOptions): string; + function toTime(scope: Scope, value: string | number | Date): string; + interface ToHumanSizeOptions extends ToNumberOptions { format?: string; } diff --git a/types/iltorb/iltorb-tests.ts b/types/iltorb/iltorb-tests.ts index 66bda251d4..202b9ebbd0 100644 --- a/types/iltorb/iltorb-tests.ts +++ b/types/iltorb/iltorb-tests.ts @@ -20,6 +20,14 @@ br.compress(Buffer.from('foo', 'utf8'), onCompress); br.compress(Buffer.from('foo', 'utf8'), opts, onCompress); +br + .compress(Buffer.from('foobar')) + .then(compressedData => { + br.decompress(compressedData).then(data => { + console.log(data.equals(Buffer.from('foobar'))); + }); + }); + const stream = br.compressStream(); stream.flush(); diff --git a/types/iltorb/index.d.ts b/types/iltorb/index.d.ts index 5ac707a51b..a1cf04844c 100644 --- a/types/iltorb/index.d.ts +++ b/types/iltorb/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for iltorb 2.0 +// Type definitions for iltorb 2.3 // Project: https://github.com/MayhemYDG/iltorb // Definitions by: Arturas Molcanovas +// Francis Gulotta // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -25,8 +26,10 @@ export type IltorbCallback = (err: Error | null | undefined, output: Buffer) => export function compress(buffer: Buffer, options: BrotliEncodeParams, callback: IltorbCallback): void; export function compress(buffer: Buffer, callback: IltorbCallback): void; +export function compress(buffer: Buffer, options?: BrotliEncodeParams): Promise; export function decompress(buffer: Buffer, callback: IltorbCallback): void; +export function decompress(buffer: Buffer): Promise; export function compressSync(buffer: Buffer, options?: BrotliEncodeParams): Buffer; export function decompressSync(buffer: Buffer): Buffer; diff --git a/types/inquirer/index.d.ts b/types/inquirer/index.d.ts index d00c037c71..5d976e896d 100644 --- a/types/inquirer/index.d.ts +++ b/types/inquirer/index.d.ts @@ -8,6 +8,7 @@ // Synarque // Justin Rockwood // Keith Kelly +// Junyoung Clare Jang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -116,12 +117,12 @@ declare namespace inquirer { * Receive the user input and should return true if the value is valid, and an error message (String) * otherwise. If false is returned, a default error message is provided. */ - validate?(input: string, answers?: T): boolean | string | Promise; + validate?(input: any, answers?: T): boolean | string | Promise; /** * Receive the user input and return the filtered value to be used inside the program. * The value returned will be added to the Answers hash. */ - filter?(input: string): string | Promise; + filter?(input: string): any; /** * Receive the user input and return the transformed value to be displayed to the user. The * transformation only impacts what is shown while editing. It does not impact the answers diff --git a/types/inquirer/inquirer-tests.ts b/types/inquirer/inquirer-tests.ts index 85a81d761e..4c8ba9491f 100644 --- a/types/inquirer/inquirer-tests.ts +++ b/types/inquirer/inquirer-tests.ts @@ -670,3 +670,17 @@ var questions = [ inquirer.createPromptModule({ output: process.stderr })(questions, function(answers) { console.log(JSON.stringify(answers, null, " ")); }); + +// Work with JS inquirer but rejected by typing. +inquirer.prompt([ + { + type: "input", + name: "listOfThings", + filter(value: string): string[] { + return ["abc", "def"]; + }, + validate(value: string[]): boolean { + return value.length > 0; + } + } +]); diff --git a/types/intl-relativeformat/index.d.ts b/types/intl-relativeformat/index.d.ts new file mode 100644 index 0000000000..7c2fc0e57c --- /dev/null +++ b/types/intl-relativeformat/index.d.ts @@ -0,0 +1,94 @@ +// Type definitions for intl-relativeformat 2.1 +// Project: https://github.com/yahoo/intl-relativeformat +// Definitions by: Mohsen Azimi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/** + * This package aims to provide a way to format different variations of relative time. + * You can use this package in the browser and on the server via Node.js. + * + * This implementation is very similar to moment.js, in concept, although it provides + * only formatting features based on the Unicode CLDR locale data, an industry + * standard that supports more than 200 languages. + * + * @see https://github.com/yahoo/intl-relativeformat + */ +export default class IntlRelativeFormat { + /** + * To format a date to relative time, use the IntlRelativeFormat constructor. + * The constructor takes two parameters: + * + * @param locales A string with a BCP 47 language tag, or an array of + * such strings. If you do not provide a locale, the default locale will be used. + * When an array of locales is provided, each item and its ancestor locales are checked + * and the first one with registered locale data is returned. See: Locale Resolution + * for more details. + * @see https://github.com/yahoo/intl-relativeformat#locale-resolution + * + * @param optionas object with user defined options for format styles. + * See: Custom Options for more details. + * @see https://github.com/yahoo/intl-relativeformat#custom-options + * Note: The rf instance should be enough for your entire application, + * unless you want to use custom options. + */ + constructor( + locales: string | string[], + options?: Intl.DateTimeFormatOptions & { + /** + * By default, the relative time is computed to the best fit unit, + * but you can explicitly call it to force units to be displayed in + * "second", "second-short", "minute", "minute-short", "hour", + * "hour-short", "day", "day-short", "month", "month-short", + * "year" or "year-short": + */ + units?: + | "second" + | "second-short" + | "minute" + | "minute-short" + | "hour" + | "hour-short" + | "day" + | "day-short" + | "month" + | "month-short" + | "year" + | "year-short"; + + /** + * By default, the relative time is computed as "best fit", + * which means that instead of "1 day ago", it will display "yesterday", + * or "in 1 year" will be "next year", etc. But you can force to always + * use the "numeric" alternative: + */ + style?: "best fit" | "numeric"; + } + ); + + /** + * This method returns an object with the options values that were resolved + * during instance creation. It currently only contains a locale property + * + * var rf = new IntlRelativeFormat('en-us'); + * console.log(rf.resolvedOptions().locale); // => "en-US" + * + * Notice how the specified locale was the all lower-case value: "en-us", + * but it was resolved and normalized to: "en-US". + */ + resolvedOptions(): { locale: string }; + + /** + * The format method (which takes a JavaScript date or timestamp) and optional + * options arguments will compare the date with "now" (or options.now), + * and returns the formatted string; e.g., "3 hours ago" in the corresponding + * locale passed into the constructor. + * + * var output = rf.format(new Date()); + * console.log(output); // => "now" + * + * If you wish to specify a "now" value, it can be provided via options.now and + * will be used instead of querying Date.now() to get the current "now" value. + */ + format(date: Date, options?: { now?: Date }): string; +} diff --git a/types/intl-relativeformat/intl-relativeformat-tests.ts b/types/intl-relativeformat/intl-relativeformat-tests.ts new file mode 100644 index 0000000000..ca3d8280ca --- /dev/null +++ b/types/intl-relativeformat/intl-relativeformat-tests.ts @@ -0,0 +1,16 @@ +import IntlRelativeFormat from "intl-relativeformat"; + +let dateFormatter = new IntlRelativeFormat("en-US"); + +dateFormatter = new IntlRelativeFormat("en-US", { + units: "day" +}); +dateFormatter = new IntlRelativeFormat("en-US", { + units: "day", + style: "numeric" +}); + +console.log(dateFormatter.resolvedOptions().locale); + +dateFormatter.format(new Date()); +dateFormatter.format(new Date(), { now: new Date() }); diff --git a/types/intl-relativeformat/tsconfig.json b/types/intl-relativeformat/tsconfig.json new file mode 100644 index 0000000000..bfd9297169 --- /dev/null +++ b/types/intl-relativeformat/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6", "dom"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": ["index.d.ts", "intl-relativeformat-tests.ts"] +} diff --git a/types/intl-relativeformat/tslint.json b/types/intl-relativeformat/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/intl-relativeformat/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/intrinsic-scale/index.d.ts b/types/intrinsic-scale/index.d.ts new file mode 100644 index 0000000000..56100aeb25 --- /dev/null +++ b/types/intrinsic-scale/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for intrinsic-scale 3.0 +// Project: https://github.com/bfred-it/intrinsic-scale#readme +// Definitions by: shalomdotnet +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function contain(parentWidth: number, parentHeight: number, childWidth: number, childHeight: number): IntrinsicScale; +export function cover(parentWidth: number, parentHeight: number, childWidth: number, childHeight: number): IntrinsicScale; + +export interface IntrinsicScale { + width: number; + height: number; + x: number; + y: number; +} diff --git a/types/intrinsic-scale/intrinsic-scale-tests.ts b/types/intrinsic-scale/intrinsic-scale-tests.ts new file mode 100644 index 0000000000..23c450572b --- /dev/null +++ b/types/intrinsic-scale/intrinsic-scale-tests.ts @@ -0,0 +1,4 @@ +import { cover, contain } from "intrinsic-scale"; + +const intrinsicScale = cover(100, 100, 50, 50); +const { x, y, width, height } = contain(1, 2, 3, 4); diff --git a/types/intrinsic-scale/tsconfig.json b/types/intrinsic-scale/tsconfig.json new file mode 100644 index 0000000000..8fcff6913d --- /dev/null +++ b/types/intrinsic-scale/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", + "intrinsic-scale-tests.ts" + ] +} \ No newline at end of file diff --git a/types/intrinsic-scale/tslint.json b/types/intrinsic-scale/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/intrinsic-scale/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index e593f4dcc3..3bd04944db 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -45,6 +45,8 @@ declare class Commander { } declare namespace IORedis { + type KeyType = string | Buffer; + interface Command { setArgumentTransformer(name: string, fn: (args: any[]) => any[]): void; setReplyTransformer(name: string, fn: (result: any) => any): void; @@ -59,257 +61,257 @@ declare namespace IORedis { send_command(command: string, ...args: any[]): any; - bitcount(key: string, callback: (err: Error, res: number) => void): void; - bitcount(key: string, start: number, end: number, callback: (err: Error, res: number) => void): void; - bitcount(key: string): Promise; - bitcount(key: string, start: number, end: number): Promise; + bitcount(key: KeyType, callback: (err: Error, res: number) => void): void; + bitcount(key: KeyType, start: number, end: number, callback: (err: Error, res: number) => void): void; + bitcount(key: KeyType): Promise; + bitcount(key: KeyType, start: number, end: number): Promise; - get(key: string, callback: (err: Error, res: string) => void): void; - get(key: string): Promise; + get(key: KeyType, callback: (err: Error, res: string) => void): void; + get(key: KeyType): Promise; - getBuffer(key: string, callback: (err: Error, res: Buffer) => void): void; - getBuffer(key: string): Promise; + getBuffer(key: KeyType, callback: (err: Error, res: Buffer) => void): void; + getBuffer(key: KeyType): Promise; - set(key: string, value: any, expiryMode?: string | any[], time?: number | string, setMode?: number | string): Promise; + set(key: KeyType, value: any, expiryMode?: string | any[], time?: number | string, setMode?: number | string): Promise; - set(key: string, value: any, callback: (err: Error, res: string) => void): void; - set(key: string, value: any, setMode: string | any[], callback: (err: Error, res: string) => void): void; - set(key: string, value: any, expiryMode: string, time: number | string, callback: (err: Error, res: string) => void): void; - set(key: string, value: any, expiryMode: string, time: number | string, setMode: number | string, callback: (err: Error, res: string) => void): void; + set(key: KeyType, value: any, callback: (err: Error, res: string) => void): void; + set(key: KeyType, value: any, setMode: string | any[], callback: (err: Error, res: string) => void): void; + set(key: KeyType, value: any, expiryMode: string, time: number | string, callback: (err: Error, res: string) => void): void; + set(key: KeyType, value: any, expiryMode: string, time: number | string, setMode: number | string, callback: (err: Error, res: string) => void): void; - setBuffer(key: string, value: any, expiryMode?: string | any[], time?: number | string, setMode?: number | string): Promise; + setBuffer(key: KeyType, value: any, expiryMode?: string | any[], time?: number | string, setMode?: number | string): Promise; - setBuffer(key: string, value: any, callback: (err: Error, res: Buffer) => void): void; - setBuffer(key: string, value: any, setMode: string, callback: (err: Error, res: Buffer) => void): void; - setBuffer(key: string, value: any, expiryMode: string, time: number, callback: (err: Error, res: Buffer) => void): void; - setBuffer(key: string, value: any, expiryMode: string, time: number | string, setMode: number | string, callback: (err: Error, res: Buffer) => void): void; + setBuffer(key: KeyType, value: any, callback: (err: Error, res: Buffer) => void): void; + setBuffer(key: KeyType, value: any, setMode: string, callback: (err: Error, res: Buffer) => void): void; + setBuffer(key: KeyType, value: any, expiryMode: string, time: number, callback: (err: Error, res: Buffer) => void): void; + setBuffer(key: KeyType, value: any, expiryMode: string, time: number | string, setMode: number | string, callback: (err: Error, res: Buffer) => void): void; - setnx(key: string, value: any, callback: (err: Error, res: any) => void): void; - setnx(key: string, value: any): Promise; + setnx(key: KeyType, value: any, callback: (err: Error, res: any) => void): void; + setnx(key: KeyType, value: any): Promise; - setex(key: string, seconds: number, value: any, callback: (err: Error, res: any) => void): void; - setex(key: string, seconds: number, value: any): Promise; + setex(key: KeyType, seconds: number, value: any, callback: (err: Error, res: any) => void): void; + setex(key: KeyType, seconds: number, value: any): Promise; - psetex(key: string, milliseconds: number, value: any, callback: (err: Error, res: any) => void): void; - psetex(key: string, milliseconds: number, value: any): Promise; + psetex(key: KeyType, milliseconds: number, value: any, callback: (err: Error, res: any) => void): void; + psetex(key: KeyType, milliseconds: number, value: any): Promise; - append(key: string, value: any, callback: (err: Error, res: number) => void): void; - append(key: string, value: any): Promise; + append(key: KeyType, value: any, callback: (err: Error, res: number) => void): void; + append(key: KeyType, value: any): Promise; - strlen(key: string, callback: (err: Error, res: number) => void): void; - strlen(key: string): Promise; + strlen(key: KeyType, callback: (err: Error, res: number) => void): void; + strlen(key: KeyType): Promise; - del(...keys: string[]): any; + del(...keys: KeyType[]): any; - exists(...keys: string[]): any; + exists(...keys: KeyType[]): any; - setbit(key: string, offset: number, value: any, callback: (err: Error, res: number) => void): void; - setbit(key: string, offset: number, value: any): Promise; + setbit(key: KeyType, offset: number, value: any, callback: (err: Error, res: number) => void): void; + setbit(key: KeyType, offset: number, value: any): Promise; - getbit(key: string, offset: number, callback: (err: Error, res: number) => void): void; - getbit(key: string, offset: number): Promise; + getbit(key: KeyType, offset: number, callback: (err: Error, res: number) => void): void; + getbit(key: KeyType, offset: number): Promise; - setrange(key: string, offset: number, value: any, callback: (err: Error, res: number) => void): void; - setrange(key: string, offset: number, value: any): Promise; + setrange(key: KeyType, offset: number, value: any, callback: (err: Error, res: number) => void): void; + setrange(key: KeyType, offset: number, value: any): Promise; - getrange(key: string, start: number, end: number, callback: (err: Error, res: string) => void): void; - getrange(key: string, start: number, end: number): Promise; + getrange(key: KeyType, start: number, end: number, callback: (err: Error, res: string) => void): void; + getrange(key: KeyType, start: number, end: number): Promise; - substr(key: string, start: number, end: number, callback: (err: Error, res: string) => void): void; - substr(key: string, start: number, end: number): Promise; + substr(key: KeyType, start: number, end: number, callback: (err: Error, res: string) => void): void; + substr(key: KeyType, start: number, end: number): Promise; - incr(key: string, callback: (err: Error, res: number) => void): void; - incr(key: string): Promise; + incr(key: KeyType, callback: (err: Error, res: number) => void): void; + incr(key: KeyType): Promise; - decr(key: string, callback: (err: Error, res: number) => void): void; - decr(key: string): Promise; + decr(key: KeyType, callback: (err: Error, res: number) => void): void; + decr(key: KeyType): Promise; - mget(...keys: string[]): any; + mget(...keys: KeyType[]): any; - rpush(key: string, ...values: any[]): any; + rpush(key: KeyType, ...values: any[]): any; - lpush(key: string, ...values: any[]): any; + lpush(key: KeyType, ...values: any[]): any; - rpushx(key: string, value: any, callback: (err: Error, res: number) => void): void; - rpushx(key: string, value: any): Promise; + rpushx(key: KeyType, value: any, callback: (err: Error, res: number) => void): void; + rpushx(key: KeyType, value: any): Promise; - lpushx(key: string, value: any, callback: (err: Error, res: number) => void): void; - lpushx(key: string, value: any): Promise; + lpushx(key: KeyType, value: any, callback: (err: Error, res: number) => void): void; + lpushx(key: KeyType, value: any): Promise; - linsert(key: string, direction: "BEFORE" | "AFTER", pivot: string, value: any, callback: (err: Error, res: number) => void): void; - linsert(key: string, direction: "BEFORE" | "AFTER", pivot: string, value: any): Promise; + linsert(key: KeyType, direction: "BEFORE" | "AFTER", pivot: string, value: any, callback: (err: Error, res: number) => void): void; + linsert(key: KeyType, direction: "BEFORE" | "AFTER", pivot: string, value: any): Promise; - rpop(key: string, callback: (err: Error, res: string) => void): void; - rpop(key: string): Promise; + rpop(key: KeyType, callback: (err: Error, res: string) => void): void; + rpop(key: KeyType): Promise; - lpop(key: string, callback: (err: Error, res: string) => void): void; - lpop(key: string): Promise; + lpop(key: KeyType, callback: (err: Error, res: string) => void): void; + lpop(key: KeyType): Promise; - brpop(...keys: string[]): any; + brpop(...keys: KeyType[]): any; - blpop(...keys: string[]): any; + blpop(...keys: KeyType[]): any; brpoplpush(source: string, destination: string, timeout: number, callback: (err: Error, res: any) => void): void; brpoplpush(source: string, destination: string, timeout: number): Promise; - llen(key: string, callback: (err: Error, res: number) => void): void; - llen(key: string): Promise; + llen(key: KeyType, callback: (err: Error, res: number) => void): void; + llen(key: KeyType): Promise; - lindex(key: string, index: number, callback: (err: Error, res: string) => void): void; - lindex(key: string, index: number): Promise; + lindex(key: KeyType, index: number, callback: (err: Error, res: string) => void): void; + lindex(key: KeyType, index: number): Promise; - lset(key: string, index: number, value: any, callback: (err: Error, res: any) => void): void; - lset(key: string, index: number, value: any): Promise; + lset(key: KeyType, index: number, value: any, callback: (err: Error, res: any) => void): void; + lset(key: KeyType, index: number, value: any): Promise; - lrange(key: string, start: number, stop: number, callback: (err: Error, res: any) => void): void; - lrange(key: string, start: number, stop: number): Promise; + lrange(key: KeyType, start: number, stop: number, callback: (err: Error, res: any) => void): void; + lrange(key: KeyType, start: number, stop: number): Promise; - ltrim(key: string, start: number, stop: number, callback: (err: Error, res: any) => void): void; - ltrim(key: string, start: number, stop: number): Promise; + ltrim(key: KeyType, start: number, stop: number, callback: (err: Error, res: any) => void): void; + ltrim(key: KeyType, start: number, stop: number): Promise; - lrem(key: string, count: number, value: any, callback: (err: Error, res: number) => void): void; - lrem(key: string, count: number, value: any): Promise; + lrem(key: KeyType, count: number, value: any, callback: (err: Error, res: number) => void): void; + lrem(key: KeyType, count: number, value: any): Promise; rpoplpush(source: string, destination: string, callback: (err: Error, res: string) => void): void; rpoplpush(source: string, destination: string): Promise; - sadd(key: string, ...members: any[]): any; + sadd(key: KeyType, ...members: any[]): any; - srem(key: string, ...members: any[]): any; + srem(key: KeyType, ...members: any[]): any; smove(source: string, destination: string, member: string, callback: (err: Error, res: string) => void): void; smove(source: string, destination: string, member: string): Promise; - sismember(key: string, member: string, callback: (err: Error, res: 1 | 0) => void): void; - sismember(key: string, member: string): Promise<1 | 0>; + sismember(key: KeyType, member: string, callback: (err: Error, res: 1 | 0) => void): void; + sismember(key: KeyType, member: string): Promise<1 | 0>; - scard(key: string, callback: (err: Error, res: number) => void): void; - scard(key: string): Promise; + scard(key: KeyType, callback: (err: Error, res: number) => void): void; + scard(key: KeyType): Promise; - spop(key: string, callback: (err: Error, res: any) => void): void; - spop(key: string, count: number, callback: (err: Error, res: any) => void): void; - spop(key: string, count?: number): Promise; + spop(key: KeyType, callback: (err: Error, res: any) => void): void; + spop(key: KeyType, count: number, callback: (err: Error, res: any) => void): void; + spop(key: KeyType, count?: number): Promise; - srandmember(key: string, callback: (err: Error, res: any) => void): void; - srandmember(key: string, count: number, callback: (err: Error, res: any) => void): void; - srandmember(key: string, count?: number): Promise; + srandmember(key: KeyType, callback: (err: Error, res: any) => void): void; + srandmember(key: KeyType, count: number, callback: (err: Error, res: any) => void): void; + srandmember(key: KeyType, count?: number): Promise; - sinter(...keys: string[]): any; + sinter(...keys: KeyType[]): any; - sinterstore(destination: string, ...keys: string[]): any; + sinterstore(destination: string, ...keys: KeyType[]): any; - sunion(...keys: string[]): any; + sunion(...keys: KeyType[]): any; - sunionstore(destination: string, ...keys: string[]): any; + sunionstore(destination: string, ...keys: KeyType[]): any; - sdiff(...keys: string[]): any; + sdiff(...keys: KeyType[]): any; - sdiffstore(destination: string, ...keys: string[]): any; + sdiffstore(destination: string, ...keys: KeyType[]): any; - smembers(key: string, callback: (err: Error, res: any) => void): void; - smembers(key: string): Promise; + smembers(key: KeyType, callback: (err: Error, res: any) => void): void; + smembers(key: KeyType): Promise; - zadd(key: string, ...args: string[]): any; + zadd(key: KeyType, ...args: string[]): any; - zincrby(key: string, increment: number, member: string, callback: (err: Error, res: any) => void): void; - zincrby(key: string, increment: number, member: string): Promise; + zincrby(key: KeyType, increment: number, member: string, callback: (err: Error, res: any) => void): void; + zincrby(key: KeyType, increment: number, member: string): Promise; - zrem(key: string, ...members: any[]): any; + zrem(key: KeyType, ...members: any[]): any; - zremrangebyscore(key: string, min: number | string, max: number | string, callback: (err: Error, res: any) => void): void; - zremrangebyscore(key: string, min: number | string, max: number | string): Promise; + zremrangebyscore(key: KeyType, min: number | string, max: number | string, callback: (err: Error, res: any) => void): void; + zremrangebyscore(key: KeyType, min: number | string, max: number | string): Promise; - zremrangebyrank(key: string, start: number, stop: number, callback: (err: Error, res: any) => void): void; - zremrangebyrank(key: string, start: number, stop: number): Promise; + zremrangebyrank(key: KeyType, start: number, stop: number, callback: (err: Error, res: any) => void): void; + zremrangebyrank(key: KeyType, start: number, stop: number): Promise; - zunionstore(destination: string, numkeys: number, key: string, ...args: string[]): any; + zunionstore(destination: string, numkeys: number, key: KeyType, ...args: string[]): any; - zinterstore(destination: string, numkeys: number, key: string, ...args: string[]): any; + zinterstore(destination: string, numkeys: number, key: KeyType, ...args: string[]): any; - zrange(key: string, start: number, stop: number, callback: (err: Error, res: any) => void): void; - zrange(key: string, start: number, stop: number, withScores: "WITHSCORES", callback: (err: Error, res: any) => void): void; - zrange(key: string, start: number, stop: number, withScores?: "WITHSCORES"): Promise; + zrange(key: KeyType, start: number, stop: number, callback: (err: Error, res: any) => void): void; + zrange(key: KeyType, start: number, stop: number, withScores: "WITHSCORES", callback: (err: Error, res: any) => void): void; + zrange(key: KeyType, start: number, stop: number, withScores?: "WITHSCORES"): Promise; - zrevrange(key: string, start: number, stop: number, callback: (err: Error, res: any) => void): void; - zrevrange(key: string, start: number, stop: number, withScores: "WITHSCORES", callback: (err: Error, res: any) => void): void; - zrevrange(key: string, start: number, stop: number, withScores?: "WITHSCORES"): Promise; + zrevrange(key: KeyType, start: number, stop: number, callback: (err: Error, res: any) => void): void; + zrevrange(key: KeyType, start: number, stop: number, withScores: "WITHSCORES", callback: (err: Error, res: any) => void): void; + zrevrange(key: KeyType, start: number, stop: number, withScores?: "WITHSCORES"): Promise; - zrangebyscore(key: string, min: number | string, max: number | string, ...args: string[]): any; + zrangebyscore(key: KeyType, min: number | string, max: number | string, ...args: string[]): any; - zrevrangebyscore(key: string, max: number | string, min: number | string, ...args: string[]): any; + zrevrangebyscore(key: KeyType, max: number | string, min: number | string, ...args: string[]): any; - zcount(key: string, min: number | string, max: number | string, callback: (err: Error, res: number) => void): void; - zcount(key: string, min: number | string, max: number | string): Promise; + zcount(key: KeyType, min: number | string, max: number | string, callback: (err: Error, res: number) => void): void; + zcount(key: KeyType, min: number | string, max: number | string): Promise; - zcard(key: string, callback: (err: Error, res: number) => void): void; - zcard(key: string): Promise; + zcard(key: KeyType, callback: (err: Error, res: number) => void): void; + zcard(key: KeyType): Promise; - zscore(key: string, member: string, callback: (err: Error, res: string) => void): void; - zscore(key: string, member: string): Promise; + zscore(key: KeyType, member: string, callback: (err: Error, res: string) => void): void; + zscore(key: KeyType, member: string): Promise; - zrank(key: string, member: string, callback: (err: Error, res: number) => void): void; - zrank(key: string, member: string): Promise; + zrank(key: KeyType, member: string, callback: (err: Error, res: number) => void): void; + zrank(key: KeyType, member: string): Promise; - zrevrank(key: string, member: string, callback: (err: Error, res: number) => void): void; - zrevrank(key: string, member: string): Promise; + zrevrank(key: KeyType, member: string, callback: (err: Error, res: number) => void): void; + zrevrank(key: KeyType, member: string): Promise; - hset(key: string, field: string, value: any, callback: (err: Error, res: 0 | 1) => void): void; - hset(key: string, field: string, value: any): Promise<0 | 1>; - hsetBuffer(key: string, field: string, value: any, callback: (err: Error, res: 0 | 1) => void): void; - hsetBuffer(key: string, field: string, value: any): Promise; + hset(key: KeyType, field: string, value: any, callback: (err: Error, res: 0 | 1) => void): void; + hset(key: KeyType, field: string, value: any): Promise<0 | 1>; + hsetBuffer(key: KeyType, field: string, value: any, callback: (err: Error, res: 0 | 1) => void): void; + hsetBuffer(key: KeyType, field: string, value: any): Promise; - hsetnx(key: string, field: string, value: any, callback: (err: Error, res: 0 | 1) => void): void; - hsetnx(key: string, field: string, value: any): Promise<0 | 1>; + hsetnx(key: KeyType, field: string, value: any, callback: (err: Error, res: 0 | 1) => void): void; + hsetnx(key: KeyType, field: string, value: any): Promise<0 | 1>; - hget(key: string, field: string, callback: (err: Error, res: string) => void): void; - hget(key: string, field: string): Promise; - hgetBuffer(key: string, field: string, callback: (err: Error, res: Buffer) => void): void; - hgetBuffer(key: string, field: string): Promise; + hget(key: KeyType, field: string, callback: (err: Error, res: string) => void): void; + hget(key: KeyType, field: string): Promise; + hgetBuffer(key: KeyType, field: string, callback: (err: Error, res: Buffer) => void): void; + hgetBuffer(key: KeyType, field: string): Promise; - hmset(key: string, field: string, value: any, ...args: string[]): Promise<0 | 1>; - hmset(key: string, data: any, callback: (err: Error, res: 0 | 1) => void): void; - hmset(key: string, data: any): Promise<0 | 1>; + hmset(key: KeyType, field: string, value: any, ...args: string[]): Promise<0 | 1>; + hmset(key: KeyType, data: any, callback: (err: Error, res: 0 | 1) => void): void; + hmset(key: KeyType, data: any): Promise<0 | 1>; - hmget(key: string, ...fields: string[]): any; + hmget(key: KeyType, ...fields: string[]): any; - hincrby(key: string, field: string, increment: number, callback: (err: Error, res: number) => void): void; - hincrby(key: string, field: string, increment: number): Promise; + hincrby(key: KeyType, field: string, increment: number, callback: (err: Error, res: number) => void): void; + hincrby(key: KeyType, field: string, increment: number): Promise; - hincrbyfloat(key: string, field: string, increment: number, callback: (err: Error, res: number) => void): void; - hincrbyfloat(key: string, field: string, increment: number): Promise; + hincrbyfloat(key: KeyType, field: string, increment: number, callback: (err: Error, res: number) => void): void; + hincrbyfloat(key: KeyType, field: string, increment: number): Promise; - hdel(key: string, ...fields: string[]): any; + hdel(key: KeyType, ...fields: string[]): any; - hlen(key: string, callback: (err: Error, res: number) => void): void; - hlen(key: string): Promise; + hlen(key: KeyType, callback: (err: Error, res: number) => void): void; + hlen(key: KeyType): Promise; - hkeys(key: string, callback: (err: Error, res: any) => void): void; - hkeys(key: string): Promise; + hkeys(key: KeyType, callback: (err: Error, res: any) => void): void; + hkeys(key: KeyType): Promise; - hvals(key: string, callback: (err: Error, res: any) => void): void; - hvals(key: string): Promise; + hvals(key: KeyType, callback: (err: Error, res: any) => void): void; + hvals(key: KeyType): Promise; - hgetall(key: string, callback: (err: Error, res: any) => void): void; - hgetall(key: string): Promise; + hgetall(key: KeyType, callback: (err: Error, res: any) => void): void; + hgetall(key: KeyType): Promise; - hexists(key: string, field: string, callback: (err: Error, res: 0 | 1) => void): void; - hexists(key: string, field: string): Promise<0 | 1>; + hexists(key: KeyType, field: string, callback: (err: Error, res: 0 | 1) => void): void; + hexists(key: KeyType, field: string): Promise<0 | 1>; - incrby(key: string, increment: number, callback: (err: Error, res: number) => void): void; - incrby(key: string, increment: number): Promise; + incrby(key: KeyType, increment: number, callback: (err: Error, res: number) => void): void; + incrby(key: KeyType, increment: number): Promise; - incrbyfloat(key: string, increment: number, callback: (err: Error, res: number) => void): void; - incrbyfloat(key: string, increment: number): Promise; + incrbyfloat(key: KeyType, increment: number, callback: (err: Error, res: number) => void): void; + incrbyfloat(key: KeyType, increment: number): Promise; - decrby(key: string, decrement: number, callback: (err: Error, res: number) => void): void; - decrby(key: string, decrement: number): Promise; + decrby(key: KeyType, decrement: number, callback: (err: Error, res: number) => void): void; + decrby(key: KeyType, decrement: number): Promise; - getset(key: string, value: any, callback: (err: Error, res: string) => void): void; - getset(key: string, value: any): Promise; + getset(key: KeyType, value: any, callback: (err: Error, res: string) => void): void; + getset(key: KeyType, value: any): Promise; - mset(key: string, value: any, ...args: string[]): any; + mset(key: KeyType, value: any, ...args: string[]): any; - msetnx(key: string, value: any, ...args: string[]): any; + msetnx(key: KeyType, value: any, ...args: string[]): any; randomkey(callback: (err: Error, res: string) => void): void; randomkey(): Promise; @@ -317,26 +319,26 @@ declare namespace IORedis { select(index: number, callback: (err: Error, res: string) => void): void; select(index: number): Promise; - move(key: string, db: string, callback: (err: Error, res: 0 | 1) => void): void; - move(key: string, db: string): Promise<0 | 1>; + move(key: KeyType, db: string, callback: (err: Error, res: 0 | 1) => void): void; + move(key: KeyType, db: string): Promise<0 | 1>; - rename(key: string, newkey: string, callback: (err: Error, res: string) => void): void; - rename(key: string, newkey: string): Promise; + rename(key: KeyType, newkey: KeyType, callback: (err: Error, res: string) => void): void; + rename(key: KeyType, newkey: KeyType): Promise; - renamenx(key: string, newkey: string, callback: (err: Error, res: 0 | 1) => void): void; - renamenx(key: string, newkey: string): Promise<0 | 1>; + renamenx(key: KeyType, newkey: KeyType, callback: (err: Error, res: 0 | 1) => void): void; + renamenx(key: KeyType, newkey: KeyType): Promise<0 | 1>; - expire(key: string, seconds: number, callback: (err: Error, res: 0 | 1) => void): void; - expire(key: string, seconds: number): Promise<0 | 1>; + expire(key: KeyType, seconds: number, callback: (err: Error, res: 0 | 1) => void): void; + expire(key: KeyType, seconds: number): Promise<0 | 1>; - pexpire(key: string, milliseconds: number, callback: (err: Error, res: 0 | 1) => void): void; - pexpire(key: string, milliseconds: number): Promise<0 | 1>; + pexpire(key: KeyType, milliseconds: number, callback: (err: Error, res: 0 | 1) => void): void; + pexpire(key: KeyType, milliseconds: number): Promise<0 | 1>; - expireat(key: string, timestamp: number, callback: (err: Error, res: 0 | 1) => void): void; - expireat(key: string, timestamp: number): Promise<0 | 1>; + expireat(key: KeyType, timestamp: number, callback: (err: Error, res: 0 | 1) => void): void; + expireat(key: KeyType, timestamp: number): Promise<0 | 1>; - pexpireat(key: string, millisecondsTimestamp: number, callback: (err: Error, res: 0 | 1) => void): void; - pexpireat(key: string, millisecondsTimestamp: number): Promise<0 | 1>; + pexpireat(key: KeyType, millisecondsTimestamp: number, callback: (err: Error, res: 0 | 1) => void): void; + pexpireat(key: KeyType, millisecondsTimestamp: number): Promise<0 | 1>; keys(pattern: string, callback: (err: Error, res: string[]) => void): void; keys(pattern: string): Promise; @@ -369,8 +371,8 @@ declare namespace IORedis { lastsave(callback: (err: Error, res: number) => void): void; lastsave(): Promise; - type(key: string, callback: (err: Error, res: string) => void): void; - type(key: string): Promise; + type(key: KeyType, callback: (err: Error, res: string) => void): void; + type(key: KeyType): Promise; multi(commands?: string[][], options?: MultiOptions): Pipeline; multi(options: { pipeline: false }): Promise; @@ -390,7 +392,7 @@ declare namespace IORedis { flushall(callback: (err: Error, res: string) => void): void; flushall(): Promise; - sort(key: string, ...args: string[]): any; + sort(key: KeyType, ...args: string[]): any; info(callback: (err: Error, res: any) => void): void; info(section: string, callback: (err: Error, res: any) => void): void; @@ -402,11 +404,11 @@ declare namespace IORedis { monitor(callback: (err: Error, res: NodeJS.EventEmitter) => void): void; monitor(): Promise; - ttl(key: string, callback: (err: Error, res: number) => void): void; - ttl(key: string): Promise; + ttl(key: KeyType, callback: (err: Error, res: number) => void): void; + ttl(key: KeyType): Promise; - persist(key: string, callback: (err: Error, res: 0 | 1) => void): void; - persist(key: string): Promise<0 | 1>; + persist(key: KeyType, callback: (err: Error, res: 0 | 1) => void): void; + persist(key: KeyType): Promise<0 | 1>; slaveof(host: string, port: number, callback: (err: Error, res: string) => void): void; slaveof(host: string, port: number): Promise; @@ -426,7 +428,7 @@ declare namespace IORedis { publish(channel: string, message: string, callback: (err: Error, res: number) => void): void; publish(channel: string, message: string): Promise; - watch(...keys: string[]): any; + watch(...keys: KeyType[]): any; unwatch(callback: (err: Error, res: string) => void): void; unwatch(): Promise; @@ -437,8 +439,8 @@ declare namespace IORedis { migrate(...args: any[]): any; - dump(key: string, callback: (err: Error, res: string) => void): void; - dump(key: string): Promise; + dump(key: KeyType, callback: (err: Error, res: string) => void): void; + dump(key: KeyType): Promise; object(subcommand: string, ...args: any[]): any; @@ -455,24 +457,24 @@ declare namespace IORedis { scan(cursor: number, ...args: any[]): any; - sscan(key: string, cursor: number, ...args: any[]): any; + sscan(key: KeyType, cursor: number, ...args: any[]): any; - hscan(key: string, cursor: number, ...args: any[]): any; + hscan(key: KeyType, cursor: number, ...args: any[]): any; - zscan(key: string, cursor: number, ...args: any[]): any; + zscan(key: KeyType, cursor: number, ...args: any[]): any; - pfmerge(destkey: string, ...sourcekeys: string[]): any; + pfmerge(destkey: KeyType, ...sourcekeys: KeyType[]): any; - pfadd(key: string, ...elements: string[]): any; + pfadd(key: KeyType, ...elements: string[]): any; - pfcount(...keys: string[]): any; + pfcount(...keys: KeyType[]): any; pipeline(commands?: string[][]): Pipeline; scanStream(options?: ScanStreamOption): NodeJS.EventEmitter; - sscanStream(key: string, options?: ScanStreamOption): NodeJS.EventEmitter; - hscanStream(key: string, options?: ScanStreamOption): NodeJS.EventEmitter; - zscanStream(key: string, options?: ScanStreamOption): NodeJS.EventEmitter; + sscanStream(key: KeyType, options?: ScanStreamOption): NodeJS.EventEmitter; + hscanStream(key: KeyType, options?: ScanStreamOption): NodeJS.EventEmitter; + zscanStream(key: KeyType, options?: ScanStreamOption): NodeJS.EventEmitter; } interface Pipeline { @@ -483,208 +485,208 @@ declare namespace IORedis { _result: any[]; _transactions: number; _shaToScript: {}; - bitcount(key: string, callback?: (err: Error, res: number) => void): Pipeline; - bitcount(key: string, start: number, end: number, callback?: (err: Error, res: number) => void): Pipeline; + bitcount(key: KeyType, callback?: (err: Error, res: number) => void): Pipeline; + bitcount(key: KeyType, start: number, end: number, callback?: (err: Error, res: number) => void): Pipeline; - get(key: string, callback?: (err: Error, res: string) => void): Pipeline; - getBuffer(key: string, callback?: (err: Error, res: Buffer) => void): Pipeline; + get(key: KeyType, callback?: (err: Error, res: string) => void): Pipeline; + getBuffer(key: KeyType, callback?: (err: Error, res: Buffer) => void): Pipeline; - set(key: string, value: any, callback?: (err: Error, res: string) => void): Pipeline; - set(key: string, value: any, setMode: string, callback?: (err: Error, res: string) => void): Pipeline; - set(key: string, value: any, expiryMode: string, time: number, callback?: (err: Error, res: string) => void): Pipeline; - set(key: string, value: any, expiryMode: string, time: number, setMode: string, callback?: (err: Error, res: string) => void): Pipeline; + set(key: KeyType, value: any, callback?: (err: Error, res: string) => void): Pipeline; + set(key: KeyType, value: any, setMode: string, callback?: (err: Error, res: string) => void): Pipeline; + set(key: KeyType, value: any, expiryMode: string, time: number, callback?: (err: Error, res: string) => void): Pipeline; + set(key: KeyType, value: any, expiryMode: string, time: number, setMode: string, callback?: (err: Error, res: string) => void): Pipeline; - setBuffer(key: string, value: any, callback?: (err: Error, res: Buffer) => void): Pipeline; - setBuffer(key: string, value: any, setMode: string, callback?: (err: Error, res: Buffer) => void): Pipeline; - setBuffer(key: string, value: any, expiryMode: string, time: number, callback?: (err: Error, res: Buffer) => void): Pipeline; - setBuffer(key: string, value: any, expiryMode: string, time: number, setMode: string, callback?: (err: Error, res: Buffer) => void): Pipeline; + setBuffer(key: KeyType, value: any, callback?: (err: Error, res: Buffer) => void): Pipeline; + setBuffer(key: KeyType, value: any, setMode: string, callback?: (err: Error, res: Buffer) => void): Pipeline; + setBuffer(key: KeyType, value: any, expiryMode: string, time: number, callback?: (err: Error, res: Buffer) => void): Pipeline; + setBuffer(key: KeyType, value: any, expiryMode: string, time: number, setMode: string, callback?: (err: Error, res: Buffer) => void): Pipeline; - setnx(key: string, value: any, callback?: (err: Error, res: any) => void): Pipeline; + setnx(key: KeyType, value: any, callback?: (err: Error, res: any) => void): Pipeline; - setex(key: string, seconds: number, value: any, callback?: (err: Error, res: any) => void): Pipeline; + setex(key: KeyType, seconds: number, value: any, callback?: (err: Error, res: any) => void): Pipeline; - psetex(key: string, milliseconds: number, value: any, callback?: (err: Error, res: any) => void): Pipeline; + psetex(key: KeyType, milliseconds: number, value: any, callback?: (err: Error, res: any) => void): Pipeline; - append(key: string, value: any, callback?: (err: Error, res: number) => void): Pipeline; + append(key: KeyType, value: any, callback?: (err: Error, res: number) => void): Pipeline; - strlen(key: string, callback?: (err: Error, res: number) => void): Pipeline; + strlen(key: KeyType, callback?: (err: Error, res: number) => void): Pipeline; - del(...keys: string[]): Pipeline; + del(...keys: KeyType[]): Pipeline; - exists(...keys: string[]): Pipeline; + exists(...keys: KeyType[]): Pipeline; - setbit(key: string, offset: number, value: any, callback?: (err: Error, res: number) => void): Pipeline; + setbit(key: KeyType, offset: number, value: any, callback?: (err: Error, res: number) => void): Pipeline; - getbit(key: string, offset: number, callback?: (err: Error, res: number) => void): Pipeline; + getbit(key: KeyType, offset: number, callback?: (err: Error, res: number) => void): Pipeline; - setrange(key: string, offset: number, value: any, callback?: (err: Error, res: number) => void): Pipeline; + setrange(key: KeyType, offset: number, value: any, callback?: (err: Error, res: number) => void): Pipeline; - getrange(key: string, start: number, end: number, callback?: (err: Error, res: string) => void): Pipeline; + getrange(key: KeyType, start: number, end: number, callback?: (err: Error, res: string) => void): Pipeline; - substr(key: string, start: number, end: number, callback?: (err: Error, res: string) => void): Pipeline; + substr(key: KeyType, start: number, end: number, callback?: (err: Error, res: string) => void): Pipeline; - incr(key: string, callback?: (err: Error, res: number) => void): Pipeline; + incr(key: KeyType, callback?: (err: Error, res: number) => void): Pipeline; - decr(key: string, callback?: (err: Error, res: number) => void): Pipeline; + decr(key: KeyType, callback?: (err: Error, res: number) => void): Pipeline; - mget(...keys: string[]): Pipeline; + mget(...keys: KeyType[]): Pipeline; - rpush(key: string, ...values: any[]): Pipeline; + rpush(key: KeyType, ...values: any[]): Pipeline; - lpush(key: string, ...values: any[]): Pipeline; + lpush(key: KeyType, ...values: any[]): Pipeline; - rpushx(key: string, value: any, callback?: (err: Error, res: number) => void): Pipeline; + rpushx(key: KeyType, value: any, callback?: (err: Error, res: number) => void): Pipeline; - lpushx(key: string, value: any, callback?: (err: Error, res: number) => void): Pipeline; + lpushx(key: KeyType, value: any, callback?: (err: Error, res: number) => void): Pipeline; - linsert(key: string, direction: "BEFORE" | "AFTER", pivot: string, value: any, callback?: (err: Error, res: number) => void): Pipeline; + linsert(key: KeyType, direction: "BEFORE" | "AFTER", pivot: string, value: any, callback?: (err: Error, res: number) => void): Pipeline; - rpop(key: string, callback?: (err: Error, res: string) => void): Pipeline; + rpop(key: KeyType, callback?: (err: Error, res: string) => void): Pipeline; - lpop(key: string, callback?: (err: Error, res: string) => void): Pipeline; + lpop(key: KeyType, callback?: (err: Error, res: string) => void): Pipeline; - brpop(...keys: string[]): Pipeline; + brpop(...keys: KeyType[]): Pipeline; - blpop(...keys: string[]): Pipeline; + blpop(...keys: KeyType[]): Pipeline; brpoplpush(source: string, destination: string, timeout: number, callback?: (err: Error, res: any) => void): Pipeline; - llen(key: string, callback?: (err: Error, res: number) => void): Pipeline; + llen(key: KeyType, callback?: (err: Error, res: number) => void): Pipeline; - lindex(key: string, index: number, callback?: (err: Error, res: string) => void): Pipeline; + lindex(key: KeyType, index: number, callback?: (err: Error, res: string) => void): Pipeline; - lset(key: string, index: number, value: any, callback?: (err: Error, res: any) => void): Pipeline; + lset(key: KeyType, index: number, value: any, callback?: (err: Error, res: any) => void): Pipeline; - lrange(key: string, start: number, stop: number, callback?: (err: Error, res: any) => void): Pipeline; + lrange(key: KeyType, start: number, stop: number, callback?: (err: Error, res: any) => void): Pipeline; - ltrim(key: string, start: number, stop: number, callback?: (err: Error, res: any) => void): Pipeline; + ltrim(key: KeyType, start: number, stop: number, callback?: (err: Error, res: any) => void): Pipeline; - lrem(key: string, count: number, value: any, callback?: (err: Error, res: number) => void): Pipeline; + lrem(key: KeyType, count: number, value: any, callback?: (err: Error, res: number) => void): Pipeline; rpoplpush(source: string, destination: string, callback?: (err: Error, res: string) => void): Pipeline; - sadd(key: string, ...members: any[]): Pipeline; + sadd(key: KeyType, ...members: any[]): Pipeline; - srem(key: string, ...members: any[]): Pipeline; + srem(key: KeyType, ...members: any[]): Pipeline; smove(source: string, destination: string, member: string, callback?: (err: Error, res: string) => void): Pipeline; - sismember(key: string, member: string, callback?: (err: Error, res: 1 | 0) => void): Pipeline; + sismember(key: KeyType, member: string, callback?: (err: Error, res: 1 | 0) => void): Pipeline; - scard(key: string, callback?: (err: Error, res: number) => void): Pipeline; + scard(key: KeyType, callback?: (err: Error, res: number) => void): Pipeline; - spop(key: string, callback?: (err: Error, res: any) => void): Pipeline; - spop(key: string, count: number, callback?: (err: Error, res: any) => void): Pipeline; + spop(key: KeyType, callback?: (err: Error, res: any) => void): Pipeline; + spop(key: KeyType, count: number, callback?: (err: Error, res: any) => void): Pipeline; - srandmember(key: string, callback?: (err: Error, res: any) => void): Pipeline; - srandmember(key: string, count: number, callback?: (err: Error, res: any) => void): Pipeline; + srandmember(key: KeyType, callback?: (err: Error, res: any) => void): Pipeline; + srandmember(key: KeyType, count: number, callback?: (err: Error, res: any) => void): Pipeline; - sinter(...keys: string[]): Pipeline; + sinter(...keys: KeyType[]): Pipeline; - sinterstore(destination: string, ...keys: string[]): Pipeline; + sinterstore(destination: string, ...keys: KeyType[]): Pipeline; - sunion(...keys: string[]): Pipeline; + sunion(...keys: KeyType[]): Pipeline; - sunionstore(destination: string, ...keys: string[]): Pipeline; + sunionstore(destination: string, ...keys: KeyType[]): Pipeline; - sdiff(...keys: string[]): Pipeline; + sdiff(...keys: KeyType[]): Pipeline; - sdiffstore(destination: string, ...keys: string[]): Pipeline; + sdiffstore(destination: string, ...keys: KeyType[]): Pipeline; - smembers(key: string, callback?: (err: Error, res: any) => void): Pipeline; + smembers(key: KeyType, callback?: (err: Error, res: any) => void): Pipeline; - zadd(key: string, ...args: string[]): Pipeline; + zadd(key: KeyType, ...args: string[]): Pipeline; - zincrby(key: string, increment: number, member: string, callback?: (err: Error, res: any) => void): Pipeline; + zincrby(key: KeyType, increment: number, member: string, callback?: (err: Error, res: any) => void): Pipeline; - zrem(key: string, ...members: any[]): Pipeline; + zrem(key: KeyType, ...members: any[]): Pipeline; - zremrangebyscore(key: string, min: number | string, max: number | string, callback?: (err: Error, res: any) => void): Pipeline; + zremrangebyscore(key: KeyType, min: number | string, max: number | string, callback?: (err: Error, res: any) => void): Pipeline; - zremrangebyrank(key: string, start: number, stop: number, callback?: (err: Error, res: any) => void): Pipeline; + zremrangebyrank(key: KeyType, start: number, stop: number, callback?: (err: Error, res: any) => void): Pipeline; - zunionstore(destination: string, numkeys: number, key: string, ...args: string[]): Pipeline; + zunionstore(destination: string, numkeys: number, key: KeyType, ...args: string[]): Pipeline; - zinterstore(destination: string, numkeys: number, key: string, ...args: string[]): Pipeline; + zinterstore(destination: string, numkeys: number, key: KeyType, ...args: string[]): Pipeline; - zrange(key: string, start: number, stop: number, callback?: (err: Error, res: any) => void): Pipeline; - zrange(key: string, start: number, stop: number, withScores: "WITHSCORES", callback?: (err: Error, res: any) => void): Pipeline; + zrange(key: KeyType, start: number, stop: number, callback?: (err: Error, res: any) => void): Pipeline; + zrange(key: KeyType, start: number, stop: number, withScores: "WITHSCORES", callback?: (err: Error, res: any) => void): Pipeline; - zrevrange(key: string, start: number, stop: number, callback?: (err: Error, res: any) => void): Pipeline; - zrevrange(key: string, start: number, stop: number, withScores: "WITHSCORES", callback?: (err: Error, res: any) => void): Pipeline; + zrevrange(key: KeyType, start: number, stop: number, callback?: (err: Error, res: any) => void): Pipeline; + zrevrange(key: KeyType, start: number, stop: number, withScores: "WITHSCORES", callback?: (err: Error, res: any) => void): Pipeline; - zrangebyscore(key: string, min: number | string, max: number | string, ...args: string[]): Pipeline; + zrangebyscore(key: KeyType, min: number | string, max: number | string, ...args: string[]): Pipeline; - zrevrangebyscore(key: string, max: number | string, min: number | string, ...args: string[]): Pipeline; + zrevrangebyscore(key: KeyType, max: number | string, min: number | string, ...args: string[]): Pipeline; - zcount(key: string, min: number | string, max: number | string, callback?: (err: Error, res: number) => void): Pipeline; + zcount(key: KeyType, min: number | string, max: number | string, callback?: (err: Error, res: number) => void): Pipeline; - zcard(key: string, callback?: (err: Error, res: number) => void): Pipeline; + zcard(key: KeyType, callback?: (err: Error, res: number) => void): Pipeline; - zscore(key: string, member: string, callback?: (err: Error, res: number) => void): Pipeline; + zscore(key: KeyType, member: string, callback?: (err: Error, res: number) => void): Pipeline; - zrank(key: string, member: string, callback?: (err: Error, res: number) => void): Pipeline; + zrank(key: KeyType, member: string, callback?: (err: Error, res: number) => void): Pipeline; - zrevrank(key: string, member: string, callback?: (err: Error, res: number) => void): Pipeline; + zrevrank(key: KeyType, member: string, callback?: (err: Error, res: number) => void): Pipeline; - hset(key: string, field: string, value: any, callback?: (err: Error, res: 0 | 1) => void): Pipeline; - hsetBuffer(key: string, field: string, value: any, callback?: (err: Error, res: Buffer) => void): Pipeline; + hset(key: KeyType, field: string, value: any, callback?: (err: Error, res: 0 | 1) => void): Pipeline; + hsetBuffer(key: KeyType, field: string, value: any, callback?: (err: Error, res: Buffer) => void): Pipeline; - hsetnx(key: string, field: string, value: any, callback?: (err: Error, res: 0 | 1) => void): Pipeline; + hsetnx(key: KeyType, field: string, value: any, callback?: (err: Error, res: 0 | 1) => void): Pipeline; - hget(key: string, field: string, callback?: (err: Error, res: string) => void): Pipeline; - hgetBuffer(key: string, field: string, callback?: (err: Error, res: Buffer) => void): Pipeline; + hget(key: KeyType, field: string, callback?: (err: Error, res: string) => void): Pipeline; + hgetBuffer(key: KeyType, field: string, callback?: (err: Error, res: Buffer) => void): Pipeline; - hmset(key: string, field: string, value: any, ...args: string[]): Pipeline; - hmset(key: string, data: any, callback?: (err: Error, res: 0 | 1) => void): Pipeline; + hmset(key: KeyType, field: string, value: any, ...args: string[]): Pipeline; + hmset(key: KeyType, data: any, callback?: (err: Error, res: 0 | 1) => void): Pipeline; - hmget(key: string, ...fields: string[]): Pipeline; + hmget(key: KeyType, ...fields: string[]): Pipeline; - hincrby(key: string, field: string, increment: number, callback?: (err: Error, res: number) => void): Pipeline; + hincrby(key: KeyType, field: string, increment: number, callback?: (err: Error, res: number) => void): Pipeline; - hincrbyfloat(key: string, field: string, increment: number, callback?: (err: Error, res: number) => void): Pipeline; + hincrbyfloat(key: KeyType, field: string, increment: number, callback?: (err: Error, res: number) => void): Pipeline; - hdel(key: string, ...fields: string[]): Pipeline; + hdel(key: KeyType, ...fields: string[]): Pipeline; - hlen(key: string, callback?: (err: Error, res: number) => void): Pipeline; + hlen(key: KeyType, callback?: (err: Error, res: number) => void): Pipeline; - hkeys(key: string, callback?: (err: Error, res: any) => void): Pipeline; + hkeys(key: KeyType, callback?: (err: Error, res: any) => void): Pipeline; - hvals(key: string, callback?: (err: Error, res: any) => void): Pipeline; + hvals(key: KeyType, callback?: (err: Error, res: any) => void): Pipeline; - hgetall(key: string, callback?: (err: Error, res: any) => void): Pipeline; + hgetall(key: KeyType, callback?: (err: Error, res: any) => void): Pipeline; - hexists(key: string, field: string, callback?: (err: Error, res: 0 | 1) => void): Pipeline; + hexists(key: KeyType, field: string, callback?: (err: Error, res: 0 | 1) => void): Pipeline; - incrby(key: string, increment: number, callback?: (err: Error, res: number) => void): Pipeline; + incrby(key: KeyType, increment: number, callback?: (err: Error, res: number) => void): Pipeline; - incrbyfloat(key: string, increment: number, callback?: (err: Error, res: number) => void): Pipeline; + incrbyfloat(key: KeyType, increment: number, callback?: (err: Error, res: number) => void): Pipeline; - decrby(key: string, decrement: number, callback?: (err: Error, res: number) => void): Pipeline; + decrby(key: KeyType, decrement: number, callback?: (err: Error, res: number) => void): Pipeline; - getset(key: string, value: any, callback?: (err: Error, res: string) => void): Pipeline; + getset(key: KeyType, value: any, callback?: (err: Error, res: string) => void): Pipeline; - mset(key: string, value: any, ...args: string[]): Pipeline; + mset(key: KeyType, value: any, ...args: string[]): Pipeline; - msetnx(key: string, value: any, ...args: string[]): Pipeline; + msetnx(key: KeyType, value: any, ...args: string[]): Pipeline; randomkey(callback?: (err: Error, res: string) => void): Pipeline; select(index: number, callback?: (err: Error, res: string) => void): Pipeline; - move(key: string, db: string, callback?: (err: Error, res: 0 | 1) => void): Pipeline; + move(key: KeyType, db: string, callback?: (err: Error, res: 0 | 1) => void): Pipeline; - rename(key: string, newkey: string, callback?: (err: Error, res: string) => void): Pipeline; + rename(key: KeyType, newkey: KeyType, callback?: (err: Error, res: string) => void): Pipeline; - renamenx(key: string, newkey: string, callback?: (err: Error, res: 0 | 1) => void): Pipeline; + renamenx(key: KeyType, newkey: KeyType, callback?: (err: Error, res: 0 | 1) => void): Pipeline; - expire(key: string, seconds: number, callback?: (err: Error, res: 0 | 1) => void): Pipeline; + expire(key: KeyType, seconds: number, callback?: (err: Error, res: 0 | 1) => void): Pipeline; - pexpire(key: string, milliseconds: number, callback?: (err: Error, res: 0 | 1) => void): Pipeline; + pexpire(key: KeyType, milliseconds: number, callback?: (err: Error, res: 0 | 1) => void): Pipeline; - expireat(key: string, timestamp: number, callback?: (err: Error, res: 0 | 1) => void): Pipeline; + expireat(key: KeyType, timestamp: number, callback?: (err: Error, res: 0 | 1) => void): Pipeline; - pexpireat(key: string, millisecondsTimestamp: number, callback?: (err: Error, res: 0 | 1) => void): Pipeline; + pexpireat(key: KeyType, millisecondsTimestamp: number, callback?: (err: Error, res: 0 | 1) => void): Pipeline; keys(pattern: string, callback?: (err: Error, res: string[]) => void): Pipeline; @@ -707,7 +709,7 @@ declare namespace IORedis { lastsave(callback?: (err: Error, res: number) => void): Pipeline; - type(key: string, callback?: (err: Error, res: string) => void): Pipeline; + type(key: KeyType, callback?: (err: Error, res: string) => void): Pipeline; multi(callback?: (err: Error, res: string) => void): Pipeline; @@ -721,7 +723,7 @@ declare namespace IORedis { flushall(callback?: (err: Error, res: string) => void): Pipeline; - sort(key: string, ...args: string[]): Pipeline; + sort(key: KeyType, ...args: string[]): Pipeline; info(callback?: (err: Error, res: any) => void): Pipeline; info(section: string, callback?: (err: Error, res: any) => void): Pipeline; @@ -730,9 +732,9 @@ declare namespace IORedis { monitor(callback?: (err: Error, res: NodeJS.EventEmitter) => void): Pipeline; - ttl(key: string, callback?: (err: Error, res: number) => void): Pipeline; + ttl(key: KeyType, callback?: (err: Error, res: number) => void): Pipeline; - persist(key: string, callback?: (err: Error, res: 0 | 1) => void): Pipeline; + persist(key: KeyType, callback?: (err: Error, res: 0 | 1) => void): Pipeline; slaveof(host: string, port: number, callback?: (err: Error, res: string) => void): Pipeline; @@ -750,7 +752,7 @@ declare namespace IORedis { publish(channel: string, message: string, callback?: (err: Error, res: number) => void): Pipeline; - watch(...keys: string[]): Pipeline; + watch(...keys: KeyType[]): Pipeline; unwatch(callback?: (err: Error, res: string) => void): Pipeline; @@ -760,7 +762,7 @@ declare namespace IORedis { migrate(...args: any[]): Pipeline; - dump(key: string, callback?: (err: Error, res: string) => void): Pipeline; + dump(key: KeyType, callback?: (err: Error, res: string) => void): Pipeline; object(subcommand: string, ...args: any[]): Pipeline; @@ -776,17 +778,17 @@ declare namespace IORedis { scan(cursor: number, ...args: any[]): Pipeline; - sscan(key: string, cursor: number, ...args: any[]): Pipeline; + sscan(key: KeyType, cursor: number, ...args: any[]): Pipeline; - hscan(key: string, cursor: number, ...args: any[]): Pipeline; + hscan(key: KeyType, cursor: number, ...args: any[]): Pipeline; - zscan(key: string, cursor: number, ...args: any[]): Pipeline; + zscan(key: KeyType, cursor: number, ...args: any[]): Pipeline; - pfmerge(destkey: string, ...sourcekeys: string[]): Pipeline; + pfmerge(destkey: KeyType, ...sourcekeys: KeyType[]): Pipeline; - pfadd(key: string, ...elements: string[]): Pipeline; + pfadd(key: KeyType, ...elements: string[]): Pipeline; - pfcount(...keys: string[]): Pipeline; + pfcount(...keys: KeyType[]): Pipeline; } interface NodeConfiguration { diff --git a/types/ioredis/ioredis-tests.ts b/types/ioredis/ioredis-tests.ts index 32ae5c24d5..106a50210b 100644 --- a/types/ioredis/ioredis-tests.ts +++ b/types/ioredis/ioredis-tests.ts @@ -31,6 +31,10 @@ redis.set('key', '100', 'EX', 10, 'NX', (err, data) => {}); redis.set('key', '100', ['EX', 10, 'NX'], (err, data) => {}); redis.setBuffer('key', '100', 'NX', 'EX', 10, (err, data) => {}); +// Should support usage of Buffer +redis.set(Buffer.from('key'), '100'); +redis.setBuffer(Buffer.from('key'), '100', 'NX', 'EX', 10); + new Redis(); // Connect to 127.0.0.1:6379 new Redis(6380); // 127.0.0.1:6380 new Redis(6379, '192.168.1.1'); // 192.168.1.1:6379 diff --git a/types/is-uuid/index.d.ts b/types/is-uuid/index.d.ts new file mode 100644 index 0000000000..f6e1f8626b --- /dev/null +++ b/types/is-uuid/index.d.ts @@ -0,0 +1,46 @@ +// Type definitions for is-uuid 1.0 +// Project: https://github.com/afram/is-uuid#readme +// Definitions by: André Thériault +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Returns true if the value is a v1 UUID + * @param value The value to test + */ +export function v1(value: string): boolean; + +/** + * Returns true if the value is a v2 UUID + * @param value The value to test + */ +export function v2(value: string): boolean; + +/** + * Returns true if the value is a v3 UUID + * @param value The value to test + */ +export function v3(value: string): boolean; + +/** + * Returns true if the value is a v4 UUID + * @param value The value to test + */ +export function v4(value: string): boolean; + +/** + * Returns true if the value is a v5 UUID + * @param value The value to test + */ +export function v5(value: string): boolean; + +/** + * Returns true if the value is a nil UUID + * @param value The value to test + */ +export function nil(value: string): boolean; + +/** + * Returns true for v1 - v5 UUID. Will return false for nil UUID + * @param value The value to test + */ +export function anyNonNil(value: string): boolean; diff --git a/types/is-uuid/is-uuid-tests.ts b/types/is-uuid/is-uuid-tests.ts new file mode 100644 index 0000000000..4e07b10905 --- /dev/null +++ b/types/is-uuid/is-uuid-tests.ts @@ -0,0 +1,10 @@ +import * as isUUID from 'is-uuid'; + +isUUID.v1('857b3f0a-a777-11e5-bf7f-feff819cdc9f'); +isUUID.v2('9a7b330a-a736-21e5-af7f-feaf819cdc9f'); +isUUID.v3('0a7b330a-a736-35ea-8f7f-feaf019cdc00'); +isUUID.v4('c51c80c2-66a1-442a-91e2-4f55b4256a72'); +isUUID.v5('5a2de30a-a736-5aea-8f7f-ad0f019cdc00'); + +isUUID.anyNonNil('c51c80c2-66a1-442a-91e2-4f55b4256a72'); +isUUID.nil('00000000-0000-0000-0000-000000000000'); diff --git a/types/is-uuid/tsconfig.json b/types/is-uuid/tsconfig.json new file mode 100644 index 0000000000..eec8e9597a --- /dev/null +++ b/types/is-uuid/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "is-uuid-tests.ts" + ] +} diff --git a/types/is-uuid/tslint.json b/types/is-uuid/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/is-uuid/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index 0453ef7d20..256e35a8c7 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for joi v13.4.0 +// Type definitions for joi 13.4 // Project: https://github.com/hapijs/joi // Definitions by: Bart van der Schoor // Laurence Dougal Myers @@ -125,7 +125,7 @@ export interface IpOptions { cidr?: string; } -export type GuidVersions = 'uuidv1' | 'uuidv2' | 'uuidv3' | 'uuidv4' | 'uuidv5' +export type GuidVersions = 'uuidv1' | 'uuidv2' | 'uuidv3' | 'uuidv4' | 'uuidv5'; export interface GuidOptions { version: GuidVersions[] | GuidVersions; @@ -181,8 +181,8 @@ export interface ReferenceOptions { } export interface IPOptions { - version?: Array; - cidr?: string + version?: string[]; + cidr?: string; } export interface StringRegexOptions { @@ -236,7 +236,6 @@ export type Schema = AnySchema | LazySchema; export interface AnySchema extends JoiObject { - schemaType?: Types | string; /** @@ -441,7 +440,6 @@ export interface State { } export interface BooleanSchema extends AnySchema { - /** * Allows for additional values to be considered valid booleans by converting them to true during validation. * Accepts a value or an array of values. String comparisons are by default case insensitive, @@ -695,7 +693,9 @@ export interface ArraySchema extends AnySchema { /** * Lists the types in sequence order for the array values where: * @param type - a joi schema object to validate against each array item in sequence order. type can be an array of values, or multiple values can be passed as individual arguments. - * If a given type is .required() then there must be a matching item with the same index position in the array. Errors will contain the number of items that didn't match. Any unmatched item having a label will be mentioned explicitly. + * If a given type is .required() then there must be a matching item with the same index position in the array. + * Errors will contain the number of items that didn't match. + * Any unmatched item having a label will be mentioned explicitly. */ ordered(...types: SchemaLike[]): this; ordered(types: SchemaLike[]): this; @@ -726,7 +726,6 @@ export interface ArraySchema extends AnySchema { } export interface ObjectSchema extends AnySchema { - /** * Sets or extends the allowed object keys. */ @@ -754,9 +753,9 @@ export interface ObjectSchema extends AnySchema { /** * Specify validation rules for unknown keys matching a pattern. - * - * @param pattern - a pattern that can be either a regular expression or a joi schema that will be tested against the unknown key names - * @param schema - the schema object matching keys must validate against + * + * @param pattern - a pattern that can be either a regular expression or a joi schema that will be tested against the unknown key names + * @param schema - the schema object matching keys must validate against */ pattern(pattern: RegExp | SchemaLike, schema: SchemaLike): this; @@ -884,7 +883,6 @@ export interface BinarySchema extends AnySchema { } export interface DateSchema extends AnySchema { - /** * Specifies the oldest date allowed. * Notes: 'now' can be passed in lieu of date so as to always compare relatively to the current date, @@ -927,7 +925,6 @@ export interface DateSchema extends AnySchema { } export interface FunctionSchema extends AnySchema { - /** * Specifies the arity of the function where: * @param n - the arity expected. @@ -961,7 +958,6 @@ export interface AlternativesSchema extends AnySchema { } export interface LazySchema extends AnySchema { - } export interface Reference extends JoiObject { @@ -982,7 +978,7 @@ export type ExtensionBoundSchema = Schema & { * @param options - should the context passed into the `validate` function in a custom rule */ createError(type: string, context: Context, state: State, options: ValidationOptions): Err; -} +}; export interface Rules

{ name: string; @@ -1134,7 +1130,7 @@ export function reach(schema: ObjectSchema, path: string[]): T /** * Creates a new Joi instance customized with the extension(s) you provide included. */ -export function extend(extension: Extension|Extension[], ...extensions: (Extension|Extension[])[]): any; +export function extend(extension: Extension|Extension[], ...extensions: Array): any; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -1160,8 +1156,8 @@ export function defaults(fn: DefaultsFunction): Root; export function describe(schema: Schema): Description; /** -* Whitelists a value -*/ + * Whitelists a value + */ export function allow(value: any, ...values: any[]): Schema; export function allow(values: any[]): Schema; diff --git a/types/joi/joi-tests.ts b/types/joi/joi-tests.ts index 49ff810263..5defe20cc1 100644 --- a/types/joi/joi-tests.ts +++ b/types/joi/joi-tests.ts @@ -3,29 +3,24 @@ import Joi = require('joi'); // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- let x: any = null; -let value: any = null; -let num: number = 0; -let str: string = ''; -let bool: boolean = false; -let exp: RegExp = null; -let obj: object = null; -let date: Date = null; -let err: Error = null; -let func: Function = null; +declare const value: any; +let num = 0; +let str = ''; +declare const bool: boolean; +declare const exp: RegExp; +declare const obj: object; +declare const date: Date; +declare const err: Error; +declare const func: Function; -let anyArr: any[] = []; -let numArr: number[] = []; -let strArr: string[] = []; -let boolArr: boolean[] = []; -let expArr: RegExp[] = []; -let objArr: object[] = []; -let errArr: Error[] = []; -let funcArr: Function[] = []; +declare const numArr: number[]; +declare const strArr: string[]; +declare const expArr: RegExp[]; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- let schema: Joi.Schema = null; -let schemaLike: Joi.SchemaLike = null; +declare const schemaLike: Joi.SchemaLike; let anySchema: Joi.AnySchema = null; let numSchema: Joi.NumberSchema = null; @@ -38,7 +33,7 @@ let funcSchema: Joi.FunctionSchema = null; let objSchema: Joi.ObjectSchema = null; let altSchema: Joi.AlternativesSchema = null; -let schemaArr: Joi.Schema[] = []; +declare const schemaArr: Joi.Schema[]; let ref: Joi.Reference = null; let description: Joi.Description = null; @@ -156,7 +151,7 @@ stringRegexOpts = { invert: bool }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -let validErr: Joi.ValidationError = null; +declare const validErr: Joi.ValidationError; let validErrItem: Joi.ValidationErrorItem; let validErrFunc: Joi.ValidationErrorFunction; @@ -235,13 +230,13 @@ schemaMap = { { c1: true }, { c2: null } ] -} +}; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- anySchema = Joi.any(); -namespace common { +{ // common anySchema = anySchema.allow(x); anySchema = anySchema.allow(x, x); anySchema = anySchema.allow([x, x, x]); @@ -323,7 +318,6 @@ arrSchema = arrSchema.unique(); arrSchema = arrSchema.unique((a, b) => a.test === b.test); arrSchema = arrSchema.unique('customer.id'); - arrSchema = arrSchema.items(numSchema); arrSchema = arrSchema.items(numSchema, strSchema, schemaLike); arrSchema = arrSchema.items([numSchema, strSchema, schemaLike]); @@ -333,7 +327,7 @@ arrSchema = arrSchema.items([schemaMap, schemaMap, schemaLike]); // - - - - - - - - -namespace common_copy_paste { +{ // common copy paste // use search & replace from any arrSchema = arrSchema.allow(x); arrSchema = arrSchema.allow(x, x); @@ -387,7 +381,7 @@ namespace common_copy_paste { boolSchema = Joi.bool(); boolSchema = Joi.boolean(); -namespace common_copy_paste { +{ // common copy paste boolSchema = boolSchema.allow(x); boolSchema = boolSchema.allow(x, x); boolSchema = boolSchema.allow([x, x, x]); @@ -462,7 +456,7 @@ binSchema = binSchema.min(num); binSchema = binSchema.max(num); binSchema = binSchema.length(num); -namespace common { +{ // common binSchema = binSchema.allow(x); binSchema = binSchema.allow(x, x); binSchema = binSchema.allow([x, x, x]); @@ -535,7 +529,7 @@ dateSchema = dateSchema.timestamp(); dateSchema = dateSchema.timestamp('javascript'); dateSchema = dateSchema.timestamp('unix'); -namespace common { +{ // common dateSchema = dateSchema.allow(x); dateSchema = dateSchema.allow(x, x); dateSchema = dateSchema.allow([x, x, x]); @@ -611,7 +605,7 @@ numSchema = numSchema.positive(); numSchema = numSchema.negative(); numSchema = numSchema.port(); -namespace common { +{ // common numSchema = numSchema.allow(x); numSchema = numSchema.allow(x, x); numSchema = numSchema.allow([x, x, x]); @@ -729,7 +723,7 @@ objSchema = objSchema.forbiddenKeys(str); objSchema = objSchema.forbiddenKeys(str, str); objSchema = objSchema.forbiddenKeys(strArr); -namespace common { +{ // common objSchema = objSchema.allow(x); objSchema = objSchema.allow(x, x); objSchema = objSchema.allow([x, x, x]); @@ -809,7 +803,7 @@ strSchema = strSchema.ip(ipOpts); strSchema = strSchema.uri(); strSchema = strSchema.uri(uriOpts); strSchema = strSchema.guid(); -strSchema = strSchema.guid({ version: ['uuidv1', 'uuidv2', 'uuidv3', 'uuidv4', 'uuidv5'] } as Joi.GuidOptions); +strSchema = strSchema.guid({ version: ['uuidv1', 'uuidv2', 'uuidv3', 'uuidv4', 'uuidv5'] }); strSchema = strSchema.guid({ version: 'uuidv4' }); strSchema = strSchema.hex(); strSchema = strSchema.hex(hexOpts); @@ -825,7 +819,7 @@ strSchema = strSchema.normalize('NFKC'); strSchema = strSchema.base64(); strSchema = strSchema.base64(base64Opts); -namespace common { +{ // common strSchema = strSchema.allow(x); strSchema = strSchema.allow(x, x); strSchema = strSchema.allow([x, x, x]); @@ -891,11 +885,11 @@ schema = Joi.alt(schema, anySchema, boolSchema); // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -schema = Joi.lazy(() => schema) +schema = Joi.lazy(() => schema); // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -namespace validate_tests { +{ // validate tests { Joi.validate(value, obj); Joi.validate(value, schema); @@ -925,7 +919,7 @@ namespace validate_tests { { let value = { username: 'example', password: 'example' }; - let schema = Joi.object().keys({ + const schema = Joi.object().keys({ username: Joi.string().max(255).required(), password: Joi.string().regex(/^[a-zA-Z0-9]{3,255}$/).required(), }); @@ -951,12 +945,11 @@ namespace validate_tests { returnValue .then(val => JSON.stringify(val, null, 2)) - .then(val => { throw 'one error'; }) + .then(val => { throw new Error('one error'); }) .catch(e => {}); } } - // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- schema = Joi.compile(obj); diff --git a/types/joi/tslint.json b/types/joi/tslint.json index a41bf5d19a..87b70df769 100644 --- a/types/joi/tslint.json +++ b/types/joi/tslint.json @@ -1,79 +1,13 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, + // All are TODOs "ban-types": false, "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "unified-signatures": false } } diff --git a/types/joi/v10/index.d.ts b/types/joi/v10/index.d.ts index e8202d77dd..8e0026a5fe 100644 --- a/types/joi/v10/index.d.ts +++ b/types/joi/v10/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for joi v10.6.0 +// Type definitions for joi 10.6 // Project: https://github.com/hapijs/joi // Definitions by: Bart van der Schoor // Laurence Dougal Myers @@ -114,7 +114,7 @@ export interface IpOptions { cidr?: string; } -export type GuidVersions = 'uuidv1' | 'uuidv2' | 'uuidv3' | 'uuidv4' | 'uuidv5' +export type GuidVersions = 'uuidv1' | 'uuidv2' | 'uuidv3' | 'uuidv4' | 'uuidv5'; export interface GuidOptions { version: GuidVersions[] | GuidVersions; @@ -160,8 +160,8 @@ export interface ReferenceOptions { } export interface IPOptions { - version?: Array; - cidr?: string + version?: string[]; + cidr?: string; } export interface JoiObject { @@ -210,7 +210,6 @@ export type Schema = AnySchema | LazySchema; export interface AnySchema extends JoiObject { - /** * Validates a value using the schema and options. */ @@ -411,7 +410,6 @@ export interface State { } export interface BooleanSchema extends AnySchema { - /** * Allows for additional values to be considered valid booleans by converting them to true during validation. * Accepts a value or an array of values. String comparisons are by default case insensitive, @@ -514,7 +512,6 @@ export interface StringSchema extends AnySchema { max(limit: number, encoding?: string): this; max(limit: Reference, encoding?: string): this; - /** * Specifies whether the string.max() limit should be used as a truncation. * @param enabled - optional parameter defaulting to true which allows you to reset the behavior of truncate by providing a falsy value. @@ -651,7 +648,9 @@ export interface ArraySchema extends AnySchema { /** * Lists the types in sequence order for the array values where: * @param type - a joi schema object to validate against each array item in sequence order. type can be an array of values, or multiple values can be passed as individual arguments. - * If a given type is .required() then there must be a matching item with the same index position in the array. Errors will contain the number of items that didn't match. Any unmatched item having a label will be mentioned explicitly. + * If a given type is .required() then there must be a matching item with the same index position in the array. + * Errors will contain the number of items that didn't match. + * Any unmatched item having a label will be mentioned explicitly. */ ordered(...types: SchemaLike[]): this; ordered(types: SchemaLike[]): this; @@ -682,7 +681,6 @@ export interface ArraySchema extends AnySchema { } export interface ObjectSchema extends AnySchema { - /** * Sets the allowed object keys. */ @@ -819,7 +817,6 @@ export interface BinarySchema extends AnySchema { } export interface DateSchema extends AnySchema { - /** * Specifies the oldest date allowed. * Notes: 'now' can be passed in lieu of date so as to always compare relatively to the current date, @@ -862,7 +859,6 @@ export interface DateSchema extends AnySchema { } export interface FunctionSchema extends AnySchema { - /** * Specifies the arity of the function where: * @param n - the arity expected. @@ -896,7 +892,6 @@ export interface AlternativesSchema extends AnySchema { } export interface LazySchema extends AnySchema { - } export interface Reference extends JoiObject { @@ -917,7 +912,7 @@ export type ExtensionBoundSchema = Schema & { * @param options - should the context passed into the `validate` function in a custom rule */ createError(type: string, context: Context, state: State, options: ValidationOptions): Err; -} +}; export interface Rules

{ name: string; @@ -1078,8 +1073,8 @@ export function extend(extention: Extension): any; export function describe(schema: Schema): Description; /** -* Whitelists a value -*/ + * Whitelists a value + */ export function allow(value: any, ...values: any[]): Schema; export function allow(values: any[]): Schema; diff --git a/types/joi/v10/joi-tests.ts b/types/joi/v10/joi-tests.ts index e1194f5b76..8782a46dfa 100644 --- a/types/joi/v10/joi-tests.ts +++ b/types/joi/v10/joi-tests.ts @@ -2,50 +2,45 @@ import Joi = require('joi'); // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var x: any = null; -var value: any = null; -var num: number = 0; -var str: string = ''; -var bool: boolean = false; -var exp: RegExp = null; -var obj: object = null; -var date: Date = null; -var err: Error = null; -var func: Function = null; +let x: any = null; +declare const value: any; +let num = 0; +let str = ''; +declare const bool: boolean; +declare const exp: RegExp; +declare const obj: object; +declare const date: Date; +declare const err: Error; +declare const func: Function; -var anyArr: any[] = []; -var numArr: number[] = []; -var strArr: string[] = []; -var boolArr: boolean[] = []; -var expArr: RegExp[] = []; -var objArr: object[] = []; -var errArr: Error[] = []; -var funcArr: Function[] = []; +declare const numArr: number[]; +declare const strArr: string[]; +declare const expArr: RegExp[]; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var schema: Joi.Schema = null; -var schemaLike: Joi.SchemaLike = null; +let schema: Joi.Schema = null; +declare const schemaLike: Joi.SchemaLike; -var anySchema: Joi.AnySchema = null; -var numSchema: Joi.NumberSchema = null; -var strSchema: Joi.StringSchema = null; -var arrSchema: Joi.ArraySchema = null; -var boolSchema: Joi.BooleanSchema = null; -var binSchema: Joi.BinarySchema = null; -var dateSchema: Joi.DateSchema = null; -var funcSchema: Joi.FunctionSchema = null; -var objSchema: Joi.ObjectSchema = null; -var altSchema: Joi.AlternativesSchema = null; +let anySchema: Joi.AnySchema = null; +let numSchema: Joi.NumberSchema = null; +let strSchema: Joi.StringSchema = null; +let arrSchema: Joi.ArraySchema = null; +let boolSchema: Joi.BooleanSchema = null; +let binSchema: Joi.BinarySchema = null; +let dateSchema: Joi.DateSchema = null; +let funcSchema: Joi.FunctionSchema = null; +let objSchema: Joi.ObjectSchema = null; +let altSchema: Joi.AlternativesSchema = null; -var schemaArr: Joi.Schema[] = []; +declare const schemaArr: Joi.Schema[]; -var ref: Joi.Reference = null; -var description: Joi.Description = null; +let ref: Joi.Reference = null; +let description: Joi.Description = null; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var validOpts: Joi.ValidationOptions = null; +let validOpts: Joi.ValidationOptions = null; validOpts = { abortEarly: bool }; validOpts = { convert: bool }; @@ -77,7 +72,7 @@ validOpts = { // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var renOpts: Joi.RenameOptions = null; +let renOpts: Joi.RenameOptions; renOpts = { alias: bool }; renOpts = { multiple: bool }; @@ -86,7 +81,7 @@ renOpts = { ignoreUndefined: bool }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var emailOpts: Joi.EmailOptions = null; +let emailOpts: Joi.EmailOptions; emailOpts = { errorLevel: num }; emailOpts = { errorLevel: bool }; @@ -96,7 +91,7 @@ emailOpts = { minDomainAtoms: num }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var ipOpts: Joi.IpOptions = null; +let ipOpts: Joi.IpOptions; ipOpts = { version: str }; ipOpts = { version: strArr }; @@ -104,7 +99,7 @@ ipOpts = { cidr: str }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var uriOpts: Joi.UriOptions = null; +let uriOpts: Joi.UriOptions; uriOpts = { scheme: str }; uriOpts = { scheme: exp }; @@ -113,7 +108,7 @@ uriOpts = { scheme: expArr }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var whenOpts: Joi.WhenOptions = null; +let whenOpts: Joi.WhenOptions; whenOpts = { is: x }; whenOpts = { is: schema, then: schema }; @@ -122,7 +117,7 @@ whenOpts = { is: schemaLike, then: schemaLike, otherwise: schemaLike }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var whenSchemaOpts: Joi.WhenSchemaOptions = null; +let whenSchemaOpts: Joi.WhenSchemaOptions; whenSchemaOpts = { then: schema }; whenSchemaOpts = { otherwise: schema }; @@ -130,16 +125,16 @@ whenSchemaOpts = { then: schemaLike, otherwise: schemaLike }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var refOpts: Joi.ReferenceOptions = null; +let refOpts: Joi.ReferenceOptions; refOpts = { separator: str }; refOpts = { contextPrefix: str }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var validErr: Joi.ValidationError = null; -var validErrItem: Joi.ValidationErrorItem; -var validErrFunc: Joi.ValidationErrorFunction; +declare const validErr: Joi.ValidationError; +let validErrItem: Joi.ValidationErrorItem; +let validErrFunc: Joi.ValidationErrorFunction; validErrItem = { message: str, @@ -184,7 +179,7 @@ anySchema = objSchema; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var schemaMap: Joi.SchemaMap = null; +let schemaMap: Joi.SchemaMap; schemaMap = { a: numSchema, @@ -216,13 +211,13 @@ schemaMap = { { c1: true }, { c2: null } ] -} +}; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- anySchema = Joi.any(); -namespace common { +{ // common anySchema = anySchema.allow(x); anySchema = anySchema.allow(x, x); anySchema = anySchema.allow([x, x, x]); @@ -304,7 +299,6 @@ arrSchema = arrSchema.unique(); arrSchema = arrSchema.unique((a, b) => a.test === b.test); arrSchema = arrSchema.unique('customer.id'); - arrSchema = arrSchema.items(numSchema); arrSchema = arrSchema.items(numSchema, strSchema, schemaLike); arrSchema = arrSchema.items([numSchema, strSchema, schemaLike]); @@ -314,7 +308,7 @@ arrSchema = arrSchema.items([schemaMap, schemaMap, schemaLike]); // - - - - - - - - -namespace common_copy_paste { +{ // common copy paste // use search & replace from any arrSchema = arrSchema.allow(x); arrSchema = arrSchema.allow(x, x); @@ -368,7 +362,7 @@ namespace common_copy_paste { boolSchema = Joi.bool(); boolSchema = Joi.boolean(); -namespace common_copy_paste { +{ // common copy paste boolSchema = boolSchema.allow(x); boolSchema = boolSchema.allow(x, x); boolSchema = boolSchema.allow([x, x, x]); @@ -443,7 +437,7 @@ binSchema = binSchema.min(num); binSchema = binSchema.max(num); binSchema = binSchema.length(num); -namespace common { +{ // common binSchema = binSchema.allow(x); binSchema = binSchema.allow(x, x); binSchema = binSchema.allow([x, x, x]); @@ -516,7 +510,7 @@ dateSchema = dateSchema.timestamp(); dateSchema = dateSchema.timestamp('javascript'); dateSchema = dateSchema.timestamp('unix'); -namespace common { +{ // common dateSchema = dateSchema.allow(x); dateSchema = dateSchema.allow(x, x); dateSchema = dateSchema.allow([x, x, x]); @@ -591,7 +585,7 @@ numSchema = numSchema.multiple(num); numSchema = numSchema.positive(); numSchema = numSchema.negative(); -namespace common { +{ // common numSchema = numSchema.allow(x); numSchema = numSchema.allow(x, x); numSchema = numSchema.allow([x, x, x]); @@ -702,7 +696,7 @@ objSchema = objSchema.optionalKeys(str); objSchema = objSchema.optionalKeys(str, str); objSchema = objSchema.optionalKeys(strArr); -namespace common { +{ // common objSchema = objSchema.allow(x); objSchema = objSchema.allow(x, x); objSchema = objSchema.allow([x, x, x]); @@ -781,7 +775,7 @@ strSchema = strSchema.ip(ipOpts); strSchema = strSchema.uri(); strSchema = strSchema.uri(uriOpts); strSchema = strSchema.guid(); -strSchema = strSchema.guid({ version: ['uuidv1', 'uuidv2', 'uuidv3', 'uuidv4', 'uuidv5'] } as Joi.GuidOptions); +strSchema = strSchema.guid({ version: ['uuidv1', 'uuidv2', 'uuidv3', 'uuidv4', 'uuidv5'] }); strSchema = strSchema.guid({ version: 'uuidv4' }); strSchema = strSchema.hex(); strSchema = strSchema.hostname(); @@ -794,7 +788,7 @@ strSchema = strSchema.truncate(false); strSchema = strSchema.normalize(); strSchema = strSchema.normalize('NFKC'); -namespace common { +{ // common strSchema = strSchema.allow(x); strSchema = strSchema.allow(x, x); strSchema = strSchema.allow([x, x, x]); @@ -860,11 +854,11 @@ schema = Joi.alt(schema, anySchema, boolSchema); // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -schema = Joi.lazy(() => schema) +schema = Joi.lazy(() => schema); // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -namespace validate_tests { +{ // validate tests { Joi.validate(value, obj); Joi.validate(value, schema); @@ -894,7 +888,7 @@ namespace validate_tests { { let value = { username: 'example', password: 'example' }; - let schema = Joi.object().keys({ + const schema = Joi.object().keys({ username: Joi.string().max(255).required(), password: Joi.string().regex(/^[a-zA-Z0-9]{3,255}$/).required(), }); @@ -920,7 +914,6 @@ namespace validate_tests { } } - // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- schema = Joi.compile(obj); diff --git a/types/joi/v10/tslint.json b/types/joi/v10/tslint.json index a41bf5d19a..0b8095b5e1 100644 --- a/types/joi/v10/tslint.json +++ b/types/joi/v10/tslint.json @@ -1,79 +1,12 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, + // All are TODOs "ban-types": false, "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "unified-signatures": false } } diff --git a/types/joi/v6/index.d.ts b/types/joi/v6/index.d.ts index d9ee7c20d1..5f5fb5625d 100644 --- a/types/joi/v6/index.d.ts +++ b/types/joi/v6/index.d.ts @@ -1,778 +1,773 @@ -// Type definitions for joi v6.5.0 +// Type definitions for joi 6.5 // Project: https://github.com/spumko/joi -// Definitions by: Bart van der Schoor , Laurence Dougal Myers , Christopher Glantschnig , David Broder-Rodgers +// Definitions by: Bart van der Schoor +// Laurence Dougal Myers +// Christopher Glantschnig +// David Broder-Rodgers // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TODO express type of Schema in a type-parameter (.default, .valid, .example etc) -declare module 'joi' { - - export interface ValidationOptions { - /** - * when true, stops validation on the first error, otherwise returns all the errors found. Defaults to true. - */ - abortEarly?: boolean; - /** - * when true, attempts to cast values to the required types (e.g. a string to a number). Defaults to true. - */ - convert?: boolean; - /** - * when true, allows object to contain unknown keys which are ignored. Defaults to false. - */ - allowUnknown?: boolean; - /** - * when true, ignores unknown keys with a function value. Defaults to false. - */ - skipFunctions?: boolean; - /** - * when true, unknown keys are deleted (only when value is an object). Defaults to false. - */ - stripUnknown?: boolean; - /** - * overrides individual error messages. Defaults to no override ({}). - */ - language?: Object; - /** - * sets the default presence requirements. Supported modes: 'optional', 'required', and 'forbidden'. Defaults to 'optional'. - */ - presence?: string; - /** - * provides an external data set to be used in references - */ - context?: Object; - } - - export interface RenameOptions { - /** - * if true, does not delete the old key name, keeping both the new and old keys in place. Defaults to false. - */ - alias?: boolean; - /** - * if true, allows renaming multiple keys to the same destination where the last rename wins. Defaults to false. - */ - multiple?: boolean; - /** - * if true, allows renaming a key over an existing key. Defaults to false. - */ - override?: boolean; - /** - * if true, skip renaming of a key if it's undefined. Defaults to false. - */ - ignoreUndefined?: boolean; - } - - export interface EmailOptions { - /** - * Numerical threshold at which an email address is considered invalid - */ - errorLevel?: number | boolean; - /** - * Specifies a list of acceptable TLDs. - */ - tldWhitelist?: string[] | Object; - /** - * Number of atoms required for the domain. Be careful since some domains, such as io, directly allow email. - */ - minDomainAtoms?: number; - } - - export interface IpOptions { - /** - * One or more IP address versions to validate against. Valid values: ipv4, ipv6, ipvfuture - */ - version ?: string | string[]; - /** - * Used to determine if a CIDR is allowed or not. Valid values: optional, required, forbidden - */ - cidr?: string; - } - - export interface UriOptions { - /** - * Specifies one or more acceptable Schemes, should only include the scheme name. - * Can be an Array or String (strings are automatically escaped for use in a Regular Expression). - */ - scheme ?: string | RegExp | Array; - } - - export interface WhenOptions { - /** - * the required condition joi type. - */ - is: T; - /** - * the alternative schema type if the condition is true. Required if otherwise is missing. - */ - then?: Schema; - /** - * the alternative schema type if the condition is false. Required if then is missing - */ - otherwise?: Schema; - } - - export interface ReferenceOptions { - separator?: string; - contextPrefix?: string; - } - - export interface IPOptions { - version?: Array; - cidr?: string - } - - export interface ValidationError extends Error { - message: string; - details: ValidationErrorItem[]; - simple(): string; - annotated(): string; - } - - export interface ValidationErrorItem { - message: string; - type: string; - path: string; - options?: ValidationOptions; - } - - export interface ValidationResult { - error: ValidationError; - value: T; - } - - export interface SchemaMap { - [key: string]: Schema; - } - - export interface Schema extends AnySchema { - - } - - export interface Reference extends Schema { - - } - - export interface AnySchema> { - /** - * Whitelists a value - */ - allow(value: any, ...values: any[]): T; - allow(values: any[]): T; - - /** - * Adds the provided values into the allowed whitelist and marks them as the only valid values allowed. - */ - valid(value: any, ...values: any[]): T; - valid(values: any[]): T; - only(value: any, ...values : any[]): T; - only(values: any[]): T; - equal(value: any, ...values : any[]): T; - equal(values: any[]): T; - - /** - * Blacklists a value - */ - invalid(value: any, ...values: any[]): T; - invalid(values: any[]): T; - disallow(value: any, ...values : any[]): T; - disallow(values: any[]): T; - not(value: any, ...values : any[]): T; - not(values: any[]): T; - - /** - * Marks a key as required which will not allow undefined as value. All keys are optional by default. - */ - required(): T; - - /** - * Marks a key as optional which will allow undefined as values. Used to annotate the schema for readability as all keys are optional by default. - */ - optional(): T; - - /** - * Marks a key as forbidden which will not allow any value except undefined. Used to explicitly forbid keys. - */ - forbidden(): T; - - /** - * Marks a key to be removed from a resulting object or array after validation. Used to sanitize output. - */ - strip(): T; - - /** - * Annotates the key - */ - description(desc: string): T; - - /** - * Annotates the key - */ - notes(notes: string): T; - notes(notes: string[]): T; - - /** - * Annotates the key - */ - tags(notes: string): T; - tags(notes: string[]): T; - - /** - * Attaches metadata to the key. - */ - meta(meta: Object): T; - - /** - * Annotates the key with an example value, must be valid. - */ - example(value: any): T; - - /** - * Annotates the key with an unit name. - */ - unit(name: string): T; - - /** - * Overrides the global validate() options for the current key and any sub-key. - */ - options(options: ValidationOptions): T; - - /** - * Sets the options.convert options to false which prevent type casting for the current key and any child keys. - */ - strict(isStrict?: boolean): T; - - /** - * Sets a default value if the original value is undefined. - * @param value - the value. - * value supports references. - * value may also be a function which returns the default value. - * If value is specified as a function that accepts a single parameter, that parameter will be a context - * object that can be used to derive the resulting value. This clones the object however, which incurs some - * overhead so if you don't need access to the context define your method so that it does not accept any - * parameters. - * Without any value, default has no effect, except for object that will then create nested defaults - * (applying inner defaults of that object). - * - * Note that if value is an object, any changes to the object after default() is called will change the - * reference and any future assignment. - * - * Additionally, when specifying a method you must either have a description property on your method or the - * second parameter is required. - */ - default(value: any, description?: string): T; - default(): T; - - /** - * Returns a new type that is the result of adding the rules of one type to another. - */ - concat(schema: T): T; - - /** - * Converts the type into an alternatives type where the conditions are merged into the type definition where: - */ - when(ref: string, options: WhenOptions): AlternativesSchema; - when(ref: Reference, options: WhenOptions): AlternativesSchema; - - /** - * Overrides the key name in error messages. - */ - label(name: string): T; - - /** - * Outputs the original untouched value instead of the casted value. - */ - raw(isRaw?: boolean): T; - - /** - * Considers anything that matches the schema to be empty (undefined). - * @param schema - any object or joi schema to match. An undefined schema unsets that rule. - */ - empty(schema?: any) : T; - } - - export interface BooleanSchema extends AnySchema { - - } - - export interface NumberSchema extends AnySchema { - /** - * Specifies the minimum value. - * It can also be a reference to another field. - */ - min(limit: number): NumberSchema; - min(limit: Reference): NumberSchema; - - /** - * Specifies the maximum value. - * It can also be a reference to another field. - */ - max(limit: number): NumberSchema; - max(limit: Reference): NumberSchema; - - /** - * Specifies that the value must be greater than limit. - * It can also be a reference to another field. - */ - greater(limit: number): NumberSchema; - greater(limit: Reference): NumberSchema; - - /** - * Specifies that the value must be less than limit. - * It can also be a reference to another field. - */ - less(limit: number): NumberSchema; - less(limit: Reference): NumberSchema; - - /** - * Requires the number to be an integer (no floating point). - */ - integer(): NumberSchema; - - /** - * Specifies the maximum number of decimal places where: - * limit - the maximum number of decimal places allowed. - */ - precision(limit: number): NumberSchema; - - /** - * Specifies that the value must be a multiple of base. - */ - multiple(base: number): NumberSchema; - - /** - * Requires the number to be positive. - */ - positive(): NumberSchema; - - /** - * Requires the number to be negative. - */ - negative(): NumberSchema; - } - - export interface StringSchema extends AnySchema { - /** - * Allows the value to match any whitelist of blacklist item in a case insensitive comparison. - */ - insensitive(): StringSchema; - - /** - * Specifies the minimum number string characters. - * @param limit - the minimum number of string characters required. It can also be a reference to another field. - * @param encoding - if specified, the string length is calculated in bytes using the provided encoding. - */ - min(limit: number, encoding?: string): StringSchema; - min(limit: Reference, encoding?: string): StringSchema; - - /** - * Specifies the maximum number of string characters. - * @param limit - the maximum number of string characters allowed. It can also be a reference to another field. - * @param encoding - if specified, the string length is calculated in bytes using the provided encoding. - */ - max(limit: number, encoding?: string): StringSchema; - max(limit: Reference, encoding?: string): StringSchema; - - /** - * Requires the number to be a credit card number (Using Lunh Algorithm). - */ - creditCard(): StringSchema; - - /** - * Specifies the exact string length required - * @param limit - the required string length. It can also be a reference to another field. - * @param encoding - if specified, the string length is calculated in bytes using the provided encoding. - */ - length(limit: number, encoding?: string): StringSchema; - length(limit: Reference, encoding?: string): StringSchema; - - /** - * Defines a regular expression rule. - * @param pattern - a regular expression object the string value must match against. - * @param name - optional name for patterns (useful with multiple patterns). Defaults to 'required'. - */ - regex(pattern: RegExp, name?: string): StringSchema; - - /** - * Replace characters matching the given pattern with the specified replacement string where: - * @param pattern - a regular expression object to match against, or a string of which all occurrences will be replaced. - * @param replacement - the string that will replace the pattern. - */ - replace(pattern: RegExp, replacement: string): StringSchema; - replace(pattern: string, replacement: string): StringSchema; - - /** - * Requires the string value to only contain a-z, A-Z, and 0-9. - */ - alphanum(): StringSchema; - - /** - * Requires the string value to only contain a-z, A-Z, 0-9, and underscore _. - */ - token(): StringSchema; - - /** - * Requires the string value to be a valid email address. - */ - email(options?: EmailOptions): StringSchema; - - /** - * Requires the string value to be a valid ip address. - */ - ip(options?: IpOptions): StringSchema; - - /** - * Requires the string value to be a valid RFC 3986 URI. - */ - uri(options?: UriOptions): StringSchema; - - /** - * Requires the string value to be a valid GUID. - */ - guid(): StringSchema; - - /** - * Requires the string value to be a valid hexadecimal string. - */ - hex(): StringSchema; - - /** - * Requires the string value to be a valid hostname as per RFC1123. - */ - hostname(): StringSchema; - - /** - * Requires the string value to be in valid ISO 8601 date format. - */ - isoDate(): StringSchema; - - /** - * Requires the string value to be all lowercase. If the validation convert option is on (enabled by default), the string will be forced to lowercase. - */ - lowercase(): StringSchema; - - /** - * Requires the string value to be all uppercase. If the validation convert option is on (enabled by default), the string will be forced to uppercase. - */ - uppercase(): StringSchema; - - /** - * Requires the string value to contain no whitespace before or after. If the validation convert option is on (enabled by default), the string will be trimmed. - */ - trim(): StringSchema; - } - - export interface ArraySchema extends AnySchema { - /** - * Allow this array to be sparse. - * enabled can be used with a falsy value to go back to the default behavior. - */ - sparse(enabled?: any): ArraySchema; - - /** - * Allow single values to be checked against rules as if it were provided as an array. - * enabled can be used with a falsy value to go back to the default behavior. - */ - single(enabled?: any): ArraySchema; - - /** - * List the types allowed for the array values. - * type can be an array of values, or multiple values can be passed as individual arguments. - * If a given type is .required() then there must be a matching item in the array. - * If a type is .forbidden() then it cannot appear in the array. - * Required items can be added multiple times to signify that multiple items must be found. - * Errors will contain the number of items that didn't match. - * Any unmatched item having a label will be mentioned explicitly. - * - * @param type - a joi schema object to validate each array item against. - */ - items(type: Schema, ...types: Schema[]): ArraySchema; - items(types: Schema[]): ArraySchema; - - /** - * Specifies the minimum number of items in the array. - */ - min(limit: number): ArraySchema; - - /** - * Specifies the maximum number of items in the array. - */ - max(limit: number): ArraySchema; - - /** - * Specifies the exact number of items in the array. - */ - length(limit: number): ArraySchema; - - /** - * Requires the array values to be unique. - * Be aware that a deep equality is performed on elements of the array having a type of object, - * a performance penalty is to be expected for this kind of operation. - */ - unique(): ArraySchema; - } - - export interface ObjectSchema extends AnySchema { - /** - * Sets the allowed object keys. - */ - keys(schema?: SchemaMap): ObjectSchema; - - /** - * Specifies the minimum number of keys in the object. - */ - min(limit: number): ObjectSchema; - - /** - * Specifies the maximum number of keys in the object. - */ - max(limit: number): ObjectSchema; - - /** - * Specifies the exact number of keys in the object. - */ - length(limit: number): ObjectSchema; - - /** - * Specify validation rules for unknown keys matching a pattern. - */ - pattern(regex: RegExp, schema: Schema): ObjectSchema; - - /** - * Defines an all-or-nothing relationship between keys where if one of the peers is present, all of them are required as well. - * @param peers - the key names of which if one present, all are required. peers can be a single string value, - * an array of string values, or each peer provided as an argument. - */ - and(peer1: string, ...peers: string[]): ObjectSchema; - and(peers: string[]): ObjectSchema; - - /** - * Defines a relationship between keys where not all peers can be present at the same time. - * @param peers - the key names of which if one present, the others may not all be present. - * peers can be a single string value, an array of string values, or each peer provided as an argument. - */ - nand(peer1: string, ...peers: string[]): ObjectSchema; - nand(peers: string[]): ObjectSchema; - - /** - * Defines a relationship between keys where one of the peers is required (and more than one is allowed). - */ - or(peer1: string, ...peers: string[]): ObjectSchema; - or(peers: string[]): ObjectSchema; - - /** - * Defines an exclusive relationship between a set of keys. one of them is required but not at the same time where: - */ - xor(peer1: string, ...peers: string[]): ObjectSchema; - xor(peers: string[]): ObjectSchema; - - /** - * Requires the presence of other keys whenever the specified key is present. - */ - with(key: string, peers: string): ObjectSchema; - with(key: string, peers: string[]): ObjectSchema; - - /** - * Forbids the presence of other keys whenever the specified is present. - */ - without(key: string, peers: string): ObjectSchema; - without(key: string, peers: string[]): ObjectSchema; - - /** - * Renames a key to another name (deletes the renamed key). - */ - rename(from: string, to: string, options?: RenameOptions): ObjectSchema; - - /** - * Verifies an assertion where. - */ - assert(ref: string, schema: Schema, message?: string): ObjectSchema; - assert(ref: Reference, schema: Schema, message?: string): ObjectSchema; - - /** - * Overrides the handling of unknown keys for the scope of the current object only (does not apply to children). - */ - unknown(allow?: boolean): ObjectSchema; - - /** - * Requires the object to be an instance of a given constructor. - * - * @param constructor - the constructor function that the object must be an instance of. - * @param name - an alternate name to use in validation errors. This is useful when the constructor function does not have a name. - */ - type(constructor: Function, name?: string): ObjectSchema; - - /** - * Sets the specified children to required. - * - * @param children - can be a single string value, an array of string values, or each child provided as an argument. - * - * var schema = Joi.object().keys({ a: { b: Joi.number() }, c: { d: Joi.string() } }); - * var requiredSchema = schema.requiredKeys('', 'a.b', 'c', 'c.d'); - * - * Note that in this example '' means the current object, a is not required but b is, as well as c and d. - */ - requiredKeys(children: string): ObjectSchema; - requiredKeys(children: string[]): ObjectSchema; - requiredKeys(child:string, ...children: string[]): ObjectSchema; - - /** - * Sets the specified children to optional. - * - * @param children - can be a single string value, an array of string values, or each child provided as an argument. - * - * The behavior is exactly the same as requiredKeys. - */ - optionalKeys(children: string): ObjectSchema; - optionalKeys(children: string[]): ObjectSchema; - optionalKeys(child:string, ...children: string[]): ObjectSchema; - } - - export interface BinarySchema extends AnySchema { - /** - * Sets the string encoding format if a string input is converted to a buffer. - */ - encoding(encoding: string): BinarySchema; - - /** - * Specifies the minimum length of the buffer. - */ - min(limit: number): BinarySchema; - - /** - * Specifies the maximum length of the buffer. - */ - max(limit: number): BinarySchema; - - /** - * Specifies the exact length of the buffer: - */ - length(limit: number): BinarySchema; - } - - export interface DateSchema extends AnySchema { - - /** - * Specifies the oldest date allowed. - * Notes: 'now' can be passed in lieu of date so as to always compare relatively to the current date, - * allowing to explicitly ensure a date is either in the past or in the future. - * It can also be a reference to another field. - */ - min(date: Date): DateSchema; - min(date: number): DateSchema; - min(date: string): DateSchema; - min(date: Reference): DateSchema; - - /** - * Specifies the latest date allowed. - * Notes: 'now' can be passed in lieu of date so as to always compare relatively to the current date, - * allowing to explicitly ensure a date is either in the past or in the future. - * It can also be a reference to another field. - */ - max(date: Date): DateSchema; - max(date: number): DateSchema; - max(date: string): DateSchema; - max(date: Reference): DateSchema; - - /** - * Specifies the allowed date format: - * @param format - string or array of strings that follow the moment.js format. - */ - format(format: string): DateSchema; - format(format: string[]): DateSchema; - - /** - * Requires the string value to be in valid ISO 8601 date format. - */ - iso(): DateSchema; - } - - export interface FunctionSchema extends AnySchema { - - } - - export interface AlternativesSchema extends AnySchema { - try(schemas: Schema[]): AlternativesSchema; - when(ref: string, options: WhenOptions): AlternativesSchema; - when(ref: Reference, options: WhenOptions): AlternativesSchema; - } - - // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- - +export interface ValidationOptions { /** - * Generates a schema object that matches any data type. + * when true, stops validation on the first error, otherwise returns all the errors found. Defaults to true. */ - export function any(): Schema; - + abortEarly?: boolean; /** - * Generates a schema object that matches an array data type. + * when true, attempts to cast values to the required types (e.g. a string to a number). Defaults to true. */ - export function array(): ArraySchema; - + convert?: boolean; /** - * Generates a schema object that matches a boolean data type (as well as the strings 'true', 'false', 'yes', and 'no'). Can also be called via bool(). + * when true, allows object to contain unknown keys which are ignored. Defaults to false. */ - export function bool(): BooleanSchema; - - export function boolean(): BooleanSchema; - + allowUnknown?: boolean; /** - * Generates a schema object that matches a Buffer data type (as well as the strings which will be converted to Buffers). + * when true, ignores unknown keys with a function value. Defaults to false. */ - export function binary(): BinarySchema; - + skipFunctions?: boolean; /** - * Generates a schema object that matches a date type (as well as a JavaScript date string or number of milliseconds). + * when true, unknown keys are deleted (only when value is an object). Defaults to false. */ - export function date(): DateSchema; - + stripUnknown?: boolean; /** - * Generates a schema object that matches a function type. + * overrides individual error messages. Defaults to no override ({}). */ - export function func(): FunctionSchema; - + language?: Object; /** - * Generates a schema object that matches a number data type (as well as strings that can be converted to numbers). + * sets the default presence requirements. Supported modes: 'optional', 'required', and 'forbidden'. Defaults to 'optional'. */ - export function number(): NumberSchema; - + presence?: string; /** - * Generates a schema object that matches an object data type (as well as JSON strings that parsed into objects). + * provides an external data set to be used in references */ - export function object(schema?: SchemaMap): ObjectSchema; - - /** - * Generates a schema object that matches a string data type. Note that empty strings are not allowed by default and must be enabled with allow(''). - */ - export function string(): StringSchema; - - /** - * Generates a type that will match one of the provided alternative schemas - */ - export function alternatives(types: Schema[]): Schema; - export function alternatives(type1: Schema, type2: Schema, ...types: Schema[]): Schema; - - /** - * Validates a value using the given schema and options. - */ - export function validate(value: T, schema: Schema, callback: (err: ValidationError, value: T) => void): void; - export function validate(value: T, schema: Object, callback: (err: ValidationError, value: T) => void): void; - export function validate(value: T, schema: Object, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): ValidationResult; - - /** - * Converts literal schema definition to joi schema object (or returns the same back if already a joi schema object). - */ - export function compile(schema: Object): Schema; - - /** - * Validates a value against a schema and throws if validation fails. - * - * @param value - the value to validate. - * @param schema - the schema object. - * @param message - optional message string prefix added in front of the error message. may also be an Error object. - */ - export function assert(value: any, schema: Schema, message?: string | Error): void; - - /** - * Generates a reference to the value of the named key. - */ - export function ref(key: string, options?: ReferenceOptions): Reference; + context?: Object; } + +export interface RenameOptions { + /** + * if true, does not delete the old key name, keeping both the new and old keys in place. Defaults to false. + */ + alias?: boolean; + /** + * if true, allows renaming multiple keys to the same destination where the last rename wins. Defaults to false. + */ + multiple?: boolean; + /** + * if true, allows renaming a key over an existing key. Defaults to false. + */ + override?: boolean; + /** + * if true, skip renaming of a key if it's undefined. Defaults to false. + */ + ignoreUndefined?: boolean; +} + +export interface EmailOptions { + /** + * Numerical threshold at which an email address is considered invalid + */ + errorLevel?: number | boolean; + /** + * Specifies a list of acceptable TLDs. + */ + tldWhitelist?: string[] | Object; + /** + * Number of atoms required for the domain. Be careful since some domains, such as io, directly allow email. + */ + minDomainAtoms?: number; +} + +export interface IpOptions { + /** + * One or more IP address versions to validate against. Valid values: ipv4, ipv6, ipvfuture + */ + version ?: string | string[]; + /** + * Used to determine if a CIDR is allowed or not. Valid values: optional, required, forbidden + */ + cidr?: string; +} + +export interface UriOptions { + /** + * Specifies one or more acceptable Schemes, should only include the scheme name. + * Can be an Array or String (strings are automatically escaped for use in a Regular Expression). + */ + scheme ?: string | RegExp | Array; +} + +export interface WhenOptions { + /** + * the required condition joi type. + */ + is: T; + /** + * the alternative schema type if the condition is true. Required if otherwise is missing. + */ + then?: Schema; + /** + * the alternative schema type if the condition is false. Required if then is missing + */ + otherwise?: Schema; +} + +export interface ReferenceOptions { + separator?: string; + contextPrefix?: string; +} + +export interface IPOptions { + version?: string[]; + cidr?: string; +} + +export interface ValidationError extends Error { + message: string; + details: ValidationErrorItem[]; + simple(): string; + annotated(): string; +} + +export interface ValidationErrorItem { + message: string; + type: string; + path: string; + options?: ValidationOptions; +} + +export interface ValidationResult { + error: ValidationError; + value: T; +} + +export interface SchemaMap { + [key: string]: Schema; +} + +export interface Schema extends AnySchema { +} + +export interface Reference extends Schema { +} + +export interface AnySchema> { + /** + * Whitelists a value + */ + allow(value: any, ...values: any[]): T; + allow(values: any[]): T; + + /** + * Adds the provided values into the allowed whitelist and marks them as the only valid values allowed. + */ + valid(value: any, ...values: any[]): T; + valid(values: any[]): T; + only(value: any, ...values: any[]): T; + only(values: any[]): T; + equal(value: any, ...values: any[]): T; + equal(values: any[]): T; + + /** + * Blacklists a value + */ + invalid(value: any, ...values: any[]): T; + invalid(values: any[]): T; + disallow(value: any, ...values: any[]): T; + disallow(values: any[]): T; + not(value: any, ...values: any[]): T; + not(values: any[]): T; + + /** + * Marks a key as required which will not allow undefined as value. All keys are optional by default. + */ + required(): T; + + /** + * Marks a key as optional which will allow undefined as values. Used to annotate the schema for readability as all keys are optional by default. + */ + optional(): T; + + /** + * Marks a key as forbidden which will not allow any value except undefined. Used to explicitly forbid keys. + */ + forbidden(): T; + + /** + * Marks a key to be removed from a resulting object or array after validation. Used to sanitize output. + */ + strip(): T; + + /** + * Annotates the key + */ + description(desc: string): T; + + /** + * Annotates the key + */ + notes(notes: string): T; + notes(notes: string[]): T; + + /** + * Annotates the key + */ + tags(notes: string): T; + tags(notes: string[]): T; + + /** + * Attaches metadata to the key. + */ + meta(meta: Object): T; + + /** + * Annotates the key with an example value, must be valid. + */ + example(value: any): T; + + /** + * Annotates the key with an unit name. + */ + unit(name: string): T; + + /** + * Overrides the global validate() options for the current key and any sub-key. + */ + options(options: ValidationOptions): T; + + /** + * Sets the options.convert options to false which prevent type casting for the current key and any child keys. + */ + strict(isStrict?: boolean): T; + + /** + * Sets a default value if the original value is undefined. + * @param value - the value. + * value supports references. + * value may also be a function which returns the default value. + * If value is specified as a function that accepts a single parameter, that parameter will be a context + * object that can be used to derive the resulting value. This clones the object however, which incurs some + * overhead so if you don't need access to the context define your method so that it does not accept any + * parameters. + * Without any value, default has no effect, except for object that will then create nested defaults + * (applying inner defaults of that object). + * + * Note that if value is an object, any changes to the object after default() is called will change the + * reference and any future assignment. + * + * Additionally, when specifying a method you must either have a description property on your method or the + * second parameter is required. + */ + default(value: any, description?: string): T; + default(): T; + + /** + * Returns a new type that is the result of adding the rules of one type to another. + */ + concat(schema: T): T; + + /** + * Converts the type into an alternatives type where the conditions are merged into the type definition where: + */ + when(ref: string, options: WhenOptions): AlternativesSchema; + when(ref: Reference, options: WhenOptions): AlternativesSchema; + + /** + * Overrides the key name in error messages. + */ + label(name: string): T; + + /** + * Outputs the original untouched value instead of the casted value. + */ + raw(isRaw?: boolean): T; + + /** + * Considers anything that matches the schema to be empty (undefined). + * @param schema - any object or joi schema to match. An undefined schema unsets that rule. + */ + empty(schema?: any): T; +} + +export interface BooleanSchema extends AnySchema { +} + +export interface NumberSchema extends AnySchema { + /** + * Specifies the minimum value. + * It can also be a reference to another field. + */ + min(limit: number): NumberSchema; + min(limit: Reference): NumberSchema; + + /** + * Specifies the maximum value. + * It can also be a reference to another field. + */ + max(limit: number): NumberSchema; + max(limit: Reference): NumberSchema; + + /** + * Specifies that the value must be greater than limit. + * It can also be a reference to another field. + */ + greater(limit: number): NumberSchema; + greater(limit: Reference): NumberSchema; + + /** + * Specifies that the value must be less than limit. + * It can also be a reference to another field. + */ + less(limit: number): NumberSchema; + less(limit: Reference): NumberSchema; + + /** + * Requires the number to be an integer (no floating point). + */ + integer(): NumberSchema; + + /** + * Specifies the maximum number of decimal places where: + * limit - the maximum number of decimal places allowed. + */ + precision(limit: number): NumberSchema; + + /** + * Specifies that the value must be a multiple of base. + */ + multiple(base: number): NumberSchema; + + /** + * Requires the number to be positive. + */ + positive(): NumberSchema; + + /** + * Requires the number to be negative. + */ + negative(): NumberSchema; +} + +export interface StringSchema extends AnySchema { + /** + * Allows the value to match any whitelist of blacklist item in a case insensitive comparison. + */ + insensitive(): StringSchema; + + /** + * Specifies the minimum number string characters. + * @param limit - the minimum number of string characters required. It can also be a reference to another field. + * @param encoding - if specified, the string length is calculated in bytes using the provided encoding. + */ + min(limit: number, encoding?: string): StringSchema; + min(limit: Reference, encoding?: string): StringSchema; + + /** + * Specifies the maximum number of string characters. + * @param limit - the maximum number of string characters allowed. It can also be a reference to another field. + * @param encoding - if specified, the string length is calculated in bytes using the provided encoding. + */ + max(limit: number, encoding?: string): StringSchema; + max(limit: Reference, encoding?: string): StringSchema; + + /** + * Requires the number to be a credit card number (Using Lunh Algorithm). + */ + creditCard(): StringSchema; + + /** + * Specifies the exact string length required + * @param limit - the required string length. It can also be a reference to another field. + * @param encoding - if specified, the string length is calculated in bytes using the provided encoding. + */ + length(limit: number, encoding?: string): StringSchema; + length(limit: Reference, encoding?: string): StringSchema; + + /** + * Defines a regular expression rule. + * @param pattern - a regular expression object the string value must match against. + * @param name - optional name for patterns (useful with multiple patterns). Defaults to 'required'. + */ + regex(pattern: RegExp, name?: string): StringSchema; + + /** + * Replace characters matching the given pattern with the specified replacement string where: + * @param pattern - a regular expression object to match against, or a string of which all occurrences will be replaced. + * @param replacement - the string that will replace the pattern. + */ + replace(pattern: RegExp, replacement: string): StringSchema; + replace(pattern: string, replacement: string): StringSchema; + + /** + * Requires the string value to only contain a-z, A-Z, and 0-9. + */ + alphanum(): StringSchema; + + /** + * Requires the string value to only contain a-z, A-Z, 0-9, and underscore _. + */ + token(): StringSchema; + + /** + * Requires the string value to be a valid email address. + */ + email(options?: EmailOptions): StringSchema; + + /** + * Requires the string value to be a valid ip address. + */ + ip(options?: IpOptions): StringSchema; + + /** + * Requires the string value to be a valid RFC 3986 URI. + */ + uri(options?: UriOptions): StringSchema; + + /** + * Requires the string value to be a valid GUID. + */ + guid(): StringSchema; + + /** + * Requires the string value to be a valid hexadecimal string. + */ + hex(): StringSchema; + + /** + * Requires the string value to be a valid hostname as per RFC1123. + */ + hostname(): StringSchema; + + /** + * Requires the string value to be in valid ISO 8601 date format. + */ + isoDate(): StringSchema; + + /** + * Requires the string value to be all lowercase. If the validation convert option is on (enabled by default), the string will be forced to lowercase. + */ + lowercase(): StringSchema; + + /** + * Requires the string value to be all uppercase. If the validation convert option is on (enabled by default), the string will be forced to uppercase. + */ + uppercase(): StringSchema; + + /** + * Requires the string value to contain no whitespace before or after. If the validation convert option is on (enabled by default), the string will be trimmed. + */ + trim(): StringSchema; +} + +export interface ArraySchema extends AnySchema { + /** + * Allow this array to be sparse. + * enabled can be used with a falsy value to go back to the default behavior. + */ + sparse(enabled?: any): ArraySchema; + + /** + * Allow single values to be checked against rules as if it were provided as an array. + * enabled can be used with a falsy value to go back to the default behavior. + */ + single(enabled?: any): ArraySchema; + + /** + * List the types allowed for the array values. + * type can be an array of values, or multiple values can be passed as individual arguments. + * If a given type is .required() then there must be a matching item in the array. + * If a type is .forbidden() then it cannot appear in the array. + * Required items can be added multiple times to signify that multiple items must be found. + * Errors will contain the number of items that didn't match. + * Any unmatched item having a label will be mentioned explicitly. + * + * @param type - a joi schema object to validate each array item against. + */ + items(type: Schema, ...types: Schema[]): ArraySchema; + items(types: Schema[]): ArraySchema; + + /** + * Specifies the minimum number of items in the array. + */ + min(limit: number): ArraySchema; + + /** + * Specifies the maximum number of items in the array. + */ + max(limit: number): ArraySchema; + + /** + * Specifies the exact number of items in the array. + */ + length(limit: number): ArraySchema; + + /** + * Requires the array values to be unique. + * Be aware that a deep equality is performed on elements of the array having a type of object, + * a performance penalty is to be expected for this kind of operation. + */ + unique(): ArraySchema; +} + +export interface ObjectSchema extends AnySchema { + /** + * Sets the allowed object keys. + */ + keys(schema?: SchemaMap): ObjectSchema; + + /** + * Specifies the minimum number of keys in the object. + */ + min(limit: number): ObjectSchema; + + /** + * Specifies the maximum number of keys in the object. + */ + max(limit: number): ObjectSchema; + + /** + * Specifies the exact number of keys in the object. + */ + length(limit: number): ObjectSchema; + + /** + * Specify validation rules for unknown keys matching a pattern. + */ + pattern(regex: RegExp, schema: Schema): ObjectSchema; + + /** + * Defines an all-or-nothing relationship between keys where if one of the peers is present, all of them are required as well. + * @param peers - the key names of which if one present, all are required. peers can be a single string value, + * an array of string values, or each peer provided as an argument. + */ + and(peer1: string, ...peers: string[]): ObjectSchema; + and(peers: string[]): ObjectSchema; + + /** + * Defines a relationship between keys where not all peers can be present at the same time. + * @param peers - the key names of which if one present, the others may not all be present. + * peers can be a single string value, an array of string values, or each peer provided as an argument. + */ + nand(peer1: string, ...peers: string[]): ObjectSchema; + nand(peers: string[]): ObjectSchema; + + /** + * Defines a relationship between keys where one of the peers is required (and more than one is allowed). + */ + or(peer1: string, ...peers: string[]): ObjectSchema; + or(peers: string[]): ObjectSchema; + + /** + * Defines an exclusive relationship between a set of keys. one of them is required but not at the same time where: + */ + xor(peer1: string, ...peers: string[]): ObjectSchema; + xor(peers: string[]): ObjectSchema; + + /** + * Requires the presence of other keys whenever the specified key is present. + */ + with(key: string, peers: string): ObjectSchema; + with(key: string, peers: string[]): ObjectSchema; + + /** + * Forbids the presence of other keys whenever the specified is present. + */ + without(key: string, peers: string): ObjectSchema; + without(key: string, peers: string[]): ObjectSchema; + + /** + * Renames a key to another name (deletes the renamed key). + */ + rename(from: string, to: string, options?: RenameOptions): ObjectSchema; + + /** + * Verifies an assertion where. + */ + assert(ref: string, schema: Schema, message?: string): ObjectSchema; + assert(ref: Reference, schema: Schema, message?: string): ObjectSchema; + + /** + * Overrides the handling of unknown keys for the scope of the current object only (does not apply to children). + */ + unknown(allow?: boolean): ObjectSchema; + + /** + * Requires the object to be an instance of a given constructor. + * + * @param constructor - the constructor function that the object must be an instance of. + * @param name - an alternate name to use in validation errors. This is useful when the constructor function does not have a name. + */ + type(constructor: Function, name?: string): ObjectSchema; + + /** + * Sets the specified children to required. + * + * @param children - can be a single string value, an array of string values, or each child provided as an argument. + * + * var schema = Joi.object().keys({ a: { b: Joi.number() }, c: { d: Joi.string() } }); + * var requiredSchema = schema.requiredKeys('', 'a.b', 'c', 'c.d'); + * + * Note that in this example '' means the current object, a is not required but b is, as well as c and d. + */ + requiredKeys(children: string): ObjectSchema; + requiredKeys(children: string[]): ObjectSchema; + requiredKeys(child: string, ...children: string[]): ObjectSchema; + + /** + * Sets the specified children to optional. + * + * @param children - can be a single string value, an array of string values, or each child provided as an argument. + * + * The behavior is exactly the same as requiredKeys. + */ + optionalKeys(children: string): ObjectSchema; + optionalKeys(children: string[]): ObjectSchema; + optionalKeys(child: string, ...children: string[]): ObjectSchema; +} + +export interface BinarySchema extends AnySchema { + /** + * Sets the string encoding format if a string input is converted to a buffer. + */ + encoding(encoding: string): BinarySchema; + + /** + * Specifies the minimum length of the buffer. + */ + min(limit: number): BinarySchema; + + /** + * Specifies the maximum length of the buffer. + */ + max(limit: number): BinarySchema; + + /** + * Specifies the exact length of the buffer: + */ + length(limit: number): BinarySchema; +} + +export interface DateSchema extends AnySchema { + /** + * Specifies the oldest date allowed. + * Notes: 'now' can be passed in lieu of date so as to always compare relatively to the current date, + * allowing to explicitly ensure a date is either in the past or in the future. + * It can also be a reference to another field. + */ + min(date: Date): DateSchema; + min(date: number): DateSchema; + min(date: string): DateSchema; + min(date: Reference): DateSchema; + + /** + * Specifies the latest date allowed. + * Notes: 'now' can be passed in lieu of date so as to always compare relatively to the current date, + * allowing to explicitly ensure a date is either in the past or in the future. + * It can also be a reference to another field. + */ + max(date: Date): DateSchema; + max(date: number): DateSchema; + max(date: string): DateSchema; + max(date: Reference): DateSchema; + + /** + * Specifies the allowed date format: + * @param format - string or array of strings that follow the moment.js format. + */ + format(format: string): DateSchema; + format(format: string[]): DateSchema; + + /** + * Requires the string value to be in valid ISO 8601 date format. + */ + iso(): DateSchema; +} + +export interface FunctionSchema extends AnySchema { +} + +export interface AlternativesSchema extends AnySchema { + try(schemas: Schema[]): AlternativesSchema; + when(ref: string, options: WhenOptions): AlternativesSchema; + when(ref: Reference, options: WhenOptions): AlternativesSchema; +} + +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + +/** + * Generates a schema object that matches any data type. + */ +export function any(): Schema; + +/** + * Generates a schema object that matches an array data type. + */ +export function array(): ArraySchema; + +/** + * Generates a schema object that matches a boolean data type (as well as the strings 'true', 'false', 'yes', and 'no'). Can also be called via bool(). + */ +export function bool(): BooleanSchema; + +export function boolean(): BooleanSchema; + +/** + * Generates a schema object that matches a Buffer data type (as well as the strings which will be converted to Buffers). + */ +export function binary(): BinarySchema; + +/** + * Generates a schema object that matches a date type (as well as a JavaScript date string or number of milliseconds). + */ +export function date(): DateSchema; + +/** + * Generates a schema object that matches a function type. + */ +export function func(): FunctionSchema; + +/** + * Generates a schema object that matches a number data type (as well as strings that can be converted to numbers). + */ +export function number(): NumberSchema; + +/** + * Generates a schema object that matches an object data type (as well as JSON strings that parsed into objects). + */ +export function object(schema?: SchemaMap): ObjectSchema; + +/** + * Generates a schema object that matches a string data type. Note that empty strings are not allowed by default and must be enabled with allow(''). + */ +export function string(): StringSchema; + +/** + * Generates a type that will match one of the provided alternative schemas + */ +export function alternatives(types: Schema[]): Schema; +export function alternatives(type1: Schema, type2: Schema, ...types: Schema[]): Schema; + +/** + * Validates a value using the given schema and options. + */ +export function validate(value: T, schema: Schema, callback: (err: ValidationError, value: T) => void): void; +export function validate(value: T, schema: Object, callback: (err: ValidationError, value: T) => void): void; +export function validate(value: T, schema: Object, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): ValidationResult; + +/** + * Converts literal schema definition to joi schema object (or returns the same back if already a joi schema object). + */ +export function compile(schema: Object): Schema; + +/** + * Validates a value against a schema and throws if validation fails. + * + * @param value - the value to validate. + * @param schema - the schema object. + * @param message - optional message string prefix added in front of the error message. may also be an Error object. + */ +export function assert(value: any, schema: Schema, message?: string | Error): void; + +/** + * Generates a reference to the value of the named key. + */ +export function ref(key: string, options?: ReferenceOptions): Reference; diff --git a/types/joi/v6/joi-tests.ts b/types/joi/v6/joi-tests.ts index 33923b500a..d8c5a99ae2 100644 --- a/types/joi/v6/joi-tests.ts +++ b/types/joi/v6/joi-tests.ts @@ -2,48 +2,42 @@ import Joi = require('joi'); // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var x: any = null; -var value: any = null; -var num: number = 0; -var str: string = ''; -var bool: boolean = false; -var exp: RegExp = null; -var obj: Object = null; -var date: Date = null; -var err: Error = null; -var func: Function = null; +let x: any = null; +declare const value: any; +let num = 0; +let str = ''; +declare const bool: boolean; +declare const exp: RegExp; +declare const obj: Object; +declare const date: Date; +declare const err: Error; +declare const func: Function; -var anyArr: any[] = []; -var numArr: number[] = []; -var strArr: string[] = []; -var boolArr: boolean[] = []; -var expArr: RegExp[] = []; -var objArr: Object[] = []; -var errArr: Error[] = []; -var funcArr: Function[] = []; +declare const strArr: string[]; +declare const expArr: RegExp[]; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var schema: Joi.Schema = null; +let schema: Joi.Schema = null; -var anySchema: Joi.AnySchema = null; -var numSchema: Joi.NumberSchema = null; -var strSchema: Joi.StringSchema = null; -var arrSchema: Joi.ArraySchema = null; -var boolSchema: Joi.BooleanSchema = null; -var binSchema: Joi.BinarySchema = null; -var dateSchema: Joi.DateSchema = null; -var funcSchema: Joi.FunctionSchema = null; -var objSchema: Joi.ObjectSchema = null; -var altSchema: Joi.AlternativesSchema = null; +let anySchema: Joi.AnySchema = null; +let numSchema: Joi.NumberSchema = null; +let strSchema: Joi.StringSchema = null; +let arrSchema: Joi.ArraySchema = null; +let boolSchema: Joi.BooleanSchema = null; +let binSchema: Joi.BinarySchema = null; +let dateSchema: Joi.DateSchema = null; +let funcSchema: Joi.FunctionSchema = null; +let objSchema: Joi.ObjectSchema = null; +let altSchema: Joi.AlternativesSchema = null; -var schemaArr: Joi.Schema[] = []; +declare const schemaArr: Joi.Schema[]; -var ref: Joi.Reference = null; +let ref: Joi.Reference = null; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var validOpts: Joi.ValidationOptions = null; +let validOpts: Joi.ValidationOptions = null; validOpts = {abortEarly: bool}; validOpts = {convert: bool}; @@ -56,7 +50,7 @@ validOpts = {context: obj}; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var renOpts: Joi.RenameOptions = null; +let renOpts: Joi.RenameOptions = null; renOpts = {alias: bool}; renOpts = {multiple: bool}; @@ -65,7 +59,7 @@ renOpts = {ignoreUndefined: bool}; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var emailOpts: Joi.EmailOptions = null; +let emailOpts: Joi.EmailOptions = null; emailOpts = {errorLevel: num}; emailOpts = {errorLevel: bool}; @@ -75,7 +69,7 @@ emailOpts = {minDomainAtoms: num}; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var ipOpts: Joi.IpOptions = null; +let ipOpts: Joi.IpOptions = null; ipOpts = {version: str}; ipOpts = {version: strArr}; @@ -83,7 +77,7 @@ ipOpts = {cidr: str}; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var uriOpts: Joi.UriOptions = null; +let uriOpts: Joi.UriOptions = null; uriOpts = {scheme: str}; uriOpts = {scheme: exp}; @@ -92,7 +86,7 @@ uriOpts = {scheme: expArr}; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var whenOpts: Joi.WhenOptions = null; +let whenOpts: Joi.WhenOptions = null; whenOpts = {is: x}; whenOpts = {is: schema, then: schema}; @@ -100,17 +94,17 @@ whenOpts = {is: schema, otherwise: schema}; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var refOpts: Joi.ReferenceOptions = null; +let refOpts: Joi.ReferenceOptions = null; refOpts = {separator: str}; refOpts = {contextPrefix: str}; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var validErr: Joi.ValidationError = null; -var validErrItem: Joi.ValidationErrorItem; +declare const validErr: Joi.ValidationError; +let validErrItem: Joi.ValidationErrorItem; -validErrItem= { +validErrItem = { message: str, type: str, path: str @@ -149,7 +143,7 @@ anySchema = objSchema; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var schemaMap: Joi.SchemaMap = null; +let schemaMap: Joi.SchemaMap = null; schemaMap = { a: numSchema, @@ -160,7 +154,7 @@ schemaMap = { anySchema = Joi.any(); -namespace common { +{ // common anySchema = anySchema.allow(x); anySchema = anySchema.allow(x, x); anySchema = anySchema.allow([x, x, x]); @@ -235,10 +229,9 @@ arrSchema = arrSchema.items(numSchema); arrSchema = arrSchema.items(numSchema, strSchema); arrSchema = arrSchema.items([numSchema, strSchema]); - // - - - - - - - - -namespace common_copy_paste { +{ // common copy paste // use search & replace from any arrSchema = arrSchema.allow(x); arrSchema = arrSchema.allow(x, x); @@ -291,7 +284,7 @@ namespace common_copy_paste { boolSchema = Joi.bool(); boolSchema = Joi.boolean(); -namespace common_copy_paste { +{ // common copy paste boolSchema = boolSchema.allow(x); boolSchema = boolSchema.allow(x, x); boolSchema = boolSchema.allow([x, x, x]); @@ -347,7 +340,7 @@ binSchema = binSchema.min(num); binSchema = binSchema.max(num); binSchema = binSchema.length(num); -namespace common { +{ // common binSchema = binSchema.allow(x); binSchema = binSchema.allow(x, x); binSchema = binSchema.allow([x, x, x]); @@ -415,7 +408,7 @@ dateSchema = dateSchema.format(strArr); dateSchema = dateSchema.iso(); -namespace common { +{ // common dateSchema = dateSchema.allow(x); dateSchema = dateSchema.allow(x, x); dateSchema = dateSchema.allow([x, x, x]); @@ -484,7 +477,7 @@ numSchema = numSchema.multiple(num); numSchema = numSchema.positive(); numSchema = numSchema.negative(); -namespace common { +{ // common numSchema = numSchema.allow(x); numSchema = numSchema.allow(x, x); numSchema = numSchema.allow([x, x, x]); @@ -593,7 +586,7 @@ objSchema = objSchema.optionalKeys(str); objSchema = objSchema.optionalKeys(str, str); objSchema = objSchema.optionalKeys(strArr); -namespace common { +{ // common objSchema = objSchema.allow(x); objSchema = objSchema.allow(x, x); objSchema = objSchema.allow([x, x, x]); @@ -678,7 +671,7 @@ strSchema = strSchema.lowercase(); strSchema = strSchema.uppercase(); strSchema = strSchema.trim(); -namespace common { +{ // common strSchema = strSchema.allow(x); strSchema = strSchema.allow(x, x); strSchema = strSchema.allow([x, x, x]); diff --git a/types/joi/v6/tslint.json b/types/joi/v6/tslint.json index a41bf5d19a..0b8095b5e1 100644 --- a/types/joi/v6/tslint.json +++ b/types/joi/v6/tslint.json @@ -1,79 +1,12 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, + // All are TODOs "ban-types": false, "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "unified-signatures": false } } diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index 821e7ec162..b03a48dc6f 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -146,12 +146,24 @@ interface JQueryStatic { * Return a collection of matched elements either found in the DOM based on passed argument(s) or created * by passing an HTML string. * - * @param element_elementArray A DOM element to wrap in a jQuery object. - * An array containing a set of DOM elements to wrap in a jQuery object. + * @param element A DOM element to wrap in a jQuery object. * @see \`{@link https://api.jquery.com/jQuery/ }\` * @since 1.0 */ - (element_elementArray: T | ArrayLike): JQuery; + // Using a unified signature is not possible due to a TypeScript 2.4 bug (DefinitelyTyped#27810) + // tslint:disable-next-line:unified-signatures + (element: T): JQuery; + /** + * Return a collection of matched elements either found in the DOM based on passed argument(s) or created + * by passing an HTML string. + * + * @param elementArray An array containing a set of DOM elements to wrap in a jQuery object. + * @see \`{@link https://api.jquery.com/jQuery/ }\` + * @since 1.0 + */ + // Using a unified signature is not possible due to a TypeScript 2.4 bug (DefinitelyTyped#27810) + // tslint:disable-next-line:unified-signatures + (elementArray: T[]): JQuery; /** * Return a collection of matched elements either found in the DOM based on passed argument(s) or created * by passing an HTML string. diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index 309b1e2f89..417d2e7941 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -69,6 +69,12 @@ function JQueryStatic() { // $ExpectType JQuery $(); + // $ExpectType JQuery + $(new HTMLSelectElement()); + + // $ExpectType JQuery + $([new HTMLSelectElement()]); + // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/19597#issuecomment-378218432 function issue_19597_378218432() { const myDiv = $(document.createElement('div')); diff --git a/types/jsforce/connection.d.ts b/types/jsforce/connection.d.ts index fcf614eb92..e7fd593b01 100644 --- a/types/jsforce/connection.d.ts +++ b/types/jsforce/connection.d.ts @@ -10,8 +10,16 @@ import { Metadata } from './api/metadata'; import { Bulk } from './bulk'; import { Cache } from './cache' import { OAuth2, Streaming } from '.'; +import { HttpApiOptions } from './http-api' -export type Callback = (err: Error, result: T) => void; +export type Callback = (err: Error | null, result: T) => void; +// The type for these options was determined by looking at the usage +// of the options object in Connection.create and other methods +// go to http://jsforce.github.io/jsforce/doc/connection.js.html#line568 +// and search for options +export interface RestApiOptions { + headers?: { [x: string]: string } +} // These are pulled out because according to http://jsforce.github.io/jsforce/doc/connection.js.html#line49 // the oauth options can either be in the `oauth2` proeprty OR spread across the main connection @@ -93,24 +101,24 @@ export type ConnectionEvent = "refresh"; */ export abstract class BaseConnection extends EventEmitter { _baseUrl(): string; - request(info: RequestInfo | string, options?: Object, callback?: (err: Error, Object: object) => void): Promise; + request(info: RequestInfo | string, options?: HttpApiOptions, callback?: (err: Error, Object: object) => void): Promise; query(soql: string, options?: ExecuteOptions, callback?: (err: Error, result: QueryResult) => void): Query>; queryMore(locator: string, options?: ExecuteOptions, callback?: (err: Error, result: QueryResult) => void): Promise>; - create(type: string, records: Record | Array>, options?: Object, + create(type: string, records: Record | Array>, options?: RestApiOptions, callback?: (err: Error, result: RecordResult | RecordResult[]) => void): Promise<(RecordResult | RecordResult[])>; - insert(type: string, records: Record | Array>, options?: Object, + insert(type: string, records: Record | Array>, options?: RestApiOptions, callback?: (err: Error, result: RecordResult | RecordResult[]) => void): Promise<(RecordResult | RecordResult[])>; - retrieve(type: string, ids: string | string[], options?: Object, + retrieve(type: string, ids: string | string[], options?: RestApiOptions, callback?: (err: Error, result: Record | Array>) => void): Promise<(Record | Array>)>; - update(type: string, records: Record | Array>, options?: Object, + update(type: string, records: Record | Array>, options?: RestApiOptions, callback?: (err: Error, result: RecordResult | Array>) => void): Promise<(RecordResult | RecordResult[])>; - upsert(type: string, records: Record | Array>, extIdField: string, options?: Object, + upsert(type: string, records: Record | Array>, extIdField: string, options?: RestApiOptions, callback?: (err: Error, result: RecordResult | RecordResult[]) => void): Promise<(RecordResult | RecordResult[])>; - del(type: string, ids: string | string[], options?: Object, + del(type: string, ids: string | string[], options?: RestApiOptions, callback?: (err: Error, result: RecordResult | RecordResult[]) => void): Promise<(RecordResult | RecordResult[])>; - delete(type: string, ids: string | string[], options?: Object, + delete(type: string, ids: string | string[], options?: RestApiOptions, callback?: (err: Error, result: RecordResult | RecordResult[]) => void): Promise<(RecordResult | RecordResult[])>; - destroy(type: string, ids: string | string[], options?: Object, + destroy(type: string, ids: string | string[], options?: RestApiOptions, callback?: (err: Error, result: RecordResult | RecordResult[]) => void): Promise<(RecordResult | RecordResult[])>; describe$: { /** Returns a value from the cache if it exists, otherwise calls Connection.describe */ @@ -124,7 +132,8 @@ export abstract class BaseConnection extends EventEmitter { clear(): void; } describeGlobal(callback?: (err: Error, result: DescribeGlobalResult) => void): Promise; - sobject(resource: string): SObject; + // we want any object to be accepted if the user doesn't decide to give an explicit type + sobject(resource: string): SObject; } export class Connection extends BaseConnection { diff --git a/types/jsforce/describe-result.d.ts b/types/jsforce/describe-result.d.ts index 17da9f5917..f59df9ff59 100644 --- a/types/jsforce/describe-result.d.ts +++ b/types/jsforce/describe-result.d.ts @@ -70,7 +70,7 @@ export interface Field { caseSensitive: boolean; compoundFieldName?: maybe; controllerName?: maybe; - creatable: boolean; + createable: boolean; custom: boolean; defaultValue?: maybe; defaultValueFormula?: maybe; diff --git a/types/jsforce/http-api.d.ts b/types/jsforce/http-api.d.ts new file mode 100644 index 0000000000..1986ce0c75 --- /dev/null +++ b/types/jsforce/http-api.d.ts @@ -0,0 +1,5 @@ +export interface HttpApiOptions { + responseType?: string; + transport?: object; + noContentResponse?: object +} diff --git a/types/jsforce/index.d.ts b/types/jsforce/index.d.ts index ddcb0d8260..d92677a5eb 100644 --- a/types/jsforce/index.d.ts +++ b/types/jsforce/index.d.ts @@ -6,7 +6,7 @@ // Tim Noonan // Abraham White // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.3 export * from './api/analytics'; export * from './api/chatter'; diff --git a/types/jsforce/jsforce-tests.ts b/types/jsforce/jsforce-tests.ts index 8eb97aebc7..8e572448b4 100644 --- a/types/jsforce/jsforce-tests.ts +++ b/types/jsforce/jsforce-tests.ts @@ -4,12 +4,9 @@ import * as express from 'express'; import * as glob from 'glob'; import * as sf from 'jsforce'; - -export interface DummyRecord { - thing: boolean; - other: number; - person: string; -} +import { RecordReference, Record } from 'jsforce/record'; +import { SObject } from 'jsforce/salesforce-object'; +import { RecordResult } from 'jsforce/record-result'; const salesforceConnection: sf.Connection = new sf.Connection({ instanceUrl: '', @@ -20,7 +17,390 @@ const salesforceConnection: sf.Connection = new sf.Connection({ }, }); -salesforceConnection.sobject("Dummy").select(["thing", "other"]); +async function testSObject(connection: sf.Connection) { + interface DummyRecord { + thing: boolean; + other: number; + person: string; + } + + const dummySObject: SObject = connection.sobject('Dummy'); + + // currently untyped, but some future change may make this stricter + const restApiOptions = { + headers: { Bearer: 'I have no idea what this wants' } + }; + + { // Test SObject.record + // $ExpectType RecordReference + dummySObject.record('50130000000014C'); + } + + { // Test SObject.retrieve + // with single id + // $ExpectType Record + await dummySObject.retrieve('50130000000014C'); + // with single id and rest api options + // $ExpectType Record + await dummySObject.retrieve('50130000000014C', restApiOptions); + + // with single id and callback + dummySObject.retrieve('50130000000014C', restApiOptions, (err, res) => { + err; // $ExpectType Error | null + res; // $ExpectType Record + }); + + // with ids array + // $ExpectType Record[] + await dummySObject.retrieve(['IIIIDDD']); + // with ids array and rest api options + // $ExpectType Record[] + await dummySObject.retrieve(['IIIIDDD'], restApiOptions); + + // with ids array and callback + dummySObject.retrieve(['50130000000014C'], restApiOptions, (err, res) => { + err; // $ExpectType Error | null + res; // $ExpectType Record[] + }); + + salesforceConnection.sobject("ContentVersion").retrieve("world", { + test: "test" + }, (err, ret) => { + err; // $ExpectType Error | null + ret; // $ExpectType any + }); + } + + { // Test SObject.update + // if we require that records have an id field this will fail + // //$ExpectError + await dummySObject.update({ thing: false }); + + // If we require that the records have an Id field + // await dummySObject.update({ thing: false, Id: 'asdf' }); // $ExpectType RecordResult + + // invalid field + // $ExpectError + await dummySObject.update({ asdf: false }); + + // with rest api options + // $ExpectType RecordResult + await dummySObject.update({ thing: false }, restApiOptions); + + // with callback + dummySObject.update({ thing: false }, (err, res) => { + err; // $ExpectType Error | null + res; // $ExpectType RecordResult + }); + + dummySObject.update({ thing: false }, restApiOptions, (err, res) => { + err; // $ExpectType Error | null + res; // $ExpectType RecordResult + }); + + // with multiple records + // $ExpectType RecordResult[] + await dummySObject.update([{ thing: false }]); + + // with multiple records and api options + // $ExpectType RecordResult[] + await dummySObject.update([{ thing: false }], restApiOptions); + + // with multiple records and callback + dummySObject.update([{ thing: false }], restApiOptions, (err, res) => { + err; // $ExpectType Error | null + res; // $ExpectType RecordResult[] + }); + + dummySObject.update([{ thing: false }], (err, res) => { + err; // $ExpectType Error | null + res; // $ExpectType RecordResult[] + }); + } + + { // Test SObject.updated + // $ExpectType UpdatedRecordsInfo + await dummySObject.updated(new Date(), new Date()); + + // $ExpectType UpdatedRecordsInfo + await dummySObject.updated(new Date(), 'hi'); + + // $ExpectType UpdatedRecordsInfo + await dummySObject.updated('hi', new Date()); + + // $ExpectType UpdatedRecordsInfo + await dummySObject.updated('hi', 'hi'); + + dummySObject.updated(new Date(), 'hi', (err, ret) => { + err; // $ExpectType Error | null + ret; // $ExpectType UpdatedRecordsInfo + }); + } + + { // Test SObject.upsert + const updateData = { + Id: 'Some ID', + thing: true, + other: 1, + person: 'hi' + }; + // $ExpectType RecordResult + await dummySObject.upsert(updateData, 'Id'); + + // $ExpectType RecordResult + await dummySObject.upsert(updateData, 'Id', restApiOptions); + + // $ExpectType RecordResult[] + await dummySObject.upsert([updateData], 'Id'); + + // $ExpectType RecordResult[] + await dummySObject.upsert([updateData], 'Id', restApiOptions); + + dummySObject.upsert(updateData, 'Id', (err, ret) => { + err; // $ExpectType Error | null + ret; // $ExpectType RecordResult + }); + + dummySObject.upsert(updateData, 'Id', restApiOptions, (err, ret) => { + err; // $ExpectType Error | null + ret; // $ExpectType RecordResult + }); + + dummySObject.upsert([updateData], 'Id', (err, ret) => { + err; // $ExpectType Error | null + ret; // $ExpectType RecordResult[] + }); + + dummySObject.upsert([updateData], 'Id', restApiOptions, (err, ret) => { + err; // $ExpectType Error | null + ret; // $ExpectType RecordResult[] + }); + } + + { // Test SObject.find + } + + { // Test SObject.findOne + salesforceConnection.sobject("ContentVersion").findOne({ Id: '' }, (err, contentVersion) => { + err; // $ExpectType Error | null + contentVersion; // $ExpectType any + }); + } + + { // Test SObject.select + + dummySObject.select(["thing", "other"]); + + // note the following should never compile: + // $ExpectError + dummySObject.select(["lol"]); + } + + { // Test SObject.create + // $ExpectType RecordResult + await dummySObject.create({ + thing: true, + other: 1, + person: 'hi' + }); + + // $ExpectType RecordResult + await dummySObject.create({ + thing: true, + other: 1, + person: 'hi' + }, restApiOptions); + + // $ExpectType RecordResult[] + await dummySObject.create([{ + thing: true, + other: 1, + person: 'hi' + }]); + + // $ExpectType RecordResult[] + await dummySObject.create([{ + thing: true, + other: 1, + person: 'hi' + }], restApiOptions); + + dummySObject.create([{ + thing: true, + other: 1, + person: 'hi' + }], (err, ret) => { + err; // $ExpectType Error | null + ret; // $ExpectType RecordResult[] + }); + + dummySObject.create([{ + thing: true, + other: 1, + person: 'hi' + }], restApiOptions, (err, ret) => { + err; // $ExpectType Error | null + ret; // $ExpectType RecordResult[] + }); + + salesforceConnection.sobject("Account").create({ + Name: "Test Acc 2", + BillingStreet: "Maplestory street", + BillingPostalCode: "ME4 666" + }, (err, ret) => { + err; // $ExpectType Error | null + ret; // $ExpectType RecordResult + }); + + // callback and rest api options + salesforceConnection.sobject("ContentVersion").create({ + OwnerId: '', + Title: 'hello', + PathOnClient: './hello-world.jpg', + VersionData: '{ Test: Data }' + }, restApiOptions, (err, ret) => { + err; // $ExpectType Error | null + ret; // $ExpectType RecordResult + }); + + salesforceConnection.sobject("ContentDocumentLink").create({ + ContentDocumentId: '', + LinkedEntityId: '', + ShareType: "I" + }, (err, ret) => { + err; // $ExpectType Error | null + ret; // $ExpectType RecordResult + }); + } + + { // Test SObject.createBulk + // $ExpectType Batch + dummySObject.createBulk(); + // $ExpectType Batch + dummySObject.createBulk('hi.csv'); + // $ExpectType Batch + dummySObject.createBulk([{ Id: 'hi', thing: true, other: 1, person: 'you' }]); + // $ExpectType Batch + dummySObject.createBulk([{ Id: 'hi', thing: true, other: 1, person: 'you' }], (err, res) => { + err; // $ExpectType Error | null + res; // $ExpectType RecordResult[] + }); + dummySObject.createBulk('hi.csv', (err, res) => { + err; // $ExpectType Error | null + res; // $ExpectType RecordResult[] + }); + } + + { // Test SObject.deleteBulk and aliases + // $ExpectType Batch + dummySObject.deleteBulk(); + // $ExpectType Batch + dummySObject.deleteBulk('hi.csv'); + // $ExpectType Batch + dummySObject.deleteBulk([{ Id: 'hi', thing: true, other: 1, person: 'you' }]); + // $ExpectType Batch + dummySObject.deleteBulk([{ Id: 'hi', thing: true, other: 1, person: 'you' }], (err, res) => { + err; // $ExpectType Error | null + res; // $ExpectType RecordResult[] + }); + dummySObject.deleteBulk('hi.csv', (err, res) => { + err; // $ExpectType Error | null + res; // $ExpectType RecordResult[] + }); + + // $ExpectType Batch + dummySObject.destroyBulk(); + // $ExpectType Batch + dummySObject.destroyBulk('hi.csv'); + // $ExpectType Batch + dummySObject.destroyBulk([{ Id: 'hi', thing: true, other: 1, person: 'you' }]); + // $ExpectType Batch + dummySObject.destroyBulk([{ Id: 'hi', thing: true, other: 1, person: 'you' }], (err, res) => { + err; // $ExpectType Error | null + res; // $ExpectType RecordResult[] + }); + dummySObject.destroyBulk('hi.csv', (err, res) => { + err; // $ExpectType Error | null + res; // $ExpectType RecordResult[] + }); + } + + { // Test SObject.deleteHardBulk and aliases + // $ExpectType Batch + dummySObject.deleteHardBulk(); + // $ExpectType Batch + dummySObject.deleteHardBulk('hi.csv'); + // $ExpectType Batch + dummySObject.deleteHardBulk([{ Id: 'hi', thing: true, other: 1, person: 'you' }]); + // $ExpectType Batch + dummySObject.deleteHardBulk([{ Id: 'hi', thing: true, other: 1, person: 'you' }], (err, res) => { + err; // $ExpectType Error | null + res; // $ExpectType RecordResult[] + }); + dummySObject.deleteHardBulk('hi.csv', (err, res) => { + err; // $ExpectType Error | null + res; // $ExpectType RecordResult[] + }); + + // $ExpectType Batch + dummySObject.destroyHardBulk(); + // $ExpectType Batch + dummySObject.destroyHardBulk('hi.csv'); + // $ExpectType Batch + dummySObject.destroyHardBulk([{ Id: 'hi', thing: true, other: 1, person: 'you' }]); + // $ExpectType Batch + dummySObject.destroyHardBulk([{ Id: 'hi', thing: true, other: 1, person: 'you' }], (err, res) => { + err; // $ExpectType Error | null + res; // $ExpectType RecordResult[] + }); + dummySObject.destroyHardBulk('hi.csv', (err, res) => { + err; // $ExpectType Error | null + res; // $ExpectType RecordResult[] + }); + } + + { // Test SObject.destroy and aliases + // $ExpectType RecordResult + await dummySObject.del('Id'); + // $ExpectType RecordResult + await dummySObject.destroy('Id'); + // $ExpectType RecordResult + await dummySObject.delete('Id'); + + // $ExpectType RecordResult[] + await dummySObject.del(['Id']); + // $ExpectType RecordResult[] + await dummySObject.destroy(['Id']); + // $ExpectType RecordResult[] + await dummySObject.delete(['Id']); + + dummySObject.del('Id', (err, ret) => { + err; // $ExpectType Error | null + ret; // $ExpectType RecordResult + }); + dummySObject.destroy('Id', (err, ret) => { + err; // $ExpectType Error | null + ret; // $ExpectType RecordResult + }); + dummySObject.delete('Id', (err, ret) => { + err; // $ExpectType Error | null + ret; // $ExpectType RecordResult + }); + + dummySObject.del(['Id'], (err, ret) => { + err; // $ExpectType Error | null + ret; // $ExpectType RecordResult[] + }); + dummySObject.destroy(['Id'], (err, ret) => { + err; // $ExpectType Error | null + ret; // $ExpectType RecordResult[] + }); + dummySObject.delete(['Id'], (err, ret) => { + err; // $ExpectType Error | null + ret; // $ExpectType RecordResult[] + }); + } +} const requestInfo: sf.RequestInfo = { body: '', @@ -38,51 +418,6 @@ const queryOptions: sf.ExecuteOptions = { }; salesforceConnection.query('SELECT Id, Name FROM Account', queryOptions); -// note the following should never compile: -// salesforceConnection.sobject("Dummy").select(["lol"]); - -salesforceConnection.sobject("Account").create({ - Name: "Test Acc 2", - BillingStreet: "Maplestory street", - BillingPostalCode: "ME4 666" -}, (err: Error, ret: sf.RecordResult | sf.RecordResult[]) => { - if (err || !Array.isArray(ret) && !ret.success) { - return; - } -}); - -salesforceConnection.sobject("ContentVersion").create({ - OwnerId: '', - Title: 'hello', - PathOnClient: './hello-world.jpg', - VersionData: '{ Test: Data }' -}, (err: Error, ret: sf.RecordResult | sf.RecordResult[]) => { - if (err || !Array.isArray(ret) && !ret.success) { - return; - } -}); - -salesforceConnection.sobject("ContentVersion").retrieve("world", { - test: "test" -}, (err: Error, ret) => { - if (err) { - return; - } -}); - -salesforceConnection.sobject("ContentVersion").findOne({ Id: '' }, (err, contentVersion) => { -}); - -salesforceConnection.sobject("ContentDocumentLink").create({ - ContentDocumentId: '', - LinkedEntityId: '', - ShareType: "I" -}, (err: Error, ret: sf.RecordResult | sf.RecordResult[]) => { - if (err || !Array.isArray(ret) && !ret.success) { - return; - } -}); - sf.Date.YESTERDAY; salesforceConnection.sobject('Coverage__c') @@ -230,7 +565,7 @@ async function testChatter(conn: sf.Connection): Promise { }, feedElementType: 'FeedItem', subjectId: 'me' - }, (err: Error, result: any) => { + }, (err: Error | null, result: any) => { if (err) { throw err; } @@ -242,7 +577,7 @@ async function testChatter(conn: sf.Connection): Promise { text: 'This is new comment on the post' }] } - }, (err: Error, result: any) => { + }, (err: Error | null, result: any) => { if (err) { throw err; } @@ -366,13 +701,15 @@ async function testDescribe() { object.fields.forEach(field => { const type: sf.FieldType = field.type; // following should never compile - // const fail = type === 'hey' + // $ExpectError + const fail = type === 'hey'; const isString = type === 'string'; }); // following should never compile (if StrictNullChecks is on) - // object.keyPrefix.length; + // $ExpectError + object.keyPrefix.length; console.log(`${sobject.name} Label: `, object.label); diff --git a/types/jsforce/quick-action.d.ts b/types/jsforce/quick-action.d.ts new file mode 100644 index 0000000000..a67f4d4e08 --- /dev/null +++ b/types/jsforce/quick-action.d.ts @@ -0,0 +1,52 @@ +import { Callback } from './connection'; +import { Record } from './record'; + +export class QuickAction { + /** + * Retrieve default field values in the action for the given record + * @param contextId Id of record + * @param callback Callback function + */ + defaultValues(contextId: string, callback?: Callback): Promise; + /** Retrieve default field values in the action */ + defaultValues(callback?: Callback): Promise; + /** + * Describe the action's information (including layout, etc.) + * @param callback Callback function + */ + describe(callback?: Callback): Promise; + /** + * Execute the action for given context id and record information + * @param contextId Context record ID of the action + * @param record Input record information for the action + * @param callback Callback function + */ + execute(contextId: string, record: Record, callback?: Callback): Promise; +} + +// TODO: figure out the actual shape of this. the docs don't have it +export type QuickActionResult = object; + +export interface QuickActionInfo { + /** Type of the action (e.g. Create, Update, Post, LogACall) */ + type: string; + /** Name of the action */ + name: string; + /** Label of the action */ + label: string; + /** Endpoint URL information of the action */ + urls: object; +} + +export interface QuickActionDescribeInfo { + /** Object type used for the action */ + contextSobjectType: string; + /** Object type of the action to target */ + targetSobjectType: string; + /** Field name in the target object which refers parent(context) object record ID */ + targetParentField: string; + /** Record type of the targeted record */ + targetRecordTypeId: string; + /** Layout sections that comprise an action */ + layout: object; +} diff --git a/types/jsforce/salesforce-id.d.ts b/types/jsforce/salesforce-id.d.ts index 87d086880f..5e79506ed6 100644 --- a/types/jsforce/salesforce-id.d.ts +++ b/types/jsforce/salesforce-id.d.ts @@ -1,2 +1 @@ -export class SalesforceId extends String { -} +export type SalesforceId = string diff --git a/types/jsforce/salesforce-object.d.ts b/types/jsforce/salesforce-object.d.ts index ab3e398891..a2f1c5dffd 100644 --- a/types/jsforce/salesforce-object.d.ts +++ b/types/jsforce/salesforce-object.d.ts @@ -5,74 +5,103 @@ import { DescribeSObjectResult } from './describe-result'; import { Query } from './query'; import { Record, RecordReference } from './record'; import { RecordResult } from './record-result'; -import { Connection } from './connection'; +import { Connection, RestApiOptions, Callback } from './connection'; import { SalesforceId } from './salesforce-id'; import { Batch, BatchResultInfo } from './batch'; +import { QuickAction, QuickActionInfo } from './quick-action'; export class SObject { record(id: SalesforceId): RecordReference; - retrieve(id: SalesforceId, options?: Object, callback?: (err: Error, record: Record) => void): Promise>; - retrieve(ids: SalesforceId[], options?: Object, callback?: (err: Error, ret: Array>) => void): Promise>>; - update(record: Partial, options?: Object, callback?: (err: Error, ret: RecordResult) => void): Promise; - update(records: Array>, options?: Object, callback?: (err: Error, ret: RecordResult[]) => void): Promise; - upsert(records: Record, extIdField: SalesforceId, options?: Object, callback?: (err: Error, ret: RecordResult) => void): Promise; - upsert(records: Array>, extIdField: SalesforceId, options?: Object, callback?: (err: Error, ret: RecordResult[]) => void): Promise; - upsertBulk(input?: Array> | stream.Stream | string, callback?: (err: Error, ret: RecordResult[] | BatchResultInfo[]) => void): Batch; + retrieve(id: SalesforceId, callback?: Callback>): Promise>; + retrieve(id: SalesforceId, options?: object, callback?: Callback>): Promise>; + retrieve(ids: SalesforceId[], callback?: Callback>>): Promise>>; + retrieve(ids: SalesforceId[], options?: object, callback?: Callback>>): Promise>>; + // Should update require that the record Id field be provided? + update(record: Partial, callback?: Callback): Promise; + update(record: Partial, options?: RestApiOptions, callback?: Callback): Promise; + update(records: Array>, callback?: Callback): Promise; + update(records: Array>, options?: RestApiOptions, callback?: Callback): Promise; + // should input really be optional? the documentation says so, but how can you actually update without it? + updateBulk(input?: Record[] | stream.Stream | string, callback?: Callback): Batch; + updated(start: string | Date, end: string | Date, callback?: Callback): Promise; + upsert(records: Record, extIdField: string, callback?: Callback): Promise; + upsert(records: Record, extIdField: string, options?: RestApiOptions, callback?: Callback): Promise; + upsert(records: Array>, extIdField: string, callback?: Callback): Promise; + upsert(records: Array>, extIdField: string, options?: RestApiOptions, callback?: Callback): Promise; + upsertBulk(input?: Array> | stream.Stream | string, callback?: Callback): Batch; - find(query?: any, callback?: (err: Error, ret: T[]) => void): Query; - find(query?: any, fields?: Object | string[] | string, callback?: (err: Error, ret: T[]) => void): Query; - find(query?: any, fields?: Object | string[] | string, options?: Object, callback?: (err: Error, ret: T[]) => void): Query; + find(query?: object | string, callback?: Callback>>): Query>>; + find(query?: object | string, fields?: Object | string[] | string, callback?: Callback>>): Query>>; + find(query?: object | string, fields?: Object | string[] | string, options?: FindOptions, callback?: Callback>>): Query>>; - findOne(query?: any, callback?: (err: Error, ret: T) => void): Query; - findOne(query?: any, fields?: Object | string[] | string, callback?: (err: Error, ret: T) => void): Query; - findOne(query?: any, fields?: Object | string[] | string, options?: Object, callback?: (err: Error, ret: T) => void): Query; + findOne(query?: object | string, callback?: Callback>): Query>; + findOne(query?: object | string, fields?: Object | string[] | string, callback?: Callback>): Query>; + findOne(query?: object | string, fields?: Object | string[] | string, options?: FindOptions, callback?: Callback>): Query>; approvalLayouts$: { /** Returns a value from the cache if it exists, otherwise calls SObject.approvalLayouts */ - (callback?: (layoutInfo: ApprovalLayoutInfo) => void): ApprovalLayoutInfo; + (callback?: Callback): ApprovalLayoutInfo; clear(): void; } - approvalLayouts(callback?: (layoutInfo: ApprovalLayoutInfo) => void): Promise; - bulkload(operation: string, options?: { extIdField?: string }, input?: Array> | stream.Stream[] | string[], callback?: (err: Error, ret: RecordResult) => void): Batch; + approvalLayouts(callback?: Callback): Promise; + bulkload(operation: string, options?: { extIdField?: string }, input?: Array> | stream.Stream | string, callback?: Callback): Batch; compactLayouts$: { /** Returns a value from the cache if it exists, otherwise calls SObject.compactLayouts */ - (callback?: CompactLayoutInfo): CompactLayoutInfo; + (callback?: Callback): CompactLayoutInfo; clear(): void; } - compactLayouts(callback?: CompactLayoutInfo): Promise; - count(conditions?: Object | string, callback?: (err: Error, num: number) => void): Promise; - create(options: any | any[], callback?: (err: Error, ret: RecordResult | RecordResult[]) => void): Promise; - createBulk(input?: Array> | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; - del(ids: string | string[], callback?: (err: Error, ret: any) => void): void; - destroy(ids: string | string[], callback?: (err: Error, ret: any) => void): void; - delete(ids: string | string[], callback?: (err: Error, ret: any) => void): void; - deleteBulk(input?: Array> | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; - destroyBulk(input?: Array> | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; - destroyHardBulk(input?: Array> | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; - deleted(start: Date | string, end: Date | string, callback?: (info: DeletedRecordsInfo) => void): Promise; - deleteHardBulk(input?: Array> | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; - describe(callback?: (err: Error, ret: DescribeSObjectResult) => void): Promise; + compactLayouts(callback?: Callback): Promise; + count(conditions?: object | string, callback?: Callback): Query; + create(record: T, options?: RestApiOptions, callback?: Callback): Promise; + create(record: T, callback?: Callback): Promise; + create(record: Array, options?: RestApiOptions, callback?: Callback): Promise; + create(record: Array, callback?: Callback): Promise; + createBulk(input?: Array> | stream.Stream | string, callback?: Callback): Batch; + del(id: string, callback?: Callback): Promise; + del(ids: string[], callback?: Callback): Promise; + destroy(id: string, callback?: Callback): Promise; + destroy(ids: string[], callback?: Callback): Promise; + delete(id: string, callback?: Callback): Promise; + delete(ids: string[], callback?: Callback): Promise; + deleteBulk(input?: Array> | stream.Stream | string, callback?: Callback): Batch; + destroyBulk(input?: Array> | stream.Stream | string, callback?: Callback): Batch; + destroyHardBulk(input?: Array> | stream.Stream | string, callback?: Callback): Batch; + deleted(start: Date | string, end: Date | string, callback?: Callback): Promise; + deleteHardBulk(input?: Array> | stream.Stream | string, callback?: Callback): Batch; + describe(callback?: Callback): Promise; describe$: { /** Returns a value from the cache if it exists, otherwise calls SObject.describe */ - (callback?: (err: Error, ret: DescribeSObjectResult) => void): DescribeSObjectResult; + (callback?: Callback): DescribeSObjectResult; clear(): void; } - insert(options: any | any[], callback?: (err: Error, ret: RecordResult | RecordResult[]) => void): Promise; - insertBulk(input?: Array> | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; + insert(record: Record, callback?: Callback): Promise; + insert(records: Array>, callback?: Callback): Promise; + insertBulk(input?: Array> | stream.Stream | string, callback?: Callback): Batch; /** Returns a value from the cache if it exists, otherwise calls SObject.layouts */ layouts$: { - (layoutName?: string, callback?: (err: Error, info: LayoutInfo) => void): LayoutInfo; + (layoutName?: string, callback?: Callback): LayoutInfo; clear(): void; } - layouts(layoutName?: string, callback?: (err: Error, info: LayoutInfo) => void): Promise; + layouts(layoutName?: string, callback?: Callback): Promise; listview(id: string): ListView; - listviews(callback?: (err: Error, info: ListViewsInfo) => void): Promise; + listviews(callback?: Callback): Promise; quickAction(actionName: string): QuickAction; - quickActions(callback?: (err: Error, info: any) => void): Promise; - recent(callback?: (err: Error, ret: RecordResult) => void): Promise; - select(callback?: (err: Error, ret: T[]) => void): Query; + quickActions(callback?: Callback): Promise; + recent(callback?: Callback): Promise; + select(callback?: Callback): Query; // TODO:use a typed pluck to turn `fields` into a subset of T's fields so that the output is slimmed down appropriately - select(fields?: {[P in keyof T]: boolean} | Array<(keyof T)> | (keyof T), callback?: (err: Error, ret: Array>) => void): Query>>; + select(fields?: {[P in keyof T]: boolean} | Array<(keyof T)> | (keyof T), callback?: Callback>>): Query>>; +} + +export interface FindOptions { + limit?: number; + offset?: number; + skip?: number; +} + +export interface UpdatedRecordsInfo { + latestDateCovered: string; + ids: string[]; } export interface ApprovalLayoutInfo { @@ -104,4 +133,5 @@ export class ListView { } export class ListViewsInfo { } -export class QuickAction { } +// TODO: Remove this export +export { QuickAction } // for compatibility if anyone had imported it from this file diff --git a/types/json5/index.d.ts b/types/json5/index.d.ts index a8fc723b60..9c0cb6cde6 100644 --- a/types/json5/index.d.ts +++ b/types/json5/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for JSON5 // Project: http://json5.org/ // Definitions by: Jason Swearingen +// Kacper Wiszczuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -40,5 +41,18 @@ Comments Both inline (single-line) and block (multi-line) comments are allowed. */ -declare var json5: JSON; + +type JSONReplacer = (key: string, value: any) => any | (number | string)[] | null; + +interface JSON5 { + // Old JSON methods + parse(text: string, reviver?: (key: any, value: any) => any): any; + stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; + stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; + + // New JSON5 stringify function + stringify(value: any, options?: { space?: number | string, quote?: string, replacer?: JSONReplacer }): string; +} + +declare var json5: JSON5; export = json5; diff --git a/types/json5/json5-tests.ts b/types/json5/json5-tests.ts index f1be5b1038..94820866f8 100644 --- a/types/json5/json5-tests.ts +++ b/types/json5/json5-tests.ts @@ -1,7 +1,21 @@ import JSON5 = require('json5'); -var obj = JSON5.parse("{ key:'val', 'key2':[0,1,2,] } //comment "); -var str = JSON5.stringify(obj, null, "\t"); -console.log(str); +const STR = "{ key:'val', 'key2':[0,1,2,] } //comment "; +const OBJ = { key: 'value', key2: [0, 1, 2] }; +function reviverFunction(key: any, value: any): any { + return { [key]: value }; +} + +function replacerFunction(key: string, value: any) { + return { [key]: value }; +} + +const str1: string = JSON5.stringify(OBJ); +const str2: string = JSON5.stringify(OBJ, null, 4); +const str3: string = JSON5.stringify(OBJ, undefined, '2'); +const str4: string = JSON5.stringify(OBJ, replacerFunction, 2); + +JSON.parse(STR); +JSON.parse(STR, reviverFunction); diff --git a/types/jui-core/index.d.ts b/types/jui-core/index.d.ts index 5a607f5721..5bc39848d0 100644 --- a/types/jui-core/index.d.ts +++ b/types/jui-core/index.d.ts @@ -53,7 +53,7 @@ export interface UtilBase { /** * use QuickSort */ - sort(array: any[]): UtilQuickSort; + sort(array: any[]): (array: number[], isClone: boolean) => this; /** * caculate callback runtime @@ -577,5 +577,3 @@ export interface UtilScaleOrdinal extends Function { rangeBands(interval: number, padding?: number, outerPadding?: number): () => void; invert(x: number): number; } - -export type UtilQuickSort = (array: number[], isClone: boolean) => this; diff --git a/types/jws/index.d.ts b/types/jws/index.d.ts index f384fadefc..fdbf1851c4 100644 --- a/types/jws/index.d.ts +++ b/types/jws/index.d.ts @@ -149,4 +149,5 @@ export type Algorithm = 'HS256' | 'HS384' | 'HS512' | 'RS256' | export interface Header { alg: Algorithm; + [name: string]: string; } diff --git a/types/jws/jws-tests.ts b/types/jws/jws-tests.ts index d5271b24ca..c6e62378f8 100644 --- a/types/jws/jws-tests.ts +++ b/types/jws/jws-tests.ts @@ -20,6 +20,13 @@ const signature = jws.sign({ secret: 'has a van', }); +// jws.sign with extra header values +const signatureWithHeaderParams = jws.sign({ + header: { alg: 'HS256', foo: 'bar' }, + payload: 'h. jon benjamin', + secret: 'has a van', +}); + // jws.decode const message = jws.decode('djfakdid'); diff --git a/types/kendo-ui/index.d.ts b/types/kendo-ui/index.d.ts index d9df1942c3..c1d114aaee 100644 --- a/types/kendo-ui/index.d.ts +++ b/types/kendo-ui/index.d.ts @@ -20300,16 +20300,19 @@ interface JQueryPromise { interface JQuery { + data(key: any): any; + kendoDraggable(): JQuery; kendoDraggable(options: kendo.ui.DraggableOptions): JQuery; + data(key: "kendoDraggable"): kendo.ui.Draggable; kendoDropTarget(): JQuery; kendoDropTarget(options: kendo.ui.DropTargetOptions): JQuery; + data(key: "kendoDropTarget"): kendo.ui.DropTarget; kendoDropTargetArea(): JQuery; kendoDropTargetArea(options: kendo.ui.DropTargetAreaOptions): JQuery; - - data(key: any): any; + data(key: "kendoDropTargetArea"): kendo.ui.DropTargetArea; kendoAlert(): JQuery; kendoAlert(options: kendo.ui.AlertOptions): JQuery; diff --git a/types/knex/index.d.ts b/types/knex/index.d.ts index c1fb224fa0..54dece1068 100644 --- a/types/knex/index.d.ts +++ b/types/knex/index.d.ts @@ -536,6 +536,7 @@ declare namespace Knex { acquireConnectionTimeout?: number; useNullAsDefault?: boolean; searchPath?: string | string[]; + asyncStackTraces?: boolean; } interface ConnectionConfig { diff --git a/types/koa-redis-cache/index.d.ts b/types/koa-redis-cache/index.d.ts new file mode 100644 index 0000000000..58f7f120ca --- /dev/null +++ b/types/koa-redis-cache/index.d.ts @@ -0,0 +1,94 @@ +// Type definitions for koa-redis-cache 3.0 +// Project: https://github.com/coderhaoxin/koa-redis-cache +// Definitions by: Dima Mukhin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as Koa from "koa"; +import * as Redis from "redis"; + +type onErrorCallback = (error: Error) => void; + +type getPrefixCallback = (ctx: Koa.Context) => string; + +declare namespace cache { + interface CacheOptions { + /** + * redis key prefix, default is koa-redis-cache: + * If a function is supplied, its signature should be function(ctx) {} and it should return a string to use as the redis key prefix + */ + prefix?: string | getPrefixCallback; + + /** + * redis expire time (second), default is 30 * 60 (30 min) + */ + expire?: number; + + /** + * if the passParam exists in the query string, skip the cache + */ + passParam?: string; + + /** + * max length of body size (in bytes) to cache. + * if the size of the body exceeds maxLength, the body will not be cached. + * default is: Infinity + */ + maxLength?: number; + + /** + * the routes to cache, default is ['(.*)']. + * can be set to an array of routes (string), or an array of RouteOptions + */ + routes?: RouteOptions[] | string[]; + + /** + * the routes to exclude, default is []. + * example: ['/api/(.*)', '/view/:id'] + */ + exclude?: string[]; + + /** + * callback function for error, default is function() {} + */ + onerror?: onErrorCallback; + + /** + * redis options + */ + redis?: RedisOptions; + } + + interface RouteOptions { + /** + * the route to cache, example: '/api/(.*)' + */ + route: string; + + /** + * expiration time in seconds for cached responses for the route + */ + expire?: number; + } + + interface RedisOptions { + /** + * host name of the redis server, default: 'localhost' + */ + host?: string; + + /** + * port number of the redis server, default: 6379 + */ + port?: number; + + /** + * node_redis options + */ + options?: Redis.ClientOpts; + } +} + +declare function cache(opts?: cache.CacheOptions): Koa.Middleware; + +export = cache; diff --git a/types/koa-redis-cache/koa-redis-cache-tests.ts b/types/koa-redis-cache/koa-redis-cache-tests.ts new file mode 100644 index 0000000000..b83d0b3aea --- /dev/null +++ b/types/koa-redis-cache/koa-redis-cache-tests.ts @@ -0,0 +1,34 @@ +import * as Koa from "koa"; +import * as cache from 'koa-redis-cache'; + +const app = new Koa(); + +const routeOptions: cache.RouteOptions[] = [ + { + route: '/api/test', + expire: 60 + }, + { + route: '/api/users' + } +]; + +const redisOptions: cache.RedisOptions = { + port: 6379, + host: 'localhost' +}; + +const options: cache.CacheOptions = { + prefix: (ctx: Koa.Context) => 'koa-redis-cache:', + expire: 30 * 30, + passParam: 'skip', + maxLength: 1024, + routes: routeOptions, + exclude: ['/api/(.*)', '/view/:id'], + onerror: (error: Error) => console.log(error), + redis: redisOptions +}; + +app.use(cache(options)); + +app.listen(80); diff --git a/types/koa-redis-cache/tsconfig.json b/types/koa-redis-cache/tsconfig.json new file mode 100644 index 0000000000..897679810e --- /dev/null +++ b/types/koa-redis-cache/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", + "koa-redis-cache-tests.ts" + ] +} \ No newline at end of file diff --git a/types/koa-redis-cache/tslint.json b/types/koa-redis-cache/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/koa-redis-cache/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index d85af4fd5a..78ce94cb56 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -6,6 +6,9 @@ /// +export = mapboxgl; +export as namespace mapboxgl; + declare namespace mapboxgl { let accessToken: string; let version: string; @@ -1286,11 +1289,3 @@ declare namespace mapboxgl { 'hillshade-accent-color-transition'?: Transition; } } - -declare module 'mapbox-gl' { - export = mapboxgl; -} - -declare module 'mapbox-gl/dist/mapbox-gl' { - export = mapboxgl; -} diff --git a/types/marked/index.d.ts b/types/marked/index.d.ts index 034c0cca18..c99f38aa6c 100644 --- a/types/marked/index.d.ts +++ b/types/marked/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for Marked 0.4 -// Project: https://github.com/chjj/marked +// Project: https://github.com/markedjs/marked // Definitions by: William Orr // BendingBender // CrossR diff --git a/types/moment-duration-format/index.d.ts b/types/moment-duration-format/index.d.ts index 1716d55d83..760b7b8263 100644 --- a/types/moment-duration-format/index.d.ts +++ b/types/moment-duration-format/index.d.ts @@ -90,3 +90,7 @@ declare module "moment" { type TemplateFunction = ((this: DurationFormatSettings) => string); } + +declare function momentDurationFormatSetup(_moment: typeof moment): void; + +export = momentDurationFormatSetup; diff --git a/types/moment-duration-format/test/module-tests.ts b/types/moment-duration-format/test/module-tests.ts new file mode 100644 index 0000000000..9178e9c414 --- /dev/null +++ b/types/moment-duration-format/test/module-tests.ts @@ -0,0 +1,4 @@ +import moment = require("moment"); +import momentDurationFormatSetup = require("moment-duration-format"); + +momentDurationFormatSetup(moment); diff --git a/types/moment-duration-format/tsconfig.json b/types/moment-duration-format/tsconfig.json index 997b0f907e..b41c97ed28 100644 --- a/types/moment-duration-format/tsconfig.json +++ b/types/moment-duration-format/tsconfig.json @@ -18,6 +18,7 @@ }, "files": [ "index.d.ts", - "moment-duration-format-tests.ts" + "moment-duration-format-tests.ts", + "test/module-tests.ts" ] } \ No newline at end of file diff --git a/types/moment-timezone/index.d.ts b/types/moment-timezone/index.d.ts index 395ab77c82..1d05b96f36 100644 --- a/types/moment-timezone/index.d.ts +++ b/types/moment-timezone/index.d.ts @@ -36,7 +36,7 @@ declare module "moment" { (date: moment.Moment, timezone: string): moment.Moment; (date: any, timezone: string): moment.Moment; - zone(timezone: string): MomentZone; + zone(timezone: string): MomentZone | null; add(packedZoneString: string): void; add(packedZoneString: string[]): void; diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index cba04cb046..5791b906f1 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -1268,6 +1268,7 @@ export class Cursor extends Readable { filter(filter: Object): Cursor; /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#forEach */ forEach(iterator: IteratorCallback, callback: EndCallback): void; + forEach(iterator: IteratorCallback): Promise; /** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#hasNext */ hasNext(): Promise; hasNext(callback: MongoCallback): void; diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 5eea1625b5..90bb04747f 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Mongoose 5.2.1 +// Type definitions for Mongoose 5.2.2 // Project: http://mongoosejs.com/ // Definitions by: horiuchi // sindrenm @@ -10,6 +10,7 @@ // jussikinnula // ondratra // alfirin +// Idan Dardikman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -769,8 +770,8 @@ declare module "mongoose" { * @param key option name * @param value if not passed, the current option value is returned */ - set(key: string): any; - set(key: string, value: any): this; + set(key: T): SchemaOptions[T]; + set(key: T, value: SchemaOptions[T]): this; /** * Adds static "class" methods to Models compiled from this schema. diff --git a/types/mongoose/mongoose-tests.ts b/types/mongoose/mongoose-tests.ts index 2fe1e1b12e..02227c681d 100644 --- a/types/mongoose/mongoose-tests.ts +++ b/types/mongoose/mongoose-tests.ts @@ -429,7 +429,7 @@ schema.queue('m1', [1, 2, 3]).queue('m2', [[]]); schema.remove('path'); schema.remove(['path1', 'path2', 'path3']); schema.requiredPaths(true)[0].toLowerCase(); -schema.set('key', 999).set('key'); +schema.set('id', true).set('id'); schema.static('static', cb).static({ s1: cb, s2: cb diff --git a/types/moo/index.d.ts b/types/moo/index.d.ts index 9cf67c3299..fa3a59d2ab 100644 --- a/types/moo/index.d.ts +++ b/types/moo/index.d.ts @@ -50,7 +50,7 @@ export interface Rule { }; } export interface Rules { - [x: string]: RegExp | string | string[] | Rule; + [x: string]: RegExp | string | string[] | Rule | Rule[]; } export interface Lexer { diff --git a/types/moo/moo-tests.ts b/types/moo/moo-tests.ts index 6f0c18ae2d..c82bedd219 100644 --- a/types/moo/moo-tests.ts +++ b/types/moo/moo-tests.ts @@ -75,3 +75,13 @@ lexer.next(); lexer.next(); lexer.reset('a different line\n', info); lexer.next(); + +// Transform: https://github.com/no-context/moo#transform +moo.compile({ + STRING: [ + { match: /"""[^]*?"""/, lineBreaks: true, value: x => x.slice(3, -3) }, + { match: /"(?:\\["\\rn]|[^"\\])*?"/, lineBreaks: true, value: x => x.slice(1, -1) }, + { match: /'(?:\\['\\rn]|[^'\\])*?'/, lineBreaks: true, value: x => x.slice(1, -1) }, + ], + // ... +}); diff --git a/types/mosca/index.d.ts b/types/mosca/index.d.ts index 178f150d05..aee3625d10 100644 --- a/types/mosca/index.d.ts +++ b/types/mosca/index.d.ts @@ -1,9 +1,11 @@ // Type definitions for mosca 2.8 // Project: https://github.com/mcollina/mosca // Definitions by: Joao Gabriel Gouveia +// Jerray Fu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export class Server { + id: string; opts: any; modernOpts: any; clients: any; @@ -83,3 +85,15 @@ export interface Message { qos: number; retain: boolean; } + +export namespace persistence { + interface Persistence { + wire(server: Server): void; + } + type FactoryFunc = (options: { [key: string]: any }) => Persistence; + + const Redis: FactoryFunc; + const Mongo: FactoryFunc; + const LevelUp: FactoryFunc; + const Memory: FactoryFunc; +} diff --git a/types/n3/index.d.ts b/types/n3/index.d.ts index c773c85a28..dd2d5ca394 100644 --- a/types/n3/index.d.ts +++ b/types/n3/index.d.ts @@ -1,125 +1,220 @@ -// Type definitions for N3 +// Type definitions for N3 1.0 // Project: https://github.com/RubenVerborgh/N3.js // Definitions by: Fred Eisele +// Ruben Taelman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// - import * as fs from "fs"; import * as stream from "stream"; +import * as RDF from "rdf-js"; +import { EventEmitter } from "events"; -declare namespace N3 { - - type ErrorCallback = (err: Error, result: any) => void; - - interface Prefixes { - [key: string]: string; - } - - interface LiteralValue { - value: string | number; - } - - interface Triple { - subject: string, - predicate: string, - object: string, - graph?: string - } - - interface BlankTriple { - predicate: string, - object: string - } - - - interface ParserConstructor { - new (options?: ParserOptions): N3Parser; - (options?: ParserOptions): N3Parser; - } - const Parser: ParserConstructor; - - interface StreamParserConstructor { - new (options?: ParserOptions): N3StreamParser; - (options?: ParserOptions): N3StreamParser; - } - const StreamParser: StreamParserConstructor; - - interface ParserOptions { - format?: string, - prefixes?: string[] - } - - interface ParseCallback { - (error: Error, triple: Triple, prefixes: Prefixes): void; - } - - interface Logger { - (message?: any, ...optionalParams: any[]): void; - } - interface N3Parser { - parse(input: string, callback: ParseCallback): void; - parse(subject: string, predicate: string, object: string): void; - parse(triple: Triple): void; - parse(stream: fs.ReadStream, log: Logger): void; - } - - interface N3StreamParser extends N3Parser, fs.WriteStream { - pipe(consumer: T): T; - } - - - interface WriterConstructor { - new (options?: WriterOptions): N3Writer; - (options?: WriterOptions): N3Writer; - - new (fd: any, options?: WriterOptions): N3Writer; - (fd: any, options?: WriterOptions): N3Writer; - } - const Writer: WriterConstructor; - - interface N3Writer { - addTriple(subject: string, predicate: string, object: string): void; - addTriple(subject: string, predicate: string, object: string[]): void; - addTriple(triple: Triple): void; - end(err?: ErrorCallback, result?: any): void; - blank(ns: string, name: string): string; - blank(triple: BlankTriple[]): string; - list(triple: string[]): string[]; - } - - function StreamWriter(options: WriterOptions): N3StreamWriter; - - interface N3StreamWriter extends N3Writer { - pipe(consumer: NodeJS.WritableStream): void; - pipe(consumer: stream.Writable): void; - } - - interface WriterOptions { - format?: string, - prefixes?: Prefixes - } - - interface N3StoreWriter extends N3Writer { - find(subject: string, predicate: string | null, object: string | null): Triple[]; - } - function Store(): N3StoreWriter; - - namespace Util { - function createLiteral(value: any): string; - function createLiteral(value: any, type: string): string; - - function isIRI(value: string): boolean; - function isLiteral(value: string): boolean; - function getLiteralValue(value: string): string; - function getLiteralLanguage(value: string): string; - function getLiteralType(value: string): string; - function isBlank(value: string): boolean; - function isPrefixedName(name: string): boolean; - function expandPrefixedName(name: string, prefixes: Prefixes): string; - } +export interface Prefixes { + [key: string]: RDF.NamedNode; } -export = N3; +export class Term implements RDF.Term { + termType: "NamedNode" | "BlankNode" | "Literal" | "Variable" | "DefaultGraph"; + id: string; + value: string; + constructor(iri: string); + toJSON(): string; + equals(other: RDF.Term): boolean; + static subclass(type: any): void; +} +export class NamedNode extends Term implements RDF.NamedNode { + termType: "NamedNode"; + value: string; + constructor(iri: string); +} + +export class BlankNode extends Term implements RDF.BlankNode { + static nextId: number; + termType: "BlankNode"; + value: string; + constructor(name: string); +} + +export class Variable extends Term implements RDF.Variable { + termType: "Variable"; + value: string; + constructor(name: string); +} + +export class Literal extends Term implements RDF.Literal { + static readonly langStringDatatype: NamedNode; + termType: "Literal"; + value: string; + language: string; + datatype: RDF.NamedNode; + datatypeString: string; + constructor(id: string); +} + +export class DefaultGraph extends Term implements RDF.DefaultGraph { + termType: "DefaultGraph"; + value: ""; + constructor(); +} + +export class Quad implements RDF.Quad { + constructor(subject: RDF.Term, predicate: RDF.Term, object: RDF.Term, graph?: RDF.Term); + subject: RDF.Term; + predicate: RDF.Term; + object: RDF.Term; + graph: RDF.Term; + equals(other: RDF.Quad): boolean; + toJSON(): string; +} + +export class Triple extends Quad implements RDF.Triple {} + +export namespace DataFactory { + function namedNode(value: string): RDF.NamedNode; + function blankNode(value?: string): RDF.BlankNode; + function literal(value: string | number, languageOrDatatype?: string | RDF.NamedNode): RDF.Literal; + function variable(value: string): RDF.Variable; + function defaultGraph(): RDF.DefaultGraph; + function triple(subject: RDF.Term, predicate: RDF.Term, object: RDF.Term): RDF.Quad; + function quad(subject: RDF.Term, predicate: RDF.Term, object: RDF.Term, graph?: RDF.Term): RDF.Quad; +} + +export type ErrorCallback = (err: Error, result: any) => void; +export type QuadCallback = (result: Quad) => void; +export type QuadPredicate = (result: Quad) => boolean; + +export type OTerm = RDF.Term | string | null; + +export type Logger = (message?: any, ...optionalParams: any[]) => void; + +export interface BlankTriple { + predicate: RDF.Term; + object: RDF.Term; +} + +export interface ParserConstructor { + new (options?: ParserOptions): N3Parser; + (options?: ParserOptions): N3Parser; +} +export const Parser: ParserConstructor; + +export interface ParserOptions { + format?: string; + prefixes?: string[]; + factory?: RDF.DataFactory; + baseIRI?: string; +} + +export type ParseCallback = (error: Error, quad: Quad, prefixes: Prefixes) => void; + +export interface N3Parser { + parse(input: string, callback: ParseCallback): void; +} + +export interface StreamParserConstructor { + new (options?: ParserOptions): N3StreamParser; + (options?: ParserOptions): N3StreamParser; +} +export const StreamParser: StreamParserConstructor; + +export interface N3StreamParser extends RDF.Stream, NodeJS.WritableStream, RDF.Sink { + // Below are the NodeJS.ReadableStream methods, + // we can not extend the interface directly, + // as `read` clashes with RDF.Sink. + readable: boolean; + // read(size?: number): string | Buffer; // Overwritten by RDF.Stream + setEncoding(encoding: string | null): void; + pause(): this; + resume(): this; + isPaused(): boolean; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: NodeJS.WritableStream | RDF.Stream): void; + unshift(chunk: string | Buffer): void; + wrap(oldStream: NodeJS.ReadableStream | RDF.Stream): NodeJS.ReadableStream; +} + +export interface WriterOptions { + format?: string; + prefixes?: Prefixes; +} + +export interface WriterConstructor { + new (options?: WriterOptions): N3Writer; + new (fd: any, options?: WriterOptions): N3Writer; + (options?: WriterOptions): N3Writer; + (fd: any, options?: WriterOptions): N3Writer; +} +export const Writer: WriterConstructor; + +export interface N3Writer { + quadToString(subject: RDF.Term, predicate: RDF.Term, object: RDF.Term, graph?: RDF.Term): string; + quadsToString(quads: RDF.Quad[]): string; + addQuad(subject: RDF.Term, predicate: RDF.Term, object: RDF.Term | RDF.Term[], graph?: RDF.Term, done?: () => void): void; + addQuad(quad: RDF.Quad): void; + addQuads(quads: RDF.Quad[]): void; + end(err?: ErrorCallback, result?: string): void; + blank(predicate: RDF.Term, object: RDF.Term): RDF.Term; + blank(triple: BlankTriple | RDF.Quad | BlankTriple[] | RDF.Quad[]): RDF.Term; + list(triple: RDF.Term[]): RDF.Term[]; +} + +export interface StreamWriterConstructor { + new (options?: WriterOptions): N3StreamWriter; + new (fd: any, options?: WriterOptions): N3StreamWriter; + (options?: WriterOptions): N3StreamWriter; + (fd: any, options?: WriterOptions): N3StreamWriter; +} +export const StreamWriter: StreamWriterConstructor; + +export interface N3StreamWriter extends NodeJS.ReadWriteStream, RDF.Source {} + +export interface N3Store extends RDF.Sink { + readonly size: number; + addQuad(subject: RDF.Term, predicate: RDF.Term, object: RDF.Term | RDF.Term[], graph?: RDF.Term, done?: () => void): void; + addQuad(quad: RDF.Quad): void; + addQuads(quads: RDF.Quad[]): void; + removeQuad(subject: RDF.Term, predicate: RDF.Term, object: RDF.Term | RDF.Term[], graph?: RDF.Term, done?: () => void): void; + removeQuad(quad: RDF.Quad): void; + removeQuads(quads: RDF.Quad[]): void; + getQuads(subject: OTerm, predicate: OTerm, object: OTerm | OTerm[], graph: OTerm): Quad[]; + countQuads(subject: OTerm, predicate: OTerm, object: OTerm, graph: OTerm): number; + forEach(callback: QuadCallback, subject: OTerm, predicate: OTerm, object: OTerm, graph: OTerm): void; + every(callback: QuadPredicate, subject: OTerm, predicate: OTerm, object: OTerm, graph: OTerm): boolean; + some(callback: QuadPredicate, subject: OTerm, predicate: OTerm, object: OTerm, graph: OTerm): boolean; + getSubjects(predicate: OTerm, object: OTerm, graph: OTerm): RDF.Term[]; + forSubjects(callback: QuadCallback, predicate: OTerm, object: OTerm, graph: OTerm): void; + getPredicates(subject: OTerm, object: OTerm, graph: OTerm): RDF.Term[]; + forPredicates(callback: QuadCallback, subject: OTerm, object: OTerm, graph: OTerm): void; + getObjects(subject: OTerm, predicate: OTerm, graph: OTerm): RDF.Term[]; + forObjects(callback: QuadCallback, subject: OTerm, predicate: OTerm, graph: OTerm): void; + getGraphs(subject: OTerm, predicate: OTerm, object: OTerm): RDF.Term[]; + forGraphs(callback: QuadCallback, subject: OTerm, predicate: OTerm, object: OTerm): void; + createBlankNode(suggestedName?: string): BlankNode; + + // match, removeMatches and deleteGraph are missing for full RDF.Store adherence + remove(stream: stream.Stream): EventEmitter; +} +export interface StoreConstructor { + new (triples?: RDF.Quad[], options?: StoreOptions): N3Store; + (triples?: RDF.Quad[], options?: StoreOptions): N3Store; +} +export const Store: StoreConstructor; + +export interface StoreOptions { + factory?: RDF.DataFactory; +} + +export namespace Util { + function isNamedNode(value: RDF.Term | null): boolean; + function isBlankNode(value: RDF.Term | null): boolean; + function isLiteral(value: RDF.Term | null): boolean; + function isVariable(value: RDF.Term | null): boolean; + function isDefaultGraph(value: RDF.Term | null): boolean; + function inDefaultGraph(value: RDF.Quad): boolean; + function prefix(iri: string, factory?: RDF.DataFactory): (suffix: string) => RDF.NamedNode; + function prefixes(defaultPrefixes: Prefixes, factory?: RDF.DataFactory): (iri: string) => (suffix: string) => RDF.NamedNode; +} diff --git a/types/n3/n3-tests.ts b/types/n3/n3-tests.ts index d3c664c61e..367b602c8a 100644 --- a/types/n3/n3-tests.ts +++ b/types/n3/n3-tests.ts @@ -1,10 +1,10 @@ import * as N3 from "n3"; +import * as RDF from "rdf-js"; import * as fs from "fs"; import * as stream from "stream"; function test_serialize() { - - var writer: N3.N3Writer = N3.Writer( + const writer: N3.N3Writer = new N3.Writer( { format: "ttl", prefixes: { @@ -13,169 +13,171 @@ function test_serialize() { g: "http://base.google.com/ns/1.0" } }); - writer.addTriple({ - subject: "subject-name", - predicate: "predicate-name", - object: N3.Util.createLiteral(12) - }); + writer.addQuad(N3.DataFactory.quad( + N3.DataFactory.namedNode("subject-name"), + N3.DataFactory.namedNode("predicate-name"), + N3.DataFactory.literal(12) + )); writer.end((error, result) => { console.log(`result ${result}`); }); } -/** +/* The following tests are taken from ... https://github.com/RubenVerborgh/N3.js/blob/master/README.md */ function test_doc_rdf_to_triples_1() { - var parser = N3.Parser(); - parser.parse('@prefix c: .\n' + - 'c:Tom a c:Cat.\n' + - 'c:Jerry a c:Mouse;\n' + - ' c:smarterThan c:Tom.', - function (error: Error, triple: N3.Triple, prefixes: N3.Prefixes) { - if (triple) - console.log(triple.subject, triple.predicate, triple.object, '.'); + const parser: N3.N3Parser = new N3.Parser(); + parser.parse(`@prefix c: . + c:Tom a c:Cat. + c:Jerry a c:Mouse; + c:smarterThan c:Tom.`, + (error: Error, quad: RDF.Quad, prefixes: N3.Prefixes) => { + if (quad) + console.log(quad.subject, quad.predicate, quad.object, quad.graph, '.'); else - console.log("# That's all, folks!", prefixes) + console.log("# That's all, folks!", prefixes); }); } function test_doc_rdf_to_triples_2() { - var parser1 = N3.Parser({ format: 'N-Triples' }); - var parser2 = N3.Parser({ format: 'application/trig' }); + const parser1: N3.N3Parser = new N3.Parser({ format: 'N-Triples' }); + const parser2: N3.N3Parser = new N3.Parser({ format: 'application/trig' }); // Notation3 (N3) is supported only through the format argument: - var parser3 = N3.Parser({ format: 'N3' }); - var parser4 = N3.Parser({ format: 'Notation3' }); - var parser5 = N3.Parser({ format: 'text/n3' }); + const parser3: N3.N3Parser = N3.Parser({ format: 'N3' }); + const parser4: N3.N3Parser = N3.Parser({ format: 'Notation3' }); + const parser5: N3.N3Parser = N3.Parser({ format: 'text/n3' }); } function test_doc_rdf_stream_to_triples_1() { - var parser = N3.Parser(); - var rdfStream = fs.createReadStream('cartoons.ttl'); - parser.parse(rdfStream, console.log); + const parser: N3.N3Parser = new N3.Parser(); + parser.parse('abc', console.log); - var streamParser = N3.StreamParser(); - var rdfStream = fs.createReadStream('cartoons.ttl'); - rdfStream.pipe(streamParser); + const streamParser: N3.N3StreamParser = N3.StreamParser(); + const quad: RDF.Quad = streamParser.read(); + const rdfStream = fs.createReadStream('cartoons.ttl'); + const pipedStreamParser: N3.N3StreamParser = rdfStream.pipe(streamParser); streamParser.pipe(new class SlowConsumer extends stream.Writable { constructor() { super({ objectMode: true }); - this._write = function (triple, encoding, done) { - console.log(triple); + this._write = (quad: RDF.Quad, encoding, done) => { + console.log(quad); setTimeout(done, 1000); }; } - }); + }()); } function test_doc_from_triples_to_string() { - var writer = N3.Writer({ prefixes: { c: 'http://example.org/cartoons#' } }); - writer.addTriple('http://example.org/cartoons#Tom', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://example.org/cartoons#Cat'); - writer.addTriple({ - subject: 'http://example.org/cartoons#Tom', - predicate: 'http://example.org/cartoons#name', - object: '"Tom"' - }); - writer.end(function (error, result) { console.log(result); }); + const writer: N3.N3Writer = new N3.Writer({ prefixes: { c: 'http://example.org/cartoons#' } }); + writer.addQuad(N3.DataFactory.quad( + N3.DataFactory.namedNode('http://example.org/cartoons#Tom'), + N3.DataFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), + N3.DataFactory.namedNode('http://example.org/cartoons#Cat') + )); + writer.addQuad(N3.DataFactory.quad( + N3.DataFactory.namedNode('http://example.org/cartoons#Tom'), + N3.DataFactory.namedNode('http://example.org/cartoons#name'), + N3.DataFactory.literal('Tom'), + )); + writer.end((error, result: string) => { console.log(result); }); - var writer1 = N3.Writer({ format: 'N-Triples' }); - var writer2 = N3.Writer({ format: 'application/trig' }); + const writer1: N3.N3Writer = N3.Writer({ format: 'N-Triples' }); + const writer2: N3.N3Writer = N3.Writer({ format: 'application/trig' }); } function test_doc_from_triples_to_rdf_stream() { - var writer = N3.Writer(process.stdout, { prefixes: { c: 'http://example.org/cartoons#' } }); - writer.addTriple('http://example.org/cartoons#Tom', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://example.org/cartoons#Cat'); - writer.addTriple({ - subject: 'http://example.org/cartoons#Tom', - predicate: 'http://example.org/cartoons#name', - object: '"Tom"' - }); + const writer: N3.N3Writer = new N3.Writer(process.stdout, { prefixes: { c: N3.DataFactory.namedNode('http://example.org/cartoons#') } }); + writer.addQuad(N3.DataFactory.quad( + N3.DataFactory.namedNode('http://example.org/cartoons#Tom'), + N3.DataFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), + N3.DataFactory.namedNode('http://example.org/cartoons#Cat'), + )); + writer.addQuad(N3.DataFactory.quad( + N3.DataFactory.namedNode('http://example.org/cartoons#Tom'), + N3.DataFactory.namedNode('http://example.org/cartoons#name'), + N3.DataFactory.literal('Tom'), + )); writer.end(); } function test_doc_from_triple_stream_to_rdf_stream() { - var streamParser = new N3.StreamParser(), - inputStream = fs.createReadStream('cartoons.ttl'), - streamWriter = /* new */ N3.StreamWriter({ prefixes: { c: 'http://example.org/cartoons#' } }); + const streamParser: N3.N3StreamParser = new N3.StreamParser(); + const inputStream = fs.createReadStream('cartoons.ttl'); + const streamWriter: N3.N3StreamWriter = new N3.StreamWriter({ prefixes: { c: N3.DataFactory.namedNode('http://example.org/cartoons#') } }); inputStream.pipe(streamParser); streamParser.pipe(streamWriter); streamWriter.pipe(process.stdout); } function test_doc_blank_nodes_and_lists() { - var writer = N3.Writer({ + const writer: N3.N3Writer = new N3.Writer({ prefixes: { c: 'http://example.org/cartoons#', foaf: 'http://xmlns.com/foaf/0.1/' } }); - writer.addTriple(writer.blank('http://xmlns.com/foaf/0.1/givenName', '"Tom"@en'), - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - 'http://example.org/cartoons#Cat'); - writer.addTriple('http://example.org/cartoons#Jerry', - 'http://xmlns.com/foaf/0.1/knows', + writer.addQuad(writer.blank(N3.DataFactory.namedNode('http://xmlns.com/foaf/0.1/givenName'), N3.DataFactory.literal('Tom', 'en')), + N3.DataFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), + N3.DataFactory.namedNode('http://example.org/cartoons#Cat')); + writer.addQuad(N3.DataFactory.namedNode('http://example.org/cartoons#Jerry'), + N3.DataFactory.namedNode('http://xmlns.com/foaf/0.1/knows'), writer.blank([{ - predicate: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', - object: 'http://example.org/cartoons#Cat' + predicate: N3.DataFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), + object: N3.DataFactory.namedNode('http://example.org/cartoons#Cat') }, { - predicate: 'http://xmlns.com/foaf/0.1/givenName', - object: '"Tom"@en', + predicate: N3.DataFactory.namedNode('http://xmlns.com/foaf/0.1/givenName'), + object: N3.DataFactory.literal('Tom', 'en'), }])); - writer.addTriple('http://example.org/cartoons#Mammy', - 'http://example.org/cartoons#hasPets', + writer.addQuad(N3.DataFactory.namedNode('http://example.org/cartoons#Mammy'), + N3.DataFactory.namedNode('http://example.org/cartoons#hasPets'), writer.list([ - 'http://example.org/cartoons#Tom', - 'http://example.org/cartoons#Jerry' + N3.DataFactory.namedNode('http://example.org/cartoons#Tom'), + N3.DataFactory.namedNode('http://example.org/cartoons#Jerry') ])); - writer.end(function (error, result) { console.log(result); }); + writer.end((error, result) => { console.log(result); }); } function test_doc_storing() { - var store = N3.Store(); - store.addTriple('http://ex.org/Pluto', 'http://ex.org/type', 'http://ex.org/Dog'); - store.addTriple('http://ex.org/Mickey', 'http://ex.org/type', 'http://ex.org/Mouse'); + const store: N3.N3Store = new N3.Store(); + store.addQuad(N3.DataFactory.namedNode('http://ex.org/Pluto'), N3.DataFactory.namedNode('http://ex.org/type'), N3.DataFactory.namedNode('http://ex.org/Dog')); + store.addQuad(N3.DataFactory.quad(N3.DataFactory.namedNode('http://ex.org/Mickey'), N3.DataFactory.namedNode('http://ex.org/type'), N3.DataFactory.namedNode('http://ex.org/Mouse'))); + store.addQuads([N3.DataFactory.quad(N3.DataFactory.namedNode('http://ex.org/Mickey'), N3.DataFactory.namedNode('http://ex.org/type'), N3.DataFactory.namedNode('http://ex.org/Mouse'))]); + store.removeQuad(N3.DataFactory.namedNode('http://ex.org/Mickey'), N3.DataFactory.namedNode('http://ex.org/type'), N3.DataFactory.namedNode('http://ex.org/Mouse')); + store.removeQuad(N3.DataFactory.quad(N3.DataFactory.namedNode('http://ex.org/Mickey'), N3.DataFactory.namedNode('http://ex.org/type'), N3.DataFactory.namedNode('http://ex.org/Mouse'))); + store.removeQuads([N3.DataFactory.quad(N3.DataFactory.namedNode('http://ex.org/Mickey'), N3.DataFactory.namedNode('http://ex.org/type'), N3.DataFactory.namedNode('http://ex.org/Mouse'))]); - var mickey = store.find('http://ex.org/Mickey', null, null)[0]; + const bnode1: RDF.BlankNode = store.createBlankNode(); + const bnode2: RDF.BlankNode = store.createBlankNode('abc'); + + const mickey: RDF.Quad = store.getQuads(N3.DataFactory.namedNode('http://ex.org/Mickey'), null, null, null)[0]; console.log(mickey.subject, mickey.predicate, mickey.object, '.'); } function test_doc_utility() { - var N3Util = N3.Util; - N3Util.isIRI('http://example.org/cartoons#Mickey'); // true + const N3Util = N3.Util; + N3Util.isNamedNode(N3.DataFactory.namedNode('http://example.org/cartoons#Mickey')); // true - N3Util.isLiteral('"Mickey Mouse"'); // true - N3Util.getLiteralValue('"Mickey Mouse"'); // 'Mickey Mouse' - N3Util.isLiteral('"Mickey Mouse"@en'); // true - N3Util.getLiteralLanguage('"Mickey Mouse"@en'); // 'en' - N3Util.isLiteral('"3"^^http://www.w3.org/2001/XMLSchema#integer'); // true - N3Util.getLiteralType('"3"^^http://www.w3.org/2001/XMLSchema#integer'); // 'http://www.w3.org/2001/XMLSchema#integer' - N3Util.isLiteral('"http://example.org/"'); // true - N3Util.getLiteralValue('"http://example.org/"'); // 'http://example.org/' + N3Util.isLiteral(N3.DataFactory.literal('Mickey Mouse')); // true + N3Util.isLiteral(N3.DataFactory.literal('Mickey Mouse', 'en')); // true + N3Util.isLiteral(N3.DataFactory.literal('3', N3.DataFactory.namedNode('http://www.w3.org/2001/XMLSchema#integer'))); // true + N3Util.isLiteral(N3.DataFactory.literal('http://example.org/')); // true - N3Util.isLiteral('"This word is "quoted"!"'); // true - N3Util.isLiteral('"3"^^http://www.w3.org/2001/XMLSchema#integer'); // true + N3Util.isLiteral(N3.DataFactory.literal('This word is "quoted"!')); // true + N3Util.isLiteral(N3.DataFactory.literal('3', N3.DataFactory.namedNode('http://www.w3.org/2001/XMLSchema#integer'))); // true new N3.Parser().parse(' "This word is \\"quoted\\"!".', console.log); // { subject: 'a', predicate: 'b', object: '"This word is "quoted"!"' } - N3Util.createLiteral('My text', 'en-gb'); - N3Util.createLiteral('123', 'http://www.w3.org/2001/XMLSchema#integer'); - N3Util.createLiteral(123); - N3Util.createLiteral(false); + N3Util.isBlankNode(N3.DataFactory.blankNode('b1')); // true + N3Util.isNamedNode(N3.DataFactory.blankNode('b1')); // false + N3Util.isLiteral(N3.DataFactory.blankNode('b1')); // false - N3Util.isBlank('_:b1'); // true - N3Util.isIRI('_:b1'); // false - N3Util.isLiteral('_:b1'); // false - - var prefixes: N3.Prefixes = { rdfs: 'http://www.w3.org/2000/01/rdf-schema#' }; - N3Util.isPrefixedName('rdfs:label'); // true; - N3Util.expandPrefixedName('rdfs:label', prefixes); // http://www.w3.org/2000/01/rdf-schema#label + const prefixes: N3.Prefixes = { rdfs: N3.DataFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#') }; + const namedNode1: RDF.NamedNode = N3Util.prefix('http://www.w3.org/2000/01/rdf-schema#')('label'); + const namedNode2: RDF.NamedNode = N3Util.prefixes(prefixes)('rdfs')('label'); } diff --git a/types/n3/tsconfig.json b/types/n3/tsconfig.json index 4ba121903d..11e61e58e3 100644 --- a/types/n3/tsconfig.json +++ b/types/n3/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "n3-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/n3/tslint.json b/types/n3/tslint.json index a41bf5d19a..d88586e5bd 100644 --- a/types/n3/tslint.json +++ b/types/n3/tslint.json @@ -1,79 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } + "extends": "dtslint/dt.json" } diff --git a/types/nanoevents/index.d.ts b/types/nanoevents/index.d.ts new file mode 100644 index 0000000000..0da2f0add3 --- /dev/null +++ b/types/nanoevents/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for nanoevents 1.0 +// Project: https://github.com/ai/nanoevents#readme +// Definitions by: nju33 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +declare function unbind(): void; + +declare class NanoEvents { + on(name: U, callBack: (arg: T[U]) => any): typeof unbind; + emit(name: U, value: T[U]): void; +} + +export = NanoEvents; diff --git a/types/nanoevents/nanoevents-tests.ts b/types/nanoevents/nanoevents-tests.ts new file mode 100644 index 0000000000..7e6eaa8cd8 --- /dev/null +++ b/types/nanoevents/nanoevents-tests.ts @@ -0,0 +1,8 @@ +import NanoEvents = require('nanoevents'); +import unbindAll = require('nanoevents/unbind-all'); + +const emitter = new NanoEvents<{foo: {foo: string}, bar: {bar: string}}>(); +const unbind = emitter.on('foo', action => action.foo); +emitter.emit('bar', {bar: 'test'}); +unbind(); +unbindAll(emitter); diff --git a/types/nanoevents/tsconfig.json b/types/nanoevents/tsconfig.json new file mode 100644 index 0000000000..d3291ed1d9 --- /dev/null +++ b/types/nanoevents/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": [ + "index.d.ts", + "nanoevents-tests.ts", + "unbind-all.d.ts" + ] +} diff --git a/types/nanoevents/tslint.json b/types/nanoevents/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/nanoevents/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/nanoevents/unbind-all.d.ts b/types/nanoevents/unbind-all.d.ts new file mode 100644 index 0000000000..1f5662e493 --- /dev/null +++ b/types/nanoevents/unbind-all.d.ts @@ -0,0 +1,5 @@ +import NanoEmitter = require('.'); + +declare function unbindAll(emitter: NanoEmitter): void; + +export = unbindAll; diff --git a/types/node/index.d.ts b/types/node/index.d.ts index ed04749756..9753d31cc6 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Node.js 10.5.x +// Type definitions for Node.js 10.9.x // Project: http://nodejs.org/ // Definitions by: Microsoft TypeScript // DefinitelyTyped @@ -26,6 +26,7 @@ // Lishude // Andrew Makarov // Zane Hannan AU +// Thomas den Hollander // Eugene Y. Q. Shen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -172,6 +173,10 @@ interface SymbolConstructor { readonly asyncIterator: symbol; } declare var Symbol: SymbolConstructor; +interface SharedArrayBuffer { + readonly byteLength: number; + slice(begin?: number, end?: number): SharedArrayBuffer; +} // Node.js ESNEXT support interface String { @@ -181,11 +186,11 @@ interface String { trimRight(): string; } -/************************************************ -* * -* GLOBAL * -* * -************************************************/ +/*-----------------------------------------------* + * * + * GLOBAL * + * * + ------------------------------------------------*/ declare var process: NodeJS.Process; declare var global: NodeJS.Global; declare var console: Console; @@ -349,13 +354,13 @@ declare var Buffer: { new(array: Uint8Array): Buffer; /** * Produces a Buffer backed by the same allocated memory as - * the given {ArrayBuffer}. + * the given {ArrayBuffer}/{SharedArrayBuffer}. * * * @param arrayBuffer The ArrayBuffer with which to share memory. * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead. */ - new(arrayBuffer: ArrayBuffer): Buffer; + new(arrayBuffer: ArrayBuffer | SharedArrayBuffer): Buffer; /** * Allocates a new buffer containing the given {array} of octets. * @@ -379,8 +384,7 @@ declare var Buffer: { * * @param arrayBuffer The .buffer property of any TypedArray or a new ArrayBuffer() */ - from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer; - // from(arrayBuffer: SharedArrayBuffer, byteOffset?: number, length?: number): Buffer; + from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer; /** * Creates a new Buffer using the passed {data} * @param data data to create a new Buffer @@ -418,7 +422,7 @@ declare var Buffer: { * @param string string to test. * @param encoding encoding used to evaluate (defaults to 'utf8') */ - byteLength(string: string | NodeJS.TypedArray | DataView | ArrayBuffer /*| SharedArrayBuffer */, encoding?: string): number; + byteLength(string: string | NodeJS.TypedArray | DataView | ArrayBuffer | SharedArrayBuffer, encoding?: string): number; /** * Returns a buffer which is the result of concatenating all the buffers in the list together. * @@ -1248,6 +1252,10 @@ declare module "http" { * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. */ maxFreeSockets?: number; + /** + * Socket timeout in milliseconds. This will set the timeout after the socket is connected. + */ + timeout?: number; } export class Agent { @@ -1281,7 +1289,9 @@ declare module "http" { // create interface RequestOptions would make the naming more clear to developers export interface RequestOptions extends ClientRequestArgs { } export function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; + export function request(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; export function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; + export function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; export var globalAgent: Agent; } @@ -1883,7 +1893,9 @@ declare module "https" { export function createServer(options: ServerOptions, requestListener?: (req: http.IncomingMessage, res: http.ServerResponse) => void): Server; export function request(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; + export function request(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; export function get(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; + export function get(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; export var globalAgent: Agent; } @@ -2190,11 +2202,13 @@ declare module "child_process" { keepOpen?: boolean; } + export type StdioOptions = "pipe" | "ignore" | "inherit" | Array<("pipe" | "ipc" | "ignore" | "inherit" | stream.Stream | number | null | undefined)>; + export interface SpawnOptions { - argv0?: string; cwd?: string; - env?: any; - stdio?: any; + env?: NodeJS.ProcessEnv; + argv0?: string; + stdio?: StdioOptions; detached?: boolean; uid?: number; gid?: number; @@ -2207,7 +2221,7 @@ declare module "child_process" { export interface ExecOptions { cwd?: string; - env?: any; + env?: NodeJS.ProcessEnv; shell?: string; timeout?: number; maxBuffer?: number; @@ -2262,7 +2276,7 @@ declare module "child_process" { export interface ExecFileOptions { cwd?: string; - env?: any; + env?: NodeJS.ProcessEnv; timeout?: number; maxBuffer?: number; killSignal?: string; @@ -2329,32 +2343,32 @@ declare module "child_process" { export interface ForkOptions { cwd?: string; - env?: any; + env?: NodeJS.ProcessEnv; execPath?: string; execArgv?: string[]; silent?: boolean; - stdio?: any[]; + stdio?: StdioOptions; + windowsVerbatimArguments?: boolean; uid?: number; gid?: number; - windowsVerbatimArguments?: boolean; } export function fork(modulePath: string, args?: ReadonlyArray, options?: ForkOptions): ChildProcess; export interface SpawnSyncOptions { - argv0?: string; + argv0?: string; // Not specified in the docs cwd?: string; - input?: string | Buffer; - stdio?: any; - env?: any; + input?: string | Buffer | Uint8Array; + stdio?: StdioOptions; + env?: NodeJS.ProcessEnv; uid?: number; gid?: number; timeout?: number; - killSignal?: string; + killSignal?: string | number; maxBuffer?: number; encoding?: string; shell?: boolean | string; - windowsHide?: boolean; windowsVerbatimArguments?: boolean; + windowsHide?: boolean; } export interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions { encoding: BufferEncoding; @@ -2381,14 +2395,14 @@ declare module "child_process" { export interface ExecSyncOptions { cwd?: string; - input?: string | Buffer; - stdio?: any; - env?: any; + input?: string | Buffer | Uint8Array; + stdio?: StdioOptions; + env?: NodeJS.ProcessEnv; shell?: string; uid?: number; gid?: number; timeout?: number; - killSignal?: string; + killSignal?: string | number; maxBuffer?: number; encoding?: string; windowsHide?: boolean; @@ -2406,16 +2420,17 @@ declare module "child_process" { export interface ExecFileSyncOptions { cwd?: string; - input?: string | Buffer; - stdio?: any; - env?: any; + input?: string | Buffer | Uint8Array; + stdio?: StdioOptions; + env?: NodeJS.ProcessEnv; uid?: number; gid?: number; timeout?: number; - killSignal?: string; + killSignal?: string | number; maxBuffer?: number; encoding?: string; windowsHide?: boolean; + shell?: boolean | string; } export interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions { encoding: BufferEncoding; @@ -2579,8 +2594,15 @@ declare module "dns" { ttl: number; } - export interface AnyRecordWithTtl extends RecordWithTtl { - type: "A" | "AAAA"; + /** @deprecated Use AnyARecord or AnyAaaaRecord instead. */ + export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord; + + export interface AnyARecord extends RecordWithTtl { + type: "A"; + } + + export interface AnyAaaaRecord extends RecordWithTtl { + type: "AAAA"; } export interface MxRecord { @@ -2635,10 +2657,36 @@ declare module "dns" { entries: string[]; } + export interface AnyNsRecord { + type: "NS"; + value: string; + } + + export interface AnyPtrRecord { + type: "PTR"; + value: string; + } + + export interface AnyCnameRecord { + type: "CNAME"; + value: string; + } + + export type AnyRecord = AnyARecord | + AnyAaaaRecord | + AnyCnameRecord | + AnyMxRecord | + AnyNaptrRecord | + AnyNsRecord | + AnyPtrRecord | + AnySoaRecord | + AnySrvRecord | + AnyTxtRecord; + export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; export function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; export function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException, addresses: ReadonlyArray) => void): void; + export function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException, addresses: AnyRecord[]) => void): void; export function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; export function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; export function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; @@ -2647,18 +2695,18 @@ declare module "dns" { export function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException, addresses: SoaRecord) => void): void; export function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; export function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; - export function resolve(hostname: string, rrtype: string, callback: (err: NodeJS.ErrnoException, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][]) => void): void; + export function resolve(hostname: string, rrtype: string, callback: (err: NodeJS.ErrnoException, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace resolve { export function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise; - export function __promisify__(hostname: string, rrtype: "ANY"): Promise>; + export function __promisify__(hostname: string, rrtype: "ANY"): Promise; export function __promisify__(hostname: string, rrtype: "MX"): Promise; export function __promisify__(hostname: string, rrtype: "NAPTR"): Promise; export function __promisify__(hostname: string, rrtype: "SOA"): Promise; export function __promisify__(hostname: string, rrtype: "SRV"): Promise; export function __promisify__(hostname: string, rrtype: "TXT"): Promise; - export function __promisify__(hostname: string, rrtype?: string): Promise; + export function __promisify__(hostname: string, rrtype: string): Promise; } export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; @@ -2683,18 +2731,54 @@ declare module "dns" { export function __promisify__(hostname: string, options?: ResolveOptions): Promise; } - export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: ReadonlyArray) => void): void; export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export namespace resolveCname { + export function __promisify__(hostname: string): Promise; + } + export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; + export namespace resolveMx { + export function __promisify__(hostname: string): Promise; + } + export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; + export namespace resolveNaptr { + export function __promisify__(hostname: string): Promise; + } + export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export namespace resolveNs { + export function __promisify__(hostname: string): Promise; + } + export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export namespace resolvePtr { + export function __promisify__(hostname: string): Promise; + } + export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException, address: SoaRecord) => void): void; + export namespace resolveSoa { + export function __promisify__(hostname: string): Promise; + } + export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; + export namespace resolveSrv { + export function __promisify__(hostname: string): Promise; + } + export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; + export namespace resolveTxt { + export function __promisify__(hostname: string): Promise; + } + + export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: AnyRecord[]) => void): void; + export namespace resolveAny { + export function __promisify__(hostname: string): Promise; + } export function reverse(ip: string, callback: (err: NodeJS.ErrnoException, hostnames: string[]) => void): void; export function setServers(servers: string[]): void; + export function getServers(): string[]; // Error codes export var NODATA: string; @@ -2721,6 +2805,25 @@ declare module "dns" { export var LOADIPHLPAPI: string; export var ADDRGETNETWORKPARAMS: string; export var CANCELLED: string; + + export class Resolver { + getServers: typeof getServers; + setServers: typeof setServers; + resolve: typeof resolve; + resolve4: typeof resolve4; + resolve6: typeof resolve6; + resolveAny: typeof resolveAny; + resolveCname: typeof resolveCname; + resolveMx: typeof resolveMx; + resolveNaptr: typeof resolveNaptr; + resolveNs: typeof resolveNs; + resolvePtr: typeof resolvePtr; + resolveSoa: typeof resolveSoa; + resolveSrv: typeof resolveSrv; + resolveTxt: typeof resolveTxt; + reverse: typeof reverse; + cancel(): void; + } } declare module "net" { @@ -6306,17 +6409,17 @@ declare module "util" { export function promisify(fn: CustomPromisify): TCustom; export function promisify(fn: (callback: (err: Error | null, result: TResult) => void) => void): () => Promise; - export function promisify(fn: (callback: (err: Error | null) => void) => void): () => Promise; + export function promisify(fn: (callback: (err?: Error | null) => void) => void): () => Promise; export function promisify(fn: (arg1: T1, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1) => Promise; - export function promisify(fn: (arg1: T1, callback: (err: Error | null) => void) => void): (arg1: T1) => Promise; + export function promisify(fn: (arg1: T1, callback: (err?: Error | null) => void) => void): (arg1: T1) => Promise; export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2) => Promise; export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; export function promisify(fn: Function): Function; export namespace promisify { const custom: symbol; diff --git a/types/node/inspector.d.ts b/types/node/inspector.d.ts index 955239b486..474c481d5a 100644 --- a/types/node/inspector.d.ts +++ b/types/node/inspector.d.ts @@ -15,26 +15,1075 @@ declare module "inspector" { params: T; } - export namespace Schema { + export namespace Console { /** - * Description of the protocol domain. + * Console message. */ - export interface Domain { + export interface ConsoleMessage { /** - * Domain name. + * Message source. */ - name: string; + source: string; /** - * Domain version. + * Message severity. */ - version: string; + level: string; + /** + * Message text. + */ + text: string; + /** + * URL of the message origin. + */ + url?: string; + /** + * Line number in the resource that generated this message (1-based). + */ + line?: number; + /** + * Column number in the resource that generated this message (1-based). + */ + column?: number; } - export interface GetDomainsReturnType { + export interface MessageAddedEventDataType { /** - * List of supported domains. + * Console message that has been added. */ - domains: Schema.Domain[]; + message: Console.ConsoleMessage; + } + } + + export namespace Debugger { + /** + * Breakpoint identifier. + */ + export type BreakpointId = string; + + /** + * Call frame identifier. + */ + export type CallFrameId = string; + + /** + * Location in the source code. + */ + export interface Location { + /** + * Script identifier as reported in the `Debugger.scriptParsed`. + */ + scriptId: Runtime.ScriptId; + /** + * Line number in the script (0-based). + */ + lineNumber: number; + /** + * Column number in the script (0-based). + */ + columnNumber?: number; + } + + /** + * Location in the source code. + * @experimental + */ + export interface ScriptPosition { + lineNumber: number; + columnNumber: number; + } + + /** + * JavaScript call frame. Array of call frames form the call stack. + */ + export interface CallFrame { + /** + * Call frame identifier. This identifier is only valid while the virtual machine is paused. + */ + callFrameId: Debugger.CallFrameId; + /** + * Name of the JavaScript function called on this call frame. + */ + functionName: string; + /** + * Location in the source code. + */ + functionLocation?: Debugger.Location; + /** + * Location in the source code. + */ + location: Debugger.Location; + /** + * JavaScript script name or url. + */ + url: string; + /** + * Scope chain for this call frame. + */ + scopeChain: Debugger.Scope[]; + /** + * `this` object for this call frame. + */ + this: Runtime.RemoteObject; + /** + * The value being returned, if the function is at return point. + */ + returnValue?: Runtime.RemoteObject; + } + + /** + * Scope description. + */ + export interface Scope { + /** + * Scope type. + */ + type: string; + /** + * Object representing the scope. For `global` and `with` scopes it represents the actual +object; for the rest of the scopes, it is artificial transient object enumerating scope +variables as its properties. + */ + object: Runtime.RemoteObject; + name?: string; + /** + * Location in the source code where scope starts + */ + startLocation?: Debugger.Location; + /** + * Location in the source code where scope ends + */ + endLocation?: Debugger.Location; + } + + /** + * Search match for resource. + */ + export interface SearchMatch { + /** + * Line number in resource content. + */ + lineNumber: number; + /** + * Line with match content. + */ + lineContent: string; + } + + export interface BreakLocation { + /** + * Script identifier as reported in the `Debugger.scriptParsed`. + */ + scriptId: Runtime.ScriptId; + /** + * Line number in the script (0-based). + */ + lineNumber: number; + /** + * Column number in the script (0-based). + */ + columnNumber?: number; + type?: string; + } + + export interface ContinueToLocationParameterType { + /** + * Location to continue to. + */ + location: Debugger.Location; + targetCallFrames?: string; + } + + export interface EvaluateOnCallFrameParameterType { + /** + * Call frame identifier to evaluate on. + */ + callFrameId: Debugger.CallFrameId; + /** + * Expression to evaluate. + */ + expression: string; + /** + * String object group name to put result into (allows rapid releasing resulting object handles +using `releaseObjectGroup`). + */ + objectGroup?: string; + /** + * Specifies whether command line API should be available to the evaluated expression, defaults +to false. + */ + includeCommandLineAPI?: boolean; + /** + * In silent mode exceptions thrown during evaluation are not reported and do not pause +execution. Overrides `setPauseOnException` state. + */ + silent?: boolean; + /** + * Whether the result is expected to be a JSON object that should be sent by value. + */ + returnByValue?: boolean; + /** + * Whether preview should be generated for the result. + * @experimental + */ + generatePreview?: boolean; + /** + * Whether to throw an exception if side effect cannot be ruled out during evaluation. + */ + throwOnSideEffect?: boolean; + } + + export interface GetPossibleBreakpointsParameterType { + /** + * Start of range to search possible breakpoint locations in. + */ + start: Debugger.Location; + /** + * End of range to search possible breakpoint locations in (excluding). When not specified, end +of scripts is used as end of range. + */ + end?: Debugger.Location; + /** + * Only consider locations which are in the same (non-nested) function as start. + */ + restrictToFunction?: boolean; + } + + export interface GetScriptSourceParameterType { + /** + * Id of the script to get source for. + */ + scriptId: Runtime.ScriptId; + } + + export interface GetStackTraceParameterType { + stackTraceId: Runtime.StackTraceId; + } + + export interface PauseOnAsyncCallParameterType { + /** + * Debugger will pause when async call with given stack trace is started. + */ + parentStackTraceId: Runtime.StackTraceId; + } + + export interface RemoveBreakpointParameterType { + breakpointId: Debugger.BreakpointId; + } + + export interface RestartFrameParameterType { + /** + * Call frame identifier to evaluate on. + */ + callFrameId: Debugger.CallFrameId; + } + + export interface SearchInContentParameterType { + /** + * Id of the script to search in. + */ + scriptId: Runtime.ScriptId; + /** + * String to search for. + */ + query: string; + /** + * If true, search is case sensitive. + */ + caseSensitive?: boolean; + /** + * If true, treats string parameter as regex. + */ + isRegex?: boolean; + } + + export interface SetAsyncCallStackDepthParameterType { + /** + * Maximum depth of async call stacks. Setting to `0` will effectively disable collecting async +call stacks (default). + */ + maxDepth: number; + } + + export interface SetBlackboxPatternsParameterType { + /** + * Array of regexps that will be used to check script url for blackbox state. + */ + patterns: string[]; + } + + export interface SetBlackboxedRangesParameterType { + /** + * Id of the script. + */ + scriptId: Runtime.ScriptId; + positions: Debugger.ScriptPosition[]; + } + + export interface SetBreakpointParameterType { + /** + * Location to set breakpoint in. + */ + location: Debugger.Location; + /** + * Expression to use as a breakpoint condition. When specified, debugger will only stop on the +breakpoint if this expression evaluates to true. + */ + condition?: string; + } + + export interface SetBreakpointByUrlParameterType { + /** + * Line number to set breakpoint at. + */ + lineNumber: number; + /** + * URL of the resources to set breakpoint on. + */ + url?: string; + /** + * Regex pattern for the URLs of the resources to set breakpoints on. Either `url` or +`urlRegex` must be specified. + */ + urlRegex?: string; + /** + * Script hash of the resources to set breakpoint on. + */ + scriptHash?: string; + /** + * Offset in the line to set breakpoint at. + */ + columnNumber?: number; + /** + * Expression to use as a breakpoint condition. When specified, debugger will only stop on the +breakpoint if this expression evaluates to true. + */ + condition?: string; + } + + export interface SetBreakpointsActiveParameterType { + /** + * New value for breakpoints active state. + */ + active: boolean; + } + + export interface SetPauseOnExceptionsParameterType { + /** + * Pause on exceptions mode. + */ + state: string; + } + + export interface SetReturnValueParameterType { + /** + * New return value. + */ + newValue: Runtime.CallArgument; + } + + export interface SetScriptSourceParameterType { + /** + * Id of the script to edit. + */ + scriptId: Runtime.ScriptId; + /** + * New content of the script. + */ + scriptSource: string; + /** + * If true the change will not actually be applied. Dry run may be used to get result +description without actually modifying the code. + */ + dryRun?: boolean; + } + + export interface SetSkipAllPausesParameterType { + /** + * New value for skip pauses state. + */ + skip: boolean; + } + + export interface SetVariableValueParameterType { + /** + * 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' +scope types are allowed. Other scopes could be manipulated manually. + */ + scopeNumber: number; + /** + * Variable name. + */ + variableName: string; + /** + * New variable value. + */ + newValue: Runtime.CallArgument; + /** + * Id of callframe that holds variable. + */ + callFrameId: Debugger.CallFrameId; + } + + export interface StepIntoParameterType { + /** + * Debugger will issue additional Debugger.paused notification if any async task is scheduled +before next pause. + * @experimental + */ + breakOnAsyncCall?: boolean; + } + + export interface EnableReturnType { + /** + * Unique identifier of the debugger. + * @experimental + */ + debuggerId: Runtime.UniqueDebuggerId; + } + + export interface EvaluateOnCallFrameReturnType { + /** + * Object wrapper for the evaluation result. + */ + result: Runtime.RemoteObject; + /** + * Exception details. + */ + exceptionDetails?: Runtime.ExceptionDetails; + } + + export interface GetPossibleBreakpointsReturnType { + /** + * List of the possible breakpoint locations. + */ + locations: Debugger.BreakLocation[]; + } + + export interface GetScriptSourceReturnType { + /** + * Script source. + */ + scriptSource: string; + } + + export interface GetStackTraceReturnType { + stackTrace: Runtime.StackTrace; + } + + export interface RestartFrameReturnType { + /** + * New stack trace. + */ + callFrames: Debugger.CallFrame[]; + /** + * Async stack trace, if any. + */ + asyncStackTrace?: Runtime.StackTrace; + /** + * Async stack trace, if any. + * @experimental + */ + asyncStackTraceId?: Runtime.StackTraceId; + } + + export interface SearchInContentReturnType { + /** + * List of search matches. + */ + result: Debugger.SearchMatch[]; + } + + export interface SetBreakpointReturnType { + /** + * Id of the created breakpoint for further reference. + */ + breakpointId: Debugger.BreakpointId; + /** + * Location this breakpoint resolved into. + */ + actualLocation: Debugger.Location; + } + + export interface SetBreakpointByUrlReturnType { + /** + * Id of the created breakpoint for further reference. + */ + breakpointId: Debugger.BreakpointId; + /** + * List of the locations this breakpoint resolved into upon addition. + */ + locations: Debugger.Location[]; + } + + export interface SetScriptSourceReturnType { + /** + * New stack trace in case editing has happened while VM was stopped. + */ + callFrames?: Debugger.CallFrame[]; + /** + * Whether current call stack was modified after applying the changes. + */ + stackChanged?: boolean; + /** + * Async stack trace, if any. + */ + asyncStackTrace?: Runtime.StackTrace; + /** + * Async stack trace, if any. + * @experimental + */ + asyncStackTraceId?: Runtime.StackTraceId; + /** + * Exception details if any. + */ + exceptionDetails?: Runtime.ExceptionDetails; + } + + export interface BreakpointResolvedEventDataType { + /** + * Breakpoint unique identifier. + */ + breakpointId: Debugger.BreakpointId; + /** + * Actual breakpoint location. + */ + location: Debugger.Location; + } + + export interface PausedEventDataType { + /** + * Call stack the virtual machine stopped on. + */ + callFrames: Debugger.CallFrame[]; + /** + * Pause reason. + */ + reason: string; + /** + * Object containing break-specific auxiliary properties. + */ + data?: {}; + /** + * Hit breakpoints IDs + */ + hitBreakpoints?: string[]; + /** + * Async stack trace, if any. + */ + asyncStackTrace?: Runtime.StackTrace; + /** + * Async stack trace, if any. + * @experimental + */ + asyncStackTraceId?: Runtime.StackTraceId; + /** + * Just scheduled async call will have this stack trace as parent stack during async execution. +This field is available only after `Debugger.stepInto` call with `breakOnAsynCall` flag. + * @experimental + */ + asyncCallStackTraceId?: Runtime.StackTraceId; + } + + export interface ScriptFailedToParseEventDataType { + /** + * Identifier of the script parsed. + */ + scriptId: Runtime.ScriptId; + /** + * URL or name of the script parsed (if any). + */ + url: string; + /** + * Line offset of the script within the resource with given URL (for script tags). + */ + startLine: number; + /** + * Column offset of the script within the resource with given URL. + */ + startColumn: number; + /** + * Last line of the script. + */ + endLine: number; + /** + * Length of the last line of the script. + */ + endColumn: number; + /** + * Specifies script creation context. + */ + executionContextId: Runtime.ExecutionContextId; + /** + * Content hash of the script. + */ + hash: string; + /** + * Embedder-specific auxiliary data. + */ + executionContextAuxData?: {}; + /** + * URL of source map associated with script (if any). + */ + sourceMapURL?: string; + /** + * True, if this script has sourceURL. + */ + hasSourceURL?: boolean; + /** + * True, if this script is ES6 module. + */ + isModule?: boolean; + /** + * This script length. + */ + length?: number; + /** + * JavaScript top stack frame of where the script parsed event was triggered if available. + * @experimental + */ + stackTrace?: Runtime.StackTrace; + } + + export interface ScriptParsedEventDataType { + /** + * Identifier of the script parsed. + */ + scriptId: Runtime.ScriptId; + /** + * URL or name of the script parsed (if any). + */ + url: string; + /** + * Line offset of the script within the resource with given URL (for script tags). + */ + startLine: number; + /** + * Column offset of the script within the resource with given URL. + */ + startColumn: number; + /** + * Last line of the script. + */ + endLine: number; + /** + * Length of the last line of the script. + */ + endColumn: number; + /** + * Specifies script creation context. + */ + executionContextId: Runtime.ExecutionContextId; + /** + * Content hash of the script. + */ + hash: string; + /** + * Embedder-specific auxiliary data. + */ + executionContextAuxData?: {}; + /** + * True, if this script is generated as a result of the live edit operation. + * @experimental + */ + isLiveEdit?: boolean; + /** + * URL of source map associated with script (if any). + */ + sourceMapURL?: string; + /** + * True, if this script has sourceURL. + */ + hasSourceURL?: boolean; + /** + * True, if this script is ES6 module. + */ + isModule?: boolean; + /** + * This script length. + */ + length?: number; + /** + * JavaScript top stack frame of where the script parsed event was triggered if available. + * @experimental + */ + stackTrace?: Runtime.StackTrace; + } + } + + export namespace HeapProfiler { + /** + * Heap snapshot object id. + */ + export type HeapSnapshotObjectId = string; + + /** + * Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes. + */ + export interface SamplingHeapProfileNode { + /** + * Function location. + */ + callFrame: Runtime.CallFrame; + /** + * Allocations size in bytes for the node excluding children. + */ + selfSize: number; + /** + * Child nodes. + */ + children: HeapProfiler.SamplingHeapProfileNode[]; + } + + /** + * Profile. + */ + export interface SamplingHeapProfile { + head: HeapProfiler.SamplingHeapProfileNode; + } + + export interface AddInspectedHeapObjectParameterType { + /** + * Heap snapshot object id to be accessible by means of $x command line API. + */ + heapObjectId: HeapProfiler.HeapSnapshotObjectId; + } + + export interface GetHeapObjectIdParameterType { + /** + * Identifier of the object to get heap object id for. + */ + objectId: Runtime.RemoteObjectId; + } + + export interface GetObjectByHeapObjectIdParameterType { + objectId: HeapProfiler.HeapSnapshotObjectId; + /** + * Symbolic group name that can be used to release multiple objects. + */ + objectGroup?: string; + } + + export interface StartSamplingParameterType { + /** + * Average sample interval in bytes. Poisson distribution is used for the intervals. The +default value is 32768 bytes. + */ + samplingInterval?: number; + } + + export interface StartTrackingHeapObjectsParameterType { + trackAllocations?: boolean; + } + + export interface StopTrackingHeapObjectsParameterType { + /** + * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken +when the tracking is stopped. + */ + reportProgress?: boolean; + } + + export interface TakeHeapSnapshotParameterType { + /** + * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken. + */ + reportProgress?: boolean; + } + + export interface GetHeapObjectIdReturnType { + /** + * Id of the heap snapshot object corresponding to the passed remote object id. + */ + heapSnapshotObjectId: HeapProfiler.HeapSnapshotObjectId; + } + + export interface GetObjectByHeapObjectIdReturnType { + /** + * Evaluation result. + */ + result: Runtime.RemoteObject; + } + + export interface GetSamplingProfileReturnType { + /** + * Return the sampling profile being collected. + */ + profile: HeapProfiler.SamplingHeapProfile; + } + + export interface StopSamplingReturnType { + /** + * Recorded sampling heap profile. + */ + profile: HeapProfiler.SamplingHeapProfile; + } + + export interface AddHeapSnapshotChunkEventDataType { + chunk: string; + } + + export interface HeapStatsUpdateEventDataType { + /** + * An array of triplets. Each triplet describes a fragment. The first integer is the fragment +index, the second integer is a total count of objects for the fragment, the third integer is +a total size of the objects for the fragment. + */ + statsUpdate: number[]; + } + + export interface LastSeenObjectIdEventDataType { + lastSeenObjectId: number; + timestamp: number; + } + + export interface ReportHeapSnapshotProgressEventDataType { + done: number; + total: number; + finished?: boolean; + } + } + + export namespace Profiler { + /** + * Profile node. Holds callsite information, execution statistics and child nodes. + */ + export interface ProfileNode { + /** + * Unique id of the node. + */ + id: number; + /** + * Function location. + */ + callFrame: Runtime.CallFrame; + /** + * Number of samples where this node was on top of the call stack. + */ + hitCount?: number; + /** + * Child node ids. + */ + children?: number[]; + /** + * The reason of being not optimized. The function may be deoptimized or marked as don't +optimize. + */ + deoptReason?: string; + /** + * An array of source position ticks. + */ + positionTicks?: Profiler.PositionTickInfo[]; + } + + /** + * Profile. + */ + export interface Profile { + /** + * The list of profile nodes. First item is the root node. + */ + nodes: Profiler.ProfileNode[]; + /** + * Profiling start timestamp in microseconds. + */ + startTime: number; + /** + * Profiling end timestamp in microseconds. + */ + endTime: number; + /** + * Ids of samples top nodes. + */ + samples?: number[]; + /** + * Time intervals between adjacent samples in microseconds. The first delta is relative to the +profile startTime. + */ + timeDeltas?: number[]; + } + + /** + * Specifies a number of samples attributed to a certain source position. + */ + export interface PositionTickInfo { + /** + * Source line number (1-based). + */ + line: number; + /** + * Number of samples attributed to the source line. + */ + ticks: number; + } + + /** + * Coverage data for a source range. + */ + export interface CoverageRange { + /** + * JavaScript script source offset for the range start. + */ + startOffset: number; + /** + * JavaScript script source offset for the range end. + */ + endOffset: number; + /** + * Collected execution count of the source range. + */ + count: number; + } + + /** + * Coverage data for a JavaScript function. + */ + export interface FunctionCoverage { + /** + * JavaScript function name. + */ + functionName: string; + /** + * Source ranges inside the function with coverage data. + */ + ranges: Profiler.CoverageRange[]; + /** + * Whether coverage data for this function has block granularity. + */ + isBlockCoverage: boolean; + } + + /** + * Coverage data for a JavaScript script. + */ + export interface ScriptCoverage { + /** + * JavaScript script id. + */ + scriptId: Runtime.ScriptId; + /** + * JavaScript script name or url. + */ + url: string; + /** + * Functions contained in the script that has coverage data. + */ + functions: Profiler.FunctionCoverage[]; + } + + /** + * Describes a type collected during runtime. + * @experimental + */ + export interface TypeObject { + /** + * Name of a type collected with type profiling. + */ + name: string; + } + + /** + * Source offset and types for a parameter or return value. + * @experimental + */ + export interface TypeProfileEntry { + /** + * Source offset of the parameter or end of function for return values. + */ + offset: number; + /** + * The types for this parameter or return value. + */ + types: Profiler.TypeObject[]; + } + + /** + * Type profile data collected during runtime for a JavaScript script. + * @experimental + */ + export interface ScriptTypeProfile { + /** + * JavaScript script id. + */ + scriptId: Runtime.ScriptId; + /** + * JavaScript script name or url. + */ + url: string; + /** + * Type profile entries for parameters and return values of the functions in the script. + */ + entries: Profiler.TypeProfileEntry[]; + } + + export interface SetSamplingIntervalParameterType { + /** + * New sampling interval in microseconds. + */ + interval: number; + } + + export interface StartPreciseCoverageParameterType { + /** + * Collect accurate call counts beyond simple 'covered' or 'not covered'. + */ + callCount?: boolean; + /** + * Collect block-based coverage. + */ + detailed?: boolean; + } + + export interface GetBestEffortCoverageReturnType { + /** + * Coverage data for the current isolate. + */ + result: Profiler.ScriptCoverage[]; + } + + export interface StopReturnType { + /** + * Recorded profile. + */ + profile: Profiler.Profile; + } + + export interface TakePreciseCoverageReturnType { + /** + * Coverage data for the current isolate. + */ + result: Profiler.ScriptCoverage[]; + } + + export interface TakeTypeProfileReturnType { + /** + * Type profile for all scripts since startTypeProfile() was turned on. + */ + result: Profiler.ScriptTypeProfile[]; + } + + export interface ConsoleProfileFinishedEventDataType { + id: string; + /** + * Location of console.profileEnd(). + */ + location: Debugger.Location; + profile: Profiler.Profile; + /** + * Profile title passed as an argument to console.profile(). + */ + title?: string; + } + + export interface ConsoleProfileStartedEventDataType { + id: string; + /** + * Location of console.profile(). + */ + location: Debugger.Location; + /** + * Profile title passed as an argument to console.profile(). + */ + title?: string; } } @@ -50,7 +1099,8 @@ declare module "inspector" { export type RemoteObjectId = string; /** - * Primitive value which cannot be JSON-stringified. + * Primitive value which cannot be JSON-stringified. Includes values `-0`, `NaN`, `Infinity`, +`-Infinity`, and bigint literals. */ export type UnserializableValue = string; @@ -63,11 +1113,11 @@ declare module "inspector" { */ type: string; /** - * Object subtype hint. Specified for object type values only. + * Object subtype hint. Specified for `object` type values only. */ subtype?: string; /** - * Object class (constructor) name. Specified for object type values only. + * Object class (constructor) name. Specified for `object` type values only. */ className?: string; /** @@ -75,7 +1125,8 @@ declare module "inspector" { */ value?: any; /** - * Primitive value which can not be JSON-stringified does not have value, but gets this property. + * Primitive value which can not be JSON-stringified does not have `value`, but gets this +property. */ unserializableValue?: Runtime.UnserializableValue; /** @@ -87,7 +1138,7 @@ declare module "inspector" { */ objectId?: Runtime.RemoteObjectId; /** - * Preview containing abbreviated property values. Specified for object type values only. + * Preview containing abbreviated property values. Specified for `object` type values only. * @experimental */ preview?: Runtime.ObjectPreview; @@ -118,7 +1169,7 @@ declare module "inspector" { */ type: string; /** - * Object subtype hint. Specified for object type values only. + * Object subtype hint. Specified for `object` type values only. */ subtype?: string; /** @@ -134,7 +1185,7 @@ declare module "inspector" { */ properties: Runtime.PropertyPreview[]; /** - * List of the entries. Specified for map and set subtype values only. + * List of the entries. Specified for `map` and `set` subtype values only. */ entries?: Runtime.EntryPreview[]; } @@ -160,7 +1211,7 @@ declare module "inspector" { */ valuePreview?: Runtime.ObjectPreview; /** - * Object subtype hint. Specified for object type values only. + * Object subtype hint. Specified for `object` type values only. */ subtype?: string; } @@ -196,19 +1247,23 @@ declare module "inspector" { */ writable?: boolean; /** - * A function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only). + * A function which serves as a getter for the property, or `undefined` if there is no getter +(accessor descriptors only). */ get?: Runtime.RemoteObject; /** - * A function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only). + * A function which serves as a setter for the property, or `undefined` if there is no setter +(accessor descriptors only). */ set?: Runtime.RemoteObject; /** - * True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object. + * True if the type of this property descriptor may be changed and if the property may be +deleted from the corresponding object. */ configurable: boolean; /** - * True if this property shows up during enumeration of the properties on the corresponding object. + * True if this property shows up during enumeration of the properties on the corresponding +object. */ enumerable: boolean; /** @@ -220,7 +1275,7 @@ declare module "inspector" { */ isOwn?: boolean; /** - * Property symbol object, if the property is of the symbol type. + * Property symbol object, if the property is of the `symbol` type. */ symbol?: Runtime.RemoteObject; } @@ -240,11 +1295,12 @@ declare module "inspector" { } /** - * Represents function call argument. Either remote object id objectId, primitive value, unserializable primitive value or neither of (for undefined) them should be specified. + * Represents function call argument. Either remote object id `objectId`, primitive `value`, +unserializable primitive value or neither of (for undefined) them should be specified. */ export interface CallArgument { /** - * Primitive value. + * Primitive value or serializable javascript object. */ value?: any; /** @@ -267,7 +1323,8 @@ declare module "inspector" { */ export interface ExecutionContextDescription { /** - * Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed. + * Unique id of the execution context. It can be used to specify in which execution context +script evaluation should be performed. */ id: Runtime.ExecutionContextId; /** @@ -285,7 +1342,8 @@ declare module "inspector" { } /** - * Detailed information about exception (or error) that was thrown during script compilation or execution. + * Detailed information about exception (or error) that was thrown during script compilation or +execution. */ export interface ExceptionDetails { /** @@ -362,7 +1420,8 @@ declare module "inspector" { */ export interface StackTrace { /** - * String label of this stack trace. For async traces this may be a name of the function that initiated the async call. + * String label of this stack trace. For async traces this may be a name of the function that +initiated the async call. */ description?: string; /** @@ -374,51 +1433,26 @@ declare module "inspector" { */ parent?: Runtime.StackTrace; /** - * Creation frame of the Promise which produced the next synchronous trace when resolved, if available. + * Asynchronous JavaScript stack trace that preceded this stack, if available. * @experimental */ - promiseCreationFrame?: Runtime.CallFrame; + parentId?: Runtime.StackTraceId; } - export interface EvaluateParameterType { - /** - * Expression to evaluate. - */ - expression: string; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string; - /** - * Determines whether Command Line API should be available during the evaluation. - */ - includeCommandLineAPI?: boolean; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean; - /** - * Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - */ - contextId?: Runtime.ExecutionContextId; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean; - /** - * Whether execution should be treated as initiated by user in the UI. - * @experimental - */ - userGesture?: boolean; - /** - * Whether execution should wait for promise to be resolved. If the result of evaluation is not a Promise, it's considered to be an error. - */ - awaitPromise?: boolean; + /** + * Unique identifier of current debugger. + * @experimental + */ + export type UniqueDebuggerId = string; + + /** + * If `debuggerId` is set stack trace comes from another debugger and can be resolved there. This +allows to track cross-debugger calls. See `Runtime.StackTrace` and `Debugger.paused` for usages. + * @experimental + */ + export interface StackTraceId { + id: string; + debuggerId?: Runtime.UniqueDebuggerId; } export interface AwaitPromiseParameterType { @@ -437,20 +1471,23 @@ declare module "inspector" { } export interface CallFunctionOnParameterType { - /** - * Identifier of the object to call function on. - */ - objectId: Runtime.RemoteObjectId; /** * Declaration of the function to call. */ functionDeclaration: string; /** - * Call arguments. All call arguments must belong to the same JavaScript world as the target object. + * Identifier of the object to call function on. Either objectId or executionContextId should +be specified. + */ + objectId?: Runtime.RemoteObjectId; + /** + * Call arguments. All call arguments must belong to the same JavaScript world as the target +object. */ arguments?: Runtime.CallArgument[]; /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. + * In silent mode exceptions thrown during evaluation are not reported and do not pause +execution. Overrides `setPauseOnException` state. */ silent?: boolean; /** @@ -464,52 +1501,23 @@ declare module "inspector" { generatePreview?: boolean; /** * Whether execution should be treated as initiated by user in the UI. - * @experimental */ userGesture?: boolean; /** - * Whether execution should wait for promise to be resolved. If the result of evaluation is not a Promise, it's considered to be an error. + * Whether execution should `await` for resulting value and return once awaited promise is +resolved. */ awaitPromise?: boolean; - } - - export interface GetPropertiesParameterType { /** - * Identifier of the object to return properties for. + * Specifies execution context which global object will be used to call function on. Either +executionContextId or objectId should be specified. */ - objectId: Runtime.RemoteObjectId; + executionContextId?: Runtime.ExecutionContextId; /** - * If true, returns properties belonging only to the element itself, not to its prototype chain. + * Symbolic group name that can be used to release multiple objects. If objectGroup is not +specified and objectId is, objectGroup will be inherited from object. */ - ownProperties?: boolean; - /** - * If true, returns accessor properties (with getter/setter) only; internal properties are not returned either. - * @experimental - */ - accessorPropertiesOnly?: boolean; - /** - * Whether preview should be generated for the results. - * @experimental - */ - generatePreview?: boolean; - } - - export interface ReleaseObjectParameterType { - /** - * Identifier of the object to release. - */ - objectId: Runtime.RemoteObjectId; - } - - export interface ReleaseObjectGroupParameterType { - /** - * Symbolic object group name. - */ - objectGroup: string; - } - - export interface SetCustomObjectFormatterEnabledParameterType { - enabled: boolean; + objectGroup?: string; } export interface CompileScriptParameterType { @@ -526,18 +1534,123 @@ declare module "inspector" { */ persistScript: boolean; /** - * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. + * Specifies in which execution context to perform script run. If the parameter is omitted the +evaluation will be performed in the context of the inspected page. */ executionContextId?: Runtime.ExecutionContextId; } + export interface EvaluateParameterType { + /** + * Expression to evaluate. + */ + expression: string; + /** + * Symbolic group name that can be used to release multiple objects. + */ + objectGroup?: string; + /** + * Determines whether Command Line API should be available during the evaluation. + */ + includeCommandLineAPI?: boolean; + /** + * In silent mode exceptions thrown during evaluation are not reported and do not pause +execution. Overrides `setPauseOnException` state. + */ + silent?: boolean; + /** + * Specifies in which execution context to perform evaluation. If the parameter is omitted the +evaluation will be performed in the context of the inspected page. + */ + contextId?: Runtime.ExecutionContextId; + /** + * Whether the result is expected to be a JSON object that should be sent by value. + */ + returnByValue?: boolean; + /** + * Whether preview should be generated for the result. + * @experimental + */ + generatePreview?: boolean; + /** + * Whether execution should be treated as initiated by user in the UI. + */ + userGesture?: boolean; + /** + * Whether execution should `await` for resulting value and return once awaited promise is +resolved. + */ + awaitPromise?: boolean; + /** + * Whether to throw an exception if side effect cannot be ruled out during evaluation. + * @experimental + */ + throwOnSideEffect?: boolean; + } + + export interface GetPropertiesParameterType { + /** + * Identifier of the object to return properties for. + */ + objectId: Runtime.RemoteObjectId; + /** + * If true, returns properties belonging only to the element itself, not to its prototype +chain. + */ + ownProperties?: boolean; + /** + * If true, returns accessor properties (with getter/setter) only; internal properties are not +returned either. + * @experimental + */ + accessorPropertiesOnly?: boolean; + /** + * Whether preview should be generated for the results. + * @experimental + */ + generatePreview?: boolean; + } + + export interface GlobalLexicalScopeNamesParameterType { + /** + * Specifies in which execution context to lookup global scope variables. + */ + executionContextId?: Runtime.ExecutionContextId; + } + + export interface QueryObjectsParameterType { + /** + * Identifier of the prototype to return objects for. + */ + prototypeObjectId: Runtime.RemoteObjectId; + /** + * Symbolic group name that can be used to release the results. + */ + objectGroup?: string; + } + + export interface ReleaseObjectParameterType { + /** + * Identifier of the object to release. + */ + objectId: Runtime.RemoteObjectId; + } + + export interface ReleaseObjectGroupParameterType { + /** + * Symbolic object group name. + */ + objectGroup: string; + } + export interface RunScriptParameterType { /** * Id of the script to run. */ scriptId: Runtime.ScriptId; /** - * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. + * Specifies in which execution context to perform script run. If the parameter is omitted the +evaluation will be performed in the context of the inspected page. */ executionContextId?: Runtime.ExecutionContextId; /** @@ -545,7 +1658,8 @@ declare module "inspector" { */ objectGroup?: string; /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. + * In silent mode exceptions thrown during evaluation are not reported and do not pause +execution. Overrides `setPauseOnException` state. */ silent?: boolean; /** @@ -561,20 +1675,14 @@ declare module "inspector" { */ generatePreview?: boolean; /** - * Whether execution should wait for promise to be resolved. If the result of evaluation is not a Promise, it's considered to be an error. + * Whether execution should `await` for resulting value and return once awaited promise is +resolved. */ awaitPromise?: boolean; } - export interface EvaluateReturnType { - /** - * Evaluation result. - */ - result: Runtime.RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: Runtime.ExceptionDetails; + export interface SetCustomObjectFormatterEnabledParameterType { + enabled: boolean; } export interface AwaitPromiseReturnType { @@ -599,6 +1707,46 @@ declare module "inspector" { exceptionDetails?: Runtime.ExceptionDetails; } + export interface CompileScriptReturnType { + /** + * Id of the script. + */ + scriptId?: Runtime.ScriptId; + /** + * Exception details. + */ + exceptionDetails?: Runtime.ExceptionDetails; + } + + export interface EvaluateReturnType { + /** + * Evaluation result. + */ + result: Runtime.RemoteObject; + /** + * Exception details. + */ + exceptionDetails?: Runtime.ExceptionDetails; + } + + export interface GetIsolateIdReturnType { + /** + * The isolate id. + */ + id: string; + } + + export interface GetHeapUsageReturnType { + /** + * Used heap size in bytes. + */ + usedSize: number; + /** + * Allocated heap size in bytes. + */ + totalSize: number; + } + export interface GetPropertiesReturnType { /** * Object properties. @@ -614,15 +1762,15 @@ declare module "inspector" { exceptionDetails?: Runtime.ExceptionDetails; } - export interface CompileScriptReturnType { + export interface GlobalLexicalScopeNamesReturnType { + names: string[]; + } + + export interface QueryObjectsReturnType { /** - * Id of the script. + * Array with objects. */ - scriptId?: Runtime.ScriptId; - /** - * Exception details. - */ - exceptionDetails?: Runtime.ExceptionDetails; + objects: Runtime.RemoteObject; } export interface RunScriptReturnType { @@ -636,39 +1784,6 @@ declare module "inspector" { exceptionDetails?: Runtime.ExceptionDetails; } - export interface ExecutionContextCreatedEventDataType { - /** - * A newly created execution context. - */ - context: Runtime.ExecutionContextDescription; - } - - export interface ExecutionContextDestroyedEventDataType { - /** - * Id of the destroyed context - */ - executionContextId: Runtime.ExecutionContextId; - } - - export interface ExceptionThrownEventDataType { - /** - * Timestamp of the exception. - */ - timestamp: Runtime.Timestamp; - exceptionDetails: Runtime.ExceptionDetails; - } - - export interface ExceptionRevokedEventDataType { - /** - * Reason describing why exception was revoked. - */ - reason: string; - /** - * The id of revoked exception, as reported in exceptionUnhandled. - */ - exceptionId: number; - } - export interface ConsoleAPICalledEventDataType { /** * Type of the call. @@ -691,959 +1806,73 @@ declare module "inspector" { */ stackTrace?: Runtime.StackTrace; /** - * Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context. + * Console context descriptor for calls on non-default console context (not console.*): +'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call +on named context. * @experimental */ context?: string; } + export interface ExceptionRevokedEventDataType { + /** + * Reason describing why exception was revoked. + */ + reason: string; + /** + * The id of revoked exception, as reported in `exceptionThrown`. + */ + exceptionId: number; + } + + export interface ExceptionThrownEventDataType { + /** + * Timestamp of the exception. + */ + timestamp: Runtime.Timestamp; + exceptionDetails: Runtime.ExceptionDetails; + } + + export interface ExecutionContextCreatedEventDataType { + /** + * A newly created execution context. + */ + context: Runtime.ExecutionContextDescription; + } + + export interface ExecutionContextDestroyedEventDataType { + /** + * Id of the destroyed context + */ + executionContextId: Runtime.ExecutionContextId; + } + export interface InspectRequestedEventDataType { object: Runtime.RemoteObject; hints: {}; } } - export namespace Debugger { + export namespace Schema { /** - * Breakpoint identifier. + * Description of the protocol domain. */ - export type BreakpointId = string; - - /** - * Call frame identifier. - */ - export type CallFrameId = string; - - /** - * Location in the source code. - */ - export interface Location { - /** - * Script identifier as reported in the Debugger.scriptParsed. - */ - scriptId: Runtime.ScriptId; - /** - * Line number in the script (0-based). - */ - lineNumber: number; - /** - * Column number in the script (0-based). - */ - columnNumber?: number; - } - - /** - * Location in the source code. - * @experimental - */ - export interface ScriptPosition { - lineNumber: number; - columnNumber: number; - } - - /** - * JavaScript call frame. Array of call frames form the call stack. - */ - export interface CallFrame { - /** - * Call frame identifier. This identifier is only valid while the virtual machine is paused. - */ - callFrameId: Debugger.CallFrameId; - /** - * Name of the JavaScript function called on this call frame. - */ - functionName: string; - /** - * Location in the source code. - * @experimental - */ - functionLocation?: Debugger.Location; - /** - * Location in the source code. - */ - location: Debugger.Location; - /** - * Scope chain for this call frame. - */ - scopeChain: Debugger.Scope[]; - /** - * this object for this call frame. - */ - this: Runtime.RemoteObject; - /** - * The value being returned, if the function is at return point. - */ - returnValue?: Runtime.RemoteObject; - } - - /** - * Scope description. - */ - export interface Scope { - /** - * Scope type. - */ - type: string; - /** - * Object representing the scope. For global and with scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties. - */ - object: Runtime.RemoteObject; - name?: string; - /** - * Location in the source code where scope starts - */ - startLocation?: Debugger.Location; - /** - * Location in the source code where scope ends - */ - endLocation?: Debugger.Location; - } - - /** - * Search match for resource. - * @experimental - */ - export interface SearchMatch { - /** - * Line number in resource content. - */ - lineNumber: number; - /** - * Line with match content. - */ - lineContent: string; - } - - /** - * @experimental - */ - export interface BreakLocation { - /** - * Script identifier as reported in the Debugger.scriptParsed. - */ - scriptId: Runtime.ScriptId; - /** - * Line number in the script (0-based). - */ - lineNumber: number; - /** - * Column number in the script (0-based). - */ - columnNumber?: number; - type?: string; - } - - export interface SetBreakpointsActiveParameterType { - /** - * New value for breakpoints active state. - */ - active: boolean; - } - - export interface SetSkipAllPausesParameterType { + export interface Domain { /** - * New value for skip pauses state. + * Domain name. */ - skip: boolean; - } - - export interface SetBreakpointByUrlParameterType { - /** - * Line number to set breakpoint at. - */ - lineNumber: number; - /** - * URL of the resources to set breakpoint on. - */ - url?: string; - /** - * Regex pattern for the URLs of the resources to set breakpoints on. Either url or urlRegex must be specified. - */ - urlRegex?: string; - /** - * Offset in the line to set breakpoint at. - */ - columnNumber?: number; - /** - * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. - */ - condition?: string; - } - - export interface SetBreakpointParameterType { - /** - * Location to set breakpoint in. - */ - location: Debugger.Location; - /** - * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. - */ - condition?: string; - } - - export interface RemoveBreakpointParameterType { - breakpointId: Debugger.BreakpointId; - } - - export interface GetPossibleBreakpointsParameterType { - /** - * Start of range to search possible breakpoint locations in. - */ - start: Debugger.Location; - /** - * End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range. - */ - end?: Debugger.Location; - /** - * Only consider locations which are in the same (non-nested) function as start. - */ - restrictToFunction?: boolean; - } - - export interface ContinueToLocationParameterType { - /** - * Location to continue to. - */ - location: Debugger.Location; - /** - * @experimental - */ - targetCallFrames?: string; - } - - export interface SearchInContentParameterType { - /** - * Id of the script to search in. - */ - scriptId: Runtime.ScriptId; - /** - * String to search for. - */ - query: string; - /** - * If true, search is case sensitive. - */ - caseSensitive?: boolean; + name: string; /** - * If true, treats string parameter as regex. + * Domain version. */ - isRegex?: boolean; - } - - export interface SetScriptSourceParameterType { - /** - * Id of the script to edit. - */ - scriptId: Runtime.ScriptId; - /** - * New content of the script. - */ - scriptSource: string; - /** - * If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code. - */ - dryRun?: boolean; - } - - export interface RestartFrameParameterType { - /** - * Call frame identifier to evaluate on. - */ - callFrameId: Debugger.CallFrameId; - } - - export interface GetScriptSourceParameterType { - /** - * Id of the script to get source for. - */ - scriptId: Runtime.ScriptId; - } - - export interface SetPauseOnExceptionsParameterType { - /** - * Pause on exceptions mode. - */ - state: string; - } - - export interface EvaluateOnCallFrameParameterType { - /** - * Call frame identifier to evaluate on. - */ - callFrameId: Debugger.CallFrameId; - /** - * Expression to evaluate. - */ - expression: string; - /** - * String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup). - */ - objectGroup?: string; - /** - * Specifies whether command line API should be available to the evaluated expression, defaults to false. - */ - includeCommandLineAPI?: boolean; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean; - /** - * Whether to throw an exception if side effect cannot be ruled out during evaluation. - * @experimental - */ - throwOnSideEffect?: boolean; - } - - export interface SetVariableValueParameterType { - /** - * 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually. - */ - scopeNumber: number; - /** - * Variable name. - */ - variableName: string; - /** - * New variable value. - */ - newValue: Runtime.CallArgument; - /** - * Id of callframe that holds variable. - */ - callFrameId: Debugger.CallFrameId; - } - - export interface SetAsyncCallStackDepthParameterType { - /** - * Maximum depth of async call stacks. Setting to 0 will effectively disable collecting async call stacks (default). - */ - maxDepth: number; - } - - export interface SetBlackboxPatternsParameterType { - /** - * Array of regexps that will be used to check script url for blackbox state. - */ - patterns: string[]; - } - - export interface SetBlackboxedRangesParameterType { - /** - * Id of the script. - */ - scriptId: Runtime.ScriptId; - positions: Debugger.ScriptPosition[]; - } - - export interface SetBreakpointByUrlReturnType { - /** - * Id of the created breakpoint for further reference. - */ - breakpointId: Debugger.BreakpointId; - /** - * List of the locations this breakpoint resolved into upon addition. - */ - locations: Debugger.Location[]; - } - - export interface SetBreakpointReturnType { - /** - * Id of the created breakpoint for further reference. - */ - breakpointId: Debugger.BreakpointId; - /** - * Location this breakpoint resolved into. - */ - actualLocation: Debugger.Location; - } - - export interface GetPossibleBreakpointsReturnType { - /** - * List of the possible breakpoint locations. - */ - locations: Debugger.BreakLocation[]; - } - - export interface SearchInContentReturnType { - /** - * List of search matches. - */ - result: Debugger.SearchMatch[]; - } - - export interface SetScriptSourceReturnType { - /** - * New stack trace in case editing has happened while VM was stopped. - */ - callFrames?: Debugger.CallFrame[]; - /** - * Whether current call stack was modified after applying the changes. - */ - stackChanged?: boolean; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace; - /** - * Exception details if any. - */ - exceptionDetails?: Runtime.ExceptionDetails; - } - - export interface RestartFrameReturnType { - /** - * New stack trace. - */ - callFrames: Debugger.CallFrame[]; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace; - } - - export interface GetScriptSourceReturnType { - /** - * Script source. - */ - scriptSource: string; - } - - export interface EvaluateOnCallFrameReturnType { - /** - * Object wrapper for the evaluation result. - */ - result: Runtime.RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: Runtime.ExceptionDetails; - } - - export interface ScriptParsedEventDataType { - /** - * Identifier of the script parsed. - */ - scriptId: Runtime.ScriptId; - /** - * URL or name of the script parsed (if any). - */ - url: string; - /** - * Line offset of the script within the resource with given URL (for script tags). - */ - startLine: number; - /** - * Column offset of the script within the resource with given URL. - */ - startColumn: number; - /** - * Last line of the script. - */ - endLine: number; - /** - * Length of the last line of the script. - */ - endColumn: number; - /** - * Specifies script creation context. - */ - executionContextId: Runtime.ExecutionContextId; - /** - * Content hash of the script. - */ - hash: string; - /** - * Embedder-specific auxiliary data. - */ - executionContextAuxData?: {}; - /** - * True, if this script is generated as a result of the live edit operation. - * @experimental - */ - isLiveEdit?: boolean; - /** - * URL of source map associated with script (if any). - */ - sourceMapURL?: string; - /** - * True, if this script has sourceURL. - * @experimental - */ - hasSourceURL?: boolean; - /** - * True, if this script is ES6 module. - * @experimental - */ - isModule?: boolean; - /** - * This script length. - * @experimental - */ - length?: number; - /** - * JavaScript top stack frame of where the script parsed event was triggered if available. - * @experimental - */ - stackTrace?: Runtime.StackTrace; - } - - export interface ScriptFailedToParseEventDataType { - /** - * Identifier of the script parsed. - */ - scriptId: Runtime.ScriptId; - /** - * URL or name of the script parsed (if any). - */ - url: string; - /** - * Line offset of the script within the resource with given URL (for script tags). - */ - startLine: number; - /** - * Column offset of the script within the resource with given URL. - */ - startColumn: number; - /** - * Last line of the script. - */ - endLine: number; - /** - * Length of the last line of the script. - */ - endColumn: number; - /** - * Specifies script creation context. - */ - executionContextId: Runtime.ExecutionContextId; - /** - * Content hash of the script. - */ - hash: string; - /** - * Embedder-specific auxiliary data. - */ - executionContextAuxData?: {}; - /** - * URL of source map associated with script (if any). - */ - sourceMapURL?: string; - /** - * True, if this script has sourceURL. - * @experimental - */ - hasSourceURL?: boolean; - /** - * True, if this script is ES6 module. - * @experimental - */ - isModule?: boolean; - /** - * This script length. - * @experimental - */ - length?: number; - /** - * JavaScript top stack frame of where the script parsed event was triggered if available. - * @experimental - */ - stackTrace?: Runtime.StackTrace; - } - - export interface BreakpointResolvedEventDataType { - /** - * Breakpoint unique identifier. - */ - breakpointId: Debugger.BreakpointId; - /** - * Actual breakpoint location. - */ - location: Debugger.Location; - } - - export interface PausedEventDataType { - /** - * Call stack the virtual machine stopped on. - */ - callFrames: Debugger.CallFrame[]; - /** - * Pause reason. - */ - reason: string; - /** - * Object containing break-specific auxiliary properties. - */ - data?: {}; - /** - * Hit breakpoints IDs - */ - hitBreakpoints?: string[]; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace; - } - } - - export namespace Console { - /** - * Console message. - */ - export interface ConsoleMessage { - /** - * Message source. - */ - source: string; - /** - * Message severity. - */ - level: string; - /** - * Message text. - */ - text: string; - /** - * URL of the message origin. - */ - url?: string; - /** - * Line number in the resource that generated this message (1-based). - */ - line?: number; - /** - * Column number in the resource that generated this message (1-based). - */ - column?: number; - } - - export interface MessageAddedEventDataType { - /** - * Console message that has been added. - */ - message: Console.ConsoleMessage; - } - } - - export namespace Profiler { - /** - * Profile node. Holds callsite information, execution statistics and child nodes. - */ - export interface ProfileNode { - /** - * Unique id of the node. - */ - id: number; - /** - * Function location. - */ - callFrame: Runtime.CallFrame; - /** - * Number of samples where this node was on top of the call stack. - * @experimental - */ - hitCount?: number; - /** - * Child node ids. - */ - children?: number[]; - /** - * The reason of being not optimized. The function may be deoptimized or marked as don't optimize. - */ - deoptReason?: string; - /** - * An array of source position ticks. - * @experimental - */ - positionTicks?: Profiler.PositionTickInfo[]; - } - - /** - * Profile. - */ - export interface Profile { - /** - * The list of profile nodes. First item is the root node. - */ - nodes: Profiler.ProfileNode[]; - /** - * Profiling start timestamp in microseconds. - */ - startTime: number; - /** - * Profiling end timestamp in microseconds. - */ - endTime: number; - /** - * Ids of samples top nodes. - */ - samples?: number[]; - /** - * Time intervals between adjacent samples in microseconds. The first delta is relative to the profile startTime. - */ - timeDeltas?: number[]; - } - - /** - * Specifies a number of samples attributed to a certain source position. - * @experimental - */ - export interface PositionTickInfo { - /** - * Source line number (1-based). - */ - line: number; - /** - * Number of samples attributed to the source line. - */ - ticks: number; - } - - /** - * Coverage data for a source range. - * @experimental - */ - export interface CoverageRange { - /** - * JavaScript script source offset for the range start. - */ - startOffset: number; - /** - * JavaScript script source offset for the range end. - */ - endOffset: number; - /** - * Collected execution count of the source range. - */ - count: number; - } - - /** - * Coverage data for a JavaScript function. - * @experimental - */ - export interface FunctionCoverage { - /** - * JavaScript function name. - */ - functionName: string; - /** - * Source ranges inside the function with coverage data. - */ - ranges: Profiler.CoverageRange[]; - /** - * Whether coverage data for this function has block granularity. - */ - isBlockCoverage: boolean; - } - - /** - * Coverage data for a JavaScript script. - * @experimental - */ - export interface ScriptCoverage { - /** - * JavaScript script id. - */ - scriptId: Runtime.ScriptId; - /** - * JavaScript script name or url. - */ - url: string; - /** - * Functions contained in the script that has coverage data. - */ - functions: Profiler.FunctionCoverage[]; - } - - export interface SetSamplingIntervalParameterType { - /** - * New sampling interval in microseconds. - */ - interval: number; - } - - export interface StartPreciseCoverageParameterType { - /** - * Collect accurate call counts beyond simple 'covered' or 'not covered'. - */ - callCount?: boolean; - } - - export interface StopReturnType { - /** - * Recorded profile. - */ - profile: Profiler.Profile; - } - - export interface TakePreciseCoverageReturnType { - /** - * Coverage data for the current isolate. - */ - result: Profiler.ScriptCoverage[]; - } - - export interface GetBestEffortCoverageReturnType { - /** - * Coverage data for the current isolate. - */ - result: Profiler.ScriptCoverage[]; - } - - export interface ConsoleProfileStartedEventDataType { - id: string; - /** - * Location of console.profile(). - */ - location: Debugger.Location; - /** - * Profile title passed as an argument to console.profile(). - */ - title?: string; - } - - export interface ConsoleProfileFinishedEventDataType { - id: string; - /** - * Location of console.profileEnd(). - */ - location: Debugger.Location; - profile: Profiler.Profile; - /** - * Profile title passed as an argument to console.profile(). - */ - title?: string; - } - } - - export namespace HeapProfiler { - /** - * Heap snapshot object id. - */ - export type HeapSnapshotObjectId = string; - - /** - * Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes. - */ - export interface SamplingHeapProfileNode { - /** - * Function location. - */ - callFrame: Runtime.CallFrame; - /** - * Allocations size in bytes for the node excluding children. - */ - selfSize: number; - /** - * Child nodes. - */ - children: HeapProfiler.SamplingHeapProfileNode[]; - } - - /** - * Profile. - */ - export interface SamplingHeapProfile { - head: HeapProfiler.SamplingHeapProfileNode; - } - - export interface StartTrackingHeapObjectsParameterType { - trackAllocations?: boolean; - } - - export interface StopTrackingHeapObjectsParameterType { - /** - * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped. - */ - reportProgress?: boolean; - } - - export interface TakeHeapSnapshotParameterType { - /** - * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken. - */ - reportProgress?: boolean; - } - - export interface GetObjectByHeapObjectIdParameterType { - objectId: HeapProfiler.HeapSnapshotObjectId; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string; - } - - export interface AddInspectedHeapObjectParameterType { - /** - * Heap snapshot object id to be accessible by means of $x command line API. - */ - heapObjectId: HeapProfiler.HeapSnapshotObjectId; - } - - export interface GetHeapObjectIdParameterType { - /** - * Identifier of the object to get heap object id for. - */ - objectId: Runtime.RemoteObjectId; - } - - export interface StartSamplingParameterType { - /** - * Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes. - */ - samplingInterval?: number; - } - - export interface GetObjectByHeapObjectIdReturnType { - /** - * Evaluation result. - */ - result: Runtime.RemoteObject; - } - - export interface GetHeapObjectIdReturnType { - /** - * Id of the heap snapshot object corresponding to the passed remote object id. - */ - heapSnapshotObjectId: HeapProfiler.HeapSnapshotObjectId; - } - - export interface StopSamplingReturnType { - /** - * Recorded sampling heap profile. - */ - profile: HeapProfiler.SamplingHeapProfile; - } - - export interface AddHeapSnapshotChunkEventDataType { - chunk: string; - } - - export interface ReportHeapSnapshotProgressEventDataType { - done: number; - total: number; - finished?: boolean; - } - - export interface LastSeenObjectIdEventDataType { - lastSeenObjectId: number; - timestamp: number; + version: string; } - export interface HeapStatsUpdateEventDataType { + export interface GetDomainsReturnType { /** - * An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment. + * List of supported domains. */ - statsUpdate: number[]; + domains: Schema.Domain[]; } } @@ -1673,15 +1902,291 @@ declare module "inspector" { post(method: string, callback?: (err: Error | null, params?: {}) => void): void; /** - * Returns supported domains. + * Does nothing. */ - post(method: "Schema.getDomains", callback?: (err: Error | null, params: Schema.GetDomainsReturnType) => void): void; - /** - * Evaluates expression on global object. - */ - post(method: "Runtime.evaluate", params?: Runtime.EvaluateParameterType, callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; - post(method: "Runtime.evaluate", callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; + post(method: "Console.clearMessages", callback?: (err: Error | null) => void): void; + /** + * Disables console domain, prevents further console messages from being reported to the client. + */ + post(method: "Console.disable", callback?: (err: Error | null) => void): void; + + /** + * Enables console domain, sends the messages collected so far to the client by means of the +`messageAdded` notification. + */ + post(method: "Console.enable", callback?: (err: Error | null) => void): void; + /** + * Continues execution until specific location is reached. + */ + post(method: "Debugger.continueToLocation", params?: Debugger.ContinueToLocationParameterType, callback?: (err: Error | null) => void): void; + post(method: "Debugger.continueToLocation", callback?: (err: Error | null) => void): void; + + /** + * Disables debugger for given page. + */ + post(method: "Debugger.disable", callback?: (err: Error | null) => void): void; + + /** + * Enables debugger for the given page. Clients should not assume that the debugging has been +enabled until the result for this command is received. + */ + post(method: "Debugger.enable", callback?: (err: Error | null, params: Debugger.EnableReturnType) => void): void; + + /** + * Evaluates expression on a given call frame. + */ + post(method: "Debugger.evaluateOnCallFrame", params?: Debugger.EvaluateOnCallFrameParameterType, callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; + post(method: "Debugger.evaluateOnCallFrame", callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; + + /** + * Returns possible locations for breakpoint. scriptId in start and end range locations should be +the same. + */ + post(method: "Debugger.getPossibleBreakpoints", params?: Debugger.GetPossibleBreakpointsParameterType, callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void): void; + post(method: "Debugger.getPossibleBreakpoints", callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void): void; + + /** + * Returns source for the script with given id. + */ + post(method: "Debugger.getScriptSource", params?: Debugger.GetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; + post(method: "Debugger.getScriptSource", callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; + + /** + * Returns stack trace with given `stackTraceId`. + * @experimental + */ + post(method: "Debugger.getStackTrace", params?: Debugger.GetStackTraceParameterType, callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; + post(method: "Debugger.getStackTrace", callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; + + /** + * Stops on the next JavaScript statement. + */ + post(method: "Debugger.pause", callback?: (err: Error | null) => void): void; + + /** + * @experimental + */ + post(method: "Debugger.pauseOnAsyncCall", params?: Debugger.PauseOnAsyncCallParameterType, callback?: (err: Error | null) => void): void; + post(method: "Debugger.pauseOnAsyncCall", callback?: (err: Error | null) => void): void; + + /** + * Removes JavaScript breakpoint. + */ + post(method: "Debugger.removeBreakpoint", params?: Debugger.RemoveBreakpointParameterType, callback?: (err: Error | null) => void): void; + post(method: "Debugger.removeBreakpoint", callback?: (err: Error | null) => void): void; + + /** + * Restarts particular call frame from the beginning. + */ + post(method: "Debugger.restartFrame", params?: Debugger.RestartFrameParameterType, callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; + post(method: "Debugger.restartFrame", callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; + + /** + * Resumes JavaScript execution. + */ + post(method: "Debugger.resume", callback?: (err: Error | null) => void): void; + + /** + * This method is deprecated - use Debugger.stepInto with breakOnAsyncCall and +Debugger.pauseOnAsyncTask instead. Steps into next scheduled async task if any is scheduled +before next pause. Returns success when async task is actually scheduled, returns error if no +task were scheduled or another scheduleStepIntoAsync was called. + * @experimental + */ + post(method: "Debugger.scheduleStepIntoAsync", callback?: (err: Error | null) => void): void; + + /** + * Searches for given string in script content. + */ + post(method: "Debugger.searchInContent", params?: Debugger.SearchInContentParameterType, callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; + post(method: "Debugger.searchInContent", callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; + + /** + * Enables or disables async call stacks tracking. + */ + post(method: "Debugger.setAsyncCallStackDepth", params?: Debugger.SetAsyncCallStackDepthParameterType, callback?: (err: Error | null) => void): void; + post(method: "Debugger.setAsyncCallStackDepth", callback?: (err: Error | null) => void): void; + + /** + * Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in +scripts with url matching one of the patterns. VM will try to leave blackboxed script by +performing 'step in' several times, finally resorting to 'step out' if unsuccessful. + * @experimental + */ + post(method: "Debugger.setBlackboxPatterns", params?: Debugger.SetBlackboxPatternsParameterType, callback?: (err: Error | null) => void): void; + post(method: "Debugger.setBlackboxPatterns", callback?: (err: Error | null) => void): void; + + /** + * Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted +scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. +Positions array contains positions where blackbox state is changed. First interval isn't +blackboxed. Array should be sorted. + * @experimental + */ + post(method: "Debugger.setBlackboxedRanges", params?: Debugger.SetBlackboxedRangesParameterType, callback?: (err: Error | null) => void): void; + post(method: "Debugger.setBlackboxedRanges", callback?: (err: Error | null) => void): void; + + /** + * Sets JavaScript breakpoint at a given location. + */ + post(method: "Debugger.setBreakpoint", params?: Debugger.SetBreakpointParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; + post(method: "Debugger.setBreakpoint", callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; + + /** + * Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this +command is issued, all existing parsed scripts will have breakpoints resolved and returned in +`locations` property. Further matching script parsing will result in subsequent +`breakpointResolved` events issued. This logical breakpoint will survive page reloads. + */ + post(method: "Debugger.setBreakpointByUrl", params?: Debugger.SetBreakpointByUrlParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; + post(method: "Debugger.setBreakpointByUrl", callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; + + /** + * Activates / deactivates all breakpoints on the page. + */ + post(method: "Debugger.setBreakpointsActive", params?: Debugger.SetBreakpointsActiveParameterType, callback?: (err: Error | null) => void): void; + post(method: "Debugger.setBreakpointsActive", callback?: (err: Error | null) => void): void; + + /** + * Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or +no exceptions. Initial pause on exceptions state is `none`. + */ + post(method: "Debugger.setPauseOnExceptions", params?: Debugger.SetPauseOnExceptionsParameterType, callback?: (err: Error | null) => void): void; + post(method: "Debugger.setPauseOnExceptions", callback?: (err: Error | null) => void): void; + + /** + * Changes return value in top frame. Available only at return break position. + * @experimental + */ + post(method: "Debugger.setReturnValue", params?: Debugger.SetReturnValueParameterType, callback?: (err: Error | null) => void): void; + post(method: "Debugger.setReturnValue", callback?: (err: Error | null) => void): void; + + /** + * Edits JavaScript source live. + */ + post(method: "Debugger.setScriptSource", params?: Debugger.SetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; + post(method: "Debugger.setScriptSource", callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; + + /** + * Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc). + */ + post(method: "Debugger.setSkipAllPauses", params?: Debugger.SetSkipAllPausesParameterType, callback?: (err: Error | null) => void): void; + post(method: "Debugger.setSkipAllPauses", callback?: (err: Error | null) => void): void; + + /** + * Changes value of variable in a callframe. Object-based scopes are not supported and must be +mutated manually. + */ + post(method: "Debugger.setVariableValue", params?: Debugger.SetVariableValueParameterType, callback?: (err: Error | null) => void): void; + post(method: "Debugger.setVariableValue", callback?: (err: Error | null) => void): void; + + /** + * Steps into the function call. + */ + post(method: "Debugger.stepInto", params?: Debugger.StepIntoParameterType, callback?: (err: Error | null) => void): void; + post(method: "Debugger.stepInto", callback?: (err: Error | null) => void): void; + + /** + * Steps out of the function call. + */ + post(method: "Debugger.stepOut", callback?: (err: Error | null) => void): void; + + /** + * Steps over the statement. + */ + post(method: "Debugger.stepOver", callback?: (err: Error | null) => void): void; + /** + * Enables console to refer to the node with given id via $x (see Command Line API for more details +$x functions). + */ + post(method: "HeapProfiler.addInspectedHeapObject", params?: HeapProfiler.AddInspectedHeapObjectParameterType, callback?: (err: Error | null) => void): void; + post(method: "HeapProfiler.addInspectedHeapObject", callback?: (err: Error | null) => void): void; + + post(method: "HeapProfiler.collectGarbage", callback?: (err: Error | null) => void): void; + + post(method: "HeapProfiler.disable", callback?: (err: Error | null) => void): void; + + post(method: "HeapProfiler.enable", callback?: (err: Error | null) => void): void; + + post(method: "HeapProfiler.getHeapObjectId", params?: HeapProfiler.GetHeapObjectIdParameterType, callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; + post(method: "HeapProfiler.getHeapObjectId", callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; + + post(method: "HeapProfiler.getObjectByHeapObjectId", params?: HeapProfiler.GetObjectByHeapObjectIdParameterType, callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void): void; + post(method: "HeapProfiler.getObjectByHeapObjectId", callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void): void; + + post(method: "HeapProfiler.getSamplingProfile", callback?: (err: Error | null, params: HeapProfiler.GetSamplingProfileReturnType) => void): void; + + post(method: "HeapProfiler.startSampling", params?: HeapProfiler.StartSamplingParameterType, callback?: (err: Error | null) => void): void; + post(method: "HeapProfiler.startSampling", callback?: (err: Error | null) => void): void; + + post(method: "HeapProfiler.startTrackingHeapObjects", params?: HeapProfiler.StartTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; + post(method: "HeapProfiler.startTrackingHeapObjects", callback?: (err: Error | null) => void): void; + + post(method: "HeapProfiler.stopSampling", callback?: (err: Error | null, params: HeapProfiler.StopSamplingReturnType) => void): void; + + post(method: "HeapProfiler.stopTrackingHeapObjects", params?: HeapProfiler.StopTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; + post(method: "HeapProfiler.stopTrackingHeapObjects", callback?: (err: Error | null) => void): void; + + post(method: "HeapProfiler.takeHeapSnapshot", params?: HeapProfiler.TakeHeapSnapshotParameterType, callback?: (err: Error | null) => void): void; + post(method: "HeapProfiler.takeHeapSnapshot", callback?: (err: Error | null) => void): void; + post(method: "Profiler.disable", callback?: (err: Error | null) => void): void; + + post(method: "Profiler.enable", callback?: (err: Error | null) => void): void; + + /** + * Collect coverage data for the current isolate. The coverage data may be incomplete due to +garbage collection. + */ + post(method: "Profiler.getBestEffortCoverage", callback?: (err: Error | null, params: Profiler.GetBestEffortCoverageReturnType) => void): void; + + /** + * Changes CPU profiler sampling interval. Must be called before CPU profiles recording started. + */ + post(method: "Profiler.setSamplingInterval", params?: Profiler.SetSamplingIntervalParameterType, callback?: (err: Error | null) => void): void; + post(method: "Profiler.setSamplingInterval", callback?: (err: Error | null) => void): void; + + post(method: "Profiler.start", callback?: (err: Error | null) => void): void; + + /** + * Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code +coverage may be incomplete. Enabling prevents running optimized code and resets execution +counters. + */ + post(method: "Profiler.startPreciseCoverage", params?: Profiler.StartPreciseCoverageParameterType, callback?: (err: Error | null) => void): void; + post(method: "Profiler.startPreciseCoverage", callback?: (err: Error | null) => void): void; + + /** + * Enable type profile. + * @experimental + */ + post(method: "Profiler.startTypeProfile", callback?: (err: Error | null) => void): void; + + post(method: "Profiler.stop", callback?: (err: Error | null, params: Profiler.StopReturnType) => void): void; + + /** + * Disable precise code coverage. Disabling releases unnecessary execution count records and allows +executing optimized code. + */ + post(method: "Profiler.stopPreciseCoverage", callback?: (err: Error | null) => void): void; + + /** + * Disable type profile. Disabling releases type profile data collected so far. + * @experimental + */ + post(method: "Profiler.stopTypeProfile", callback?: (err: Error | null) => void): void; + + /** + * Collect coverage data for the current isolate, and resets execution counters. Precise code +coverage needs to have started. + */ + post(method: "Profiler.takePreciseCoverage", callback?: (err: Error | null, params: Profiler.TakePreciseCoverageReturnType) => void): void; + + /** + * Collect type profile. + * @experimental + */ + post(method: "Profiler.takeTypeProfile", callback?: (err: Error | null, params: Profiler.TakeTypeProfileReturnType) => void): void; /** * Add handler to promise with given promise object id. */ @@ -1689,17 +2194,70 @@ declare module "inspector" { post(method: "Runtime.awaitPromise", callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void; /** - * Calls function with given declaration on the given object. Object group of the result is inherited from the target object. + * Calls function with given declaration on the given object. Object group of the result is +inherited from the target object. */ post(method: "Runtime.callFunctionOn", params?: Runtime.CallFunctionOnParameterType, callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; post(method: "Runtime.callFunctionOn", callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; /** - * Returns properties of a given object. Object group of the result is inherited from the target object. + * Compiles expression. + */ + post(method: "Runtime.compileScript", params?: Runtime.CompileScriptParameterType, callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; + post(method: "Runtime.compileScript", callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; + + /** + * Disables reporting of execution contexts creation. + */ + post(method: "Runtime.disable", callback?: (err: Error | null) => void): void; + + /** + * Discards collected exceptions and console API calls. + */ + post(method: "Runtime.discardConsoleEntries", callback?: (err: Error | null) => void): void; + + /** + * Enables reporting of execution contexts creation by means of `executionContextCreated` event. +When the reporting gets enabled the event will be sent immediately for each existing execution +context. + */ + post(method: "Runtime.enable", callback?: (err: Error | null) => void): void; + + /** + * Evaluates expression on global object. + */ + post(method: "Runtime.evaluate", params?: Runtime.EvaluateParameterType, callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; + post(method: "Runtime.evaluate", callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; + + /** + * Returns the isolate id. + * @experimental + */ + post(method: "Runtime.getIsolateId", callback?: (err: Error | null, params: Runtime.GetIsolateIdReturnType) => void): void; + + /** + * Returns the JavaScript heap usage. +It is the total usage of the corresponding isolate not scoped to a particular Runtime. + * @experimental + */ + post(method: "Runtime.getHeapUsage", callback?: (err: Error | null, params: Runtime.GetHeapUsageReturnType) => void): void; + + /** + * Returns properties of a given object. Object group of the result is inherited from the target +object. */ post(method: "Runtime.getProperties", params?: Runtime.GetPropertiesParameterType, callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; post(method: "Runtime.getProperties", callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; + /** + * Returns all let, const and class variables from global scope. + */ + post(method: "Runtime.globalLexicalScopeNames", params?: Runtime.GlobalLexicalScopeNamesParameterType, callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void): void; + post(method: "Runtime.globalLexicalScopeNames", callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void): void; + + post(method: "Runtime.queryObjects", params?: Runtime.QueryObjectsParameterType, callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; + post(method: "Runtime.queryObjects", callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; + /** * Releases remote object with given id. */ @@ -1718,19 +2276,10 @@ declare module "inspector" { post(method: "Runtime.runIfWaitingForDebugger", callback?: (err: Error | null) => void): void; /** - * Enables reporting of execution contexts creation by means of executionContextCreated event. When the reporting gets enabled the event will be sent immediately for each existing execution context. + * Runs script with given id in a given context. */ - post(method: "Runtime.enable", callback?: (err: Error | null) => void): void; - - /** - * Disables reporting of execution contexts creation. - */ - post(method: "Runtime.disable", callback?: (err: Error | null) => void): void; - - /** - * Discards collected exceptions and console API calls. - */ - post(method: "Runtime.discardConsoleEntries", callback?: (err: Error | null) => void): void; + post(method: "Runtime.runScript", params?: Runtime.RunScriptParameterType, callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; + post(method: "Runtime.runScript", callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; /** * @experimental @@ -1739,245 +2288,15 @@ declare module "inspector" { post(method: "Runtime.setCustomObjectFormatterEnabled", callback?: (err: Error | null) => void): void; /** - * Compiles expression. - */ - post(method: "Runtime.compileScript", params?: Runtime.CompileScriptParameterType, callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; - post(method: "Runtime.compileScript", callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; - - /** - * Runs script with given id in a given context. - */ - post(method: "Runtime.runScript", params?: Runtime.RunScriptParameterType, callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; - post(method: "Runtime.runScript", callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; - /** - * Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received. - */ - post(method: "Debugger.enable", callback?: (err: Error | null) => void): void; - - /** - * Disables debugger for given page. - */ - post(method: "Debugger.disable", callback?: (err: Error | null) => void): void; - - /** - * Activates / deactivates all breakpoints on the page. - */ - post(method: "Debugger.setBreakpointsActive", params?: Debugger.SetBreakpointsActiveParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setBreakpointsActive", callback?: (err: Error | null) => void): void; - - /** - * Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc). - */ - post(method: "Debugger.setSkipAllPauses", params?: Debugger.SetSkipAllPausesParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setSkipAllPauses", callback?: (err: Error | null) => void): void; - - /** - * Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in locations property. Further matching script parsing will result in subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads. - */ - post(method: "Debugger.setBreakpointByUrl", params?: Debugger.SetBreakpointByUrlParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; - post(method: "Debugger.setBreakpointByUrl", callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; - - /** - * Sets JavaScript breakpoint at a given location. - */ - post(method: "Debugger.setBreakpoint", params?: Debugger.SetBreakpointParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; - post(method: "Debugger.setBreakpoint", callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; - - /** - * Removes JavaScript breakpoint. - */ - post(method: "Debugger.removeBreakpoint", params?: Debugger.RemoveBreakpointParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.removeBreakpoint", callback?: (err: Error | null) => void): void; - - /** - * Returns possible locations for breakpoint. scriptId in start and end range locations should be the same. + * Terminate current or next JavaScript execution. +Will cancel the termination when the outer-most script execution ends. * @experimental */ - post(method: "Debugger.getPossibleBreakpoints", params?: Debugger.GetPossibleBreakpointsParameterType, callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void): void; - post(method: "Debugger.getPossibleBreakpoints", callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void): void; - + post(method: "Runtime.terminateExecution", callback?: (err: Error | null) => void): void; /** - * Continues execution until specific location is reached. + * Returns supported domains. */ - post(method: "Debugger.continueToLocation", params?: Debugger.ContinueToLocationParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.continueToLocation", callback?: (err: Error | null) => void): void; - - /** - * Steps over the statement. - */ - post(method: "Debugger.stepOver", callback?: (err: Error | null) => void): void; - - /** - * Steps into the function call. - */ - post(method: "Debugger.stepInto", callback?: (err: Error | null) => void): void; - - /** - * Steps out of the function call. - */ - post(method: "Debugger.stepOut", callback?: (err: Error | null) => void): void; - - /** - * Stops on the next JavaScript statement. - */ - post(method: "Debugger.pause", callback?: (err: Error | null) => void): void; - - /** - * Steps into next scheduled async task if any is scheduled before next pause. Returns success when async task is actually scheduled, returns error if no task were scheduled or another scheduleStepIntoAsync was called. - * @experimental - */ - post(method: "Debugger.scheduleStepIntoAsync", callback?: (err: Error | null) => void): void; - - /** - * Resumes JavaScript execution. - */ - post(method: "Debugger.resume", callback?: (err: Error | null) => void): void; - - /** - * Searches for given string in script content. - * @experimental - */ - post(method: "Debugger.searchInContent", params?: Debugger.SearchInContentParameterType, callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; - post(method: "Debugger.searchInContent", callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; - - /** - * Edits JavaScript source live. - */ - post(method: "Debugger.setScriptSource", params?: Debugger.SetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; - post(method: "Debugger.setScriptSource", callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; - - /** - * Restarts particular call frame from the beginning. - */ - post(method: "Debugger.restartFrame", params?: Debugger.RestartFrameParameterType, callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; - post(method: "Debugger.restartFrame", callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; - - /** - * Returns source for the script with given id. - */ - post(method: "Debugger.getScriptSource", params?: Debugger.GetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; - post(method: "Debugger.getScriptSource", callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; - - /** - * Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is none. - */ - post(method: "Debugger.setPauseOnExceptions", params?: Debugger.SetPauseOnExceptionsParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setPauseOnExceptions", callback?: (err: Error | null) => void): void; - - /** - * Evaluates expression on a given call frame. - */ - post(method: "Debugger.evaluateOnCallFrame", params?: Debugger.EvaluateOnCallFrameParameterType, callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; - post(method: "Debugger.evaluateOnCallFrame", callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; - - /** - * Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually. - */ - post(method: "Debugger.setVariableValue", params?: Debugger.SetVariableValueParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setVariableValue", callback?: (err: Error | null) => void): void; - - /** - * Enables or disables async call stacks tracking. - */ - post(method: "Debugger.setAsyncCallStackDepth", params?: Debugger.SetAsyncCallStackDepthParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setAsyncCallStackDepth", callback?: (err: Error | null) => void): void; - - /** - * Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. - * @experimental - */ - post(method: "Debugger.setBlackboxPatterns", params?: Debugger.SetBlackboxPatternsParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setBlackboxPatterns", callback?: (err: Error | null) => void): void; - - /** - * Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted. - * @experimental - */ - post(method: "Debugger.setBlackboxedRanges", params?: Debugger.SetBlackboxedRangesParameterType, callback?: (err: Error | null) => void): void; - post(method: "Debugger.setBlackboxedRanges", callback?: (err: Error | null) => void): void; - /** - * Enables console domain, sends the messages collected so far to the client by means of the messageAdded notification. - */ - post(method: "Console.enable", callback?: (err: Error | null) => void): void; - - /** - * Disables console domain, prevents further console messages from being reported to the client. - */ - post(method: "Console.disable", callback?: (err: Error | null) => void): void; - - /** - * Does nothing. - */ - post(method: "Console.clearMessages", callback?: (err: Error | null) => void): void; - post(method: "Profiler.enable", callback?: (err: Error | null) => void): void; - - post(method: "Profiler.disable", callback?: (err: Error | null) => void): void; - - /** - * Changes CPU profiler sampling interval. Must be called before CPU profiles recording started. - */ - post(method: "Profiler.setSamplingInterval", params?: Profiler.SetSamplingIntervalParameterType, callback?: (err: Error | null) => void): void; - post(method: "Profiler.setSamplingInterval", callback?: (err: Error | null) => void): void; - - post(method: "Profiler.start", callback?: (err: Error | null) => void): void; - - post(method: "Profiler.stop", callback?: (err: Error | null, params: Profiler.StopReturnType) => void): void; - - /** - * Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters. - * @experimental - */ - post(method: "Profiler.startPreciseCoverage", params?: Profiler.StartPreciseCoverageParameterType, callback?: (err: Error | null) => void): void; - post(method: "Profiler.startPreciseCoverage", callback?: (err: Error | null) => void): void; - - /** - * Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code. - * @experimental - */ - post(method: "Profiler.stopPreciseCoverage", callback?: (err: Error | null) => void): void; - - /** - * Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started. - * @experimental - */ - post(method: "Profiler.takePreciseCoverage", callback?: (err: Error | null, params: Profiler.TakePreciseCoverageReturnType) => void): void; - - /** - * Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection. - * @experimental - */ - post(method: "Profiler.getBestEffortCoverage", callback?: (err: Error | null, params: Profiler.GetBestEffortCoverageReturnType) => void): void; - post(method: "HeapProfiler.enable", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.disable", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.startTrackingHeapObjects", params?: HeapProfiler.StartTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.startTrackingHeapObjects", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.stopTrackingHeapObjects", params?: HeapProfiler.StopTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.stopTrackingHeapObjects", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.takeHeapSnapshot", params?: HeapProfiler.TakeHeapSnapshotParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.takeHeapSnapshot", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.collectGarbage", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.getObjectByHeapObjectId", params?: HeapProfiler.GetObjectByHeapObjectIdParameterType, callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void): void; - post(method: "HeapProfiler.getObjectByHeapObjectId", callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void): void; - - /** - * Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions). - */ - post(method: "HeapProfiler.addInspectedHeapObject", params?: HeapProfiler.AddInspectedHeapObjectParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.addInspectedHeapObject", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.getHeapObjectId", params?: HeapProfiler.GetHeapObjectIdParameterType, callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; - post(method: "HeapProfiler.getHeapObjectId", callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; - - post(method: "HeapProfiler.startSampling", params?: HeapProfiler.StartSamplingParameterType, callback?: (err: Error | null) => void): void; - post(method: "HeapProfiler.startSampling", callback?: (err: Error | null) => void): void; - - post(method: "HeapProfiler.stopSampling", callback?: (err: Error | null, params: HeapProfiler.StopSamplingReturnType) => void): void; + post(method: "Schema.getDomains", callback?: (err: Error | null, params: Schema.GetDomainsReturnType) => void): void; // Events @@ -1989,49 +2308,9 @@ declare module "inspector" { addListener(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; /** - * Issued when new execution context is created. + * Issued when new console message is added. */ - addListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - addListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - addListener(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - addListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - addListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - addListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - addListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - addListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - addListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; + addListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; /** * Fired when breakpoint is resolved to an actual script and location. @@ -2049,52 +2328,97 @@ declare module "inspector" { addListener(event: "Debugger.resumed", listener: () => void): this; /** - * Issued when new console message is added. + * Fired when virtual machine fails to parse the script. */ - addListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; + addListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; /** - * Sent when new profile recording is started using console.profile() call. + * Fired when virtual machine parses script. This event is also fired for all known and uncollected +scripts upon enabling debugger. */ - addListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; + addListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - addListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; addListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - addListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; - addListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; - - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - addListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; /** * If heap objects tracking has been started then backend may send update for one or more fragments */ addListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last +seen object id and corresponding timestamp. If the were changes in the heap since last event +then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + addListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; + + addListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; + addListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; + addListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; + + /** + * Sent when new profile recording is started using console.profile() call. + */ + addListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; + + /** + * Issued when console API was called. + */ + addListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; + + /** + * Issued when unhandled exception was revoked. + */ + addListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; + + /** + * Issued when exception was thrown and unhandled. + */ + addListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; + + /** + * Issued when new execution context is created. + */ + addListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; + + /** + * Issued when execution context is destroyed. + */ + addListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; + + /** + * Issued when all executionContexts were cleared in browser + */ + addListener(event: "Runtime.executionContextsCleared", listener: () => void): this; + + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API +call). + */ + addListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; emit(event: "inspectorNotification", message: InspectorNotification<{}>): boolean; - emit(event: "Runtime.executionContextCreated", message: InspectorNotification): boolean; - emit(event: "Runtime.executionContextDestroyed", message: InspectorNotification): boolean; - emit(event: "Runtime.executionContextsCleared"): boolean; - emit(event: "Runtime.exceptionThrown", message: InspectorNotification): boolean; - emit(event: "Runtime.exceptionRevoked", message: InspectorNotification): boolean; - emit(event: "Runtime.consoleAPICalled", message: InspectorNotification): boolean; - emit(event: "Runtime.inspectRequested", message: InspectorNotification): boolean; - emit(event: "Debugger.scriptParsed", message: InspectorNotification): boolean; - emit(event: "Debugger.scriptFailedToParse", message: InspectorNotification): boolean; + emit(event: "Console.messageAdded", message: InspectorNotification): boolean; emit(event: "Debugger.breakpointResolved", message: InspectorNotification): boolean; emit(event: "Debugger.paused", message: InspectorNotification): boolean; emit(event: "Debugger.resumed"): boolean; - emit(event: "Console.messageAdded", message: InspectorNotification): boolean; - emit(event: "Profiler.consoleProfileStarted", message: InspectorNotification): boolean; - emit(event: "Profiler.consoleProfileFinished", message: InspectorNotification): boolean; + emit(event: "Debugger.scriptFailedToParse", message: InspectorNotification): boolean; + emit(event: "Debugger.scriptParsed", message: InspectorNotification): boolean; emit(event: "HeapProfiler.addHeapSnapshotChunk", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.resetProfiles"): boolean; - emit(event: "HeapProfiler.reportHeapSnapshotProgress", message: InspectorNotification): boolean; - emit(event: "HeapProfiler.lastSeenObjectId", message: InspectorNotification): boolean; emit(event: "HeapProfiler.heapStatsUpdate", message: InspectorNotification): boolean; + emit(event: "HeapProfiler.lastSeenObjectId", message: InspectorNotification): boolean; + emit(event: "HeapProfiler.reportHeapSnapshotProgress", message: InspectorNotification): boolean; + emit(event: "HeapProfiler.resetProfiles"): boolean; + emit(event: "Profiler.consoleProfileFinished", message: InspectorNotification): boolean; + emit(event: "Profiler.consoleProfileStarted", message: InspectorNotification): boolean; + emit(event: "Runtime.consoleAPICalled", message: InspectorNotification): boolean; + emit(event: "Runtime.exceptionRevoked", message: InspectorNotification): boolean; + emit(event: "Runtime.exceptionThrown", message: InspectorNotification): boolean; + emit(event: "Runtime.executionContextCreated", message: InspectorNotification): boolean; + emit(event: "Runtime.executionContextDestroyed", message: InspectorNotification): boolean; + emit(event: "Runtime.executionContextsCleared"): boolean; + emit(event: "Runtime.inspectRequested", message: InspectorNotification): boolean; on(event: string, listener: (...args: any[]) => void): this; @@ -2104,49 +2428,9 @@ declare module "inspector" { on(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; /** - * Issued when new execution context is created. + * Issued when new console message is added. */ - on(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - on(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - on(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - on(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - on(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - on(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - on(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - on(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - on(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; + on(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; /** * Fired when breakpoint is resolved to an actual script and location. @@ -2164,29 +2448,74 @@ declare module "inspector" { on(event: "Debugger.resumed", listener: () => void): this; /** - * Issued when new console message is added. + * Fired when virtual machine fails to parse the script. */ - on(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; + on(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; + + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected +scripts upon enabling debugger. + */ + on(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; + + on(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; + + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + on(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; + + /** + * If heap objects tracking has been started then backend regularly sends a current value for last +seen object id and corresponding timestamp. If the were changes in the heap since last event +then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + on(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; + + on(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; + on(event: "HeapProfiler.resetProfiles", listener: () => void): this; + on(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; /** * Sent when new profile recording is started using console.profile() call. */ on(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - on(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - on(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - on(event: "HeapProfiler.resetProfiles", listener: () => void): this; - on(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + on(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + * Issued when unhandled exception was revoked. */ - on(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; + on(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; /** - * If heap objects tracking has been started then backend may send update for one or more fragments + * Issued when exception was thrown and unhandled. */ - on(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; + on(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; + + /** + * Issued when new execution context is created. + */ + on(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; + + /** + * Issued when execution context is destroyed. + */ + on(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; + + /** + * Issued when all executionContexts were cleared in browser + */ + on(event: "Runtime.executionContextsCleared", listener: () => void): this; + + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API +call). + */ + on(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; once(event: string, listener: (...args: any[]) => void): this; @@ -2196,49 +2525,9 @@ declare module "inspector" { once(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; /** - * Issued when new execution context is created. + * Issued when new console message is added. */ - once(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - once(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - once(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - once(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - once(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - once(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - once(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - once(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - once(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; + once(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; /** * Fired when breakpoint is resolved to an actual script and location. @@ -2256,29 +2545,74 @@ declare module "inspector" { once(event: "Debugger.resumed", listener: () => void): this; /** - * Issued when new console message is added. + * Fired when virtual machine fails to parse the script. */ - once(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; + once(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; + + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected +scripts upon enabling debugger. + */ + once(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; + + once(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; + + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + once(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; + + /** + * If heap objects tracking has been started then backend regularly sends a current value for last +seen object id and corresponding timestamp. If the were changes in the heap since last event +then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + once(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; + + once(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; + once(event: "HeapProfiler.resetProfiles", listener: () => void): this; + once(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; /** * Sent when new profile recording is started using console.profile() call. */ once(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - once(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - once(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - once(event: "HeapProfiler.resetProfiles", listener: () => void): this; - once(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + once(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + * Issued when unhandled exception was revoked. */ - once(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; + once(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; /** - * If heap objects tracking has been started then backend may send update for one or more fragments + * Issued when exception was thrown and unhandled. */ - once(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; + once(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; + + /** + * Issued when new execution context is created. + */ + once(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; + + /** + * Issued when execution context is destroyed. + */ + once(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; + + /** + * Issued when all executionContexts were cleared in browser + */ + once(event: "Runtime.executionContextsCleared", listener: () => void): this; + + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API +call). + */ + once(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; @@ -2288,49 +2622,9 @@ declare module "inspector" { prependListener(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; /** - * Issued when new execution context is created. + * Issued when new console message is added. */ - prependListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - prependListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - prependListener(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - prependListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - prependListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - prependListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - prependListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - prependListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - prependListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; + prependListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; /** * Fired when breakpoint is resolved to an actual script and location. @@ -2348,29 +2642,74 @@ declare module "inspector" { prependListener(event: "Debugger.resumed", listener: () => void): this; /** - * Issued when new console message is added. + * Fired when virtual machine fails to parse the script. */ - prependListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; + prependListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; + + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected +scripts upon enabling debugger. + */ + prependListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; + + prependListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; + + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + prependListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; + + /** + * If heap objects tracking has been started then backend regularly sends a current value for last +seen object id and corresponding timestamp. If the were changes in the heap since last event +then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + prependListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; + + prependListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; + prependListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; + prependListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; /** * Sent when new profile recording is started using console.profile() call. */ prependListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - prependListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - prependListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - prependListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; - prependListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + prependListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + * Issued when unhandled exception was revoked. */ - prependListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; + prependListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; /** - * If heap objects tracking has been started then backend may send update for one or more fragments + * Issued when exception was thrown and unhandled. */ - prependListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; + prependListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; + + /** + * Issued when new execution context is created. + */ + prependListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; + + /** + * Issued when execution context is destroyed. + */ + prependListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; + + /** + * Issued when all executionContexts were cleared in browser + */ + prependListener(event: "Runtime.executionContextsCleared", listener: () => void): this; + + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API +call). + */ + prependListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; @@ -2380,49 +2719,9 @@ declare module "inspector" { prependOnceListener(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this; /** - * Issued when new execution context is created. + * Issued when new console message is added. */ - prependOnceListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when execution context is destroyed. - */ - prependOnceListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when all executionContexts were cleared in browser - */ - prependOnceListener(event: "Runtime.executionContextsCleared", listener: () => void): this; - - /** - * Issued when exception was thrown and unhandled. - */ - prependOnceListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when unhandled exception was revoked. - */ - prependOnceListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when console API was called. - */ - prependOnceListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; - - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - prependOnceListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - prependOnceListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; - - /** - * Fired when virtual machine fails to parse the script. - */ - prependOnceListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; /** * Fired when breakpoint is resolved to an actual script and location. @@ -2440,29 +2739,74 @@ declare module "inspector" { prependOnceListener(event: "Debugger.resumed", listener: () => void): this; /** - * Issued when new console message is added. + * Fired when virtual machine fails to parse the script. */ - prependOnceListener(event: "Console.messageAdded", listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification) => void): this; + + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected +scripts upon enabling debugger. + */ + prependOnceListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification) => void): this; + + prependOnceListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; + + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + prependOnceListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; + + /** + * If heap objects tracking has been started then backend regularly sends a current value for last +seen object id and corresponding timestamp. If the were changes in the heap since last event +then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + prependOnceListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; + + prependOnceListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; + prependOnceListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; /** * Sent when new profile recording is started using console.profile() call. */ prependOnceListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: "HeapProfiler.resetProfiles", listener: () => void): this; - prependOnceListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + prependOnceListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification) => void): this; /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + * Issued when unhandled exception was revoked. */ - prependOnceListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification) => void): this; /** - * If heap objects tracking has been started then backend may send update for one or more fragments + * Issued when exception was thrown and unhandled. */ - prependOnceListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification) => void): this; + + /** + * Issued when new execution context is created. + */ + prependOnceListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; + + /** + * Issued when execution context is destroyed. + */ + prependOnceListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; + + /** + * Issued when all executionContexts were cleared in browser + */ + prependOnceListener(event: "Runtime.executionContextsCleared", listener: () => void): this; + + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API +call). + */ + prependOnceListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification) => void): this; } // Top Level API diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index 9c38a5672e..5a87685a68 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -446,6 +446,11 @@ function bufferTests() { const arrUint8: Uint8Array = new Uint8Array(2); const buf5: Buffer = Buffer.from(arrUint8); const buf6: Buffer = Buffer.from(buf1); + const sharedArrayBuffer: SharedArrayBuffer = { + byteLength: 10, + slice: (begin?: number, end?: number) => sharedArrayBuffer + }; + const buf7: Buffer = Buffer.from(sharedArrayBuffer); } // Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]]) @@ -857,6 +862,7 @@ namespace util_tests { var arg0NoResult: () => Promise = util.promisify((cb: (err: Error) => void): void => { }); var arg1: (arg: string) => Promise = util.promisify((arg: string, cb: (err: Error, result: number) => void): void => { }); var arg1NoResult: (arg: string) => Promise = util.promisify((arg: string, cb: (err: Error) => void): void => { }); + var cbOptionalError: () => Promise = util.promisify((cb: (err?: Error | null) => void): void => { cb(); }); assert(typeof util.promisify.custom === 'symbol'); // util.deprecate const foo = () => {}; @@ -1691,7 +1697,8 @@ namespace http_tests { keepAlive: true, keepAliveMsecs: 10000, maxSockets: Infinity, - maxFreeSockets: 256 + maxFreeSockets: 256, + timeout: 15000 }); var agent: http.Agent = http.globalAgent; @@ -1702,7 +1709,25 @@ namespace http_tests { } { + http.get('http://www.example.com/xyz'); http.request('http://www.example.com/xyz'); + + http.get('http://www.example.com/xyz', (res: http.IncomingMessage): void => {}); + http.request('http://www.example.com/xyz', (res: http.IncomingMessage): void => {}); + + http.get(new url.URL('http://www.example.com/xyz')); + http.request(new url.URL('http://www.example.com/xyz')); + + http.get(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {}); + http.request(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {}); + + const opts: http.RequestOptions = { + path: '"/some/path' + }; + http.get(new url.URL('http://www.example.com'), opts); + http.request(new url.URL('http://www.example.com'), opts); + http.get(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {}); + http.request(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {}); } { @@ -1748,7 +1773,8 @@ namespace https_tests { keepAliveMsecs: 10000, maxSockets: Infinity, maxFreeSockets: 256, - maxCachedSessions: 100 + maxCachedSessions: 100, + timeout: 15000 }); var agent: https.Agent = https.globalAgent; @@ -1763,8 +1789,26 @@ namespace https_tests { agent: undefined }); + https.get('http://www.example.com/xyz'); https.request('http://www.example.com/xyz'); + https.get('http://www.example.com/xyz', (res: http.IncomingMessage): void => {}); + https.request('http://www.example.com/xyz', (res: http.IncomingMessage): void => {}); + + https.get(new url.URL('http://www.example.com/xyz')); + https.request(new url.URL('http://www.example.com/xyz')); + + https.get(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {}); + https.request(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {}); + + const opts: https.RequestOptions = { + path: '/some/path' + }; + https.get(new url.URL('http://www.example.com'), opts); + https.request(new url.URL('http://www.example.com'), opts); + https.get(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {}); + https.request(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {}); + https.globalAgent.options.ca = []; { @@ -2322,6 +2366,7 @@ namespace child_process_tests { childProcess.exec("echo test", { windowsHide: true }); childProcess.spawn("echo", ["test"], { windowsHide: true }); childProcess.spawn("echo", ["test"], { windowsHide: true, argv0: "echo-test" }); + childProcess.spawn("echo", ["test"], { stdio: [0xdeadbeef, "inherit", undefined, "pipe"] }); childProcess.spawnSync("echo test"); childProcess.spawnSync("echo test", {windowsVerbatimArguments: false}); childProcess.spawnSync("echo test", {windowsVerbatimArguments: false, argv0: "echo-test"}); @@ -3354,7 +3399,7 @@ namespace dns_tests { const _addresses: string[] = addresses; }); dns.resolve("nodejs.org", "ANY", (err, addresses) => { - const _addresses: ReadonlyArray = addresses; + const _addresses: dns.AnyRecord[] = addresses; }); dns.resolve("nodejs.org", "MX", (err, addresses) => { const _addresses: dns.MxRecord[] = addresses; @@ -3385,6 +3430,14 @@ namespace dns_tests { const _addresses: string[] | dns.RecordWithTtl[] = addresses; }); } + { + const resolver = new dns.Resolver(); + resolver.setServers(["4.4.4.4"]); + resolver.resolve("nodejs.org", (err, addresses) => { + const _addresses: string[] = addresses; + }); + resolver.cancel(); + } } /***************************************************************************** diff --git a/types/node/v8/index.d.ts b/types/node/v8/index.d.ts index 06283dd1dd..729a0c0da8 100644 --- a/types/node/v8/index.d.ts +++ b/types/node/v8/index.d.ts @@ -2465,11 +2465,23 @@ declare module "dns" { ttl: number; } + export interface AnyARecord extends RecordWithTtl { + type: "A"; + } + + export interface AnyAaaaRecord extends RecordWithTtl { + type: "AAAA"; + } + export interface MxRecord { priority: number; exchange: string; } + export interface AnyMxRecord extends MxRecord { + type: "MX"; + } + export interface NaptrRecord { flags: string; service: string; @@ -2479,6 +2491,10 @@ declare module "dns" { preference: number; } + export interface AnyNaptrRecord extends NaptrRecord { + type: "NAPTR"; + } + export interface SoaRecord { nsname: string; hostmaster: string; @@ -2489,6 +2505,10 @@ declare module "dns" { minttl: number; } + export interface AnySoaRecord extends SoaRecord { + type: "SOA"; + } + export interface SrvRecord { priority: number; weight: number; @@ -2496,9 +2516,45 @@ declare module "dns" { name: string; } + export interface AnySrvRecord extends SrvRecord { + type: "SRV"; + } + + export interface AnyTxtRecord { + type: "TXT"; + entries: string[]; + } + + export interface AnyNsRecord { + type: "NS"; + value: string; + } + + export interface AnyPtrRecord { + type: "PTR"; + value: string; + } + + export interface AnyCnameRecord { + type: "CNAME"; + value: string; + } + + export type AnyRecord = AnyARecord | + AnyAaaaRecord | + AnyCnameRecord | + AnyMxRecord | + AnyNaptrRecord | + AnyNsRecord | + AnyPtrRecord | + AnySoaRecord | + AnySrvRecord | + AnyTxtRecord; + export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; export function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; export function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException, addresses: AnyRecord[]) => void): void; export function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; export function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; export function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; @@ -2507,17 +2563,18 @@ declare module "dns" { export function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException, addresses: SoaRecord) => void): void; export function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; export function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; - export function resolve(hostname: string, rrtype: string, callback: (err: NodeJS.ErrnoException, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][]) => void): void; + export function resolve(hostname: string, rrtype: string, callback: (err: NodeJS.ErrnoException, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace resolve { export function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise; + export function __promisify__(hostname: string, rrtype: "ANY"): Promise; export function __promisify__(hostname: string, rrtype: "MX"): Promise; export function __promisify__(hostname: string, rrtype: "NAPTR"): Promise; export function __promisify__(hostname: string, rrtype: "SOA"): Promise; export function __promisify__(hostname: string, rrtype: "SRV"): Promise; export function __promisify__(hostname: string, rrtype: "TXT"): Promise; - export function __promisify__(hostname: string, rrtype?: string): Promise; + export function __promisify__(hostname: string, rrtype: string): Promise; } export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; @@ -2543,16 +2600,53 @@ declare module "dns" { } export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export namespace resolveCname { + export function __promisify__(hostname: string): Promise; + } + export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; + export namespace resolveMx { + export function __promisify__(hostname: string): Promise; + } + export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; + export namespace resolveNaptr { + export function __promisify__(hostname: string): Promise; + } + export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export namespace resolveNs { + export function __promisify__(hostname: string): Promise; + } + export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export namespace resolvePtr { + export function __promisify__(hostname: string): Promise; + } + export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException, address: SoaRecord) => void): void; + export namespace resolveSoa { + export function __promisify__(hostname: string): Promise; + } + export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; + export namespace resolveSrv { + export function __promisify__(hostname: string): Promise; + } + export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; + export namespace resolveTxt { + export function __promisify__(hostname: string): Promise; + } + + export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: AnyRecord[]) => void): void; + export namespace resolveAny { + export function __promisify__(hostname: string): Promise; + } export function reverse(ip: string, callback: (err: NodeJS.ErrnoException, hostnames: string[]) => void): void; export function setServers(servers: string[]): void; + export function getServers(): string[]; // Error codes export var NODATA: string; @@ -2579,6 +2673,25 @@ declare module "dns" { export var LOADIPHLPAPI: string; export var ADDRGETNETWORKPARAMS: string; export var CANCELLED: string; + + export class Resolver { + getServers: typeof getServers; + setServers: typeof setServers; + resolve: typeof resolve; + resolve4: typeof resolve4; + resolve6: typeof resolve6; + resolveAny: typeof resolveAny; + resolveCname: typeof resolveCname; + resolveMx: typeof resolveMx; + resolveNaptr: typeof resolveNaptr; + resolveNs: typeof resolveNs; + resolvePtr: typeof resolvePtr; + resolveSoa: typeof resolveSoa; + resolveSrv: typeof resolveSrv; + resolveTxt: typeof resolveTxt; + reverse: typeof reverse; + cancel(): void; + } } declare module "net" { @@ -5575,17 +5688,17 @@ declare module "util" { export function promisify(fn: CustomPromisify): TCustom; export function promisify(fn: (callback: (err: Error | null, result: TResult) => void) => void): () => Promise; - export function promisify(fn: (callback: (err: Error | null) => void) => void): () => Promise; + export function promisify(fn: (callback: (err?: Error | null) => void) => void): () => Promise; export function promisify(fn: (arg1: T1, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1) => Promise; - export function promisify(fn: (arg1: T1, callback: (err: Error | null) => void) => void): (arg1: T1) => Promise; + export function promisify(fn: (arg1: T1, callback: (err?: Error | null) => void) => void): (arg1: T1) => Promise; export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2) => Promise; export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; export function promisify(fn: Function): Function; export namespace promisify { const custom: symbol; diff --git a/types/node/v8/inspector.d.ts b/types/node/v8/inspector.d.ts index 955239b486..19bba5af01 100644 --- a/types/node/v8/inspector.d.ts +++ b/types/node/v8/inspector.d.ts @@ -244,7 +244,7 @@ declare module "inspector" { */ export interface CallArgument { /** - * Primitive value. + * Primitive value or serializable javascript object. */ value?: any; /** @@ -416,7 +416,7 @@ declare module "inspector" { */ userGesture?: boolean; /** - * Whether execution should wait for promise to be resolved. If the result of evaluation is not a Promise, it's considered to be an error. + * Whether execution should await for resulting value and return once awaited promise is resolved. */ awaitPromise?: boolean; } @@ -468,7 +468,7 @@ declare module "inspector" { */ userGesture?: boolean; /** - * Whether execution should wait for promise to be resolved. If the result of evaluation is not a Promise, it's considered to be an error. + * Whether execution should await for resulting value and return once awaited promise is resolved. */ awaitPromise?: boolean; } @@ -561,11 +561,18 @@ declare module "inspector" { */ generatePreview?: boolean; /** - * Whether execution should wait for promise to be resolved. If the result of evaluation is not a Promise, it's considered to be an error. + * Whether execution should await for resulting value and return once awaited promise is resolved. */ awaitPromise?: boolean; } + export interface QueryObjectsParameterType { + /** + * Identifier of the prototype to return objects for. + */ + prototypeObjectId: Runtime.RemoteObjectId; + } + export interface EvaluateReturnType { /** * Evaluation result. @@ -636,6 +643,13 @@ declare module "inspector" { exceptionDetails?: Runtime.ExceptionDetails; } + export interface QueryObjectsReturnType { + /** + * Array with objects. + */ + objects: Runtime.RemoteObject; + } + export interface ExecutionContextCreatedEventDataType { /** * A newly created execution context. @@ -1476,6 +1490,10 @@ declare module "inspector" { * Collect accurate call counts beyond simple 'covered' or 'not covered'. */ callCount?: boolean; + /** + * Collect block-based coverage. + */ + detailed?: boolean; } export interface StopReturnType { @@ -1749,6 +1767,12 @@ declare module "inspector" { */ post(method: "Runtime.runScript", params?: Runtime.RunScriptParameterType, callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; post(method: "Runtime.runScript", callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; + + /** + * @experimental + */ + post(method: "Runtime.queryObjects", params?: Runtime.QueryObjectsParameterType, callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; + post(method: "Runtime.queryObjects", callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; /** * Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received. */ diff --git a/types/node/v8/node-tests.ts b/types/node/v8/node-tests.ts index 9cec14a88e..e1d14b9089 100644 --- a/types/node/v8/node-tests.ts +++ b/types/node/v8/node-tests.ts @@ -819,6 +819,8 @@ namespace util_tests { var arg0NoResult: () => Promise = util.promisify((cb: (err: Error) => void): void => { }); var arg1: (arg: string) => Promise = util.promisify((arg: string, cb: (err: Error, result: number) => void): void => { }); var arg1NoResult: (arg: string) => Promise = util.promisify((arg: string, cb: (err: Error) => void): void => { }); + // The following test requires typescript >= 2.4, but definitions currently tested with typescript@2.1 + // var cbOptionalError: () => Promise = util.promisify((cb: (err?: Error | null) => void): void => { cb(); }); assert(typeof util.promisify.custom === 'symbol'); // util.deprecate const foo = () => {}; @@ -3127,6 +3129,14 @@ namespace dns_tests { const _addresses: string[] | dns.RecordWithTtl[] = addresses; }); } + { + const resolver = new dns.Resolver(); + resolver.setServers(["4.4.4.4"]); + resolver.resolve("nodejs.org", (err, addresses) => { + const _addresses: string[] = addresses; + }); + resolver.cancel(); + } } /***************************************************************************** diff --git a/types/node/v9/index.d.ts b/types/node/v9/index.d.ts index aed5a0f9a0..ba7347e849 100644 --- a/types/node/v9/index.d.ts +++ b/types/node/v9/index.d.ts @@ -2547,11 +2547,23 @@ declare module "dns" { ttl: number; } + export interface AnyARecord extends RecordWithTtl { + type: "A"; + } + + export interface AnyAaaaRecord extends RecordWithTtl { + type: "AAAA"; + } + export interface MxRecord { priority: number; exchange: string; } + export interface AnyMxRecord extends MxRecord { + type: "MX"; + } + export interface NaptrRecord { flags: string; service: string; @@ -2561,6 +2573,10 @@ declare module "dns" { preference: number; } + export interface AnyNaptrRecord extends NaptrRecord { + type: "NAPTR"; + } + export interface SoaRecord { nsname: string; hostmaster: string; @@ -2571,6 +2587,10 @@ declare module "dns" { minttl: number; } + export interface AnySoaRecord extends SoaRecord { + type: "SOA"; + } + export interface SrvRecord { priority: number; weight: number; @@ -2578,9 +2598,45 @@ declare module "dns" { name: string; } + export interface AnySrvRecord extends SrvRecord { + type: "SRV"; + } + + export interface AnyTxtRecord { + type: "TXT"; + entries: string[]; + } + + export interface AnyNsRecord { + type: "NS"; + value: string; + } + + export interface AnyPtrRecord { + type: "PTR"; + value: string; + } + + export interface AnyCnameRecord { + type: "CNAME"; + value: string; + } + + export type AnyRecord = AnyARecord | + AnyAaaaRecord | + AnyCnameRecord | + AnyMxRecord | + AnyNaptrRecord | + AnyNsRecord | + AnyPtrRecord | + AnySoaRecord | + AnySrvRecord | + AnyTxtRecord; + export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; export function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; export function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException, addresses: AnyRecord[]) => void): void; export function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; export function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; export function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; @@ -2589,17 +2645,18 @@ declare module "dns" { export function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException, addresses: SoaRecord) => void): void; export function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; export function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; - export function resolve(hostname: string, rrtype: string, callback: (err: NodeJS.ErrnoException, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][]) => void): void; + export function resolve(hostname: string, rrtype: string, callback: (err: NodeJS.ErrnoException, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace resolve { export function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise; + export function __promisify__(hostname: string, rrtype: "ANY"): Promise; export function __promisify__(hostname: string, rrtype: "MX"): Promise; export function __promisify__(hostname: string, rrtype: "NAPTR"): Promise; export function __promisify__(hostname: string, rrtype: "SOA"): Promise; export function __promisify__(hostname: string, rrtype: "SRV"): Promise; export function __promisify__(hostname: string, rrtype: "TXT"): Promise; - export function __promisify__(hostname: string, rrtype?: string): Promise; + export function __promisify__(hostname: string, rrtype: string): Promise; } export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; @@ -2625,16 +2682,53 @@ declare module "dns" { } export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export namespace resolveCname { + export function __promisify__(hostname: string): Promise; + } + export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; + export namespace resolveMx { + export function __promisify__(hostname: string): Promise; + } + export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; + export namespace resolveNaptr { + export function __promisify__(hostname: string): Promise; + } + export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export namespace resolveNs { + export function __promisify__(hostname: string): Promise; + } + export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export namespace resolvePtr { + export function __promisify__(hostname: string): Promise; + } + export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException, address: SoaRecord) => void): void; + export namespace resolveSoa { + export function __promisify__(hostname: string): Promise; + } + export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; + export namespace resolveSrv { + export function __promisify__(hostname: string): Promise; + } + export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; + export namespace resolveTxt { + export function __promisify__(hostname: string): Promise; + } + + export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: AnyRecord[]) => void): void; + export namespace resolveAny { + export function __promisify__(hostname: string): Promise; + } export function reverse(ip: string, callback: (err: NodeJS.ErrnoException, hostnames: string[]) => void): void; export function setServers(servers: string[]): void; + export function getServers(): string[]; // Error codes export var NODATA: string; @@ -2661,6 +2755,25 @@ declare module "dns" { export var LOADIPHLPAPI: string; export var ADDRGETNETWORKPARAMS: string; export var CANCELLED: string; + + export class Resolver { + getServers: typeof getServers; + setServers: typeof setServers; + resolve: typeof resolve; + resolve4: typeof resolve4; + resolve6: typeof resolve6; + resolveAny: typeof resolveAny; + resolveCname: typeof resolveCname; + resolveMx: typeof resolveMx; + resolveNaptr: typeof resolveNaptr; + resolveNs: typeof resolveNs; + resolvePtr: typeof resolvePtr; + resolveSoa: typeof resolveSoa; + resolveSrv: typeof resolveSrv; + resolveTxt: typeof resolveTxt; + reverse: typeof reverse; + cancel(): void; + } } declare module "net" { @@ -5659,17 +5772,17 @@ declare module "util" { export function promisify(fn: CustomPromisify): TCustom; export function promisify(fn: (callback: (err: Error | null, result: TResult) => void) => void): () => Promise; - export function promisify(fn: (callback: (err: Error | null) => void) => void): () => Promise; + export function promisify(fn: (callback: (err?: Error | null) => void) => void): () => Promise; export function promisify(fn: (arg1: T1, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1) => Promise; - export function promisify(fn: (arg1: T1, callback: (err: Error | null) => void) => void): (arg1: T1) => Promise; + export function promisify(fn: (arg1: T1, callback: (err?: Error | null) => void) => void): (arg1: T1) => Promise; export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2) => Promise; export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; export function promisify(fn: Function): Function; export namespace promisify { const custom: symbol; diff --git a/types/node/v9/inspector.d.ts b/types/node/v9/inspector.d.ts index 955239b486..7088455c8c 100644 --- a/types/node/v9/inspector.d.ts +++ b/types/node/v9/inspector.d.ts @@ -244,7 +244,7 @@ declare module "inspector" { */ export interface CallArgument { /** - * Primitive value. + * Primitive value or serializable javascript object. */ value?: any; /** @@ -416,7 +416,7 @@ declare module "inspector" { */ userGesture?: boolean; /** - * Whether execution should wait for promise to be resolved. If the result of evaluation is not a Promise, it's considered to be an error. + * Whether execution should await for resulting value and return once awaited promise is resolved. */ awaitPromise?: boolean; } @@ -468,7 +468,7 @@ declare module "inspector" { */ userGesture?: boolean; /** - * Whether execution should wait for promise to be resolved. If the result of evaluation is not a Promise, it's considered to be an error. + * Whether execution should await for resulting value and return once awaited promise is resolved. */ awaitPromise?: boolean; } @@ -561,11 +561,25 @@ declare module "inspector" { */ generatePreview?: boolean; /** - * Whether execution should wait for promise to be resolved. If the result of evaluation is not a Promise, it's considered to be an error. + * Whether execution should await for resulting value and return once awaited promise is resolved. */ awaitPromise?: boolean; } + export interface QueryObjectsParameterType { + /** + * Identifier of the prototype to return objects for. + */ + prototypeObjectId: Runtime.RemoteObjectId; + } + + export interface GlobalLexicalScopeNamesParameterType { + /** + * Specifies in which execution context to lookup global scope variables. + */ + executionContextId?: Runtime.ExecutionContextId; + } + export interface EvaluateReturnType { /** * Evaluation result. @@ -636,6 +650,17 @@ declare module "inspector" { exceptionDetails?: Runtime.ExceptionDetails; } + export interface QueryObjectsReturnType { + /** + * Array with objects. + */ + objects: Runtime.RemoteObject; + } + + export interface GlobalLexicalScopeNamesReturnType { + names: string[]; + } + export interface ExecutionContextCreatedEventDataType { /** * A newly created execution context. @@ -1476,6 +1501,10 @@ declare module "inspector" { * Collect accurate call counts beyond simple 'covered' or 'not covered'. */ callCount?: boolean; + /** + * Collect block-based coverage. + */ + detailed?: boolean; } export interface StopReturnType { @@ -1749,6 +1778,19 @@ declare module "inspector" { */ post(method: "Runtime.runScript", params?: Runtime.RunScriptParameterType, callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; post(method: "Runtime.runScript", callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; + + /** + * @experimental + */ + post(method: "Runtime.queryObjects", params?: Runtime.QueryObjectsParameterType, callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; + post(method: "Runtime.queryObjects", callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; + + /** + * Returns all let, const and class variables from global scope. + * @experimental + */ + post(method: "Runtime.globalLexicalScopeNames", params?: Runtime.GlobalLexicalScopeNamesParameterType, callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void): void; + post(method: "Runtime.globalLexicalScopeNames", callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void): void; /** * Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received. */ diff --git a/types/node/v9/node-tests.ts b/types/node/v9/node-tests.ts index 3d7861f532..03f641e216 100644 --- a/types/node/v9/node-tests.ts +++ b/types/node/v9/node-tests.ts @@ -845,6 +845,7 @@ namespace util_tests { var arg0NoResult: () => Promise = util.promisify((cb: (err: Error) => void): void => { }); var arg1: (arg: string) => Promise = util.promisify((arg: string, cb: (err: Error, result: number) => void): void => { }); var arg1NoResult: (arg: string) => Promise = util.promisify((arg: string, cb: (err: Error) => void): void => { }); + var cbOptionalError: () => Promise = util.promisify((cb: (err?: Error | null) => void): void => { cb(); }); assert(typeof util.promisify.custom === 'symbol'); // util.deprecate const foo = () => {}; @@ -3160,6 +3161,14 @@ namespace dns_tests { const _addresses: string[] | dns.RecordWithTtl[] = addresses; }); } + { + const resolver = new dns.Resolver(); + resolver.setServers(["4.4.4.4"]); + resolver.resolve("nodejs.org", (err, addresses) => { + const _addresses: string[] = addresses; + }); + resolver.cancel(); + } } /***************************************************************************** diff --git a/types/nunjucks/index.d.ts b/types/nunjucks/index.d.ts index d307bd27d5..13869f0d60 100644 --- a/types/nunjucks/index.d.ts +++ b/types/nunjucks/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for nunjucks 3.0 +// Type definitions for nunjucks 3.1 // Project: http://mozilla.github.io/nunjucks/ // Definitions by: Ruben Slabbert // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -95,6 +95,7 @@ export function installJinjaCompat(): void; export interface ILoader { async?: boolean; getSource(name: string): LoaderSource; + getSource(name: string, callback: (err?: any, result?: LoaderSource) => void): void; extend?(extender: ILoader): ILoader; } @@ -128,7 +129,7 @@ export class FileSystemLoader extends Loader implements ILoader { constructor(searchPaths?: string | string[], opts?: FileSystemLoaderOptions); } -export class WebLoader implements ILoader { +export class WebLoader extends Loader implements ILoader { constructor(baseUrl: string, opts?: any); getSource(name: string): LoaderSource; } @@ -137,3 +138,13 @@ export class PrecompiledLoader extends Loader implements ILoader { init(searchPaths: string[], opts: any): void; getSource(name: string): LoaderSource; } + +export namespace runtime { + class SafeString { + constructor(val: string); + val: string; + length: number; + valueOf(): string; + toString(): string; + } +} diff --git a/types/nunjucks/nunjucks-tests.ts b/types/nunjucks/nunjucks-tests.ts index 9f3afcddfe..6dd4d8fed7 100644 --- a/types/nunjucks/nunjucks-tests.ts +++ b/types/nunjucks/nunjucks-tests.ts @@ -52,3 +52,5 @@ class MyLoader extends nunjucks.Loader implements nunjucks.ILoader { } env = new nunjucks.Environment(new MyLoader()); + +new nunjucks.runtime.SafeString("an unsafe string"); diff --git a/types/nunjucks/tslint.json b/types/nunjucks/tslint.json index 2c7c1bed53..65fb79195f 100644 --- a/types/nunjucks/tslint.json +++ b/types/nunjucks/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "interface-name": false + "interface-name": false, + "no-unnecessary-class": false // to allow SafeString class } } diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index f3bd6b3681..490063fb77 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -231,7 +231,7 @@ declare namespace Office { resolve(value: T | PromiseLike): Promise; /** - * Creates a new resolved promise . + * Creates a new resolved promise. * @returns A resolved promise. */ resolve(): Promise; @@ -244,9 +244,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -263,21 +265,26 @@ declare namespace Office { /** * Occurs when the runtime environment is loaded and the add-in is ready to start interacting with the application and hosted document. * - * The reason parameter of the initialize event listener function returns an `InitializationReason` enumeration value that specifies how initialization occurred. A task pane or content add-in can be initialized in two ways: + * The reason parameter of the initialize event listener function returns an `InitializationReason` enumeration value that specifies how + * initialization occurred. A task pane or content add-in can be initialized in two ways: * - * - The user just inserted it from Recently Used Add-ins section of the Add-in drop-down list on the Insert tab of the ribbon in the Office host application, or from Insert add-in dialog box. + * - The user just inserted it from Recently Used Add-ins section of the Add-in drop-down list on the Insert tab of the ribbon in the Office + * host application, or from Insert add-in dialog box. * * - The user opened a document that already contains the add-in. * - * *Note*: The reason parameter of the initialize event listener function only returns an `InitializationReason` enumeration value for task pane and content add-ins. It does not return a value for Outlook add-ins. + * *Note*: The reason parameter of the initialize event listener function only returns an `InitializationReason` enumeration value for task pane + * and content add-ins. It does not return a value for Outlook add-ins. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -294,9 +301,13 @@ declare namespace Office { */ function initialize(reason: InitializationReason): void; /** - * Ensures that the Office JavaScript APIs are ready to be called by the add-in. If the framework hasn't initialized yet, the callback or promise will wait until the Office host is ready to accept API calls. - * Note that though this API is intended to be used inside an Office add-in, it can also be used outside the add-in. In that case, once Office.js determines that it is running outside of an Office host application, it will call the callback and resolve the promise with "null" for both the host and platform. - * @param callback - An optional callback method, that will receive the host and platform info. Alternatively, rather than use a callback, an add-in may simply wait for the Promise returned by the function to resolve. + * Ensures that the Office JavaScript APIs are ready to be called by the add-in. If the framework hasn't initialized yet, the callback or promise + * will wait until the Office host is ready to accept API calls. Note that though this API is intended to be used inside an Office add-in, it can + * also be used outside the add-in. In that case, once Office.js determines that it is running outside of an Office host application, it will call + * the callback and resolve the promise with "null" for both the host and platform. + * + * @param callback - An optional callback method, that will receive the host and platform info. + * Alternatively, rather than use a callback, an add-in may simply wait for the Promise returned by the function to resolve. * @returns A Promise that contains the host and platform info, once initialization is completed. */ function onReady(callback?: (info: { host: HostType, platform: PlatformType }) => any): Promise<{ host: HostType, platform: PlatformType }>; @@ -307,9 +318,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -335,9 +348,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -367,9 +382,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -396,9 +413,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -449,9 +468,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -498,19 +519,24 @@ declare namespace Office { * @remarks *
HostsAccess, Excel, Outlook, PowerPoint, Project, Word
* - * When the function you pass to the `callback` parameter of an "Async" method executes, it receives an AsyncResult object that you can access from the `callback` function's only parameter. + * When the function you pass to the `callback` parameter of an "Async" method executes, it receives an AsyncResult object that you can access + * from the `callback` function's only parameter. */ - interface AsyncResult { + interface AsyncResult { /** - * Gets the user-defined item passed to the optional `asyncContext` parameter of the invoked method in the same state as it was passed in. This returns the user-defined item (which can be of any JavaScript type: String, Number, Boolean, Object, Array, Null, or Undefined) passed to the optional `asyncContext` parameter of the invoked method. Returns Undefined, if you didn't pass anything to the asyncContext parameter. + * Gets the user-defined item passed to the optional `asyncContext` parameter of the invoked method in the same state as it was passed in. + * This returns the user-defined item (which can be of any JavaScript type: String, Number, Boolean, Object, Array, Null, or Undefined) passed + * to the optional `asyncContext` parameter of the invoked method. Returns Undefined, if you didn't pass anything to the asyncContext parameter. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -531,9 +557,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -554,9 +582,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -574,16 +604,19 @@ declare namespace Office { * Gets the payload or content of this asynchronous operation, if any. * * @remarks - * You access the AsyncResult object in the function passed as the argument to the callback parameter of an "Async" method, such as the `getSelectedDataAsync` and `setSelectedDataAsync` methods of the {@link Office.Document | Document} object. + * You access the AsyncResult object in the function passed as the argument to the callback parameter of an "Async" method, such as the + * `getSelectedDataAsync` and `setSelectedDataAsync` methods of the {@link Office.Document | Document} object. * * Note: What the value property returns for a particular "Async" method varies depending on the purpose and context of that method. * To determine what is returned by the value property for an "Async" method, refer to the "Callback value" section of the method's topic. * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -596,10 +629,11 @@ declare namespace Office { * *
Word Y Y Y
*/ - value: any; + value: T; } /** * Represents the runtime environment of the add-in and provides access to key objects of the API. + * The current context exists as a property of Office. It is accessed using `Office.context`. * * @remarks *
HostsAccess, Excel, Outlook, PowerPoint, Project, Word
@@ -613,13 +647,17 @@ declare namespace Office { * True, if the current platform allows the add-in to display a UI for selling or upgrading; otherwise returns False. * * @remarks - * The iOS App Store doesn't support apps with add-ins that provide links to additional payment systems. However, Office Add-ins running on the Windows desktop or for Office Online in the browser do allow such links. If you want the UI of your add-in to provide a link to an external payment system on platforms other than iOS, you can use the commerceAllowed property to control when that link is displayed. + * The iOS App Store doesn't support apps with add-ins that provide links to additional payment systems. However, Office Add-ins running on + * the Windows desktop or for Office Online in the browser do allow such links. If you want the UI of your add-in to provide a link to an + * external payment system on platforms other than iOS, you can use the commerceAllowed property to control when that link is displayed. * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -633,15 +671,18 @@ declare namespace Office { * Gets the locale (language) specified by the user for editing the document or item. * * @remarks - * The `contentLanguage` value reflects the **Editing Language** setting specified with **File > Options > Language** in the Office host application. + * The `contentLanguage` value reflects the **Editing Language** setting specified with **File > Options > Language** in the Office host + * application. * * In content add-ins for Access web apps, the `contentLanguage` property gets the add-in culture (e.g., "en-GB"). * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -666,7 +707,8 @@ declare namespace Office { * * The returned value is a string in the RFC 1766 Language tag format, such as en-US. * - * The `displayLanguage` value reflects the current **Display Language** setting specified with **File > Options > Language** in the Office host application. + * The `displayLanguage` value reflects the current **Display Language** setting specified with **File > Options > Language** in the Office + * host application. * * In content add-ins for Access web apps, the `displayLanguage property` gets the add-in language (e.g., "en-US"). * @@ -674,9 +716,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -697,9 +741,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -754,7 +800,8 @@ declare namespace Office { /** * Gets an object that represents the custom settings or state of a mail add-in saved to a user's mailbox. * - * The RoamingSettings object lets you store and access data for a mail add-in that is stored in a user's mailbox, so that is available to that add-in when it is running from any host client application used to access that mailbox. + * The RoamingSettings object lets you store and access data for a mail add-in that is stored in a user's mailbox, so that is available to + * that add-in when it is running from any host client application used to access that mailbox. * * [Api set: Mailbox 1.0] * @@ -765,16 +812,20 @@ declare namespace Office { */ roamingSettings: Office.RoamingSettings; /** - * Specifies whether the platform and device allows touch interaction. True if the add-in is running on a touch device, such as an iPad; false otherwise. + * Specifies whether the platform and device allows touch interaction. + * True if the add-in is running on a touch device, such as an iPad; false otherwise. * * @remarks - * Use the touchEnabled property to determine when your add-in is running on a touch device and if necessary, adjust the kind of controls, and size and spacing of elements in your add-in's UI to accommodate touch interactions. + * Use the touchEnabled property to determine when your add-in is running on a touch device and if necessary, adjust the kind of controls, and + * size and spacing of elements in your add-in's UI to accommodate touch interactions. * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -794,13 +845,16 @@ declare namespace Office { * Provides specific information about an error that occurred during an asynchronous data operation. * * @remarks - * The Error object is accessed from the AsyncResult object that is returned in the function passed as the callback argument of an asynchronous data operation, such as the setSelectedDataAsync method of the Document object. + * The Error object is accessed from the AsyncResult object that is returned in the function passed as the callback argument of an asynchronous + * data operation, such as the setSelectedDataAsync method of the Document object. * * **Support details** * - * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this interface. + * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this interface. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -829,7 +883,8 @@ declare namespace Office { } namespace AddinCommands { /** - * The event object is passed as a parameter to add-in functions invoked by UI-less command buttons. The object allows the add-in to identify which button was clicked and to signal the host that it has completed its processing. + * The event object is passed as a parameter to add-in functions invoked by UI-less command buttons. The object allows the add-in to identify + * which button was clicked and to signal the host that it has completed its processing. * * @remarks * @@ -846,9 +901,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this property. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this property. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -860,7 +917,10 @@ declare namespace Office { /** * Indicates that the add-in has completed processing that was triggered by an add-in command button or event handler. * - * This method must be called at the end of a function which was invoked by an add-in command defined with an Action element with an xsi:type attribute set to ExecuteFunction. Calling this method signals the host client that the function is complete and that it can clean up any state involved with invoking the function. For example, if the user closes Outlook before this method is called, Outlook will warn that a function is still executing. + * This method must be called at the end of a function which was invoked by an add-in command defined with an Action element with an + * xsi:type attribute set to ExecuteFunction. Calling this method signals the host client that the function is complete and that it can + * clean up any state involved with invoking the function. For example, if the user closes Outlook before this method is called, Outlook + * will warn that a function is still executing. * * This method must be called in an event handler added via Office.context.mailbox.addHandlerAsync after completing processing of the event. * @@ -874,9 +934,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -888,7 +950,9 @@ declare namespace Office { *
* * @param options Optional. An object literal that contains one or more of the following properties. - * allowEvent: A boolean value. When the completed method is used to signal completion of an event handler, this value indicates of the handled event should continue execution or be canceled. For example, an add-in that handles the ItemSend event can set allowEvent = false to cancel sending of the message. + * allowEvent: A boolean value. When the completed method is used to signal completion of an event handler, + * this value indicates of the handled event should continue execution or be canceled. + * For example, an add-in that handles the ItemSend event can set allowEvent = false to cancel sending of the message. */ completed(options?: any): void; } @@ -899,7 +963,8 @@ declare namespace Office { interface Source { /** - * The id of the control that triggered calling this function. The id comes from the manifest and is the unique ID of your Office Add-in as a GUID. + * The id of the control that triggered calling this function. The id comes from the manifest and is the unique ID of your Office Add-in + * as a GUID. */ id: string; } @@ -907,7 +972,8 @@ declare namespace Office { /** * Provides objects and methods that you can use to create and manipulate UI components, such as dialog boxes, in your Office Add-ins. * - * Visit "{@link https://docs.microsoft.com/office/dev/add-ins/develop/dialog-api-in-office-add-ins | Use the Dialog API in your Office Add-ins}" for more information. + * Visit "{@link https://docs.microsoft.com/office/dev/add-ins/develop/dialog-api-in-office-add-ins | Use the Dialog API in your Office Add-ins}" + * for more information. */ interface UI { /** @@ -918,10 +984,12 @@ declare namespace Office { * * Requirement setsDialogApi, Mailbox 1.4 * - * This method is available in the DialogApi requirement set for Word, Excel, or PowerPoint add-ins, and in the Mailbox requirement set 1.4 for Outlook. - * For more on how to specify a requirement set in your manifest, see {@link https://docs.microsoft.com/en-us/office/dev/add-ins/develop/specify-office-hosts-and-api-requirements | Specify Office hosts and API requirements}. + * This method is available in the DialogApi requirement set for Word, Excel, or PowerPoint add-ins, and in the Mailbox requirement set 1.4 + * for Outlook. For more on how to specify a requirement set in your manifest, see + * {@link https://docs.microsoft.com/en-us/office/dev/add-ins/develop/specify-office-hosts-and-api-requirements | Specify Office hosts and API requirements}. * - * The initial page must be on the same domain as the parent page (the startAddress parameter). After the initial page loads, you can go to other domains. + * The initial page must be on the same domain as the parent page (the startAddress parameter). After the initial page loads, you can go to + * other domains. * * Any page calling `office.context.ui.messageParent` must also be on the same domain as the parent page. * @@ -929,7 +997,8 @@ declare namespace Office { * * The following design considerations apply to dialog boxes: * - * - An Office Add-in task pane can have only one dialog box open at any time. Multiple dialogs can be open at the same time from Add-in Commands (custom ribbon buttons or menu items). + * - An Office Add-in task pane can have only one dialog box open at any time. Multiple dialogs can be open at the same time from Add-in + * Commands (custom ribbon buttons or menu items). * * - Every dialog box can be moved and resized by the user. * @@ -941,13 +1010,15 @@ declare namespace Office { * * - Display authentication pages to collect user credentials. * - * - Display an error/progress/input screen from a ShowTaspane or ExecuteAction command. + * - Display an error/progress/input screen from a ShowTaskpane or ExecuteAction command. * * - Temporarily increase the surface area that a user has available to complete a task. * * Do not use a dialog box to interact with a document. Use a task pane instead. * - * For a design pattern that you can use to create a dialog box, see {@link https://github.com/OfficeDev/Office-Add-in-UX-Design-Patterns/blob/master/Patterns/Client_Dialog.md | Client Dialog} in the Office Add-in UX Design Patterns repository on GitHub. + * For a design pattern that you can use to create a dialog box, see + * {@link https://github.com/OfficeDev/Office-Add-in-UX-Design-Patterns/blob/master/Patterns/Client_Dialog.md | Client Dialog} in the Office + * Add-in UX Design Patterns repository on GitHub. * * **displayDialogAsync Errors**: * @@ -970,7 +1041,8 @@ declare namespace Office { * * * - * In the callback function passed to the displayDialogAsync method, you can use the properties of the AsyncResult object to return the following information. + * In the callback function passed to the displayDialogAsync method, you can use the properties of the AsyncResult object to return the + * following information. * * * @@ -987,7 +1059,7 @@ declare namespace Office { * * * - * * * * @@ -999,7 +1071,7 @@ declare namespace Office { * @param options - Optional. Accepts an {@link Office.DialogOptions} object to define dialog display. * @param callback - Optional. Accepts a callback method to handle the dialog creation attempt. If successful, the AsyncResult.value is a Dialog object. */ - displayDialogAsync(startAddress: string, options?: DialogOptions, callback?: (result: AsyncResult) => void): void; + displayDialogAsync(startAddress: string, options?: DialogOptions, callback?: (result: AsyncResult) => void): void; /** * Delivers a message from the dialog box to its parent/opener page. The page calling this API must be on the same domain as the parent. * @param messageObject Accepts a message from the dialog to deliver to the add-in. @@ -1015,7 +1087,8 @@ declare namespace Office { * * - Called from a UI-less command button: No effect. Any dialog opened by displayDialogAsync will remain open. * - * - Called from a taskpane: The taskpane will close. Any dialog opened by displayDialogAsync will also close. If the taskpane supports pinning and was pinned by the user, it will be un-pinned. + * - Called from a taskpane: The taskpane will close. Any dialog opened by displayDialogAsync will also close. + * If the taskpane supports pinning and was pinned by the user, it will be un-pinned. * * - Called from a module extension: No effect. */ @@ -1047,7 +1120,10 @@ declare namespace Office { */ width?: number, /** - * Determines whether the dialog box should be displayed within an IFrame. This setting is only applicable in Office Online clients, and is ignored by other platforms. If false (default), the dialog will be displayed as a new browser window (pop-up). Recommended for authentication pages that cannot be displayed in an IFrame. If true, the dialog will be displayed as a floating overlay with an IFrame. This is best for user experience and performance. + * Determines whether the dialog box should be displayed within an IFrame. This setting is only applicable in Office Online clients, and is + * ignored by other platforms. If false (default), the dialog will be displayed as a new browser window (pop-up). Recommended for + * authentication pages that cannot be displayed in an IFrame. If true, the dialog will be displayed as a floating overlay with an IFrame. + * This is best for user experience and performance. */ displayInIframe?: boolean /** @@ -1056,26 +1132,32 @@ declare namespace Office { asyncContext?: any } /** - * The Office Auth namespace, Office.context.auth, provides a method that allows the Office host to obtain and access the add-in token. Indirectly, enable the add-in to access the signed-in user's Microsoft Graph data without requiring the user to sign in a second time. + * The Office Auth namespace, Office.context.auth, provides a method that allows the Office host to obtain and access the add-in token. + * Indirectly, enable the add-in to access the signed-in user's Microsoft Graph data without requiring the user to sign in a second time. */ interface Auth { /** - * Calls the Azure Active Directory V 2.0 endpoint to get an access token to your add-in's web application. Allows add-ins to identify users. Server side code can use this token to access Microsoft Graph for the add-in's web application by using the {@link https://docs.microsoft.com/azure/active-directory/develop/active-directory-v2-protocols-oauth-on-behalf-of | "on behalf of" OAuth flow}. + * Calls the Azure Active Directory V 2.0 endpoint to get an access token to your add-in's web application. Allows add-ins to identify users. + * Server side code can use this token to access Microsoft Graph for the add-in's web application by using the + * {@link https://docs.microsoft.com/azure/active-directory/develop/active-directory-v2-protocols-oauth-on-behalf-of | "on behalf of" OAuth flow}. * * Important: In Outlook, this API is not supported if the add-in is loaded in an Outlook.com or Gmail mailbox. * * @remarks *
AsyncResult.errorAccess an Error object that provides error information if the operation failed. + * Access an Error object that provides error information if the operation failed.
AsyncResult.asyncContext
* - *
HostsExcel, OneNote, Outlook, PowerPoint, Word
Requirement sets{@link https://docs.microsoft.com/office/dev/add-ins/develop/specify-office-hosts-and-api-requirements -| IdentityAPI}
+ * Requirement sets{@link https://docs.microsoft.com/office/dev/add-ins/develop/specify-office-hosts-and-api-requirements | IdentityAPI} * - * This API requires a single sign-on configuration that bridges the add-in to an Azure application. Office users sign-in with Organizational Accounts and Microsoft Accounts. Microsoft Azure returns tokens intended for both user account types to access resources in the Microsoft Graph. + * This API requires a single sign-on configuration that bridges the add-in to an Azure application. Office users sign-in with Organizational + * Accounts and Microsoft Accounts. Microsoft Azure returns tokens intended for both user account types to access resources in the Microsoft Graph. * * @param options - Optional. Accepts an AuthOptions object to define sign-on behaviors. - * @param callback - Optional. Accepts a callback method to handle the token acquisition attempt. If AsyncResult.status is "succeeded", then AsyncResult.value is the raw AAD v. 2.0-formatted access token. + * @param callback - Optional. Accepts a callback method to handle the token acquisition attempt. + * If AsyncResult.status is "succeeded", then AsyncResult.value is the raw AAD v. 2.0-formatted access token. + * + * @beta */ - getAccessTokenAsync(options?: AuthOptions, callback?: (result: AsyncResult) => void): void; + getAccessTokenAsync(options?: AuthOptions, callback?: (result: AsyncResult) => void): void; } /** @@ -1083,7 +1165,8 @@ declare namespace Office { */ interface AuthOptions { /** - * Causes Office to display the add-in consent experience. Useful if the add-in's Azure permissions have changed or if the user's consent has been revoked. + * Causes Office to display the add-in consent experience. Useful if the add-in's Azure permissions have changed or if the user's consent has + * been revoked. */ forceConsent?: boolean, /** @@ -1091,7 +1174,11 @@ declare namespace Office { */ forceAddAccount?: boolean, /** - * Causes Office to prompt the user to provide the additional factor when the tenancy being targeted by Microsoft Graph requires multifactor authentication. The string value identifies the type of additional factor that is required. In most cases, you won't know at development time whether the user's tenant requires an additional factor or what the string should be. So this option would be used in a "second try" call of getAccessTokenAsync after Microsoft Graph has sent an error requesting the additional factor and containing the string that should be used with the authChallenge option. + * Causes Office to prompt the user to provide the additional factor when the tenancy being targeted by Microsoft Graph requires multifactor + * authentication. The string value identifies the type of additional factor that is required. In most cases, you won't know at development + * time whether the user's tenant requires an additional factor or what the string should be. So this option would be used in a "second try" + * call of getAccessTokenAsync after Microsoft Graph has sent an error requesting the additional factor and containing the string that should + * be used with the authChallenge option. */ authChallenge?: string /** @@ -1137,7 +1224,8 @@ declare namespace Office { */ coercionType?: Office.CoercionType | string /** - * Specifies whether values, such as numbers and dates, are returned with their formatting applied. Use Office.ValueFormat or text value. Default: Unformatted data. + * Specifies whether values, such as numbers and dates, are returned with their formatting applied. Use Office.ValueFormat or text value. + * Default: Unformatted data. */ valueFormat?: Office.ValueFormat | string /** @@ -1157,7 +1245,8 @@ declare namespace Office { */ columnCount?: number /** - * Specify whether to get only the visible (filtered in) data or all the data (default is all). Useful when filtering data. Use Office.FilterType or text value. + * Specify whether to get only the visible (filtered in) data or all the data (default is all). Useful when filtering data. + * Use Office.FilterType or text value. */ filterType?: Office.FilterType | string /** @@ -1177,7 +1266,8 @@ declare namespace Office { */ interface SetBindingDataOptions { /** - * Use only with binding type table and when a TableData object is passed for the data parameter. An array of objects that specify a range of columns, rows, or cells and specify, as key-value pairs, the cell formatting to apply to that range. + * Use only with binding type table and when a TableData object is passed for the data parameter. An array of objects that specify a range of + * columns, rows, or cells and specify, as key-value pairs, the cell formatting to apply to that range. * * Example: `[{cells: Office.Table.Data, format: {fontColor: "yellow"}}, {cells: {row: 3, column: 4}, format: {borderColor: "white", fontStyle: "bold"}}]` */ @@ -1195,15 +1285,18 @@ declare namespace Office { */ rows?: string /** - * Specifies the zero-based starting row for a subset of the data in the binding. Only for table or matrix bindings. If omitted, data is set starting in the first row. + * Specifies the zero-based starting row for a subset of the data in the binding. Only for table or matrix bindings. If omitted, data is set + * starting in the first row. */ startRow?: number /** - * Specifies the zero-based starting column for a subset of the data. Only for table or matrix bindings. If omitted, data is set starting in the first column. + * Specifies the zero-based starting column for a subset of the data. Only for table or matrix bindings. If omitted, data is set starting in + * the first column. */ startColumn?: number /** - * For an inserted table, a list of key-value pairs that specify table formatting options, such as header row, total row, and banded rows. Example: `{bandedRows: true, filterButton: false}` + * For an inserted table, a list of key-value pairs that specify table formatting options, such as header row, total row, and banded rows. + * Example: `{bandedRows: true, filterButton: false}` */ tableOptions?: object /** @@ -1216,7 +1309,8 @@ declare namespace Office { */ interface RangeFormatConfiguration { /** - * Specifies the range. Example of using Office.Table enum: Office.Table.All. Example of using RangeCoordinates: {row: 3, column: 4} specifies the cell in the 3rd (zero-based) row in the 4th (zero-based) column. + * Specifies the range. Example of using Office.Table enum: Office.Table.All. Example of using RangeCoordinates: {row: 3, column: 4} specifies + * the cell in the 3rd (zero-based) row in the 4th (zero-based) column. */ cells: Office.Table | RangeCoordinates /** @@ -1225,7 +1319,8 @@ declare namespace Office { format: object } /** - * Specifies a cell, or row, or column, by its zero-based row and/or column number. Example: {row: 3, column: 4} specifies the cell in the 3rd (zero-based) row in the 4th (zero-based) column. + * Specifies a cell, or row, or column, by its zero-based row and/or column number. Example: {row: 3, column: 4} specifies the cell in the 3rd + * (zero-based) row in the 4th (zero-based) column. */ interface RangeCoordinates { /** @@ -1272,11 +1367,14 @@ declare namespace Office { */ id?: string /** - * Specifies the string to display in the prompt UI that tells the user what to select. Limited to 200 characters. If no promptText argument is passed, "Please make a selection" is displayed. + * Specifies the string to display in the prompt UI that tells the user what to select. Limited to 200 characters. + * If no promptText argument is passed, "Please make a selection" is displayed. */ promptText?: string /** - * Specifies a table of sample data displayed in the prompt UI as an example of the kinds of fields (columns) that can be bound by your add-in. The headers provided in the TableData object specify the labels used in the field selection UI. Note: This parameter is used only in add-ins for Access. It is ignored if provided when calling the method in an add-in for Excel. + * Specifies a table of sample data displayed in the prompt UI as an example of the kinds of fields (columns) that can be bound by your add-in. + * The headers provided in the TableData object specify the labels used in the field selection UI. + * Note: This parameter is used only in add-ins for Access. It is ignored if provided when calling the method in an add-in for Excel. */ sampleData?: Office.TableData /** @@ -1323,7 +1421,8 @@ declare namespace Office { */ valueFormat?: Office.ValueFormat | string /** - * Specify whether to get only the visible (that is, filtered-in) data or all the data. Useful when filtering data. Use {@link Office.FilterType} or string equivalent. This parameter is ignored in Word documents. + * Specify whether to get only the visible (that is, filtered-in) data or all the data. Useful when filtering data. + * Use {@link Office.FilterType} or string equivalent. This parameter is ignored in Word documents. */ filterType?: Office.FilterType | string /** @@ -1337,15 +1436,19 @@ declare namespace Office { * @remarks * The behavior caused by the {@link Office.SelectionMode | options.selectionMode} option varies by host: * - * In Excel: `Office.SelectionMode.Selected` selects all content in the binding, or named item. `Office.SelectionMode.None` for text bindings, selects the cell; for matrix bindings, table bindings, and named items, selects the first data cell (not first cell in header row for tables). + * In Excel: `Office.SelectionMode.Selected` selects all content in the binding, or named item. `Office.SelectionMode.None` for text bindings, + * selects the cell; for matrix bindings, table bindings, and named items, selects the first data cell (not first cell in header row for tables). * - * In PowerPoint: `Office.SelectionMode.Selected` selects the slide title or first textbox on the slide. `Office.SelectionMode.None` Doesn't select anything. + * In PowerPoint: `Office.SelectionMode.Selected` selects the slide title or first textbox on the slide. + * `Office.SelectionMode.None` doesn't select anything. * - * In Word: `Office.SelectionMode.Selected` selects all content in the binding. `Office.SelectionMode.None` for text bindings, moves the cursor to the beginning of the text; for matrix bindings and table bindings, selects the first data cell (not first cell in header row for tables). + * In Word: `Office.SelectionMode.Selected` selects all content in the binding. `Office.SelectionMode.None` for text bindings, moves the cursor to + * the beginning of the text; for matrix bindings and table bindings, selects the first data cell (not first cell in header row for tables). */ interface GoToByIdOptions { /** - * Specifies whether the location specified by the id parameter is selected (highlighted). Use {@link Office.SelectionMode} or string equivalent. See the Remarks for more information. + * Specifies whether the location specified by the id parameter is selected (highlighted). + * Use {@link Office.SelectionMode} or string equivalent. See the Remarks for more information. */ selectionMode?: Office.SelectionMode | string /** @@ -1358,7 +1461,8 @@ declare namespace Office { */ interface SetSelectedDataOptions { /** - * Use only with binding type table and when a TableData object is passed for the data parameter. An array of objects that specify a range of columns, rows, or cells and specify, as key-value pairs, the cell formatting to apply to that range. + * Use only with binding type table and when a TableData object is passed for the data parameter. An array of objects that specify a range of + * columns, rows, or cells and specify, as key-value pairs, the cell formatting to apply to that range. * * Example: `[{cells: Office.Table.Data, format: {fontColor: "yellow"}}, {cells: {row: 3, column: 4}, format: {borderColor: "white", fontStyle: "bold"}}]` */ @@ -1368,23 +1472,30 @@ declare namespace Office { */ coercionType?: Office.CoercionType | string /** - * For an inserted table, a list of key-value pairs that specify table formatting options, such as header row, total row, and banded rows. Example: `{bandedRows: true, filterButton: false}` + * For an inserted table, a list of key-value pairs that specify table formatting options, such as header row, total row, and banded rows. + * Example: `{bandedRows: true, filterButton: false}` */ tableOptions?: object /** - * This option is applicable for inserting images. Indicates the insert location in relation to the top of the slide for PowerPoint, and its relation to the currently selected cell in Excel. This value is ignored for Word. This value is in points. + * This option is applicable for inserting images. Indicates the insert location in relation to the top of the slide for PowerPoint, and its + * relation to the currently selected cell in Excel. This value is ignored for Word. This value is in points. */ imageTop?: number /** - * This option is applicable for inserting images. Indicates the image width. If this option is provided without the imageHeight, the image will scale to match the value of the image width. If both image width and image height are provided, the image will be resized accordingly. If neither the image height or width is provided, the default image size and aspect ratio will be used. This value is in points. + * This option is applicable for inserting images. Indicates the image width. If this option is provided without the imageHeight, the image + * will scale to match the value of the image width. If both image width and image height are provided, the image will be resized accordingly. + * If neither the image height or width is provided, the default image size and aspect ratio will be used. This value is in points. */ imageWidth?: number /** - * This option is applicable for inserting images. Indicates the insert location in relation to the left side of the slide for PowerPoint, and its relation to the currently selected cell in Excel. This value is ignored for Word. This value is in points. + * This option is applicable for inserting images. Indicates the insert location in relation to the left side of the slide for PowerPoint, and + * its relation to the currently selected cell in Excel. This value is ignored for Word. This value is in points. */ imageLeft?: number /** - * This option is applicable for inserting images. Indicates the image height. If this option is provided without the imageWidth, the image will scale to match the value of the image height. If both image width and image height are provided, the image will be resized accordingly. If neither the image height or width is provided, the default image size and aspect ratio will be used. This value is in points. + * This option is applicable for inserting images. Indicates the image height. If this option is provided without the imageWidth, the image + * will scale to match the value of the image height. If both image width and image height are provided, the image will be resized accordingly. + * If neither the image height or width is provided, the default image size and aspect ratio will be used. This value is in points. */ imageHeight?: number /** @@ -1408,15 +1519,19 @@ declare namespace Office { /** * Provides access to the properties for Office theme colors. * - * Using Office theme colors lets you coordinate the color scheme of your add-in with the current Office theme selected by the user with File > Office Account > Office Theme UI, which is applied across all Office host applications. Using Office theme colors is appropriate for mail and task pane add-ins. + * Using Office theme colors lets you coordinate the color scheme of your add-in with the current Office theme selected by the user with File > + * Office Account > Office Theme UI, which is applied across all Office host applications. Using Office theme colors is appropriate for mail and + * task pane add-ins. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that these properties are supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that these properties are supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -1471,16 +1586,19 @@ declare namespace Office { declare namespace Office { /** * Returns a promise of an object described in the expression. Callback is invoked only if method fails. + * * @param expression The object to be retrieved. Example "bindings#BindingName", retrieves a binding promise for a binding named 'BindingName' - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -1490,7 +1608,7 @@ declare namespace Office { * *
Word Y Y
*/ - function select(expression: string, callback?: (result: AsyncResult) => void): Binding; + function select(expression: string, callback?: (result: AsyncResult) => void): Binding; // Enumerations /** * Specifies the state of the active view of the document, for example, whether the user can edit the document. @@ -1498,9 +1616,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -1524,9 +1644,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -1542,7 +1664,8 @@ declare namespace Office { */ Text, /** - * Tabular data without a header row. Data is returned as an array of arrays, for example in this form: [[row1column1, row1column2],[row2column1, row2column2]] + * Tabular data without a header row. Data is returned as an array of arrays, for example in this form: + * [[row1column1, row1column2],[row2column1, row2column2]] */ Matrix, /** @@ -1560,9 +1683,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -1581,7 +1706,8 @@ declare namespace Office { */ Text, /** - * Return or set data as tabular data with no headers. Data is returned or set as an array of arrays containing one-dimensional runs of characters. For example, three rows of string values in two columns would be: [["R1C1", "R1C2"], ["R2C1", "R2C2"], ["R3C1", "R3C2"]]. + * Return or set data as tabular data with no headers. Data is returned or set as an array of arrays containing one-dimensional runs of + * characters. For example, three rows of string values in two columns would be: [["R1C1", "R1C2"], ["R2C1", "R2C2"], ["R3C1", "R3C2"]]. * * Note: Only applies to data in Excel and Word. */ @@ -1605,9 +1731,11 @@ declare namespace Office { */ Ooxml, /** - * Return a JSON object that contains an array of the ids, titles, and indexes of the selected slides. For example, `{"slides":[{"id":257,"title":"Slide 2","index":2},{"id":256,"title":"Slide 1","index":1}]}` for a selection of two slides. + * Return a JSON object that contains an array of the ids, titles, and indexes of the selected slides. For example, + * `{"slides":[{"id":257,"title":"Slide 2","index":2},{"id":256,"title":"Slide 1","index":1}]}` for a selection of two slides. * - * Note: Only applies to data in PowerPoint when calling the {@link Office.Document | Document}.getSelectedData method to get the current slide or selected range of slides. + * Note: Only applies to data in PowerPoint when calling the {@link Office.Document | Document}.getSelectedData method to get the current + * slide or selected range of slides. */ SlideRange, /** @@ -1625,9 +1753,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -1656,9 +1786,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -1699,7 +1831,8 @@ declare namespace Office { /** * Specifies the kind of event that was raised. Returned by the `type` property of an *EventArgs object. * - * Add-ins for Project support the `Office.EventType.ResourceSelectionChanged`, `Office.EventType.TaskSelectionChanged`, and `Office.EventType.ViewSelectionChanged` event types. + * Add-ins for Project support the `Office.EventType.ResourceSelectionChanged`, `Office.EventType.TaskSelectionChanged`, and + * `Office.EventType.ViewSelectionChanged` event types. * *
BindingDataChanged and BindingSelectionChanged hosts
Access, Excel, Word
* @@ -1707,9 +1840,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -1727,9 +1862,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -1738,6 +1875,14 @@ declare namespace Office { *
*/ ActiveViewChanged, + /** + * Triggers when the appointment date or time of the selected series was changed in Outlook. + * + * [Api set: Mailbox Preview] + * + * @beta + */ + AppointmentTimeChanged, /** * Occurs when data within the binding is changed. * To add an event handler for the BindingDataChanged event of a binding, use the addHandlerAsync method of the Binding object. @@ -1747,9 +1892,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -1761,17 +1908,18 @@ declare namespace Office { */ BindingDataChanged, /** - * Occurs when the selection is changed within the binding. - * To add an event handler for the BindingSelectionChanged event of a binding, use the addHandlerAsync method of the Binding object. - * The event handler receives an argument of type {@link Office.BindingSelectionChangedEventArgs}. + * Occurs when the selection is changed within the binding. To add an event handler for the BindingSelectionChanged event of a binding, use + * the addHandlerAsync method of the Binding object. The event handler receives an argument of type {@link Office.BindingSelectionChangedEventArgs}. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -1795,9 +1943,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -1825,6 +1975,14 @@ declare namespace Office { * Triggers when a customXmlPart node was replaced. */ NodeReplaced, + /** + * Triggers when the recipient list of the selected item was changed in Outlook. + * + * [Api set: Mailbox Preview] + * + * @beta + */ + RecipientsChanged, /** * Triggers when the recurrence pattern of the selected series was changed in Outlook. * @@ -1842,9 +2000,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -1873,9 +2033,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -1906,9 +2068,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -1935,9 +2099,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -1981,9 +2147,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -2016,9 +2184,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -2043,14 +2213,17 @@ declare namespace Office { * Specifies whether values, such as numbers and dates, returned by the invoked method are returned with their formatting applied. * * @remarks - * For example, if the valueFormat parameter is specified as "formatted", a number formatted as currency, or a date formatted as mm/dd/yy in the host application will have its formatting preserved. - * If the valueFormat parameter is specified as "unformatted", a date will be returned in its underlying sequential serial number form. + * For example, if the valueFormat parameter is specified as "formatted", a number formatted as currency, or a date formatted as mm/dd/yy in the + * host application will have its formatting preserved. If the valueFormat parameter is specified as "unformatted", a date will be returned in its + * underlying sequential serial number form. * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -2079,13 +2252,19 @@ declare namespace Office { * * The Binding object exposes the functionality possessed by all bindings regardless of type. * - * The Binding object is never called directly. It is the abstract parent class of the objects that represent each type of binding: {@link Office.MatrixBinding}, {@link Office.TableBinding}, or {@link Office.TextBinding}. All three of these objects inherit the getDataAsync and setDataAsync methods from the Binding object that enable to you interact with the data in the binding. They also inherit the id and type properties for querying those property values. Additionally, the MatrixBinding and TableBinding objects expose additional methods for matrix- and table-specific features, such as counting the number of rows and columns. + * The Binding object is never called directly. It is the abstract parent class of the objects that represent each type of binding: + * {@link Office.MatrixBinding}, {@link Office.TableBinding}, or {@link Office.TextBinding}. All three of these objects inherit the getDataAsync + * and setDataAsync methods from the Binding object that enable to you interact with the data in the binding. They also inherit the id and type + * properties for querying those property values. Additionally, the MatrixBinding and TableBinding objects expose additional methods for matrix- + * and table-specific features, such as counting the number of rows and columns. * * **Support details** * - * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this interface. + * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this interface. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -2111,7 +2290,8 @@ declare namespace Office { */ type: Office.BindingType; /** - * Adds an event handler to the object for the specified {@link Office.EventType}. Supported EventTypes are `Office.EventType.BindingDataChanged` and `Office.EventType.BindingSelectionChanged`. + * Adds an event handler to the object for the specified {@link Office.EventType}. Supported EventTypes are + * `Office.EventType.BindingDataChanged` and `Office.EventType.BindingSelectionChanged`. * * @remarks * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. @@ -2121,19 +2301,22 @@ declare namespace Office { * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; /** * Returns the data contained within the binding. * * @remarks *
Requirement SetsMatrixBindings, TableBindings, TextBindings
* - * When called from a MatrixBinding or TableBinding, the getDataAsync method will return a subset of the bound values if the optional startRow, startColumn, rowCount, and columnCount parameters are specified (and they specify a contiguous and valid range). + * When called from a MatrixBinding or TableBinding, the getDataAsync method will return a subset of the bound values if the optional startRow, + * startColumn, rowCount, and columnCount parameters are specified (and they specify a contiguous and valid range). * * @param options Provides options for how to get the data in a binding. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is the values in the specified binding. + * If the `coercionType` parameter is specified (and the call is successful), the data is returned in the format described in the CoercionType enumeration topic. */ - getDataAsync(options?: GetBindingDataOptions, callback?: (result: AsyncResult) => void): void; + getDataAsync(options?: GetBindingDataOptions, callback?: (result: AsyncResult) => void): void; /** * Removes the specified handler from the binding for the specified event type. * @@ -2142,9 +2325,9 @@ declare namespace Office { * * @param eventType The event type. For bindings, it can be `Office.EventType.BindingDataChanged` or `Office.EventType.BindingSelectionChanged`. * @param options Provides options to determine which event handler or handlers are removed. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - removeHandlerAsync(eventType: Office.EventType, options?: RemoveHandlerOptions, callback?: (result: AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: RemoveHandlerOptions, callback?: (result: AsyncResult) => void): void; /** * Writes data to the bound section of the document represented by the specified binding object. * @@ -2152,7 +2335,8 @@ declare namespace Office { * *
Requirement SetsMatrixBindings, TableBindings, TextBindings
* - * The value passed for data contains the data to be written in the binding. The kind of value passed determines what will be written as described in the following table. + * The value passed for data contains the data to be written in the binding. The kind of value passed determines what will be written as + * described in the following table. * * * @@ -2173,7 +2357,8 @@ declare namespace Office { * *
* - * Additionally, these application-specific actions apply when writing data to a binding. For Word, the specified data is written to the binding as follows: + * Additionally, these application-specific actions apply when writing data to a binding. For Word, the specified data is written to the + * binding as follows: * * * @@ -2223,13 +2408,16 @@ declare namespace Office { * * - The total number of cells in the value passed to 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. + * - 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. * * In all other cases, an error is returned. * - * The setDataAsync method will write data in a subset of a table or matrix binding if the optional startRow and startColumn parameters are specified, and they specify a valid range. + * The setDataAsync method will write data in a subset of a table or matrix binding if the optional startRow and startColumn parameters are + * specified, and they specify a valid range. * - * In the callback function passed to the setDataAsync method, you can use the properties of the AsyncResult object to return the following information. + * In the callback function passed to the setDataAsync method, you can use the properties of the AsyncResult object to return the following + * information. * *
* @@ -2268,9 +2456,9 @@ declare namespace Office { * * @param options Provides options for how to set the data in a binding. * - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. You can use the properties of the AsyncResult object to return the following information. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - setDataAsync(data: TableData | any, options?: SetBindingDataOptions, callback?: (result: AsyncResult) => void): void; + setDataAsync(data: TableData | any, options?: SetBindingDataOptions, callback?: (result: AsyncResult) => void): void; } /** @@ -2307,7 +2495,9 @@ declare namespace Office { * * If the user makes a non-contiguous selection, the count for the last contiguous selection within the binding is returned. * - * For Word, this property will work only for bindings of {@link Office.BindingType} "table". If the binding is of type "matrix", null is returned. Also, the call will fail if the table contains merged cells, because the structure of the table must be uniform for this property to work correctly. + * For Word, this property will work only for bindings of {@link Office.BindingType} "table". If the binding is of type "matrix", null is + * returned. Also, the call will fail if the table contains merged cells, because the structure of the table must be uniform for this property + * to work correctly. */ columnCount: number; /** @@ -2315,7 +2505,9 @@ declare namespace Office { * * If the user makes a non-contiguous selection, the count for the last contiguous selection within the binding is returned. * - * For Word, this property will work only for bindings of {@link Office.BindingType} "table". If the binding is of type "matrix", null is returned. Also, the call will fail if the table contains merged cells, because the structure of the table must be uniform for this property to work correctly. + * For Word, this property will work only for bindings of {@link Office.BindingType} "table". If the binding is of type "matrix", null is + * returned. Also, the call will fail if the table contains merged cells, because the structure of the table must be uniform for this property + * to work correctly. */ rowCount: number; /** @@ -2323,7 +2515,9 @@ declare namespace Office { * * If the user makes a non-contiguous selection, the coordinates for the last contiguous selection within the binding are returned. * - * For Word, this property will work only for bindings of {@link Office.BindingType} "table". If the binding is of type "matrix", null is returned. Also, the call will fail if the table contains merged cells, because the structure of the table must be uniform for this property to work correctly. + * For Word, this property will work only for bindings of {@link Office.BindingType} "table". If the binding is of type "matrix", null is + * returned. Also, the call will fail if the table contains merged cells, because the structure of the table must be uniform for this property + * to work correctly. */ startColumn: number; /** @@ -2331,7 +2525,9 @@ declare namespace Office { * * If the user makes a non-contiguous selection, the coordinates for the last contiguous selection within the binding are returned. * - * For Word, this property will work only for bindings of {@link Office.BindingType} "table". If the binding is of type "matrix", null is returned. Also, the call will fail if the table contains merged cells, because the structure of the table must be uniform for this property to work correctly. + * For Word, this property will work only for bindings of {@link Office.BindingType} "table". If the binding is of type "matrix", null is + * returned. Also, the call will fail if the table contains merged cells, because the structure of the table must be uniform for this property + * to work correctly. */ startRow: number; /** @@ -2351,9 +2547,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this property. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this property. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -2372,21 +2570,29 @@ declare namespace Office { * * For Excel, the itemName parameter can refer to a named range or a table. * - * By default, adding a table in Excel assigns the name "Table1" for the first table you add, "Table2" for the second table you add, and so on. To assign a meaningful name for a table in the Excel UI, use the Table Name property on the Table Tools | Design tab of the ribbon. + * By default, adding a table in Excel assigns the name "Table1" for the first table you add, "Table2" for the second table you add, and so on. + * To assign a meaningful name for a table in the Excel UI, use the Table Name property on the Table Tools | Design tab of the ribbon. * - * Note: In Excel, when specifying a table as a named item, you must fully qualify the name to include the worksheet name in the name of the table in this format: "Sheet1!Table1" + * Note: In Excel, when specifying a table as a named item, you must fully qualify the name to include the worksheet name in the name of + * the table in this format: "Sheet1!Table1" * - * For Word, the itemName parameter refers to the Title property of a Rich Text content control. (You can't bind to content controls other than the Rich Text content control). + * For Word, the itemName parameter refers to the Title property of a Rich Text content control. (You can't bind to content controls other + * than the Rich Text content control). * - * By default, a content control has no Title value assigned. To assign a meaningful name in the Word UI, after inserting a Rich Text content control from the Controls group on the Developer tab of the ribbon, use the Properties command in the Controls group to display the Content Control Properties dialog box. Then set the Title property of the content control to the name you want to reference from your code. + * By default, a content control has no Title value assigned. To assign a meaningful name in the Word UI, after inserting a Rich Text content + * control from the Controls group on the Developer tab of the ribbon, use the Properties command in the Controls group to display the Content + * Control Properties dialog box. Then set the Title property of the content control to the name you want to reference from your code. * - * Note: In Word, if there are multiple Rich Text content controls with the same Title property value (name), and you try to bind to one these content controls with this method (by specifying its name as the itemName parameter), the operation will fail. + * Note: In Word, if there are multiple Rich Text content controls with the same Title property value (name), and you try to bind to one + * these content controls with this method (by specifying its name as the itemName parameter), the operation will fail. * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -2398,22 +2604,26 @@ declare namespace Office { * @param itemName Name of the bindable object in the document. For Example 'MyExpenses' table in Excel." * @param bindingType The {@link Office.BindingType} for the data. The method returns null if the selected object cannot be coerced into the specified type. * @param options Provides options for configuring the binding that is created. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is the Binding object that represents the specified named item. */ - addFromNamedItemAsync(itemName: string, bindingType: BindingType, options?: AddBindingFromNamedItemOptions, callback?: (result: AsyncResult) => void): void; + addFromNamedItemAsync(itemName: string, bindingType: BindingType, options?: AddBindingFromNamedItemOptions, callback?: (result: AsyncResult) => void): void; /** * Create a binding by prompting the user to make a selection on the document. * * @remarks *
Requirement SetsNot in a set
* - * Adds a binding object of the specified type to the Bindings collection, which will be identified with the supplied id. The method fails if the specified selection cannot be bound. + * Adds a binding object of the specified type to the Bindings collection, which will be identified with the supplied id. + * The method fails if the specified selection cannot be bound. * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -2422,11 +2632,13 @@ declare namespace Office { * *
Excel Y Y Y
* - * @param bindingType Specifies the type of the binding object to create. Required. Returns null if the selected object cannot be coerced into the specified type. + * @param bindingType Specifies the type of the binding object to create. Required. + * Returns null if the selected object cannot be coerced into the specified type. * @param options Provides options for configuring the prompt and identifying the binding that is created. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is the Binding object that represents the selection specified by the user. */ - addFromPromptAsync(bindingType: BindingType, options?: AddBindingFromPromptOptions, callback?: (result: AsyncResult) => void): void; + addFromPromptAsync(bindingType: BindingType, options?: AddBindingFromPromptOptions, callback?: (result: AsyncResult) => void): void; /** * Create a binding based on the user's current selection. * @@ -2435,14 +2647,18 @@ declare namespace Office { * * Adds the specified type of binding object to the Bindings collection, which will be identified with the supplied id. * - * Note In Excel, if you call the addFromSelectionAsync method passing in the Binding.id of an existing binding, the Binding.type of that binding is used, and its type cannot be changed by specifying a different value for the bindingType parameter. - * If you need to use an existing id and change the bindingType, call the Bindings.releaseByIdAsync method first to release the binding, and then call the addFromSelectionAsync method to reestablish the binding with a new type. + * Note In Excel, if you call the addFromSelectionAsync method passing in the Binding.id of an existing binding, the Binding.type of that + * binding is used, and its type cannot be changed by specifying a different value for the bindingType parameter. + * If you need to use an existing id and change the bindingType, call the Bindings.releaseByIdAsync method first to release the binding, and + * then call the addFromSelectionAsync method to reestablish the binding with a new type. * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -2452,11 +2668,13 @@ declare namespace Office { * *
Word Y Y Y
* - * @param bindingType Specifies the type of the binding object to create. Required. Returns null if the selected object cannot be coerced into the specified type. + * @param bindingType Specifies the type of the binding object to create. Required. + * Returns null if the selected object cannot be coerced into the specified type. * @param options Provides options for configuring the prompt and identifying the binding that is created. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is the Binding object that represents the selection specified by the user. */ - addFromSelectionAsync(bindingType: BindingType, options?: AddBindingFromSelectionOptions, callback?: (result: AsyncResult) => void): void; + addFromSelectionAsync(bindingType: BindingType, options?: AddBindingFromSelectionOptions, callback?: (result: AsyncResult) => void): void; /** * Gets all bindings that were previously created. * @@ -2465,9 +2683,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -2478,9 +2698,10 @@ declare namespace Office { *
* * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is an array that contains each binding created for the referenced Bindings object. */ - getAllAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getAllAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Retrieves a binding based on its Name * @@ -2491,9 +2712,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -2505,9 +2728,10 @@ declare namespace Office { * * @param id Specifies the unique name of the binding object. Required. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is the Binding object specified by the id in the call. */ - getByIdAsync(id: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getByIdAsync(id: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Removes the binding from the document * @@ -2518,9 +2742,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -2532,9 +2758,9 @@ declare namespace Office { * * @param id Specifies the unique name to be used to identify the binding object. Required. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - releaseByIdAsync(id: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + releaseByIdAsync(id: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; } /** * Represents an XML node in a tree in a document. @@ -2544,9 +2770,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this interface. + * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this interface. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -2584,9 +2812,10 @@ declare namespace Office { * * @param xPath The XPath expression that specifies the nodes to get. Required. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is an array of CustomXmlNode objects that represent the nodes specified by the XPath expression passed to the `xPath` parameter. */ - getNodesAsync(xPath: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getNodesAsync(xPath: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Gets the node value. * @@ -2594,9 +2823,10 @@ declare namespace Office { *
Requirement SetsCustomXmlParts
* * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is a string that contains the value of the referenced node. */ - getNodeValueAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getNodeValueAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Gets the text of an XML node in a custom XML part. * @@ -2604,9 +2834,10 @@ declare namespace Office { *
Requirement SetsCustomXmlParts
* * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is a string that contains the inner text of the referenced nodes. */ - getTextAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getTextAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Gets the node's XML. * @@ -2614,9 +2845,10 @@ declare namespace Office { *
Requirement SetsCustomXmlParts
* * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is a string that contains the XML of the referenced node. */ - getXmlAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getXmlAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Sets the node value. * @@ -2625,9 +2857,9 @@ declare namespace Office { * * @param value The value to be set on the node * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - setNodeValueAsync(value: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + setNodeValueAsync(value: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Asynchronously sets the text of an XML node in a custom XML part. * @@ -2638,9 +2870,9 @@ declare namespace Office { * * @param text Required. The text value of the XML node. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - setTextAsync(text: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + setTextAsync(text: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Sets the node XML. * @@ -2649,9 +2881,9 @@ declare namespace Office { * * @param xml The XML to be set on the node * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - setXmlAsync(xml: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + setXmlAsync(xml: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; } /** * Represents a single CustomXMLPart in an {@link Office.CustomXmlParts} collection. @@ -2661,9 +2893,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this interface. + * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this interface. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -2681,7 +2915,7 @@ declare namespace Office { */ id: string; /** - * Gets the set of namespace prefix mappings ({@link Office.CustomXmlPrefixMappings}) used against the current CustomXMLPart. + * Gets the set of namespace prefix mappings ({@link Office.CustomXmlPrefixMappings}) used against the current CustomXmlPart. */ namespaceManager: CustomXmlPrefixMappings; @@ -2692,21 +2926,23 @@ declare namespace Office { * * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. * - * @param eventType Specifies the type of event to add. For a CustomXmlPart object, the eventType parameter can be specified as `Office.EventType.NodeDeleted`, `Office.EventType.NodeInserted`, and `Office.EventType.NodeReplaced`. - * @param handler The event handler function to add, whose only parameter is of type {@link Office.NodeDeletedEventArgs}, {@link Office.NodeInsertedEventArgs}, or {@link Office.NodeReplacedEventArgs} + * @param eventType Specifies the type of event to add. For a CustomXmlPart object, the eventType parameter can be specified as + * `Office.EventType.NodeDeleted`, `Office.EventType.NodeInserted`, and `Office.EventType.NodeReplaced`. + * @param handler The event handler function to add, whose only parameter is of type {@link Office.NodeDeletedEventArgs}, + * {@link Office.NodeInsertedEventArgs}, or {@link Office.NodeReplacedEventArgs} * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - addHandlerAsync(eventType: Office.EventType, handler: (result: any) => void, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: (result: any) => void, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Deletes the Custom XML Part. * * @remarks * * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - deleteAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + deleteAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Asynchronously gets any CustomXmlNodes in this custom XML part which match the specified XPath. * @@ -2714,29 +2950,32 @@ declare namespace Office { * * @param xPath An XPath expression that specifies the nodes you want returned. Required. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is an array of CustomXmlNode objects that represent the nodes specified by the XPath expression passed to the xPath parameter. */ - getNodesAsync(xPath: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getNodesAsync(xPath: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Asynchronously gets the XML inside this custom XML part. * * @remarks * * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is a string that contains the XML of the referenced CustomXmlPart object. */ - getXmlAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getXmlAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Removes an event handler for the specified event type. * * @remarks * - * @param eventType Specifies the type of event to remove. For a CustomXmlPart object, the eventType parameter can be specified as `Office.EventType.NodeDeleted`, `Office.EventType.NodeInserted`, and `Office.EventType.NodeReplaced`. + * @param eventType Specifies the type of event to remove. For a CustomXmlPart object, the eventType parameter can be specified as + * `Office.EventType.NodeDeleted`, `Office.EventType.NodeInserted`, and `Office.EventType.NodeReplaced`. * @param handler The name of the handler to remove. * @param options Provides options to determine which event handler or handlers are removed. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - removeHandlerAsync(eventType: Office.EventType, handler?: (result: any) => void, options?: RemoveHandlerOptions, callback?: (result: AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, handler?: (result: any) => void, options?: RemoveHandlerOptions, callback?: (result: AsyncResult) => void): void; } /** @@ -2746,9 +2985,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this interface. + * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this interface. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -2768,7 +3009,8 @@ declare namespace Office { /** * Gets the node which was just deleted from the {@link Office.CustomXmlPart} object. * - * Note that this node may have children, if a subtree is being removed from the document. Also, this node will be a "disconnected" node in that you can query down from the node, but you cannot query up the tree - the node appears to exist alone. + * Note that this node may have children, if a subtree is being removed from the document. Also, this node will be a "disconnected" node in + * that you can query down from the node, but you cannot query up the tree - the node appears to exist alone. */ oldNode: CustomXmlNode; } @@ -2780,9 +3022,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this interface. + * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this interface. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -2809,9 +3053,11 @@ declare namespace Office { * @remarks * **Support details** * - * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this interface. + * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this interface. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -2833,7 +3079,8 @@ declare namespace Office { /** * Gets the node which was just deleted (replaced) from the CustomXmlPart object. * - * Note that this node may have children, if a subtree is being removed from the document. Also, this node will be a "disconnected" node in that you can query down from the node, but you cannot query up the tree - the node appears to exist alone. + * Note that this node may have children, if a subtree is being removed from the document. Also, this node will be a "disconnected" node in + * that you can query down from the node, but you cannot query up the tree - the node appears to exist alone. */ oldNode: CustomXmlNode; } @@ -2846,9 +3093,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this interface. + * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this interface. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -2862,25 +3111,29 @@ declare namespace Office { * * @param xml The XML to add to the newly created custom XML part. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is the newly created CustomXmlPart object. */ - addAsync(xml: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + addAsync(xml: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Asynchronously gets the specified custom XML part by its id. * * @param id The GUID of the custom XML part, including opening and closing braces. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is a CustomXmlPart object that represents the specified custom XML part. + * If there is no custom XML part with the specified id, the method returns null. */ - getByIdAsync(id: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getByIdAsync(id: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Asynchronously gets the specified custom XML part(s) by its namespace. * * @param ns The namespace URI. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is an array of CustomXmlPart objects that match the specified namespace. */ - getByNamespaceAsync(ns: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getByNamespaceAsync(ns: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; } /** * Represents a collection of CustomXmlPart objects. @@ -2891,9 +3144,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this interface. + * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this interface. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -2911,33 +3166,37 @@ declare namespace Office { * @param prefix Specifies the prefix to add to the prefix mapping list. Required. * @param ns Specifies the namespace URI to assign to the newly added prefix. Required. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - addNamespaceAsync(prefix: string, ns: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + addNamespaceAsync(prefix: string, ns: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Asynchronously gets the namespace mapped to the specified prefix. * * @remarks * - * If the prefix already exists in the namespace manager, this method will overwrite the mapping of that prefix except when the prefix is one added or used by the data store internally, in which case it will return an error. + * If the prefix already exists in the namespace manager, this method will overwrite the mapping of that prefix except when the prefix is one + * added or used by the data store internally, in which case it will return an error. * * @param prefix TSpecifies the prefix to get the namespace for. Required. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is a string that contains the namespace mapped to the specified prefix. */ - getNamespaceAsync(prefix: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getNamespaceAsync(prefix: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Asynchronously gets the prefix for the specified namespace. * * @remarks * - * If no prefix is assigned to the requested namespace, the method returns an empty string (""). If there are multiple prefixes specified in the namespace manager, the method returns the first prefix that matches the supplied namespace. + * If no prefix is assigned to the requested namespace, the method returns an empty string (""). If there are multiple prefixes specified in + * the namespace manager, the method returns the first prefix that matches the supplied namespace. * * @param ns Specifies the namespace to get the prefix for. Required. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is a string that contains the prefix of the specified namespace. */ - getPrefixAsync(ns: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getPrefixAsync(ns: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; } /** * An abstract class that represents the document the add-in is interacting with. @@ -2950,13 +3209,16 @@ declare namespace Office { * Gets an object that provides access to the bindings defined in the document. * * @remarks - * You don't instantiate the Document object directly in your script. To call members of the Document object to interact with the current document or worksheet, use `Office.context.document` in your script. + * You don't instantiate the Document object directly in your script. To call members of the Document object to interact with the current + * document or worksheet, use `Office.context.document` in your script. * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this property. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this property. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -2974,9 +3236,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this property. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this property. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -2992,9 +3256,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this property. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this property. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -3013,9 +3279,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this property. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this property. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -3034,9 +3302,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this property. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this property. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -3058,9 +3328,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -3071,12 +3343,13 @@ declare namespace Office { * *
Word Y Y Y
* - * @param eventType For a Document object event, the eventType parameter can be specified as `Office.EventType.Document.SelectionChanged` or `Office.EventType.Document.ActiveViewChanged`, or the corresponding text value of this enumeration. + * @param eventType For a Document object event, the eventType parameter can be specified as `Office.EventType.Document.SelectionChanged` or + * `Office.EventType.Document.ActiveViewChanged`, or the corresponding text value of this enumeration. * @param handler The event handler function to add, whose only parameter is of type {@link Office.DocumentSelectionChangedEventArgs}. Required. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Returns the state of the current view of the presentation (edit or read). * @@ -3087,9 +3360,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -3100,18 +3375,25 @@ declare namespace Office { *
* * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is the state of the presentation's current view. + * The value returned can be either "edit" or "read". "edit" corresponds to any of the views in which you can edit slides, + * such as Normal or Outline View. "read" corresponds to either Slide Show or Reading View. */ - getActiveViewAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getActiveViewAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<"edit" | "read">) => void): void; /** - * Returns the entire document file in slices of up to 4194304 bytes (4 MB). For add-ins for iOS, file slice is supported up to 65536 (64 KB). Note that specifying file slice size of above permitted limit will result in an "Internal Error" failure. + * Returns the entire document file in slices of up to 4194304 bytes (4 MB). For add-ins for iOS, file slice is supported up to 65536 (64 KB). + * Note that specifying file slice size of above permitted limit will result in an "Internal Error" failure. * * @remarks *
Requirement SetsFile
* - * For add-ins running in Office host applications other than Office for iOS, the getFileAsync method supports getting files in slices of up to 4194304 bytes (4 MB). For add-ins running in Office for iOS apps, the getFileAsync method supports getting files in slices of up to 65536 (64 KB). + * For add-ins running in Office host applications other than Office for iOS, the getFileAsync method supports getting files in slices of up + * to 4194304 bytes (4 MB). For add-ins running in Office for iOS apps, the getFileAsync method supports getting files in slices of up to + * 65536 (64 KB). * - * The fileType parameter can be specified by using the {@link Office.FileType} enumeration or text values. But the possible values vary with the host: + * The fileType parameter can be specified by using the {@link Office.FileType} enumeration or text values. But the possible values vary with + * the host: * * Excel Online, Win32, Mac, and iOS: `Office.FileType.Compressed` * @@ -3123,9 +3405,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -3137,9 +3421,10 @@ declare namespace Office { * * @param fileType The format in which the file will be returned * @param options Provides options for setting the size of slices that the document will be divided into. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is the File object. */ - getFileAsync(fileType: FileType, options?: GetFileOptions, callback?: (result: AsyncResult) => void): void; + getFileAsync(fileType: FileType, options?: GetFileOptions, callback?: (result: AsyncResult) => void): void; /** * Gets file properties of the current document. * @@ -3150,9 +3435,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -3163,16 +3450,18 @@ declare namespace Office { *
* * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is the file's properties (with the URL found at `asyncResult.value.url`). */ - getFilePropertiesAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getFilePropertiesAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Reads the data contained in the current selection in the document. * * @remarks *
Requirement SetsSelection
* - * In the callback function that is passed to the getSelectedDataAsync method, you can use the properties of the AsyncResult object to return the following information. + * In the callback function that is passed to the getSelectedDataAsync method, you can use the properties of the AsyncResult object to return + * the following information. * * * @@ -3232,9 +3521,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -3250,9 +3541,12 @@ declare namespace Office { * * @param options Provides options for customizing what data is returned and how it is formatted. * - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is the data in the current selection. + * This is returned in the data structure or format you specified with the coercionType parameter. + * (See Remarks for more information about data coercion.) */ - getSelectedDataAsync(coerciontype: Office.CoercionType, options?: GetSelectedDataOptions, callback?: (result: AsyncResult) => void): void; + getSelectedDataAsync(coerciontype: Office.CoercionType, options?: GetSelectedDataOptions, callback?: (result: AsyncResult) => void): void; /** * Goes to the specified object or location in the document. * @@ -3263,17 +3557,22 @@ declare namespace Office { * * The behavior caused by the selectionMode option varies by host: * - * In Excel: `Office.SelectionMode.Selected` selects all content in the binding, or named item. Office.SelectionMode.None for text bindings, selects the cell; for matrix bindings, table bindings, and named items, selects the first data cell (not first cell in header row for tables). + * In Excel: `Office.SelectionMode.Selected` selects all content in the binding, or named item. Office.SelectionMode.None for text bindings, + * selects the cell; for matrix bindings, table bindings, and named items, selects the first data cell (not first cell in header row for tables). * - * In PowerPoint: `Office.SelectionMode.Selected` selects the slide title or first textbox on the slide. `Office.SelectionMode.None` Doesn't select anything. + * In PowerPoint: `Office.SelectionMode.Selected` selects the slide title or first textbox on the slide. + * `Office.SelectionMode.None` doesn't select anything. * - * In Word: `Office.SelectionMode.Selected` selects all content in the binding. Office.SelectionMode.None for text bindings, moves the cursor to the beginning of the text; for matrix bindings and table bindings, selects the first data cell (not first cell in header row for tables). + * In Word: `Office.SelectionMode.Selected` selects all content in the binding. Office.SelectionMode.None for text bindings, moves the cursor + * to the beginning of the text; for matrix bindings and table bindings, selects the first data cell (not first cell in header row for tables). * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -3286,9 +3585,10 @@ declare namespace Office { * @param id The identifier of the object or location to go to. * @param goToType The type of the location to go to. * @param options Provides options for whether to select the location that is navigated to. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is the current view. */ - goToByIdAsync(id: string | number, goToType: GoToType, options?: GoToByIdOptions, callback?: (result: AsyncResult) => void): void; + goToByIdAsync(id: string | number, goToType: GoToType, options?: GoToByIdOptions, callback?: (result: AsyncResult) => void): void; /** * Removes an event handler for the specified event type. * @@ -3297,9 +3597,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -3311,9 +3613,9 @@ declare namespace Office { * * @param eventType The event type. For document can be 'Document.SelectionChanged' or 'Document.ActiveViewChanged'. * @param options Provides options to determine which event handler or handlers are removed. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - removeHandlerAsync(eventType: Office.EventType, options?: RemoveHandlerOptions, callback?: (result: AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: RemoveHandlerOptions, callback?: (result: AsyncResult) => void): void; /** * Writes the specified data into the current selection. * @@ -3382,9 +3684,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -3400,32 +3704,47 @@ declare namespace Office { * If the value passed for `data` is: * * - A string: Plain text or anything that can be coerced to a string will be inserted. - * In Excel, you can also specify data as a valid formula to add that formula to the selected cell. For example, setting data to "=SUM(A1:A5)" will total the values in the specified range. However, when you set a formula on the bound cell, after doing so, you can't read the added formula (or any pre-existing formula) from the bound cell. If you call the Document.getSelectedDataAsync method on the selected cell to read its data, the method can return only the data displayed in the cell (the formula's result). + * In Excel, you can also specify data as a valid formula to add that formula to the selected cell. For example, setting data to "=SUM(A1:A5)" + * will total the values in the specified range. However, when you set a formula on the bound cell, after doing so, you can't read the added + * formula (or any pre-existing formula) from the bound cell. If you call the Document.getSelectedDataAsync method on the selected cell to + * read its data, the method can return only the data displayed in the cell (the formula's result). * - * - An array of arrays ("matrix"): Tabular data without headers will be inserted. For example, to write data to three rows in two columns, you can pass an array like this: [["R1C1", "R1C2"], ["R2C1", "R2C2"], ["R3C1", "R3C2"]]. To write a single column of three rows, pass an array like this: [["R1C1"], ["R2C1"], ["R3C1"]] - * In Excel, you can also specify data as an array of arrays that contains valid formulas to add them to the selected cells. For example if no other data will be overwritten, setting data to [["=SUM(A1:A5)","=AVERAGE(A1:A5)"]] will add those two formulas to the selection. Just as when setting a formula on a single cell as "text", you can't read the added formulas (or any pre-existing formulas) after they have been set - you can only read the formulas' results. + * - An array of arrays ("matrix"): Tabular data without headers will be inserted. For example, to write data to three rows in two columns, + * you can pass an array like this: [["R1C1", "R1C2"], ["R2C1", "R2C2"], ["R3C1", "R3C2"]]. To write a single column of three rows, pass an + * array like this: [["R1C1"], ["R2C1"], ["R3C1"]] + * + * In Excel, you can also specify data as an array of arrays that contains valid formulas to add them to the selected cells. For example if no + * other data will be overwritten, setting data to [["=SUM(A1:A5)","=AVERAGE(A1:A5)"]] will add those two formulas to the selection. Just as + * when setting a formula on a single cell as "text", you can't read the added formulas (or any pre-existing formulas) after they have been + * set - you can only read the formulas' results. * * - A TableData object: A table with headers will be inserted. - * In Excel, if you specify formulas in the TableData object you pass for the data parameter, you might not get the results you expect due to the "calculated columns" feature of Excel, which automatically duplicates formulas within a column. To work around this when you want to write `data` that contains formulas to a selected table, try specifying the data as an array of arrays (instead of a TableData object), and specify the coercionType as Microsoft.Office.Matrix or "matrix". + * In Excel, if you specify formulas in the TableData object you pass for the data parameter, you might not get the results you expect due to + * the "calculated columns" feature of Excel, which automatically duplicates formulas within a column. To work around this when you want to + * write `data` that contains formulas to a selected table, try specifying the data as an array of arrays (instead of a TableData object), and + * specify the coercionType as Microsoft.Office.Matrix or "matrix". * * @param options Provides options for how to insert data to the selection. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. - * The AsyncResult.value property always returns undefined because there is no object or data to retrieve. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The AsyncResult.value property always returns undefined because there is no object or data to retrieve. */ - setSelectedDataAsync(data: string | TableData | any[][], options?: SetSelectedDataOptions, callback?: (result: AsyncResult) => void): void; + setSelectedDataAsync(data: string | TableData | any[][], options?: SetSelectedDataOptions, callback?: (result: AsyncResult) => void): void; /** * Project documents only. Get Project field (Ex. ProjectWebAccessURL). * @param fieldId Project level fields. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result contains the `fieldValue` property, which represents the value of the specified field. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -3433,21 +3752,24 @@ declare namespace Office { * *
Project Y
*/ - getProjectFieldAsync(fieldId: number, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getProjectFieldAsync(fieldId: number, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Project documents only. Get resource field for provided resource Id. (Ex.ResourceName) * @param resourceId Either a string or value of the Resource Id. * @param fieldId Resource Fields. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is the GUID of the resource as a string. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -3455,19 +3777,22 @@ declare namespace Office { * *
Project Y
*/ - getResourceFieldAsync(resourceId: string, fieldId: number, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getResourceFieldAsync(resourceId: string, fieldId: number, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Project documents only. Get the current selected Resource's Id. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is the GUID of the resource as a string. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -3475,19 +3800,22 @@ declare namespace Office { * *
Project Y
*/ - getSelectedResourceAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getSelectedResourceAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Project documents only. Get the current selected Task's Id. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is the GUID of the resource as a string. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -3495,19 +3823,24 @@ declare namespace Office { * *
Project Y
*/ - getSelectedTaskAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getSelectedTaskAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Project documents only. Get the current selected View Type (Ex. Gantt) and View Name. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result contains the following properties: + * `viewName` - The name of the view, as a ProjectViewTypes constant. + * `viewType` - The type of view, as the integer value of a ProjectViewTypes constant. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -3515,20 +3848,26 @@ declare namespace Office { * *
Project Y
*/ - getSelectedViewAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getSelectedViewAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Project documents only. Get the Task Name, WSS Task Id, and ResourceNames for given taskId. * @param taskId Either a string or value of the Task Id. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result contains the following properties: + * `taskName` - The name of the task. + * `wssTaskId` - The ID of the task in the synchronized SharePoint task list. If the project is not synchronized with a SharePoint task list, the value is 0. + * `resourceNames` - The comma-separated list of the names of resources that are assigned to the task. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -3536,21 +3875,24 @@ declare namespace Office { * *
Project Y
*/ - getTaskAsync(taskId: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getTaskAsync(taskId: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Project documents only. Get task field for provided task Id. (Ex. StartDate). * @param taskId Either a string or value of the Task Id. * @param fieldId Task Fields. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result contains the `fieldValue` property, which represents the value of the specified field. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -3558,19 +3900,24 @@ declare namespace Office { * *
Project Y
*/ - getTaskFieldAsync(taskId: string, fieldId: number, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getTaskFieldAsync(taskId: string, fieldId: number, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Project documents only. Get the WSS Url and list name for the Tasks List, the MPP is synced too. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result contains the following properties: + * `listName` - the name of the synchronized SharePoint task list. + * `serverUrl` - the URL of the synchronized SharePoint task list. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -3578,22 +3925,25 @@ declare namespace Office { * *
Project Y
*/ - getWSSUrlAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getWSSUrlAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Project documents only. Get the maximum index of the collection of resources in the current project. * * Important: This API works only in Project 2016 on Windows desktop. * * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is the highest index number in the current project's resource collection. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -3601,22 +3951,25 @@ declare namespace Office { * *
Project Y
*/ - getMaxResourceIndexAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getMaxResourceIndexAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Project documents only. Get the maximum index of the collection of tasks in the current project. * * Important: This API works only in Project 2016 on Windows desktop. * * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is the highest index number in the current project's task collection. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -3624,7 +3977,7 @@ declare namespace Office { * *
Project Y
*/ - getMaxTaskIndexAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getMaxTaskIndexAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Project documents only. Get the GUID of the resource that has the specified index in the resource collection. * @@ -3632,15 +3985,18 @@ declare namespace Office { * * @param resourceIndex The index of the resource in the collection of resources for the project. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is the GUID of the resource as a string. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -3648,7 +4004,7 @@ declare namespace Office { * *
Project Y
*/ - getResourceByIndexAsync(resourceIndex: number, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getResourceByIndexAsync(resourceIndex: number, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Project documents only. Get the GUID of the task that has the specified index in the task collection. * @@ -3656,15 +4012,18 @@ declare namespace Office { * * @param taskIndex The index of the task in the collection of tasks for the project. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is the GUID of the task as a string. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -3672,7 +4031,7 @@ declare namespace Office { * *
Project Y
*/ - getTaskByIndexAsync(taskIndex: number, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getTaskByIndexAsync(taskIndex: number, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Project documents only. Set resource field for specified resource Id. * @@ -3682,15 +4041,17 @@ declare namespace Office { * @param fieldId Resource Fields. * @param fieldValue Value of the target field. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -3698,7 +4059,7 @@ declare namespace Office { * *
Project Y
*/ - setResourceFieldAsync(resourceId: string, fieldId: number, fieldValue: string | number | boolean | object, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + setResourceFieldAsync(resourceId: string, fieldId: number, fieldValue: string | number | boolean | object, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Project documents only. Set task field for specified task Id. * @@ -3708,15 +4069,17 @@ declare namespace Office { * @param fieldId Task Fields. * @param fieldValue Value of the target field. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -3724,7 +4087,7 @@ declare namespace Office { * *
Project Y
*/ - setTaskFieldAsync(taskId: string, fieldId: number, fieldValue: string | number | boolean | object, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + setTaskFieldAsync(taskId: string, fieldId: number, fieldValue: string | number | boolean | object, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; } /** * Provides information about the document that raised the SelectionChanged event. @@ -3747,9 +4110,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this interface. + * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this interface. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -3777,9 +4142,11 @@ declare namespace Office { * *
Requirement SetsFile
* - * No more than two documents are allowed to be in memory; otherwise the Document.getFileAsync operation will fail. Use the File.closeAsync method to close the file when you are finished working with it. + * No more than two documents are allowed to be in memory; otherwise the Document.getFileAsync operation will fail. Use the File.closeAsync + * method to close the file when you are finished working with it. * - * In the callback function passed to the closeAsync method, you can use the properties of the AsyncResult object to return the following information. + * In the callback function passed to the closeAsync method, you can use the properties of the AsyncResult object to return the following + * information. * * * @@ -3804,16 +4171,17 @@ declare namespace Office { * *
* - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter to return the following information. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - closeAsync(callback?: (result: AsyncResult) => void): void; + closeAsync(callback?: (result: AsyncResult) => void): void; /** * Returns the specified slice. * * @remarks *
Requirement SetsFile
* - * In the callback function passed to the getSliceAsync method, you can use the properties of the AsyncResult object to return the following information. + * In the callback function passed to the getSliceAsync method, you can use the properties of the AsyncResult object to return the following + * information. * * * @@ -3839,9 +4207,10 @@ declare namespace Office { *
* * @param sliceIndex Specifies the zero-based index of the slice to be retrieved. Required. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter to return the following information. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is the {@link Office.Slice} object. */ - getSliceAsync(sliceIndex: number, callback?: (result: AsyncResult) => void): void; + getSliceAsync(sliceIndex: number, callback?: (result: AsyncResult) => void): void; } interface FileProperties { /** @@ -3859,9 +4228,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this interface. + * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this interface. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -3903,14 +4274,18 @@ declare namespace Office { * * The name of a setting is a string, while the value can be a string, number, boolean, null, object, or array. * - * The Settings object is automatically loaded as part of the Document object, and is available by calling the settings property of that object when the add-in is activated. + * The Settings object is automatically loaded as part of the Document object, and is available by calling the settings property of that object + * when the add-in is activated. + * * The developer is responsible for calling the saveAsync method after adding or deleting settings to save the settings in the document. */ interface Settings { /** * Adds an event handler for the settingsChanged event. * - * Important: Your add-in's code can register a handler for the settingsChanged event when the add-in is running with any Excel client, but the event will fire only when the add-in is loaded with a spreadsheet that is opened in Excel Online, and more than one user is editing the spreadsheet (co-authoring). Therefore, effectively the settingsChanged event is supported only in Excel Online in co-authoring scenarios. + * Important: Your add-in's code can register a handler for the settingsChanged event when the add-in is running with any Excel client, but + * the event will fire only when the add-in is loaded with a spreadsheet that is opened in Excel Online, and more than one user is editing the + * spreadsheet (co-authoring). Therefore, effectively the settingsChanged event is supported only in Excel Online in co-authoring scenarios. * * @remarks * @@ -3919,9 +4294,9 @@ declare namespace Office { * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. * * @param eventType Specifies the type of event to add. Required. - * @param handler The event handler function to add. Required. + * @param handler The event handler function to add, whose only parameter is of type {@link Office.SettingsChangedEventArgs}. Required. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter to return the following information. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. * *
* @@ -3948,9 +4323,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -3958,7 +4335,7 @@ declare namespace Office { * *
Excel Y
*/ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Retrieves the specified setting. * @@ -3967,9 +4344,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -3991,12 +4370,14 @@ declare namespace Office { * *
Requirement SetsSettings
* - * This method is useful in Excel, Word, and PowerPoint coauthoring scenarios when multiple instances of the same add-in are working against the same document. - * Because each add-in is working against an in-memory copy of the settings loaded from the document at the time the user opened it, the settings values used by each user can get out of sync. - * This can happen whenever an instance of the add-in calls the Settings.saveAsync method to persist all of that user's settings to the document. - * Calling the refreshAsync method from the event handler for the settingsChanged event of the add-in will refresh the settings values for all users. + * This method is useful in Excel, Word, and PowerPoint coauthoring scenarios when multiple instances of the same add-in are working against + * the same document. Because each add-in is working against an in-memory copy of the settings loaded from the document at the time the user + * opened it, the settings values used by each user can get out of sync. This can happen whenever an instance of the add-in calls the + * Settings.saveAsync method to persist all of that user's settings to the document. Calling the refreshAsync method from the event handler + * for the settingsChanged event of the add-in will refresh the settings values for all users. * - * In the callback function passed to the refreshAsync method, you can use the properties of the AsyncResult object to return the following information. + * In the callback function passed to the refreshAsync method, you can use the properties of the AsyncResult object to return the following + * information. * * * @@ -4023,9 +4404,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -4036,13 +4419,16 @@ declare namespace Office { * *
Word Y Y Y
* - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is an {@link Office.Settings} object with the refreshed values. */ - refreshAsync(callback?: (result: AsyncResult) => void): void; + refreshAsync(callback?: (result: AsyncResult) => void): void; /** * Removes the specified setting. * - * Important: Be aware that the Settings.remove method affects only the in-memory copy of the settings property bag. To persist the removal of the specified setting in the document, at some point after calling the Settings.remove method and before the add-in is closed, you must call the Settings.saveAsync method. + * Important: Be aware that the Settings.remove method affects only the in-memory copy of the settings property bag. To persist the removal of + * the specified setting in the document, at some point after calling the Settings.remove method and before the add-in is closed, you must + * call the Settings.saveAsync method. * * @remarks *
Requirement SetsSettings
@@ -4051,9 +4437,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -4074,17 +4462,22 @@ declare namespace Office { * *
Requirement SetsSettings
* - * If the optional handler parameter is omitted when calling the removeHandlerAsync method, all event handlers for the specified eventType will be removed. + * If the optional handler parameter is omitted when calling the removeHandlerAsync method, all event handlers for the specified eventType + * will be removed. * - * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback + * function's only parameter. * - * In the callback function passed to the removeHandlerAsync method, you can use the properties of the AsyncResult object to return the following information. + * In the callback function passed to the removeHandlerAsync method, you can use the properties of the AsyncResult object to return the + * following information. * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -4096,18 +4489,21 @@ declare namespace Office { * * @param eventType Specifies the type of event to remove. Required. * @param options Provides options to determine which event handler or handlers are removed. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - removeHandlerAsync(eventType: Office.EventType, options?: RemoveHandlerOptions, callback?: (result: AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: RemoveHandlerOptions, callback?: (result: AsyncResult) => void): void; /** * Persists the in-memory copy of the settings property bag in the document. * * @remarks - * Any settings previously saved by an add-in are loaded when it is initialized, so during the lifetime of the session you can just use the set and get methods to work with the in-memory copy of the settings property bag. - * When you want to persist the settings so that they are available the next time the add-in is used, use the saveAsync method. + * Any settings previously saved by an add-in are loaded when it is initialized, so during the lifetime of the session you can just use the + * set and get methods to work with the in-memory copy of the settings property bag. When you want to persist the settings so that they are + * available the next time the add-in is used, use the saveAsync method. * - * Note: The saveAsync method persists the in-memory settings property bag into the document file. However, the changes to the document file itself are saved only when the user (or AutoRecover setting) saves the document to the file system. - * The refreshAsync method is only useful in coauthoring scenarios when other instances of the same add-in might change the settings and those changes should be made available to all instances. + * Note: The saveAsync method persists the in-memory settings property bag into the document file. However, the changes to the document file + * itself are saved only when the user (or AutoRecover setting) saves the document to the file system. The refreshAsync method is only useful + * in coauthoring scenarios when other instances of the same add-in might change the settings and those changes should be made available to + * all instances. * *
* @@ -4134,9 +4530,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -4148,26 +4546,31 @@ declare namespace Office { *
* * @param options Provides options for saving settings. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter to return the following information. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - saveAsync(options?: SaveSettingsOptions, callback?: (result: AsyncResult) => void): void; + saveAsync(options?: SaveSettingsOptions, callback?: (result: AsyncResult) => void): void; /** * Sets or creates the specified setting. * * Important: Be aware that the Settings.set method affects only the in-memory copy of the settings property bag. - * To make sure that additions or changes to settings will be available to your add-in the next time the document is opened, at some point after calling the Settings.set method and before the add-in is closed, you must call the Settings.saveAsync method to persist settings in the document. + * To make sure that additions or changes to settings will be available to your add-in the next time the document is opened, at some point + * after calling the Settings.set method and before the add-in is closed, you must call the Settings.saveAsync method to persist settings in + * the document. * * @remarks *
Requirement SetsSettings
* - * The set method creates a new setting of the specified name if it does not already exist, or sets an existing setting of the specified name in the in-memory copy of the settings property bag. - * After you call the Settings.saveAsync method, the value is stored in the document as the serialized JSON representation of its data type. A maximum of 2MB is available for the settings of each add-in. + * The set method creates a new setting of the specified name if it does not already exist, or sets an existing setting of the specified name + * in the in-memory copy of the settings property bag. After you call the Settings.saveAsync method, the value is stored in the document as + * the serialized JSON representation of its data type. A maximum of 2MB is available for the settings of each add-in. * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -4183,6 +4586,52 @@ declare namespace Office { */ set(name: string, value: any): void; } + /** + * Provides information about the settings that raised the settingsChanged event. + * + * @remarks + *
Requirement SetsSettings
+ * + * To add an event handler for the settingsChanged event, use the addHandlerAsync method of the + * {@link Office.Settings} object. + * + * The settingsChanged event fires only when your add-in's script calls the Settings.saveAsync method to persist + * the in-memory copy of the settings into the document file. The settingsChanged event is not triggered when the + * Settings.set or Settings.remove methods are called. + * + * The settingsChanged event was designed to let you to handle potential conflicts when two or more users are + * attempting to save settings at the same time when your add-in is used in a shared (co-authored) document. + * + * **Important:** Your add-in's code can register a handler for the settingsChanged event when the add-in + * is running with any Excel client, but the event will fire only when the add-in is loaded with a spreadsheet + * that is opened in Excel Online, and more than one user is editing the spreadsheet (co-authoring). + * Therefore, effectively the settingsChanged event is supported only in Excel Online in co-authoring scenarios. + * + * **Support details** + * + * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this interface. + * + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * + * *Supported hosts, by platform* + * + * + * + * + *
Office for Windows desktop Office Online (in browser) Office for iPad
Excel Y
Word Y Y
+ */ + interface SettingsChangedEventArgs { + /** + * Gets an {@link Office.Settings} object that represents the settings that raised the settingsChanged event. + */ + settings: Settings; + /** + * Get an {@link Office.EventType} enumeration value that identifies the kind of event that was raised. + */ + type: EventType; + } /** * Represents a slice of a document file. * @@ -4193,9 +4642,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this interface. + * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this interface. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -4206,7 +4657,8 @@ declare namespace Office { */ interface Slice { /** - * Gets the raw data of the file slice in `Office.FileType.Text` ("text") or `Office.FileType.Compressed` ("compressed") format as specified by the fileType parameter of the call to the Document.getFileAsync method. + * Gets the raw data of the file slice in `Office.FileType.Text` ("text") or `Office.FileType.Compressed` ("compressed") format as specified + * by the fileType parameter of the call to the Document.getFileAsync method. * * @remarks * @@ -4228,9 +4680,11 @@ declare namespace Office { * @remarks *
Requirement SetsTableBindings
* - * The TableBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the Binding object. + * The TableBinding object inherits the `id` property, `type` property, `getDataAsync` method, and `setDataAsync` method from the + * {@link Office.Binding} object. * - * For Excel, note that after you establish a table binding in Excel, each new row a user adds to the table is automatically included in the binding and rowCount increases. + * For Excel, note that after you establish a table binding, each new row a user adds to the table is automatically included in the binding and + * rowCount increases. */ interface TableBinding extends Binding { /** @@ -4240,9 +4694,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this property. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this property. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -4260,9 +4716,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this property. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this property. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -4277,20 +4735,27 @@ declare namespace Office { * Gets the number of rows in the TableBinding, as an integer value. * * @remarks - * When you insert an empty table by selecting a single row in Excel 2013 and Excel Online (using Table on the Insert tab), both Office host applications create a single row of headers followed by a single blank row. However, if your add-in's script creates a binding for this newly inserted table (for example, by using the addFromSelectionAsync method), and then checks the value of the rowCount property, the value returned will differ depending whether the spreadsheet is open in Excel 2013 or Excel Online. + * When you insert an empty table by selecting a single row in Excel 2013 and Excel Online (using Table on the Insert tab), both Office host + * applications create a single row of headers followed by a single blank row. However, if your add-in's script creates a binding for this + * newly inserted table (for example, by using the {@link Office.Bindings}.addFromSelectionAsync method), and then checks the value of the + * rowCount property, the value returned will differ depending whether the spreadsheet is open in Excel 2013 or Excel Online. + * * - In Excel on the desktop, rowCount will return 0 (the blank row following the headers is not counted). * * - In Excel Online, rowCount will return 1 (the blank row following the headers is counted). * - * You can work around this difference in your script by checking if rowCount == 1, and if so, then checking if the row contains all empty strings. + * You can work around this difference in your script by checking if rowCount == 1, and if so, then checking if the row contains all empty + * strings. * * In content add-ins for Access, for performance reasons the rowCount property always returns -1. * * **Support details** * - * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this property. + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this property. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -4306,23 +4771,30 @@ declare namespace Office { * * @remarks * - * To add one or more columns specifying the values of the data and headers, pass a TableData object as the data parameter. To add one or more columns specifying only the data, pass an array of arrays ("matrix") as the data parameter. + * To add one or more columns specifying the values of the data and headers, pass a TableData object as the data parameter. To add one or more + * columns specifying only the data, pass an array of arrays ("matrix") as the data parameter. * - * The success or failure of an addColumnsAsync operation is atomic. That is, the entire add columns operation must succeed, or it will be completely rolled back (and the AsyncResult.status property returned to the callback will report failure): + * The success or failure of an addColumnsAsync operation is atomic. That is, the entire add columns operation must succeed, or it will be + * completely rolled back (and the AsyncResult.status property returned to the callback will report failure): * - * - Each row in the array you pass as the data argument must have the same number of rows as the table being updated. If not, the entire operation will fail. + * - Each row in the array you pass as the data argument must have the same number of rows as the table being updated. If not, the entire + * operation will fail. * - * - Each row and cell in the array must successfully add that row or cell to the table in the newly added column(s). If any row or cell fails to be set for any reason, the entire operation will fail. + * - Each row and cell in the array must successfully add that row or cell to the table in the newly added column(s). If any row or cell + * fails to be set for any reason, the entire operation will fail. * * - If you pass a TableData object as the data argument, the number of header rows must match that of the table being updated. * - * Additional remark for Excel Online: The total number of cells in the TableData object passed to the data parameter can't exceed 20,000 in a single call to this method. + * Additional remark for Excel Online: The total number of cells in the TableData object passed to the data parameter can't exceed 20,000 in + * a single call to this method. * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -4333,31 +4805,35 @@ declare namespace Office { * * @param tableData An array of arrays ("matrix") or a TableData object that contains one or more columns of data to add to the table. Required. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - addColumnsAsync(tableData: TableData | any[][], options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + addColumnsAsync(tableData: TableData | any[][], options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Adds the specified data to the table as additional rows. * * @remarks * - * To add one or more columns specifying the values of the data and headers, pass a TableData object as the data parameter. To add one or more columns specifying only the data, pass an array of arrays ("matrix") as the data parameter. + * The success or failure of an addRowsAsync operation is atomic. That is, the entire add columns operation must succeed, or it will be + * completely rolled back (and the AsyncResult.status property returned to the callback will report failure): * - * The success or failure of an addRowsAsync operation is atomic. That is, the entire add columns operation must succeed, or it will be completely rolled back (and the AsyncResult.status property returned to the callback will report failure): + * - Each row in the array you pass as the data argument must have the same number of columns as the table being updated. If not, the entire + * operation will fail. * - * - Each row in the array you pass as the data argument must have the same number of columns as the table being updated. If not, the entire operation will fail. - * - * - Each column and cell in the array must successfully add that column or cell to the table in the newly added rows(s). If any column or cell fails to be set for any reason, the entire operation will fail. + * - Each column and cell in the array must successfully add that column or cell to the table in the newly added rows(s). If any column or + * cell fails to be set for any reason, the entire operation will fail. * * - If you pass a TableData object as the data argument, the number of header rows must match that of the table being updated. * - * Additional remark for Excel Online: The total number of cells in the TableData object passed to the data parameter can't exceed 20,000 in a single call to this method. + * Additional remark for Excel Online: The total number of cells in the TableData object passed to the data parameter can't exceed 20,000 in + * a single call to this method. * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -4369,9 +4845,9 @@ declare namespace Office { * * @param rows An array of arrays ("matrix") or a TableData object that contains one or more rows of data to add to the table. Required. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - addRowsAsync(rows: TableData | any[][], options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + addRowsAsync(rows: TableData | any[][], options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Deletes all non-header rows and their values in the table, shifting appropriately for the host application. * @@ -4381,9 +4857,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -4394,9 +4872,9 @@ declare namespace Office { *
* * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - deleteAllDataValuesAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + deleteAllDataValuesAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Clears formatting on the bound table. * @@ -4405,9 +4883,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -4416,28 +4896,17 @@ declare namespace Office { *
* * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - clearFormatsAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + clearFormatsAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Gets the formatting on specified items in the table. - * @param cellReference An object literal containing name-value pairs that specify the range of cells to get formatting from. - * @param formats An array specifying the format properties to get. - * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. - */ - getFormatsAsync(cellReference?: any, formats?: any[], options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; - /** - * Sets formatting on specified items and data in the table. - * + * * @remarks * - * **Specifying the cellFormat parameter** + * **Returned format structure** * - * Use the cellFormat parameter to set or change cell formatting values, such as width, height, font, background, alignment, and so on. - * The value you pass as the cellFormat parameter is an array that contains a list of one or more JavaScript objects that specify which cells to target (`cells:`) and the formats (`format:`) to apply to them. - * - * Each JavaScript object in the cellFormat array has this form: `{cells:{ cell_range }, format:{ format_definition }}` + * Each JavaScript object in the return value array has this form: `{cells:{ cell_range }, format:{ format_definition }}` * * The `cells:` property specifies the range you want format using one of the following values: * @@ -4476,7 +4945,66 @@ declare namespace Office { * * 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). * - * You specify the value of the `format:` property as a list of one or more property name - value pairs in a JavaScript object literal. The property name specifies the name of the formatting property to set, and value specifies the property value. + * @param cellReference An object literal containing name-value pairs that specify the range of cells to get formatting from. + * @param formats An array specifying the format properties to get. + * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. + * The `value` property of the result is an array containing one or more JavaScript objects specifying the formatting of their corresponding cells. + */ + getFormatsAsync(cellReference?: any, formats?: any[], options?: Office.AsyncContextOptions, callback?: (result: AsyncResult< ({ cells: any, format: any})[]>) => void): void; + /** + * Sets formatting on specified items and data in the table. + * + * @remarks + * + * **Specifying the cellFormat parameter** + * + * Use the cellFormat parameter to set or change cell formatting values, such as width, height, font, background, alignment, and so on. + * The value you pass as the cellFormat parameter is an array that contains a list of one or more JavaScript objects that specify which cells + * to target (`cells:`) and the formats (`format:`) to apply to them. + * + * Each JavaScript object in the cellFormat array has this form: `{cells:{ cell_range }, format:{ format_definition }}` + * + * The `cells:` property specifies the range you want format using one of the following values: + * + * **Supported ranges in cells property** + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
cells range settingsDescription
{row: n}Specifies the range that is the zero-based nth row of data in the table.
{column: n}Specifies the range that is the zero-based nth column of data in the table.
{row: i, column: j}Specifies the single cell that is the ith row and jth column of the table.
Office.Table.AllSpecifies the entire table, including column headers, data, and totals (if any).
Office.Table.DataSpecifies only the data in the table (no headers and totals).
Office.Table.HeadersSpecifies 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). + * + * You specify the value of the `format:` property as a list of one or more property name - value pairs in a JavaScript object literal. The + * property name specifies the name of the formatting property to set, and value specifies the property value. * You can specify multiple values for a given format, such as both a font's color and size. * * Here's three `format:` property value examples: @@ -4502,9 +5030,11 @@ declare namespace Office { * * For more detail, see how to {@link https://support.office.com/article/create-or-delete-a-custom-number-format-78f2a361-936b-4c03-8772-09fab54be7f4 | Create a custom number format}. * - * To set formatting on tables when writing data, use the tableOptions and cellFormat optional parameters of the `Document.setSelectedDataAsync` or `TableBinding.setDataAsync` methods. + * To set formatting on tables when writing data, use the tableOptions and cellFormat optional parameters of the + * `Document.setSelectedDataAsync` or `TableBinding.setDataAsync` methods. * - * Setting formatting with the optional parameters of the `Document.setSelectedDataAsync` and `TableBinding.setDataAsync` methods only works to set formatting when writing data the first time. + * Setting formatting with the optional parameters of the `Document.setSelectedDataAsync` and `TableBinding.setDataAsync` methods only works + * to set formatting when writing data the first time. * To make formatting changes after writing data, use the following methods: * * - To update cell formatting, such as font color and style, use the `TableBinding.setFormatsAsync` method (this method). @@ -4513,38 +5043,16 @@ declare namespace Office { * * - To clear formatting, use the `TableBinding.clearFormats` method. * - * For more details and examples, see {@link https://docs.microsoft.com/office/dev/add-ins/excel/excel-add-ins-tables#format-a-table | How to format tables in add-ins for Excel}. - * - * In the callback function passed to the goToByIdAsync method, you can use the properties of the AsyncResult object to return the following information. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
PropertyUse to...
AsyncResult.valueAlways returns undefined because there is no data or object to retrieve when setting formats.
AsyncResult.statusDetermine the success or failure of the operation.
AsyncResult.errorAccess an Error object that provides error information if the operation failed.
AsyncResult.asyncContextA user-defined item of any type that is returned in the AsyncResult object without being altered.
+ * For more details and examples, see + * {@link https://docs.microsoft.com/office/dev/add-ins/excel/excel-add-ins-tables#format-a-table | How to format tables in add-ins for Excel}. * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -4554,9 +5062,9 @@ declare namespace Office { * * @param cellFormat An array that contains one or more JavaScript objects that specify which cells to target and the formatting to apply to them. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - setFormatsAsync(cellFormat?: any[], options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + setFormatsAsync(cellFormat: any[], options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Updates table formatting options on the bound table. * @@ -4592,9 +5100,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this method. + * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this method. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -4604,11 +5114,10 @@ declare namespace Office { * * @param tableOptions An object literal containing a list of property name-value pairs that define the table options to apply. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. You can use the properties of the AsyncResult object to return the following information. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. * - */ - setTableOptionsAsync(tableOptions: any, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + setTableOptionsAsync(tableOptions: any, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; } /** * Represents the data in a table or a {@link Office.TableBinding}. @@ -4629,9 +5138,11 @@ declare namespace Office { * *
Requirement SetsTableBindings
* - * To specify headers, you must specify an array of arrays that corresponds to the structure of the table. For example, to specify headers for a two-column table you would set the header property to [['header1', 'header2']]. + * To specify headers, you must specify an array of arrays that corresponds to the structure of the table. For example, to specify headers + * for a two-column table you would set the header property to [['header1', 'header2']]. * - * If you specify null for the headers property (or leaving the property empty when you construct a TableData object), the following results occur when your code executes: + * If you specify null for the headers property (or leaving the property empty when you construct a TableData object), the following results + * occur when your code executes: * * - If you insert a new table, the default column headers for the table are created. * @@ -4639,16 +5150,19 @@ declare namespace Office { */ headers: any[]; /** - * Gets or sets the rows in the table. Returns an array of arrays that contains the data in the table. Returns an empty array ``, if there are no rows. + * Gets or sets the rows in the table. Returns an array of arrays that contains the data in the table. Returns an empty array ``, if there are + * no rows. * * @remarks * * *
HostsExcel, Word
Requirement SetsTableBindings
* - * To specify rows, you must specify an array of arrays that corresponds to the structure of the table. For example, to specify two rows of string values in a two-column table you would set the rows property to [['a', 'b'], ['c', 'd']]. + * To specify rows, you must specify an array of arrays that corresponds to the structure of the table. For example, to specify two rows of + * string values in a two-column table you would set the rows property to [['a', 'b'], ['c', 'd']]. * - * If you specify null for the rows property (or leave the property empty when you construct a TableData object), the following results occur when your code executes: + * If you specify null for the rows property (or leave the property empty when you construct a TableData object), the following results occur + * when your code executes: * * - If you insert a new table, a blank row will be inserted. * @@ -4657,15 +5171,18 @@ declare namespace Office { rows: any[][]; } /** - * Specifies enumerated values for the `cells` property in the cellFormat parameter of {@link https://docs.microsoft.com/en-us/office/dev/add-ins/excel/excel-add-ins-tables#format-a-table | table formatting methods}. + * Specifies enumerated values for the `cells` property in the cellFormat parameter of + * {@link https://docs.microsoft.com/en-us/office/dev/add-ins/excel/excel-add-ins-tables#format-a-table | table formatting methods}. * * @remarks * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -4693,13 +5210,16 @@ declare namespace Office { * @remarks *
Requirement SetsTextBindings
* - * The TextBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the {@link Office.Binding} object. It does not implement any additional properties or methods of its own. + * The TextBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the {@link Office.Binding} + * object. It does not implement any additional properties or methods of its own. * * **Support details** * - * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this interface. + * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this interface. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * @@ -4718,9 +5238,11 @@ declare namespace Office { * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -4738,7 +5260,8 @@ declare namespace Office { */ CurrencySymbol, /** - * The placement of the currency symbol: Not specified = -1; Before the value with no space ($0) = 0; After the value with no space (0$) = 1; Before the value with a space ($ 0) = 2; After the value with a space (0 $) = 3. + * The placement of the currency symbol: Not specified = -1; Before the value with no space ($0) = 0; After the value with no space (0$) = 1; + * Before the value with a space ($ 0) = 2; After the value with a space (0 $) = 3. */ CurrencySymbolPosition, DurationUnits, @@ -4785,13 +5308,17 @@ declare namespace Office { * @remarks * A ProjectResourceFields constant can be used as a parameter of the {@link Office.Document | Document}.getResourceFieldAsync method. * - * For more information about working with fields in Project, see {@link https://support.office.com/article/Available-fields-reference-615a4563-1cc3-40f4-b66f-1b17e793a460 | Available fields} reference. In Project Help, search for Available fields. + * For more information about working with fields in Project, see + * {@link https://support.office.com/article/Available-fields-reference-615a4563-1cc3-40f4-b66f-1b17e793a460 | Available fields} reference. In + * Project Help, search for Available fields. * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -4801,7 +5328,8 @@ declare namespace Office { */ enum ProjectResourceFields { /** - * The accrual method that defines how a task accrues the cost of the resource: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + * The accrual method that defines how a task accrues the cost of the resource: Accrues when the task starts = 1, + * accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. */ Accrual, /** @@ -5607,13 +6135,17 @@ declare namespace Office { * @remarks * A ProjectTaskFields constant can be used as a parameter of the {@link Office.Document | Document}.getTaskFieldAsync method. * - * For more information about working with fields in Project, see the {@link https://support.office.com/article/Available-fields-reference-615a4563-1cc3-40f4-b66f-1b17e793a460 | Available fields} reference. In Project Help, search for Available fields. + * For more information about working with fields in Project, see the + * {@link https://support.office.com/article/Available-fields-reference-615a4563-1cc3-40f4-b66f-1b17e793a460 | Available fields} reference. + * In Project Help, search for Available fields. * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -5875,7 +6407,8 @@ declare namespace Office { */ Baseline10FixedCost, /** - * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, + * accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. */ Baseline10FixedCostAccrual, /** @@ -5911,7 +6444,8 @@ declare namespace Office { */ Baseline1FixedCost, /** - * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, + * accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. */ Baseline1FixedCostAccrual, /** @@ -5947,7 +6481,8 @@ declare namespace Office { */ Baseline2FixedCost, /** - * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, + * accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. */ Baseline2FixedCostAccrual, /** @@ -5983,7 +6518,8 @@ declare namespace Office { */ Baseline3FixedCost, /** - * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, + * accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. */ Baseline3FixedCostAccrual, /** @@ -6019,7 +6555,8 @@ declare namespace Office { */ Baseline4FixedCost, /** - * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, + * accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. */ Baseline4FixedCostAccrual, /** @@ -6055,7 +6592,8 @@ declare namespace Office { */ Baseline5FixedCost, /** - * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, + * accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. */ Baseline5FixedCostAccrual, /** @@ -6091,7 +6629,8 @@ declare namespace Office { */ Baseline6FixedCost, /** - * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, + * accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. */ Baseline6FixedCostAccrual, /** @@ -6127,7 +6666,8 @@ declare namespace Office { */ Baseline7FixedCost, /** - * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, + * accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. */ Baseline7FixedCostAccrual, /** @@ -6163,7 +6703,8 @@ declare namespace Office { */ Baseline8FixedCost, /** - * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, + * accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. */ Baseline8FixedCostAccrual, /** @@ -6199,7 +6740,8 @@ declare namespace Office { */ Baseline9FixedCost, /** - * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, + * accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. */ Baseline9FixedCostAccrual, /** @@ -6235,7 +6777,8 @@ declare namespace Office { */ BaselineFixedCost, /** - * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, + * accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. */ BaselineFixedCostAccrual, /** @@ -6265,7 +6808,8 @@ declare namespace Office { */ ConstraintDate, /** - * A constraint type for the task: As Soon As Possible = 0, As Late As Possible = 1, Must Start On = 2, Must Finish On = 3, Start No Earlier Than = 4, Start No Later Than = 5, Finish No Earlier Than = 6, Finish No Later Than = 7. + * A constraint type for the task: As Soon As Possible = 0, As Late As Possible = 1, Must Start On = 2, Must Finish On = 3, + * Start No Earlier Than = 4, Start No Later Than = 5, Finish No Earlier Than = 6, Finish No Later Than = 7. */ ConstraintType, /** @@ -6409,7 +6953,8 @@ declare namespace Office { */ FixedCost, /** - * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, + * accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. */ FixedCostAccrual, /** @@ -6753,13 +7298,16 @@ declare namespace Office { * Specifies the types of views that the {@link Office.Document | Document}.getSelectedViewAsync method can recognize. * * @remarks - * The {@link Office.Document | Document}.getSelectedViewAsync method returns the ProjectViewTypes constant value and name that corresponds to the active view. + * The {@link Office.Document | Document}.getSelectedViewAsync method returns the ProjectViewTypes constant value and name that corresponds to the + * active view. * * **Support details** * - * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * A capital Y in the following matrix indicates that this enumeration is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. * - * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* *
@@ -7087,7 +7635,8 @@ declare namespace Office { */ TwoColumns = "TwoColumns", /** - Three column view. Displayed when the screen is wide. For example, Outlook Web App uses this view in a full screen window on a desktop computer. + Three column view. Displayed when the screen is wide. For example, Outlook Web App uses this view in a full screen window on a desktop + computer. */ ThreeColumns = "ThreeColumns" } @@ -7843,7 +8392,8 @@ declare namespace Office { /** * 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. + * 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* * @@ -7853,7 +8403,8 @@ declare namespace Office { * * 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. + * 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] * @@ -7927,7 +8478,8 @@ declare namespace Office { /** * 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. + * 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* * @@ -7937,7 +8489,8 @@ declare namespace Office { * * 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. + * 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] * @@ -8010,7 +8563,8 @@ declare namespace Office { size: number; } /** - * The body object provides methods for adding and updating the content of the message or appointment. It is returned in the body property of the selected item. + * The body object provides methods for adding and updating the content of the message or appointment. + * It is returned in the body property of the selected item. * * [Api set: Mailbox 1.1] * @@ -8025,7 +8579,9 @@ declare namespace Office { * * This method returns the entire current body in the format specified by coercionType. * - * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. + * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. + * The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method previously. + * The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. * * [Api set: Mailbox 1.3] * @@ -8036,20 +8592,23 @@ declare namespace Office { * * In addition to the main signature, this method also has this signature: * - * `getAsync(coerciontype: Office.CoercionType, callback: (result: AsyncResult) => void): void;` + * `getAsync(coerciontype: Office.CoercionType, callback: (result: AsyncResult) => void): void;` * * @param coercionType The format for the returned body. * @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 of type AsyncResult. The body is provided in the requested format in the asyncResult.value property. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * The body is provided in the requested format in the asyncResult.value property. */ - getAsync(coerciontype: Office.CoercionType, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getAsync(coerciontype: Office.CoercionType, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Returns the current body in a specified format. * * This method returns the entire current body in the format specified by coercionType. * - * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. + * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. + * The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method previously. + * The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. * * [Api set: Mailbox 1.3] * @@ -8059,9 +8618,10 @@ declare namespace Office { *
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read
* * @param coercionType The format for the returned body. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. The body is provided in the requested format in the asyncResult.value property. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}. + * The body is provided in the requested format in the asyncResult.value property. */ - getAsync(coerciontype: Office.CoercionType, callback: (result: AsyncResult) => void): void; + getAsync(coerciontype: Office.CoercionType, callback: (result: AsyncResult) => void): void; /** * Gets a value that indicates whether the content is in HTML or text format. @@ -8075,15 +8635,18 @@ declare namespace Office { * * @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 of type AsyncResult. The content type is returned as one of the CoercionType values in the asyncResult.value property. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}. + * The content type is returned as one of the CoercionType values in the asyncResult.value property. */ - getTypeAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getTypeAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Adds the specified content to the beginning of the item body. * - * The prependAsync method inserts the specified string at the beginning of the item body. After insertion, the cursor is returned to its original place, relative to the inserted content. + * The prependAsync method inserts the specified string at the beginning of the item body. + * After insertion, the cursor is returned to its original place, relative to the inserted content. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (
) to "LPNoLP" (please see the Examples section for a sample). + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * (please see the Examples section for a sample). * * [Api set: Mailbox 1.1] * @@ -8098,7 +8661,7 @@ declare namespace Office { * * `prependAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions): void;` * - * `prependAsync(data: string, callback: (result: AsyncResult) => void): void;` + * `prependAsync(data: string, callback: (result: AsyncResult) => void): void;` * * `prependAsync(data: string): void;` * @@ -8106,15 +8669,18 @@ declare namespace Office { * @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. * coercionType: The desired format for the body. The string in the data parameter will be converted to this format. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. Any errors encountered will be provided in the asyncResult.error property. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}. + * Any errors encountered will be provided in the asyncResult.error property. */ - prependAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult) => void): void; + prependAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult) => void): void; /** * Adds the specified content to the beginning of the item body. * - * The prependAsync method inserts the specified string at the beginning of the item body. After insertion, the cursor is returned to its original place, relative to the inserted content. + * The prependAsync method inserts the specified string at the beginning of the item body. + * After insertion, the cursor is returned to its original place, relative to the inserted content. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" (please see the Examples section for a sample). + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * (please see the Examples section for a sample). * * [Api set: Mailbox 1.1] * @@ -8134,9 +8700,11 @@ declare namespace Office { /** * Adds the specified content to the beginning of the item body. * - * The prependAsync method inserts the specified string at the beginning of the item body. After insertion, the cursor is returned to its original place, relative to the inserted content. + * The prependAsync method inserts the specified string at the beginning of the item body. + * After insertion, the cursor is returned to its original place, relative to the inserted content. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" (please see the Examples section for a sample). + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * (please see the Examples section for a sample). * * [Api set: Mailbox 1.1] * @@ -8146,15 +8714,18 @@ declare namespace Office { * ErrorsDataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters. * * @param data The string to be inserted at the beginning of the body. The string is limited to 1,000,000 characters. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. Any errors encountered will be provided in the asyncResult.error property. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}. + * Any errors encountered will be provided in the asyncResult.error property. */ - prependAsync(data: string, callback: (result: AsyncResult) => void): void; + prependAsync(data: string, callback: (result: AsyncResult) => void): void; /** * Adds the specified content to the beginning of the item body. * - * The prependAsync method inserts the specified string at the beginning of the item body. After insertion, the cursor is returned to its original place, relative to the inserted content. + * The prependAsync method inserts the specified string at the beginning of the item body. + * After insertion, the cursor is returned to its original place, relative to the inserted content. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" (please see the Examples section for a sample). + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * (please see the Examples section for a sample). * * [Api set: Mailbox 1.1] * @@ -8169,9 +8740,12 @@ declare namespace Office { /** * Replaces the entire body with the specified text. * - * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. + * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. + * The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method + * previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" (please see the Examples section for a sample). + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * (please see the Examples section for a sample). * * [Api set: Mailbox 1.3] * @@ -8186,7 +8760,7 @@ declare namespace Office { * * `setAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions): void;` * - * `setAsync(data: string, callback: (result: AsyncResult) => void): void;` + * `setAsync(data: string, callback: (result: AsyncResult) => void): void;` * * `setAsync(data: string): void;` * @@ -8194,15 +8768,19 @@ declare namespace Office { * @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. * coercionType: The desired format for the body. The string in the data parameter will be converted to this format. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. Any errors encountered will be provided in the asyncResult.error property. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}. + * Any errors encountered will be provided in the asyncResult.error property. */ - setAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult) => void): void; + setAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult) => void): void; /** * Replaces the entire body with the specified text. * - * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. + * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. + * The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method + * previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" (please see the Examples section for a sample). + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * (please see the Examples section for a sample). * * [Api set: Mailbox 1.3] * @@ -8222,9 +8800,12 @@ declare namespace Office { /** * Replaces the entire body with the specified text. * - * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. + * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. + * The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method + * previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" (please see the Examples section for a sample). + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * (please see the Examples section for a sample). * * [Api set: Mailbox 1.3] * @@ -8236,15 +8817,19 @@ declare namespace Office { * ErrorsDataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.InvalidFormatError - The options.coercionType parameter is set to Office.CoercionType.Html and the message body is in plain text. * * @param data The string that will replace the existing body. The string is limited to 1,000,000 characters. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. Any errors encountered will be provided in the asyncResult.error property. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}. + * Any errors encountered will be provided in the asyncResult.error property. */ - setAsync(data: string, callback: (result: AsyncResult) => void): void; + setAsync(data: string, callback: (result: AsyncResult) => void): void; /** * Replaces the entire body with the specified text. * - * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. + * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. + * The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method + * previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" (please see the Examples section for a sample). + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * (please see the Examples section for a sample). * * [Api set: Mailbox 1.3] * @@ -8262,9 +8847,12 @@ declare namespace Office { /** * Replaces the selection in the body with the specified text. * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content. + * The setSelectedDataAsync method inserts the specified string at the cursor location in the body of the item, or, if text is selected in + * the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the + * UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" (please see the Examples section for a sample). + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * (please see the Examples section for a sample). * * [Api set: Mailbox 1.1] * @@ -8279,7 +8867,7 @@ declare namespace Office { * * `setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions): void;` * - * `setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void;` + * `setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void;` * * `setSelectedDataAsync(data: string): void;` * @@ -8287,15 +8875,19 @@ declare namespace Office { * @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. * coercionType: The desired format for the body. The string in the data parameter will be converted to this format. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. Any errors encountered will be provided in the asyncResult.error property. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}. + * Any errors encountered will be provided in the asyncResult.error property. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult) => void): void; + setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult) => void): void; /** * Replaces the selection in the body with the specified text. * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content. + * The setSelectedDataAsync method inserts the specified string at the cursor location in the body of the item, or, if text is selected in + * the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the + * UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" (please see the Examples section for a sample). + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * (please see the Examples section for a sample). * * [Api set: Mailbox 1.1] * @@ -8315,9 +8907,12 @@ declare namespace Office { /** * Replaces the selection in the body with the specified text. * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content. + * The setSelectedDataAsync method inserts the specified string at the cursor location in the body of the item, or, if text is selected in + * the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the + * UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" (please see the Examples section for a sample). + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * (please see the Examples section for a sample). * * [Api set: Mailbox 1.1] * @@ -8329,15 +8924,19 @@ declare namespace Office { * ErrorsDataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.InvalidFormatError - The options.coercionType parameter is set to Office.CoercionType.Html and the message body is in plain text. * * @param data The string that will replace the existing body. The string is limited to 1,000,000 characters. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. Any errors encountered will be provided in the asyncResult.error property. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}. + * Any errors encountered will be provided in the asyncResult.error property. */ - setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void; + setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void; /** * Replaces the selection in the body with the specified text. * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content. + * The setSelectedDataAsync method inserts the specified string at the cursor location in the body of the item, or, if text is selected in + * the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the + * UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" (please see the Examples section for a sample). + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * (please see the Examples section for a sample). * * [Api set: Mailbox 1.1] * @@ -8355,7 +8954,8 @@ declare namespace Office { /** * Represents a contact stored on the server. Read mode only. * - * The list of contacts associated with an email message or appointment is returned in the contacts property of the {@link Office.Entities} object that is returned by the getEntities or getEntitiesByType method of the active item. + * The list of contacts associated with an email message or appointment is returned in the contacts property of the {@link Office.Entities} object + * that is returned by the getEntities or getEntitiesByType method of the active item. * * [Api set: Mailbox 1.0] * @@ -8391,7 +8991,10 @@ declare namespace Office { urls: Array; } /** - * The CustomProperties object represents custom properties that are specific to a particular item and specific to a mail add-in for Outlook. For example, there might be a need for a mail add-in to save some data that is specific to the current email message that activated the add-in. If the user revisits the same message in the future and activates the mail add-in again, the add-in will be able to retrieve the data that had been saved as custom properties. + * The CustomProperties object represents custom properties that are specific to a particular item and specific to a mail add-in for Outlook. + * For example, there might be a need for a mail add-in to save some data that is specific to the current email message that activated the add-in. + * If the user revisits the same message in the future and activates the mail add-in again, the add-in will be able to retrieve the data that had + * been saved as custom properties. * * Because Outlook for Mac doesn't cache custom properties, if the user's network goes down, mail add-ins cannot access their custom properties. * @@ -8421,7 +9024,9 @@ declare namespace Office { * * The set method sets the specified property to the specified value. You must use the saveAsync method to save the property to the server. * - * The set method creates a new property if the specified property does not already exist; otherwise, the existing value is replaced with the new value. The value parameter can be of any type; however, it is always passed to the server as a string. + * The set method creates a new property if the specified property does not already exist; + * otherwise, the existing value is replaced with the new value. + * The value parameter can be of any type; however, it is always passed to the server as a string. * * [Api set: Mailbox 1.0] * @@ -8451,11 +9056,17 @@ declare namespace Office { /** * Saves item-specific custom properties to the server. * - * You must call the saveAsync method to persist any changes made with the set method or the remove method of the CustomProperties object. The saving action is asynchronous. + * You must call the saveAsync method to persist any changes made with the set method or the remove method of the CustomProperties object. + * The saving action is asynchronous. * - * It's a good practice to have your callback function check for and handle errors from saveAsync. In particular, a read add-in can be activated while the user is in a connected state in a read form, and subsequently the user becomes disconnected. If the add-in calls saveAsync while in the disconnected state, saveAsync would return an error. Your callback method should handle this error accordingly. + * It's a good practice to have your callback function check for and handle errors from saveAsync. + * In particular, a read add-in can be activated while the user is in a connected state in a read form, and subsequently the user becomes + * disconnected. + * If the add-in calls saveAsync while in the disconnected state, saveAsync would return an error. + * Your callback method should handle this error accordingly. * - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. * @param asyncContext Optional. Any state data that is passed to the callback method. * * [Api set: Mailbox 1.0] @@ -8465,7 +9076,7 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read */ - saveAsync(callback?: (result: AsyncResult) => void, asyncContext?: any): void; + saveAsync(callback?: (result: AsyncResult) => void, asyncContext?: any): void; } /** * Provides diagnostic information to an Outlook add-in. @@ -8494,7 +9105,8 @@ declare namespace Office { /** * Gets a string that represents the version of either the host application or the Exchange Server. * - * If the mail add-in is running on the Outlook desktop client or Outlook for iOS, the hostVersion property returns the version of the host application, Outlook. In Outlook Web App, the property returns the version of the Exchange Server. An example is the string 15.0.468.0. + * If the mail add-in is running on the Outlook desktop client or Outlook for iOS, the hostVersion property returns the version of the host + * application, Outlook. In Outlook Web App, the property returns the version of the Exchange Server. An example is the string 15.0.468.0. * * [Api set: Mailbox 1.0] * @@ -8513,11 +9125,13 @@ declare namespace Office { * * Outlook Web App has three views that correspond to the width of the screen and the window, and the number of columns that can be displayed: * - * - OneColumn, which is displayed when the screen is narrow. Outlook Web App uses this single-column layout on the entire screen of a smartphone. + * - OneColumn, which is displayed when the screen is narrow. Outlook Web App uses this single-column layout on the entire screen of a + * smartphone. * * - TwoColumns, which is displayed when the screen is wider. Outlook Web App uses this view on most tablets. * - * - ThreeColumns, which is displayed when the screen is wide. For example, Outlook Web App uses this view in a full screen window on a desktop computer. + * - ThreeColumns, which is displayed when the screen is wide. For example, Outlook Web App uses this view in a full screen window on a + * desktop computer. * * [Api set: Mailbox 1.0] * @@ -8548,7 +9162,9 @@ declare namespace Office { */ displayName: string; /** - * Gets the response that an attendee returned for an appointment. This property applies to only an attendee of an appointment, as represented by the optionalAttendees or requiredAttendees property. This property returns undefined in other scenarios. + * Gets the response that an attendee returned for an appointment. + * This property applies to only an attendee of an appointment, as represented by the optionalAttendees or requiredAttendees property. + * This property returns undefined in other scenarios. */ appointmentResponse: Office.MailboxEnums.ResponseType; /** @@ -8579,17 +9195,25 @@ declare namespace Office { /** * Represents a collection of entities found in an email message or appointment. Read mode only. * - * The Entities object is a container for the entity arrays returned by the getEntities and getEntitiesByType methods when the item (either an email message or an appointment) contains one or more entities that have been found by the server. You can use these entities in your code to provide additional context information to the viewer, such as a map to an address found in the item, or to open a dialer for a phone number found in the item. + * The Entities object is a container for the entity arrays returned by the getEntities and getEntitiesByType methods when the item + * (either an email message or an appointment) contains one or more entities that have been found by the server. + * You can use these entities in your code to provide additional context information to the viewer, such as a map to an address found in the item, + * or to open a dialer for a phone number found in the item. * - * If no entities of the type specified in the property are present in the item, the property associated with that entity is null. For example, if a message contains a street address and a phone number, the addresses property and phoneNumbers property would contain information, and the other properties would be null. + * If no entities of the type specified in the property are present in the item, the property associated with that entity is null. + * For example, if a message contains a street address and a phone number, the addresses property and phoneNumbers property would contain + * information, and the other properties would be null. * - * To be recognized as an address, the string must contain a United States postal address that has at least a subset of the elements of a street number, street name, city, state, and zip code. + * To be recognized as an address, the string must contain a United States postal address that has at least a subset of the elements of a street + * number, street name, city, state, and zip code. * * To be recognized as a phone number, the string must contain a North American phone number format. * - * Entity recognition relies on natural language recognition that is based on machine learning of large amounts of data. The recognition of an entity is non-deterministic and success sometimes relies on the particular context in the item. + * Entity recognition relies on natural language recognition that is based on machine learning of large amounts of data. + * The recognition of an entity is non-deterministic and success sometimes relies on the particular context in the item. * - * When the property arrays are returned by the getEntitiesByType method, only the property for the specified entity contains data; all other properties are null. + * When the property arrays are returned by the getEntitiesByType method, only the property for the specified entity contains data; + * all other properties are null. * * [Api set: Mailbox 1.0] * @@ -8658,19 +9282,20 @@ declare namespace Office { * * In addition to this signature, the method also has the following signature: * - * `getAsync(callback?: (result: AsyncResult) => void): void;` + * `getAsync(callback?: (result: AsyncResult) => void): void;` * * @param options 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 When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an {@link Office.AsyncResult} object. + * The `value` property of the result is message's from value, as an EmailAddressDetails object. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (result: AsyncResult) => void): void; /** * Gets the from value of a message. * * The getAsync method starts an asynchronous call to the Exchange server to get the from value of a message. * - * The from value of the item is provided as an EmailAddressDetails in the asyncResult.value property. + * The from value of the item is provided as an {@link Office.EmailAddressDetails} in the asyncResult.value property. * * [Api set: Mailbox Preview] * @@ -8680,22 +9305,57 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * - * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an {@link Office.AsyncResult} object. + * The `value` property of the result is message's from value, as an EmailAddressDetails object. */ - getAsync(callback?: (result: AsyncResult) => void): void; + getAsync(callback?: (result: AsyncResult) => void): void; } /** - * The subclass of {@link Office.Item} dealing with apppointments. + * Represents the appointment organizer, even if an alias or a delegate was used to create the appointment. + * This object provides a method to get the organizer value of an appointment in an Outlook add-in. * - * 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. + * [Api set: Mailbox Preview] + * + * @remarks + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
+ * + * @beta + */ + export interface Organizer { + /** + * Gets the organizer value of an appointment as an {@link Office.EmailAddressDetails} in the asyncResult.value property. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
+ * + * @param options 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 When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * The `value` property of the result is message's organizer value, as an EmailAddressDetails object. + */ + getAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + } + + /** + * The subclass of {@link Office.Item} dealing with appointments. + * + * 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 Appointment extends Item { } /** * The appointment organizer mode of {@link Office.Item | Office.context.mailbox.item}. * - * 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. + * 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 { /** @@ -8739,9 +9399,11 @@ declare namespace Office { /** * 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. + * 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. + * 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] * @@ -8767,7 +9429,8 @@ declare namespace Office { */ 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. + * 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] * @@ -8791,7 +9454,9 @@ declare namespace Office { */ 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. + * 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] * @@ -8802,14 +9467,32 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer */ optionalAttendees: Recipients; + /** + * Gets the organizer for the specified meeting. + * + * The organizer property returns an {@link Office.Organizer | Organizer} object that provides a method to get the organizer value. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
+ * + * @beta + */ + organizer: Office.Organizer; /** * Gets or sets the recurrence pattern of an appointment. * - * 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. + * 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. * * 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. + * 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] * @@ -8823,7 +9506,9 @@ declare namespace Office { */ 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. + * 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] * @@ -8837,11 +9522,16 @@ declare namespace Office { /** * 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. + * 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}. + * 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. + * 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] * @@ -8857,9 +9547,11 @@ declare namespace Office { /** * 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. + * 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. + * 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] * @@ -8908,16 +9600,18 @@ declare namespace Office { * * `addFileAttachmentAsync(uri: string, attachmentName: string, options: Office.AsyncContextOptions): void;` * - * `addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: AsyncResult) => void): void;` + * `addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: AsyncResult) => void): void;` * * @param uri The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. * @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. - * 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. + * isInline: 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?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -8958,7 +9652,7 @@ declare namespace Office { * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. * @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. - * inInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the attachment list. + * isInline: 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; /** @@ -8979,13 +9673,41 @@ declare namespace Office { * * @param uri The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @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. + * @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; + addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: AsyncResult) => void): void; + /** + * Adds a file to a message or appointment as an attachment. + * + * The addFileAttachmentFromBase64Async method uploads the file from the base64 encoding and attaches it to the item in the compose form. This method returns the attachment identifier in the AsyncResult.value object. + * + * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
+ * + * @param base64File The base64 encoded content of an image or file to be added to an email or event. + * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. + * @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. + * isInline: 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. + */ + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions, 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -8997,21 +9719,24 @@ declare namespace Office { * * In addition to this signature, the method also has the following signature: * - * `addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;` + * `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 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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. * * @beta */ - addHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -9022,20 +9747,26 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment 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. + * @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 {@link Office.AsyncResult} object. * * @beta */ - addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + 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. * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. + * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or + * a code that indicates any error that occurred while attaching the item. + * You can use the options parameter to pass state information to the callback method, if needed. * * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that + * you are editing; however, this is not supported and is not recommended. * * [Api set: Mailbox 1.1] * @@ -9052,23 +9783,29 @@ declare namespace Office { * * `addItemAttachmentAsync(itemId: any, attachmentName: string, options: Office.AsyncContextOptions): void;` * - * `addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: AsyncResult) => void): void;` + * `addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: AsyncResult) => void): void;` * * @param itemId The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. * @param options 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 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. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.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, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. + * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or + * a code that indicates any error that occurred while attaching the item. + * You can use the options parameter to pass state information to the callback method, if needed. * * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that + * you are editing; however, this is not supported and is not recommended. * * [Api set: Mailbox 1.1] * @@ -9086,11 +9823,15 @@ declare namespace Office { /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. + * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or + * a code that indicates any error that occurred while attaching the item. + * You can use the options parameter to pass state information to the callback method, if needed. * * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that + * you are editing; however, this is not supported and is not recommended. * * [Api set: Mailbox 1.1] * @@ -9110,11 +9851,15 @@ declare namespace Office { /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. + * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or + * a code that indicates any error that occurred while attaching the item. + * You can use the options parameter to pass state information to the callback method, if needed. * * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that + * you are editing; however, this is not supported and is not recommended. * * [Api set: Mailbox 1.1] * @@ -9127,17 +9872,21 @@ declare namespace Office { * * @param itemId The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @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. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.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; + addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: AsyncResult) => void): void; /** * Closes the current item that is being composed * - * The behaviors of the close method depends on the current state of the item being composed. If the item has unsaved changes, the client prompts the user to save, discard, or close the action. + * The behaviors of the close method depends on the current state of the item being composed. + * If the item has unsaved changes, the client prompts the user to save, discard, or close the action. * * In the Outlook desktop client, if the message is an inline reply, the close method has no effect. * - * Note: In Outlook on the web, if the item is an appointment and it has previously been saved using saveAsync, the user is prompted to save, discard, or cancel even if no changes have occurred since the item was last saved. + * Note: In Outlook on the web, if the item is an appointment and it has previously been saved using saveAsync, the user is prompted to save, + * discard, or cancel even if no changes have occurred since the item was last saved. * * [Api set: Mailbox 1.3] * @@ -9165,21 +9914,23 @@ declare namespace Office { * * @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 of type AsyncResult. - * On success, the initialization data is provided in the asyncResult.value property as a string. - * If there is no initialization context, the asyncResult object will contain an Error object with its code property set to 9020 and its name property set to GenericResponseError. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}. + * On success, the initialization data is provided in the asyncResult.value property as a string. + * If there is no initialization context, the asyncResult object will contain an Error object with its code property set to 9020 and its name property set to GenericResponseError. * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * - * If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. If a field other than the body or subject is selected, the method returns the InvalidSelection error. + * If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. + * If a field other than the body or subject is selected, the method returns the InvalidSelection error. * - * To access the selected data from the callback method, call asyncResult.value.data. To access the source property that the selection comes from, call asyncResult.value.sourceProperty, which will be either body or subject. + * To access the selected data from the callback method, call asyncResult.value.data. + * To access the source property that the selection comes from, call asyncResult.value.sourceProperty, which will be either body or subject. * - * [Api set: Mailbox 1.0] + * [Api set: Mailbox 1.2] * * @returns * The selected data as a string with format determined by coercionType. @@ -9190,20 +9941,23 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer * - * @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present. If HTML, the method returns the selected text, whether it is plaintext or HTML. + * @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present. + * If HTML, the method returns the selected text, whether it is plaintext or HTML. * @param options 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 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; + getSelectedDataAsync(coerciontype: Office.CoercionType, options: Office.AsyncContextOptions, callback: (result: AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * - * If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. If a field other than the body or subject is selected, the method returns the InvalidSelection error. + * If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. + * If a field other than the body or subject is selected, the method returns the InvalidSelection error. * - * To access the selected data from the callback method, call asyncResult.value.data. To access the source property that the selection comes from, call asyncResult.value.sourceProperty, which will be either body or subject. + * To access the selected data from the callback method, call asyncResult.value.data. + * To access the source property that the selection comes from, call asyncResult.value.sourceProperty, which will be either body or subject. * - * [Api set: Mailbox 1.0] + * [Api set: Mailbox 1.2] * * @returns * The selected data as a string with format determined by coercionType. @@ -9214,16 +9968,22 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer * - * @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present. If HTML, the method returns the selected text, whether it is plaintext or HTML. - * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present. + * If HTML, the method returns the selected text, whether it is plaintext or HTML. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. */ - getSelectedDataAsync(coerciontype: Office.CoercionType, callback: (result: AsyncResult) => void): void; + 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. + * 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. + * 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] * @@ -9233,14 +9993,20 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment 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. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.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; + loadCustomPropertiesAsync(callback: (result: AsyncResult) => void, userContext?: any): void; /** * Removes an attachment from a message or appointment. * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form + * to continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -9258,18 +10024,23 @@ declare namespace Office { * * `removeAttachmentAsync(attachmentIndex: string, options: Office.AsyncContextOptions): void;` * - * `removeAttachmentAsync(attachmentIndex: string, callback: (result: AsyncResult) => void): void;` + * `removeAttachmentAsync(attachmentIndex: string, callback: (result: AsyncResult) => void): void;` * * @param attachmentIndex The identifier of the attachment to remove. The maximum length of the string is 100 characters. * @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 of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}. + * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - removeAttachmentAsync(attachmentIndex: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + removeAttachmentAsync(attachmentIndex: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Removes an attachment from a message or appointment. * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form + * to continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -9287,7 +10058,11 @@ declare namespace Office { /** * Removes an attachment from a message or appointment. * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form + * to continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -9307,7 +10082,12 @@ declare namespace Office { /** * Removes an attachment from a message or appointment. * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. + * In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form + * to continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -9320,13 +10100,16 @@ declare namespace Office { * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * * @param attachmentIndex The identifier of the attachment to remove. The maximum length of the string is 100 characters. - * @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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.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; + 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -9338,21 +10121,23 @@ declare namespace Office { * * In addition to this signature, the method also has the following signature: * - * `removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;` + * `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 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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. * * @beta */ - removeHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -9363,20 +10148,28 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment 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. + * @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 {@link Office.AsyncResult} object. * * @beta */ - removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; /** * Asynchronously saves an item. * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. + * In Outlook in cached mode, the item is saved to the local cache. * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. + * Saving an existing appointment will send an update to added or removed attendees. * - * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. * * Note: The following clients have different behavior for saveAsync on appointments in compose mode: * @@ -9400,21 +10193,27 @@ declare namespace Office { * * `saveAsync(options: Office.AsyncContextOptions): void;` * - * `saveAsync(callback: (result: AsyncResult) => void): void;` + * `saveAsync(callback: (result: AsyncResult) => void): void;` * * @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 of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}. */ - saveAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + saveAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Asynchronously saves an item. * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. + * In Outlook in cached mode, the item is saved to the local cache. * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. + * Saving an existing appointment will send an update to added or removed attendees. * - * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. * * Note: The following clients have different behavior for saveAsync on appointments in compose mode: * @@ -9437,11 +10236,17 @@ declare namespace Office { /** * Asynchronously saves an item. * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. + * In Outlook in cached mode, the item is saved to the local cache. * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. + * Saving an existing appointment will send an update to added or removed attendees. * - * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. * * Note: The following clients have different behavior for saveAsync on appointments in compose mode: * @@ -9466,11 +10271,16 @@ declare namespace Office { /** * Asynchronously saves an item. * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. + * Saving an existing appointment will send an update to added or removed attendees. * - * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. * * Note: The following clients have different behavior for saveAsync on appointments in compose mode: * @@ -9488,13 +10298,15 @@ declare namespace Office { * * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * - * @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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}. */ - saveAsync(callback: (result: AsyncResult) => void): void; + saveAsync(callback: (result: AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is + * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. + * After insertion, the cursor is placed at the end of the inserted content. * * [Api set: Mailbox 1.2] * @@ -9512,19 +10324,29 @@ declare namespace Office { * * `setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions): void;` * - * `setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void;` + * `setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void;` * - * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. + * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. * @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. - * coercionType: If text, the current style is applied in Outlook Web App and Outlook. If the field is an HTML editor, only the text data is inserted, even if the data is HTML. If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is applied in Outlook. If the field is a text field, an InvalidDataFormat error is returned. If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; if the field is text, then plain text is used. - * @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. + * coercionType: If text, the current style is applied in Outlook Web App and Outlook. + * If the field is an HTML editor, only the text data is inserted, even if the data is HTML. + * If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the + * default style is applied in Outlook. + * If the field is a text field, an InvalidDataFormat error is returned. + * If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; + * if the field is text, then plain text is used. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult) => void): void; + setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is + * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. + * After insertion, the cursor is placed at the end of the inserted content. * * [Api set: Mailbox 1.2] * @@ -9536,13 +10358,16 @@ declare namespace Office { * * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * - * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. + * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. */ setSelectedDataAsync(data: string): void; /** * Asynchronously inserts data into the body or subject of a message. * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is + * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. + * After insertion, the cursor is placed at the end of the inserted content. * * [Api set: Mailbox 1.2] * @@ -9554,16 +10379,24 @@ declare namespace Office { * * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * - * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. + * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. * @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. - * coercionType: If text, the current style is applied in Outlook Web App and Outlook. If the field is an HTML editor, only the text data is inserted, even if the data is HTML. If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is applied in Outlook. If the field is a text field, an InvalidDataFormat error is returned. If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; if the field is text, then plain text is used. + * coercionType: If text, the current style is applied in Outlook Web App and Outlook. + * If the field is an HTML editor, only the text data is inserted, even if the data is HTML. + * If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the + * default style is applied in Outlook. If the field is a text field, an InvalidDataFormat error is returned. + * If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; + * if the field is text, then plain text is used. */ setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions): void; /** * Asynchronously inserts data into the body or subject of a message. * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is + * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. + * After insertion, the cursor is placed at the end of the inserted content. * * [Api set: Mailbox 1.2] * @@ -9575,16 +10408,19 @@ declare namespace Office { * * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * - * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @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. + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. + * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. */ - setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void; + setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void; } /** * The appointment attendee mode of {@link Office.Item | Office.context.mailbox.item}. * - * 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. + * 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 AppointmentRead extends Appointment, ItemRead { /** @@ -9598,7 +10434,8 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment 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}. + * 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[]; @@ -9643,9 +10480,11 @@ declare namespace Office { /** * 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. + * 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. + * 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] * @@ -9695,9 +10534,14 @@ declare namespace Office { /** * 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. + * 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. + * 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 {@link https://docs.microsoft.com/outlook/add-ins/use-rest-api#get-the-item-id | Use the Outlook REST APIs from an Outlook add-in}. * * [Api set: Mailbox 1.0] * @@ -9739,7 +10583,8 @@ declare namespace Office { /** * 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. + * 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] * @@ -9765,7 +10610,8 @@ declare namespace Office { /** * 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. + * 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] * @@ -9777,7 +10623,7 @@ declare namespace Office { */ optionalAttendees: EmailAddressDetails[]; /** - * Gets the email address of the meeting organizer for a specified meeting. Read mode only. + * Gets the email address of the meeting organizer for a specified meeting. * * [Api set: Mailbox 1.0] * @@ -9791,11 +10637,13 @@ declare namespace Office { /** * Gets the recurrence pattern of an appointment. Gets the recurrence pattern of a meeting request. * - * 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. + * 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. * * 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. + * 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] * @@ -9811,7 +10659,8 @@ declare namespace Office { /** * 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. + * 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] * @@ -9825,7 +10674,8 @@ declare namespace Office { /** * 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. + * 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] * @@ -9839,11 +10689,16 @@ declare namespace Office { /** * 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. + * 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}. + * 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. + * 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] * @@ -9876,7 +10731,8 @@ declare namespace Office { /** * 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -9888,22 +10744,25 @@ declare namespace Office { * * In addition to this signature, the method also has the following signature: * - * `addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void;` + * `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 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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. * * @beta */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -9914,20 +10773,25 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment 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 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. + * @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 {@link Office.AsyncResult} object. * * @beta */ - addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + 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. + * 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. * * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. * * If any of the string parameters exceed their limits, displayReplyAllForm throws an exception. * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. If this isn't possible, then no error message is thrown. + * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and + * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. + * If this isn't possible, then no error message is thrown. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * @@ -9950,7 +10814,9 @@ declare namespace Office { * * If any of the string parameters exceed their limits, displayReplyForm throws an exception. * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. If this isn't possible, then no error message is thrown. + * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and + * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. + * If this isn't possible, then no error message is thrown. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * @@ -9970,7 +10836,8 @@ declare namespace Office { /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * - * Note: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. + * Note: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web + * for Office 365. * * [Api set: Mailbox Preview] * @@ -9982,17 +10849,19 @@ declare namespace Office { * * In addition to this signature, the method also has the following signature: * - * `getInitializationContextAsync(callback?: (result: AsyncResult) => void): void;` + * `getInitializationContextAsync(callback?: (result: AsyncResult) => void): void;` * * @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. - * On success, the initialization data is provided in the asyncResult.value property as a string. - * If there is no initialization context, the asyncResult object will contain an Error object with its code property set to 9020 and its name property set to GenericResponseError. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. + * On success, the initialization data is provided in the asyncResult.value property as a string. + * If there is no initialization context, the asyncResult object will contain an Error object with its code property + * set to 9020 and its name property set to GenericResponseError. * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * @@ -10006,13 +10875,15 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee * - * @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. - * On success, the initialization data is provided in the asyncResult.value property as a string. - * If there is no initialization context, the asyncResult object will contain an Error object with its code property set to 9020 and its name property set to GenericResponseError. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. + * On success, the initialization data is provided in the asyncResult.value property as a string. + * If there is no initialization context, the asyncResult object will contain an Error object with its code property + * set to 9020 and its name property set to GenericResponseError. * * @beta */ - getInitializationContextAsync(callback?: (result: AsyncResult) => void): void; + getInitializationContextAsync(callback?: (result: AsyncResult) => void): void; /** * Gets the entities found in the selected item's body. * @@ -10037,7 +10908,9 @@ declare namespace Office { * @param entityType One of the EntityType enumeration values. * * @returns - * If the value passed in entityType is not a valid member of the EntityType enumeration, the method returns null. If no entities of the specified type are present in the item's body, the method returns an empty array. Otherwise, the type of the objects in the returned array depends on the type of entity requested in the entityType parameter. + * If the value passed in entityType is not a valid member of the EntityType enumeration, the method returns null. + * If no entities of the specified type are present in the item's body, the method returns an empty array. + * Otherwise, the type of the objects in the returned array depends on the type of entity requested in the entityType parameter. * * @remarks * @@ -10093,7 +10966,8 @@ declare namespace Office { /** * Returns well-known entities in the selected item that pass the named filter defined in the manifest XML file. * - * The getFilteredEntitiesByName method returns the entities that match the regular expression defined in the ItemHasKnownEntity rule element in the manifest XML file with the specified FilterName element value. + * The getFilteredEntitiesByName method returns the entities that match the regular expression defined in the ItemHasKnownEntity rule element + * in the manifest XML file with the specified FilterName element value. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * @@ -10106,22 +10980,33 @@ declare namespace Office { *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}Restricted
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
* * @param name The name of the ItemHasKnownEntity rule element that defines the filter to match. - * @returns If there is no ItemHasKnownEntity element in the manifest with a FilterName element value that matches the name parameter, the method returns null. If the name parameter does match an ItemHasKnownEntity element in the manifest, but there are no entities in the current item that match, the method return an empty array. + * @returns If there is no ItemHasKnownEntity element in the manifest with a FilterName element value that matches the name parameter, + * the method returns null. + * If the name parameter does match an ItemHasKnownEntity element in the manifest, but there are no entities in the current item that match, + * the method return an empty array. */ getFilteredEntitiesByName(name: string): (string | Contact | MeetingSuggestion | PhoneNumber | TaskSuggestion)[]; /** * Returns string values in the selected item that match the regular expressions defined in the manifest XML file. * - * The getRegExMatches method returns the strings that match the regular expression defined in each ItemHasRegularExpressionMatch or ItemHasKnownEntity rule element in the manifest XML file. For an ItemHasRegularExpressionMatch rule, a matching string has to occur in the property of the item that is specified by that rule. The PropertyName simple type defines the supported properties. + * The getRegExMatches method returns the strings that match the regular expression defined in each ItemHasRegularExpressionMatch or + * ItemHasKnownEntity rule element in the manifest XML file. + * For an ItemHasRegularExpressionMatch rule, a matching string has to occur in the property of the item that is specified by that rule. + * The PropertyName simple type defines the supported properties. * - * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body and should not attempt to return the entire body of the item. Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. Instead, use the Body.getAsync method to retrieve the entire body. + * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body + * and should not attempt to return the entire body of the item. + * Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. + * Instead, use the Body.getAsync method to retrieve the entire body. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * * [Api set: Mailbox 1.0] * * @returns - * An object that contains arrays of strings that match the regular expressions defined in the manifest XML file. The name of each array is equal to the corresponding value of the RegExName attribute of the matching ItemHasRegularExpressionMatch rule or the FilterName attribute of the matching ItemHasKnownEntity rule. + * An object that contains arrays of strings that match the regular expressions defined in the manifest XML file. + * The name of each array is equal to the corresponding value of the RegExName attribute of the matching ItemHasRegularExpressionMatch rule + * or the FilterName attribute of the matching ItemHasKnownEntity rule. * * @remarks * @@ -10133,9 +11018,12 @@ declare namespace Office { /** * Returns string values in the selected item that match the named regular expression defined in the manifest XML file. * - * The getRegExMatchesByName method returns the strings that match the regular expression defined in the ItemHasRegularExpressionMatch rule element in the manifest XML file with the specified RegExName element value. + * The getRegExMatchesByName method returns the strings that match the regular expression defined in the ItemHasRegularExpressionMatch rule + * element in the manifest XML file with the specified RegExName element value. * - * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body and should not attempt to return the entire body of the item. Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. + * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body + * and should not attempt to return the entire body of the item. + * Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * @@ -10170,18 +11058,27 @@ declare namespace Office { */ getSelectedEntities(): Entities; /** - * Returns string values in a highlighted match that match the regular expressions defined in the manifest XML file. Highlighted matches apply to contextual add-ins. + * Returns string values in a highlighted match that match the regular expressions defined in the manifest XML file. + * Highlighted matches apply to contextual add-ins. * - * The getSelectedRegExMatches method returns the strings that match the regular expression defined in each ItemHasRegularExpressionMatch or ItemHasKnownEntity rule element in the manifest XML file. For an ItemHasRegularExpressionMatch rule, a matching string has to occur in the property of the item that is specified by that rule. The PropertyName simple type defines the supported properties. + * The getSelectedRegExMatches method returns the strings that match the regular expression defined in each ItemHasRegularExpressionMatch or + * ItemHasKnownEntity rule element in the manifest XML file. + * For an ItemHasRegularExpressionMatch rule, a matching string has to occur in the property of the item that is specified by that rule. + * The PropertyName simple type defines the supported properties. * - * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body and should not attempt to return the entire body of the item. Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. Instead, use the Body.getAsync method to retrieve the entire body. + * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body + * and should not attempt to return the entire body of the item. + * Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. + * Instead, use the Body.getAsync method to retrieve the entire body. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * * [Api set: Mailbox 1.6] * * @returns - * An object that contains arrays of strings that match the regular expressions defined in the manifest XML file. The name of each array is equal to the corresponding value of the RegExName attribute of the matching ItemHasRegularExpressionMatch rule or the FilterName attribute of the matching ItemHasKnownEntity rule. + * An object that contains arrays of strings that match the regular expressions defined in the manifest XML file. + * The name of each array is equal to the corresponding value of the RegExName attribute of the matching ItemHasRegularExpressionMatch rule + * or the FilterName attribute of the matching ItemHasKnownEntity rule. * * @remarks * @@ -10193,9 +11090,13 @@ declare namespace Office { /** * 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. + * 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. + * 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] * @@ -10205,15 +11106,18 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment 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. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.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; + 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -10225,21 +11129,24 @@ declare namespace Office { * * In addition to this signature, the method also has the following signature: * - * `removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;` + * `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 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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. * * @beta */ - removeHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -10250,16 +11157,19 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment 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. + * @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 {@link Office.AsyncResult} object. * * @beta */ - removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; } /** - * The item namespace is used to access the currently selected message, meeting request, or appointment. You can determine the type of the item by using the `itemType` property. + * The item namespace is used to access the currently selected message, meeting request, or appointment. + * You can determine the type of the item by using the `itemType` property. * * [Api set: Mailbox 1.0] * @@ -10310,7 +11220,8 @@ declare namespace Office { /** * 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. + * 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] * @@ -10335,13 +11246,17 @@ declare namespace Office { 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. + * 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. * - * 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. + * 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. + * 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] * @@ -10358,11 +11273,16 @@ declare namespace Office { /** * 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. + * 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}. + * 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. + * 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] * @@ -10379,7 +11299,7 @@ declare namespace Office { /** * 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -10391,22 +11311,24 @@ declare namespace Office { * * In addition to this signature, the method also has the following signature: * - * `addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void;` + * `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 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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. * * @beta */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -10417,19 +11339,25 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or 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. + * @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 {@link Office.AsyncResult} object. * * @beta */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void; + 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. + * 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. + * 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] * @@ -10439,15 +11367,18 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or 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. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.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; + 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -10459,22 +11390,25 @@ declare namespace Office { * * In addition to this signature, the method also has the following signature: * - * `removeHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void;` + * `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 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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. * * @beta */ - removeHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -10485,17 +11419,20 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or 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. + * @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 {@link Office.AsyncResult} object. * * @beta */ - removeHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void; } /** * The compose mode of {@link Office.Item | Office.context.mailbox.item}. * - * 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. + * 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 ItemCompose extends Item { /** @@ -10536,16 +11473,20 @@ declare namespace Office { * * `addFileAttachmentAsync(uri: string, attachmentName: string, options: Office.AsyncContextOptions): void;` * - * `addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: AsyncResult) => void): void;` + * `addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: AsyncResult) => void): void;` * * @param uri The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. * @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. - * 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. + * isInline: 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?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -10586,7 +11527,8 @@ declare namespace Office { * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. * @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. - * inInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the attachment list. + * isInline: 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; /** @@ -10607,18 +11549,52 @@ declare namespace Office { * * @param uri The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @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. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.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; + addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: AsyncResult) => void): void; + + /** + * Adds a file to a message or appointment as an attachment. + * + * The addFileAttachmentFromBase64Async method uploads the file from the base64 encoding and attaches it to the item in the compose form. This method returns the attachment identifier in the AsyncResult.value object. + * + * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
+ * + * @param base64File The base64 encoded content of an image or file to be added to an email or event. + * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. + * @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. + * isInline: 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. + */ + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. + * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or + * a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the + * callback method, if needed. * * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that + * you are editing; however, this is not supported and is not recommended. * * [Api set: Mailbox 1.1] * @@ -10635,23 +11611,30 @@ declare namespace Office { * * `addItemAttachmentAsync(itemId: any, attachmentName: string, options: Office.AsyncContextOptions): void;` * - * `addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: AsyncResult) => void): void;` + * `addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: AsyncResult) => void): void;` * * @param itemId The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. * @param options 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 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. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.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, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. + * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or + * a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the + * callback method, if needed. * * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that + * you are editing; however, this is not supported and is not recommended. * * [Api set: Mailbox 1.1] * @@ -10669,11 +11652,15 @@ declare namespace Office { /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. + * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or + * a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the + * callback method, if needed. * * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that + * you are editing; however, this is not supported and is not recommended. * * [Api set: Mailbox 1.1] * @@ -10693,11 +11680,15 @@ declare namespace Office { /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. + * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or + * a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the + * callback method, if needed. * * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that + * you are editing; however, this is not supported and is not recommended. * * [Api set: Mailbox 1.1] * @@ -10710,18 +11701,23 @@ declare namespace Office { * * @param itemId The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @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. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.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; + addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: AsyncResult) => void): void; /** * Closes the current item that is being composed * - * The behaviors of the close method depends on the current state of the item being composed. If the item has unsaved changes, the client prompts the user to save, discard, or close the action. + * The behaviors of the close method depends on the current state of the item being composed. + * If the item has unsaved changes, the client prompts the user to save, discard, or close the action. * * In the Outlook desktop client, if the message is an inline reply, the close method has no effect. * - * Note: In Outlook on the web, if the item is an appointment and it has previously been saved using saveAsync, the user is prompted to save, discard, or cancel even if no changes have occurred since the item was last saved. + * Note: In Outlook on the web, if the item is an appointment and it has previously been saved using saveAsync, the user is prompted to save, + * discard, or cancel even if no changes have occurred since the item was last saved. * * [Api set: Mailbox 1.3] * @@ -10749,21 +11745,25 @@ declare namespace Office { * * @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 of type AsyncResult. - * On success, the initialization data is provided in the asyncResult.value property as a string. - * If there is no initialization context, the asyncResult object will contain an Error object with its code property set to 9020 and its name property set to GenericResponseError. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. + * On success, the initialization data is provided in the asyncResult.value property as a string. + * If there is no initialization context, the asyncResult object will contain an Error object with its code property + * set to 9020 and its name property set to GenericResponseError. * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * - * If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. If a field other than the body or subject is selected, the method returns the InvalidSelection error. + * If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. + * If a field other than the body or subject is selected, the method returns the InvalidSelection error. * - * To access the selected data from the callback method, call asyncResult.value.data. To access the source property that the selection comes from, call asyncResult.value.sourceProperty, which will be either body or subject. + * To access the selected data from the callback method, call asyncResult.value.data. To access the source property that the selection comes + * from, call asyncResult.value.sourceProperty, which will be either body or subject. * - * [Api set: Mailbox 1.0] + * [Api set: Mailbox 1.2] * * @returns * The selected data as a string with format determined by coercionType. @@ -10774,18 +11774,22 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * - * @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present. If HTML, the method returns the selected text, whether it is plaintext or HTML. - * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present. + * If HTML, the method returns the selected text, whether it is plaintext or HTML. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. */ - getSelectedDataAsync(coerciontype: Office.CoercionType, callback: (result: AsyncResult) => void): void; + getSelectedDataAsync(coerciontype: Office.CoercionType, callback: (result: AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * - * If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. If a field other than the body or subject is selected, the method returns the InvalidSelection error. + * If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. + * If a field other than the body or subject is selected, the method returns the InvalidSelection error. * - * To access the selected data from the callback method, call asyncResult.value.data. To access the source property that the selection comes from, call asyncResult.value.sourceProperty, which will be either body or subject. + * To access the selected data from the callback method, call asyncResult.value.data. + * To access the source property that the selection comes from, call asyncResult.value.sourceProperty, which will be either body or subject. * - * [Api set: Mailbox 1.0] + * [Api set: Mailbox 1.2] * * @returns * The selected data as a string with format determined by coercionType. @@ -10796,16 +11800,22 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * - * @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present. If HTML, the method returns the selected text, whether it is plaintext or HTML. + * @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string, removing any HTML tags present. + * If HTML, the method returns the selected text, whether it is plaintext or HTML. * @param options 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 When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. */ - getSelectedDataAsync(coerciontype: Office.CoercionType, options: Office.AsyncContextOptions, callback: (result: AsyncResult) => void): void; + getSelectedDataAsync(coerciontype: Office.CoercionType, options: Office.AsyncContextOptions, callback: (result: AsyncResult) => void): void; /** * Removes an attachment from a message or appointment. * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form + * to continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -10823,18 +11833,24 @@ declare namespace Office { * * `removeAttachmentAsync(attachmentIndex: string, options: Office.AsyncContextOptions): void;` * - * `removeAttachmentAsync(attachmentIndex: string, callback: (result: AsyncResult) => void): void;` + * `removeAttachmentAsync(attachmentIndex: string, callback: (result: AsyncResult) => void): void;` * * @param attachmentIndex The identifier of the attachment to remove. The maximum length of the string is 100 characters. * @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 of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. + * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - removeAttachmentAsync(attachmentIndex: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + removeAttachmentAsync(attachmentIndex: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Removes an attachment from a message or appointment. * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form + * to continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -10852,7 +11868,11 @@ declare namespace Office { /** * Removes an attachment from a message or appointment. * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form + * to continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -10872,7 +11892,11 @@ declare namespace Office { /** * Removes an attachment from a message or appointment. * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form + * to continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -10885,18 +11909,26 @@ declare namespace Office { * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * * @param attachmentIndex The identifier of the attachment to remove. The maximum length of the string is 100 characters. - * @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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Offfice.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; + removeAttachmentAsync(attachmentIndex: string, callback: (result: AsyncResult) => void): void; /** * Asynchronously saves an item. * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. + * In Outlook in cached mode, the item is saved to the local cache. * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. + * Saving an existing appointment will send an update to added or removed attendees. * - * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. * * Note: The following clients have different behavior for saveAsync on appointments in compose mode: * @@ -10920,21 +11952,29 @@ declare namespace Office { * * `saveAsync(options: Office.AsyncContextOptions): void;` * - * `saveAsync(callback: (result: AsyncResult) => void): void;` + * `saveAsync(callback: (result: AsyncResult) => void): void;` * * @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 of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. + * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - saveAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + saveAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Asynchronously saves an item. * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. + * In Outlook in cached mode, the item is saved to the local cache. * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. + * Saving an existing appointment will send an update to added or removed attendees. * - * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. * * Note: The following clients have different behavior for saveAsync on appointments in compose mode: * @@ -10957,11 +11997,17 @@ declare namespace Office { /** * Asynchronously saves an item. * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. + * In Outlook in cached mode, the item is saved to the local cache. * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. + * Saving an existing appointment will send an update to added or removed attendees. * - * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. * * Note: The following clients have different behavior for saveAsync on appointments in compose mode: * @@ -10986,11 +12032,17 @@ declare namespace Office { /** * Asynchronously saves an item. * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. + * In Outlook in cached mode, the item is saved to the local cache. * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. + * Saving an existing appointment will send an update to added or removed attendees. * - * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. * * Note: The following clients have different behavior for saveAsync on appointments in compose mode: * @@ -11008,13 +12060,17 @@ declare namespace Office { * * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * - * @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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. + * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - saveAsync(callback: (result: AsyncResult) => void): void; + saveAsync(callback: (result: AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is + * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. + * After insertion, the cursor is placed at the end of the inserted content. * * [Api set: Mailbox 1.2] * @@ -11032,19 +12088,29 @@ declare namespace Office { * * `setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions): void;` * - * `setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void;` + * `setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void;` * - * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. + * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. * @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. - * coercionType: If text, the current style is applied in Outlook Web App and Outlook. If the field is an HTML editor, only the text data is inserted, even if the data is HTML. If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is applied in Outlook. If the field is a text field, an InvalidDataFormat error is returned. If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; if the field is text, then plain text is used. - * @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. + * coercionType: If text, the current style is applied in Outlook Web App and Outlook. + * If the field is an HTML editor, only the text data is inserted, even if the data is HTML. + * If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is + * applied in Outlook. + * If the field is a text field, an InvalidDataFormat error is returned. + * If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; + * if the field is text, then plain text is used. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult) => void): void; + setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is + * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. + * After insertion, the cursor is placed at the end of the inserted content. * * [Api set: Mailbox 1.2] * @@ -11056,13 +12122,16 @@ declare namespace Office { * * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * - * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. + * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. */ setSelectedDataAsync(data: string): void; /** * Asynchronously inserts data into the body or subject of a message. * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is + * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. + * After insertion, the cursor is placed at the end of the inserted content. * * [Api set: Mailbox 1.2] * @@ -11074,16 +12143,25 @@ declare namespace Office { * * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * - * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. + * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. * @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. - * coercionType: If text, the current style is applied in Outlook Web App and Outlook. If the field is an HTML editor, only the text data is inserted, even if the data is HTML. If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is applied in Outlook. If the field is a text field, an InvalidDataFormat error is returned. If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; if the field is text, then plain text is used. + * coercionType: If text, the current style is applied in Outlook Web App and Outlook. + * If the field is an HTML editor, only the text data is inserted, even if the data is HTML. + * If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is + * applied in Outlook. + * If the field is a text field, an InvalidDataFormat error is returned. + * If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; + * if the field is text, then plain text is used. */ setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions): void; /** * Asynchronously inserts data into the body or subject of a message. * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is + * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. + * After insertion, the cursor is placed at the end of the inserted content. * * [Api set: Mailbox 1.2] * @@ -11095,15 +12173,18 @@ declare namespace Office { * * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * - * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @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. + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. + * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. */ - setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void; + setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void; } /** * The read mode of {@link Office.Item | Office.context.mailbox.item}. * - * 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. + * 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 ItemRead extends Item { /** @@ -11116,7 +12197,9 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}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}. + * 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[]; @@ -11124,7 +12207,8 @@ declare namespace Office { * 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. + * 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] * @@ -11134,7 +12218,8 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Read * - * The itemClass property specifies the message class of the selected item. The following are the default message classes for the message or appointment item. + * The itemClass property specifies the message class of the selected item. The following are the default message classes for the message or + * appointment item. * * * @@ -11158,9 +12243,14 @@ declare namespace Office { /** * 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. + * 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. + * 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 {@link https://docs.microsoft.com/outlook/add-ins/use-rest-api#get-the-item-id | Use the Outlook REST APIs from an Outlook add-in}. * * [Api set: Mailbox 1.0] * @@ -11174,7 +12264,8 @@ declare namespace Office { /** * 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. + * 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] * @@ -11202,13 +12293,16 @@ declare namespace Office { */ subject: string; /** - * 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. + * 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. * * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. * * If any of the string parameters exceed their limits, displayReplyAllForm throws an exception. * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. If this isn't possible, then no error message is thrown. + * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and + * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. + * If this isn't possible, then no error message is thrown. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * @@ -11231,7 +12325,9 @@ declare namespace Office { * * If any of the string parameters exceed their limits, displayReplyForm throws an exception. * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. If this isn't possible, then no error message is thrown. + * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and + * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. + * If this isn't possible, then no error message is thrown. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * @@ -11251,7 +12347,8 @@ declare namespace Office { /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * - * Note: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. + * Note: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web + * for Office 365. * * [Api set: Mailbox Preview] * @@ -11263,21 +12360,24 @@ declare namespace Office { * * In addition to this signature, the method also has the following signature: * - * `getInitializationContextAsync(callback?: (result: AsyncResult) => void): void;` + * `getInitializationContextAsync(callback?: (result: AsyncResult) => void): void;` * * @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. - * On success, the initialization data is provided in the asyncResult.value property as a string. - * If there is no initialization context, the asyncResult object will contain an Error object with its code property set to 9020 and its name property set to GenericResponseError. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. + * On success, the initialization data is provided in the asyncResult.value property as a string. + * If there is no initialization context, the asyncResult object will contain an Error object with its code property + * set to 9020 and its name property set to GenericResponseError. * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * - * Note: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. + * Note: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web + * for Office 365. * * [Api set: Mailbox Preview] * @@ -11287,13 +12387,15 @@ declare namespace Office { * *
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Read
* - * @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. - * On success, the initialization data is provided in the asyncResult.value property as a string. - * If there is no initialization context, the asyncResult object will contain an Error object with its code property set to 9020 and its name property set to GenericResponseError. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. + * On success, the initialization data is provided in the asyncResult.value property as a string. + * If there is no initialization context, the asyncResult object will contain an Error object with its code property + * set to 9020 and its name property set to GenericResponseError. * * @beta */ - getInitializationContextAsync(callback?: (result: AsyncResult) => void): void; + getInitializationContextAsync(callback?: (result: AsyncResult) => void): void; /** * Gets the entities found in the selected item's body. * @@ -11318,14 +12420,17 @@ declare namespace Office { * @param entityType One of the EntityType enumeration values. * * @returns - * If the value passed in entityType is not a valid member of the EntityType enumeration, the method returns null. If no entities of the specified type are present in the item's body, the method returns an empty array. Otherwise, the type of the objects in the returned array depends on the type of entity requested in the entityType parameter. + * If the value passed in entityType is not a valid member of the EntityType enumeration, the method returns null. + * If no entities of the specified type are present in the item's body, the method returns an empty array. + * Otherwise, the type of the objects in the returned array depends on the type of entity requested in the entityType parameter. * * @remarks * * *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}Restricted
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Read
* - * While the minimum permission level to use this method is Restricted, some entity types require ReadItem to access, as specified in the following table. + * While the minimum permission level to use this method is Restricted, some entity types require ReadItem to access, as specified in the + * following table. * * * @@ -11374,7 +12479,8 @@ declare namespace Office { /** * Returns well-known entities in the selected item that pass the named filter defined in the manifest XML file. * - * The getFilteredEntitiesByName method returns the entities that match the regular expression defined in the ItemHasKnownEntity rule element in the manifest XML file with the specified FilterName element value. + * The getFilteredEntitiesByName method returns the entities that match the regular expression defined in the ItemHasKnownEntity rule element + * in the manifest XML file with the specified FilterName element value. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * @@ -11387,22 +12493,33 @@ declare namespace Office { *
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Read
* * @param name The name of the ItemHasKnownEntity rule element that defines the filter to match. - * @returns If there is no ItemHasKnownEntity element in the manifest with a FilterName element value that matches the name parameter, the method returns null. If the name parameter does match an ItemHasKnownEntity element in the manifest, but there are no entities in the current item that match, the method return an empty array. + * @returns If there is no ItemHasKnownEntity element in the manifest with a FilterName element value that matches the name parameter, + * the method returns null. + * If the name parameter does match an ItemHasKnownEntity element in the manifest, but there are no entities in the current item that match, + * the method return an empty array. */ getFilteredEntitiesByName(name: string): (string | Contact | MeetingSuggestion | PhoneNumber | TaskSuggestion)[]; /** * Returns string values in the selected item that match the regular expressions defined in the manifest XML file. * - * The getRegExMatches method returns the strings that match the regular expression defined in each ItemHasRegularExpressionMatch or ItemHasKnownEntity rule element in the manifest XML file. For an ItemHasRegularExpressionMatch rule, a matching string has to occur in the property of the item that is specified by that rule. The PropertyName simple type defines the supported properties. + * The getRegExMatches method returns the strings that match the regular expression defined in each ItemHasRegularExpressionMatch or + * ItemHasKnownEntity rule element in the manifest XML file. + * For an ItemHasRegularExpressionMatch rule, a matching string has to occur in the property of the item that is specified by that rule. + * The PropertyName simple type defines the supported properties. * - * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body and should not attempt to return the entire body of the item. Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. Instead, use the Body.getAsync method to retrieve the entire body. + * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body + * and should not attempt to return the entire body of the item. + * Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. + * Instead, use the Body.getAsync method to retrieve the entire body. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * * [Api set: Mailbox 1.0] * * @returns - * An object that contains arrays of strings that match the regular expressions defined in the manifest XML file. The name of each array is equal to the corresponding value of the RegExName attribute of the matching ItemHasRegularExpressionMatch rule or the FilterName attribute of the matching ItemHasKnownEntity rule. + * An object that contains arrays of strings that match the regular expressions defined in the manifest XML file. + * The name of each array is equal to the corresponding value of the RegExName attribute of the matching ItemHasRegularExpressionMatch rule + * or the FilterName attribute of the matching ItemHasKnownEntity rule. * * @remarks * @@ -11414,9 +12531,12 @@ declare namespace Office { /** * Returns string values in the selected item that match the named regular expression defined in the manifest XML file. * - * The getRegExMatchesByName method returns the strings that match the regular expression defined in the ItemHasRegularExpressionMatch rule element in the manifest XML file with the specified RegExName element value. + * The getRegExMatchesByName method returns the strings that match the regular expression defined in the ItemHasRegularExpressionMatch rule + * element in the manifest XML file with the specified RegExName element value. * - * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body and should not attempt to return the entire body of the item. Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. + * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body + * and should not attempt to return the entire body of the item. + * Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * @@ -11451,18 +12571,25 @@ declare namespace Office { */ getSelectedEntities(): Entities; /** - * Returns string values in a highlighted match that match the regular expressions defined in the manifest XML file. Highlighted matches apply to contextual add-ins. + * Returns string values in a highlighted match that match the regular expressions defined in the manifest XML file. + * Highlighted matches apply to contextual add-ins. * - * The getSelectedRegExMatches method returns the strings that match the regular expression defined in each ItemHasRegularExpressionMatch or ItemHasKnownEntity rule element in the manifest XML file. For an ItemHasRegularExpressionMatch rule, a matching string has to occur in the property of the item that is specified by that rule. The PropertyName simple type defines the supported properties. + * The getSelectedRegExMatches method returns the strings that match the regular expression defined in each ItemHasRegularExpressionMatch or + * ItemHasKnownEntity rule element in the manifest XML file. For an ItemHasRegularExpressionMatch rule, a matching string has to occur in the property of the item that is specified by that rule. The PropertyName simple type defines the supported properties. * - * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body and should not attempt to return the entire body of the item. Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. Instead, use the Body.getAsync method to retrieve the entire body. + * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body + * and should not attempt to return the entire body of the item. + * Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. + * Instead, use the Body.getAsync method to retrieve the entire body. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * * [Api set: Mailbox 1.6] * * @returns - * An object that contains arrays of strings that match the regular expressions defined in the manifest XML file. The name of each array is equal to the corresponding value of the RegExName attribute of the matching ItemHasRegularExpressionMatch rule or the FilterName attribute of the matching ItemHasKnownEntity rule. + * An object that contains arrays of strings that match the regular expressions defined in the manifest XML file. + * The name of each array is equal to the corresponding value of the RegExName attribute of the matching ItemHasRegularExpressionMatch rule + * or the FilterName attribute of the matching ItemHasKnownEntity rule. * * @remarks * @@ -11475,15 +12602,19 @@ declare namespace Office { /** * A subclass of {@link Office.Item} for messages. * - * 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. + * 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 Message extends Item { /** * Gets an identifier for the email conversation that contains a particular message. * - * You can get an integer for this property if your mail app is activated in read forms or responses in compose forms. If subsequently the user changes the subject of the reply message, upon sending the reply, the conversation ID for that message will change and that value you obtained earlier will no longer apply. + * You can get an integer for this property if your mail app is activated in read forms or responses in compose forms. + * If subsequently the user changes the subject of the reply message, upon sending the reply, the conversation ID for that message will + * change and that value you obtained earlier will no longer apply. * - * You get null for this property for a new item in a compose form. If the user sets a subject and saves the item, the conversationId property will return a value. + * You get null for this property for a new item in a compose form. + * If the user sets a subject and saves the item, the conversationId property will return a value. * * [Api set: Mailbox 1.0] * @@ -11499,7 +12630,8 @@ declare namespace Office { /** * The message compose mode of {@link Office.Item | Office.context.mailbox.item}. * - * 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. + * 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 MessageCompose extends Message, ItemCompose { /** @@ -11527,9 +12659,11 @@ declare namespace Office { */ 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. + * 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. * - * The cc property returns a {@link Office.Recipients} object that provides methods to get or update the recipients on the Cc line of the message. + * The cc property returns a {@link Office.Recipients} object that provides methods to get or update the recipients on the Cc line of + * the message. * * [Api set: Mailbox 1.0] * @@ -11543,9 +12677,12 @@ declare namespace Office { /** * Gets an identifier for the email conversation that contains a particular message. * - * You can get an integer for this property if your mail app is activated in read forms or responses in compose forms. If subsequently the user changes the subject of the reply message, upon sending the reply, the conversation ID for that message will change and that value you obtained earlier will no longer apply. + * You can get an integer for this property if your mail app is activated in read forms or responses in compose forms. + * If subsequently the user changes the subject of the reply message, upon sending the reply, the conversation ID for that message will change + * and that value you obtained earlier will no longer apply. * - * You get null for this property for a new item in a compose form. If the user sets a subject and saves the item, the conversationId property will return a value. + * You get null for this property for a new item in a compose form. + * If the user sets a subject and saves the item, the conversationId property will return a value. * * [Api set: Mailbox 1.0] * @@ -11585,7 +12722,8 @@ declare namespace Office { /** * 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 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. * @@ -11603,7 +12741,8 @@ declare namespace Office { /** * 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. + * 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] * @@ -11627,13 +12766,17 @@ declare namespace Office { */ 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. + * 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. * - * 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. + * 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. + * 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] * @@ -11649,11 +12792,16 @@ declare namespace Office { /** * 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. + * 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}. + * 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. + * 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] * @@ -11683,7 +12831,8 @@ declare namespace Office { */ 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. + * 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. * @@ -11719,16 +12868,20 @@ declare namespace Office { * * `addFileAttachmentAsync(uri: string, attachmentName: string, options: AsyncContextOptions): void;` * - * `addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: AsyncResult) => void): void;` + * `addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: AsyncResult) => void): void;` * * @param uri The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. * @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. - * 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. + * isInline: 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 {@link Office.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?: 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. * @@ -11769,7 +12922,7 @@ declare namespace Office { * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. * @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. - * inInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the attachment list. + * isInline: 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: AsyncContextOptions): void; /** @@ -11790,13 +12943,42 @@ declare namespace Office { * * @param uri The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @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. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.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; + addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: AsyncResult) => void): void; + /** + * Adds a file to a message or appointment as an attachment. + * + * The addFileAttachmentFromBase64Async method uploads the file from the base64 encoding and attaches it to the item in the compose form. This method returns the attachment identifier in the AsyncResult.value object. + * + * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
+ * + * @param base64File The base64 encoded content of an image or file to be added to an email or event. + * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. + * @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. + * isInline: 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. + */ + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions, 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -11808,21 +12990,24 @@ declare namespace Office { * * In addition to this signature, the method also has the following signature: * - * `addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;` + * `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 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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. * * @beta */ - addHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -11833,20 +13018,26 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message 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. + * @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 {@link Office.AsyncResult} object. * * @beta */ - addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + 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. * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. + * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or + * a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the + * callback method, if needed. * * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that + * you are editing; however, this is not supported and is not recommended. * * [Api set: Mailbox 1.1] * @@ -11863,23 +13054,30 @@ declare namespace Office { * * `addItemAttachmentAsync(itemId: any, attachmentName: string, options: Office.AsyncContextOptions): void;` * - * `addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: AsyncResult) => void): void;` + * `addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: AsyncResult) => void): void;` * * @param itemId The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. * @param options 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 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. + * @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, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. + * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or + * a code that indicates any error that occurred while attaching the item. + * You can use the options parameter to pass state information to the callback method, if needed. * * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that + * you are editing; however, this is not supported and is not recommended. * * [Api set: Mailbox 1.1] * @@ -11897,11 +13095,15 @@ declare namespace Office { /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. + * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or + * a code that indicates any error that occurred while attaching the item. + * You can use the options parameter to pass state information to the callback method, if needed. * * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that + * you are editing; however, this is not supported and is not recommended. * * [Api set: Mailbox 1.1] * @@ -11921,11 +13123,15 @@ declare namespace Office { /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. + * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or + * a code that indicates any error that occurred while attaching the item. + * You can use the options parameter to pass state information to the callback method, if needed. * * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that + * you are editing; however, this is not supported and is not recommended. * * [Api set: Mailbox 1.1] * @@ -11938,17 +13144,22 @@ declare namespace Office { * * @param itemId The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @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. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.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; + addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: AsyncResult) => void): void; /** * Closes the current item that is being composed * - * The behaviors of the close method depends on the current state of the item being composed. If the item has unsaved changes, the client prompts the user to save, discard, or close the action. + * The behaviors of the close method depends on the current state of the item being composed. + * If the item has unsaved changes, the client prompts the user to save, discard, or close the action. * * In the Outlook desktop client, if the message is an inline reply, the close method has no effect. * - * Note: In Outlook on the web, if the item is an appointment and it has previously been saved using saveAsync, the user is prompted to save, discard, or cancel even if no changes have occurred since the item was last saved. + * Note: In Outlook on the web, if the item is an appointment and it has previously been saved using saveAsync, the user is prompted to save, + * discard, or cancel even if no changes have occurred since the item was last saved. * * [Api set: Mailbox 1.3] * @@ -11962,7 +13173,8 @@ declare namespace Office { /** * Gets initialization data passed when the add-in is activated by an actionable message. * - * Note: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. + * Note: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web + * for Office 365. * * [Api set: Mailbox Preview] * @@ -11976,21 +13188,25 @@ declare namespace Office { * * @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 of type AsyncResult. - * On success, the initialization data is provided in the asyncResult.value property as a string. - * If there is no initialization context, the asyncResult object will contain an Error object with its code property set to 9020 and its name property set to GenericResponseError. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. + * On success, the initialization data is provided in the asyncResult.value property as a string. + * If there is no initialization context, the asyncResult object will contain an Error object with its code property + * set to 9020 and its name property set to GenericResponseError. * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * - * If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. If a field other than the body or subject is selected, the method returns the InvalidSelection error. + * If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. + * If a field other than the body or subject is selected, the method returns the InvalidSelection error. * - * To access the selected data from the callback method, call asyncResult.value.data. To access the source property that the selection comes from, call asyncResult.value.sourceProperty, which will be either body or subject. + * To access the selected data from the callback method, call asyncResult.value.data. + * To access the source property that the selection comes from, call asyncResult.value.sourceProperty, which will be either body or subject. * - * [Api set: Mailbox 1.0] + * [Api set: Mailbox 1.2] * * @returns * The selected data as a string with format determined by coercionType. @@ -12001,18 +13217,22 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose * - * @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present. If HTML, the method returns the selected text, whether it is plaintext or HTML. - * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string, removing any HTML tags present. + * If HTML, the method returns the selected text, whether it is plaintext or HTML. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. */ - getSelectedDataAsync(coerciontype: Office.CoercionType, callback: (result: AsyncResult) => void): void; + getSelectedDataAsync(coerciontype: Office.CoercionType, callback: (result: AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * - * If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. If a field other than the body or subject is selected, the method returns the InvalidSelection error. + * If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. + * If a field other than the body or subject is selected, the method returns the InvalidSelection error. * - * To access the selected data from the callback method, call asyncResult.value.data. To access the source property that the selection comes from, call asyncResult.value.sourceProperty, which will be either body or subject. + * To access the selected data from the callback method, call asyncResult.value.data. + * To access the source property that the selection comes from, call asyncResult.value.sourceProperty, which will be either body or subject. * - * [Api set: Mailbox 1.0] + * [Api set: Mailbox 1.2] * * @returns * The selected data as a string with format determined by coercionType. @@ -12023,18 +13243,24 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose * - * @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present. If HTML, the method returns the selected text, whether it is plaintext or HTML. + * @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string, removing any HTML tags present. + * If HTML, the method returns the selected text, whether it is plaintext or HTML. * @param options 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 When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. */ - getSelectedDataAsync(coerciontype: Office.CoercionType, options: Office.AsyncContextOptions, callback: (result: AsyncResult) => void): void; + 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. + * 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. + * 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] * @@ -12044,14 +13270,20 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message 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. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.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; + loadCustomPropertiesAsync(callback: (result: AsyncResult) => void, userContext?: any): void; /** * Removes an attachment from a message or appointment. * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form + * to continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -12069,18 +13301,24 @@ declare namespace Office { * * `removeAttachmentAsync(attachmentIndex: string, options: Office.AsyncContextOptions): void;` * - * `removeAttachmentAsync(attachmentIndex: string, callback: (result: AsyncResult) => void): void;` + * `removeAttachmentAsync(attachmentIndex: string, callback: (result: AsyncResult) => void): void;` * * @param attachmentIndex The identifier of the attachment to remove. The maximum length of the string is 100 characters. * @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 of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. + * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - removeAttachmentAsync(attachmentIndex: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + removeAttachmentAsync(attachmentIndex: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Removes an attachment from a message or appointment. * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form + * to continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -12098,7 +13336,11 @@ declare namespace Office { /** * Removes an attachment from a message or appointment. * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form + * to continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -12118,7 +13360,11 @@ declare namespace Office { /** * Removes an attachment from a message or appointment. * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form + * to continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -12131,13 +13377,16 @@ declare namespace Office { * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * * @param attachmentIndex The identifier of the attachment to remove. The maximum length of the string is 100 characters. - * @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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.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; + 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -12149,21 +13398,24 @@ declare namespace Office { * * In addition to this signature, the method also has the following signature: * - * `removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;` + * `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 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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. * * @beta */ - removeHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -12174,20 +13426,28 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message 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. + * @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 {@link Office.AsyncResult} object. * * @beta */ - removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; /** * Asynchronously saves an item. * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. + * In Outlook in cached mode, the item is saved to the local cache. * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. + * Saving an existing appointment will send an update to added or removed attendees. * - * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. * * Note: The following clients have different behavior for saveAsync on appointments in compose mode: * @@ -12211,21 +13471,28 @@ declare namespace Office { * * `saveAsync(options: Office.AsyncContextOptions): void;` * - * `saveAsync(callback: (result: AsyncResult) => void): void;` + * `saveAsync(callback: (result: AsyncResult) => void): void;` * * @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 of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. */ - saveAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + saveAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Asynchronously saves an item. * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. + * In Outlook in cached mode, the item is saved to the local cache. * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. + * Saving an existing appointment will send an update to added or removed attendees. * - * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. * * Note: The following clients have different behavior for saveAsync on appointments in compose mode: * @@ -12248,11 +13515,16 @@ declare namespace Office { /** * Asynchronously saves an item. * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. + * In Outlook in cached mode, the item is saved to the local cache. * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. * - * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. * * Note: The following clients have different behavior for saveAsync on appointments in compose mode: * @@ -12277,11 +13549,17 @@ declare namespace Office { /** * Asynchronously saves an item. * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. + * In Outlook in cached mode, the item is saved to the local cache. * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. + * Saving an existing appointment will send an update to added or removed attendees. * - * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. * * Note: The following clients have different behavior for saveAsync on appointments in compose mode: * @@ -12299,13 +13577,16 @@ declare namespace Office { * * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * - * @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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. */ - saveAsync(callback: (result: AsyncResult) => void): void; + saveAsync(callback: (result: AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is + * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. + * After insertion, the cursor is placed at the end of the inserted content. * * [Api set: Mailbox 1.2] * @@ -12323,19 +13604,28 @@ declare namespace Office { * * `setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions): void;` * - * `setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void;` + * `setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void;` * - * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. + * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. * @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. - * coercionType: If text, the current style is applied in Outlook Web App and Outlook. If the field is an HTML editor, only the text data is inserted, even if the data is HTML. If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is applied in Outlook. If the field is a text field, an InvalidDataFormat error is returned. If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; if the field is text, then plain text is used. - * @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. + * coercionType: If text, the current style is applied in Outlook Web App and Outlook. + * If the field is an HTML editor, only the text data is inserted, even if the data is HTML. + * If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is + * applied in Outlook. If the field is a text field, an InvalidDataFormat error is returned. + * If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; + * if the field is text, then plain text is used. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult) => void): void; + setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is + * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. + * After insertion, the cursor is placed at the end of the inserted content. * * [Api set: Mailbox 1.2] * @@ -12347,13 +13637,16 @@ declare namespace Office { * * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * - * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. + * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. */ setSelectedDataAsync(data: string): void; /** * Asynchronously inserts data into the body or subject of a message. * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is + * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. + * After insertion, the cursor is placed at the end of the inserted content. * * [Api set: Mailbox 1.2] * @@ -12365,16 +13658,24 @@ declare namespace Office { * * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * - * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. + * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. * @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. - * coercionType: If text, the current style is applied in Outlook Web App and Outlook. If the field is an HTML editor, only the text data is inserted, even if the data is HTML. If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is applied in Outlook. If the field is a text field, an InvalidDataFormat error is returned. If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; if the field is text, then plain text is used. + * coercionType: If text, the current style is applied in Outlook Web App and Outlook. + * If the field is an HTML editor, only the text data is inserted, even if the data is HTML. + * If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is + * applied in Outlook. If the field is a text field, an InvalidDataFormat error is returned. + * If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; + * if the field is text, then plain text is used. */ setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions): void; /** * Asynchronously inserts data into the body or subject of a message. * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is + * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. + * After insertion, the cursor is placed at the end of the inserted content. * * [Api set: Mailbox 1.2] * @@ -12386,15 +13687,18 @@ declare namespace Office { * * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * - * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @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. + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. + * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type{@link Office.AsyncResult}. */ - setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void; + setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void; } /** * The message read mode of {@link Office.Item | Office.context.mailbox.item}. * - * 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. + * 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 { /** @@ -12408,7 +13712,9 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message 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}. + * 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[]; @@ -12425,9 +13731,11 @@ declare namespace Office { */ 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. + * 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. * - * The cc property returns an array that contains an EmailAddressDetails object for each recipient listed on the Cc line of the message. The collection is limited to a maximum of 100 members. + * The cc property returns an array that contains an EmailAddressDetails object for each recipient listed on the Cc line of the message. + * The collection is limited to a maximum of 100 members. * * [Api set: Mailbox 1.0] * @@ -12441,9 +13749,12 @@ declare namespace Office { /** * Gets an identifier for the email conversation that contains a particular message. * - * You can get an integer for this property if your mail app is activated in read forms or responses in compose forms. If subsequently the user changes the subject of the reply message, upon sending the reply, the conversation ID for that message will change and that value you obtained earlier will no longer apply. + * You can get an integer for this property if your mail app is activated in read forms or responses in compose forms. + * If subsequently the user changes the subject of the reply message, upon sending the reply, the conversation ID for that message will change + * and that value you obtained earlier will no longer apply. * - * You get null for this property for a new item in a compose form. If the user sets a subject and saves the item, the conversationId property will return a value. + * You get null for this property for a new item in a compose form. + * If the user sets a subject and saves the item, the conversationId property will return a value. * * [Api set: Mailbox 1.0] * @@ -12483,7 +13794,8 @@ declare namespace Office { /** * 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 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 from property is undefined. * @@ -12513,7 +13825,8 @@ declare namespace Office { /** * 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. + * 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] * @@ -12523,7 +13836,8 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read - * The itemClass property specifies the message class of the selected item. The following are the default message classes for the message or appointment item. + * The itemClass property specifies the message class of the selected item. + * The following are the default message classes for the message or appointment item. * * * @@ -12548,9 +13862,14 @@ declare namespace Office { /** * 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. + * 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. + * 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 {@link https://docs.microsoft.com/outlook/add-ins/use-rest-api#get-the-item-id | Use the Outlook REST APIs from an Outlook add-in}. * * [Api set: Mailbox 1.0] * @@ -12564,7 +13883,8 @@ declare namespace Office { /** * 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. + * 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] * @@ -12578,7 +13898,9 @@ declare namespace Office { /** * 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. + * 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] * @@ -12602,13 +13924,17 @@ declare namespace Office { */ 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. + * 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. + * 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. + * 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] * @@ -12624,11 +13950,16 @@ declare namespace Office { /** * 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. + * 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}. + * 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. + * 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] * @@ -12644,7 +13975,8 @@ declare namespace Office { /** * 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. + * 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. * @@ -12674,9 +14006,11 @@ declare namespace Office { */ 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. + * 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. + * 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] * @@ -12691,7 +14025,8 @@ declare namespace Office { /** * 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -12703,22 +14038,25 @@ declare namespace Office { * * In addition to this signature, the method also has the following signature: * - * `addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;` + * `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 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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. * * @beta */ - addHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -12729,20 +14067,25 @@ declare namespace Office { *
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message 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. + * @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 {@link Office.AsyncResult} object. * * @beta */ - addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + 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. + * 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. * * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. * * If any of the string parameters exceed their limits, displayReplyAllForm throws an exception. * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. If this isn't possible, then no error message is thrown. + * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and + * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. + * If this isn't possible, then no error message is thrown. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * @@ -12765,7 +14108,9 @@ declare namespace Office { * * If any of the string parameters exceed their limits, displayReplyForm throws an exception. * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. If this isn't possible, then no error message is thrown. + * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and + * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. + * If this isn't possible, then no error message is thrown. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * @@ -12783,9 +14128,11 @@ declare namespace Office { */ displayReplyForm(formData: string | ReplyFormData): void; /** - * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. + * Gets initialization data passed when the add-in is + * {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * - * Note: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. + * Note: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web + * for Office 365. * * [Api set: Mailbox Preview] * @@ -12797,21 +14144,25 @@ declare namespace Office { * * In addition to this signature, the method also has the following signature: * - * `getInitializationContextAsync(callback?: (result: AsyncResult) => void): void;` + * `getInitializationContextAsync(callback?: (result: AsyncResult) => void): void;` * * @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. - * On success, the initialization data is provided in the asyncResult.value property as a string. - * If there is no initialization context, the asyncResult object will contain an Error object with its code property set to 9020 and its name property set to GenericResponseError. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. + * On success, the initialization data is provided in the asyncResult.value property as a string. + * If there is no initialization context, the asyncResult object will contain an Error object with its code property + * set to 9020 and its name property set to GenericResponseError. * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** - * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. + * Gets initialization data passed when the add-in is + * {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * - * Note: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. + * Note: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the + * web for Office 365. * * [Api set: Mailbox Preview] * @@ -12821,13 +14172,15 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read * - * @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. - * On success, the initialization data is provided in the asyncResult.value property as a string. - * If there is no initialization context, the asyncResult object will contain an Error object with its code property set to 9020 and its name property set to GenericResponseError. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. + * On success, the initialization data is provided in the asyncResult.value property as a string. + * If there is no initialization context, the asyncResult object will contain an Error object with its code property + * set to 9020 and its name property set to GenericResponseError. * * @beta */ - getInitializationContextAsync(callback?: (result: AsyncResult) => void): void; + getInitializationContextAsync(callback?: (result: AsyncResult) => void): void; /** * Gets the entities found in the selected item's body. * @@ -12852,7 +14205,9 @@ declare namespace Office { * @param entityType One of the EntityType enumeration values. * * @returns - * If the value passed in entityType is not a valid member of the EntityType enumeration, the method returns null. If no entities of the specified type are present in the item's body, the method returns an empty array. Otherwise, the type of the objects in the returned array depends on the type of entity requested in the entityType parameter. + * If the value passed in entityType is not a valid member of the EntityType enumeration, the method returns null. + * If no entities of the specified type are present in the item's body, the method returns an empty array. + * Otherwise, the type of the objects in the returned array depends on the type of entity requested in the entityType parameter. * * @remarks * @@ -12860,7 +14215,8 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Read * - * While the minimum permission level to use this method is Restricted, some entity types require ReadItem to access, as specified in the following table. + * While the minimum permission level to use this method is Restricted, some entity types require ReadItem to access, as specified in the + * following table. * * * @@ -12909,7 +14265,8 @@ declare namespace Office { /** * Returns well-known entities in the selected item that pass the named filter defined in the manifest XML file. * - * The getFilteredEntitiesByName method returns the entities that match the regular expression defined in the ItemHasKnownEntity rule element in the manifest XML file with the specified FilterName element value. + * The getFilteredEntitiesByName method returns the entities that match the regular expression defined in the ItemHasKnownEntity rule element + * in the manifest XML file with the specified FilterName element value. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * @@ -12922,22 +14279,33 @@ declare namespace Office { *
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
* * @param name The name of the ItemHasKnownEntity rule element that defines the filter to match. - * @returns If there is no ItemHasKnownEntity element in the manifest with a FilterName element value that matches the name parameter, the method returns null. If the name parameter does match an ItemHasKnownEntity element in the manifest, but there are no entities in the current item that match, the method return an empty array. + * @returns If there is no ItemHasKnownEntity element in the manifest with a FilterName element value that matches the name parameter, + * the method returns null. + * If the name parameter does match an ItemHasKnownEntity element in the manifest, but there are no entities in the current item that match, + * the method return an empty array. */ getFilteredEntitiesByName(name: string): (string | Contact | MeetingSuggestion | PhoneNumber | TaskSuggestion)[]; /** * Returns string values in the selected item that match the regular expressions defined in the manifest XML file. * - * The getRegExMatches method returns the strings that match the regular expression defined in each ItemHasRegularExpressionMatch or ItemHasKnownEntity rule element in the manifest XML file. For an ItemHasRegularExpressionMatch rule, a matching string has to occur in the property of the item that is specified by that rule. The PropertyName simple type defines the supported properties. + * The getRegExMatches method returns the strings that match the regular expression defined in each ItemHasRegularExpressionMatch or + * ItemHasKnownEntity rule element in the manifest XML file. + * For an ItemHasRegularExpressionMatch rule, a matching string has to occur in the property of the item that is specified by that rule. + * The PropertyName simple type defines the supported properties. * - * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body and should not attempt to return the entire body of the item. Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. Instead, use the Body.getAsync method to retrieve the entire body. + * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body + * and should not attempt to return the entire body of the item. + * Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. + * Instead, use the Body.getAsync method to retrieve the entire body. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * * [Api set: Mailbox 1.0] * * @returns - * An object that contains arrays of strings that match the regular expressions defined in the manifest XML file. The name of each array is equal to the corresponding value of the RegExName attribute of the matching ItemHasRegularExpressionMatch rule or the FilterName attribute of the matching ItemHasKnownEntity rule. + * An object that contains arrays of strings that match the regular expressions defined in the manifest XML file. + * The name of each array is equal to the corresponding value of the RegExName attribute of the matching ItemHasRegularExpressionMatch rule + * or the FilterName attribute of the matching ItemHasKnownEntity rule. * * @remarks * @@ -12949,9 +14317,12 @@ declare namespace Office { /** * Returns string values in the selected item that match the named regular expression defined in the manifest XML file. * - * The getRegExMatchesByName method returns the strings that match the regular expression defined in the ItemHasRegularExpressionMatch rule element in the manifest XML file with the specified RegExName element value. + * The getRegExMatchesByName method returns the strings that match the regular expression defined in the ItemHasRegularExpressionMatch rule + * element in the manifest XML file with the specified RegExName element value. * - * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body and should not attempt to return the entire body of the item. Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. + * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body + * and should not attempt to return the entire body of the item. + * Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * @@ -12986,18 +14357,27 @@ declare namespace Office { */ getSelectedEntities(): Entities; /** - * Returns string values in a highlighted match that match the regular expressions defined in the manifest XML file. Highlighted matches apply to contextual add-ins. + * Returns string values in a highlighted match that match the regular expressions defined in the manifest XML file. + * Highlighted matches apply to contextual add-ins. * - * The getSelectedRegExMatches method returns the strings that match the regular expression defined in each ItemHasRegularExpressionMatch or ItemHasKnownEntity rule element in the manifest XML file. For an ItemHasRegularExpressionMatch rule, a matching string has to occur in the property of the item that is specified by that rule. The PropertyName simple type defines the supported properties. + * The getSelectedRegExMatches method returns the strings that match the regular expression defined in each ItemHasRegularExpressionMatch or + * ItemHasKnownEntity rule element in the manifest XML file. + * For an ItemHasRegularExpressionMatch rule, a matching string has to occur in the property of the item that is specified by that rule. + * The PropertyName simple type defines the supported properties. * - * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body and should not attempt to return the entire body of the item. Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. Instead, use the Body.getAsync method to retrieve the entire body. + * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body + * and should not attempt to return the entire body of the item. + * Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. + * Instead, use the Body.getAsync method to retrieve the entire body. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * * [Api set: Mailbox 1.6] * * @returns - * An object that contains arrays of strings that match the regular expressions defined in the manifest XML file. The name of each array is equal to the corresponding value of the RegExName attribute of the matching ItemHasRegularExpressionMatch rule or the FilterName attribute of the matching ItemHasKnownEntity rule. + * An object that contains arrays of strings that match the regular expressions defined in the manifest XML file. + * The name of each array is equal to the corresponding value of the RegExName attribute of the matching ItemHasRegularExpressionMatch rule or + * the FilterName attribute of the matching ItemHasKnownEntity rule. * * @remarks * @@ -13009,9 +14389,13 @@ declare namespace Office { /** * 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. + * 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. + * 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] * @@ -13021,14 +14405,17 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message 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. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.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; + 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -13040,21 +14427,24 @@ declare namespace Office { * * In addition to this signature, the method also has the following signature: * - * `removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;` + * `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 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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. * * @beta */ - removeHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + 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. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrencePatternChanged`. * * [Api set: Mailbox Preview] * @@ -13065,12 +14455,14 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message 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. + * @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 {@link Office.AsyncResult} object. * * @beta */ - removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; } /** @@ -13132,11 +14524,13 @@ declare namespace Office { /** * Gets the location of an appointment. * - * The getAsync method starts an asynchronous call to the Exchange server to get the location of an appointment. The location of the appointment is provided as a string in the asyncResult.value property. + * The getAsync method starts an asynchronous call to the Exchange server to get the location of an appointment. + * The location of the appointment is provided as a string in the asyncResult.value property. * * @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 of type AsyncResult. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. * * [Api set: Mailbox 1.1] * @@ -13147,16 +14541,18 @@ declare namespace Office { * * In addition to this signature, the method also has the following signature: * - * `getAsync(callback: (result: AsyncResult) => void): void;` + * `getAsync(callback: (result: AsyncResult) => void): void;` * */ - getAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Gets the location of an appointment. * - * The getAsync method starts an asynchronous call to the Exchange server to get the location of an appointment. The location of the appointment is provided as a string in the asyncResult.value property. + * The getAsync method starts an asynchronous call to the Exchange server to get the location of an appointment. + * The location of the appointment is provided as a string in the asyncResult.value property. * - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. * * [Api set: Mailbox 1.1] * @@ -13165,16 +14561,18 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose */ - getAsync(callback: (result: AsyncResult) => void): void; + getAsync(callback: (result: AsyncResult) => void): void; /** * Sets the location of an appointment. * - * The setAsync method starts an asynchronous call to the Exchange server to set the location of an appointment. Setting the location of an appointment overwrites the current location. + * The setAsync method starts an asynchronous call to the Exchange server to set the location of an appointment. + * Setting the location of an appointment overwrites the current location. * * @param location The location of the appointment. The string is limited to 255 characters. * @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 of type AsyncResult. If setting the location fails, the asyncResult.error property will contain an error code. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. If setting the location fails, the asyncResult.error property will contain an error code. * * [Api set: Mailbox 1.1] * @@ -13191,13 +14589,14 @@ declare namespace Office { * * `setAsync(location: string, options: Office.AsyncContextOptions): void;` * - * `setAsync(location: string, callback: (result: AsyncResult) => void): void;` + * `setAsync(location: string, callback: (result: AsyncResult) => void): void;` */ - setAsync(location: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + setAsync(location: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Sets the location of an appointment. * - * The setAsync method starts an asynchronous call to the Exchange server to set the location of an appointment. Setting the location of an appointment overwrites the current location. + * The setAsync method starts an asynchronous call to the Exchange server to set the location of an appointment. + * Setting the location of an appointment overwrites the current location. * * @param location The location of the appointment. The string is limited to 255 characters. * @@ -13214,7 +14613,8 @@ declare namespace Office { /** * Sets the location of an appointment. * - * The setAsync method starts an asynchronous call to the Exchange server to set the location of an appointment. Setting the location of an appointment overwrites the current location. + * The setAsync method starts an asynchronous call to the Exchange server to set the location of an appointment. + * Setting the location of an appointment overwrites the current location. * * @param location The location of the appointment. The string is limited to 255 characters. * @param options Optional. An object literal that contains one or more of the following properties. @@ -13233,10 +14633,12 @@ declare namespace Office { /** * Sets the location of an appointment. * - * The setAsync method starts an asynchronous call to the Exchange server to set the location of an appointment. Setting the location of an appointment overwrites the current location. + * The setAsync method starts an asynchronous call to the Exchange server to set the location of an appointment. + * Setting the location of an appointment overwrites the current location. * * @param location The location of the appointment. The string is limited to 255 characters. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If setting the location fails, the asyncResult.error property will contain an error code. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. If setting the location fails, the asyncResult.error property will contain an error code. * * [Api set: Mailbox 1.1] * @@ -13247,7 +14649,7 @@ declare namespace Office { * * ErrorsDataExceedsMaximumSize - The location parameter is longer than 255 characters. */ - setAsync(location: string, callback: (result: AsyncResult) => void): void; + setAsync(location: string, callback: (result: AsyncResult) => void): void; } /** * Provides access to the Outlook Add-in object model for Microsoft Outlook and Microsoft Outlook on the web. @@ -13273,11 +14675,18 @@ declare namespace Office { * * Contains the following members: * - * - hostName (string): A string that represents the name of the host application. It be one of the following values: Outlook, Mac Outlook, OutlookIOS, or OutlookWebApp. + * - hostName (string): A string that represents the name of the host application. + * It be one of the following values: Outlook, Mac Outlook, OutlookIOS, or OutlookWebApp. * - * - hostVersion (string): A string that represents the version of either the host application or the Exchange Server. If the mail add-in is running on the Outlook desktop client or Outlook for iOS, the hostVersion property returns the version of the host application, Outlook. In Outlook Web App, the property returns the version of the Exchange Server. An example is the string 15.0.468.0. + * - hostVersion (string): A string that represents the version of either the host application or the Exchange Server. + * If the mail add-in is running on the Outlook desktop client or Outlook for iOS, the hostVersion property returns the version of the + * host application, Outlook. In Outlook Web App, the property returns the version of the Exchange Server. An example is the string 15.0.468.0. * - * - OWAView (MailboxEnums.OWAView or string): An enum (or string literal) that represents the current view of Outlook Web App. If the host application is not Outlook Web App, then accessing this property results in undefined. Outlook Web App has three views (OneColumn - displayed when the screen is narrow, TwoColumns - displayed when the screen is wider, and ThreeColumns - displayed when the screen is wide) that correspond to the width of the screen and the window, and the number of columns that can be displayed. + * - OWAView (MailboxEnums.OWAView or string): An enum (or string literal) that represents the current view of Outlook Web App. + * If the host application is not Outlook Web App, then accessing this property results in undefined. + * Outlook Web App has three views (OneColumn - displayed when the screen is narrow, TwoColumns - displayed when the screen is wider, + * and ThreeColumns - displayed when the screen is wide) that correspond to the width of the screen and the window, and the number of columns + * that can be displayed. * * More information is under {@link Office.Diagnostics}. * @@ -13294,7 +14703,8 @@ declare namespace Office { * * Your app must have the ReadItem permission specified in its manifest to call the ewsUrl member in read mode. * - * In compose mode you must call the saveAsync method before you can use the ewsUrl member. Your app must have ReadWriteItem permissions to call the saveAsync method. + * In compose mode you must call the saveAsync method before you can use the ewsUrl member. + * Your app must have ReadWriteItem permissions to call the saveAsync method. * * [Api set: Mailbox 1.0] * @@ -13320,7 +14730,8 @@ declare namespace Office { * * Your app must have the ReadItem permission specified in its manifest to call the restUrl member in read mode. * - * In compose mode you must call the saveAsync method before you can use the restUrl member. Your app must have ReadWriteItem permissions to call the saveAsync method. + * In compose mode you must call the saveAsync method before you can use the restUrl member. + * Your app must have ReadWriteItem permissions to call the saveAsync method. * * [Api set: Mailbox 1.5] * @@ -13342,7 +14753,9 @@ declare namespace Office { /** * Adds an event handler for a supported event. * - * Currently the only supported event type is Office.EventType.ItemChanged, which is invoked when the user selects a new item. This event is used by add-ins that implement a pinnable taskpane, and allows the add-in to refresh the taskpane UI based on the currently selected item. + * Currently the only supported event type is Office.EventType.ItemChanged, which is invoked when the user selects a new item. + * This event is used by add-ins that implement a pinnable taskpane, and allows the add-in to refresh the taskpane UI based on the currently + * selected item. * * [Api set: Mailbox 1.5] * @@ -13353,15 +14766,18 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or 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 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. Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. */ - addHandlerAsync(eventType: Office.EventType, handler: (type: EventType) => void, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: (type: EventType) => void, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Converts an item ID formatted for REST into EWS format. * - * Item IDs retrieved via a REST API (such as the Outlook Mail API or the Microsoft Graph) use a different format than the format used by Exchange Web Services (EWS). The convertToEwsId method converts a REST-formatted ID into the proper format for EWS. + * Item IDs retrieved via a REST API (such as the Outlook Mail API or the Microsoft Graph) use a different format than the format used by + * Exchange Web Services (EWS). The convertToEwsId method converts a REST-formatted ID into the proper format for EWS. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * @@ -13380,9 +14796,15 @@ declare namespace Office { /** * Gets a dictionary containing time information in local client time. * - * The dates and times used by a mail app for Outlook or Outlook Web App can use different time zones. Outlook uses the client computer time zone; Outlook Web App uses the time zone set on the Exchange Admin Center (EAC). You should handle date and time values so that the values you display on the user interface are always consistent with the time zone that the user expects. + * The dates and times used by a mail app for Outlook or Outlook Web App can use different time zones. + * Outlook uses the client computer time zone; Outlook Web App uses the time zone set on the Exchange Admin Center (EAC). + * You should handle date and time values so that the values you display on the user interface are always consistent with the time zone that + * the user expects. * - * If the mail app is running in Outlook, the convertToLocalClientTime method will return a dictionary object with the values set to the client computer time zone. If the mail app is running in Outlook Web App, the convertToLocalClientTime method will return a dictionary object with the values set to the time zone specified in the EAC. + * If the mail app is running in Outlook, the convertToLocalClientTime method will return a dictionary object with the values set to the + * client computer time zone. + * If the mail app is running in Outlook Web App, the convertToLocalClientTime method will return a dictionary object with the values set to + * the time zone specified in the EAC. * * [Api set: Mailbox 1.0] * @@ -13408,7 +14830,9 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read * - * Item IDs retrieved via EWS or via the itemId property use a different format than the format used by REST APIs (such as the {@link https://msdn.microsoft.com/office/office365/APi/mail-rest-operations | Outlook Mail API} or the {@link http://graph.microsoft.io/ | Microsoft Graph}. The convertToRestId method converts an EWS-formatted ID into the proper format for REST. + * Item IDs retrieved via EWS or via the itemId property use a different format than the format used by REST APIs (such as the + * {@link https://msdn.microsoft.com/office/office365/APi/mail-rest-operations | Outlook Mail API} or the {@link http://graph.microsoft.io/ | Microsoft Graph}. + * The convertToRestId method converts an EWS-formatted ID into the proper format for REST. * * @param itemId An item ID formatted for Exchange Web Services (EWS) * @param restVersion A value indicating the version of the Outlook REST API that the converted ID will be used with. @@ -13417,7 +14841,8 @@ declare namespace Office { /** * Gets a Date object from a dictionary containing time information. * - * The convertToUtcClientTime method converts a dictionary containing a local date and time to a Date object with the correct values for the local date and time. + * The convertToUtcClientTime method converts a dictionary containing a local date and time to a Date object with the correct values for the + * local date and time. * * [Api set: Mailbox 1.0] * @@ -13434,13 +14859,17 @@ declare namespace Office { /** * Displays an existing calendar appointment. * - * The displayAppointmentForm method opens an existing calendar appointment in a new window on the desktop or in a dialog box on mobile devices. + * The displayAppointmentForm method opens an existing calendar appointment in a new window on the desktop or in a dialog box on + * mobile devices. * - * In Outlook for Mac, you can use this method to display a single appointment that is not part of a recurring series, or the master appointment of a recurring series, but you cannot display an instance of the series. This is because in Outlook for Mac, you cannot access the properties (including the item ID) of instances of a recurring series. + * In Outlook for Mac, you can use this method to display a single appointment that is not part of a recurring series, or the + * master appointment of a recurring series, but you cannot display an instance of the series. + * This is because in Outlook for Mac, you cannot access the properties (including the item ID) of instances of a recurring series. * * In Outlook Web App, this method opens the specified form only if the body of the form is less than or equal to 32KB number of characters. * - * If the specified item identifier does not identify an existing appointment, a blank pane opens on the client computer or device, and no error message will be returned. + * If the specified item identifier does not identify an existing appointment, a blank pane opens on the client computer or device, and + * no error message will be returned. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * @@ -13462,9 +14891,11 @@ declare namespace Office { * * In Outlook Web App, this method opens the specified form only if the body of the form is less than or equal to 32 KB number of characters. * - * If the specified item identifier does not identify an existing message, no message will be displayed on the client computer, and no error message will be returned. + * If the specified item identifier does not identify an existing message, no message will be displayed on the client computer, and + * no error message will be returned. * - * Do not use the displayMessageForm with an itemId that represents an appointment. Use the displayAppointmentForm method to display an existing appointment, and displayNewAppointmentForm to display a form to create a new appointment. + * Do not use the displayMessageForm with an itemId that represents an appointment. Use the displayAppointmentForm method to display + * an existing appointment, and displayNewAppointmentForm to display a form to create a new appointment. * * Note: This method is not supported in Outlook for iOS or Outlook for Android. * @@ -13482,11 +14913,16 @@ declare namespace Office { /** * Displays a form for creating a new calendar appointment. * - * The displayNewAppointmentForm method opens a form that enables the user to create a new appointment or meeting. If parameters are specified, the appointment form fields are automatically populated with the contents of the parameters. + * The displayNewAppointmentForm method opens a form that enables the user to create a new appointment or meeting. + * If parameters are specified, the appointment form fields are automatically populated with the contents of the parameters. * - * In Outlook Web App and OWA for Devices, this method always displays a form with an attendees field. If you do not specify any attendees as input arguments, the method displays a form with a Save button. If you have specified attendees, the form would include the attendees and a Send button. + * In Outlook Web App and OWA for Devices, this method always displays a form with an attendees field. + * If you do not specify any attendees as input arguments, the method displays a form with a Save button. + * If you have specified attendees, the form would include the attendees and a Send button. * - * In the Outlook rich client and Outlook RT, if you specify any attendees or resources in the requiredAttendees, optionalAttendees, or resources parameter, this method displays a meeting form with a Send button. If you don't specify any recipients, this method displays an appointment form with a Save & Close button. + * In the Outlook rich client and Outlook RT, if you specify any attendees or resources in the requiredAttendees, optionalAttendees, or + * resources parameter, this method displays a meeting form with a Send button. + * If you don't specify any recipients, this method displays an appointment form with a Save & Close button. * * If any of the parameters exceed the specified size limits, or if an unknown parameter name is specified, an exception is thrown. * @@ -13506,7 +14942,8 @@ declare namespace Office { /** * Displays a form for creating a new message. * - * The displayNewMessageForm method opens a form that enables the user to create a new message. If parameters are specified, the message form fields are automatically populated with the contents of the parameters. + * The displayNewMessageForm method opens a form that enables the user to create a new message. If parameters are specified, the message form + * fields are automatically populated with the contents of the parameters. * * If any of the parameters exceed the specified size limits, or if an unknown parameter name is specified, an exception is thrown. * @@ -13520,11 +14957,14 @@ declare namespace Office { * * @param parameters A dictionary containing all values to be filled in for the user in the new form. All parameters are optional. * - * toRecipients: An array of strings containing the email addresses or an array containing an {@link Office.EmailAddressDetails} object for each of the recipients on the To line. The array is limited to a maximum of 100 entries. + * toRecipients: An array of strings containing the email addresses or an array containing an {@link Office.EmailAddressDetails} object + * for each of the recipients on the To line. The array is limited to a maximum of 100 entries. * - * ccRecipients: An array of strings containing the email addresses or an array containing an {@link Office.EmailAddressDetails} object for each of the recipients on the Cc line. The array is limited to a maximum of 100 entries. + * ccRecipients: An array of strings containing the email addresses or an array containing an {@link Office.EmailAddressDetails} object + * for each of the recipients on the Cc line. The array is limited to a maximum of 100 entries. * - * bccRecipients: An array of strings containing the email addresses or an array containing an {@link Office.EmailAddressDetails} object for each of the recipients on the Bcc line. The array is limited to a maximum of 100 entries. + * bccRecipients: An array of strings containing the email addresses or an array containing an {@link Office.EmailAddressDetails} object + * for each of the recipients on the Bcc line. The array is limited to a maximum of 100 entries. * * subject: A string containing the subject of the message. The string is limited to a maximum of 255 characters. * @@ -13538,25 +14978,33 @@ declare namespace Office { * * attachments.url: Only used if type is set to file. The URI of the location for the file. * - * attachments.isInline: Only used if type is set to file. If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the attachment list. + * attachments.isInline: Only used if type is set to file. If true, indicates that the attachment will be shown inline in the + * message body, and should not be displayed in the attachment list. * - * attachments.itemId: Only used if type is set to item. The EWS item id of the existing e-mail you want to attach to the new message. This is a string up to 100 characters. + * attachments.itemId: Only used if type is set to item. The EWS item id of the existing e-mail you want to attach to the new message. + * This is a string up to 100 characters. */ displayNewMessageForm(parameters: any): void; /** * Gets a string that contains a token used to call REST APIs or Exchange Web Services. * - * The getCallbackTokenAsync method makes an asynchronous call to get an opaque token from the Exchange Server that hosts the user's mailbox. The lifetime of the callback token is 5 minutes. + * The getCallbackTokenAsync method makes an asynchronous call to get an opaque token from the Exchange Server that hosts the user's mailbox. + * The lifetime of the callback token is 5 minutes. * * *REST Tokens* * - * When a REST token is requested (options.isRest = true), the resulting token will not work to authenticate Exchange Web Services calls. The token will be limited in scope to read-only access to the current item and its attachments, unless the add-in has specified the ReadWriteMailbox permission in its manifest. If the ReadWriteMailbox permission is specified, the resulting token will grant read/write access to mail, calendar, and contacts, including the ability to send mail. + * When a REST token is requested (options.isRest = true), the resulting token will not work to authenticate Exchange Web Services calls. + * The token will be limited in scope to read-only access to the current item and its attachments, unless the add-in has specified the + * ReadWriteMailbox permission in its manifest. + * If the ReadWriteMailbox permission is specified, the resulting token will grant read/write access to mail, calendar, and contacts, + * including the ability to send mail. * * The add-in should use the restUrl property to determine the correct URL to use when making REST API calls. * * *EWS Tokens* * - * When an EWS token is requested (options.isRest = false), the resulting token will not work to authenticate REST API calls. The token will be limited in scope to accessing the current item. + * When an EWS token is requested (options.isRest = false), the resulting token will not work to authenticate REST API calls. + * The token will be limited in scope to accessing the current item. * * The add-in should use the ewsUrl property to determine the correct URL to use when making EWS calls. * @@ -13572,26 +15020,31 @@ declare namespace Office { * * In addition to this signature, the method has the following signatures: * - * `getCallbackTokenAsync(callback: (result: AsyncResult) => void): void;` + * `getCallbackTokenAsync(callback: (result: AsyncResult) => void): void;` * - * `getCallbackTokenAsync(callback: (result: AsyncResult) => void, userContext?: any): void;` + * `getCallbackTokenAsync(callback: (result: AsyncResult) => void, userContext?: any): void;` * * @param options An object literal that contains one or more of the following properties. * isRest: Determines if the token provided will be used for the Outlook REST APIs or Exchange Web Services. Default value is false. * asyncContext: Any state data that is passed to the asynchronous method. - * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. The token is provided as a string in the asyncResult.value property. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. The token is provided as a string in the asyncResult.value property. */ - getCallbackTokenAsync(options: Office.AsyncContextOptions, callback: (result: AsyncResult) => void): void; + getCallbackTokenAsync(options: Office.AsyncContextOptions & { isRest?: boolean }, callback: (result: AsyncResult) => void): void; /** * Gets a string that contains a token used to get an attachment or item from an Exchange Server. * - * The getCallbackTokenAsync method makes an asynchronous call to get an opaque token from the Exchange Server that hosts the user's mailbox. The lifetime of the callback token is 5 minutes. + * The getCallbackTokenAsync method makes an asynchronous call to get an opaque token from the Exchange Server that hosts the user's mailbox. + * The lifetime of the callback token is 5 minutes. * - * You can pass the token and an attachment identifier or item identifier to a third-party system. The third-party system uses the token as a bearer authorization token to call the Exchange Web Services (EWS) GetAttachment or GetItem operation to return an attachment or item. For example, you can create a remote service to get attachments from the selected item. + * You can pass the token and an attachment identifier or item identifier to a third-party system. + * The third-party system uses the token as a bearer authorization token to call the Exchange Web Services (EWS) GetAttachment or + * GetItem operation to return an attachment or item. For example, you can create a remote service to get attachments from the selected item. * * Your app must have the ReadItem permission specified in its manifest to call the getCallbackTokenAsync method in read mode. * - * In compose mode you must call the saveAsync method to get an item identifier to pass to the getCallbackTokenAsync method. Your app must have ReadWriteItem permissions to call the saveAsync method. + * In compose mode you must call the saveAsync method to get an item identifier to pass to the getCallbackTokenAsync method. + * Your app must have ReadWriteItem permissions to call the saveAsync method. * * [Api set: Mailbox 1.5] * @@ -13601,19 +15054,24 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose and read * - * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. The token is provided as a string in the asyncResult.value property. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * The token is provided as a string in the asyncResult.value property. */ - getCallbackTokenAsync(callback: (result: AsyncResult) => void): void; + getCallbackTokenAsync(callback: (result: AsyncResult) => void): void; /** * Gets a string that contains a token used to get an attachment or item from an Exchange Server. * - * The getCallbackTokenAsync method makes an asynchronous call to get an opaque token from the Exchange Server that hosts the user's mailbox. The lifetime of the callback token is 5 minutes. + * The getCallbackTokenAsync method makes an asynchronous call to get an opaque token from the Exchange Server that hosts the user's mailbox. + * The lifetime of the callback token is 5 minutes. * - * You can pass the token and an attachment identifier or item identifier to a third-party system. The third-party system uses the token as a bearer authorization token to call the Exchange Web Services (EWS) GetAttachment or GetItem operation to return an attachment or item. For example, you can create a remote service to get attachments from the selected item. + * You can pass the token and an attachment identifier or item identifier to a third-party system. + * The third-party system uses the token as a bearer authorization token to call the Exchange Web Services (EWS) GetAttachment or + * GetItem operation to return an attachment or item. For example, you can create a remote service to get attachments from the selected item. * * Your app must have the ReadItem permission specified in its manifest to call the getCallbackTokenAsync method in read mode. * - * In compose mode you must call the saveAsync method to get an item identifier to pass to the getCallbackTokenAsync method. Your app must have ReadWriteItem permissions to call the saveAsync method. + * In compose mode you must call the saveAsync method to get an item identifier to pass to the getCallbackTokenAsync method. + * Your app must have ReadWriteItem permissions to call the saveAsync method. * * [Api set: Mailbox 1.3] * @@ -13623,10 +15081,11 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose and read * - * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. The token is provided as a string in the asyncResult.value property. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. The token is provided as a string in the asyncResult.value property. * @param userContext Optional. Any state data that is passed to the asynchronous method. */ - getCallbackTokenAsync(callback: (result: AsyncResult) => void, userContext?: any): void; + getCallbackTokenAsync(callback: (result: AsyncResult) => void, userContext?: any): void; /** * Gets a token identifying the user and the Office Add-in. * @@ -13640,12 +15099,15 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose and read * - * The getUserIdentityTokenAsync method returns a token that you can use to identify and {@link https://msdn.microsoft.com/library/office/fp179828.aspx | authenticate the add-in and user with a third-party system}. + * The getUserIdentityTokenAsync method returns a token that you can use to identify and + * {@link https://msdn.microsoft.com/library/office/fp179828.aspx | authenticate the add-in and user with a third-party system}. * - * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. + * The token is provided as a string in the asyncResult.value property. * @param userContext Optional. Any state data that is passed to the asynchronous method.| */ - getUserIdentityTokenAsync(callback: (result: AsyncResult) => void, userContext?: any): void; + getUserIdentityTokenAsync(callback: (result: AsyncResult) => void, userContext?: any): void; /** * Makes an asynchronous request to an Exchange Web Services (EWS) service on the Exchange server that hosts the user's mailbox. * @@ -13657,21 +15119,32 @@ declare namespace Office { * * The XML request must specify UTF-8 encoding. * - * Your add-in must have the ReadWriteMailbox permission to use the makeEwsRequestAsync method. For information about using the ReadWriteMailbox permission and the EWS operations that you can call with the makeEwsRequestAsync method, see Specify permissions for mail add-in access to the user's mailbox. + * Your add-in must have the ReadWriteMailbox permission to use the makeEwsRequestAsync method. + * For information about using the ReadWriteMailbox permission and the EWS operations that you can call with the makeEwsRequestAsync method, + * see {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Specify permissions for mail add-in access to the user's mailbox}. * - * The XML result of the EWS call is provided as a string in the asyncResult.value property. If the result exceeds 1 MB in size, an error message is returned instead. + * The XML result of the EWS call is provided as a string in the asyncResult.value property. + * If the result exceeds 1 MB in size, an error message is returned instead. * - * Note: This method is not supported in the following scenarios. - In Outlook for iOS or Outlook for Android - When the add-in is loaded in a Gmail mailbox + * Note: This method is not supported in the following scenarios: + * + * - In Outlook for iOS or Outlook for Android. + * + * - When the add-in is loaded in a Gmail mailbox. * - * Note: The server administrator must set OAuthAuthentication to true on the Client Access Server EWS directory to enable the makeEwsRequestAsync method to make EWS requests. + * Note: The server administrator must set OAuthAuthentication to true on the Client Access Server EWS directory to enable the + * makeEwsRequestAsync method to make EWS requests. * * *Version differences* * - * When you use the makeEwsRequestAsync method in mail apps running in Outlook versions earlier than version 15.0.4535.1004, you should set the encoding value to ISO-8859-1. + * When you use the makeEwsRequestAsync method in mail apps running in Outlook versions earlier than version 15.0.4535.1004, you should set + * the encoding value to ISO-8859-1. * * `` * - * You do not need to set the encoding value when your mail app is running in Outlook on the web. You can determine whether your mail app is running in Outlook or Outlook on the web by using the mailbox.diagnostics.hostName property. You can determine what version of Outlook is running by using the mailbox.diagnostics.hostVersion property. + * You do not need to set the encoding value when your mail app is running in Outlook on the web. + * You can determine whether your mail app is running in Outlook or Outlook on the web by using the mailbox.diagnostics.hostName property. + * You can determine what version of Outlook is running by using the mailbox.diagnostics.hostVersion property. * * [Api set: Mailbox 1.0] * @@ -13682,18 +15155,23 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose and read * * @param data The EWS request. - * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}. + * The `value` property of the result is the XML of the EWS request provided as a string. + * If the result exceeds 1 MB in size, an error message is returned instead. * @param userContext Optional. Any state data that is passed to the asynchronous method. */ - makeEwsRequestAsync(data: any, callback: (result: AsyncResult) => void, userContext?: any): void; + makeEwsRequestAsync(data: any, callback: (result: AsyncResult) => void, userContext?: any): void; } /** * Represents a suggested meeting found in an item. Read mode only. * - * The list of meetings suggested in an email message is returned in the meetingSuggestions property of the Entities object that is returned when the getEntities or getEntitiesByType method is called on the active item. + * The list of meetings suggested in an email message is returned in the meetingSuggestions property of the Entities object that is returned when + * the getEntities or getEntitiesByType method is called on the active item. * - * The start and end values are string representations of a Date object that contains the date and time at which the suggested meeting is to begin and end. The values are in the default time zone specified for the current user. + * The start and end values are string representations of a Date object that contains the date and time at which the suggested meeting is to + * begin and end. + * The values are in the default time zone specified for the current user. * * [Api set: Mailbox 1.0] * @@ -13744,19 +15222,27 @@ declare namespace Office { */ key?: string; /** - * Specifies the ItemNotificationMessageType of message. If type is ProgressIndicator or ErrorMessage, an icon is automatically supplied and the message is not persistent. Therefore the icon and persistent properties are not valid for these types of messages. Including them will result in an ArgumentException. If type is ProgressIndicator, the developer should remove or replace the progress indicator when the action is complete. + * Specifies the ItemNotificationMessageType of message. If type is ProgressIndicator or ErrorMessage, an icon is automatically supplied and + * the message is not persistent. Therefore the icon and persistent properties are not valid for these types of messages. + * Including them will result in an ArgumentException. + * If type is ProgressIndicator, the developer should remove or replace the progress indicator when the action is complete. */ type: Office.MailboxEnums.ItemNotificationMessageType; /** - * A reference to an icon that is defined in the manifest in the Resources section. It appears in the infobar area. It is only applicable if the type is InformationalMessage. Specifying this parameter for an unsupported type results in an exception. + * A reference to an icon that is defined in the manifest in the Resources section. It appears in the infobar area. + * It is only applicable if the type is InformationalMessage. Specifying this parameter for an unsupported type results in an exception. */ icon?: string; /** - * The text of the notification message. Maximum length is 150 characters. If the developer passes in a longer string, an ArgumentOutOfRange exception is thrown. + * The text of the notification message. Maximum length is 150 characters. + * If the developer passes in a longer string, an ArgumentOutOfRange exception is thrown. */ message: string; /** - * Only applicable when type is InformationalMessage. If true, the message remains until removed by this add-in or dismissed by the user. If false, it is removed when the user navigates to a different item. For error notifications, the message persists until the user sees it once. Specifying this parameter for an unsupported type throws an exception. + * Only applicable when type is InformationalMessage. If true, the message remains until removed by this add-in or dismissed by the user. + * If false, it is removed when the user navigates to a different item. + * For error notifications, the message persists until the user sees it once. + * Specifying this parameter for an unsupported type throws an exception. */ persistent?: Boolean; } @@ -13776,11 +15262,14 @@ declare namespace Office { * * There are a maximum of 5 notifications per message. Setting more will return a NumberOfNotificationMessagesExceeded error. * - * @param key A developer-specified key used to reference this notification message. Developers can use it to modify this message later. It can't be longer than 32 characters. - * @param JSONmessage A JSON object that contains the notification message to be added to the item. It contains a NotificationMessageDetails object. + * @param key A developer-specified key used to reference this notification message. + * Developers can use it to modify this message later. It can't be longer than 32 characters. + * @param JSONmessage A JSON object that contains the notification message to be added to the item. + * It contains a NotificationMessageDetails object. * @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 of type AsyncResult. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. * * [Api set: Mailbox 1.3] * @@ -13795,17 +15284,19 @@ declare namespace Office { * * `addAsync(key: string, JSONmessage: NotificationMessageDetails, options: Office.AsyncContextOptions): void;` * - * `addAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: AsyncResult) => void): void;` + * `addAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: AsyncResult) => void): void;` * */ - addAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + addAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Adds a notification to an item. * * There are a maximum of 5 notifications per message. Setting more will return a NumberOfNotificationMessagesExceeded error. * - * @param key A developer-specified key used to reference this notification message. Developers can use it to modify this message later. It can't be longer than 32 characters. - * @param JSONmessage A JSON object that contains the notification message to be added to the item. It contains a NotificationMessageDetails object. + * @param key A developer-specified key used to reference this notification message. Developers can use it to modify this message later. + * It can't be longer than 32 characters. + * @param JSONmessage A JSON object that contains the notification message to be added to the item. + * It contains a NotificationMessageDetails object. * * [Api set: Mailbox 1.3] * @@ -13820,8 +15311,10 @@ declare namespace Office { * * There are a maximum of 5 notifications per message. Setting more will return a NumberOfNotificationMessagesExceeded error. * - * @param key A developer-specified key used to reference this notification message. Developers can use it to modify this message later. It can't be longer than 32 characters. - * @param JSONmessage A JSON object that contains the notification message to be added to the item. It contains a NotificationMessageDetails object. + * @param key A developer-specified key used to reference this notification message. Developers can use it to modify this message later. + * It can't be longer than 32 characters. + * @param JSONmessage A JSON object that contains the notification message to be added to the item. + * It contains a NotificationMessageDetails object. * @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. * @@ -13838,9 +15331,12 @@ declare namespace Office { * * There are a maximum of 5 notifications per message. Setting more will return a NumberOfNotificationMessagesExceeded error. * - * @param key A developer-specified key used to reference this notification message. Developers can use it to modify this message later. It can't be longer than 32 characters. - * @param JSONmessage A JSON object that contains the notification message to be added to the item. It contains a NotificationMessageDetails object. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param key A developer-specified key used to reference this notification message. Developers can use it to modify this message later. + * It can't be longer than 32 characters. + * @param JSONmessage A JSON object that contains the notification message to be added to the item. + * It contains a NotificationMessageDetails object. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. * * [Api set: Mailbox 1.3] * @@ -13849,7 +15345,7 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read */ - addAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: AsyncResult) => void): void; + addAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: AsyncResult) => void): void; /** * Returns all keys and messages for an item. * @@ -13862,13 +15358,14 @@ declare namespace Office { * * In addition to the main signature, this method also has this signature: * - * `getAllAsync(callback: (result: AsyncResult) => void): void;` + * `getAllAsync(callback: (result: AsyncResult) => void): void;` * * @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 of type AsyncResult. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}. + * The `value` property of the result is an array of NotificationMessageDetails objects. */ - getAllAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getAllAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Returns all keys and messages for an item. * @@ -13879,9 +15376,10 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read * - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}. + * The `value` property of the result is an array of NotificationMessageDetails objects. */ - getAllAsync(callback: (result: AsyncResult) => void): void; + getAllAsync(callback: (result: AsyncResult) => void): void; /** * Removes a notification message for an item. * @@ -13898,14 +15396,15 @@ declare namespace Office { * * `removeAsync(key: string, options: Office.AsyncContextOptions): void;` * - * `removeAsync(key: string, callback: (result: AsyncResult) => void): void;` + * `removeAsync(key: string, callback: (result: AsyncResult) => void): void;` * * @param key The key for the notification message to remove. * @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 of type AsyncResult. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. */ - removeAsync(key: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + removeAsync(key: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Removes a notification message for an item. * @@ -13945,9 +15444,10 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read * * @param key The key for the notification message to remove. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. */ - removeAsync(key: string, callback: (result: AsyncResult) => void): void; + removeAsync(key: string, callback: (result: AsyncResult) => void): void; /** * Replaces a notification message that has a given key with another message. * @@ -13966,15 +15466,17 @@ declare namespace Office { * * `replaceAsync(key: string, JSONmessage: NotificationMessageDetails, options: Office.AsyncContextOptions): void;` * - * `replaceAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: AsyncResult) => void): void;` + * `replaceAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: AsyncResult) => void): void;` * * @param key The key for the notification message to replace. It can't be longer than 32 characters. - * @param JSONmessage A JSON object that contains the new notification message to replace the existing message. It contains a NotificationMessageDetails object. + * @param JSONmessage A JSON object that contains the new notification message to replace the existing message. + * It contains a NotificationMessageDetails object. * @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 of type AsyncResult. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. */ - replaceAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + replaceAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Replaces a notification message that has a given key with another message. * @@ -13988,7 +15490,8 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read * * @param key The key for the notification message to replace. It can't be longer than 32 characters. - * @param JSONmessage A JSON object that contains the new notification message to replace the existing message. It contains a NotificationMessageDetails object. + * @param JSONmessage A JSON object that contains the new notification message to replace the existing message. + * It contains a NotificationMessageDetails object. */ replaceAsync(key: string, JSONmessage: NotificationMessageDetails): void; /** @@ -14004,7 +15507,8 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read * * @param key The key for the notification message to replace. It can't be longer than 32 characters. - * @param JSONmessage A JSON object that contains the new notification message to replace the existing message. It contains a NotificationMessageDetails object. + * @param JSONmessage A JSON object that contains the new notification message to replace the existing message. + * It contains a NotificationMessageDetails object. * @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. */ @@ -14022,15 +15526,18 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read * * @param key The key for the notification message to replace. It can't be longer than 32 characters. - * @param JSONmessage A JSON object that contains the new notification message to replace the existing message. It contains a NotificationMessageDetails object. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param JSONmessage A JSON object that contains the new notification message to replace the existing message. + * It contains a NotificationMessageDetails object. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. */ - replaceAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: AsyncResult) => void): void; + replaceAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: AsyncResult) => void): void; } /** * Represents a phone number identified in an item. Read mode only. * - * An array of PhoneNumber objects containing the phone numbers found in an email message is returned in the phoneNumbers property of the Entities object that is returned when you call the getEntities method on the selected item. + * An array of PhoneNumber objects containing the phone numbers found in an email message is returned in the phoneNumbers property of the + * Entities object that is returned when you call the getEntities method on the selected item. * * [Api set: Mailbox 1.0] * @@ -14088,14 +15595,15 @@ declare namespace Office { * * `addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options: Office.AsyncContextOptions): void;` * - * `addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: AsyncResult) => void): void;` + * `addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: AsyncResult) => void): void;` * * @param recipients The recipients to add to the recipients list. * @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 of type AsyncResult. If adding the recipients fails, the asyncResult.error property will contain an error code. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. If adding the recipients fails, the asyncResult.error property will contain an error code. */ - addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Adds a recipient list to the existing recipients for an appointment or message. * @@ -14165,13 +15673,14 @@ declare namespace Office { * ErrorsNumberOfRecipientsExceeded - The number of recipients exceeded 100 entries. * * @param recipients The recipients to add to the recipients list. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If adding the recipients fails, the asyncResult.error property will contain an error code. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. If adding the recipients fails, the asyncResult.error property will contain an error code. */ - addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: AsyncResult) => void): void; + addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: AsyncResult) => void): void; /** * Gets a recipient list for an appointment or message. * - * When the call completes, the asyncResult.value property will contain an array of{@link Office.EmailAddressDetails} objects. + * When the call completes, the asyncResult.value property will contain an array of {@link Office.EmailAddressDetails} objects. * * [Api set: Mailbox 1.1] * @@ -14182,13 +15691,15 @@ declare namespace Office { * * In addition to the main signature, this method also has this signature: * - * `getAsync(callback: (result: AsyncResult) => void): void;` + * `getAsync(callback: (result: AsyncResult) => void): void;` * * @param options 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 When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. + * The `value` property of the result is an array of EmailAddressDetails objects. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (result: AsyncResult) => void): void; /** * Gets a recipient list for an appointment or message. * @@ -14201,9 +15712,11 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * - * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. + * The `value` property of the result is an array of EmailAddressDetails objects. */ - getAsync(callback: (result: AsyncResult) => void): void; + getAsync(callback: (result: AsyncResult) => void): void; /** * Sets a recipient list for an appointment or message. * @@ -14232,14 +15745,17 @@ declare namespace Office { * * `setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options: Office.AsyncContextOptions): void;` * - * `setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: AsyncResult) => void): void;` + * `setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: AsyncResult) => void): void;` * * @param recipients The recipients to add to the recipients list. * @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 of type AsyncResult. If setting the recipients fails the asyncResult.error property will contain a code that indicates any error that occurred while adding the data. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. + * If setting the recipients fails the asyncResult.error property will contain a code that indicates any error that occurred + * while adding the data. */ - setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Sets a recipient list for an appointment or message. * @@ -14315,14 +15831,19 @@ declare namespace Office { * ErrorsNumberOfRecipientsExceeded - The number of recipients exceeded 100 entries. * * @param recipients The recipients to add to the recipients list. - * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If setting the recipients fails the asyncResult.error property will contain a code that indicates any error that occurred while adding the data. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. + * If setting the recipients fails the asyncResult.error property will contain a code that indicates any error that occurred + * while adding the data. */ - setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: AsyncResult) => void): void; + setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: AsyncResult) => void): void; } /** - * The recurrence object provides methods to get and set the recurrence pattern of appointments but only get the recurrence pattern of meeting requests. It will have a dictionary with the following keys: seriesTime, recurrenceType, recurrenceProperties, and recurrenceTimeZone (optional). + * The recurrence object provides methods to get and set the recurrence pattern of appointments but only get the recurrence pattern of + * meeting requests. + * It will have a dictionary with the following keys: seriesTime, recurrenceType, recurrenceProperties, and recurrenceTimeZone (optional). * * [Api set: Mailbox Preview] * @@ -14414,7 +15935,9 @@ declare namespace Office { recurrenceType: Office.MailboxEnums.RecurrenceType; /** - * The {@link Office.SeriesTime} object enables you to manage the start and end dates of the recurring appointment series and the usual start and end times of instances. **This object is not in UTC time.** Instead, it is set in the time zone specified by the recurrenceTimeZone value or defaulted to the item's time zone. + * The {@link Office.SeriesTime} object enables you to manage the start and end dates of the recurring appointment series and the usual start + * and end times of instances. **This object is not in UTC time.** + * Instead, it is set in the time zone specified by the recurrenceTimeZone value or defaulted to the item's time zone. * * [Api set: Mailbox Preview] * @@ -14441,13 +15964,15 @@ declare namespace Office { * * In addition to the main signature, this method also has this signature: * - * `getAsync(callback?: (result: AsyncResult) => void): void;` + * `getAsync(callback?: (result: AsyncResult) => void): void;` * * @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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. + * The `value` property of the result is a Recurrence object. */ - getAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Returns the current recurrence object of an appointment series. @@ -14462,9 +15987,11 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read * - * @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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. + * The `value` property of the result is a Recurrence object. */ - getAsync(callback?: (result: AsyncResult) => void): void; + getAsync(callback?: (result: AsyncResult) => void): void; /** * Sets the recurrence pattern of an appointment series. @@ -14483,14 +16010,15 @@ declare namespace Office { * * In addition to the main signature, this method also has this signature: * - * `setAsync(recurrencePattern: Recurrence, callback?: (result: AsyncResult) => void): void;` + * `setAsync(recurrencePattern: Recurrence, callback?: (result: AsyncResult) => void): void;` * * @param recurrencePattern A recurrence object. * @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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. */ - setAsync(recurrencePattern: Recurrence, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + setAsync(recurrencePattern: Recurrence, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Sets the recurrence pattern of an appointment series. @@ -14508,9 +16036,10 @@ declare namespace Office { * ErrorsInvalidEndTime - The appointment end time is before its start time. * * @param recurrencePattern A recurrence object. - * @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. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. */ - setAsync(recurrencePattern: Recurrence, callback?: (result: AsyncResult) => void): void; + setAsync(recurrencePattern: Recurrence, callback?: (result: AsyncResult) => void): void; } /** @@ -14552,7 +16081,8 @@ declare namespace Office { */ month: Office.MailboxEnums.Month; /** - * Represents your chosen first day of the week otherwise the default is the value in the current user's settings. Valid values are: 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', and 'Sun'. + * Represents your chosen first day of the week otherwise the default is the value in the current user's settings. + * Valid values are: 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', and 'Sun'. */ firstDayOfWeek: Office.MailboxEnums.Days; } @@ -14574,7 +16104,8 @@ declare namespace Office { */ url?: string; /** - * Only used if type is set to file. If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the attachment list. + * Only used if type is set to file. If true, indicates that the attachment will be shown inline in the message body, and should not be + * displayed in the attachment list. */ inLine?: boolean; /** @@ -14596,20 +16127,27 @@ declare namespace Office { */ attachments?: ReplyFormAttachment[]; /** - * When the reply display call completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * When the reply display call completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an {@link Office.AsyncResult} object. */ - callback?: (result: AsyncResult) => void; + callback?: (result: AsyncResult) => void; } /** - * The settings created by using the methods of the RoamingSettings object are saved per add-in and per user. That is, they are available only to the add-in that created them, and only from the user's mail box in which they are saved. + * The settings created by using the methods of the RoamingSettings object are saved per add-in and per user. + * That is, they are available only to the add-in that created them, and only from the user's mail box in which they are saved. * - * While the Outlook Add-in API limits access to these settings to only the add-in that created them, these settings should not be considered secure storage. They can be accessed by Exchange Web Services or Extended MAPI. They should not be used to store sensitive information such as user credentials or security tokens. + * While the Outlook Add-in API limits access to these settings to only the add-in that created them, these settings should not be considered + * secure storage. They can be accessed by Exchange Web Services or Extended MAPI. + * They should not be used to store sensitive information such as user credentials or security tokens. * * The name of a setting is a String, while the value can be a String, Number, Boolean, null, Object, or Array. * * The RoamingSettings object is accessible via the roamingSettings property in the Office.context namespace. * - * Important: The RoamingSettings object is initialized from the persisted storage only when the add-in is first loaded. For task panes, this means that it is only initialized when the task pane first opens. If the task pane navigates to another page or reloads the current page, the in-memory object is reset to its initial values, even if your add-in has persisted changes. The persisted changes will not be available until the task pane is closed and reopened. + * Important: The RoamingSettings object is initialized from the persisted storage only when the add-in is first loaded. + * For task panes, this means that it is only initialized when the task pane first opens. + * If the task pane navigates to another page or reloads the current page, the in-memory object is reset to its initial values, even if + * your add-in has persisted changes. The persisted changes will not be available until the task pane is closed and reopened. * * [Api set: Mailbox 1.0] * @@ -14649,7 +16187,9 @@ declare namespace Office { /** * Saves the settings. * - * Any settings previously saved by an add-in are loaded when it is initialized, so during the lifetime of the session you can just use the set and get methods to work with the in-memory copy of the settings property bag. When you want to persist the settings so that they are available the next time the add-in is used, use the saveAsync method. + * Any settings previously saved by an add-in are loaded when it is initialized, so during the lifetime of the session you can just use + * the set and get methods to work with the in-memory copy of the settings property bag. + * When you want to persist the settings so that they are available the next time the add-in is used, use the saveAsync method. * * [Api set: Mailbox 1.0] * @@ -14658,13 +16198,15 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read * - * @param callback Optional? When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. */ - saveAsync(callback?: (result: AsyncResult) => void): void; + saveAsync(callback?: (result: AsyncResult) => void): void; /** * Sets or creates the specified setting. * - * The set method creates a new setting of the specified name if it does not already exist, or sets an existing setting of the specified name. The value is stored in the document as the serialized JSON representation of its data type. + * The set method creates a new setting of the specified name if it does not already exist, or sets an existing setting of the specified name. + * The value is stored in the document as the serialized JSON representation of its data type. * * A maximum of 2MB is available for the settings of each add-in, and each individual setting is limited to 32KB. * @@ -14684,7 +16226,8 @@ declare namespace Office { } /** - * The SeriesTime object provides methods to get and set the dates and times of appointments in a recurring series and get the dates and times of meeting requests in a recurring series. + * The SeriesTime object provides methods to get and set the dates and times of appointments in a recurring series and get the dates and times of + * meeting requests in a recurring series. * * [Api set: Mailbox Preview] * @@ -14721,7 +16264,9 @@ declare namespace Office { getEndDate(): string; /** - * Gets the end time of a usual appointment or meeting request instance of a recurrence pattern in whichever time zone that the user or add-in set the recurrence pattern using the following {@link https://www.iso.org/iso-8601-date-and-time-format.html | ISO 8601} format: "THH:mm:ss:mmm" + * Gets the end time of a usual appointment or meeting request instance of a recurrence pattern in whichever time zone that the user or + * add-in set the recurrence pattern using the following {@link https://www.iso.org/iso-8601-date-and-time-format.html | ISO 8601} format: + * "THH:mm:ss:mmm" * * [Api set: Mailbox Preview] * @@ -14745,7 +16290,8 @@ declare namespace Office { getStartDate(): string; /** - * Gets the start time of a usual appointment instance of a recurrence pattern in whichever time zone that the user/add-in set the recurrence pattern using the following {@link https://www.iso.org/iso-8601-date-and-time-format.html | ISO 8601} format: "THH:mm:ss:mmm" + * Gets the start time of a usual appointment instance of a recurrence pattern in whichever time zone that the user/add-in set the + * recurrence pattern using the following {@link https://www.iso.org/iso-8601-date-and-time-format.html | ISO 8601} format: "THH:mm:ss:mmm" * * [Api set: Mailbox Preview] * @@ -14784,7 +16330,8 @@ declare namespace Office { * * In addition to the main signature, this method also has this signature: * - * `setEndDate(date: string): void;` (Where date is the end date of the recurring appointment series represented in the {@link https://www.iso.org/iso-8601-date-and-time-format.html | ISO 8601} date format: "YYYY-MM-DD"). + * `setEndDate(date: string): void;` (Where date is the end date of the recurring appointment series represented in the + * {@link https://www.iso.org/iso-8601-date-and-time-format.html | ISO 8601} date format: "YYYY-MM-DD"). * * @param year The year value of the end date. * @param month The month value of the end date. Valid range is 0-11 where 0 represents the 1st month and 11 represents the 12th month. @@ -14845,7 +16392,8 @@ declare namespace Office { setStartDate(date:string): void; /** - * Sets the start time of all instances of a recurring appointment series in whichever time zone the recurrence pattern is set (the item's time zone is used by default). + * Sets the start time of all instances of a recurring appointment series in whichever time zone the recurrence pattern is set + * (the item's time zone is used by default). * * [Api set: Mailbox Preview] * @@ -14866,7 +16414,8 @@ declare namespace Office { setStartTime(hours: number, minutes: number): void; /** - * Sets the start time of all instances of a recurring appointment series in whichever time zone the recurrence pattern is set (the item's time zone is used by default). + * Sets the start time of all instances of a recurring appointment series in whichever time zone the recurrence pattern is set + * (the item's time zone is used by default). * * [Api set: Mailbox Preview] * @@ -14907,15 +16456,18 @@ declare namespace Office { * * In addition to the main signature, this method also has this signature: * - * `getAsync(callback: (result: AsyncResult) => void): void;` + * `getAsync(callback: (result: AsyncResult) => void): void;` * * @param options 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 When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. + * The `value` property of the result is the subject of the item. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (result: AsyncResult) => void): void; /** * Gets the subject of an appointment or message. + * * The getAsync method starts an asynchronous call to the Exchange server to get the subject of an appointment or message. * * [Api set: Mailbox 1.1] @@ -14926,12 +16478,14 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * The `value` property of the result is the subject of the item. */ - getAsync(callback: (result: AsyncResult) => void): void; + getAsync(callback: (result: AsyncResult) => void): void; /** * Sets the subject of an appointment or message. * - * The setAsync method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place. + * The setAsync method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. + * Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place. * * [Api set: Mailbox 1.1] * @@ -14948,18 +16502,20 @@ declare namespace Office { * * `setAsync(subject: string, options: Office.AsyncContextOptions): void;` * - * `setAsync(subject: string, callback: (result: AsyncResult) => void): void;` + * `setAsync(subject: string, callback: (result: AsyncResult) => void): void;` * * @param subject The subject of the appointment or message. The string is limited to 255 characters. * @param options 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 When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If setting the subject fails, the asyncResult.error property will contain an error code. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. If setting the subject fails, the asyncResult.error property will contain an error code. */ - setAsync(subject: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + setAsync(subject: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Sets the subject of an appointment or message. * - * The setAsync method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place. + * The setAsync method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. + * Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place. * * [Api set: Mailbox 1.1] * @@ -14976,7 +16532,8 @@ declare namespace Office { /** * Sets the subject of an appointment or message. * - * The setAsync method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place. + * The setAsync method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. + * Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place. * * [Api set: Mailbox 1.1] * @@ -14995,7 +16552,8 @@ declare namespace Office { /** * Sets the subject of an appointment or message. * - * The setAsync method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place. + * The setAsync method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. + * Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place. * * [Api set: Mailbox 1.1] * @@ -15007,15 +16565,17 @@ declare namespace Office { * ErrorsDataExceedsMaximumSize - The subject parameter is longer than 255 characters. * * @param subject The subject of the appointment or message. The string is limited to 255 characters. - * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If setting the subject fails, the asyncResult.error property will contain an error code. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. If setting the subject fails, the asyncResult.error property will contain an error code. */ - setAsync(data: string, callback: (result: AsyncResult) => void): void; + setAsync(data: string, callback: (result: AsyncResult) => void): void; } /** * Represents a suggested task identified in an item. Read mode only. * - * The list of tasks suggested in an email message is returned in the taskSuggestions property of the [Entities]Entities object that is returned when the getEntities or getEntitiesByType method is called on the active item. + * The list of tasks suggested in an email message is returned in the taskSuggestions property of the {@link Office.Entities | Entities} object + * that is returned when the getEntities or getEntitiesByType method is called on the active item. * * [Api set: Mailbox 1.0] * @@ -15048,7 +16608,8 @@ declare namespace Office { /** * Gets the start or end time of an appointment. * - * The date and time is provided as a Date object in the asyncResult.value property. The value is in Coordinated Universal Time (UTC). You can convert the UTC time to the local client time by using the convertToLocalClientTime method. + * The date and time is provided as a Date object in the asyncResult.value property. The value is in Coordinated Universal Time (UTC). + * You can convert the UTC time to the local client time by using the convertToLocalClientTime method. * * [Api set: Mailbox 1.1] * @@ -15059,17 +16620,19 @@ declare namespace Office { * * In addition to the main signature, this method also has this signature: * - * `getAsync(callback: (result: AsyncResult) => void): void;` + * `getAsync(callback: (result: AsyncResult) => void): void;` * * @param options 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 When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * The `value` property of the result is a Date object. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (result: AsyncResult) => void): void; /** * Gets the start or end time of an appointment. * - * The date and time is provided as a Date object in the asyncResult.value property. The value is in Coordinated Universal Time (UTC). You can convert the UTC time to the local client time by using the convertToLocalClientTime method. + * The date and time is provided as a Date object in the asyncResult.value property. The value is in Coordinated Universal Time (UTC). + * You can convert the UTC time to the local client time by using the convertToLocalClientTime method. * * [Api set: Mailbox 1.1] * @@ -15079,12 +16642,14 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * The `value` property of the result is a Date object. */ - getAsync(callback: (result: AsyncResult) => void): void; + getAsync(callback: (result: AsyncResult) => void): void; /** * Sets the start or end time of an appointment. * - * If the setAsync method is called on the start property, the end property will be adjusted to maintain the duration of the appointment as previously set. If the setAsync method is called on the end property, the duration of the appointment will be extended to the new end time. + * If the setAsync method is called on the start property, the end property will be adjusted to maintain the duration of the appointment as + * previously set. If the setAsync method is called on the end property, the duration of the appointment will be extended to the new end time. * * The time must be in UTC; you can get the correct UTC time by using the convertToUtcClientTime method. * @@ -15103,18 +16668,21 @@ declare namespace Office { * * `setAsync(dateTime: Date, options: Office.AsyncContextOptions): void;` * - * `setAsync(dateTime: Date, callback: (result: AsyncResult) => void): void;` + * `setAsync(dateTime: Date, callback: (result: AsyncResult) => void): void;` * * @param dateTime A date-time object in Coordinated Universal Time (UTC). * @param options 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 When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If setting the date and time fails, the asyncResult.error property will contain an error code. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. + * If setting the date and time fails, the asyncResult.error property will contain an error code. */ - setAsync(dateTime: Date, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + setAsync(dateTime: Date, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Sets the start or end time of an appointment. * - * If the setAsync method is called on the start property, the end property will be adjusted to maintain the duration of the appointment as previously set. If the setAsync method is called on the end property, the duration of the appointment will be extended to the new end time. + * If the setAsync method is called on the start property, the end property will be adjusted to maintain the duration of the appointment as + * previously set. If the setAsync method is called on the end property, the duration of the appointment will be extended to the new end time. * * The time must be in UTC; you can get the correct UTC time by using the convertToUtcClientTime method. * @@ -15133,7 +16701,8 @@ declare namespace Office { /** * Sets the start or end time of an appointment. * - * If the setAsync method is called on the start property, the end property will be adjusted to maintain the duration of the appointment as previously set. If the setAsync method is called on the end property, the duration of the appointment will be extended to the new end time. + * If the setAsync method is called on the start property, the end property will be adjusted to maintain the duration of the appointment as + * previously set. If the setAsync method is called on the end property, the duration of the appointment will be extended to the new end time. * * The time must be in UTC; you can get the correct UTC time by using the convertToUtcClientTime method. * @@ -15154,7 +16723,8 @@ declare namespace Office { /** * Sets the start or end time of an appointment. * - * If the setAsync method is called on the start property, the end property will be adjusted to maintain the duration of the appointment as previously set. If the setAsync method is called on the end property, the duration of the appointment will be extended to the new end time. + * If the setAsync method is called on the start property, the end property will be adjusted to maintain the duration of the appointment as + * previously set. If the setAsync method is called on the end property, the duration of the appointment will be extended to the new end time. * * The time must be in UTC; you can get the correct UTC time by using the convertToUtcClientTime method. * @@ -15168,9 +16738,11 @@ declare namespace Office { * ErrorsInvalidEndTime - The appointment end time is before the appointment start time. * * @param dateTime A date-time object in Coordinated Universal Time (UTC). - * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If setting the date and time fails, the asyncResult.error property will contain an error code. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of + * type {@link Office.AsyncResult}. + * If setting the date and time fails, the asyncResult.error property will contain an error code. */ - setAsync(dateTime: Date, callback: (result: AsyncResult) => void): void; + setAsync(dateTime: Date, callback: (result: AsyncResult) => void): void; } /** @@ -15275,24 +16847,31 @@ declare namespace Office { //////////////////////////////////////////////////////////////// declare namespace OfficeExtension { - /** An abstract proxy object that represents an object in an Office document. - * You create proxy objects from the context (or from other proxy objects), add commands to a queue to act on the object, and then synchronize the proxy object state with the document by calling `context.sync()`. + /** + * An abstract proxy object that represents an object in an Office document. + * You create proxy objects from the context (or from other proxy objects), add commands to a queue to act on the object, and then synchronize the + * proxy object state with the document by calling `context.sync()`. */ class ClientObject { /** The request context associated with the object */ context: ClientRequestContext; - /** Returns a boolean value for whether the corresponding object is a null object. You must call `context.sync()` before reading the isNullObject property. */ + /** + * Returns a boolean value for whether the corresponding object is a null object. You must call `context.sync()` before reading the + * isNullObject property. + */ isNullObject: boolean; } } declare namespace OfficeExtension { /** - * Specifies which properties of an object should be loaded. This load happens when the sync() method is executed. This synchronizes the states between Office objects and corresponding JavaScript proxy objects. + * Specifies which properties of an object should be loaded. This load happens when the sync() method is executed. + * This synchronizes the states between Office objects and corresponding JavaScript proxy objects. * * @remarks * - * For Word, the preferred method for specifying the properties and paging information is by using a string literal. The first two examples show the preferred way to request the text and font size properties for paragraphs in a paragraph collection: + * For Word, the preferred method for specifying the properties and paging information is by using a string literal. + * The first two examples show the preferred way to request the text and font size properties for paragraphs in a paragraph collection: * * `context.load(paragraphs, 'text, font/size');` * @@ -15304,7 +16883,8 @@ declare namespace OfficeExtension { * * `paragraphs.load({select: 'text, font/size', expand: 'font', top: 50, skip: 0});` * - * Note that if we don't specify the specific properties on the font object in the select statement, the expand statement by itself would indicate that all of the font properties are loaded. + * Note that if we don't specify the specific properties on the font object in the select statement, the expand statement by itself would + * indicate that all of the font properties are loaded. */ interface LoadOption { /** @@ -15320,7 +16900,8 @@ declare namespace OfficeExtension { */ top?: number; /** - * Only usable on collection types. Specifies the number of items in the collection that are to be skipped and not included in the result. If top is specified, the result set will start after skipping the specified number of items. + * Only usable on collection types. Specifies the number of items in the collection that are to be skipped and not included in the result. + * If top is specified, the result set will start after skipping the specified number of items. */ skip?: number; } @@ -15344,7 +16925,9 @@ declare namespace OfficeExtension { session?: RequestUrlAndHeaderInfo | T; /** - * A previously-created context, or API object, or array of objects. The batch will use the same RequestContext as the passed-in object, which means that any changes applied to the object will be picked up by `context.sync()`. + * A previously-created context, or API object, or array of objects. + * The batch will use the same RequestContext as the passed-in object, which means that any changes applied to the object will be picked up + * by `context.sync()`. */ previousObjects?: ClientObject | ClientObject[] | ClientRequestContext; } @@ -15359,7 +16942,10 @@ declare namespace OfficeExtension { pendingStatements: string[]; } - /** An abstract RequestContext object that facilitates requests to the host Office application. The `Excel.run` and `Word.run` methods provide a request context. */ + /** + * An abstract RequestContext object that facilitates requests to the host Office application. + * The `Excel.run` and `Word.run` methods provide a request context. + */ class ClientRequestContext { constructor(url?: string); @@ -15369,10 +16955,12 @@ declare namespace OfficeExtension { /** Request headers */ requestHeaders: { [name: string]: string }; - /** Queues up a command to load the specified properties of the object. You must call `context.sync()` before reading the properties. + /** + * Queues up a command to load the specified properties of the object. You must call `context.sync()` before reading the properties. * * @param object The object whose properties are loaded. - * @param option A comma-delimited string, or array of strings, that specifies the properties/relationships to load, or an {@link OfficeExtension.LoadOption} object. + * @param option A comma-delimited string, or array of strings, that specifies the properties/relationships to load, or an + * {@link OfficeExtension.LoadOption} object. */ load(object: ClientObject, option?: string | string[] | LoadOption): void; @@ -15382,15 +16970,24 @@ declare namespace OfficeExtension { * You must call `context.sync()` before reading the properties. * * @param object The object to be loaded. - * @param options The key-value pairing of load options for the types, such as `{ "Workbook": "worksheets,tables", "Worksheet": "tables", "Tables": "name" }` + * @param options The key-value pairing of load options for the types, such as + * `{ "Workbook": "worksheets,tables", "Worksheet": "tables", "Tables": "name" }` * @param maxDepth The maximum recursive depth. */ loadRecursive(object: ClientObject, options: { [typeName: string]: string | string[] | LoadOption }, maxDepth?: number): void; - /** Adds a trace message to the queue. If the promise returned by `context.sync()` is rejected due to an error, this adds a ".traceMessages" array to the OfficeExtension.Error object, containing all trace messages that were executed. These messages can help you monitor the program execution sequence and detect the cause of the error. */ + /** + * Adds a trace message to the queue. If the promise returned by `context.sync()` is rejected due to an error, this adds a ".traceMessages" + * array to the OfficeExtension.Error object, containing all trace messages that were executed. + * These messages can help you monitor the program execution sequence and detect the cause of the error. + */ trace(message: string): void; - /** Synchronizes the state between JavaScript proxy objects and the Office document, by executing instructions queued on the request context and retrieving properties of loaded Office objects for use in your code. This method returns a promise, which is resolved when the synchronization is complete. */ + /** + * Synchronizes the state between JavaScript proxy objects and the Office document, by executing instructions queued on the request context + * and retrieving properties of loaded Office objects for use in your code. + * This method returns a promise, which is resolved when the synchronization is complete. + */ sync(passThroughValue?: T): Promise; /** Debug information */ @@ -15426,10 +17023,13 @@ declare namespace OfficeExtension { /** * Determines whether to log additional error information upon failure. * - * When this property is set to true, the error object will include a "debugInfo.fullStatements" property that lists all statements in the batch request, including all statements that precede and follow the point of failure. + * When this property is set to true, the error object will include a "debugInfo.fullStatements" property that lists all statements in the + * batch request, including all statements that precede and follow the point of failure. * - * Setting this property to true will negatively impact performance and will log all statements in the batch request, including any statements that may contain potentially-sensitive data. - * It is recommended that you only set this property to true during debugging and that you never log the value of error.debugInfo.fullStatements to an external database or analytics service. + * Setting this property to true will negatively impact performance and will log all statements in the batch request, including any statements + * that may contain potentially-sensitive data. + * It is recommended that you only set this property to true during debugging and that you never log the value of + * error.debugInfo.fullStatements to an external database or analytics service. */ extendedErrorLogging: boolean; }; @@ -15448,13 +17048,15 @@ declare namespace OfficeExtension { /** * The statement that caused the error, if available. * - * This statement will never contain any potentially-sensitive data and may not match the code exactly as written, but will be a close approximation. + * This statement will never contain any potentially-sensitive data and may not match the code exactly as written, + * but will be a close approximation. */ statements?: string; /** * The statements that closely precede and follow the statement that caused the error, if available. * - * These statements will never contain any potentially-sensitive data and may not match the code exactly as written, but will be a close approximation. + * These statements will never contain any potentially-sensitive data and may not match the code exactly as written, + * but will be a close approximation. */ surroundingStatements?: string[]; /** @@ -15475,7 +17077,11 @@ declare namespace OfficeExtension { stack: string; /** Error code string, such as "InvalidArgument". */ code: string; - /** Trace messages (if any) that were added via a `context.trace()` invocation before calling `context.sync()`. If there was an error, this contains all trace messages that were executed before the error occurred. These messages can help you monitor the program execution sequence and detect the case of the error. */ + /** + * Trace messages (if any) that were added via a `context.trace()` invocation before calling `context.sync()`. + * If there was an error, this contains all trace messages that were executed before the error occurred. + * These messages can help you monitor the program execution sequence and detect the case of the error. + */ traceMessages: Array; /** Debug info (useful for detailed logging of the error, i.e., via `JSON.stringify(...)`). */ debugInfo: DebugInfo; @@ -15502,7 +17108,13 @@ declare namespace OfficeExtension { } declare namespace OfficeExtension { - /** A Promise object that represents a deferred interaction with the host Office application. The publicly-consumable {@link Office.OfficeExtension.Promise} is available starting in ExcelApi 1.2 and WordApi 1.2. Promises can be chained via ".then", and errors can be caught via ".catch". Remember to always use a ".catch" on the outer promise, and to return intermediary promises so as not to break the promise chain. When a browser-provided native Promise implementation is available, OfficeExtension.Promise will switch to use the native Promise instead. */ + /** + * A Promise object that represents a deferred interaction with the host Office application. + * The publicly-consumable {@link Office.OfficeExtension.Promise} is available starting in ExcelApi 1.2 and WordApi 1.2. + * Promises can be chained via ".then", and errors can be caught via ".catch". + * Remember to always use a ".catch" on the outer promise, and to return intermediary promises so as not to break the promise chain. + * When a browser-provided native Promise implementation is available, OfficeExtension.Promise will switch to use the native Promise instead. + */ const Promise: Office.IPromiseConstructor; type IPromise = Promise; } @@ -15511,24 +17123,38 @@ declare namespace OfficeExtension { /** Collection of tracked objects, contained within a request context. See "context.trackedObjects" for more information. */ class TrackedObjects { /** - * Track a new object for automatic adjustment based on surrounding changes in the document. Only some object types require this. If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object to the tracked object collection when the object was first created. + * Track a new object for automatic adjustment based on surrounding changes in the document. Only some object types require this. + * If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, + * and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object + * to the tracked object collection when the object was first created. * * This method also has the following signature: * * `add(objects: ClientObject[]): void;` Where objects is an array of objects to be tracked. */ add(object: ClientObject): void; - /** Track a set of objects for automatic adjustment based on surrounding changes in the document. Only some object types require this. If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object to the tracked object collection when the object was first created. */ + /** + * Track a set of objects for automatic adjustment based on surrounding changes in the document. Only some object types require this. + * If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, + * and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object + * to the tracked object collection when the object was first created. + */ add(objects: ClientObject[]): void; /** - * Release the memory associated with an object that was previously added to this collection. Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call `context.sync()` before the memory release takes effect. + * Release the memory associated with an object that was previously added to this collection. + * Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. + * You will need to call `context.sync()` before the memory release takes effect. * * This method also has the following signature: * * `remove(objects: ClientObject[]): void;` Where objects is an array of objects to be removed. */ remove(object: ClientObject): void; - /** Release the memory associated with an object that was previously added to this collection. Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call `context.sync()` before the memory release takes effect. */ + /** + * Release the memory associated with an object that was previously added to this collection. + * Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. + * You will need to call `context.sync()` before the memory release takes effect. + */ remove(objects: ClientObject[]): void; } } @@ -15817,25 +17443,24 @@ declare namespace Excel { */ function run(options: Excel.RunOptions, batch: (context: Excel.RequestContext) => Promise): Promise; /** - * Executes a batch script that performs actions on the Excel object model, using the RequestContext of a previously-created object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. - * - * @remarks - * - * In addition to this signature, the method also has the following signatures: - * - * `run(object: OfficeExtension.ClientObject, batch: (context: Excel.RequestContext) => Promise): Promise;` - * - * `run(objects: OfficeExtension.ClientObject[], batch: (context: Excel.RequestContext) => Promise): Promise;` - * - * `run(options: Excel.RunOptions, batch: (context: Excel.RequestContext) => Promise): Promise;` - * - * `run(batch: (context: Excel.RequestContext) => Promise): Promise;` - * - * @param context - A previously-created object. The batch will use the same RequestContext as the passed-in object, which means that any changes applied to the object will be picked up by "context.sync()". - * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. - */ - function run(context: OfficeExtension.ClientRequestContext, batch: (context: Excel.RequestContext) => Promise): Promise; - function createWorkbook(base64?: string): Promise; + * Executes a batch script that performs actions on the Excel object model, using the RequestContext of a previously-created object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. + * + * @remarks + * + * In addition to this signature, the method also has the following signatures: + * + * `run(object: OfficeExtension.ClientObject, batch: (context: Excel.RequestContext) => Promise): Promise;` + * + * `run(objects: OfficeExtension.ClientObject[], batch: (context: Excel.RequestContext) => Promise): Promise;` + * + * `run(options: Excel.RunOptions, batch: (context: Excel.RequestContext) => Promise): Promise;` + * + * `run(batch: (context: Excel.RequestContext) => Promise): Promise;` + * + * @param context - A previously-created object. The batch will use the same RequestContext as the passed-in object, which means that any changes applied to the object will be picked up by "context.sync()". + * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. + */ + function run(context: OfficeExtension.ClientRequestContext, batch: (context: Excel.RequestContext) => Promise): Promise; /** * * Provides information about the binding that raised the SelectionChanged event. @@ -16434,7 +18059,7 @@ declare namespace Excel { getActiveCell(): Excel.Range; /** * - * Gets the currently selected range from the workbook. + * Gets the currently selected single range from the workbook. If there are multiple ranges selected, this method will throw an error. * * [Api set: ExcelApi 1.1] */ @@ -16732,11 +18357,11 @@ declare namespace Excel { getPreviousOrNullObject(visibleOnly?: boolean): Excel.Worksheet; /** * - * Gets the range object specified by the address or name. + * Gets the range object, representing a single rectangular block of cells, specified by the address or name. * * [Api set: ExcelApi 1.1] * - * @param address Optional. The address or the name of the range. If not specified, the entire worksheet range is returned. + * @param address Optional. The string representing the address or name of the range. For example, "A1:B2". If not specified, the entire worksheet range is returned. */ getRange(address?: string): Excel.Range; /** @@ -17220,7 +18845,7 @@ declare namespace Excel { readonly worksheet: Excel.Worksheet; /** * - * Represents the range reference in A1-style. Address value will contain the Sheet reference (e.g. Sheet1!A1:B4). Read-only. + * Represents the range reference in A1-style. Address value will contain the Sheet reference (e.g. "Sheet1!A1:B4"). Read-only. * * [Api set: ExcelApi 1.1] */ @@ -17449,7 +19074,7 @@ declare namespace Excel { getAbsoluteResizedRange(numRows: number, numColumns: number): Excel.Range; /** * - * Gets the smallest range object that encompasses the given ranges. For example, the GetBoundingRect of "B2:C5" and "D10:E15" is "B2:E16". + * Gets the smallest range object that encompasses the given ranges. For example, the GetBoundingRect of "B2:C5" and "D10:E15" is "B2:E15". * * [Api set: ExcelApi 1.1] * @@ -17662,7 +19287,6 @@ declare namespace Excel { /** * * Selects the specified range in the Excel UI. - If true, a multi-area range can be selected; otherwise, only the first area will be selected. Default is false. * * [Api set: ExcelApi 1.1] */ @@ -19073,10 +20697,10 @@ declare namespace Excel { * * Represents a collection of all the rows that are part of the table. - Note that unlike Ranges or Columns, which will adjust if new rows/columns are added before them, - a TableRow object represent the physical location of the table row, but not the data. - That is, if the data is sorted or if new rows are added, a table row will continue - to point at the index for which it was created. + Note that unlike Ranges or Columns, which will adjust if new rows/columns are added before them, + a TableRow object represent the physical location of the table row, but not the data. + That is, if the data is sorted or if new rows are added, a table row will continue + to point at the index for which it was created. * * [Api set: ExcelApi 1.1] */ @@ -19094,10 +20718,10 @@ declare namespace Excel { * * Adds one or more rows to the table. The return object will be the top of the newly added row(s). - Note that unlike Ranges or Columns, which will adjust if new rows/columns are added before them, - a TableRow object represent the physical location of the table row, but not the data. - That is, if the data is sorted or if new rows are added, a table row will continue - to point at the index for which it was created. + Note that unlike Ranges or Columns, which will adjust if new rows/columns are added before them, + a TableRow object represent the physical location of the table row, but not the data. + That is, if the data is sorted or if new rows are added, a table row will continue + to point at the index for which it was created. * * [Api set: ExcelApi 1.1 for adding a single row; 1.4 allows adding of multiple rows.] * @@ -19116,10 +20740,10 @@ declare namespace Excel { * * Gets a row based on its position in the collection. - Note that unlike Ranges or Columns, which will adjust if new rows/columns are added before them, - a TableRow object represent the physical location of the table row, but not the data. - That is, if the data is sorted or if new rows are added, a table row will continue - to point at the index for which it was created. + Note that unlike Ranges or Columns, which will adjust if new rows/columns are added before them, + a TableRow object represent the physical location of the table row, but not the data. + That is, if the data is sorted or if new rows are added, a table row will continue + to point at the index for which it was created. * * [Api set: ExcelApi 1.1] * @@ -19150,10 +20774,10 @@ declare namespace Excel { * * Represents a row in a table. - Note that unlike Ranges or Columns, which will adjust if new rows/columns are added before them, - a TableRow object represent the physical location of the table row, but not the data. - That is, if the data is sorted or if new rows are added, a table row will continue - to point at the index for which it was created. + Note that unlike Ranges or Columns, which will adjust if new rows/columns are added before them, + a TableRow object represent the physical location of the table row, but not the data. + That is, if the data is sorted or if new rows are added, a table row will continue + to point at the index for which it was created. * * [Api set: ExcelApi 1.1] */ @@ -19747,7 +21371,7 @@ declare namespace Excel { * @param sourceData The Range object corresponding to the source data. * @param seriesBy Optional. Specifies the way columns or rows are used as data series on the chart. See Excel.ChartSeriesBy for details. */ - add(type: "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap", sourceData: Range, seriesBy?: "Auto" | "Columns" | "Rows"): Excel.Chart; + add(type: "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel", sourceData: Range, seriesBy?: "Auto" | "Columns" | "Rows"): Excel.Chart; /** * * Returns the number of charts in the worksheet. @@ -19865,7 +21489,7 @@ declare namespace Excel { * * [Api set: ExcelApi 1.7] */ - chartType: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap"; + chartType: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; /** * * Represents the height, in points, of the chart object. @@ -19966,7 +21590,7 @@ declare namespace Excel { * * [Api set: ExcelApi 1.1] * - * @param sourceData The range corresponding to the source data. + * @param sourceData The range object corresponding to the source data. * @param seriesBy Specifies the way columns or rows are used as data series on the chart. Can be one of the following: Auto (default), Rows, and Columns. See Excel.ChartSeriesBy for details. */ setData(sourceData: Range, seriesBy?: Excel.ChartSeriesBy): void; @@ -19976,7 +21600,7 @@ declare namespace Excel { * * [Api set: ExcelApi 1.1] * - * @param sourceData The range corresponding to the source data. + * @param sourceData The range object corresponding to the source data. * @param seriesBy Specifies the way columns or rows are used as data series on the chart. Can be one of the following: Auto (default), Rows, and Columns. See Excel.ChartSeriesBy for details. */ setData(sourceData: Range, seriesBy?: "Auto" | "Columns" | "Rows"): void; @@ -20174,7 +21798,7 @@ declare namespace Excel { * * [Api set: ExcelApi 1.7] */ - chartType: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap"; + chartType: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; /** * * Represents the doughnut hole size of a chart series. Only valid on doughnut and doughnutExploded charts. @@ -23832,14 +25456,14 @@ declare namespace Excel { delete(): void; /** * - * Returns the range the conditonal format is applied to. Read-only. + * Returns the range the conditonal format is applied to. Throws an error if the conditional format is applied to multiple ranges. Read-only. * * [Api set: ExcelApi 1.6] */ getRange(): Excel.Range; /** * - * Returns the range the conditonal format is applied to or a null object if the range is discontiguous. Read-only. + * Returns the range the conditonal format is applied to, or a null object if the conditional format is applied to multiple ranges. Read-only. * * [Api set: ExcelApi 1.6] */ @@ -26521,7 +28145,7 @@ declare namespace Excel { worksheetCalculated = "WorksheetCalculated", /** * - * ChartActivated represents the type of event registered on Chart or ChartCollection, and occurs when chart activates. + * VisualSelectionChanged represents the type of event registered on VisualCollection, and occurs when visual selection changes. * */ visualSelectionChanged = "VisualSelectionChanged", @@ -31102,7 +32726,7 @@ declare namespace Excel { * * [Api set: ExcelApi 1.7] */ - chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap"; + chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; /** * * Represents the height, in points, of the chart object. @@ -31182,7 +32806,7 @@ declare namespace Excel { * * [Api set: ExcelApi 1.7] */ - chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap"; + chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; /** * * Represents the doughnut hole size of a chart series. Only valid on doughnut and doughnutExploded charts. @@ -33120,7 +34744,7 @@ declare namespace Excel { worksheet?: Excel.Interfaces.WorksheetData; /** * - * Represents the range reference in A1-style. Address value will contain the Sheet reference (e.g. Sheet1!A1:B4). Read-only. + * Represents the range reference in A1-style. Address value will contain the Sheet reference (e.g. "Sheet1!A1:B4"). Read-only. * * [Api set: ExcelApi 1.1] */ @@ -33939,7 +35563,7 @@ declare namespace Excel { * * [Api set: ExcelApi 1.7] */ - chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap"; + chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; /** * * Represents the height, in points, of the chart object. @@ -34040,7 +35664,7 @@ declare namespace Excel { * * [Api set: ExcelApi 1.7] */ - chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap"; + chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; /** * * Represents the doughnut hole size of a chart series. Only valid on doughnut and doughnutExploded charts. @@ -36251,7 +37875,7 @@ declare namespace Excel { worksheet?: Excel.Interfaces.WorksheetLoadOptions; /** * - * Represents the range reference in A1-style. Address value will contain the Sheet reference (e.g. Sheet1!A1:B4). Read-only. + * Represents the range reference in A1-style. Address value will contain the Sheet reference (e.g. "Sheet1!A1:B4"). Read-only. * * [Api set: ExcelApi 1.1] */ @@ -36294,7 +37918,7 @@ declare namespace Excel { /** * * Represents the formula in A1-style notation. - When setting formulas to a range, the value argument can be either a single value (a string) or a two-dimensional array. If the argument is a single value, it will be applied to all cells in the range. + When setting formulas to a range, the value argument can be either a single value (a string) or a two-dimensional array. If the argument is a single value, it will be applied to all cells in the range. * * [Api set: ExcelApi 1.1] */ @@ -36302,7 +37926,7 @@ declare namespace Excel { /** * * Represents the formula in A1-style notation, in the user's language and number-formatting locale. For example, the English "=SUM(A1, 1.5)" formula would become "=SUMME(A1; 1,5)" in German. - When setting formulas to a range, the value argument can be either a single value (a string) or a two-dimensional array. If the argument is a single value, it will be applied to all cells in the range. + When setting formulas to a range, the value argument can be either a single value (a string) or a two-dimensional array. If the argument is a single value, it will be applied to all cells in the range. * * [Api set: ExcelApi 1.1] */ @@ -36310,7 +37934,7 @@ declare namespace Excel { /** * * Represents the formula in R1C1-style notation. - When setting formulas to a range, the value argument can be either a single value (a string) or a two-dimensional array. If the argument is a single value, it will be applied to all cells in the range. + When setting formulas to a range, the value argument can be either a single value (a string) or a two-dimensional array. If the argument is a single value, it will be applied to all cells in the range. * * [Api set: ExcelApi 1.2] */ @@ -36346,7 +37970,7 @@ declare namespace Excel { /** * * Represents Excel's number format code for the given range. - When setting number format to a range, the value argument can be either a single value (string) or a two-dimensional array. If the argument is a single value, it will be applied to all cells in the range. + When setting number format to a range, the value argument can be either a single value (string) or a two-dimensional array. If the argument is a single value, it will be applied to all cells in the range. * * [Api set: ExcelApi 1.1] */ @@ -36354,7 +37978,7 @@ declare namespace Excel { /** * * Represents Excel's number format code for the given range as a string in the language of the user. - When setting number format local to a range, the value argument can be either a single value (string) or a two-dimensional array. If the argument is a single value, it will be applied to all cells in the range. + When setting number format local to a range, the value argument can be either a single value (string) or a two-dimensional array. If the argument is a single value, it will be applied to all cells in the range. * * [Api set: ExcelApi 1.7] */ @@ -36383,8 +38007,8 @@ declare namespace Excel { /** * * Represents the style of the current range. - If the styles of the cells are inconsistent, null will be returned. - For custom styles, the style name will be returned. For built-in styles, a string representing a value in the BuiltInStyle enum will be returned. + If the styles of the cells are inconsistent, null will be returned. + For custom styles, the style name will be returned. For built-in styles, a string representing a value in the BuiltInStyle enum will be returned. * * [Api set: ExcelApi 1.7] */ @@ -36406,7 +38030,7 @@ declare namespace Excel { /** * * Represents the raw values of the specified range. The data returned could be of type string, number, or a boolean. Cells that contain an error will return the error string. - When setting values to a range, the value argument can be either a single value (string, number or boolean) or a two-dimensional array. If the argument is a single value, it will be applied to all cells in the range. + When setting values to a range, the value argument can be either a single value (string, number or boolean) or a two-dimensional array. If the argument is a single value, it will be applied to all cells in the range. * * [Api set: ExcelApi 1.1] */ @@ -37162,11 +38786,11 @@ declare namespace Excel { /** * * Represents a collection of all the rows that are part of the table. - - Note that unlike Ranges or Columns, which will adjust if new rows/columns are added before them, - a TableRow object represent the physical location of the table row, but not the data. - That is, if the data is sorted or if new rows are added, a table row will continue - to point at the index for which it was created. + + Note that unlike Ranges or Columns, which will adjust if new rows/columns are added before them, + a TableRow object represent the physical location of the table row, but not the data. + That is, if the data is sorted or if new rows are added, a table row will continue + to point at the index for which it was created. * * [Api set: ExcelApi 1.1] */ @@ -37190,11 +38814,11 @@ declare namespace Excel { /** * * Represents a row in a table. - - Note that unlike Ranges or Columns, which will adjust if new rows/columns are added before them, - a TableRow object represent the physical location of the table row, but not the data. - That is, if the data is sorted or if new rows are added, a table row will continue - to point at the index for which it was created. + + Note that unlike Ranges or Columns, which will adjust if new rows/columns are added before them, + a TableRow object represent the physical location of the table row, but not the data. + That is, if the data is sorted or if new rows are added, a table row will continue + to point at the index for which it was created. * * [Api set: ExcelApi 1.1] */ @@ -37275,8 +38899,8 @@ declare namespace Excel { /** * * Gets or sets the text orientation of all the cells within the range. - The text orientation should be an integer either from -90 to 90, or 180 for vertically-oriented text. - If the orientation within a range are not uniform, then null will be returned. + The text orientation should be an integer either from -90 to 90, or 180 for vertically-oriented text. + If the orientation within a range are not uniform, then null will be returned. * * [Api set: ExcelApi 1.7] */ @@ -37284,9 +38908,9 @@ declare namespace Excel { /** * * Determines if the row height of the Range object equals the standard height of the sheet. - Returns True if the row height of the Range object equals the standard height of the sheet. - Returns Null if the range contains more than one row and the rows aren't all the same height. - Returns False otherwise. + Returns True if the row height of the Range object equals the standard height of the sheet. + Returns Null if the range contains more than one row and the rows aren't all the same height. + Returns False otherwise. * * [Api set: ExcelApi 1.7] */ @@ -37294,9 +38918,9 @@ declare namespace Excel { /** * * Indicates whether the column width of the Range object equals the standard width of the sheet. - Returns True if the column width of the Range object equals the standard width of the sheet. - Returns Null if the range contains more than one column and the columns aren't all the same height. - Returns False otherwise. + Returns True if the column width of the Range object equals the standard width of the sheet. + Returns Null if the range contains more than one column and the columns aren't all the same height. + Returns False otherwise. * * [Api set: ExcelApi 1.7] */ @@ -37763,7 +39387,7 @@ declare namespace Excel { /** * * For EACH ITEM in the collection: Represents the doughnut hole size of a chart series. Only valid on doughnut and doughnutExploded charts. - Throws an invalid argument exception on invalid charts. + Throws an invalid argument exception on invalid charts. * * [Api set: ExcelApi 1.7] */ @@ -37778,7 +39402,7 @@ declare namespace Excel { /** * * For EACH ITEM in the collection: Represents the gap width of a chart series. Only valid on bar and column charts, as well as - specific classes of line and pie charts. Throws an invalid argument exception on invalid charts. + specific classes of line and pie charts. Throws an invalid argument exception on invalid charts. * * [Api set: ExcelApi 1.7] */ @@ -37879,7 +39503,7 @@ declare namespace Excel { /** * * Represents the doughnut hole size of a chart series. Only valid on doughnut and doughnutExploded charts. - Throws an invalid argument exception on invalid charts. + Throws an invalid argument exception on invalid charts. * * [Api set: ExcelApi 1.7] */ @@ -37894,7 +39518,7 @@ declare namespace Excel { /** * * Represents the gap width of a chart series. Only valid on bar and column charts, as well as - specific classes of line and pie charts. Throws an invalid argument exception on invalid charts. + specific classes of line and pie charts. Throws an invalid argument exception on invalid charts. * * [Api set: ExcelApi 1.7] */ @@ -39186,8 +40810,8 @@ declare namespace Excel { /** * * A scoped collection of custom XML parts. - A scoped collection is the result of some operation, e.g. filtering by namespace. - A scoped collection cannot be scoped any further. + A scoped collection is the result of some operation, e.g. filtering by namespace. + A scoped collection cannot be scoped any further. * * [Api set: ExcelApi 1.5] */ @@ -39471,7 +41095,7 @@ declare namespace Excel { /** * * For EACH ITEM in the collection: Returns the cell value conditional format properties if the current conditional format is a CellValue type. - For example to format all cells between 5 and 10. + For example to format all cells between 5 and 10. * * [Api set: ExcelApi 1.6] */ @@ -39479,7 +41103,7 @@ declare namespace Excel { /** * * For EACH ITEM in the collection: Returns the cell value conditional format properties if the current conditional format is a CellValue type. - For example to format all cells between 5 and 10. + For example to format all cells between 5 and 10. * * [Api set: ExcelApi 1.6] */ @@ -39557,7 +41181,7 @@ declare namespace Excel { /** * * For EACH ITEM in the collection: Returns the specific text conditional format properties if the current conditional format is a text type. - For example to format cells matching the word "Text". + For example to format cells matching the word "Text". * * [Api set: ExcelApi 1.6] */ @@ -39565,7 +41189,7 @@ declare namespace Excel { /** * * For EACH ITEM in the collection: Returns the specific text conditional format properties if the current conditional format is a text type. - For example to format cells matching the word "Text". + For example to format cells matching the word "Text". * * [Api set: ExcelApi 1.6] */ @@ -39573,7 +41197,7 @@ declare namespace Excel { /** * * For EACH ITEM in the collection: Returns the Top/Bottom conditional format properties if the current conditional format is an TopBottom type. - For example to format the top 10% or bottom 10 items. + For example to format the top 10% or bottom 10 items. * * [Api set: ExcelApi 1.6] */ @@ -39581,7 +41205,7 @@ declare namespace Excel { /** * * For EACH ITEM in the collection: Returns the Top/Bottom conditional format properties if the current conditional format is an TopBottom type. - For example to format the top 10% or bottom 10 items. + For example to format the top 10% or bottom 10 items. * * [Api set: ExcelApi 1.6] */ @@ -39596,10 +41220,10 @@ declare namespace Excel { /** * * For EACH ITEM in the collection: The priority (or index) within the conditional format collection that this conditional format currently exists in. Changing this also - changes other conditional formats' priorities, to allow for a contiguous priority order. - Use a negative priority to begin from the back. - Priorities greater than than bounds will get and set to the maximum (or minimum if negative) priority. - Also note that if you change the priority, you have to re-fetch a new copy of the object at that new priority location if you want to make further changes to it. Read-only. + changes other conditional formats' priorities, to allow for a contiguous priority order. + Use a negative priority to begin from the back. + Priorities greater than than bounds will get and set to the maximum (or minimum if negative) priority. + Also note that if you change the priority, you have to re-fetch a new copy of the object at that new priority location if you want to make further changes to it. Read-only. * * [Api set: ExcelApi 1.6] */ @@ -39607,7 +41231,7 @@ declare namespace Excel { /** * * For EACH ITEM in the collection: If the conditions of this conditional format are met, no lower-priority formats shall take effect on that cell. - Null on databars, icon sets, and colorscales as there's no concept of StopIfTrue for these + Null on databars, icon sets, and colorscales as there's no concept of StopIfTrue for these * * [Api set: ExcelApi 1.6] */ @@ -39631,7 +41255,7 @@ declare namespace Excel { /** * * Returns the cell value conditional format properties if the current conditional format is a CellValue type. - For example to format all cells between 5 and 10. + For example to format all cells between 5 and 10. * * [Api set: ExcelApi 1.6] */ @@ -39639,7 +41263,7 @@ declare namespace Excel { /** * * Returns the cell value conditional format properties if the current conditional format is a CellValue type. - For example to format all cells between 5 and 10. + For example to format all cells between 5 and 10. * * [Api set: ExcelApi 1.6] */ @@ -39717,7 +41341,7 @@ declare namespace Excel { /** * * Returns the specific text conditional format properties if the current conditional format is a text type. - For example to format cells matching the word "Text". + For example to format cells matching the word "Text". * * [Api set: ExcelApi 1.6] */ @@ -39725,7 +41349,7 @@ declare namespace Excel { /** * * Returns the specific text conditional format properties if the current conditional format is a text type. - For example to format cells matching the word "Text". + For example to format cells matching the word "Text". * * [Api set: ExcelApi 1.6] */ @@ -39733,7 +41357,7 @@ declare namespace Excel { /** * * Returns the Top/Bottom conditional format properties if the current conditional format is an TopBottom type. - For example to format the top 10% or bottom 10 items. + For example to format the top 10% or bottom 10 items. * * [Api set: ExcelApi 1.6] */ @@ -39741,7 +41365,7 @@ declare namespace Excel { /** * * Returns the Top/Bottom conditional format properties if the current conditional format is an TopBottom type. - For example to format the top 10% or bottom 10 items. + For example to format the top 10% or bottom 10 items. * * [Api set: ExcelApi 1.6] */ @@ -39756,10 +41380,10 @@ declare namespace Excel { /** * * The priority (or index) within the conditional format collection that this conditional format currently exists in. Changing this also - changes other conditional formats' priorities, to allow for a contiguous priority order. - Use a negative priority to begin from the back. - Priorities greater than than bounds will get and set to the maximum (or minimum if negative) priority. - Also note that if you change the priority, you have to re-fetch a new copy of the object at that new priority location if you want to make further changes to it. Read-only. + changes other conditional formats' priorities, to allow for a contiguous priority order. + Use a negative priority to begin from the back. + Priorities greater than than bounds will get and set to the maximum (or minimum if negative) priority. + Also note that if you change the priority, you have to re-fetch a new copy of the object at that new priority location if you want to make further changes to it. Read-only. * * [Api set: ExcelApi 1.6] */ @@ -39767,7 +41391,7 @@ declare namespace Excel { /** * * If the conditions of this conditional format are met, no lower-priority formats shall take effect on that cell. - Null on databars, icon sets, and colorscales as there's no concept of StopIfTrue for these + Null on databars, icon sets, and colorscales as there's no concept of StopIfTrue for these * * [Api set: ExcelApi 1.6] */ @@ -39805,7 +41429,7 @@ declare namespace Excel { /** * * HTML color code representing the color of the Axis line, of the form #RRGGBB (e.g. "FFA500") or as a named HTML color (e.g. "orange"). - "" (empty string) if no axis is present or set. + "" (empty string) if no axis is present or set. * * [Api set: ExcelApi 1.6] */ @@ -39857,7 +41481,7 @@ declare namespace Excel { /** * * HTML color code representing the color of the border line, of the form #RRGGBB (e.g. "FFA500") or as a named HTML color (e.g. "orange"). - "" (empty string) if no border is present or set. + "" (empty string) if no border is present or set. * * [Api set: ExcelApi 1.6] */ @@ -39888,7 +41512,7 @@ declare namespace Excel { /** * * HTML color code representing the color of the border line, of the form #RRGGBB (e.g. "FFA500") or as a named HTML color (e.g. "orange"). - "Empty String" if no border is present or set. + "Empty String" if no border is present or set. * * [Api set: ExcelApi 1.6] */ @@ -40776,10 +42400,20 @@ declare namespace Word { * [Api set: WordApi 1.3] */ readonly type: Word.BodyType | "Unknown" | "MainDoc" | "Section" | "Header" | "Footer" | "TableCell"; - /** Sets multiple properties on the object at the same time, based on JSON input. */ + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Word.Body): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ set(properties: Interfaces.BodyUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: Body): void; + set(properties: Word.Body): void; /** * * Clears the contents of the body object. The user can perform the undo operation on the cleared content. @@ -40996,7 +42630,7 @@ declare namespace Word { * * [Api set: WordApi 1.1] * - * @param searchText Required. The search text. + * @param searchText Required. The search text. Can be a maximum of 255 characters. * @param searchOptions Optional. Options for the search. */ search(searchText: string, searchOptions?: Word.SearchOptions | { @@ -41028,6 +42662,18 @@ declare namespace Word { select(selectionMode?: "Select" | "Start" | "End"): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.Body` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.Body` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.Body` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.BodyLoadOptions): Word.Body; load(option?: string | string[]): Word.Body; @@ -41241,10 +42887,20 @@ declare namespace Word { * [Api set: WordApi 1.1] */ readonly type: Word.ContentControlType | "Unknown" | "RichTextInline" | "RichTextParagraphs" | "RichTextTableCell" | "RichTextTableRow" | "RichTextTable" | "PlainTextInline" | "PlainTextParagraph" | "Picture" | "BuildingBlockGallery" | "CheckBox" | "ComboBox" | "DropDownList" | "DatePicker" | "RepeatingSection" | "RichText" | "PlainText"; - /** Sets multiple properties on the object at the same time, based on JSON input. */ + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Word.ContentControl): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ set(properties: Interfaces.ContentControlUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: ContentControl): void; + set(properties: Word.ContentControl): void; /** * * Clears the contents of the content control. The user can perform the undo operation on the cleared content. @@ -41517,6 +43173,18 @@ declare namespace Word { split(delimiters: string[], multiParagraphs?: boolean, trimDelimiters?: boolean, trimSpacing?: boolean): Word.RangeCollection; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.ContentControl` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.ContentControl` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.ContentControl` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.ContentControlLoadOptions): Word.ContentControl; load(option?: string | string[]): Word.ContentControl; @@ -41613,6 +43281,18 @@ declare namespace Word { getItem(index: number): Word.ContentControl; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.ContentControlCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.ContentControlCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.ContentControlCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.ContentControlCollectionLoadOptions & Word.Interfaces.CollectionLoadOptions): Word.ContentControlCollection; load(option?: string | string[]): Word.ContentControlCollection; @@ -41655,10 +43335,20 @@ declare namespace Word { * [Api set: WordApi 1.3] */ value: any; - /** Sets multiple properties on the object at the same time, based on JSON input. */ + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Word.CustomProperty): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ set(properties: Interfaces.CustomPropertyUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: CustomProperty): void; + set(properties: Word.CustomProperty): void; /** * * Deletes the custom property. @@ -41668,6 +43358,18 @@ declare namespace Word { delete(): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.CustomProperty` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.CustomProperty` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.CustomProperty` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.CustomPropertyLoadOptions): Word.CustomProperty; load(option?: string | string[]): Word.CustomProperty; @@ -41738,6 +43440,18 @@ declare namespace Word { getItemOrNullObject(key: string): Word.CustomProperty; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.CustomPropertyCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.CustomPropertyCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.CustomPropertyCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.CustomPropertyCollectionLoadOptions & Word.Interfaces.CollectionLoadOptions): Word.CustomPropertyCollection; load(option?: string | string[]): Word.CustomPropertyCollection; @@ -41794,10 +43508,20 @@ declare namespace Word { * [Api set: WordApi 1.1] */ readonly saved: boolean; - /** Sets multiple properties on the object at the same time, based on JSON input. */ + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Word.Document): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ set(properties: Interfaces.DocumentUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: Document): void; + set(properties: Word.Document): void; /** * * Gets the current selection of the document. Multiple selections are not supported. @@ -41814,6 +43538,18 @@ declare namespace Word { save(): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.Document` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.Document` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.Document` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.DocumentLoadOptions): Word.Document; load(option?: string | string[]): Word.Document; @@ -41873,10 +43609,20 @@ declare namespace Word { * [Api set: WordApiHiddenDocument 1.3] */ readonly saved: boolean; - /** Sets multiple properties on the object at the same time, based on JSON input. */ + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Word.DocumentCreated): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ set(properties: Interfaces.DocumentCreatedUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: DocumentCreated): void; + set(properties: Word.DocumentCreated): void; /** * * Opens the document. @@ -41893,6 +43639,18 @@ declare namespace Word { save(): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.DocumentCreated` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.DocumentCreated` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.DocumentCreated` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.DocumentCreatedLoadOptions): Word.DocumentCreated; load(option?: string | string[]): Word.DocumentCreated; @@ -42043,12 +43801,34 @@ declare namespace Word { * [Api set: WordApi 1.3] */ title: string; - /** Sets multiple properties on the object at the same time, based on JSON input. */ + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Word.DocumentProperties): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ set(properties: Interfaces.DocumentPropertiesUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: DocumentProperties): void; + set(properties: Word.DocumentProperties): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.DocumentProperties` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.DocumentProperties` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.DocumentProperties` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.DocumentPropertiesLoadOptions): Word.DocumentProperties; load(option?: string | string[]): Word.DocumentProperties; @@ -42150,12 +43930,34 @@ declare namespace Word { * [Api set: WordApi 1.1] */ underline: Word.UnderlineType | "Mixed" | "None" | "Hidden" | "DotLine" | "Single" | "Word" | "Double" | "Thick" | "Dotted" | "DottedHeavy" | "DashLine" | "DashLineHeavy" | "DashLineLong" | "DashLineLongHeavy" | "DotDashLine" | "DotDashLineHeavy" | "TwoDotDashLine" | "TwoDotDashLineHeavy" | "Wave" | "WaveHeavy" | "WaveDouble"; - /** Sets multiple properties on the object at the same time, based on JSON input. */ + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Word.Font): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ set(properties: Interfaces.FontUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: Font): void; + set(properties: Word.Font): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.Font` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.Font` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.Font` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.FontLoadOptions): Word.Font; load(option?: string | string[]): Word.Font; @@ -42271,10 +44073,20 @@ declare namespace Word { * [Api set: WordApi 1.1] */ width: number; - /** Sets multiple properties on the object at the same time, based on JSON input. */ + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Word.InlinePicture): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ set(properties: Interfaces.InlinePictureUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: InlinePicture): void; + set(properties: Word.InlinePicture): void; /** * * Deletes the inline picture from the document. @@ -42488,6 +44300,18 @@ declare namespace Word { select(selectionMode?: "Select" | "Start" | "End"): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.InlinePicture` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.InlinePicture` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.InlinePicture` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.InlinePictureLoadOptions): Word.InlinePicture; load(option?: string | string[]): Word.InlinePicture; @@ -42530,6 +44354,18 @@ declare namespace Word { getFirstOrNullObject(): Word.InlinePicture; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.InlinePictureCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.InlinePictureCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.InlinePictureCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.InlinePictureCollectionLoadOptions & Word.Interfaces.CollectionLoadOptions): Word.InlinePictureCollection; load(option?: string | string[]): Word.InlinePictureCollection; @@ -42706,6 +44542,18 @@ declare namespace Word { setLevelStartingNumber(level: number, startingNumber: number): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.List` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.List` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.List` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.ListLoadOptions): Word.List; load(option?: string | string[]): Word.List; @@ -42775,6 +44623,18 @@ declare namespace Word { getItem(index: number): Word.List; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.ListCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.ListCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.ListCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.ListCollectionLoadOptions & Word.Interfaces.CollectionLoadOptions): Word.ListCollection; load(option?: string | string[]): Word.ListCollection; @@ -42817,10 +44677,20 @@ declare namespace Word { * [Api set: WordApi 1.3] */ readonly siblingIndex: number; - /** Sets multiple properties on the object at the same time, based on JSON input. */ + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Word.ListItem): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ set(properties: Interfaces.ListItemUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: ListItem): void; + set(properties: Word.ListItem): void; /** * * Gets the list item parent, or the closest ancestor if the parent does not exist. Throws if the list item has no ancestor. @@ -42850,6 +44720,18 @@ declare namespace Word { getDescendants(directChildrenOnly?: boolean): Word.ParagraphCollection; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.ListItem` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.ListItem` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.ListItem` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.ListItemLoadOptions): Word.ListItem; load(option?: string | string[]): Word.ListItem; @@ -43084,10 +44966,20 @@ declare namespace Word { * [Api set: WordApi 1.1] */ readonly text: string; - /** Sets multiple properties on the object at the same time, based on JSON input. */ + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Word.Paragraph): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ set(properties: Interfaces.ParagraphUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: Paragraph): void; + set(properties: Word.Paragraph): void; /** * * Lets the paragraph join an existing list at the specified level. Fails if the paragraph cannot join the list or if the paragraph is already a list item. @@ -43416,6 +45308,18 @@ declare namespace Word { startNewList(): Word.List; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.Paragraph` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.Paragraph` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.Paragraph` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.ParagraphLoadOptions): Word.Paragraph; load(option?: string | string[]): Word.Paragraph; @@ -43472,6 +45376,18 @@ declare namespace Word { getLastOrNullObject(): Word.Paragraph; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.ParagraphCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.ParagraphCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.ParagraphCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.ParagraphCollectionLoadOptions & Word.Interfaces.CollectionLoadOptions): Word.ParagraphCollection; load(option?: string | string[]): Word.ParagraphCollection; @@ -43619,10 +45535,20 @@ declare namespace Word { * [Api set: WordApi 1.1] */ readonly text: string; - /** Sets multiple properties on the object at the same time, based on JSON input. */ + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Word.Range): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ set(properties: Interfaces.RangeUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: Range): void; + set(properties: Word.Range): void; /** * * Clears the contents of the range object. The user can perform the undo operation on the cleared content. @@ -43972,6 +45898,18 @@ declare namespace Word { split(delimiters: string[], multiParagraphs?: boolean, trimDelimiters?: boolean, trimSpacing?: boolean): Word.RangeCollection; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.Range` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.Range` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.Range` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.RangeLoadOptions): Word.Range; load(option?: string | string[]): Word.Range; @@ -44014,6 +45952,18 @@ declare namespace Word { getFirstOrNullObject(): Word.Range; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.RangeCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.RangeCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.RangeCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.RangeCollectionLoadOptions & Word.Interfaces.CollectionLoadOptions): Word.RangeCollection; load(option?: string | string[]): Word.RangeCollection; @@ -44085,12 +46035,34 @@ declare namespace Word { * [Api set: WordApi 1.1] */ matchWildcards: boolean; - /** Sets multiple properties on the object at the same time, based on JSON input. */ + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Word.SearchOptions): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ set(properties: Interfaces.SearchOptionsUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: SearchOptions): void; + set(properties: Word.SearchOptions): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.SearchOptions` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.SearchOptions` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.SearchOptions` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.SearchOptionsLoadOptions): Word.SearchOptions; load(option?: string | string[]): Word.SearchOptions; @@ -44118,10 +46090,20 @@ declare namespace Word { * [Api set: WordApi 1.1] */ readonly body: Word.Body; - /** Sets multiple properties on the object at the same time, based on JSON input. */ + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Word.Section): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ set(properties: Interfaces.SectionUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: Section): void; + set(properties: Word.Section): void; /** * * Gets one of the section's footers. @@ -44174,6 +46156,18 @@ declare namespace Word { getNextOrNullObject(): Word.Section; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.Section` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.Section` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.Section` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.SectionLoadOptions): Word.Section; load(option?: string | string[]): Word.Section; @@ -44216,6 +46210,18 @@ declare namespace Word { getFirstOrNullObject(): Word.Section; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.SectionCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.SectionCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.SectionCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.SectionCollectionLoadOptions & Word.Interfaces.CollectionLoadOptions): Word.SectionCollection; load(option?: string | string[]): Word.SectionCollection; @@ -44426,10 +46432,20 @@ declare namespace Word { * [Api set: WordApi 1.3] */ width: number; - /** Sets multiple properties on the object at the same time, based on JSON input. */ + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Word.Table): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ set(properties: Interfaces.TableUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: Table): void; + set(properties: Word.Table): void; /** * * Adds columns to the start or end of the table, using the first or last existing column as a template. This is applicable to uniform tables. The string values, if specified, are set in the newly inserted rows. @@ -44747,6 +46763,18 @@ declare namespace Word { setCellPadding(cellPaddingLocation: "Top" | "Left" | "Bottom" | "Right", cellPadding: number): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.Table` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.Table` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.Table` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.TableLoadOptions): Word.Table; load(option?: string | string[]): Word.Table; @@ -44789,6 +46817,18 @@ declare namespace Word { getFirstOrNullObject(): Word.Table; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.TableCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.TableCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.TableCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.TableCollectionLoadOptions & Word.Interfaces.CollectionLoadOptions): Word.TableCollection; load(option?: string | string[]): Word.TableCollection; @@ -44887,10 +46927,20 @@ declare namespace Word { * [Api set: WordApi 1.3] */ verticalAlignment: Word.VerticalAlignment | "Mixed" | "Top" | "Center" | "Bottom"; - /** Sets multiple properties on the object at the same time, based on JSON input. */ + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Word.TableRow): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ set(properties: Interfaces.TableRowUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: TableRow): void; + set(properties: Word.TableRow): void; /** * * Clears the contents of the row. @@ -45035,6 +47085,18 @@ declare namespace Word { setCellPadding(cellPaddingLocation: "Top" | "Left" | "Bottom" | "Right", cellPadding: number): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.TableRow` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.TableRow` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.TableRow` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.TableRowLoadOptions): Word.TableRow; load(option?: string | string[]): Word.TableRow; @@ -45077,6 +47139,18 @@ declare namespace Word { getFirstOrNullObject(): Word.TableRow; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.TableRowCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.TableRowCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.TableRowCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.TableRowCollectionLoadOptions & Word.Interfaces.CollectionLoadOptions): Word.TableRowCollection; load(option?: string | string[]): Word.TableRowCollection; @@ -45175,10 +47249,20 @@ declare namespace Word { * [Api set: WordApi 1.3] */ readonly width: number; - /** Sets multiple properties on the object at the same time, based on JSON input. */ + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Word.TableCell): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ set(properties: Interfaces.TableCellUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: TableCell): void; + set(properties: Word.TableCell): void; /** * * Deletes the column containing this cell. This is applicable to uniform tables. @@ -45309,6 +47393,18 @@ declare namespace Word { setCellPadding(cellPaddingLocation: "Top" | "Left" | "Bottom" | "Right", cellPadding: number): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.TableCell` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.TableCell` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.TableCell` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.TableCellLoadOptions): Word.TableCell; load(option?: string | string[]): Word.TableCell; @@ -45351,6 +47447,18 @@ declare namespace Word { getFirstOrNullObject(): Word.TableCell; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.TableCellCollection` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.TableCellCollection` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.TableCellCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.TableCellCollectionLoadOptions & Word.Interfaces.CollectionLoadOptions): Word.TableCellCollection; load(option?: string | string[]): Word.TableCellCollection; @@ -45393,12 +47501,34 @@ declare namespace Word { * [Api set: WordApi 1.3] */ width: number; - /** Sets multiple properties on the object at the same time, based on JSON input. */ + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Word.TableBorder): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ set(properties: Interfaces.TableBorderUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ - set(properties: TableBorder): void; + set(properties: Word.TableBorder): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Word.TableBorder` - Where option is a comma-delimited string or an array of strings that specify the properties/relationships to load. + * + * `load(option?: { select?: string; expand?: string; }): Word.TableBorder` - Where option.select is a comma-delimited string that specifies the properties/relationships to load, and options.expand is a comma-delimited string that specifies the relationships to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.TableBorder` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. */ load(option?: Word.Interfaces.TableBorderLoadOptions): Word.TableBorder; load(option?: string | string[]): Word.TableBorder; @@ -46230,8 +48360,17 @@ declare namespace Word { notImplemented = "NotImplemented", } module Interfaces { + /** + * Provides ways to load properties of only a subset of members of a collection. + */ interface CollectionLoadOptions { + /** + * Specify the number of items in the queried collection to be included in the result. + */ $top?: number; + /** + * Specify the number of items in the collection that are to be skipped and not included in the result. If top is specified, the selection of result will start after skipping the specified number of items. + */ $skip?: number; } /** An interface for updating data on the Body object, for use in "body.set({ ... })". */ @@ -54420,15 +56559,6 @@ declare namespace OneNote { */ numberType: OneNote.NumberType | "None" | "Arabic" | "UCRoman" | "LCRoman" | "UCLetter" | "LCLetter" | "Ordinal" | "Cardtext" | "Ordtext" | "Hex" | "ChiManSty" | "DbNum1" | "DbNum2" | "Aiueo" | "Iroha" | "DbChar" | "SbChar" | "DbNum3" | "DbNum4" | "Circlenum" | "DArabic" | "DAiueo" | "DIroha" | "ArabicLZ" | "Bullet" | "Ganada" | "Chosung" | "GB1" | "GB2" | "GB3" | "GB4" | "Zodiac1" | "Zodiac2" | "Zodiac3" | "TpeDbNum1" | "TpeDbNum2" | "TpeDbNum3" | "TpeDbNum4" | "ChnDbNum1" | "ChnDbNum2" | "ChnDbNum3" | "ChnDbNum4" | "KorDbNum1" | "KorDbNum2" | "KorDbNum3" | "KorDbNum4" | "Hebrew1" | "Arabic1" | "Hebrew2" | "Arabic2" | "Hindi1" | "Hindi2" | "Hindi3" | "Thai1" | "Thai2" | "NumInDash" | "LCRus" | "UCRus" | "LCGreek" | "UCGreek" | "Lim" | "Custom"; } - /** - * [Api set: OneNoteApi 1.1] - */ - enum EntityType { - notebook = "Notebook", - sectionGroup = "SectionGroup", - section = "Section", - page = "Page", - } /** * [Api set: OneNoteApi 1.1] */ @@ -55690,6 +57820,7 @@ declare namespace OneNote { interface TableCellCollectionData { items?: OneNote.Interfaces.TableCellData[]; } + /** * * Represents the top-level object that contains all globally addressable OneNote objects such as notebooks, the active notebook, and the active section. @@ -57361,182 +59492,6 @@ declare namespace OneNote { */ shadingColor?: boolean; } - /** - * - * Represents a OneNote accessibility violation. - * - * [Api set: OneNoteApi 1.2] - */ - interface AccessibilityViolationLoadOptions { - $all?: boolean; - /** - * - * Gets the ID of the accessibility violation. Read-only. - * - * [Api set: OneNoteApi 1.2] - */ - id?: boolean; - /** - * - * Gets the location of the accessibility violation. Read-only. - * - * [Api set: OneNoteApi 1.2] - */ - location?: boolean; - /** - * - * Gets the name of the accessibility violation. Read-only. - * - * [Api set: OneNoteApi 1.2] - */ - name?: boolean; - /** - * - * Gets the type of the accessibility violation. Read-only. - * - * [Api set: OneNoteApi 1.2] - */ - type?: boolean; - } - /** - * - * Represents the collection of AccessibilityViolations - * - * [Api set: OneNoteApi 1.2] - */ - interface AccessibilityViolationCollectionLoadOptions { - $all?: boolean; - /** - * - * For EACH ITEM in the collection: Gets the ID of the accessibility violation. Read-only. - * - * [Api set: OneNoteApi 1.2] - */ - id?: boolean; - /** - * - * For EACH ITEM in the collection: Gets the location of the accessibility violation. Read-only. - * - * [Api set: OneNoteApi 1.2] - */ - location?: boolean; - /** - * - * For EACH ITEM in the collection: Gets the name of the accessibility violation. Read-only. - * - * [Api set: OneNoteApi 1.2] - */ - name?: boolean; - /** - * - * For EACH ITEM in the collection: Gets the type of the accessibility violation. Read-only. - * - * [Api set: OneNoteApi 1.2] - */ - type?: boolean; - } - /** - * - * A OneNote structure that stores metadata about accessibility violations for an entity. - * - * [Api set: OneNoteApi 1.2] - */ - interface AccessibilityViolationsByEntityLoadOptions { - $all?: boolean; - /** - * - * Gets the parent section section group (if any) of the entity. - * - * [Api set: OneNoteApi 1.2] - */ - parentSectionGroupOrNull?: OneNote.Interfaces.SectionGroupLoadOptions; - /** - * - * Gets the parent section (if any) of the entity. - * - * [Api set: OneNoteApi 1.2] - */ - parentSectionOrNull?: OneNote.Interfaces.SectionLoadOptions; - /** - * - * Gets the name of the entity for which this structure holds metadata. Read-only. - * - * [Api set: OneNoteApi 1.2] - */ - entityName?: boolean; - /** - * - * Gets the type of the entity for which this structure holds metadata. Read-only. - * - * [Api set: OneNoteApi 1.2] - */ - entityType?: boolean; - /** - * - * Gets the ID of the AccessibilityViolationsByEntity. Read-only. - * - * [Api set: OneNoteApi 1.2] - */ - id?: boolean; - /** - * - * Gets the count of accessibility violations for the entity. Read-only. - * - * [Api set: OneNoteApi 1.2] - */ - violationsCount?: boolean; - } - /** - * - * Represents the collection of AccessibilityViolationsByEntity - * - * [Api set: OneNoteApi 1.2] - */ - interface AccessibilityViolationsByEntityCollectionLoadOptions { - $all?: boolean; - /** - * - * For EACH ITEM in the collection: Gets the parent section section group (if any) of the entity. - * - * [Api set: OneNoteApi 1.2] - */ - parentSectionGroupOrNull?: OneNote.Interfaces.SectionGroupLoadOptions; - /** - * - * For EACH ITEM in the collection: Gets the parent section (if any) of the entity. - * - * [Api set: OneNoteApi 1.2] - */ - parentSectionOrNull?: OneNote.Interfaces.SectionLoadOptions; - /** - * - * For EACH ITEM in the collection: Gets the name of the entity for which this structure holds metadata. Read-only. - * - * [Api set: OneNoteApi 1.2] - */ - entityName?: boolean; - /** - * - * For EACH ITEM in the collection: Gets the type of the entity for which this structure holds metadata. Read-only. - * - * [Api set: OneNoteApi 1.2] - */ - entityType?: boolean; - /** - * - * For EACH ITEM in the collection: Gets the ID of the AccessibilityViolationsByEntity. Read-only. - * - * [Api set: OneNoteApi 1.2] - */ - id?: boolean; - /** - * - * For EACH ITEM in the collection: Gets the count of accessibility violations for the entity. Read-only. - * - * [Api set: OneNoteApi 1.2] - */ - violationsCount?: boolean; - } } } declare namespace OneNote { diff --git a/types/omggif/index.d.ts b/types/omggif/index.d.ts new file mode 100644 index 0000000000..f7d374ddbb --- /dev/null +++ b/types/omggif/index.d.ts @@ -0,0 +1,60 @@ +// Type definitions for omggif 1.0 +// Project: https://github.com/deanm/omggif +// Definitions by: Florian Keller +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// + +export interface GifOptions { + background?: number; + loop?: number; + palette?: number[]; +} + +export interface FrameOptions { + delay?: number; + disposal?: number; + palette?: number[] | null; + transparent?: number; +} + +export interface Frame { + data_length: number; + data_offset: number; + delay: number; + disposal: number; + has_local_palette: boolean; + height: number; + interlaced: boolean; + palette_offset: number | null; + palette_size: number | null; + transparent_index: number | null; + width: number; + x: number; + y: number; +} + +export class GifWriter { + height: number; + width: number; + + constructor(buf: Buffer, width: number, height: number, gopts?: GifOptions); + + addFrame(x: number, y: number, w: number, h: number, indexed_pixels: number[], opts?: FrameOptions): number; + end(): number; + getOutputBuffer(): Buffer; + getOutputBufferPosition(): number; + setOutputBuffer(v: Buffer): void; + setOutputBufferPosition(v: number): void; +} + +export class GifReader { + constructor(buf: Buffer); + + decodeAndBlitFrameBGRA(frame_num: number, pixels: number[]): void; + decodeAndBlitFrameRGBA(frame_num: number, pixels: number[]): void; + frameInfo(frame_num: number): Frame; + loopCount(): number; + numFrames(): number; +} diff --git a/types/omggif/omggif-tests.ts b/types/omggif/omggif-tests.ts new file mode 100644 index 0000000000..c20df1f446 --- /dev/null +++ b/types/omggif/omggif-tests.ts @@ -0,0 +1,84 @@ +import * as omggif from 'omggif'; + +// (c) Dean McNamee , 2013. +// Node omggif example to write out a few example images. + +// Needs to be large enough for the final full file size. Can be any type of +// buffer that supports [] (an Array, Uint8Array, Node Buffer, etc). +const buf = new Buffer(1024 * 1024); + +function gen_static_global() { + const gf = new omggif.GifWriter(buf, 2, 2, { palette: [0xff0000, 0x0000ff] }); + gf.addFrame(0, 0, 2, 2, [0, 1, 1, 0]); + return gf.end(); +} + +function gen_anim() { + // The loop parameter is the number of times to loop, or 0 for forever. + // A value of 1 will play twice (first time, and then one loop time). + // To play only once do not specify loop or pass null. + const gf = new omggif.GifWriter(buf, 2, 2, { loop: 1 }); + gf.addFrame(0, 0, 2, 2, [0, 1, 1, 0], { palette: [0xff0000, 0x0000ff] }); + gf.addFrame(0, 0, 2, 2, [1, 0, 0, 1], { + palette: [0xff0000, 0x0000ff], + delay: 10, + }); // Delay in hundredths of a sec (100 = 1s). + return gf.end(); +} + +function gen_gray_strip() { + const gf = new omggif.GifWriter(buf, 256, 1); + const palette = []; + const indices = []; + for (let i = 0; i < 256; ++i) { + palette.push((i << 16) | (i << 8) | i); + indices.push(i); + } + gf.addFrame(0, 0, 256, 1, indices, { palette }); + return gf.end(); +} + +// More than 8-bit color (via tiling of several frames). Browsers seem to +// treat this as an animation though, with an enforced minimum time between +// frames which makes it animated instead of the intended static image. +function gen_color_strip() { + const gf = new omggif.GifWriter(buf, 256, 256, { + palette: [0x000000, 0xff0000], + background: 1, + }); + + const indices = []; + for (let i = 0; i < 256; ++i) indices.push(i); + + for (let j = 0; j < 256; ++j) { + const palette = []; + for (let i = 0; i < 256; ++i) palette.push((j << 16) | (i << 8) | i); + gf.addFrame(0, j, 256, 1, indices, { palette, disposal: 1 }); + } + return gf.end(); +} + +// 1x1 white, generates the same as Google's 35 byte __utm.gif, except for some +// reason that I'm not sure of they set their background index to 255. +function gen_empty_white() { + const gf = new omggif.GifWriter(buf, 1, 1, { palette: [0xffffff, 0x000000] }); + gf.addFrame(0, 0, 1, 1, [0]); + return gf.end(); +} + +// with lzw block of 256. +// see: https://github.com/deanm/omggif/issues/5 +function gen_block256() { + const width = 4840; + const gf = new omggif.GifWriter(buf, width, 1, { + palette: [0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000], + }); + const stream = Array(width); + for (let i = 0; i < width; ++i) stream[i] = i & 0x7; + gf.addFrame(0, 0, width, 1, stream, { transparent: 0 }); + const data = buf.slice(0, gf.end()); + // Make sure it decodes. + const gr = new omggif.GifReader(data); + const frameInfo = gr.frameInfo(0); + return frameInfo; +} diff --git a/types/omggif/tsconfig.json b/types/omggif/tsconfig.json new file mode 100644 index 0000000000..fdc89342ec --- /dev/null +++ b/types/omggif/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "omggif-tests.ts" + ] +} diff --git a/types/omggif/tslint.json b/types/omggif/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/omggif/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/openlayers/index.d.ts b/types/openlayers/index.d.ts index 37cac7e65d..3214bad15c 100644 --- a/types/openlayers/index.d.ts +++ b/types/openlayers/index.d.ts @@ -9,6 +9,7 @@ // Yair Tawil // Pierre Marchand // Hauke Stieler +// Guillaume Beraudo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Definitions partially generated using tsd-jsdoc (https://github.com/englercj/tsd-jsdoc) @@ -1715,7 +1716,7 @@ export class Feature extends Object { * representing the current style of this feature. * @api stable */ - getStyleFunction(): (ol.FeatureStyleFunction); + getStyleFunction(): (ol.FeatureStyleFunction | undefined); /** * Set the default geometry for the feature. This will update the property @@ -6412,7 +6413,7 @@ export namespace layer { * @return Layer style function. * @api stable */ - getStyleFunction(): (ol.StyleFunction); + getStyleFunction(): (ol.StyleFunction | undefined); /** * Set the style for features. This can be a single style object, an array @@ -6424,7 +6425,7 @@ export namespace layer { * @param style Layer style. * @api stable */ - setStyle(style: (ol.style.Style | ol.style.Style[] | ol.StyleFunction | null)): void; + setStyle(style: (ol.style.Style | ol.style.Style[] | ol.StyleFunction | null | undefined)): void; } /** @@ -8472,7 +8473,7 @@ export namespace source { * @return Layer style function. * @api stable */ - getStyleFunction(): (ol.StyleFunction); + getStyleFunction(): (ol.StyleFunction | undefined); /** * Set the style for features. This can be a single style object, an array @@ -8484,7 +8485,7 @@ export namespace source { * @param style Layer style. * @api stable */ - setStyle(style: (ol.style.Style | ol.style.Style[] | ol.StyleFunction)): void; + setStyle(style: (ol.style.Style | ol.style.Style[] | ol.StyleFunction | null | undefined)): void; } /** @@ -10831,7 +10832,7 @@ export type FeatureLoader = (extent: ol.Extent, resolution: number, proj: ol.pro * {@link ol.Feature} to be styled. * */ -export type FeatureStyleFunction = (resolution: number) => (ol.style.Style | ol.style.Style[]); +export type FeatureStyleFunction = (resolution: number) => (ol.style.Style | ol.style.Style[] | null); /** * {@link ol.source.Vector} sources use a function of this type to get the url @@ -10981,7 +10982,7 @@ export interface StyleImageOptions { * or an array of them. This way e.g. a vector layer can be styled. * */ -export type StyleFunction = (feature: (ol.Feature | ol.render.Feature), resolution: number) => (ol.style.Style | ol.style.Style[]); +export type StyleFunction = (feature: (ol.Feature | ol.render.Feature), resolution: number) => (ol.style.Style | ol.style.Style[] | null); /** * A function that takes an {@link ol.Feature} as argument and returns an diff --git a/types/openlayers/openlayers-tests.ts b/types/openlayers/openlayers-tests.ts index 6e28ad4cd2..d631a9e9bb 100644 --- a/types/openlayers/openlayers-tests.ts +++ b/types/openlayers/openlayers-tests.ts @@ -418,6 +418,14 @@ feature.setStyle(styleArray); feature.setStyle(featureStyleFunction); feature.setStyle(styleFunction); feature.setProperties(object); +const nullStyleFunction = (feature: (ol.Feature|ol.render.Feature), resolution: number): null => { + return null; +}; +const nullFeatureStyleFunction = (resolution: number): null => { + return null; +}; +feature.setStyle(nullStyleFunction); +feature.setStyle(nullFeatureStyleFunction); // // ol.View @@ -573,6 +581,10 @@ const vectorLayer: ol.layer.Vector = new ol.layer.Vector({ zIndex: -1 }); +vectorLayer.setStyle(nullStyleFunction); +vectorLayer.setStyle(null); +vectorLayer.setStyle(undefined); + // // ol.layer.VectorTile // diff --git a/types/ora/v0/index.d.ts b/types/ora/v0/index.d.ts index 536d858bd7..771f6beef6 100644 --- a/types/ora/v0/index.d.ts +++ b/types/ora/v0/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for ora v0.3.0 +// Type definitions for ora 0.3 // Project: https://github.com/sindresorhus/ora -// Definitions by: Basarat Ali Syed , Christian Rackerseder +// Definitions by: Basarat Ali Syed , Christian Rackerseder // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/ora/v0/tslint.json b/types/ora/v0/tslint.json index a41bf5d19a..3db14f85ea 100644 --- a/types/ora/v0/tslint.json +++ b/types/ora/v0/tslint.json @@ -1,79 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} +{ "extends": "dtslint/dt.json" } diff --git a/types/p-retry/index.d.ts b/types/p-retry/index.d.ts index 784f637549..c1791fcc63 100644 --- a/types/p-retry/index.d.ts +++ b/types/p-retry/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for p-retry 1.0 +// Type definitions for p-retry 2.0 // Project: https://github.com/sindresorhus/p-retry#readme // Definitions by: BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -8,7 +8,7 @@ import { OperationOptions } from 'retry'; export = pRetry; -declare function pRetry(input: (attemptCount: number) => PromiseLike | T, options?: OperationOptions): Promise; +declare function pRetry(input: (attemptCount: number) => PromiseLike | T, options?: pRetry.Options): Promise; declare namespace pRetry { class AbortError extends Error { @@ -16,4 +16,13 @@ declare namespace pRetry { readonly originalError: Error; constructor(message: string | Error); } + + interface FailedAttemptError extends Error { + attemptNumber: number; + attemptsLeft: number; + } + + interface Options extends OperationOptions { + onFailedAttempt?: (error: FailedAttemptError) => void; + } } diff --git a/types/p-retry/p-retry-tests.ts b/types/p-retry/p-retry-tests.ts index 72962d553e..1b58960e95 100644 --- a/types/p-retry/p-retry-tests.ts +++ b/types/p-retry/p-retry-tests.ts @@ -11,6 +11,11 @@ const run = () => fetch('https://sindresorhus.com/unicorn') return response.text(); }); -pRetry(run, {retries: 5}).then(result => { +pRetry(run, { + retries: 5, + onFailedAttempt: error => { + console.log(`Attempt ${error.attemptNumber} failed. There are ${error.attemptsLeft} attempts left.`); + } +}).then(result => { const str: string = result; }); diff --git a/types/page/index.d.ts b/types/page/index.d.ts index 0f9317c6a4..ef56afdc9b 100644 --- a/types/page/index.d.ts +++ b/types/page/index.d.ts @@ -1,7 +1,9 @@ // Type definitions for page v1.5.0 // Project: http://visionmedia.github.io/page.js/ // Definitions by: Alan Norbauer +// James Garbutt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 declare namespace PageJS { interface Static { @@ -64,7 +66,7 @@ declare namespace PageJS { * * If you wish to load serve initial content from the server you likely will want to set dispatch to false. */ - (options: Options): void; + (options: Partial): void; /** * Register page's popstate / click bindings. If you're doing selective binding you'll like want to pass { click: false } to specify this yourself. The following options are available: * @@ -125,7 +127,7 @@ declare namespace PageJS { * * Identical to page([options]). */ - start(options: Options): void; + start(options: Partial): void; /** * Register page's popstate / click bindings. If you're doing selective binding you'll like want to pass { click: false } to specify this yourself. The following options are available: * @@ -205,19 +207,23 @@ declare namespace PageJS { /** * bind to click events (default = true) */ - click?: boolean; + click: boolean; /** * bind to popstate (default = true) */ - popstate?: boolean; + popstate: boolean; /** * perform initial dispatch (default = true) */ - dispatch?: boolean; + dispatch: boolean; /** * add #!before urls (default = false) */ - hashbang?: boolean; + hashbang: boolean; + /** + * remove URL encoding frfrom path components + */ + decodeURLComponents: boolean; } interface Callback { diff --git a/types/page/page-tests.ts b/types/page/page-tests.ts index 9d78998672..5d5b421d7e 100644 --- a/types/page/page-tests.ts +++ b/types/page/page-tests.ts @@ -13,6 +13,16 @@ page('/contact', contact); page('/contact/:contactName', contact); page('/contact/inline/:contactName', ctx => { }); page(); +page({ + click: false, + popstate: true, + dispatch: false, + hashbang: true, + decodeURLComponents: false +}); +page({ + hashbang: true +}); var index: PageJS.Callback = function() { document.querySelector('p') @@ -82,4 +92,4 @@ var show: PageJS.Callback = function (ctx) { function notfound() { document.querySelector('p') .textContent = 'not found'; -} \ No newline at end of file +} diff --git a/types/passport-google-oauth/index.d.ts b/types/passport-google-oauth/index.d.ts index 8b45504cb2..26ee9888b7 100644 --- a/types/passport-google-oauth/index.d.ts +++ b/types/passport-google-oauth/index.d.ts @@ -53,6 +53,7 @@ interface IOAuth2StrategyOption { callbackURL: string; authorizationURL?: string; tokenURL?: string; + userProfileURL?: string; accessType?: string; approval_prompt?: string; prompt?: string; diff --git a/types/passport-strategy/index.d.ts b/types/passport-strategy/index.d.ts index 1a0b2dd4f5..33b35ddbaf 100644 --- a/types/passport-strategy/index.d.ts +++ b/types/passport-strategy/index.d.ts @@ -45,7 +45,7 @@ declare class Strategy implements passport.Strategy { * @param {Object} info * @api public */ - success(user: any, info: any): void; + success(user: any, info?: any): void; /** * Fail authentication, with optional `challenge` and `status`, defaulting diff --git a/types/passport-strategy/passport-strategy-tests.ts b/types/passport-strategy/passport-strategy-tests.ts index e9c6fd604f..4b8090d241 100644 --- a/types/passport-strategy/passport-strategy-tests.ts +++ b/types/passport-strategy/passport-strategy-tests.ts @@ -33,7 +33,7 @@ export class Strategy extends passport.Strategy { var self = this; - function verified(err: Error, user: any, info: any) { + function verified(err: Error, user: any, info?: any) { if (err) { return self.error(err); } @@ -43,6 +43,6 @@ export class Strategy extends passport.Strategy { self.success(user, info); } - verified(null, {}, {}); + verified(null, {}); } } diff --git a/types/phonegap/index.d.ts b/types/phonegap/index.d.ts index 60ad5d2fd9..926140c3f9 100644 --- a/types/phonegap/index.d.ts +++ b/types/phonegap/index.d.ts @@ -526,7 +526,7 @@ declare var Media: { new(src: string, onSuccess: (arg: any) => any, onError: (error: any) => any): Media; } -interface Notification { +interface PhonegapNotification { alert(message: string, alertCallback: Function, title?: string, buttonName?: string): void; confirm(message: string, confirmCallback: Function, title?: string, buttonLabels?: string): void; confirm(message: string, confirmCallback: Function, title?: string, buttonLabels?: string[]): void; @@ -614,7 +614,7 @@ interface /*PhoneGapNavigator extends*/ Navigator { contacts: Contacts; device: Device; globalization: Globalization; - notification: Notification; + notification: PhonegapNotification; splashscreen: Splashscreen; } diff --git a/types/pino/index.d.ts b/types/pino/index.d.ts index 27d0f51fc6..42d7a4d1f6 100644 --- a/types/pino/index.d.ts +++ b/types/pino/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for pino 4.16 +// Type definitions for pino 5.20 // Project: https://github.com/pinojs/pino.git // Definitions by: Peter Snider // BendingBender // Christian Rackerseder +// GP // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -145,6 +146,10 @@ declare namespace P { * requires supplying a level value via `levelVal`. Default: 'info'. */ level?: LevelWithSilent | string; + /** + * Outputs the level as a string instead of integer. Default: `false`. + */ + useLevelLabels?: boolean; /** * When defining a custom log level via level, set to an integer value to define the new level. Default: `undefined`. */ @@ -268,6 +273,10 @@ declare namespace P { * You can pass `'silent'` to disable logging. */ level: LevelWithSilent | string; + /** + * Outputs the level as a string instead of integer. + */ + useLevelLabels: boolean; /** * Returns the integer value for the logger instance's logging level. */ diff --git a/types/pino/pino-tests.ts b/types/pino/pino-tests.ts index 6959a6cd97..356f84da30 100644 --- a/types/pino/pino-tests.ts +++ b/types/pino/pino-tests.ts @@ -96,3 +96,7 @@ pino.levels.labels[50] === 'error'; const logstderr: pino.Logger = pino(process.stderr); logstderr.error('on stderr instead of stdout'); + +log.useLevelLabels = true; +log.info('lol'); +log.level === 'info'; diff --git a/types/png.js/index.d.ts b/types/png.js/index.d.ts new file mode 100644 index 0000000000..a7d05fd837 --- /dev/null +++ b/types/png.js/index.d.ts @@ -0,0 +1,58 @@ +// Type definitions for png.js 0.2 +// Project: https://github.com/arian/pngjs +// Definitions by: Florian Keller +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +type BitDepth = 2 | 4 | 8 | 16; +type ColorType = 0 | 2 | 3 | 4 | 6; +type ParseCallback = (err: Error | undefined, png: PNG) => void; + +interface ParseOptions { + data?: boolean; +} + +declare class PNGReader { + bytes: Uint8Array | number[] | Buffer; + dataChunks: number[][]; + i: number; + png: PNG; + + constructor(bytes: Uint8Array | string | Buffer | ArrayBuffer); + parse(callback: ParseCallback): void; + parse(options: ParseOptions, callback: ParseCallback): void; +} + +declare class PNG { + alpha: boolean; + bitDepth: BitDepth; + colors: number; + colorType: ColorType; + compressionMethod: 0; + filterMethod: 0; + height: number; + interlaceMethod: 0 | 1; + palette: number[] | null; + pixelBits: number; + pixels: Buffer | null; + width: number; + + getBitDepth(): BitDepth; + getColorType(): ColorType; + getCompressionMethod(): 0; + getFilterMethod(): 0; + getHeight(): number; + getInterlaceMethod(): 0 | 1; + getPalette(): number[]; + getPixel(x: number, y: number): [number, number, number, number]; + getWidth(): number; + setBitDepth(bitDepth: BitDepth): void; + setColorType(colorType: ColorType): void; + setCompressionMethod(compressionMethod: 0): void; + setFilterMethod(filterMethod: 0): void; + setHeight(height: number): void; + setInterlaceMethod(interlaceMethod: 0 | 1): void; + setPalette(palette: number[]): void; + setWidth(width: number): void; +} + +export = PNGReader; diff --git a/types/png.js/png.js-tests.ts b/types/png.js/png.js-tests.ts new file mode 100644 index 0000000000..86cc504a75 --- /dev/null +++ b/types/png.js/png.js-tests.ts @@ -0,0 +1,37 @@ +/// + +import PNGReader = require('png.js'); + +const buffer = new Buffer([]); +const reader1 = new PNGReader(buffer); + +reader1.parse((err, png) => { + if (err) throw err; + + png.getWidth(); + png.getHeight(); + png.getPixel(1, 0)[0]; + png.getBitDepth(); + png.getColorType(); + png.getCompressionMethod(); + png.getFilterMethod(); + png.getInterlaceMethod(); + png.getPalette(); +}); + +const bytes = new Uint8Array(0); +const reader2 = new PNGReader(bytes); + +reader2.parse({data: false}, (err, png) => { + if (err) throw err; + + png.getWidth(); + png.getHeight(); + png.getPixel(1, 0)[2]; + png.getBitDepth(); + png.getColorType(); + png.getCompressionMethod(); + png.getFilterMethod(); + png.getInterlaceMethod(); + png.getPalette(); +}); diff --git a/types/png.js/tsconfig.json b/types/png.js/tsconfig.json new file mode 100644 index 0000000000..595988b23f --- /dev/null +++ b/types/png.js/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "png.js-tests.ts" + ] +} diff --git a/types/png.js/tslint.json b/types/png.js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/png.js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/polymer-ts/index.d.ts b/types/polymer-ts/index.d.ts index bf7daf936f..7ab10afa47 100644 --- a/types/polymer-ts/index.d.ts +++ b/types/polymer-ts/index.d.ts @@ -58,7 +58,7 @@ declare namespace polymer { setScrollDirection(direction: string, node: HTMLElement): void; shift(path: string, value: any): any; splice(path: string, start: number, deleteCount: number, ...items: any[]): any; - toggleAttribute(name: string, bool: boolean, node?: HTMLElement): void; + toggleAttribute(name: string, force?: boolean, node?: HTMLElement): boolean; toggleClass(name: string, bool: boolean, node?: HTMLElement): void; transform(transform: string, node?: HTMLElement): void; translate3d(x: any, y: any, z: any, node?: HTMLElement): void; diff --git a/types/polymer/index.d.ts b/types/polymer/index.d.ts index 569842066a..1b67f4c6d5 100644 --- a/types/polymer/index.d.ts +++ b/types/polymer/index.d.ts @@ -263,7 +263,7 @@ declare global { setAttribute(name: string, value: any):void; removeAttribute(name: string):void; - + observeNodes(callback: (info: ObservedNodeInfo) => void): {}; unobserveNodes(observer: {}): void; @@ -340,6 +340,12 @@ declare global { whenLoaded(cb: Function): void; } + interface Templatizer { + templatize(template: HTMLTemplateElement, mutableData?: boolean): void; + stamp(model: {}): Base; + modelForElement: (elem: HTMLElement) => Base; + } + interface PolymerStatic { Settings: Settings; @@ -351,12 +357,14 @@ declare global { Class(prototype: Base | { new (): Base }): CustomElementConstructor; - RenderStatus: RenderStatus + RenderStatus: RenderStatus; ArraySplice: ArraySplice; /** @deprecated */ - ImportStatus: ImportStatus + ImportStatus: ImportStatus; + + Templatizer: Templatizer; } } diff --git a/types/polymer/polymer-tests.ts b/types/polymer/polymer-tests.ts index 2b6631ffb7..ce55ac325d 100644 --- a/types/polymer/polymer-tests.ts +++ b/types/polymer/polymer-tests.ts @@ -1,6 +1,8 @@ Polymer({ is: "my-element", + behaviors: [Polymer.Templatizer], + properties: { prop1: String, prop2: { @@ -24,6 +26,11 @@ Polymer({ }, ready: function () { + const template = Polymer.dom(this).querySelector('template'); + if (template) { + this.templatize(template); + const instance = this.stamp({item: {}}); + } this.textContent = 'My element!'; this.$.name.textContent = this.name; this.serialize({}); diff --git a/types/pouchdb-upsert/index.d.ts b/types/pouchdb-upsert/index.d.ts index 003f310ad7..d044e9f2a4 100644 --- a/types/pouchdb-upsert/index.d.ts +++ b/types/pouchdb-upsert/index.d.ts @@ -1,6 +1,9 @@ // Type definitions for pouchdb-upsert 2.2 // Project: https://github.com/pouchdb/upsert -// Definitions by: Keith D. Moore , Andrew Mitchell , Eddie Hsu +// Definitions by: Keith D. Moore +// Andrew Mitchell +// Eddie Hsu +// John McLaughlin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -55,7 +58,8 @@ declare namespace PouchDB { callback: Core.Callback): void; } - type UpsertDiffCallback = (doc: Core.Document | {}) => Core.Document | boolean; + type CancelUpsert = '' | 0 | false | null | undefined; // falsey values + type UpsertDiffCallback = (doc: Core.Document | {}) => Content & Partial | CancelUpsert; interface UpsertResponse { id: Core.DocumentId; diff --git a/types/pouchdb-upsert/pouchdb-upsert-tests.ts b/types/pouchdb-upsert/pouchdb-upsert-tests.ts index 55697e88d6..b86afedf29 100644 --- a/types/pouchdb-upsert/pouchdb-upsert-tests.ts +++ b/types/pouchdb-upsert/pouchdb-upsert-tests.ts @@ -2,9 +2,10 @@ import * as pouchdbUpsert from 'pouchdb-upsert'; PouchDB.plugin(pouchdbUpsert); interface UpsertDocModel { - _id: 'test-doc1'; - name: 'test'; + name: string; + readonly?: boolean; } + declare const docToUpsert: PouchDB.Core.Document; const db = new PouchDB(); @@ -16,10 +17,20 @@ function testUpsert_WithPromise_AndReturnDoc() { }); } -function testUpsert_WithPromise_AndReturnBoolean() { +function testUpsert_WithPromise_AndReturnFalsey() { db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document) => { + if (doc.readonly) + return false; // Make some updates.... - return false; + return doc; + }).then((res: PouchDB.UpsertResponse) => { + }); +} + +function testUpsert_WithPromise_AndReturnNewObject() { + // callback return boolean + db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document) => { + return {name: 'test', readonly: true}; }).then((res: PouchDB.UpsertResponse) => { }); } @@ -31,11 +42,20 @@ function testUpsert_WithCallback_AndReturnDoc() { }, (res: PouchDB.UpsertResponse) => {}); } -function testUpsert_WithCallback_AndReturnBoolean() { +function testUpsert_WithCallback_AndReturnFalsey() { // callback return boolean db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document) => { + if (doc.readonly) + return false; // Make some updates.... - return false; + return doc; + }, (res: PouchDB.UpsertResponse) => {}); +} + +function testUpsert_WithCallback_AndReturnNewObject() { + // callback return boolean + db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document) => { + return {name: 'test', readonly: true}; }, (res: PouchDB.UpsertResponse) => {}); } diff --git a/types/puppeteer/puppeteer-tests.ts b/types/puppeteer/puppeteer-tests.ts index 96cb4fd361..e883157fec 100644 --- a/types/puppeteer/puppeteer-tests.ts +++ b/types/puppeteer/puppeteer-tests.ts @@ -27,8 +27,8 @@ import * as puppeteer from "puppeteer"; // Get the "viewport" of the page, as reported by the page. const dimensions = await page.evaluate(() => { return { - width: document.documentElement.clientWidth, - height: document.documentElement.clientHeight, + width: document.documentElement!.clientWidth, + height: document.documentElement!.clientHeight, deviceScaleFactor: window.devicePixelRatio }; }); @@ -300,7 +300,7 @@ puppeteer.launch().then(async browser => { someElement; // $ExpectType ElementHandle // If one passes an ElementHandle, puppeteer will unwrap its DOM reference instead - await page.$eval('.hello-world', (e, x1: HTMLDivElement) => x1.noWrap, someElement); + await page.$eval('.hello-world', (e, x1) => (x1 as any).noWrap, someElement); browser.close(); })(); diff --git a/types/puppeteer/v0/puppeteer-tests.ts b/types/puppeteer/v0/puppeteer-tests.ts index 913d46a789..963fb1c8c1 100644 --- a/types/puppeteer/v0/puppeteer-tests.ts +++ b/types/puppeteer/v0/puppeteer-tests.ts @@ -27,8 +27,8 @@ import * as puppeteer from "puppeteer"; // Get the "viewport" of the page, as reported by the page. const dimensions = await page.evaluate(() => { return { - width: document.documentElement.clientWidth, - height: document.documentElement.clientHeight, + width: document.documentElement!.clientWidth, + height: document.documentElement!.clientHeight, deviceScaleFactor: window.devicePixelRatio }; }); diff --git a/types/qiniu-js/index.d.ts b/types/qiniu-js/index.d.ts new file mode 100644 index 0000000000..b47bc0528e --- /dev/null +++ b/types/qiniu-js/index.d.ts @@ -0,0 +1,371 @@ +// Type definitions for qiniu-js 2.4 +// Project: https://github.com/qiniu/js-sdk#readme +// Definitions by: taoqf +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +export as namespace qiniu; + +export interface Next { + total: { + loaded: number; // 已上传大小,单位为字节。 + total: number; // 本次上传的总量控制信息,单位为字节,注意这里的 total 跟文件大小并不一致。 + percent: number; // 当前上传进度,范围:0~100。 + }; +} + +export interface Error { + code: number; // 请求错误状态码,只有在 err.isRequestError 为 true 的时候才有效。可查阅码值对应说明。 + message: string; // 错误信息,包含错误码,当后端返回提示信息时也会有相应的错误信息。 + isRequestError: true | undefined; // 用于区分是否 xhr 请求错误;当 xhr 请求出现错误并且后端通过 HTTP 状态码返回了错误信息时,该参数为 true;否则为 undefined 。 + reqId: string; // xhr请求错误的 X-Reqid。 +} + +export interface AudioInfo { + bit_rate: string; + channels: number; + codec_name: string; + codec_type: string; + duration: string; + index: number; + nb_frames: string; + r_frame_rate: string; + sample_fmt: string; + sample_rate: string; + start_time: string; + tags: { + creation_time: string; + [key: string]: string; + }; +} + +export interface AvFormat { + bit_rate: string; + duration: string; + format_long_name: string; + format_name: string; + nb_streams: number; + size: string; + start_time: string; + tags: { + creation_time: string; + [key: string]: string; + }; +} + +export interface VideoInfo { + bit_rate: string; + codec_name: string; + codec_type: string; + display_aspect_ratio: string; + duration: string; + height: number; + index: number; + nb_frames: string; + pix_fmt: string; + r_frame_rate: string; + sample_aspect_ratio: string; + start_time: string; + tags: { + creation_time: string; + [key: string]: string; + }; + width: number; +} + +export interface AvAudioInfo { + audio: AudioInfo; + format: AvFormat; + video: VideoInfo; +} + +export interface AvImageInfo { + format: string; + width: number; + height: number; + colorModel: string; +} + +export interface CompletedResult { + avinfo?: AvAudioInfo; + imageInfo?: AvImageInfo; + key: string; + name: string; + size: number; + persistentid: string; + sec: string; + ext: string; + bucket: string; +} + +export interface Observer { + next(res: Next): void; + error(err: Error | string): void; + complete(res: CompletedResult): void; +} + +export interface Subscription { + unsubscribe(): void; +} + +export interface Observable { + subscribe(options: Observer): Subscription; + /** + * 订阅 + * + * @param next 接收上传进度信息 + * @param error 上传错误后触发;自动重试本身并不会触发该错误,而当重试次数到达上限后则可以触发。当不是 xhr 请求错误时,会把当前错误产生原因直接抛出,诸如 JSON 解析异常等;当产生 xhr 请求错误时,参数 err 为一个包含 code、message、isRequestError 三个属性的 object + * @param complete 接收上传完成后的后端返回信息,具体返回结构取决于后端sdk的配置,可参考[上传策略](https://developer.qiniu.com/kodo/manual/1206/put-policy)。 + * @returns + */ + subscribe(next: (obj: Next) => void, error?: (err: Error | string) => void, complete?: (obj: CompletedResult) => void): Subscription; +} + +export interface Extra { + fname: string; // 文件原文件名 + params: any; // 用来放置自定义变量 + mimeType: string[] | null; // 用来限制上传文件类型,为 null 时表示不对文件类型限制;限制类型放到数组里: ["image/png", "image/jpeg", "image/gif"] +} + +export interface Config { + useCdnDomain: boolean; + region: Region | string; +} + +/** + * 上传文件 + * @param file Blob 对象,上传的文件 + * @param key 文件资源名 + * @param token 上传验证信息,前端通过接口请求后端获得 + * @param putExtra + * @param config + */ +export function upload(file: Blob, key: string | null | undefined, token: string, putExtra: Partial, config: Partial): Observable; + +/** + * 返回创建文件的 url;当分片上传时,我们需要把分片返回的 ctx 信息拼接后通过该 url 上传给七牛以创建文件。 + * + * @param url 上传域名,可以通过qiniu.getUploadUrl()获得 + * @param size 文件大小 + * @param key 文件资源名 + * @param putExtra + * @returns + */ +export function createMkFileUrl(url: string, size: number, key: string, putExtra: Partial): string; + +export enum Region { + z0, // 代表华东区域 + z1, // 代表华北区域 + z2, // 代表华南区域 + na0, // 代表北美区域 + as0 // 代表新加坡区域 +} + +export namespace region { + const z0: Region; + const z1: Region; + const z2: Region; + const na0: Region; + const as0: Region; +} + +/** + * 接收参数为 config 对象,返回根据 config 里所配置信息的上传域名 + * + * @param config + * @param token + * @returns + */ +export function getUploadUrl(config: Partial, token: string): Promise; + +export interface Headers { + [key: string]: string; +} + +/** + * 返回 object,包含用来获得分片上传设置的头信息,参数为 token 字符串;当分片上传时,请求需要带该函数返回的头信息 + * + * @param token + * @returns + */ +export function getHeadersForChunkUpload(token: string): Headers; + +/** + * 返回 object,包含用来获得文件创建的头信息,参数为 token 字符串;当分片上传完需要把 ctx 信息传给七牛用来创建文件时,请求需要带该函数返回的头信息 + * + * @param token + * @returns + */ +export function getHeadersForMkFile(token: string): Headers; + +/** + * 返回[[k, v],...]格式的数组,k 为自定义变量 key 名,v 为自定义变量值,用来提取 putExtra.params 包含的自定义变量 + * + * @param params + * @returns + */ +export function filterParams(params: any): Array<[string, any]>; + +export interface CompressOptions { + quality: number; // 图片压缩质量,在图片格式为 image/jpeg 或 image/webp 的情况下生效,其他格式不会生效,可以从 0 到 1 的区间内选择图片的质量。默认值 0.92 + maxWidh: number; // 压缩图片的最大宽度值 + maxHeight: number; // 压缩图片的最大高度值 (注意:当 maxWidth 和 maxHeight 都不设置时,则采用原图尺寸大小) + noCompressIfLarger: boolean; // 为 true 时如果发现压缩后图片大小比原来还大,则返回源图片(即输出的 dist 直接返回了输入的 file);默认 false,即保证图片尺寸符合要求,但不保证压缩后的图片体积一定变小 +} + +/** + * 上传前图片压缩 + * + * @param file 要压缩的源图片,为 blob 对象,支持 image/png、image/jpeg、image/bmp、image/webp 这几种图片类型 + * @param options + * @returns + */ +export function compressImage(file: Blob, options: Partial): Promise<{ + dist: Blob; // 压缩后输出的 blob 对象,或原始的 file,具体看下面的 options 配置 + width: number; // 压缩后的图片宽度 + height: number; // 压缩后的图片高度 +}>; + +export interface WaterMarkOptions1 { + mode: 1; // 图片水印 + image: string; // 图片水印的Url,mode = 1 时 **必需** + dissolve: number; // 透明度,取值范围1-100,非必需,下同 + gravity: 'NorthWest' | 'North' | 'NorthEast' | 'West' | 'Center' | 'East' | 'SouthWest' | 'South' | 'SouthEast'; // 水印位置 + dx: number; // 横轴边距,单位:像素(px) + dy: number; // 纵轴边距,单位:像素(px) +} + +export interface WaterMarkOptions2 { + mode: 2; // 文字水印 + text: string; // 水印文字,mode = 2 时 **必需** + dissolve: number; // 透明度,取值范围1-100,非必需,下同 + gravity: 'NorthWest' | 'North' | 'NorthEast' | 'West' | 'Center' | 'East' | 'SouthWest' | 'South' | 'SouthEast'; // 水印位置 + fontsize: number; // 字体大小,单位: 缇 + font: string; // 水印文字字体 + dx: number; // 横轴边距,单位:像素(px) + dy: number; // 纵轴边距,单位:像素(px) + fill: string; // 水印文字颜色,RGB格式,可以是颜色名称 +} + +/** + * 水印 + * + * @param options 包含的具体水印参数解释见水印([watermark](https://developer.qiniu.com/dora/manual/1316/image-watermarking-processing-watermark)) + * @param key 文件资源名 + * @param domain 为七牛空间(bucket)对应的域名,选择某个空间后,可通过"空间设置->基本设置->域名设置"查看获取,前端可以通过接口请求后端得到 + * @returns 返回添加水印后的图片地址,可以赋值给 html 的 img 元素的 src 属性, 若未指定key,可以通过以下方式获得完整的 imgLink + * `imgLink = '/?' + imgLink` + * 为七牛空间(bucket)对应的域名,选择某个空间后,可通过"空间设置->基本设置->域名设置"查看获取 + */ +export function watermark(options: WaterMarkOptions1 | WaterMarkOptions2, key?: string, domain?: string): string; + +export interface ImageView2Options { + mode: 0 | 1 | 2 | 3 | 4 | 5; // 缩略模式,共6种[0-5] + w: number; // 具体含义由缩略模式决定 + h: number; // 具体含义由缩略模式决定 + q: number; // 新图的图像质量,取值范围:1-100 + format: 'jpg' | 'gif' | 'png' | 'webp' | string; // 新图的输出格式,取值范围:jpg,gif,png,webp等 +} + +/** + * 缩略 + * + * @param options 具体缩略参数解释见[图片基本处理(imageView2)](https://developer.qiniu.com/dora/manual/1279/basic-processing-images-imageview2) + * @param key + * @param domain + * @returns 返回处理后的图片url + */ +export function imageView2(options: Partial, key: string, domain: string): string; + +export interface ImageMogr2Options { + 'auto-orient': boolean; // 布尔值,是否根据原图EXIF信息自动旋正,便于后续处理,建议放在首位。 + strip: boolean; // 布尔值,是否去除图片中的元信息 + thumbnail: string; // 缩放操作参数 + crop: string; // 裁剪操作参数 + gravity: string; // 裁剪锚点参数 + quality: number; // 图片质量,取值范围1-100 + rotate: number; // 旋转角度,取值范围1-360,缺省为不旋转。 + format: string; // 新图的输出格式,取值范围:jpg,gif,png,webp等 + blur: string; // 高斯模糊参数 +} + +/** + * 返回处理后的图片url + * + * @param optoins 具体高级图像处理参数解释见[图像高级处理(imageMogr2)](https://developer.qiniu.com/dora/manual/1270/the-advanced-treatment-of-images-imagemogr2) + * @param key + * @param domain + * @returns 返回处理后的图片url + */ +export function imageMogr2(optoins: Partial, key: string, domain: string): string; + +export interface ImageInfo { + size: number; // 文件大小,单位:Bytes + format: 'png' | 'jpeg' | 'gif' | 'bmp'; // 图片类型,如png、jpeg、gif、bmp等。 + width: number; // 图片宽度,单位:像素(px) 。 + height: number; // 图片高度,单位:像素(px) 。 + colorModel: string; // 彩色空间,如palette16、ycbcr等。 + frameNumber: number; // 帧数,gif 图片会返回此项。 +} + +/** + * + * 图片基本信息 + * 具体 imageInfo 解释见[图片基本信息(imageInfo)](https://developer.qiniu.com/dora/manual/1269/pictures-basic-information-imageinfo) + * + * @param key + * @param domain + * @returns + */ +export function imageInfo(key: string, domain: string): Promise; + +export interface ExtendedInfo { + code: number; + error: string; + [key: string]: { + type: number; + val: string; + } | number | string; +} + +export interface ExtentInfoValue { + type: number; + val: string; +} + +export interface ExtentInfo { + [key: string]: ExtentInfoValue; + DateTime: ExtentInfoValue; + ExposureBiasValue: ExtentInfoValue; + ExposureTime: ExtentInfoValue; + Model: ExtentInfoValue; + ISOSpeedRatings: ExtentInfoValue; + ResolutionUnit: ExtentInfoValue; +} + +/** + * EXIF 信息 + * 具体 exif 解释见[图片 EXIF 信息(exif)](https://developer.qiniu.com/dora/manual/1260/photo-exif-information-exif) + * @param key + * @param domain + * @returns + */ +export function exif(key: string, domain: string): Promise; + +export interface WaterMarkFopOptions1 extends WaterMarkOptions1 { + fop: 'watermark'; +} + +export interface WaterMarkFopOptions2 extends WaterMarkOptions2 { + fop: 'watermark'; +} + +export interface ImageView2FopOptions extends ImageView2Options { + fop: 'imageView2'; +} + +export interface ImageMogr2FopOptions extends ImageMogr2Options { + fop: 'imageMogr2'; +} + +export function pipeline(fos: Array<(WaterMarkFopOptions1 | WaterMarkFopOptions2 | ImageView2FopOptions | ImageMogr2FopOptions)>, key: string, domain: string): string; diff --git a/types/qiniu-js/qiniu-js-tests.ts b/types/qiniu-js/qiniu-js-tests.ts new file mode 100644 index 0000000000..344f38b195 --- /dev/null +++ b/types/qiniu-js/qiniu-js-tests.ts @@ -0,0 +1,50 @@ +import { compressImage, region, upload } from 'qiniu-js'; + +const file: Blob = null as any; + +const config = { + useCdnDomain: true, + region: region.z2 +}; + +const key = 'key'; +const token = 'token'; + +const putExtra = { + fname: "", + params: {}, + mimeType: [] || null +}; + +(() => { + const observable = upload(file, key, token, putExtra, config); + + const subscription = observable.subscribe({ + next(res) { }, + complete(res) { }, + error(err) { } + }); // 上传开始 + subscription.unsubscribe(); // 上传取消 +})(); + +(() => { + const observable = upload(file, key, token, putExtra, config); + const subscription = observable.subscribe((res) => { }, (err) => { }, (res) => { }); // 这样传参形式也可以 +})(); + +(async () => { + // 图片上传前压缩: + const options = { + quality: 0.92, + noCompressIfLarger: true + // maxWidth: 1000, + // maxHeight: 618 + }; + const data = await compressImage(file, options); + const observable = upload(data.dist, key, token, putExtra, config); + const subscription = observable.subscribe({ + next(res) { }, + complete(res) { }, + error(err) { } + }); // 上传开始 +})(); diff --git a/types/qiniu-js/test/qiniu-js-global-tests.ts b/types/qiniu-js/test/qiniu-js-global-tests.ts new file mode 100644 index 0000000000..e3820d1438 --- /dev/null +++ b/types/qiniu-js/test/qiniu-js-global-tests.ts @@ -0,0 +1,48 @@ +const file: Blob = null as any; + +const config = { + useCdnDomain: true, + region: qiniu.region.z2 +}; + +const key = 'key'; +const token = 'token'; + +const putExtra = { + fname: "", + params: {}, + mimeType: [] || null +}; + +(() => { + const observable = qiniu.upload(file, key, token, putExtra, config); + + const subscription = observable.subscribe({ + next(res) { }, + complete(res) { }, + error(err) { } + }); // 上传开始 + subscription.unsubscribe(); // 上传取消 +})(); + +(() => { + const observable = qiniu.upload(file, key, token, putExtra, config); + const subscription = observable.subscribe((res) => { }, (err) => { }, (res) => { }); // 这样传参形式也可以 +})(); + +(async () => { + // 图片上传前压缩: + const options = { + quality: 0.92, + noCompressIfLarger: true + // maxWidth: 1000, + // maxHeight: 618 + }; + const data = await qiniu.compressImage(file, options); + const observable = qiniu.upload(data.dist, key, token, putExtra, config); + const subscription = observable.subscribe({ + next(res) { }, + complete(res) { }, + error(err) { } + }); // 上传开始 +})(); diff --git a/types/qiniu-js/tsconfig.json b/types/qiniu-js/tsconfig.json new file mode 100644 index 0000000000..15efaa0a4c --- /dev/null +++ b/types/qiniu-js/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "strictFunctionTypes": true, + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "qiniu-js-tests.ts", + "test/qiniu-js-global-tests.ts" + ] +} \ No newline at end of file diff --git a/types/qiniu-js/tslint.json b/types/qiniu-js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/qiniu-js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/qlik-engineapi/index.d.ts b/types/qlik-engineapi/index.d.ts index 115802a935..bf2355e88f 100644 --- a/types/qlik-engineapi/index.d.ts +++ b/types/qlik-engineapi/index.d.ts @@ -9265,6 +9265,7 @@ declare namespace EngineAPI { * DimensionItemLayout... */ interface IDimensionItemLayout { + qInfo: INxInfo; qMeta: INxMetaTitleDescriptionTag; qData: null; } diff --git a/types/rc-select/index.d.ts b/types/rc-select/index.d.ts index b78fc03837..30fc16507f 100644 --- a/types/rc-select/index.d.ts +++ b/types/rc-select/index.d.ts @@ -20,41 +20,55 @@ export { declare namespace RcSelect { interface SelectProps { - className?: string; - prefixCls?: string; - animation?: string; - transitionName?: string; - choiceTransitionName?: string; - dropdownMatchSelectWidth?: boolean; - dropdownClassName?: string; - dropdownStyle?: { [key: string]: string }; - dropdownMenuStyle?: { [key: string]: string }; - notFoundContent?: string; - showSearch?: boolean; allowClear?: boolean; - tags?: boolean; - maxTagTextLength?: number; + animation?: string; + choiceTransitionName?: string; + className?: string; combobox?: boolean; - multiple?: boolean; + defaultActiveFirstOption?: boolean; + defaultLabel?: string | Array; + defaultValue?: string | Array; disabled?: boolean; + dropdownClassName?: string; + dropdownMatchSelectWidth?: boolean; + dropdownMenuStyle?: { [key: string]: string }; + dropdownStyle?: { [key: string]: string }; filterOption?: boolean; + getPopupContainer?: (trigger: Node) => Node; + getInputElement?: () => Node; + id?: string; + labelInValue?: boolean; + maxTagCount?: number; + maxTagPlaceholder?: React.ReactNode | Function; + maxTagTextLength?: number; + multiple?: boolean; + notFoundContent?: string; + onBlur?: () => void; + onChange?: (value: string, label: string) => void; + onDeselect?: (value: string, option: Option) => void; + onFocus?: () => void; + onInputKeyDown?: (e: Event) => void; + onPopupScroll?: () => void; + onSearch?: () => void; + onSelect?: (value: string, ontion: Option) => void; optionFilterProp?: string; optionLabelProp?: string; - defaultValue?: string | Array; + placeholder?: React.ReactNode; + prefixCls?: string; + showAction?: string[]; + showArrow?: boolean; + showSearch?: boolean; + tags?: boolean; + tokenSeparators?: string[]; + transitionName?: string; value?: string | Array; - onChange?: (value: string, label: string) => void; - onSearch?: Function; - onSelect?: (value: string, ontion: Option) => void; - onDeselect?: Function; - defaultLabel?: string | Array; - defaultActiveFirstOption?: boolean; - getPopupContainer?: (trigger: Node) => Node; } export class Select extends React.Component { } interface OptionProps { className?: string; disabled?: boolean; key?: string; + title?: string; value?: string; } export class Option extends React.Component { } diff --git a/types/rc-slider/README.md b/types/rc-slider/README.md index 6c56f6c2e1..10c7dec387 100644 --- a/types/rc-slider/README.md +++ b/types/rc-slider/README.md @@ -5,7 +5,7 @@ This package contains type definitions for rc-slider (https://github.com/react-component/slider). Additional Details - * Last updated: Fri, 15 Dec 2017 + * Last updated: Sun, 04 Aug 2018 * Dependencies: react * Global values: none diff --git a/types/rc-slider/index.d.ts b/types/rc-slider/index.d.ts index 707f5425c5..420d836034 100644 --- a/types/rc-slider/index.d.ts +++ b/types/rc-slider/index.d.ts @@ -1,9 +1,10 @@ -// Type definitions for rc-slider 8.2 +// Type definitions for rc-slider 8.6 // Project: https://github.com/react-component/slider // Definitions by: Marcinkus Mantas // Alexander Mattoni // Austin Turner // Jacob Froman +// Deanna Veale // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -68,18 +69,6 @@ export interface CommonApiProps { * @default false */ dots?: boolean; - /** - * onBeforeChange will be triggered when ontouchstart or onmousedown is triggered. - */ - onBeforeChange?(value: any): any | undefined; - /** - * onChange will be triggered while the value of Slider changing. - */ - onChange?(value: any): any | undefined; - /** - * onAfterChange will be triggered when ontouchend or onmouseup is triggered. - */ - onAfterChange?(value: any): any | undefined; /** * @deprecated in version ^6.0.0. Use rc-tooltip @@ -125,6 +114,18 @@ export interface CommonApiProps { } export interface SliderProps extends CommonApiProps { + /** + * onBeforeChange will be triggered when ontouchstart or onmousedown is triggered. + */ + onBeforeChange?(value: number): void; + /** + * onChange will be triggered while the value of Slider changing. + */ + onChange?(value: number): void; + /** + * onAfterChange will be triggered when ontouchend or onmouseup is triggered. + */ + onAfterChange?(value: number): void; /** * Set initial value of slider. * @default 0 @@ -137,6 +138,21 @@ export interface SliderProps extends CommonApiProps { } export interface RangeProps extends CommonApiProps { + /** + * onBeforeChange will be triggered when ontouchstart or onmousedown is triggered. + * For prop (count = -1) type returned is [number, undefined]. Bug raised in rc-slider https://github.com/react-component/slider/issues/457 + */ + onBeforeChange?(value: number[]): void; + /** + * onChange will be triggered while the value of Slider changing. + * For prop (count = -1) type returned is [number, undefined]. Bug raised in rc-slider https://github.com/react-component/slider/issues/457 + */ + onChange?(value: number[]): void; + /** + * onAfterChange will be triggered when ontouchend or onmouseup is triggered. + * For prop (count = -1) type returned is [number, undefined]. Bug raised in rc-slider https://github.com/react-component/slider/issues/457 + */ + onAfterChange?(value: number[]): void; /** * Set initial positions of handles. * @default [0,0] diff --git a/types/rc-slider/rc-slider-tests.tsx b/types/rc-slider/rc-slider-tests.tsx index 2de87bc4e2..5b246dd7ab 100644 --- a/types/rc-slider/rc-slider-tests.tsx +++ b/types/rc-slider/rc-slider-tests.tsx @@ -18,6 +18,11 @@ ReactDOM.render( />, document.querySelector('.another-app') ); + +const onChangeFunc1 = (string: number) => {}; + +const onChangeFunc2 = (string: number[]) => {}; + ReactDOM.render( { }} - onChange={() => { }} - onAfterChange={() => { }} + onBeforeChange={onChangeFunc1} + onChange={onChangeFunc1} + onAfterChange={onChangeFunc1} defaultValue={0.1} value={0.1} style={{backgroundColor: 'plum'}} @@ -49,6 +54,9 @@ ReactDOM.render( count={3} allowCross={false} pushable={true} + onChange={onChangeFunc2} + onAfterChange={onChangeFunc2} + onBeforeChange={onChangeFunc2} />, document.querySelector('.app') ); diff --git a/types/reach__router/index.d.ts b/types/reach__router/index.d.ts index f52b3954e3..e61e9e15ad 100644 --- a/types/reach__router/index.d.ts +++ b/types/reach__router/index.d.ts @@ -5,8 +5,8 @@ // TypeScript Version: 2.8 import * as React from "react"; - -export type WindowLocation = Window["location"]; +import { Location as HLocation } from "history"; +export type WindowLocation = Window["location"] & HLocation; export interface History { readonly location: string; @@ -60,13 +60,15 @@ export interface LinkGetProps { export class Link extends React.Component> {} -export interface RedirectProps { +export interface RedirectProps { from?: string; to: string; noThrow?: boolean; + state?: TState; + replace?: boolean; } -export class Redirect extends React.Component {} +export class Redirect extends React.Component> {} export interface MatchProps { path: string; @@ -74,7 +76,7 @@ export interface MatchProps { } export type MatchRenderFn = ( - props: MatchRenderProps, + props: MatchRenderProps ) => React.ReactNode; export interface MatchRenderProps { @@ -104,7 +106,7 @@ export interface LocationProviderProps { } export type LocationProviderRenderFn = ( - context: LocationContext, + context: LocationContext ) => React.ReactNode; export interface LocationContext { diff --git a/types/reach__router/reach__router-tests.tsx b/types/reach__router/reach__router-tests.tsx index 56e2305a2e..0cada3367d 100644 --- a/types/reach__router/reach__router-tests.tsx +++ b/types/reach__router/reach__router-tests.tsx @@ -1,4 +1,10 @@ -import { Link, Location, RouteComponentProps, Router } from "@reach/router"; +import { + Link, + Location, + RouteComponentProps, + Router, + Redirect +} from "@reach/router"; import * as React from "react"; import { render } from "react-dom"; @@ -21,9 +27,10 @@ render( + - {(context) => ( + {context => ( <>
hostname is {context.location.hostname}