diff --git a/types/aws-lambda/trigger/sns.d.ts b/types/aws-lambda/trigger/sns.d.ts index c6d2cae29ee934..5c3ce544f2f44b 100644 --- a/types/aws-lambda/trigger/sns.d.ts +++ b/types/aws-lambda/trigger/sns.d.ts @@ -16,12 +16,12 @@ export interface SNSMessage { SignatureVersion: string; Timestamp: string; Signature: string; - SigningCertUrl: string; + SigningCertUrl: string; // Not SigningCertURL; see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/73817#issuecomment-3367340170 MessageId: string; Message: string; MessageAttributes: SNSMessageAttributes; Type: string; - UnsubscribeUrl: string; + UnsubscribeUrl: string; // Not UnsubscribeURL; see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/73817#issuecomment-3367340170 TopicArn: string; Subject?: string; Token?: string; diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index e8ec196ac916c0..e36e59bfcd0140 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -10156,69 +10156,74 @@ declare namespace chrome { * Permissions: "system.storage" */ export namespace system.storage { + export enum EjectDeviceResultCode { + /** The ejection command is successful -- the application can prompt the user to remove the device. */ + SUCCESS = "success", + /** The device is in use by another application. The ejection did not succeed; the user should not remove the device until the other application is done with the device. */ + IN_USE = "in_use", + /** There is no such device known. */ + NO_SUCH_DEVICE = "no_such_device", + /** The ejection command failed. */ + FAILURE = "failure", + } + export interface StorageUnitInfo { /** The transient ID that uniquely identifies the storage device. This ID will be persistent within the same run of a single application. It will not be a persistent identifier between different runs of an application, or between different applications. */ id: string; /** The name of the storage unit. */ name: string; - /** - * The media type of the storage unit. - * fixed: The storage has fixed media, e.g. hard disk or SSD. - * removable: The storage is removable, e.g. USB flash drive. - * unknown: The storage type is unknown. - */ - type: string; + /** The media type of the storage unit. */ + type: `${StorageUnitType}`; /** The total amount of the storage space, in bytes. */ capacity: number; } - export interface StorageCapacityInfo { - /** A copied |id| of getAvailableCapacity function parameter |id|. */ + export enum StorageUnitType { + /** The storage has fixed media, e.g. hard disk or SSD. */ + FIXED = "fixed", + /** The storage is removable, e.g. USB flash drive. */ + REMOVABLE = "removable", + /** The storage type is unknown. */ + UNKNOWN = "unknown", + } + + export interface StorageAvailableCapacityInfo { + /** A copied `id` of getAvailableCapacity function parameter `id`. */ id: string; /** The available capacity of the storage device, in bytes. */ availableCapacity: number; } - export interface SystemStorageAttachedEvent extends chrome.events.Event<(info: StorageUnitInfo) => void> {} - - export interface SystemStorageDetachedEvent extends chrome.events.Event<(id: string) => void> {} - - /** Get the storage information from the system. The argument passed to the callback is an array of StorageUnitInfo objects. */ - export function getInfo(callback: (info: StorageUnitInfo[]) => void): void; /** * Get the storage information from the system. The argument passed to the callback is an array of StorageUnitInfo objects. - * @return The `getInfo` method provides its result via callback or returned as a `Promise` (MV3 only). + * + * Can return its result via Promise in Manifest V3 or later since Chrome 91. */ export function getInfo(): Promise; + export function getInfo(callback: (info: StorageUnitInfo[]) => void): void; + /** * Ejects a removable storage device. - * @param callback - * Parameter result: success: The ejection command is successful -- the application can prompt the user to remove the device; in_use: The device is in use by another application. The ejection did not succeed; the user should not remove the device until the other application is done with the device; no_such_device: There is no such device known. failure: The ejection command failed. - */ - export function ejectDevice(id: string, callback: (result: string) => void): void; - /** - * Ejects a removable storage device. - * @param callback - * Parameter result: success: The ejection command is successful -- the application can prompt the user to remove the device; in_use: The device is in use by another application. The ejection did not succeed; the user should not remove the device until the other application is done with the device; no_such_device: There is no such device known. failure: The ejection command failed. - * @return The `ejectDevice` method provides its result via callback or returned as a `Promise` (MV3 only). - */ - export function ejectDevice(id: string): Promise; - /** - * Get the available capacity of a specified |id| storage device. The |id| is the transient device ID from StorageUnitInfo. - * @since Dev channel only. + * + * Can return its result via Promise in Manifest V3 or later since Chrome 91. */ - export function getAvailableCapacity(id: string, callback: (info: StorageCapacityInfo) => void): void; + export function ejectDevice(id: string): Promise<`${EjectDeviceResultCode}`>; + export function ejectDevice(id: string, callback: (result: `${EjectDeviceResultCode}`) => void): void; + /** - * Get the available capacity of a specified |id| storage device. The |id| is the transient device ID from StorageUnitInfo. + * Get the available capacity of a specified `id` storage device. The `id` is the transient device ID from StorageUnitInfo. + * + * Can return its result via Promise in Manifest V3. * @since Dev channel only. - * @return The `getAvailableCapacity` method provides its result via callback or returned as a `Promise` (MV3 only). */ - export function getAvailableCapacity(id: string): Promise; + export function getAvailableCapacity(id: string): Promise; + export function getAvailableCapacity(id: string, callback: (info: StorageAvailableCapacityInfo) => void): void; /** Fired when a new removable storage is attached to the system. */ - export var onAttached: SystemStorageAttachedEvent; + export const onAttached: events.Event<(info: StorageUnitInfo) => void>; + /** Fired when a removable storage is detached from the system. */ - export var onDetached: SystemStorageDetachedEvent; + export const onDetached: events.Event<(id: string) => void>; } //////////////////// diff --git a/types/chrome/test/index.ts b/types/chrome/test/index.ts index 363306740f25f6..dee5b277f3b120 100644 --- a/types/chrome/test/index.ts +++ b/types/chrome/test/index.ts @@ -2863,11 +2863,50 @@ async function testSystemCpu() { chrome.system.cpu.getInfo(() => {}).then(() => {}); } -// https://developer.chrome.com/docs/extensions/reference/system_storage -async function testSystemStorageForPromise() { - await chrome.system.storage.getInfo(); - await chrome.system.storage.ejectDevice("id1"); - await chrome.system.storage.getAvailableCapacity("id1"); +// https://developer.chrome.com/docs/extensions/reference/api/system/storage +async function testSystemStorage() { + chrome.system.storage.EjectDeviceResultCode.FAILURE === "failure"; + chrome.system.storage.EjectDeviceResultCode.IN_USE === "in_use"; + chrome.system.storage.EjectDeviceResultCode.NO_SUCH_DEVICE === "no_such_device"; + chrome.system.storage.EjectDeviceResultCode.SUCCESS === "success"; + + chrome.system.storage.StorageUnitType.FIXED === "fixed"; + chrome.system.storage.StorageUnitType.REMOVABLE === "removable"; + chrome.system.storage.StorageUnitType.UNKNOWN === "unknown"; + + const id = "id"; + chrome.system.storage.ejectDevice(id); // $ExpectType Promise<"success" | "in_use" | "no_such_device" | "failure"> + chrome.system.storage.ejectDevice(id, (result) => { // $ExpectType void + result; // $ExpectType "success" | "in_use" | "no_such_device" | "failure" + }); + // @ts-expect-error + chrome.system.storage.ejectDevice(id, () => {}).then(() => {}); + + chrome.system.storage.getAvailableCapacity(id); // $ExpectType Promise + chrome.system.storage.getAvailableCapacity(id, (info) => { // $ExpectType void + info.availableCapacity; // $ExpectType number + info.id; // $ExpectType string + }); + // @ts-expect-error + chrome.system.storage.getAvailableCapacity(id, () => {}).then(() => {}); + + chrome.system.storage.getInfo(); // $ExpectType Promise + chrome.system.storage.getInfo((units) => { // $ExpectType void + units; // $ExpectType StorageUnitInfo[] + }); + // @ts-expect-error + chrome.system.storage.getInfo(() => {}).then(() => {}); + + checkChromeEvent(chrome.system.storage.onAttached, (info) => { + info.capacity; // $ExpectType number + info.id; // $ExpectType string + info.name; // $ExpectType string + info.type; // $ExpectType "fixed" | "removable" | "unknown" + }); + + checkChromeEvent(chrome.system.storage.onDetached, (id) => { + id; // $ExpectType string + }); } // https://developer.chrome.com/docs/extensions/reference/api/system/display diff --git a/types/dhtmlxscheduler/.eslintrc.json b/types/dhtmlxscheduler/.eslintrc.json deleted file mode 100644 index da61a149919e75..00000000000000 --- a/types/dhtmlxscheduler/.eslintrc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "rules": { - "@typescript-eslint/adjacent-overload-signatures": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - "@typescript-eslint/no-wrapper-object-types": "off" - } -} diff --git a/types/dhtmlxscheduler/dhtmlxscheduler-tests.ts b/types/dhtmlxscheduler/dhtmlxscheduler-tests.ts deleted file mode 100644 index 1eb237265601a6..00000000000000 --- a/types/dhtmlxscheduler/dhtmlxscheduler-tests.ts +++ /dev/null @@ -1,43 +0,0 @@ -// date operations -var start: Date = scheduler.date.week_start(new Date()); -var next: Date = scheduler.date.add(new Date(), 1, "week"); - -// hotkeys -scheduler.keys.edit_cancel = 13; - -// config options -scheduler.config.details_on_create = true; -scheduler.config.xml_date = "%m-%d-%Y"; -scheduler.xy.bar_height = 40; - -// templates -scheduler.templates.event_class = function(start: Date, end: Date, event: any) { - if (event.some) { - return "classA"; - } else { - return "classB"; - } -}; - -// locale -scheduler.locale.labels.week_tab = "7 days"; - -// API -scheduler.init("scheduler_here", start); -scheduler.load("/data/events"); - -// events -scheduler.attachEvent("onEmptyClick", function(ev?: Event) { - var date: Date = scheduler.getActionData(ev).date; -}); -// filters -scheduler.filter_week = (id: string, e: Event) => true; - -// enterprise version -var scheduler2 = Scheduler.getSchedulerInstance(); -scheduler2.addEvent({ some: 1 }); - -// map function for prev/next arrows -scheduler.date.add_map = function(date, inc) { - return scheduler.date.add(date, inc, "month"); -}; diff --git a/types/dhtmlxscheduler/index.d.ts b/types/dhtmlxscheduler/index.d.ts deleted file mode 100644 index 139bc8e39ac8c4..00000000000000 --- a/types/dhtmlxscheduler/index.d.ts +++ /dev/null @@ -1,1870 +0,0 @@ -interface SchedulerCallback { - (...args: any[]): any; -} -interface SchedulerFilterCallback { - (id: string | number, event: any): boolean; -} - -type SchedulerEventName = - | "onAfterEventDisplay" - | "onAfterFolderToggle" - | "onAfterLightbox" - | "onAfterSchedulerResize" - | "onBeforeCollapse" - | "onBeforeDrag" - | "onBeforeEventChanged" - | "onBeforeEventCreated" - | "onBeforeEventDelete" - | "onBeforeEventDisplay" - | "onBeforeEventDragIn" - | "onBeforeEventDragOut" - | "onBeforeExpand" - | "onBeforeExternalDragIn" - | "onBeforeFolderToggle" - | "onBeforeLightbox" - | "onBeforeSectionRender" - | "onBeforeTodayDisplayed" - | "onBeforeTooltip" - | "onBeforeViewChange" - | "onCellClick" - | "onCellDblClick" - | "onClearAll" - | "onClick" - | "onCollapse" - | "onConfirmedBeforeEventDelete" - | "onContextMenu" - | "onDblClick" - | "onDragEnd" - | "onEmptyClick" - | "onEventAdded" - | "onEventCancel" - | "onEventChanged" - | "onEventCollision" - | "onEventCopied" - | "onEventCreated" - | "onEventCut" - | "onEventDeleted" - | "onEventDrag" - | "onEventDragIn" - | "onEventDragOut" - | "onEventDropOut" - | "onEventIdChange" - | "onEventLoading" - | "onEventPasted" - | "onEventSave" - | "onExpand" - | "onExternalDragIn" - | "onLightbox" - | "onLightboxButton" - | "onLimitViolation" - | "onLoadError" - | "onLocationError" - | "onMouseDown" - | "onMouseMove" - | "onOptionsLoad" - | "onOptionsLoadFinal" - | "onOptionsLoadStart" - | "onSaveError" - | "onScaleAdd" - | "onScaleDblClick" - | "onSchedulerReady" - | "onSchedulerResize" - | "onTemplatesReady" - | "onTimelineCreated" - | "onViewChange" - | "onViewMoreClick" - | "onXLE" - | "onXLS" - | "onXScaleClick" - | "onXScaleDblClick" - | "onYScaleClick" - | "onYScaleDblClick"; - -interface SchedulerTemplates { - /** - * specifies the date in the header of the view - * @param start the start date of the view - * @param end the end date of the view - */ - agenda_date(start: Date, end: Date): string; - - /** - * specifies the text in the second column of the Agenda view - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param event the event object - */ - agenda_text(start: Date, end: Date, event: any): string; - - /** - * specifies the date in the first column of the Agenda view - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param event the event object - */ - agenda_time(start: Date, end: Date, event: any): string; - - /** - * specifies the format of dates that are set by means of API methods. Used to parse incoming dates - * @param date the date which needs formatting - */ - api_date(date: Date): string; - - /** - * specifies the format of the date in a cell - * @param date the cell's date - */ - calendar_date(date: Date): string; - - /** - * specifies the date in the header of the calendar - * @param date the date which needs formatting - */ - calendar_month(date: Date): string; - - /** - * specifies the day name in the week sub-header of the view - * @param date the date which needs formatting - */ - calendar_scale_date(date: Date): string; - - /** - * specifies the date format of the lightbox's start and end date inputs - * @param date the date which needs formatting - */ - calendar_time(date: Date): string; - - /** - * specifies the date in the header of the Day and Units views - * @param date the date which needs formatting - */ - day_date(date: Date): string; - - /** - * specifies the date in the sub-header of the Day view - * @param date the date which needs formatting - */ - day_scale_date(date: Date): string; - - /** - * specifies the CSS class that will be applied to the highlighted event's duration on the time scale - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param ev the event's object - */ - drag_marker_class(start: Date, end: Date, ev: any): void; - - /** - * specifies the content of the highlighted block on the time scale - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param ev the event's object - */ - drag_marker_content(start: Date, end: Date, ev: any): void; - - /** - * specifies the date of an event. Applied to one-day events only - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param event the event object - */ - event_bar_date(start: Date, end: Date, event: any): string; - - /** - * specifies the event's text. Applied to multi-day events only - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param event the event's object - */ - event_bar_text(start: Date, end: Date, event: any): string; - - /** - * specifies the CSS class that will be applied to the event's container - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param ev the event's object - */ - event_class(start: Date, end: Date, ev: any): string; - - /** - * specifies the time part of the start and end dates of the event. Mostly used by other templates for presenting time periods - * @param date the date which needs formatting - */ - event_date(date: Date): string; - - /** - * specifies the event's header - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param event the event's object - */ - event_header(start: Date, end: Date, event: any): string; - - /** - * specifies the event's text - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param event the event object - */ - event_text(start: Date, end: Date, event: any): string; - - /** - * specifies the items of the Y-Axis - * @param date the date which needs formatting - */ - hour_scale(date: Date): string; - - /** - * specifies the format of requests in the dynamic loading mode - * @param date the date which needs formatting - */ - load_format(date: Date): string; - - /** - * specifies the date in the header of the view - * @param start the start date of the view - * @param end the end date of the view - */ - map_date(start: Date, end: Date): string; - - /** - * specifies the text in the second column of the view - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param event the event object - */ - map_text(start: Date, end: Date, event: any): string; - - /** - * specifies the date in the first column of the view - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param event the event object - */ - map_time(start: Date, end: Date, event: any): string; - - /** - * specifies the date of the event in the Google Maps popup marker - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param event the event object - */ - marker_date(start: Date, end: Date, event: any): string; - - /** - * specifies the text of the event in the Google Maps popup marker - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param event the event object - */ - marker_text(start: Date, end: Date, event: any): string; - - /** - * specifies the date in the header of the view - * @param date the date which needs formatting - */ - month_date(date: Date): string; - - /** - * specifies the CSS class that will be applied to a day cell - * @param date the date which needs formatting - */ - month_date_class(date: Date): string; - - /** - * specifies the format of the day in a cell - * @param date the date which needs formatting - */ - month_day(date: Date): string; - - /** - * specifies the presentation of the 'View more' link in the cell of the Month view - * @param date the date of a month cell - * @param count the number of events in the cell - */ - month_events_link(date: Date, count: number): string; - - /** - * specifies the date format of the X-Axis of the view - * @param date the date which needs formatting - */ - month_scale_date(date: Date): string; - - /** - * specifies the content of the pop-up edit form - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param event the event object - */ - quick_info_content(start: Date, end: Date, event: any): string; - - /** - * specifies the date of the pop-up edit form - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param event the event object - */ - quick_info_date(start: Date, end: Date, event: any): string; - - /** - * specifies the title of the pop-up edit form - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param event the event object - */ - quick_info_title(start: Date, end: Date, event: any): string; - - /** - * specifies the date string before events parse and load methods - * @param start the date string before assigned to event - */ - parse_date(date: string): string; - - /** - * specifies the drop-down time selector in the lightbox - */ - time_picker(): string; - - /** - * specifies the format of start and end dates displayed in the tooltip - * @param date the date which needs formatting - */ - tooltip_date_format(date: Date): string; - - /** - * specifies the text of tooltips - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param event the event object - */ - tooltip_text(start: Date, end: Date, event: any): string; - - /** - * specifies the event's text - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param event the event object - * @param cellDate the date of a day cell that a one-day event or a single occurrence of
the recurring event displays in - * @param pos the position of a single occurrence in the recurring event: 'start' - the first occurrence, 'end' - the last occurrence, 'middle' - for remaining occurrences - */ - week_agenda_event_text(start: Date, end: Date, event: any, cellDate: Date, pos: string): string; - - /** - * the date of a day cell of the view - * @param date the date which needs formatting - */ - week_agenda_scale_date(date: Date): string; - - /** - * specifies the date in the header of the view - * @param start the start date of the view - * @param end the end date of the view - */ - week_date(start: Date, end: Date): string; - - /** - * specifies the CSS class that will be applied to a day cell - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param event the event object - */ - week_date_class(start: Date, end: Date, event: any): string; - - /** - * specifies the date in the sub-header of the view - * @param date the date which needs formatting - */ - week_scale_date(date: Date): string; - - /** - * a string from an XML file is converted into a date object in conformity with this template - * @param date the string which need to be parsed - */ - xml_date(date: Date): Date; - - /** - * a date object is converted into a string in conformity with this template. Used to send data back to the server - * @param date the date which needs formatting - */ - xml_format(date: Date): string; - - /** - * specifies the date in the header of the view - * @param date the date which needs formatting - */ - year_date(date: Date): string; - - /** - * specifies the month's name in the header of a month block of the view. - * @param date the date which needs formatting - */ - year_month(date: Date): string; - - /** - * specifies the day's name in the sub-header of a month block of the view - * @param date the date which needs formatting - */ - year_scale_date(date: Date): string; - - /** - * specifies the tooltip over a day cell containing some scheduled event(s) - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param event the event object - */ - year_tooltip(start: Date, end: Date, event: any): string; - - /** - * specifies the lightbox's header - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param event the event object - */ - lightbox_header(start: Date, end: Date, event: any): string; - - /** - * specifies the date in the header of the view - * @param start the start date of the view - * @param end the end date of the view - */ - grid_date(start: Date, end: Date): string; - - /** - * specifies the format of dates in columns with id='date' - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param ev the event object - */ - grid_full_date(start: Date, end: Date, ev: any): string; - - /** - * specifies the format of dates in columns with id='start_date' or id='end_date' - * @param date the date which needs formatting - */ - grid_single_date(date: Date): string; - - /** - * specifies the text in the columns - * @param field_name the column's id - * @param event the event object - */ - grid_field(field_name: string, event: any): string; - - /** - * specifies the number of scheduled events in a cell of the view - * @param evs an array of objects of events contained in a cell - * @param date the date of a cell - */ - timeline_cell_value(evs: any[], date: Date): string; - - /** - * specifies the CSS class that will be applied to a cell of the view - * @param evs an array of objects of events contained in a cell (defined only in the 'cell' mode) - * @param date the date of a column - * @param section the section object - */ - timeline_cell_class(evs: any[], date: Date, section: any): string; - - /** - * specifies the name of a CSS class that will be applied to items of the X-Axis - * @param date the date which needs formatting - */ - timeline_scalex_class(date: Date): string; - - /** - * specifies the name of a CSS class that will be applied to items of the second X-Axis - * @param date the date which needs formatting - */ - timeline_second_scalex_class(date: Date): string; - - /** - * specifies the name of a CSS class that will be applied to items of the Y-Axis - * @param key the section's id - * @param label the section's label - * @param section the section object that contains the 'key' and 'label' properties - */ - timeline_scaley_class(key: string, label: string, section: any): string; - - /** - * specifies items of the Y-Axis - * @param key the section's id (key) - * @param label the section's label - * @param section the section object containing the 'key' and 'label' properties - */ - timeline_scale_label(key: string, label: string, section: any): string; - - /** - * specifies the tooltip over a day cell containing some scheduled event(s) - * @param start the date when an event is scheduled to begin - * @param end the date when an event is scheduled to be completed - * @param event the event object - */ - timeline_tooltip(start: Date, end: Date, event: any): string; - - /** - * specifies the date in the header of the view - * @param date1 the date when an event is scheduled to begin - * @param date2 the date when an event is scheduled to be completed - */ - timeline_date(date1: Date, date2: Date): string; - - /** - * specifies items of the X-Axis - * @param date the date which needs formatting - */ - timeline_scale_date(date: Date): string; - - /** - * specifies items of the second X-Axis - * @param date the date which needs formatting - */ - timeline_second_scale_date(date: Date): string; - - /** - * specifies the date in the header of the view - * @param date the date which needs formatting - */ - units_date(date: Date): string; - - /** - * specifies items of the X-Axis - * @param key the unit's id (key) - * @param label the unit's label - * @param unit the unit object containing the 'key' and 'label' properties - */ - units_scale_text(key: string, label: string, unit: any): string; -} - -interface SchedulerConfigOptions { - /** - * 'says' to present the numbers of days in the Month view as clickable links that open the related day in the specified view - */ - active_link_view: string; - - /** - * sets the date to display events until - */ - agenda_end: Date; - - /** - * sets the date to start displaying events from - */ - agenda_start: Date; - - /** - * specifies how to display the default error notification in case the XML data loading failed - */ - ajax_error: string | boolean; - - /** - * 'says' to show multi-day events in the regular way (as one-day events are displayed) - */ - all_timed: boolean | string; - - /** - * sets the date format that will be used by the addEvent() method to parse the start_date, end_date properties in case they are specified as strings - */ - api_date: string; - - /** - * enables automatic changing of the end event date after changing the start date - */ - auto_end_date: boolean; - - /** - * stores a collection of buttons resided in the left bottom corner of the lightbox - */ - buttons_left: any[]; - - /** - * stores a collection of buttons resided in the right bottom corner of the lightbox - */ - buttons_right: any[]; - - /** - * sets the maximum number of events in a cascade - */ - cascade_event_count: number; - - /** - * sets the 'cascade' display mode - */ - cascade_event_display: boolean; - - /** - * sets the left margin for a cascade of events - */ - cascade_event_margin: number; - - /** - * activates/disables checking of limits - */ - check_limits: boolean; - - /** - * sets the maximum allowable number of events per time slot - */ - collision_limit: number; - - /** - * forces the scheduler container to automatically change its size to show the whole content without scrolling - */ - container_autoresize: boolean; - - /** - * sets the date format for the X-Axis of the Week and Units views - */ - day_date: string; - - /** - * enables the possibility to create events by double click - */ - dblclick_create: boolean; - - /** - * sets the date format used by the templates 'day_date', 'week_date', 'day_scale_date' for setting date in the views' headers - */ - default_date: string; - - /** - * sets a timeout (in milliseconds) that wraps the api/scheduler_updateview.md and api/scheduler_setcurrentview.md calls ( that cause re-drawing of the scheduler ) - */ - delay_render: number; - - /** - * 'says' to use the extended form while creating new events by drag or double click - */ - details_on_create: boolean; - - /** - * 'says' to open the lightbox after double clicking on an event - */ - details_on_dblclick: boolean; - - /** - * defines whether the marked(blocked) time spans should be highlighted in the scheduler - */ - display_marked_timespans: boolean; - - /** - * sets the default background color for the events retrieved by the showEvent() method - */ - displayed_event_color: string; - - /** - * sets the default font color for the events retrieved by the showEvent() method - */ - displayed_event_text_color: string; - - /** - * enables the possibility to create new events by drag-and-drop - */ - drag_create: boolean; - - /** - * highlights the event's duration on the time scale when you drags an event over the scheduler - */ - drag_highlight: boolean; - - /** - * restrict dragging events to the calling scheduler from any other scheduler(s) - */ - drag_in: boolean; - - /** - * enables the possibility to drag the lightbox by the header - */ - drag_lightbox: boolean; - - /** - * enables the possibility to move events by drag-and-drop - */ - drag_move: boolean; - - /** - * restrict dragging events from the calling scheduler to any other scheduler(s) - */ - drag_out: boolean; - - /** - * enables the possibility to resize events by drag-and-drop - */ - drag_resize: boolean; - - /** - * 'says' to open the lightbox while creating new events - */ - edit_on_create: boolean; - - /** - * sets the initial duration of events in minutes - */ - event_duration: number; - - /** - * sets the minimum value for the hour scale (Y-Axis) - */ - first_hour: number; - - /** - * moves views' tabs from the left to the right side - */ - fix_tab_position: boolean; - - /** - * enables setting of the event's duration to the full day - */ - full_day: boolean; - - /** - * specifies whether events retrieved by the showEvent method should be highlighted while displaying - */ - highlight_displayed_event: boolean; - - /** - * sets the time format of Y-Axis. Also used in the default event and lighbox templates for setting the time part. - */ - hour_date: string; - - /** - * sets the height of an hour unit in pixels - */ - hour_size_px: number; - - /** - * stores a collection of icons visible in the side edit menu of the event's box - */ - icons_edit: any[]; - - /** - * stores a collection of icons visible in the side selection menu of the event's box - */ - icons_select: any[]; - - /** - * defines whether the date specified in the 'End by' field should be exclusive or inclusive - */ - include_end_by: boolean; - - /** - * disables the keyboard navigation in the scheduler - */ - key_nav: boolean; - - /** - * sets the maximum value of the hour scale (Y-Axis) - */ - last_hour: number; - - /** - * adds the dotted left border to the scheduler - */ - left_border: boolean; - - /** - * specifies the lightbox object - */ - lightbox: any; - - /** - * defines the lightbox's behavior, when the user opens the lightbox to edit a recurring event - */ - lightbox_recurring: string; - - /** - * denies to drag events out of the visible area of the scheduler - */ - limit_drag_out: boolean; - - /** - * sets the right border of the allowable date range - */ - limit_end: Date; - - /** - * sets the left border of the allowable date range - */ - limit_start: Date; - - /** - * sets the max and min values of the time selector in the lightbox to the values of the 'last_hour' and 'first_hour' options - */ - limit_time_select: boolean; - - /** - * limits the date period during which the user can view the events - */ - limit_view: boolean; - - /** - * sets the format of server request parameters 'from', 'to' in case of dynamic loading - */ - load_date: string; - - /** - * sets the date to display events until - */ - map_end: Date; - - /** - * sets the position that will be displayed on the map in case the event's location can't be identified - */ - map_error_position: any; - - /** - * the maximum width of the Google Maps's popup marker in the Map view - */ - map_infowindow_max_width: number; - - /** - * sets the initial position of the map - */ - map_initial_position: any; - - /** - * sets the initial zoom of Google Maps in the Map view - */ - map_initial_zoom: number; - - /** - * activates attempts to resolve the event's location, if the database doesn't have the event's coordinates stored - */ - map_resolve_event_location: boolean; - - /** - * enables/disables prompts asking the user to share their location for displaying on the map - */ - map_resolve_user_location: boolean; - - /** - * sets the date to start displaying events from - */ - map_start: Date; - - /** - * sets the type of Google Maps - */ - map_type: any; - - /** - * sets the zoom that will be used to show the user's location, if the user agrees to the browser's offer to show it - */ - map_zoom_after_resolve: number; - - /** - * enables/disables the marker displaying the current time - */ - mark_now: boolean; - - /** - * sets the maximum number of events displayable in a cell - */ - max_month_events: number; - - /** - * specifies the mini calendar object - */ - minicalendar: any; - - /** - * sets the format for the header of the Month view - */ - month_date: string; - - /** - * sets the format for the day in the cells of the Month and Year views - */ - month_day: string; - - /** - * sets the minimum height of cells in the Month view - */ - month_day_min_height: number; - - /** - * enables rendering of multi-day events - */ - multi_day: boolean; - - /** - * sets the height of the area that displays multi-day events - */ - multi_day_height_limit: number | boolean; - - /** - * enables the possibility to render the same events in several sections of the Timeline or Units view - */ - multisection: boolean; - - /** - * specifies whether while dragging events that assigned to several sections of the Timeline or Units view, all instances should be dragged at once ('true') or just the selected one ('false') - */ - multisection_shift_all: boolean; - - /** - * sets the date for the current-time marker in the Limit extension (enabled by the configuration - mark_now) - */ - now_date: Date; - - /** - * allows working with recurring events independently of time zones - */ - occurrence_timestamp_in_utc: boolean; - - /** - * defines the 'saving' behaviour for the case, when the user edits the event's text directly in the event's box - */ - positive_closing: boolean; - - /** - * preserves the visible length of an event while dragging along a non-linear time scale - */ - preserve_length: boolean; - - /** - * cancels preserving of the current scroll position while navigating between dates of the same view - */ - preserve_scroll: boolean; - - /** - * enables/disables caching of GET requests in the browser - */ - prevent_cache: boolean; - - /** - * defines whether the event form will appear from the left/right side of the screen or near the selected event - */ - quick_info_detached: boolean; - - /** - * activates the read-only mode for the scheduler - */ - readonly: boolean; - - /** - * activates the read-only mode for the lightbox - */ - readonly_form: boolean; - - /** - * specifies working days that will affect the recurring event when the user selects the ""Every workday" option in the lightbox - */ - recurring_workdays: any[]; - - /** - * sets the date format of the 'End by' field in the 'recurring' lightbox - */ - repeat_date: string; - - /** - * prevents including past days to events with the 'weekly' recurrence - */ - repeat_precise: boolean; - - /** - * enables the possibility to resize multi-day events in the Month view by drag-and-drop - */ - resize_month_events: boolean; - - /** - * enables the possibility to resize single-day events in the Month view by drag-n-drop - */ - resize_month_timed: boolean; - - /** - * sets the initial position of the vertical scroll in the scheduler (an hour in the 24-hour clock format) - */ - scroll_hour: number; - - /** - * specifies the delimeter that will be used to separate several sections/units in the related data property of the event - */ - section_delemiter: string; - - /** - * shows/hides the select bar in the event's box - */ - select: boolean; - - /** - * allows preventing short events from overlapping - */ - separate_short_events: boolean; - - /** - * enables converting server-side dates from UTC to a local time zone (and backward) while sending data to the server - */ - server_utc: boolean; - - /** - * enables showing a progress/spinner while data is loading (useful for dynamic loading) - */ - show_loading: boolean; - - /** - * activates/disables the 'quick_info' extension (pop-up task's details form) - */ - show_quick_info: boolean; - - /** - * sets the start day of weeks - */ - start_on_monday: boolean; - - /** - * sets the minimum step (in minutes) for event's time values - */ - time_step: number; - - /** - * enables/disables the touch support in the scheduler - */ - touch: boolean | string; - - /** - * defines the time period in milliseconds that is used to differ the long touch gesture from the scroll gesture - */ - touch_drag: number | boolean; - - /** - * enables/disables prompting messages in the right top corner of the screen - */ - touch_tip: boolean; - - /** - * disables dhtmxlScheduler's tooltips on the touch devices - */ - touch_tooltip: boolean; - - /** - * updates the mode when the scheduler fully repaints itself on any action - */ - update_render: boolean; - - /** - * 'says' events to occupy the whole width of the cell - */ - use_select_menu_space: boolean; - - /** - * sets the format of the date in the sub-header of the Month view - */ - week_date: string; - - /** - * enables/disables displaying the standard (wide) lightbox instead of the short one - */ - wide_form: boolean; - - /** - * sets the date format that is used to parse data from the data set - */ - xml_date: string; - - /** - * sets the number of rows in the Year view - */ - year_x: number; - - /** - * sets the number of columns in the Year view - */ - year_y: number; -} - -interface SchedulerDateHelpers { - add(origin: Date, count: number, unit: string): Date; - add_map(origin: Date, count: number): Date; - copy(origin: Date): Date; - - date_part(origin: Date): Date; - time_part(origin: Date): Date; - - day_start(origin: Date): Date; - month_start(origin: Date): Date; - week_start(origin: Date): Date; - year_start(origin: Date): Date; - - getISOWeek(origin: Date): number; - getUTCISOWeek(origin: Date): number; - - date_to_str(format: string): any; - str_to_date(format: string): any; - convert_to_utc(origin: Date): Date; - to_fixed(value: number): string; -} - -interface SchedulerHotkeys { - edit_save: number; - edit_cancel: number; -} - -interface SchedulerLocaleDate { - month_full: string[]; - month_short: string[]; - day_full: string[]; - day_short: string[]; -} - -interface SchedulerLocaleLabels { - dhx_cal_today_button: string; - day_tab: string; - week_tab: string; - month_tab: string; - new_event: string; - icon_save: string; - icon_cancel: string; - icon_details: string; - icon_edit: string; - icon_delete: string; - confirm_closing: string; - confirm_deleting: string; - section_description: string; - section_time: string; - unit_tab: string; -} - -interface SchedulerLocale { - date: SchedulerLocaleDate; - labels: SchedulerLocaleLabels; -} - -interface SchedulerSizes { - /** - * the height of day cells in the month view - */ - bar_height: number; - - /** - * the width of the event text input 140 day - */ - editor_width: number; - - /** - * increases the length of the lightbox - */ - lightbox_additional_height: number; - - /** - * the width of the date column in the Map view - */ - map_date_width: number; - - /** - * the width of the description column in the Map view - */ - map_description_width: number; - - /** - * the left margin of the main scheduler area - */ - margin_left: number; - - /** - * the bottom margin of the main scheduler area - */ - margin_top: number; - - /** - * the width of the selection menu - */ - menu_width: number; - - /** - * the minimal height of the event box - */ - min_event_height: number; - - /** - * the top offset of an event in a cell in the month view - */ - month_scale_height: number; - - /** - * the height of the navigation bar - */ - nav_height: number; - - /** - * the height of the X-Axis - */ - scale_height: number; - - /** - * the width of the Y-Axis - */ - scale_width: number; - - /** - * the width of the scrollbar area - */ - scroll_width: number; -} - -interface SchedulerEnterprise { - /** - * Creates a new instance of Scheduler - */ - getSchedulerInstance(): SchedulerStatic; -} - -interface SchedulerStatic { - templates: SchedulerTemplates; - config: SchedulerConfigOptions; - date: SchedulerDateHelpers; - keys: SchedulerHotkeys; - skin: String; - version: String; - xy: SchedulerSizes; - locale: SchedulerLocale; - - /** - * filter events that will be displayed on the day view - */ - filter_day: SchedulerFilterCallback; - - /** - * filter events that will be displayed on the week view - */ - filter_week: SchedulerFilterCallback; - - /** - * filter events that will be displayed on the month view - */ - filter_month: SchedulerFilterCallback; - - /** - * filter events that will be displayed on the year view - */ - filter_year: SchedulerFilterCallback; - - /** - * filter events that will be displayed on the agenda view - */ - filter_agenda: SchedulerFilterCallback; - - /** - * filter events that will be displayed on the timeline view - */ - filter_timeline: SchedulerFilterCallback; - - /** - * filter events that will be displayed on the units view - */ - filter_units: SchedulerFilterCallback; - - /** - * filter events that will be displayed on the grid view - */ - filter_grid: SchedulerFilterCallback; - - /** - * removes all blocking sets from the scheduler - */ - deleteMarkedTimespan(); - - /** - * removes marking/blocking set by the addMarkedTimespan() and blockTime() methods - * @param configuration for deleting - */ - deleteMarkedTimespan(config: any); - - /** - * adds a new event - * @param event the event object - */ - addEvent(event: any): string; - - /** - * adds a new event and opens the lightbox to confirm - * @param event the event object - */ - addEventNow(event: any): string; - - /** - * marks dates, but with certain settings makes blocking (unlike blockTime() allows setting custom styling for the limit) - * @param config the configuration object of the timespan to mark/block - */ - addMarkedTimespan(config: any): number; - - /** - * adds a new keyboard shortcut - * @param shortcut the key name or the name of keys combination for a shortcut (shortcut syntax) - * @param handler the handler of the shortcut call - * @param scope the name of the context element to attach the handler function to (list of scopes) - */ - addShortcut(shortcut: string, handler: () => void, scope?: any): void; - - /** - * adds a section to the currently active view (if the opened view isn't Timeline in the 'Tree' mode - the method will be ignored) - * @param section the object of the section to add - * @param parent_id the id of the parent section. Pass 'null' if you are adding a section to the root - */ - addSection(section: any, parent_id: string): boolean; - - /** - * attaches the handler to an inner event of dhtmlxScheduler - * @param name the event's name, case-insensitive - * @param handler the handler function - */ - attachEvent(name: SchedulerEventName, handler: SchedulerCallback): string; - - /** - * makes the scheduler reflect all data changes in the Backbone model and vice versa - * @param events the Backbone data collection - */ - backbone(events: any): void; - - /** - * blocks the specified date and applies the default 'dimmed' style to it. - * @param date a date to block ( if a number is provided, the parameter will be treated as a week
day: '0' index refers to Sunday,'6' - to Saturday ) - * @param time_points an array [start_minute,end_minute,..,start_minute_N,end_minute_N],
where each pair sets a certain limit range. The array can have any number of
such pairs - * @param items defines specific items of view(s) to block - */ - blockTime(date: Date | number, time_points: any[], items?: any): void; - - /** - * calls an inner event - * @param name the event's name, case-insensitive - * @param params an array of the event-related data - */ - callEvent(name: string, params: any[]): boolean; - - /** - * changes the event's id - * @param id the current event's id - * @param new_id the new event's id - */ - changeEventId(id: string, new_id: string): void; - - /** - * checks whether the specified event occurs at the time that has already been occupied by another event(s) - * @param event the event object - */ - checkCollision(event: any): boolean; - - /** - * checks whether an event has some handler(s) specified - * @param name the event's name - */ - checkEvent(name: SchedulerEventName): boolean; - - /** - * checks whether an event resides in a timespan of a specific type - * @param event the event object - * @param timespan the timespan's type - */ - checkInMarkedTimespan(event: any, timespan: string): boolean; - - /** - * checks whether the specified event takes place at the blocked time period - * @param event the event object - */ - checkLimitViolation(event: any): boolean; - - /** - * removes all events from the scheduler - */ - clearAll(): void; - - /** - * closes all sections in the currently active view (if the opened view isn't Timeline in the 'Tree' mode - the method will be ignored) - */ - closeAllSections(): void; - - /** - * closes the specified section in the currently active view (if the opened view isn't Timeline in the 'Tree' mode - the method will be ignored) - * @param section_id the section's id - */ - closeSection(section_id: string): void; - - /** - * collapses the expanded scheduler back to the normal size - */ - collapse(): void; - - /** - * creates the Grid view in the scheduler - * @param config the configuration object of the Grid view - */ - createGridView(config: any): void; - - /** - * creates the Timeline view in the scheduler - * @param config the configuration object of the Timeline view - */ - createTimelineView(config: any): void; - - /** - * creates the Units view in the scheduler - * @param config the configuration object of the Units view - */ - createUnitsView(config: any): void; - - /** - * deletes all sections from the currently active view (if the opened view isn't Timeline in the 'Tree' mode - the method will be ignored) - */ - deleteAllSections(): void; - - /** - * deletes the specified event - * @param id the event's id - */ - deleteEvent(id: string | number): void; - - /** - * removes marking/blocking set by the addMarkedTimespan() and blockTime() methods - * @param id the timespan's id - */ - deleteMarkedTimespan(id: string): void; - - /** - * deletes a section from the currently active view (if the opened view isn't Timeline in the 'Tree' mode - the method will be ignored) - * @param section_id the section's id - */ - deleteSection(section_id: string): boolean; - - /** - * destroys previously created mini-calendar - * @param name the mini-calendar's object (if not specified, the scheduler attempts
to destroy the last created mini calendar) - */ - destroyCalendar(name?: any): void; - - /** - * detaches a handler from an event (which was attached before by the attachEvent method) - * @param id the event's id - */ - detachEvent(id: string): void; - - /** - * opens the inline editor to alter the event's text (the editor in the event's box) - * @param id the event's id - */ - edit(id: string): void; - - /** - * closes the inline event editor, if it's currently open - * @param id the event's id - */ - editStop(id: string): void; - - /** - * closes the lightbox - * @param mode if set to true, the changes, made in the lightbox, will be saved before closing.
If - false, the changes will be cancelled. - * @param box the HTML container for the lightbox - */ - endLightbox(mode: boolean, box?: HTMLElement): void; - - /** - * expands the scheduler to the full screen view - */ - expand(): void; - - /** - * gives access to the objects of lightbox's sections - * @param name the name of a lightbox section - */ - formSection(name: string): any; - - /** - * returns the current cursor-pointed date and section (if defined) - * @param e a native event object - */ - getActionData(e: Event): any; - - /** - * returns the event object by its id - * @param event_id the event's id - */ - getEvent(event_id: string | number): any; - - /** - * gets the event's end date - * @param id the event's id - */ - getEventEndDate(id: string | number): Date; - - /** - * gets the event's start date - * @param id the event's id - */ - getEventStartDate(id: string | number): Date; - - /** - * gets the event's text - * @param id the event's id - */ - getEventText(id: string | number): string; - - /** - * returns a collection of events which occur during the specified period - * @param from the start date of the period - * @param to the end date of the period - */ - getEvents(from?: Date, to?: Date): any; - - /** - * gets the label of a select control in the lightbox - * @param property the name of a data property that the control is mapped to - * @param key the option's id. This parameter is compared with the event's data property
to assign the select's option to an event - */ - getLabel(property: string, key: string | number): any; - - /** - * gets the lightbox's HTML object element - */ - getLightbox(): HTMLElement; - - /** - * returns all occurrences of a recurring event - * @param id the id of a recurring event - * @param number the maximum number of occurrences to return (by default, 100) - */ - getRecDates(id: string, number: number): any; - - /** - * gets the object of the currently displayed event - * @param id the event's id - */ - getRenderedEvent(id: string): HTMLElement; - - /** - * gets the object of the specified section in the currently active view (if the opened view isn't Timeline in the 'Tree' mode - the method will be ignored) - * @param section_id the section's id - */ - getSection(section_id: string): any; - - /** - * gets the current state of the scheduler - */ - getState(): any; - - /** - * gets the user data associated with the specified event - * @param id the event's id - * @param name the user data name - */ - getUserData(id: string, name: string): any; - - /** - * hides the lightbox modal overlay that blocks interactions with the remaining screen - * @param box an element to hide - */ - hideCover(box?: HTMLElement): void; - - /** - * hides the pop-up event form (if it's currently active) - */ - hideQuickInfo(): void; - - /** - * highlights the event's duration on the time scale - * @param event the event object - */ - highlightEventPosition(event: any): void; - - /** - * constructor. Initializes a dhtmlxScheduler object - * @param container an HTML container ( or its id) where a dhtmlxScheduler object will be initialized - * @param date the initial date of the scheduler (by default, the current date) - * @param view the name of the initial view (by default, "week") - */ - init(container: string | HTMLElement, date?: Date, view?: string): void; - - /** - * inverts the specified time zones - * @param zones an array **[start_minute,end_minute,..,start_minute_N,end_minute_N]**
where each pair sets a certain limit range (in minutes). The array can have any
number of such pairs - */ - invertZones(zones: any[]): void; - - /** - * checks whether the calendar is currently opened in the scheduler - */ - isCalendarVisible(): boolean | HTMLElement; - - /** - * checks whether the specified event one-day or multi-day - * @param event the event object - */ - isOneDayEvent(event: any): boolean; - - /** - * checks whether a view with the specified name exists - * @param name the view name - */ - isViewExists(name: string): boolean; - - /** - * 'says' to change the active date in the mini calendar each time, the active date in the scheduler is changed - * @param calendar the mini calendar object - * @param shift a function that defines the difference between active dates in the mini-calendar
and the scheduler. The function takes the scheduler's date as a parameter and
returns the date that should be displayed in the mini calendar - */ - linkCalendar(calendar: any, shift: SchedulerCallback): void; - - /** - * loads data to the scheduler from an external data source - * @param url the server side url (may be a static file or a server side script which outputs data
as XML) - * @param type ('json', 'xml', 'ical') the data type. The default value - 'xml' - * @param callback the callback function - */ - load(url: string, type?: string, callback?: SchedulerCallback): void; - - /** - * applies a css class to the specified date - * @param calendar the calendar object - * @param date the date to mark - * @param css the name of a css class - */ - markCalendar(calendar: any, date: Date, css: string): void; - - /** - * marks and/or blocks date(s) by applying the default or a custom style to them. Marking is cancelled right after any internal update in the app. Can be used for highlighting - * @param config the configuration object of the timespan to mark/block - */ - markTimespan(config: any): void; - - /** - * opens all sections in the currently active view (if the opened view isn't Timeline in the 'Tree' mode - the method will be ignored) - */ - openAllSections(): void; - - /** - * opens the specified section in the currently active view (if the opened view isn't Timeline in the 'Tree' mode - the method will be ignored) - * @param section_id the section's id - */ - openSection(section_id: string): void; - - /** - * loads data from a client-side resource - * @param data a string or object which represents data - * @param type ('json', 'xml', 'ical') the data type. The default value - 'xml' - */ - parse(data: any, type?: string): void; - - /** - * removes a keyboard shortcut - * @param shortcut the key name or the name of keys combination for a shortcut (shortcut syntax) - * @param scope the element to which the shortcut is attached (list of scopes) - */ - removeShortcut(shortcut: string, scope: any): void; - - /** - * creates a mini calendar - * @param config the calendar configuration object - */ - renderCalendar(config: any): void; - - /** - * generates HTML content for a custom event's box - * @param container the event container - * @param event the event object - */ - renderEvent(container: HTMLElement, event: any): boolean; - - /** - * removes the current lightbox's HTML object element - */ - resetLightbox(): void; - - /** - * scrolls the specified number of units in the Units view - * @param step the number of units to scroll (set the positive value to scroll units to the right
side, the negative value - to the left side
). - */ - scrollUnit(step: number): void; - - /** - * selects the specified event - * @param id the event's id - */ - select(id: string): void; - - /** - * returns a list of options - * @param list_name the name of a list - * @param options an array of options - */ - serverList(list_name: string, options?: any[]): void; - - /** - * displays the specified view and date - * @param date the date to display - * @param view the name of a view to display - */ - setCurrentView(date?: Date, view?: string): void; - - /** - * adds a new event to the scheduler's data pool - * @param id the event's id - * @param event the event object - */ - setEvent(id: string | number, event: any): void; - - /** - * sets the event's end date - * @param id the event's id - * @param date the new end date of the event - */ - setEventEndDate(id: string, date: Date): void; - - /** - * sets the event's start date - * @param id the event's id - * @param date the new start date of the event - */ - setEventStartDate(id: string, date: Date): void; - - /** - * sets the event's text - * @param id the event's id - * @param text the new text of the event - */ - setEventText(id: string, text: string): void; - - /** - * forces the lightbox to resize - */ - setLightboxSize(): void; - - /** - * sets the mode that allows loading data by parts (enables the dynamic loading) - * @param mode the loading mode - */ - setLoadMode(mode: string): void; - - /** - * sets the user data associated with the specified event - * @param id the event's id - * @param name the user data name - * @param value the user data value - */ - setUserData(id: string, name: string, value: any): void; - - /** - * shows the lightbox modal overlay that blocks interactions with the remaining screen - * @param box an element to hide - */ - showCover(box?: HTMLElement): void; - - /** - * shows and highlights the specified event in the current or specified view - * @param id the event's id - * @param view the view name - */ - showEvent(id: string, view?: string): void; - - /** - * opens the lightbox for the specified event - * @param id the event's id - */ - showLightbox(id: string): void; - - /** - * displays the pop-up event form for the specified event - * @param id the event's id - */ - showQuickInfo(id: string): void; - - /** - * shows a custom lightbox in the specified HTML container centered on the screen - * @param id the event's id - * @param box the lightbox's HTML container - */ - startLightbox(id: string, box: HTMLElement): void; - - /** - * converts scheduler's data to the ICal format - * @param header sets the value for the content's header field - */ - toICal(header?: string): string; - - /** - * converts scheduler's data into the JSON format - */ - toJSON(): string; - - /** - * exports the current view to a PDF document (can be used for printing) - * @param url the path to the server-side PDF converter - * @param mode the color map of the resulting PDF document - */ - toPDF(url: string, mode?: string): void; - - /** - * exports several scheduler's views to a PDF document (can be used for printing) - * @param from the date to start export events from - * @param to the date to export events until - * @param view the name of a view that the export should be applied to - * @param path the path to the php file which generates a PDF file (details) - * @param color the color map in use - */ - toPDFRange(from: Date, to: Date, view: string, path: string, color: string): void; - - /** - * converts scheduler's data into the XML format - */ - toXML(): string; - - /** - * generates a unique ID (unique inside the current scheduler, not GUID) - */ - uid(): void; - - /** - * removes blocking set by the blockTime() method - * @param days (Date, number,array, string) days that should be limited - * @param zones the period in minutes that should be limited. Can be set to 'fullday' value
to limit the entire day - * @param sections allows blocking date(s) just for specific items of specific views. BTW, the specified date(s) will be blocked just in the related view(s) - */ - unblockTime(days: any, zones?: any[], sections?: any): void; - - /** - * removes a css class from the specified date - * @param calendar the mini calendar object - * @param date the date to unmark - * @param css the name of a css class to remove - */ - unmarkCalendar(calendar: any, date: Date, css: string): void; - - /** - * removes marking/blocking set by the markTimespan() method - * @param divs a timespan to remove marking/blocking from (or an array of timespans) - */ - unmarkTimespan(divs: HTMLElement | any[]): void; - - /** - * unselects the specified event - * @param id the event's id (if not specified, the currently selected event will be unselected) - */ - unselect(id?: string): void; - - /** - * displays the specified date in the mini calendar - * @param calendar the mini calendar object - * @param new_date a new date to display in the mini calendar - */ - updateCalendar(calendar: any, new_date: Date): void; - - /** - * updates the specified collection with new options - * @param collection the name of the collection to update - * @param options the new values of the collection - */ - updateCollection(collection: string, options: any[]): boolean; - - /** - * updates the specified event - * @param id the event's id - */ - updateEvent(id: string): void; - - /** - * displays the specified view and date (doesn't invoke any events) - * the function will just refresh the current view if invoked without parameters. - * @param date the date to set - * @param view the view name - */ - updateView(date?: Date, view?: string): void; -} - -declare var scheduler: SchedulerStatic; -declare var Scheduler: SchedulerEnterprise; diff --git a/types/dhtmlxscheduler/package.json b/types/dhtmlxscheduler/package.json deleted file mode 100644 index 7063edc6ecb24f..00000000000000 --- a/types/dhtmlxscheduler/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "private": true, - "name": "@types/dhtmlxscheduler", - "version": "4.3.9999", - "nonNpm": true, - "nonNpmDescription": "dhtmlxscheduler", - "projects": [ - "http://dhtmlx.com/docs/products/dhtmlxScheduler" - ], - "devDependencies": { - "@types/dhtmlxscheduler": "workspace:." - }, - "owners": [ - { - "name": "Maksim Kozhukh", - "githubUsername": "mkozhukh" - } - ] -} diff --git a/types/dom-speech-recognition/index.d.ts b/types/dom-speech-recognition/index.d.ts index f03791e03e43a8..d0192fc719c585 100644 --- a/types/dom-speech-recognition/index.d.ts +++ b/types/dom-speech-recognition/index.d.ts @@ -76,15 +76,15 @@ declare var SpeechRecognitionEvent: { }; // https://wicg.github.io/speech-api/#enumdef-speechrecognitionerrorcode -type SpeechRecognitionErrorCode = - | "aborted" - | "audio-capture" - | "bad-grammar" - | "language-not-supported" - | "network" - | "no-speech" - | "not-allowed" - | "service-not-allowed"; +// type SpeechRecognitionErrorCode = +// | "aborted" +// | "audio-capture" +// | "bad-grammar" +// | "language-not-supported" +// | "network" +// | "no-speech" +// | "not-allowed" +// | "service-not-allowed"; // https://wicg.github.io/speech-api/#dictdef-speechrecognitionerroreventinit interface SpeechRecognitionErrorEventInit extends EventInit { diff --git a/types/dom-speech-recognition/package.json b/types/dom-speech-recognition/package.json index c3d87de3868047..d3bfcb00103c53 100644 --- a/types/dom-speech-recognition/package.json +++ b/types/dom-speech-recognition/package.json @@ -7,6 +7,14 @@ "projects": [ "https://wicg.github.io/speech-api/" ], + "types": "index", + "typesVersions": { + "<=5.9": { + "*": [ + "ts5.9/*" + ] + } + }, "devDependencies": { "@types/dom-speech-recognition": "workspace:." }, diff --git a/types/dom-speech-recognition/ts5.9/dom-speech-recognition-tests.ts b/types/dom-speech-recognition/ts5.9/dom-speech-recognition-tests.ts new file mode 100644 index 00000000000000..8b6dd40f6dd9aa --- /dev/null +++ b/types/dom-speech-recognition/ts5.9/dom-speech-recognition-tests.ts @@ -0,0 +1,86 @@ +function eventMap(ev: Event, errorEv: SpeechRecognitionErrorEvent, srEvent: SpeechRecognitionEvent): void { + const speechRecognitionEventMap: SpeechRecognitionEventMap = { + audioend: ev, + audiostart: ev, + end: ev, + error: errorEv, + nomatch: srEvent, + result: srEvent, + soundend: ev, + soundstart: ev, + speechend: ev, + speechstart: ev, + start: ev, + }; +} + +const speechGrammar = new SpeechGrammar(); +const speechGrammar2: SpeechGrammar = { + src: "abc", + weight: 3, +}; + +const speechGrammarList = new SpeechGrammarList(); +const speechGrammarList2: SpeechGrammarList = { + length: 1, + addFromString: (string: string, weight?: number) => undefined, + addFromURI: (src: string, weight?: number) => undefined, + item: (index: number) => speechGrammar2, +}; +const speechGrammarList3 = new webkitSpeechGrammarList(); + +const speechRecognition = new SpeechRecognition(); +const speechRecognition2: SpeechRecognition = { + continuous: true, + grammars: speechGrammarList, + interimResults: false, + lang: "eng", + maxAlternatives: 2, + onaudioend: null, + onaudiostart: null, + onend: null, + onerror: null, + onnomatch: null, + onresult: null, + onsoundend: null, + onsoundstart: null, + onspeechend: null, + onspeechstart: null, + onstart: null, + abort: () => undefined, + start: () => undefined, + stop: () => undefined, + dispatchEvent: (ev: Event) => true, + addEventListener: ( + type: string, + listener: EventListenerOrEventListenerObject, + options?: boolean | EventListenerOptions, + ) => undefined, + removeEventListener: ( + type: string, + listener: EventListenerOrEventListenerObject, + options?: boolean | EventListenerOptions, + ) => undefined, +}; +const speechRecognition3 = new webkitSpeechRecognition(); + +const speechRecognition4: SpeechRecognition = { + ...speechRecognition2, + start: (audioTrack: MediaStreamTrack) => undefined, +}; + +const speechRecognitionResultList = new SpeechRecognitionResultList(); + +const speechRecognitionEventInit: SpeechRecognitionEventInit = { + resultIndex: 5, + results: speechRecognitionResultList, +}; + +const speechRecognitionEvent = new SpeechRecognitionEvent("type", speechRecognitionEventInit); +const speechRecognitionEvent2 = new webkitSpeechRecognitionEvent("type", speechRecognitionEventInit); + +const speechRecognitionErrorEventInit: SpeechRecognitionErrorEventInit = { + error: "aborted", + message: "abcde", +}; +const speechRecognitionErrorEvent = new SpeechRecognitionErrorEvent("type", speechRecognitionErrorEventInit); diff --git a/types/dom-speech-recognition/ts5.9/index.d.ts b/types/dom-speech-recognition/ts5.9/index.d.ts new file mode 100644 index 00000000000000..f03791e03e43a8 --- /dev/null +++ b/types/dom-speech-recognition/ts5.9/index.d.ts @@ -0,0 +1,135 @@ +// https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition#events +interface SpeechRecognitionEventMap { + audioend: Event; + audiostart: Event; + end: Event; + error: SpeechRecognitionErrorEvent; + nomatch: SpeechRecognitionEvent; + result: SpeechRecognitionEvent; + soundend: Event; + soundstart: Event; + speechend: Event; + speechstart: Event; + start: Event; +} + +// https://wicg.github.io/speech-api/#speechreco-section +interface SpeechRecognition extends EventTarget { + continuous: boolean; + grammars: SpeechGrammarList; + interimResults: boolean; + lang: string; + maxAlternatives: number; + onaudioend: ((this: SpeechRecognition, ev: Event) => any) | null; + onaudiostart: ((this: SpeechRecognition, ev: Event) => any) | null; + onend: ((this: SpeechRecognition, ev: Event) => any) | null; + onerror: ((this: SpeechRecognition, ev: SpeechRecognitionErrorEvent) => any) | null; + onnomatch: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null; + onresult: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null; + onsoundend: ((this: SpeechRecognition, ev: Event) => any) | null; + onsoundstart: ((this: SpeechRecognition, ev: Event) => any) | null; + onspeechend: ((this: SpeechRecognition, ev: Event) => any) | null; + onspeechstart: ((this: SpeechRecognition, ev: Event) => any) | null; + onstart: ((this: SpeechRecognition, ev: Event) => any) | null; + abort(): void; + start(audioTrack?: MediaStreamTrack): void; + stop(): void; + addEventListener( + type: K, + listener: (this: SpeechRecognition, ev: SpeechRecognitionEventMap[K]) => any, + options?: boolean | AddEventListenerOptions, + ): void; + addEventListener( + type: string, + listener: EventListenerOrEventListenerObject, + options?: boolean | AddEventListenerOptions, + ): void; + removeEventListener( + type: K, + listener: (this: SpeechRecognition, ev: SpeechRecognitionEventMap[K]) => any, + options?: boolean | EventListenerOptions, + ): void; + removeEventListener( + type: string, + listener: EventListenerOrEventListenerObject, + options?: boolean | EventListenerOptions, + ): void; +} + +declare var SpeechRecognition: { prototype: SpeechRecognition; new(): SpeechRecognition }; + +// https://wicg.github.io/speech-api/#speechrecognitionevent +interface SpeechRecognitionEventInit extends EventInit { + resultIndex?: number; + results: SpeechRecognitionResultList; +} + +// https://wicg.github.io/speech-api/#dictdef-speechrecognitioneventinit +interface SpeechRecognitionEvent extends Event { + readonly resultIndex: number; + readonly results: SpeechRecognitionResultList; +} + +declare var SpeechRecognitionEvent: { + prototype: SpeechRecognitionEvent; + new(type: string, eventInitDict: SpeechRecognitionEventInit): SpeechRecognitionEvent; +}; + +// https://wicg.github.io/speech-api/#enumdef-speechrecognitionerrorcode +type SpeechRecognitionErrorCode = + | "aborted" + | "audio-capture" + | "bad-grammar" + | "language-not-supported" + | "network" + | "no-speech" + | "not-allowed" + | "service-not-allowed"; + +// https://wicg.github.io/speech-api/#dictdef-speechrecognitionerroreventinit +interface SpeechRecognitionErrorEventInit extends EventInit { + error: SpeechRecognitionErrorCode; + message?: string; +} + +// https://wicg.github.io/speech-api/#speechrecognitionerrorevent +interface SpeechRecognitionErrorEvent extends Event { + readonly error: SpeechRecognitionErrorCode; + readonly message: string; +} + +declare var SpeechRecognitionErrorEvent: { + prototype: SpeechRecognitionErrorEvent; + new(type: string, eventInitDict: SpeechRecognitionErrorEventInit): SpeechRecognitionErrorEvent; +}; + +// https://wicg.github.io/speech-api/#speechgrammar +interface SpeechGrammar { + src: string; + weight: number; +} + +declare var SpeechGrammar: { + prototype: SpeechGrammar; + new(): SpeechGrammar; +}; + +// https://wicg.github.io/speech-api/#speechgrammarlist +interface SpeechGrammarList { + readonly length: number; + addFromString(string: string, weight?: number): void; + addFromURI(src: string, weight?: number): void; + item(index: number): SpeechGrammar; + [index: number]: SpeechGrammar; +} + +declare var SpeechGrammarList: { prototype: SpeechGrammarList; new(): SpeechGrammarList }; + +// prefixed global variables in Chrome; should match the equivalents above +// https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API/Using_the_Web_Speech_API#chrome_support +declare var webkitSpeechRecognition: { prototype: SpeechRecognition; new(): SpeechRecognition }; +declare var webkitSpeechGrammarList: { prototype: SpeechGrammarList; new(): SpeechGrammarList }; +declare var webkitSpeechRecognitionEvent: { + prototype: SpeechRecognitionEvent; + new(type: string, eventInitDict: SpeechRecognitionEventInit): SpeechRecognitionEvent; +}; diff --git a/types/dom-speech-recognition/ts5.9/tsconfig.json b/types/dom-speech-recognition/ts5.9/tsconfig.json new file mode 100644 index 00000000000000..0a8da2222dc059 --- /dev/null +++ b/types/dom-speech-recognition/ts5.9/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "node16", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "dom-speech-recognition-tests.ts" + ] +} diff --git a/types/es6-collections/index.d.ts b/types/es6-collections/index.d.ts index 7073bc1973f1e5..40ed0ec3c1c9d0 100644 --- a/types/es6-collections/index.d.ts +++ b/types/es6-collections/index.d.ts @@ -13,10 +13,7 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -interface IteratorResult { - done: boolean; - value?: T | undefined; -} +/// interface Iterator { next(value?: any): IteratorResult; @@ -38,13 +35,13 @@ interface Map { entries(): Iterator<[K, V]>; keys(): Iterator; values(): Iterator; - size: number; + readonly size: number; } interface MapConstructor { new(): Map; new(iterable: ForEachable<[K, V]>): Map; - prototype: Map; + readonly prototype: Map; } declare var Map: MapConstructor; @@ -58,13 +55,13 @@ interface Set { entries(): Iterator<[T, T]>; keys(): Iterator; values(): Iterator; - size: number; + readonly size: number; } interface SetConstructor { new(): Set; new(iterable: ForEachable): Set; - prototype: Set; + readonly prototype: Set; } declare var Set: SetConstructor; @@ -80,7 +77,7 @@ interface WeakMap { interface WeakMapConstructor { new(): WeakMap; new(iterable: ForEachable<[K, V]>): WeakMap; - prototype: WeakMap; + readonly prototype: WeakMap; } declare var WeakMap: WeakMapConstructor; @@ -93,9 +90,9 @@ interface WeakSet { } interface WeakSetConstructor { - new(): WeakSet; - new(iterable: ForEachable): WeakSet; - prototype: WeakSet; + new(): WeakSet; + new(iterable: ForEachable): WeakSet; + readonly prototype: WeakSet; } declare var WeakSet: WeakSetConstructor; diff --git a/types/es6-shim/index.d.ts b/types/es6-shim/index.d.ts index e4c7ce3d06e36e..6f228f5847814c 100644 --- a/types/es6-shim/index.d.ts +++ b/types/es6-shim/index.d.ts @@ -1,7 +1,4 @@ -interface IteratorResult { - done: boolean; - value?: T | undefined; -} +/// interface IterableShim { /** @@ -237,7 +234,7 @@ interface NumberConstructor { * that is representable as a Number value, which is approximately: * 2.2204460492503130808472633361816 x 10‍−‍16. */ - EPSILON: number; + readonly EPSILON: number; /** * Returns true if passed value is finite. @@ -272,14 +269,14 @@ interface NumberConstructor { * a Number value. * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. */ - MAX_SAFE_INTEGER: number; + readonly MAX_SAFE_INTEGER: number; /** * The value of the smallest integer n such that n and n − 1 are both exactly representable as * a Number value. * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). */ - MIN_SAFE_INTEGER: number; + readonly MIN_SAFE_INTEGER: number; /** * Converts a string to a floating-point number. @@ -335,7 +332,7 @@ interface RegExp { * * If no flags are set, the value is the empty string. */ - flags: string; + readonly flags: string; } interface Math { @@ -499,7 +496,7 @@ interface PromiseConstructor { /** * A reference to the prototype. */ - prototype: Promise; + readonly prototype: Promise; /** * Creates a new Promise. @@ -564,7 +561,7 @@ interface Map { get(key: K): V | undefined; has(key: K): boolean; set(key: K, value: V): Map; - size: number; + readonly size: number; entries(): IterableIteratorShim<[K, V]>; keys(): IterableIteratorShim; values(): IterableIteratorShim; @@ -573,7 +570,7 @@ interface Map { interface MapConstructor { new(): Map; new(iterable: IterableShim<[K, V]>): Map; - prototype: Map; + readonly prototype: Map; } declare var Map: MapConstructor; @@ -584,7 +581,7 @@ interface Set { delete(value: T): boolean; forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; has(value: T): boolean; - size: number; + readonly size: number; entries(): IterableIteratorShim<[T, T]>; keys(): IterableIteratorShim; values(): IterableIteratorShim; @@ -594,7 +591,7 @@ interface Set { interface SetConstructor { new(): Set; new(iterable: IterableShim): Set; - prototype: Set; + readonly prototype: Set; } declare var Set: SetConstructor; @@ -609,7 +606,7 @@ interface WeakMap { interface WeakMapConstructor { new(): WeakMap; new(iterable: IterableShim<[K, V]>): WeakMap; - prototype: WeakMap; + readonly prototype: WeakMap; } declare var WeakMap: WeakMapConstructor; @@ -621,9 +618,9 @@ interface WeakSet { } interface WeakSetConstructor { - new(): WeakSet; - new(iterable: IterableShim): WeakSet; - prototype: WeakSet; + new(): WeakSet; + new(iterable: IterableShim): WeakSet; + readonly prototype: WeakSet; } declare var WeakSet: WeakSetConstructor; diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index d84c3f4fc9dce7..88ff58e4a342bc 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -10467,6 +10467,10 @@ declare namespace Office { * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read item** * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Appointment Organizer + * + * **Important**: To manage the locations of an appointment in Outlook clients that don't support Mailbox requirement set 1.8, use the `location` property instead. + * For guidance on selecting the right location API for your scenario, see + * {@link https://learn.microsoft.com/office/dev/add-ins/outlook/get-or-set-the-location-of-an-appointment | Get or set the location when composing an appointmnt in Outlook}. */ enhancedLocation: EnhancedLocation; /** @@ -10500,9 +10504,15 @@ declare namespace Office { * * @remarks * + * [Api set: Mailbox 1.1] + * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read item** * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Appointment Organizer + * + * **Important**: The `enhancedLocation` property was introduced in Mailbox requirement set 1.8. Use the `enhancedLocation` property to better identify and manage + * appointment locations, especially if you need to determine the location type. For guidance on selecting the right location API for your scenario, see + * {@link https://learn.microsoft.com/office/dev/add-ins/outlook/get-or-set-the-location-of-an-appointment | Get or set the location when composing an appointmnt in Outlook}. */ location: Location; /** @@ -12001,6 +12011,10 @@ declare namespace Office { * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read item** * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Appointment Attendee + * + * **Important**: To manage the locations of an appointment in Outlook clients that don't support Mailbox requirement set 1.8, use the `location` property instead. + * For guidance on selecting the right location API for your scenario, see + * {@link https://learn.microsoft.com/office/dev/add-ins/outlook/get-or-set-the-location-of-an-appointment | Get or set the location when composing an appointmnt in Outlook}. */ enhancedLocation: EnhancedLocation; /** @@ -12069,9 +12083,15 @@ declare namespace Office { * * @remarks * + * [Api set: Mailbox 1.1] + * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read item** * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Appointment Attendee + * + * **Important**: The `enhancedLocation` property was introduced in Mailbox requirement set 1.8. Use the `enhancedLocation` property to better identify and manage + * appointment locations, especially if you need to determine the location type. For guidance on selecting the right location API for your scenario, see + * {@link https://learn.microsoft.com/office/dev/add-ins/outlook/get-or-set-the-location-of-an-appointment | Get or set the location when composing an appointmnt in Outlook}. */ location: string; /** @@ -14832,6 +14852,10 @@ declare namespace Office { * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read item** * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Compose or Read + * + * **Important**: To manage the locations of an appointment in Outlook clients that don't support Mailbox requirement set 1.8, use the Office.Location API instead. + * For guidance on selecting the right location API for your scenario, see + * {@link https://learn.microsoft.com/office/dev/add-ins/outlook/get-or-set-the-location-of-an-appointment | Get or set the location when composing an appointmnt in Outlook}. */ export interface EnhancedLocation { /** @@ -14876,9 +14900,6 @@ declare namespace Office { addAsync(locationIdentifiers: LocationIdentifier[], callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the set of locations associated with the appointment. - * - * **Note**: {@link https://support.microsoft.com/office/88ff6c60-0a1d-4b54-8c9d-9e1a71bc3023 | Personal contact groups} - * added as appointment locations aren't returned by this method. * * @remarks * [Api set: Mailbox 1.8] @@ -14887,18 +14908,23 @@ declare namespace Office { * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Compose or Read * + * **Important**: + * + * - The `getAsync` method doesn't return {@link https://support.microsoft.com/office/88ff6c60-0a1d-4b54-8c9d-9e1a71bc3023 | personal contact groups} that + * were added to the **Location** field of an appointment. + * + * - If a location was added using `Office.context.mailbox.item.location.setAsync`, its location type is `Office.MailboxEnums.LocationType.Custom`. + * * @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 function. * @param callback Optional. When the method completes, the function passed in the `callback` parameter is called with a single parameter, - * `asyncResult`, which is an `Office.AsyncResult` object. + * `asyncResult`, which is an `Office.AsyncResult` object. An array of `Office.LocationDetails` objects representing the locations of the + * appointment is returned in the `asyncResult.value` property. */ getAsync(options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the set of locations associated with the appointment. * - * **Note**: {@link https://support.microsoft.com/office/88ff6c60-0a1d-4b54-8c9d-9e1a71bc3023 | Personal contact groups} - * added as appointment locations aren't returned by this method. - * * @remarks * [Api set: Mailbox 1.8] * @@ -14906,8 +14932,16 @@ declare namespace Office { * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Compose or Read * + * **Important**: + * + * - The `getAsync` method doesn't return {@link https://support.microsoft.com/office/88ff6c60-0a1d-4b54-8c9d-9e1a71bc3023 | personal contact groups} that + * were added to the **Location** field of an appointment. + * + * - If a location was added using `Office.context.mailbox.item.location.setAsync`, its location type is `Office.MailboxEnums.LocationType.Custom`. + * * @param callback Optional. When the method completes, the function passed in the `callback` parameter is called with a single parameter, - * `asyncResult`, which is an `Office.AsyncResult` object. + * `asyncResult`, which is an `Office.AsyncResult` object. An array of `Office.LocationDetails` objects representing the locations of the + * appointment is returned in the `asyncResult.value` property. */ getAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** @@ -17380,6 +17414,10 @@ declare namespace Office { * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read item** * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Compose + * + * **Important**: The Office.EnhancedLocation API was introduced in Mailbox requirement set 1.8. Use the EnhancedLocation API to better identify and manage + * appointment locations, especially if you need to determine the location type. For guidance on selecting the right location API for your scenario, see + * {@link https://learn.microsoft.com/office/dev/add-ins/outlook/get-or-set-the-location-of-an-appointment | Get or set the location when composing an appointmnt in Outlook}. */ interface Location { /** @@ -17431,6 +17469,9 @@ declare namespace Office { * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Compose * + * **Important**: To ensure that multiple locations resolve correctly in Outlook, separate them with a semicolon and a space. For example, + * "Conference Room 1; Conference Room 2". + * * **Errors**: * * - DataExceedsMaximumSize: The location parameter is longer than 255 characters. @@ -17455,6 +17496,9 @@ declare namespace Office { * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Compose * + * **Important**: To ensure that multiple locations resolve correctly in Outlook, separate them with a semicolon and a space. For example, + * "Conference Room 1; Conference Room 2". + * * **Errors**: * * - DataExceedsMaximumSize: The location parameter is longer than 255 characters. diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index b021509258ef97..677cb07ba4e9e5 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -10457,6 +10457,10 @@ declare namespace Office { * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read item** * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Appointment Organizer + * + * **Important**: To manage the locations of an appointment in Outlook clients that don't support Mailbox requirement set 1.8, use the `location` property instead. + * For guidance on selecting the right location API for your scenario, see + * {@link https://learn.microsoft.com/office/dev/add-ins/outlook/get-or-set-the-location-of-an-appointment | Get or set the location when composing an appointmnt in Outlook}. */ enhancedLocation: EnhancedLocation; /** @@ -10477,9 +10481,15 @@ declare namespace Office { * * @remarks * + * [Api set: Mailbox 1.1] + * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read item** * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Appointment Organizer + * + * **Important**: The `enhancedLocation` property was introduced in Mailbox requirement set 1.8. Use the `enhancedLocation` property to better identify and manage + * appointment locations, especially if you need to determine the location type. For guidance on selecting the right location API for your scenario, see + * {@link https://learn.microsoft.com/office/dev/add-ins/outlook/get-or-set-the-location-of-an-appointment | Get or set the location when composing an appointmnt in Outlook}. */ location: Location; /** @@ -11982,6 +11992,10 @@ declare namespace Office { * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read item** * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Appointment Attendee + * + * **Important**: To manage the locations of an appointment in Outlook clients that don't support Mailbox requirement set 1.8, use the `location` property instead. + * For guidance on selecting the right location API for your scenario, see + * {@link https://learn.microsoft.com/office/dev/add-ins/outlook/get-or-set-the-location-of-an-appointment | Get or set the location when composing an appointmnt in Outlook}. */ enhancedLocation: EnhancedLocation; /** @@ -12037,9 +12051,15 @@ declare namespace Office { * * @remarks * + * [Api set: Mailbox 1.1] + * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read item** * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Appointment Attendee + * + * **Important**: The `enhancedLocation` property was introduced in Mailbox requirement set 1.8. Use the `enhancedLocation` property to better identify and manage + * appointment locations, especially if you need to determine the location type. For guidance on selecting the right location API for your scenario, see + * {@link https://learn.microsoft.com/office/dev/add-ins/outlook/get-or-set-the-location-of-an-appointment | Get or set the location when composing an appointmnt in Outlook}. */ location: string; /** @@ -14612,6 +14632,10 @@ declare namespace Office { * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read item** * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Compose or Read + * + * **Important**: To manage the locations of an appointment in Outlook clients that don't support Mailbox requirement set 1.8, use the Office.Location API instead. + * For guidance on selecting the right location API for your scenario, see + * {@link https://learn.microsoft.com/office/dev/add-ins/outlook/get-or-set-the-location-of-an-appointment | Get or set the location when composing an appointmnt in Outlook}. */ export interface EnhancedLocation { /** @@ -14657,9 +14681,6 @@ declare namespace Office { /** * Gets the set of locations associated with the appointment. * - * **Note**: {@link https://support.microsoft.com/office/88ff6c60-0a1d-4b54-8c9d-9e1a71bc3023 | Personal contact groups} - * added as appointment locations aren't returned by this method. - * * @remarks * [Api set: Mailbox 1.8] * @@ -14667,18 +14688,23 @@ declare namespace Office { * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Compose or Read * + * **Important**: + * + * - The `getAsync` method doesn't return {@link https://support.microsoft.com/office/88ff6c60-0a1d-4b54-8c9d-9e1a71bc3023 | personal contact groups} that + * were added to the **Location** field of an appointment. + * + * - If a location was added using `Office.context.mailbox.item.location.setAsync`, its location type is `Office.MailboxEnums.LocationType.Custom`. + * * @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 function. * @param callback Optional. When the method completes, the function passed in the `callback` parameter is called with a single parameter, - * `asyncResult`, which is an `Office.AsyncResult` object. + * `asyncResult`, which is an `Office.AsyncResult` object. An array of `Office.LocationDetails` objects representing the locations of the + * appointment is returned in the `asyncResult.value` property. */ getAsync(options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the set of locations associated with the appointment. * - * **Note**: {@link https://support.microsoft.com/office/88ff6c60-0a1d-4b54-8c9d-9e1a71bc3023 | Personal contact groups} - * added as appointment locations aren't returned by this method. - * * @remarks * [Api set: Mailbox 1.8] * @@ -14686,8 +14712,16 @@ declare namespace Office { * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Compose or Read * + * **Important**: + * + * - The `getAsync` method doesn't return {@link https://support.microsoft.com/office/88ff6c60-0a1d-4b54-8c9d-9e1a71bc3023 | personal contact groups} that + * were added to the **Location** field of an appointment. + * + * - If a location was added using `Office.context.mailbox.item.location.setAsync`, its location type is `Office.MailboxEnums.LocationType.Custom`. + * * @param callback Optional. When the method completes, the function passed in the `callback` parameter is called with a single parameter, - * `asyncResult`, which is an `Office.AsyncResult` object. + * `asyncResult`, which is an `Office.AsyncResult` object. An array of `Office.LocationDetails` objects representing the locations of the + * appointment is returned in the `asyncResult.value` property. */ getAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** @@ -17125,6 +17159,10 @@ declare namespace Office { * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read item** * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Compose + * + * **Important**: The Office.EnhancedLocation API was introduced in Mailbox requirement set 1.8. Use the EnhancedLocation API to better identify and manage + * appointment locations, especially if you need to determine the location type. For guidance on selecting the right location API for your scenario, see + * {@link https://learn.microsoft.com/office/dev/add-ins/outlook/get-or-set-the-location-of-an-appointment | Get or set the location when composing an appointmnt in Outlook}. */ interface Location { /** @@ -17176,6 +17214,9 @@ declare namespace Office { * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Compose * + * **Important**: To ensure that multiple locations resolve correctly in Outlook, separate them with a semicolon and a space. For example, + * "Conference Room 1; Conference Room 2". + * * **Errors**: * * - DataExceedsMaximumSize: The location parameter is longer than 255 characters. @@ -17200,6 +17241,9 @@ declare namespace Office { * * **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Compose * + * **Important**: To ensure that multiple locations resolve correctly in Outlook, separate them with a semicolon and a space. For example, + * "Conference Room 1; Conference Room 2". + * * **Errors**: * * - DataExceedsMaximumSize: The location parameter is longer than 255 characters. diff --git a/types/send/.npmignore b/types/send/.npmignore index 93e307400a5456..49916246872b73 100644 --- a/types/send/.npmignore +++ b/types/send/.npmignore @@ -3,3 +3,4 @@ !**/*.d.cts !**/*.d.mts !**/*.d.*.ts +/v0/ diff --git a/types/send/index.d.ts b/types/send/index.d.ts index 6d624bb61b8cad..5d483dc8103ef2 100644 --- a/types/send/index.d.ts +++ b/types/send/index.d.ts @@ -1,7 +1,6 @@ /// import * as fs from "fs"; -import * as m from "mime"; import * as stream from "stream"; /** @@ -11,7 +10,6 @@ import * as stream from "stream"; declare function send(req: stream.Readable, path: string, options?: send.SendOptions): send.SendStream; declare namespace send { - const mime: typeof m; interface SendOptions { /** * Enable or disable accepting ranged requests, defaults to true. @@ -94,42 +92,6 @@ declare namespace send { } interface SendStream extends stream.Stream { - /** - * @deprecated pass etag as option - * Enable or disable etag generation. - */ - etag(val: boolean): SendStream; - - /** - * @deprecated use dotfiles option - * Enable or disable "hidden" (dot) files. - */ - hidden(val: boolean): SendStream; - - /** - * @deprecated pass index as option - * Set index `paths`, set to a falsy value to disable index support. - */ - index(paths: string[] | string): SendStream; - - /** - * @deprecated pass root as option - * Set root `path`. - */ - root(paths: string): SendStream; - - /** - * @deprecated pass root as option - * Set root `path`. - */ - from(paths: string): SendStream; - - /** - * @deprecated pass maxAge as option - * Set max-age to `maxAge`. - */ - maxage(maxAge: string | number): SendStream; - /** * Emit error with `status`. */ diff --git a/types/send/package.json b/types/send/package.json index 25850eaecb1600..baf0074c7d45d9 100644 --- a/types/send/package.json +++ b/types/send/package.json @@ -1,12 +1,11 @@ { "private": true, "name": "@types/send", - "version": "0.17.9999", + "version": "1.2.9999", "projects": [ "https://github.com/pillarjs/send" ], "dependencies": { - "@types/mime": "^1", "@types/node": "*" }, "devDependencies": { diff --git a/types/send/send-tests.ts b/types/send/send-tests.ts index 13162a9fad6d59..3fe0d29823e864 100644 --- a/types/send/send-tests.ts +++ b/types/send/send-tests.ts @@ -3,10 +3,6 @@ import send = require("send"); const app = express(); -send.mime.define({ - "application/x-my-type": ["x-mt", "x-mtt"], -}); - app.get("/test.html", (req, res) => { send(req, "/test.html", { immutable: true, @@ -17,8 +13,6 @@ app.get("/test.html", (req, res) => { app.get("/test.html", (req, res) => { send(req, "/test.html") - .maxage(0) - .root(__dirname + "/wwwroot") .on("error", (err: any) => { res.statusCode = err.status || 500; res.end(err.message); diff --git a/types/dhtmlxscheduler/.npmignore b/types/send/v0/.npmignore similarity index 100% rename from types/dhtmlxscheduler/.npmignore rename to types/send/v0/.npmignore diff --git a/types/send/v0/index.d.ts b/types/send/v0/index.d.ts new file mode 100644 index 00000000000000..6d624bb61b8cad --- /dev/null +++ b/types/send/v0/index.d.ts @@ -0,0 +1,225 @@ +/// + +import * as fs from "fs"; +import * as m from "mime"; +import * as stream from "stream"; + +/** + * Create a new SendStream for the given path to send to a res. + * The req is the Node.js HTTP request and the path is a urlencoded path to send (urlencoded, not the actual file-system path). + */ +declare function send(req: stream.Readable, path: string, options?: send.SendOptions): send.SendStream; + +declare namespace send { + const mime: typeof m; + interface SendOptions { + /** + * Enable or disable accepting ranged requests, defaults to true. + * Disabling this will not send Accept-Ranges and ignore the contents of the Range request header. + */ + acceptRanges?: boolean | undefined; + + /** + * Enable or disable setting Cache-Control response header, defaults to true. + * Disabling this will ignore the maxAge option. + */ + cacheControl?: boolean | undefined; + + /** + * Set how "dotfiles" are treated when encountered. + * A dotfile is a file or directory that begins with a dot ("."). + * Note this check is done on the path itself without checking if the path actually exists on the disk. + * If root is specified, only the dotfiles above the root are checked (i.e. the root itself can be within a dotfile when when set to "deny"). + * 'allow' No special treatment for dotfiles. + * 'deny' Send a 403 for any request for a dotfile. + * 'ignore' Pretend like the dotfile does not exist and 404. + * The default value is similar to 'ignore', with the exception that this default will not ignore the files within a directory that begins with a dot, for backward-compatibility. + */ + dotfiles?: "allow" | "deny" | "ignore" | undefined; + + /** + * Byte offset at which the stream ends, defaults to the length of the file minus 1. + * The end is inclusive in the stream, meaning end: 3 will include the 4th byte in the stream. + */ + end?: number | undefined; + + /** + * Enable or disable etag generation, defaults to true. + */ + etag?: boolean | undefined; + + /** + * If a given file doesn't exist, try appending one of the given extensions, in the given order. + * By default, this is disabled (set to false). + * An example value that will serve extension-less HTML files: ['html', 'htm']. + * This is skipped if the requested file already has an extension. + */ + extensions?: string[] | string | boolean | undefined; + + /** + * Enable or disable the immutable directive in the Cache-Control response header, defaults to false. + * If set to true, the maxAge option should also be specified to enable caching. + * The immutable directive will prevent supported clients from making conditional requests during the life of the maxAge option to check if the file has changed. + * @default false + */ + immutable?: boolean | undefined; + + /** + * By default send supports "index.html" files, to disable this set false or to supply a new index pass a string or an array in preferred order. + */ + index?: string[] | string | boolean | undefined; + + /** + * Enable or disable Last-Modified header, defaults to true. + * Uses the file system's last modified value. + */ + lastModified?: boolean | undefined; + + /** + * Provide a max-age in milliseconds for http caching, defaults to 0. + * This can also be a string accepted by the ms module. + */ + maxAge?: string | number | undefined; + + /** + * Serve files relative to path. + */ + root?: string | undefined; + + /** + * Byte offset at which the stream starts, defaults to 0. + * The start is inclusive, meaning start: 2 will include the 3rd byte in the stream. + */ + start?: number | undefined; + } + + interface SendStream extends stream.Stream { + /** + * @deprecated pass etag as option + * Enable or disable etag generation. + */ + etag(val: boolean): SendStream; + + /** + * @deprecated use dotfiles option + * Enable or disable "hidden" (dot) files. + */ + hidden(val: boolean): SendStream; + + /** + * @deprecated pass index as option + * Set index `paths`, set to a falsy value to disable index support. + */ + index(paths: string[] | string): SendStream; + + /** + * @deprecated pass root as option + * Set root `path`. + */ + root(paths: string): SendStream; + + /** + * @deprecated pass root as option + * Set root `path`. + */ + from(paths: string): SendStream; + + /** + * @deprecated pass maxAge as option + * Set max-age to `maxAge`. + */ + maxage(maxAge: string | number): SendStream; + + /** + * Emit error with `status`. + */ + error(status: number, error?: Error): void; + + /** + * Check if the pathname ends with "/". + */ + hasTrailingSlash(): boolean; + + /** + * Check if this is a conditional GET request. + */ + isConditionalGET(): boolean; + + /** + * Strip content-* header fields. + */ + removeContentHeaderFields(): void; + + /** + * Respond with 304 not modified. + */ + notModified(): void; + + /** + * Raise error that headers already sent. + */ + headersAlreadySent(): void; + + /** + * Check if the request is cacheable, aka responded with 2xx or 304 (see RFC 2616 section 14.2{5,6}). + */ + isCachable(): boolean; + + /** + * Handle stat() error. + */ + onStatError(error: Error): void; + + /** + * Check if the cache is fresh. + */ + isFresh(): boolean; + + /** + * Check if the range is fresh. + */ + isRangeFresh(): boolean; + + /** + * Redirect to path. + */ + redirect(path: string): void; + + /** + * Pipe to `res`. + */ + pipe(res: T): T; + + /** + * Transfer `path`. + */ + send(path: string, stat?: fs.Stats): void; + + /** + * Transfer file for `path`. + */ + sendFile(path: string): void; + + /** + * Transfer index for `path`. + */ + sendIndex(path: string): void; + + /** + * Transfer index for `path`. + */ + stream(path: string, options?: {}): void; + + /** + * Set content-type based on `path` if it hasn't been explicitly set. + */ + type(path: string): void; + + /** + * Set response header fields, most fields may be pre-defined. + */ + setHeader(path: string, stat: fs.Stats): void; + } +} + +export = send; diff --git a/types/send/v0/package.json b/types/send/v0/package.json new file mode 100644 index 00000000000000..25850eaecb1600 --- /dev/null +++ b/types/send/v0/package.json @@ -0,0 +1,30 @@ +{ + "private": true, + "name": "@types/send", + "version": "0.17.9999", + "projects": [ + "https://github.com/pillarjs/send" + ], + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + }, + "devDependencies": { + "@types/express": "*", + "@types/send": "workspace:." + }, + "owners": [ + { + "name": "Mike Jerred", + "githubUsername": "MikeJerred" + }, + { + "name": "Piotr Błażejewicz", + "githubUsername": "peterblazejewicz" + }, + { + "name": "Sebastian Beltran", + "githubUsername": "bjohansebas" + } + ] +} diff --git a/types/send/v0/send-tests.ts b/types/send/v0/send-tests.ts new file mode 100644 index 00000000000000..13162a9fad6d59 --- /dev/null +++ b/types/send/v0/send-tests.ts @@ -0,0 +1,35 @@ +import express = require("express"); +import send = require("send"); + +const app = express(); + +send.mime.define({ + "application/x-my-type": ["x-mt", "x-mtt"], +}); + +app.get("/test.html", (req, res) => { + send(req, "/test.html", { + immutable: true, + maxAge: 0, + root: __dirname + "/wwwroot", + }).pipe(res); +}); + +app.get("/test.html", (req, res) => { + send(req, "/test.html") + .maxage(0) + .root(__dirname + "/wwwroot") + .on("error", (err: any) => { + res.statusCode = err.status || 500; + res.end(err.message); + }) + .on("directory", () => { + res.statusCode = 301; + res.setHeader("Location", req.url + "/"); + res.end(`Redirecting to ${req.url}/`); + }) + .on("headers", (res: any, path: string, stat: any) => { + res.setHeader("Content-Disposition", "attachment"); + }) + .pipe(res); +}); diff --git a/types/send/v0/tsconfig.json b/types/send/v0/tsconfig.json new file mode 100644 index 00000000000000..accf6586ca5ce4 --- /dev/null +++ b/types/send/v0/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "node16", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "send-tests.ts" + ] +} diff --git a/types/serve-static/package.json b/types/serve-static/package.json index 6d001c779fcee6..da54a89a94a824 100644 --- a/types/serve-static/package.json +++ b/types/serve-static/package.json @@ -8,7 +8,7 @@ "dependencies": { "@types/http-errors": "*", "@types/node": "*", - "@types/send": "*" + "@types/send": "<1" }, "devDependencies": { "@types/express": "*", diff --git a/types/webrtc/MediaStream.d.ts b/types/webrtc/MediaStream.d.ts index dafc7f5af94ee1..7b0ec440cf16de 100644 --- a/types/webrtc/MediaStream.d.ts +++ b/types/webrtc/MediaStream.d.ts @@ -21,6 +21,11 @@ interface ConstrainStringParameters { ideal?: string | string[] | undefined; } +interface ConstrainBooleanOrDOMStringParameters { + exact?: boolean | string; + ideal?: boolean | string; +} + interface MediaStreamConstraints { video?: boolean | MediaTrackConstraints | undefined; audio?: boolean | MediaTrackConstraints | undefined; @@ -34,6 +39,7 @@ declare namespace W3C { type ConstrainLong = ConstrainNumber; type ConstrainDouble = ConstrainNumber; type ConstrainString = string | string[] | ConstrainStringParameters; + type ConstrainBooleanOrDOMString = boolean | string | ConstrainBooleanOrDOMStringParameters; } interface MediaTrackConstraints extends MediaTrackConstraintSet { @@ -49,7 +55,7 @@ interface MediaTrackConstraintSet { volume?: W3C.ConstrainDouble | undefined; sampleRate?: W3C.ConstrainLong | undefined; sampleSize?: W3C.ConstrainLong | undefined; - echoCancellation?: W3C.ConstrainBoolean | undefined; + echoCancellation?: W3C.ConstrainBooleanOrDOMString | undefined; latency?: W3C.ConstrainDouble | undefined; deviceId?: W3C.ConstrainString | undefined; groupId?: W3C.ConstrainString | undefined; diff --git a/types/webrtc/package.json b/types/webrtc/package.json index cff9526b2eb11e..7e70ea8d97b48c 100644 --- a/types/webrtc/package.json +++ b/types/webrtc/package.json @@ -8,6 +8,11 @@ "types": "index", "minimumTypeScriptVersion": "4.9", "typesVersions": { + "<=5.9": { + "*": [ + "ts5.9/*" + ] + }, "<=5.7": { "*": [ "ts5.7/*" diff --git a/types/webrtc/ts5.9/MediaStream.d.ts b/types/webrtc/ts5.9/MediaStream.d.ts new file mode 100644 index 00000000000000..dafc7f5af94ee1 --- /dev/null +++ b/types/webrtc/ts5.9/MediaStream.d.ts @@ -0,0 +1,194 @@ +// Taken from http://dev.w3.org/2011/webrtc/editor/getusermedia.html +// version: W3C Editor's Draft 29 June 2015 + +interface ConstrainBooleanParameters { + exact?: boolean | undefined; + ideal?: boolean | undefined; +} + +interface NumberRange { + max?: number | undefined; + min?: number | undefined; +} + +interface ConstrainNumberRange extends NumberRange { + exact?: number | undefined; + ideal?: number | undefined; +} + +interface ConstrainStringParameters { + exact?: string | string[] | undefined; + ideal?: string | string[] | undefined; +} + +interface MediaStreamConstraints { + video?: boolean | MediaTrackConstraints | undefined; + audio?: boolean | MediaTrackConstraints | undefined; +} + +declare namespace W3C { + type LongRange = NumberRange; + type DoubleRange = NumberRange; + type ConstrainBoolean = boolean | ConstrainBooleanParameters; + type ConstrainNumber = number | ConstrainNumberRange; + type ConstrainLong = ConstrainNumber; + type ConstrainDouble = ConstrainNumber; + type ConstrainString = string | string[] | ConstrainStringParameters; +} + +interface MediaTrackConstraints extends MediaTrackConstraintSet { + advanced?: MediaTrackConstraintSet[] | undefined; +} + +interface MediaTrackConstraintSet { + width?: W3C.ConstrainLong | undefined; + height?: W3C.ConstrainLong | undefined; + aspectRatio?: W3C.ConstrainDouble | undefined; + frameRate?: W3C.ConstrainDouble | undefined; + facingMode?: W3C.ConstrainString | undefined; + volume?: W3C.ConstrainDouble | undefined; + sampleRate?: W3C.ConstrainLong | undefined; + sampleSize?: W3C.ConstrainLong | undefined; + echoCancellation?: W3C.ConstrainBoolean | undefined; + latency?: W3C.ConstrainDouble | undefined; + deviceId?: W3C.ConstrainString | undefined; + groupId?: W3C.ConstrainString | undefined; +} + +interface MediaTrackSupportedConstraints { + width?: boolean | undefined; + height?: boolean | undefined; + aspectRatio?: boolean | undefined; + frameRate?: boolean | undefined; + facingMode?: boolean | undefined; + volume?: boolean | undefined; + sampleRate?: boolean | undefined; + sampleSize?: boolean | undefined; + echoCancellation?: boolean | undefined; + latency?: boolean | undefined; + deviceId?: boolean | undefined; + groupId?: boolean | undefined; +} + +interface MediaStream extends EventTarget { + // id: string; + // active: boolean; + + // onactive: EventListener; + // oninactive: EventListener; + // onaddtrack: (event: MediaStreamTrackEvent) => any; + // onremovetrack: (event: MediaStreamTrackEvent) => any; + + clone(): MediaStream; + stop(): void; + + getAudioTracks(): MediaStreamTrack[]; + getVideoTracks(): MediaStreamTrack[]; + getTracks(): MediaStreamTrack[]; + + getTrackById(trackId: string): MediaStreamTrack; + + addTrack(track: MediaStreamTrack): void; + removeTrack(track: MediaStreamTrack): void; +} + +interface MediaStreamTrackEvent extends Event { + // track: MediaStreamTrack; +} + +interface MediaStreamTrack extends EventTarget { + // id: string; + // kind: string; + // label: string; + enabled: boolean; + // muted: boolean; + // remote: boolean; + // readyState: MediaStreamTrackState; + + // onmute: EventListener; + // onunmute: EventListener; + // onended: EventListener; + // onoverconstrained: EventListener; + + clone(): MediaStreamTrack; + + stop(): void; + + getCapabilities(): MediaTrackCapabilities; + getConstraints(): MediaTrackConstraints; + getSettings(): MediaTrackSettings; + applyConstraints(constraints: MediaTrackConstraints): Promise; +} + +interface MediaTrackCapabilities { + // width: number | W3C.LongRange; + // height: number | W3C.LongRange; + // aspectRatio: number | W3C.DoubleRange; + // frameRate: number | W3C.DoubleRange; + // facingMode: string; + // volume: number | W3C.DoubleRange; + // sampleRate: number | W3C.LongRange; + // sampleSize: number | W3C.LongRange; + // echoCancellation: boolean[]; + latency?: W3C.DoubleRange | undefined; + // deviceId: string; + // groupId: string; +} + +interface MediaTrackSettings { + // width: number; + // height: number; + // aspectRatio: number; + // frameRate: number; + // facingMode: string; + // volume: number; + // sampleRate: number; + // sampleSize: number; + // echoCancellation: boolean; + latency?: number | undefined; + // deviceId: string; + // groupId: string; +} + +interface MediaStreamError { + readonly name: string; + readonly message: string | null; + readonly constraintName: string | null; +} + +interface NavigatorGetUserMedia { + ( + constraints: MediaStreamConstraints, + successCallback: (stream: MediaStream) => void, + errorCallback: (error: MediaStreamError) => void, + ): void; +} + +// to use with adapter.js, see: https://github.com/webrtc/adapter +declare var getUserMedia: NavigatorGetUserMedia; + +interface Navigator { + getUserMedia: NavigatorGetUserMedia; + + webkitGetUserMedia: NavigatorGetUserMedia; + + mozGetUserMedia: NavigatorGetUserMedia; + + msGetUserMedia: NavigatorGetUserMedia; + + readonly mediaDevices: MediaDevices; +} + +interface MediaDevices { + getSupportedConstraints(): MediaTrackSupportedConstraints; + + getUserMedia(constraints: MediaStreamConstraints): Promise; + enumerateDevices(): Promise; +} + +interface MediaDeviceInfo { + // label: string; + // deviceId: string; + // kind: string; + // groupId: string; +} diff --git a/types/webrtc/ts5.9/RTCPeerConnection.d.ts b/types/webrtc/ts5.9/RTCPeerConnection.d.ts new file mode 100644 index 00000000000000..5da133e2152211 --- /dev/null +++ b/types/webrtc/ts5.9/RTCPeerConnection.d.ts @@ -0,0 +1,455 @@ +// W3 Spec: https://www.w3.org/TR/webrtc/ +// +// Note: Commented out definitions clash with definitions in lib.es6.d.ts. I +// still kept them in here though, as sometimes they're more specific than the +// ES6 library ones. + +/// + +// https://www.w3.org/TR/webrtc/#idl-def-rtcerror +interface RTCError extends DOMException { + readonly errorDetail: RTCErrorDetailType; + readonly httpRequestStatusCode: number | null; + readonly receivedAlert: number | null; + readonly sctpCauseCode: number | null; + readonly sdpLineNumber: number | null; + readonly sentAlert: number | null; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcerrorinit +interface RTCErrorInit { + errorDetail: RTCErrorDetailType; + httpRequestStatusCode?: number | undefined; + receivedAlert?: number | undefined; + sctpCauseCode?: number | undefined; + sdpLineNumber?: number | undefined; + sentAlert?: number | undefined; +} + +declare var RTCError: { + prototype: RTCError; + new(init: RTCErrorInit, message?: string): RTCError; +}; + +// https://www.w3.org/TR/webrtc/#idl-def-rtcerrorevent +interface RTCErrorEvent extends Event { + readonly error: RTCError; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcerroreventinit +interface RTCErrorEventInit extends EventInit { + error: RTCError; +} + +declare var RTCErrorEvent: { + prototype: RTCErrorEvent; + new(type: string, eventInitDict: RTCErrorEventInit): RTCErrorEvent; +}; + +// https://www.w3.org/TR/webrtc/#idl-def-rtcicecandidatepair +interface RTCIceCandidatePair { + local: RTCIceCandidate; + remote: RTCIceCandidate; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcofferansweroptions +interface RTCOfferAnswerOptions { + voiceActivityDetection?: boolean | undefined; // default = true +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcofferoptions +interface RTCOfferOptions extends RTCOfferAnswerOptions { + iceRestart?: boolean | undefined; // default = false +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcansweroptions +interface RTCAnswerOptions extends RTCOfferAnswerOptions { +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtciceserver +interface RTCIceServer { + credential?: string | undefined; + urls: string | string[]; + username?: string | undefined; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtciceparameters +interface RTCIceParameters { + iceLite?: boolean | undefined; + password?: string | undefined; + usernameFragment?: string | undefined; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcicerole +// type RTCIceRole = "controlled" | "controlling" | "unknown"; + +interface RTCIceTransportEventMap { + "gatheringstatechange": Event; + "selectedcandidatepairchange": Event; + "statechange": Event; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcicetransport +type IceTransportEventHandler = ((this: RTCIceTransport, ev: Event) => any) | null; +interface RTCIceTransport extends EventTarget { + readonly role: RTCIceRole; + // readonly component: RTCIceComponent; + // readonly state: RTCIceTransportState; + readonly gatheringState: RTCIceGatheringState; + getLocalCandidates(): RTCIceCandidate[]; + getRemoteCandidates(): RTCIceCandidate[]; + getLocalParameters(): RTCIceParameters | null; + getRemoteParameters(): RTCIceParameters | null; + getSelectedCandidatePair(): RTCIceCandidatePair | null; + onstatechange: IceTransportEventHandler; + ongatheringstatechange: IceTransportEventHandler; + onselectedcandidatepairchange: IceTransportEventHandler; + addEventListener( + type: K, + listener: (this: RTCIceTransport, ev: RTCIceTransportEventMap[K]) => any, + options?: boolean | AddEventListenerOptions, + ): void; + addEventListener( + type: string, + listener: EventListenerOrEventListenerObject, + options?: boolean | AddEventListenerOptions, + ): void; + removeEventListener( + type: K, + listener: (this: RTCIceTransport, ev: RTCIceTransportEventMap[K]) => any, + options: boolean | EventListenerOptions, + ): void; + removeEventListener( + type: string, + listener: EventListenerOrEventListenerObject, + options?: boolean | EventListenerOptions, + ): void; +} + +interface RTCDtlsTransportEventMap { + "error": RTCErrorEvent; + "statechange": Event; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcdtlstransport +type DtlsTransportEventHandler = ((this: RTCDtlsTransport, ev: E) => any) | null; +interface RTCDtlsTransport extends EventTarget { + readonly iceTransport: RTCIceTransport; + readonly state: RTCDtlsTransportState; + getRemoteCertificates(): ArrayBuffer[]; + onerror: DtlsTransportEventHandler; + onstatechange: DtlsTransportEventHandler; + addEventListener( + type: K, + listener: (this: RTCDtlsTransport, ev: RTCDtlsTransportEventMap[K]) => any, + options?: boolean | AddEventListenerOptions, + ): void; + addEventListener( + type: string, + listener: EventListenerOrEventListenerObject, + options?: boolean | AddEventListenerOptions, + ): void; + removeEventListener( + type: K, + listener: (this: RTCDtlsTransport, ev: RTCDtlsTransportEventMap[K]) => any, + options?: boolean | EventListenerOptions, + ): void; + removeEventListener( + type: string, + listener: EventListenerOrEventListenerObject, + options?: boolean | EventListenerOptions, + ): void; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcrtpcodeccapability +interface RTCRtpCodecCapability { + mimeType: string; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcrtpheaderextensioncapability +interface RTCRtpHeaderExtensionCapability { + uri: string; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcrtpcapabilities +interface RTCRtpCapabilities { + // codecs: RTCRtpCodecCapability[]; + // headerExtensions: RTCRtpHeaderExtensionCapability[]; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcrtprtxparameters +interface RTCRtpRtxParameters { + // ssrc: number; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcrtpfecparameters +interface RTCRtpFecParameters { + // ssrc: number; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcrtpencodingparameters +interface RTCRtpEncodingParameters { + // ssrc: number; + // rtx: RTCRtpRtxParameters; + // fec: RTCRtpFecParameters; + // dtx?: RTCDtxStatus; + // active: boolean; + // priority: RTCPriorityType; + // maxBitrate: number; + rid: string; + scaleResolutionDownBy?: number | undefined; // default = 1 +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcrtpheaderextensionparameters +interface RTCRtpHeaderExtensionParameters { + // uri: string; + // id: number; + encrypted?: boolean | undefined; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcrtcpparameters +interface RTCRtcpParameters { + // cname: string; + // reducedSize: boolean; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcrtpcodecparameters +interface RTCRtpCodecParameters { + // payloadType: number; + mimeType: string; + // clockRate: number; + channels?: number | undefined; // default = 1 + sdpFmtpLine?: string | undefined; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcrtpparameters +interface RTCRtpParameters { + transactionId: string; + // encodings: RTCRtpEncodingParameters[]; + // headerExtensions: RTCRtpHeaderExtensionParameters[]; + // rtcp: RTCRtcpParameters; + // codecs: RTCRtpCodecParameters[]; + // degradationPreference?: RTCDegradationPreference; // default = 'balanced' +} + +// https://www.w3.org/TR/webrtc/#dom-rtcrtpcontributingsource +interface RTCRtpContributingSource { + // readonly timestamp: number; + source: number; + // readonly audioLevel: number | null; + readonly voiceActivityFlag?: boolean | undefined; +} + +// https://www.w3.org/TR/webrtc/#dom-rtcrtpsender +interface RTCRtpSender { + // readonly track?: MediaStreamTrack; + // readonly transport?: RTCDtlsTransport; + // readonly rtcpTransport?: RTCDtlsTransport; + setParameters(parameters?: RTCRtpParameters): Promise; + getParameters(): RTCRtpParameters; + replaceTrack(withTrack: MediaStreamTrack): Promise; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcrtpreceiver +interface RTCRtpReceiver { + // readonly track?: MediaStreamTrack; + // readonly transport?: RTCDtlsTransport; + // readonly rtcpTransport?: RTCDtlsTransport; + getParameters(): RTCRtpParameters; + getContributingSources(): RTCRtpContributingSource[]; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcrtptransceiver +interface RTCRtpTransceiver { + readonly mid: string | null; + readonly sender: RTCRtpSender; + readonly receiver: RTCRtpReceiver; + readonly stopped: boolean; + direction: RTCRtpTransceiverDirection; + setDirection(direction: RTCRtpTransceiverDirection): void; + stop(): void; + setCodecPreferences(codecs: RTCRtpCodecCapability[]): void; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcrtptransceiverinit +interface RTCRtpTransceiverInit { + direction?: RTCRtpTransceiverDirection | undefined; // default = 'sendrecv' + streams?: MediaStream[] | undefined; + sendEncodings?: RTCRtpEncodingParameters[] | undefined; +} + +// https://www.w3.org/TR/webrtc/#dom-rtccertificate +interface RTCCertificate { + readonly expires: number; + getAlgorithm(): string; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcconfiguration +interface RTCConfiguration { + iceServers?: RTCIceServer[] | undefined; + iceTransportPolicy?: RTCIceTransportPolicy | undefined; // default = 'all' + bundlePolicy?: RTCBundlePolicy | undefined; // default = 'balanced' + rtcpMuxPolicy?: RTCRtcpMuxPolicy | undefined; // default = 'require' + peerIdentity?: string | undefined; // default = null + certificates?: RTCCertificate[] | undefined; + iceCandidatePoolSize?: number | undefined; // default = 0 +} + +// Compatibility for older definitions on DefinitelyTyped. +type RTCPeerConnectionConfig = RTCConfiguration; + +// https://www.w3.org/TR/webrtc/#idl-def-rtcsctptransport +interface RTCSctpTransport { + readonly transport: RTCDtlsTransport; + readonly maxMessageSize: number; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcdatachannelinit +interface RTCDataChannelInit { + ordered?: boolean | undefined; // default = true + maxPacketLifeTime?: number | undefined; + maxRetransmits?: number | undefined; + protocol?: string | undefined; // default = '' + negotiated?: boolean | undefined; // default = false + id?: number | undefined; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcdatachannel +type DataChannelEventHandler = ((this: RTCDataChannel, ev: E) => any) | null; +interface RTCDataChannel extends EventTarget { + readonly label: string; + readonly ordered: boolean; + readonly maxPacketLifeTime: number | null; + readonly maxRetransmits: number | null; + readonly protocol: string; + readonly negotiated: boolean; + readonly id: number | null; + readonly readyState: RTCDataChannelState; + readonly bufferedAmount: number; + bufferedAmountLowThreshold: number; + // binaryType: string; + + close(): void; + send(data: string | Blob | ArrayBuffer | ArrayBufferView): void; + + onopen: DataChannelEventHandler; + onmessage: DataChannelEventHandler; + onbufferedamountlow: DataChannelEventHandler; + // onerror: DataChannelEventHandler; + onclose: DataChannelEventHandler; +} + +// https://www.w3.org/TR/webrtc/#h-rtctrackevent +interface RTCTrackEvent extends Event { + readonly receiver: RTCRtpReceiver; + readonly track: MediaStreamTrack; + readonly streams: readonly MediaStream[]; + readonly transceiver: RTCRtpTransceiver; +} + +// https://www.w3.org/TR/webrtc/#h-rtcpeerconnectioniceevent +interface RTCPeerConnectionIceEvent extends Event { + readonly url: string | null; +} + +// https://www.w3.org/TR/webrtc/#h-rtcpeerconnectioniceerrorevent +interface RTCPeerConnectionIceErrorEvent extends Event { + readonly hostCandidate: string; + readonly url: string; + readonly errorCode: number; + readonly errorText: string; +} + +// https://www.w3.org/TR/webrtc/#h-rtcdatachannelevent +interface RTCDataChannelEvent { + readonly channel: RTCDataChannel; +} + +// https://www.w3.org/TR/webrtc/#idl-def-rtcpeerconnection +type PeerConnectionEventHandler = ((this: RTCPeerConnection, ev: E) => any) | null; +interface RTCPeerConnection extends EventTarget { + createOffer(options?: RTCOfferOptions): Promise; + createAnswer(options?: RTCAnswerOptions): Promise; + + setLocalDescription(description: RTCSessionDescriptionInit): Promise; + readonly localDescription: RTCSessionDescription | null; + readonly currentLocalDescription: RTCSessionDescription | null; + readonly pendingLocalDescription: RTCSessionDescription | null; + + setRemoteDescription(description: RTCSessionDescriptionInit): Promise; + readonly remoteDescription: RTCSessionDescription | null; + readonly currentRemoteDescription: RTCSessionDescription | null; + readonly pendingRemoteDescription: RTCSessionDescription | null; + + addIceCandidate(candidate?: RTCIceCandidateInit | RTCIceCandidate): Promise; + + readonly signalingState: RTCSignalingState; + readonly connectionState: RTCPeerConnectionState; + + getConfiguration(): RTCConfiguration; + setConfiguration(configuration: RTCConfiguration): void; + close(): void; + + onicecandidateerror: PeerConnectionEventHandler; + onconnectionstatechange: PeerConnectionEventHandler; + + // Extension: https://www.w3.org/TR/webrtc/#h-rtcpeerconnection-interface-extensions + getSenders(): RTCRtpSender[]; + getReceivers(): RTCRtpReceiver[]; + getTransceivers(): RTCRtpTransceiver[]; + addTrack(track: MediaStreamTrack, ...streams: MediaStream[]): RTCRtpSender; + removeTrack(sender: RTCRtpSender): void; + addTransceiver(trackOrKind: MediaStreamTrack | string, init?: RTCRtpTransceiverInit): RTCRtpTransceiver; + ontrack: PeerConnectionEventHandler; + + // Extension: https://www.w3.org/TR/webrtc/#h-rtcpeerconnection-interface-extensions-1 + readonly sctp: RTCSctpTransport | null; + createDataChannel(label: string | null, dataChannelDict?: RTCDataChannelInit): RTCDataChannel; + ondatachannel: PeerConnectionEventHandler; + + // Extension: https://www.w3.org/TR/webrtc/#h-rtcpeerconnection-interface-extensions-2 + getStats(selector?: MediaStreamTrack | null): Promise; + + // Extension: https://www.w3.org/TR/webrtc/#legacy-interface-extensions + // Deprecated! + createOffer( + successCallback: RTCSessionDescriptionCallback, + failureCallback: RTCPeerConnectionErrorCallback, + options?: RTCOfferOptions, + ): Promise; + setLocalDescription( + description: RTCSessionDescriptionInit, + successCallback: () => void, + failureCallback: RTCPeerConnectionErrorCallback, + ): Promise; + createAnswer( + successCallback: RTCSessionDescriptionCallback, + failureCallback: RTCPeerConnectionErrorCallback, + ): Promise; + setRemoteDescription( + description: RTCSessionDescriptionInit, + successCallback: () => void, + failureCallback: RTCPeerConnectionErrorCallback, + ): Promise; + addIceCandidate( + candidate: RTCIceCandidateInit | RTCIceCandidate, + successCallback: () => void, + failureCallback: RTCPeerConnectionErrorCallback, + ): Promise; + getStats( + selector: MediaStreamTrack | null, + successCallback: (report: RTCStatsReport) => void, + failureCallback: RTCPeerConnectionErrorCallback, + ): Promise; +} +interface RTCPeerConnectionStatic { + new(configuration?: RTCConfiguration, options?: any): RTCPeerConnection; + readonly defaultIceServers: RTCIceServer[]; + + // Extension: https://www.w3.org/TR/webrtc/#sec.cert-mgmt + generateCertificate(keygenAlgorithm: string): Promise; +} + +interface Window { + RTCPeerConnection: RTCPeerConnectionStatic; +} diff --git a/types/webrtc/ts5.9/index.d.ts b/types/webrtc/ts5.9/index.d.ts new file mode 100644 index 00000000000000..f950da1943286d --- /dev/null +++ b/types/webrtc/ts5.9/index.d.ts @@ -0,0 +1,2 @@ +/// +/// diff --git a/types/webrtc/ts5.9/test/MediaStream.ts b/types/webrtc/ts5.9/test/MediaStream.ts new file mode 100644 index 00000000000000..0668afab8bca95 --- /dev/null +++ b/types/webrtc/ts5.9/test/MediaStream.ts @@ -0,0 +1,36 @@ +const mediaStreamConstraints: MediaStreamConstraints = { audio: true, video: true }; + +const mediaTrackConstraintSet: MediaTrackConstraintSet = {}; +const mediaTrackConstraintArray: MediaTrackConstraintSet[] = []; +const mediaTrackConstraints: MediaTrackConstraints = mediaTrackConstraintSet; +const mediaTrackConstraints2: MediaTrackConstraints = { advanced: mediaTrackConstraintArray }; + +navigator.getUserMedia(mediaStreamConstraints, stream => { + const track: MediaStreamTrack = stream.getTracks()[0]; + console.log("label:" + track.label); + console.log("ended:" + track.readyState); + track.onended = (event: Event) => console.log("Track ended"); +}, error => { + console.log("Error message: " + error.message); + console.log("Error name: " + error.name); +}); + +navigator.webkitGetUserMedia(mediaStreamConstraints, stream => { + const track: MediaStreamTrack = stream.getTracks()[0]; + console.log("label:" + track.label); + console.log("ended:" + track.readyState); + track.onended = (event: Event) => console.log("Track ended"); +}, error => { + console.log("Error message: " + error.message); + console.log("Error name: " + error.name); +}); + +navigator.mozGetUserMedia(mediaStreamConstraints, stream => { + const track: MediaStreamTrack = stream.getTracks()[0]; + console.log("label:" + track.label); + console.log("ended:" + track.readyState); + track.onended = (event: Event) => console.log("Track ended"); +}, error => { + console.log("Error message: " + error.message); + console.log("Error name: " + error.name); +}); diff --git a/types/webrtc/ts5.9/test/RTCPeerConnection.ts b/types/webrtc/ts5.9/test/RTCPeerConnection.ts new file mode 100644 index 00000000000000..8ea9a2b858bf51 --- /dev/null +++ b/types/webrtc/ts5.9/test/RTCPeerConnection.ts @@ -0,0 +1,124 @@ +let defaultIceServers: RTCIceServer[] = window.RTCPeerConnection.defaultIceServers; +if (defaultIceServers.length > 0) { + const urls = defaultIceServers[0].urls; +} + +// Create a peer connection +let ice1: RTCIceServer = { + urls: "stun:stun.l.google.com:19302", + username: "john", + credential: "1234", +}; +let ice2: RTCIceServer = { urls: ["stun:stunserver.org", "stun:stun.example.com"] }; +let pc: RTCPeerConnection = new RTCPeerConnection({}); +let pc2: RTCPeerConnection = new RTCPeerConnection({ + iceServers: [ice1, ice2], +}); +window.RTCPeerConnection.generateCertificate("sha-256").then((cert: RTCCertificate) => { + new RTCPeerConnection({ + iceServers: [ice1], + iceTransportPolicy: "relay", + bundlePolicy: "max-compat", + rtcpMuxPolicy: "require", + peerIdentity: "dude", + certificates: [cert], + iceCandidatePoolSize: 5, + }); +}); + +// Get/set the configuration +let conf: RTCConfiguration = pc2.getConfiguration(); +pc.setConfiguration(conf); + +// Close peer connection +pc2.close(); + +// Offer/answer flow +pc.createOffer({ iceRestart: true }) + .then((offer: RTCSessionDescriptionInit) => { + pc.setLocalDescription(offer); + pc2.setRemoteDescription(offer); + pc2.createAnswer().then((answer: RTCSessionDescriptionInit) => { + pc2.setLocalDescription(answer); + pc.setRemoteDescription(answer); + }); + }); + +// Event handlers +pc.onnegotiationneeded = ev => console.log(ev.type); +pc.onicecandidate = ev => console.log(ev.candidate); +pc.onicecandidateerror = ev => console.log(ev.type); +pc.onsignalingstatechange = ev => console.log(ev.type); +pc.oniceconnectionstatechange = ev => console.log(ev.type); +pc.onicegatheringstatechange = ev => console.log(ev.type); +pc.onconnectionstatechange = ev => console.log(ev.type); +pc.ontrack = ev => console.log(ev.receiver); +pc.ondatachannel = ev => console.log(ev.channel); + +// State properties +console.log(pc.signalingState); +console.log(pc.iceGatheringState); +console.log(pc.iceConnectionState); +console.log(pc.connectionState); + +// Legacy interface extensions +pc.createOffer( + (sdp: RTCSessionDescription) => console.log(sdp.sdp), + (error: DOMException) => console.log(error.message), + { iceRestart: true }, +).then(() => console.log("createOffer complete")); +pc.setLocalDescription( + { type: "offer", sdp: "foobar" }, + () => console.log("local description set"), + (error: DOMException) => console.log(error.message), +).then(() => console.log("setLocalDescription complete")); +pc.createAnswer( + (sdp: RTCSessionDescription) => console.log(sdp.sdp), + (error: DOMException) => console.log(error.message), +).then(() => console.log("createAnswer complete")); +pc.setRemoteDescription( + { type: "answer", sdp: "foobar" }, + () => console.log("remote description set"), + (error: DOMException) => console.log(error.message), +).then(() => console.log("setRemoteDescription complete")); +pc.addIceCandidate( + { candidate: "candidate", sdpMid: "foo", sdpMLineIndex: 1 }, + () => console.log("candidate added"), + (error: DOMException) => console.log(error.message), +).then(() => console.log("addIceCandidate complete")); +pc.getStats( + null, + (report: RTCStatsReport) => console.log("got report"), + (error: DOMException) => console.log(error.message), +).then(() => console.log("getStats complete")); + +// RTCError +const error = new RTCError({ + errorDetail: "dtls-failure", + httpRequestStatusCode: 400, + receivedAlert: 1, + sctpCauseCode: 1, + sdpLineNumber: 1, + sentAlert: 1, +}); + +// RPCDtlsTransport +const dtlsTransport = pc.sctp!.transport; +dtlsTransport.onerror = (ev: RTCErrorEvent) => console.log(ev.error.errorDetail); +dtlsTransport.onstatechange = ev => console.log(ev.type); +dtlsTransport.addEventListener("error", (ev: RTCErrorEvent) => console.log(ev.error.errorDetail)); +dtlsTransport.addEventListener("statechange", ev => console.log(ev.type)); +console.log(dtlsTransport.state); + +// RPCIceTransport +const iceTransport = dtlsTransport.iceTransport; +iceTransport.onstatechange = ev => console.log(ev.type); +iceTransport.ongatheringstatechange = ev => console.log(ev.type); +iceTransport.onselectedcandidatepairchange = ev => console.log(ev.type); +iceTransport.addEventListener("statechange", ev => console.log(ev.type)); +iceTransport.addEventListener("ongatheringstatechange", ev => console.log(ev.type)); +iceTransport.addEventListener("onselectedcandidatepairchange", ev => console.log(ev.type)); +console.log(iceTransport.role); +console.log(iceTransport.gatheringState); +console.log(iceTransport.getSelectedCandidatePair()!.local); +console.log(iceTransport.getSelectedCandidatePair()!.remote); diff --git a/types/dhtmlxscheduler/tsconfig.json b/types/webrtc/ts5.9/tsconfig.json similarity index 71% rename from types/dhtmlxscheduler/tsconfig.json rename to types/webrtc/ts5.9/tsconfig.json index 60718d5db827fe..eab932800e5834 100644 --- a/types/dhtmlxscheduler/tsconfig.json +++ b/types/webrtc/ts5.9/tsconfig.json @@ -5,9 +5,9 @@ "es6", "dom" ], - "noImplicitAny": false, + "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": false, "types": [], "noEmit": true, @@ -15,6 +15,7 @@ }, "files": [ "index.d.ts", - "dhtmlxscheduler-tests.ts" + "test/MediaStream.ts", + "test/RTCPeerConnection.ts" ] } diff --git a/types/wicg-file-system-access/index.d.ts b/types/wicg-file-system-access/index.d.ts index 1a3d198217c303..f673c75b94af92 100644 --- a/types/wicg-file-system-access/index.d.ts +++ b/types/wicg-file-system-access/index.d.ts @@ -146,7 +146,7 @@ declare global { keys(): AsyncIterableIterator; values(): AsyncIterableIterator; entries(): AsyncIterableIterator<[string, FileSystemDirectoryHandle | FileSystemFileHandle]>; - [Symbol.asyncIterator]: FileSystemDirectoryHandle["entries"]; + [Symbol.asyncIterator](): AsyncIterableIterator<[string, FileSystemDirectoryHandle | FileSystemFileHandle]>; /** * @deprecated Old property just for Chromium <=85. Use `kind` property in the new API. */