diff --git a/notNeededPackages.json b/notNeededPackages.json index 7541a88848..38c0a39808 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -372,6 +372,12 @@ "sourceRepoURL": "https://github.com/elitechance/lambda-phi", "asOfVersion": "1.0.1" }, + { + "libraryName": "left-pad", + "typingsPackageName": "left-pad", + "sourceRepoURL": "https://github.com/stevemao/left-pad", + "asOfVersion": "1.2.0" + }, { "libraryName": "Linq.JS", "typingsPackageName": "linq", @@ -708,6 +714,12 @@ "sourceRepoURL": "https://github.com/JMPerez/spotify-web-api-js", "asOfVersion": "0.21.0" }, + { + "libraryName": "striptags", + "typingsPackageName": "striptags", + "sourceRepoURL": "https://github.com/ericnorris/striptags", + "asOfVersion": "3.1.1" + }, { "libraryName": "Sugar", "typingsPackageName": "sugar", diff --git a/types/accepts/index.d.ts b/types/accepts/index.d.ts index 08ac71e919..33ee0db8a1 100644 --- a/types/accepts/index.d.ts +++ b/types/accepts/index.d.ts @@ -1,13 +1,14 @@ // Type definitions for accepts 1.3 // Project: https://github.com/jshttp/accepts // Definitions by: Stefan Reichel +// Brice BERNARD // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace accepts { - interface Headers { - [key: string]: string | string[]; - } +/// +import { IncomingMessage } from "http"; + +declare namespace accepts { interface Accepts { /** * Return the first accepted charset. If nothing in `charsets` is accepted, then `false` is returned. @@ -55,6 +56,6 @@ declare namespace accepts { } } -declare function accepts(req: { headers: accepts.Headers }): accepts.Accepts; +declare function accepts(req: IncomingMessage): accepts.Accepts; export = accepts; diff --git a/types/add-zero/add-zero-tests.ts b/types/add-zero/add-zero-tests.ts new file mode 100644 index 0000000000..ac0509d26d --- /dev/null +++ b/types/add-zero/add-zero-tests.ts @@ -0,0 +1,3 @@ +import addZero from "add-zero"; + +addZero(5, 2); diff --git a/types/add-zero/index.d.ts b/types/add-zero/index.d.ts new file mode 100644 index 0000000000..907364a62d --- /dev/null +++ b/types/add-zero/index.d.ts @@ -0,0 +1,6 @@ +// Type definitions for add-zero 1.0 +// Project: https://github.com/rafaelrinaldi/add-zero#readme +// Definitions by: Giles Roadnight +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export default function addZero(value: string | number, digits?: number): string; diff --git a/types/striptags/tsconfig.json b/types/add-zero/tsconfig.json similarity index 86% rename from types/striptags/tsconfig.json rename to types/add-zero/tsconfig.json index 5823e343cd..e71d235cdf 100644 --- a/types/striptags/tsconfig.json +++ b/types/add-zero/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "striptags-tests.ts" + "add-zero-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/left-pad/tslint.json b/types/add-zero/tslint.json similarity index 100% rename from types/left-pad/tslint.json rename to types/add-zero/tslint.json diff --git a/types/agenda/index.d.ts b/types/agenda/index.d.ts index d170a6f6f1..426b187d7c 100644 --- a/types/agenda/index.d.ts +++ b/types/agenda/index.d.ts @@ -113,8 +113,8 @@ declare class Agenda extends EventEmitter { * @param options The options for the job. * @param handler The handler to execute. */ - define(name: string, handler: (job?: Agenda.Job, done?: (err?: Error) => void) => void): void; - define(name: string, options: Agenda.JobOptions, handler: (job?: Agenda.Job, done?: (err?: Error) => void) => void): void; + define(name: string, handler: (job: Agenda.Job, done: (err?: Error) => void) => void): void; + define(name: string, options: Agenda.JobOptions, handler: (job: Agenda.Job, done: (err?: Error) => void) => void): void; /** * Runs job name at the given interval. Optionally, data and options can be passed in. diff --git a/types/amcharts/index.d.ts b/types/amcharts/index.d.ts index 0dae492a76..4bb6631292 100644 --- a/types/amcharts/index.d.ts +++ b/types/amcharts/index.d.ts @@ -1549,7 +1549,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val /** Hides cursor. */ hideCursor(): void; /** You can force cursor to appear at specified cateogry or date. */ - showCursorAt(category: string): void; + showCursorAt(category: string | Date): void; /** Adds event listener of the type "changed" to the object. @param type Always "changed". @param handler Dispatched when cursor position is changed. "index" is a series index over which chart cursors currently is. "zooming" specifies if user is currently zooming (is selecting) the chart. mostCloseGraph property is set only when oneBalloonOnly is set to true.*/ @@ -1652,6 +1652,727 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val zoomToIndexes(start: Date, end: Date): void; } + // AmAngularGauge Extension for AmChart to create gauge charts. + class AmAngularGauge extends AmChart { + /** When enabled, chart adds aria-label attributes to columns, bullets or map objects. You can control values of these labels using properties like accessibleLabel of AmGraph. Note, not all screen readers support these tags. We tested this mostly with NVDA Screen reader. WAI-ARIA is now official W3 standard, so in future more readers will handle this well. We will be improving accessibility on our charts, so we would be glad to hear your feedback. + @default true + */ + accessible: boolean; + + /** Description which will be added to node of SVG element. Most of the screen readers will read this description. */ + accessibleDescription: string; + + /** Description which is added to of a SVG element. Some of the screen readers will read this description. */ + accessibleTitle: string; + + /** Specifies, if class names should be added to chart elements. + @default false + */ + addClassNames: boolean; + + /** Uses the whole space of the canvas to draw the gauge. + @default true + */ + adjustSize: boolean; + + /** Array of Labels. Example of label object, with all possible properties: + {"x": 20, "y": 20, "text": "this is label", "align": "left", "size": 12, "color": "#CC0000", "alpha": 1, "rotation": 0, "bold": true, "url": "http://www.amcharts.com"} + @default [] + */ + allLabels: [Label] + + /** Array of arrows. */ + arrows: [GaugeArrow]; + + /** If you set it to true the chart will automatically monitor changes of display style of chart’s container (or any of it’s parents) and will render chart correctly if it is changed from none to block. We recommend setting it to true if you change this style at a run time, as it affects performance a bit. + @default false + */ + autoDisplay: boolean; + + /** Set this to false if you don't want chart to resize itself whenever its parent container size changes. + @default true + */ + autoResize: boolean; + + /** If you set it to true and your chart div (or any of the parent div) has css scale applied, the chart will position mouse at a correct position. Default value is false because this operation consumes some CPU and quite a few people are using css transfroms. + @default false + */ + autoTransform: boolean; + + /** Array of axes. + @default [GaugeAxis] + */ + axes: [GaugeAxis]; + + /** Opacity of background. Set it to >0 value if you want backgroundColor to work. However we recommend changing div's background-color style for changing background color. + @default 0 + */ + backgroundAlpha: number; + + /** Background color. You should set backgroundAlpha to >0 value in order background to be visible. We recommend setting background color directly on a chart's DIV instead of using this property. + @default #FFFFFF + */ + backgroundColor: string; + + /** The chart creates AmBalloon class itself. If you want to customize balloon, get balloon instance using this property, and then change balloon's properties. + @default AmBalloon + */ + balloon: AmBalloon; + + /** Opacity of chart's border. Value range is 0 - 1. + @default 0 + */ + borderAlpha: number; + + /** Color of chart's border. You should set borderAlpha >0 in order border to be visible. We recommend setting border color directly on a chart's DIV instead of using this property. + @default #000000 + */ + borderColor: string; + + /** This prefix is added to all class names which are added to all visual elements of a chart in case addClassNames is set to true. + @default amcharts + */ + classNamePrefix: string; + + /** In case you use gauge to create a clock, set this to true. + @default false + */ + clockWiseOnly: boolean; + + /** Text color. + @default #000000 + */ + color: string; + + /** Non-commercial version only. Specifies position of link to amCharts site. Allowed values are: top-left, top-right, bottom-left and bottom-right. + @default 'top - left' + */ + creditsPosition: string; + + /** A config object for Data Loader plugin. Please refer to the following page for more information. */ + dataLoader: Object; + + /** Array of data objects, for example: [{country:"US", value:524},{country:"UK", value:624},{country:"Lithuania", value:824}]. You can have any number of fields and use any field names. In case of AmMap, data provider should be MapData object. + + The data set data. + + Important: if you are using date/time-based category axis, the data points needs to come pre-ordered in ascending order. Data with incorrect order might result in visual and functional glitches on the chart. */ + dataProvider: [Object]; + + /** Decimal separator. + @default . + */ + decimalSeparator: string; + + /** Using this property you can add any additional information to SVG, like SVG filters or clip paths. The structure of this object should be identical to XML structure of a object you are adding, only in JSON format. */ + defs: Object; + + /** Export config. Specifies how export to image/data export/print/annotate menu will look and behave. You can find a lot of examples in amcharts/plugins/export folder. More details can be found here. */ + export: ExportSettings; + + /** Gauge face opacity. + @default 0 + */ + faceAlpha: number; + + /** Gauge face border opacity. + @default 0 + */ + faceBorderAlpha: number; + + /** Gauge face border color. + @default #555555 + */ + faceBorderColor: string; + + /** Gauge face border width. + @default 1 + */ + faceBorderWidth: number; + + /** Gauge face color, requires faceAlpha > 0 + @default #FAFAFA + */ + faceColor: string; + + /** Gauge face image-pattern. + Example: {"url":"../amcharts/patterns/black/pattern1.png", "width":4, "height":4} + fontFamily String Verdana Font family. + fontSize Number 11 Font size. */ + facePattern: Object; + + /** Gauge's horizontal position in pixel, origin is the center. Centered by default. */ + gaugeX: number; + + /** Gauge's vertical position in pixel, origin is the center. Centered by default. */ + gaugeY: number; + + /** If you set this to true, the lines of the chart will be distorted and will produce hand-drawn effect. Try to adjust chart.handDrawScatter and chart.handDrawThickness properties for a more scattered result. + @default false + */ + handDrawn: boolean; + + /** Defines by how many pixels hand-drawn line (when handDrawn is set to true) will fluctuate. + @default 2 + */ + handDrawScatter: number; + + /** Defines by how many pixels line thickness will fluctuate (when handDrawn is set to true). + @default 1 + */ + handDrawThickness: number; + + /** Time, in milliseconds after which balloon is hidden if the user rolls-out of the object. Might be useful for AmMap to avoid balloon flickering while moving mouse over the areas. Note, this is not duration of fade-out. Duration of fade-out is set in AmBalloon class. + @default 150 + */ + hideBalloonTime: number; + + /** Allows changing language easily. Note, you should include language js file from amcharts/lang or ammap/lang folder and then use variable name used in this file, like chart.language = "de"; Note, for maps this works differently - you use language only for country names, as there are no other strings in the maps application. */ + language: string; + + /** Legend of a chart. */ + legend: AmLegend; + + /** Read-only. Reference to the div of the legend. */ + legendDiv: HTMLElement; + + /** You can add listeners of events using this property. Example: listeners = [{"event":"dataUpdated", "method":handleEvent}]; + @default [Object] + */ + listeners: [Object]; + + /** Bottom spacing between chart and container. + @default 10 + */ + marginBottom: number; + + /** Left-hand spacing between chart and container. + @default 10 + */ + marginLeft: number; + + /** Right-hand spacing between chart and container. + @default 10 + */ + marginRight: number; + + /** Top spacing between chart and container. + @default 10 + */ + marginTop: number; + + /** Minimum radius of a gauge. + @default 10 + */ + minRadius: number; + + /** This setting affects touch-screen devices only. If a chart is on a page, and panEventsEnabled are set to true, the page won't move if the user touches the chart first. If a chart is big enough and occupies all the screen of your touch device, the user won’t be able to move the page at all. If you think that selecting/panning the chart or moving/pinching the map is a primary purpose of your users, you should set panEventsEnabled to true, otherwise - false. + @default true + */ + panEventsEnabled: boolean; + + /** Specifies absolute or relative path to amCharts files, i.e."amcharts/". (where all.js files are located) + If relative URLs are used, they will be relative to the current web page, displaying the chart. + You can also set path globally, using global JavaScript variable AmCharts_path.If this variable is set, and "path" is not set in chart config, the chart will assume the path from the global variable.This allows setting amCharts path globally.I.e.: + var AmCharts_path = "/libs/amcharts/"; + "path" parameter will be used by the charts to locate it's files, like images, plugins or patterns. + @default 'amcharts/' + */ + path: string; + + /** Specifies path to the folder where images like resize grips, lens and similar are. + + IMPORTANT: Since V3.14.12, you should use "path" to point to amCharts directory instead. The "pathToImages" will be automatically set and does not need to be in the chart config, unless you keep your images separately from other amCharts files. */ + pathToImages: string; + + /** Precision of percent values. -1 means percent values won't be rounded at all and show as they are. + @default 2 + */ + percentPrecision: number; + + /** Precision of values. -1 means values won't be rounded at all and show as they are. + @default -1 + */ + precision: number; + + /**Prefixes which are used to make big numbers shorter: 2M instead of 2000000, etc.Prefixes are used on value axes and in the legend.To enable prefixes, set usePrefixes property to true. + @default [{ "number": 1e+3, "prefix": "k" }, { "number": 1e+6, "prefix": "M" }, { "number": 1e+9, "prefix": "G" }, { "number": 1e+12, "prefix": "T" }, { "number": 1e+15, "prefix": "P" }, { "number": 1e+18, "prefix": "E" }, { "number": 1e+21, "prefix": "Z" }, { "number": 1e+24, "prefix": "Y" }] + */ + prefixesOfBigNumbers: [Object]; + + /** Prefixes which are used to make small numbers shorter: 2μ instead of 0.000002, etc.Prefixes are used on value axes and in the legend.To enable prefixes, set usePrefixes property to true. + @default [{ "number": 1e-24, "prefix": "y" }, { "number": 1e-21, "prefix": "z" }, { "number": 1e-18, "prefix": "a" }, { "number": 1e-15, "prefix": "f" }, { "number": 1e-12, "prefix": "p" }, { "number": 1e-9, "prefix": "n" }, { "number": 1e-6, "prefix": "μ" }, { "number": 1e-3, "prefix": "m" }] + */ + prefixesOfSmallNumbers: [Object]; + + /** If processTimeout is > 0, 1000 data items will be parsed at a time, then the chart will make pause and continue parsing data until it finishes. + @default 1000 + */ + processCount: number; + + /** If you set it to 1 millisecond or some bigger value, chart will be built in chunks instead of all at once. This is useful if you work with a lot of data and the initial build of the chart takes a lot of time, which freezes the whole web application by not allowing other processes to do their job while the chart is busy. + @default 0 + */ + processTimeout: number; + + /** A config object for Responsive plugin. Please refer to the following page for more information. */ + responsive: Object + + /** Duration of arrow animation. + @default 1 + */ + startDuration: number; + + /** Transition effect of the arrows, possible effects: easeOutSine, easeInSine, elastic, bounce. + @default easeInSine + */ + startEffect: string; + + /** Charts will use SVG icons (some are loaded from images folder and some are drawn inline) if browser supports SVG. his makes icons look good on retina displays on all resolutions. + @default true + */ + svgIcons: boolean; + + /** Charts which require gestures like swipe (charts with scrollbar/cursor) or pinch (maps) used to prevent regular page scrolling and could result page to stick to the same spot if the chart occupied whole screen. Now, in order these gestures to start working user has to touch the chart/maps once. Regular touch events like touching on the bar/slice/map area do not require the first tap and will show balloons and perform other tasks as usual. If you have a map or chart which occupies full screen and your page does not require scrolling, set tapToActivate to false – this will bring old behavior back. + @default true + */ + tapToActivate: boolean; + + /** Theme of a chart. Config files of themes can be found in amcharts/themes/ folder. More info about using themes. + @default none + */ + theme: string; + + /** Thousands separator. + @default , + */ + thousandsSeparator: string; + + /** Array of Title objects. + @default [] + */ + titles: [Title]; + + /** If you set it to 200 (milliseconds) or so, the chart will fire clickGraphItem or clickSlice (AmSlicedChart) or clickMapObject only if user holds his/her finger for 0.2 seconds (200 ms) on the column/bullet/slice/map object. + @default 0 + */ + touchClickDuration: number; + + /** Type of a chart. Required when creating chart using JSON. Possible types are: serial, pie, xy, radar, funnel, gauge, map, gantt, stock. */ + type: string; + + /** If true, prefixes will be used for big and small numbers.You can set arrays of prefixes via prefixesOfSmallNumbers and prefixesOfBigNumbers properties. + @default false + */ + usePrefixes: boolean; + + /** Read-only. Indicates current version of a script. */ + version: string; + + /** Adds arrow to the chart. */ + addArrow(arrow: GaugeArrow): void; + + /** Adds axis to angular gauge. */ + addAxis(axis: GaugeAxis): void; + + /** Adds a label on a chart. You can use it for labeling axes, adding chart title, etc. x and y coordinates can be set in number, percent, or a number with ! in front of it - coordinate will be calculated from right or bottom instead of left or top. */ + addLabel(x: number, y: number, text: string, align: string, size: number, color: string, rotation: number, alpha: number, bold: boolean, url: string): void; + + /** Adds a legend to the chart. By default, you don't need to create div for your legend, however if you want it to be positioned in some different way, you can create div anywhere you want and pass id or reference to your div as a second parameter. (NOTE: This method will not work on StockPanel.) */ + addLegend(legend: AmLegend, legendDivId?: string): void; + /** Adds a legend to the chart. + By default, you don't need to create div for your legend, however if you want it to be positioned in some different way, you can create div anywhere you want and pass id or reference to your div as a second parameter. + (NOTE: This method will not work on StockPanel.) + @param legend + @param legendDiv - Legend div (optional). + */ + addLegend(legend: AmLegend, legendDiv: HTMLElement): void; + + /** Adds event listener to the object. */ + addListener(type: string, handler: Function): void; + + /** Adds title to the top of the chart. Pie, Radar positions are updated so that they won't overlap. Plot area of Serial/XY chart is also updated unless autoMargins property is set to false. You can add any number of titles - each of them will be placed in a new line. To remove titles, simply clear titles array: chart.titles = []; and call chart.validateNow() method. */ + addTitle(text: string, size: number, color: string, alpha: number, bold: boolean): void; + + /** Clears the chart area, intervals, etc. */ + clear(): void; + + /** Removes all labels added to the chart. */ + clearLabels(): void; + + /** Use this method to force the chart to resize to it's current container size. */ + invalidateSize(): void; + + /** This method allows to create charts with a single config. */ + makeChart(container: string, config: any, delay: number): AmChart; + + /** Removes arrow from the chart. */ + removeArrow(arrow: GaugeArrow): void; + + /** Removes axis from the chart. */ + removeAxis(axis: GaugeAxis): void; + + /** Removes chart's legend. */ + removeLegend(): void; + + /** Removes event listener from chart object. */ + removeListener(chart: AmChart, type: string, handler: any): void; + + /** This method should be called after data in your data provider changed or a new array was set to dataProvider. After calling this method the chart will parse data and redraw. */ + validateData(): void; + + /** This method should be called after you changed one or more properties of any class. The chart will redraw after this method is called.Both attributes, validateData and skipEvents are optional (false by default). */ + validateNow(): void; + + /** Adds chart to the specified DIV. + @param container DIV object which will hold the chart. */ + write(container: HTMLElement): void; + /** Adds chart to the specified DIV. + @param container Id of a DIV which will hold the chart. */ + write(container: string): void; + } + + class GaugeArrow { + /** Opacity of an arrow. + @default 1 + */ + alpha: number; + + /** Axis of the arrow. You can use reference to the axis or id of the axis. If you don't set any axis, the first axis of a chart will be used. + @default GaugeAxis + */ + axis: GaugeAxis + + /** Opacity of arrow border. + @default 1 + */ + borderAlpha: number; + + /** In case you need the arrow to rotate only clock-wise, set this property to true. + @default false + */ + clockWiseOnly: boolean; + + /** Color of an arrow. + @default #000000 + */ + color: string; + + /** Unique id of an arrow. */ + id: string; + + /** Inner radius of an arrow. + @default 0 + */ + innerRadius: any; + + /** Opacity of a nail, holding the arrow. + @default 1 + */ + nailAlpha: number; + + /** Opacity of nail border. + @default 0 + */ + nailBorderAlpha: number; + + /** Thickness of nail border. + @default 1 + */ + nailBorderThickness: number; + + /** Radius of a nail, holding the arrow. + @default 8 + */ + nailRadius: number; + + /** Radius of an arrow. + @default '90%' + */ + radius: any; + + /** Width of arrow root. + @default 8 + */ + startWidth: number; + + /** Value to which the arrow should point at. */ + value: number; + + /** Sets value for the arrow. Arrow will animate to this value if you do it after chart is written to it's container. */ + setValue(value: number): void; + } + + class GaugeAxis { + /** Axis opacity. + @default 1 + */ + axisAlpha: number; + + /** Axis color. + @default #000000 + */ + axisColor: string; + + /** Thickness of the axis outline. + @default 1 + */ + axisThickness: number; + + /** Opacity of band fills. + @default 1 + */ + bandAlpha: number; + + /** Example: [-0.2, 0, -0.2]. Will make bands to be filled with color gradients. Negative value means the color will be darker than the original, and positive number means the color will be lighter. + @default [] + */ + bandGradientRatio: [number]; + + /** Opacity of band outlines. + @default 0 + */ + bandOutlineAlpha: number; + + /** Color of band outlines. + @default #000000 + */ + bandOutlineColor: string; + + /** Thickness of band outlines. + @default 0 + */ + bandOutlineThickness: number; + + /** Array of bands - GaugeBand objects. Bands are used to draw color fills between specified values. */ + bands: [GaugeBand]; + + /** Text displayed below the axis center. */ + bottomText: string; + + /** Specifies if text should be bold. + @default true + */ + bottomTextBold: boolean; + + /** Bottom text color. */ + bottomTextColor: string; + + /** Font size of bottom text. */ + bottomTextFontSize: number; + + /** Y offset of bottom text. + @default 0 + */ + bottomTextYOffset: number; + + /** X position of the axis, relative to the center of the gauge. + @default '0%' + */ + centerX: any; + + /** Y position of the axis, relative to the center of the gauge. + @default '0%' + */ + centerY: any; + + /** Specifies labels color of the axis. */ + color: string + + /** Axis end angle. Valid values are from - 180 to 180. + @default 120 + */ + endAngle: number; + + /** Axis end (max) value */ + endValue: number; + + /** Font size for axis labels. */ + fontSize: number; + + /** Number of grid lines. Note, GaugeAxis doesn't adjust gridCount, so you should check your values and choose a proper gridCount which would result grids at round numbers. + @default 5 + */ + gridCount: number; + + /** Specifies if grid should be drawn inside or outside the axis. + @default true + */ + gridInside: boolean; + + /** Unique id of an axis. */ + id: any; + + /** Specifies if labels should be placed inside or outside the axis. + @default true + */ + inside: boolean; + + /** Frequency of labels. + @default 1 + */ + labelFrequency: number; + + /** You can use this function to format axis labels. This function is called and value is passed as a attribute: labelFunction(value); */ + labelFunction: Function; + + /** Distance from axis to the labels. + @default 15 + */ + labelOffset: number; + + /** Specifies if labels on the axis should be shown. + @default true + */ + labelsEnabled: boolean; + + /** You can add listeners of events using this property. Example: listeners = [{"event":"clickBand", "method":handleClick}]; */ + listeners: Object[]; + + /** Interval, at which minor ticks should be placed. */ + minorTickInterval: number; + + /** Length of a minor tick. + @default 5 + */ + minorTickLength: number + + /** Axis radius. + @default '95%' + */ + radius: any; + + /** Specifies if the first label should be shown. + @default true + */ + showFirstLabel: boolean; + + /** Specifies if the last label should be shown. + @default true + */ + showLastLabel: boolean; + + /** Axis start angle. Valid values are from - 180 to 180. + @default -120 + */ + startAngle: number; + + /** Axis start (min) value. + @default 0 + */ + startValue: number; + + /** Opacity of axis ticks. + @default 1 + */ + tickAlpha: number; + + /** Color of axis ticks. + @default #555555 + */ + tickColor: string; + + /** Length of a major tick. + @default 10 + */ + tickLength: number; + + /** Tick thickness. + @default 1 + */ + tickThickness: number; + + /** Text displayed above the axis center. */ + topText: string + + /** Specifies if text should be bold. + @default true + */ + topTextBold: boolean; + + /** Color of top text. */ + topTextColor: string + + /** Font size of top text. */ + topTextFontSize: number + + /** Y offset of top text. + @default 0 + */ + topTextYOffset: number; + + /** A string which can be placed next to axis labels. */ + unit: string; + + /** Position of the unit. + @default right + */ + unitPosition: string; + + /** Specifies if small and big numbers should use prefixes to make them more readable. + @default false + */ + usePrefixes: boolean; + + /** Interval, at which ticks with values should be placed. */ + valueInterval: number; + + /** Adds event listener to the object. */ + addListener(type: string, handler: any); + + /** Removes event listener from chart object. */ + removeListener(chart: AmChart, type: string, handler: any); + + /** Sets bottom text. */ + setBottomText(text: string); + + /** Sets top text. */ + setTopText(textstring); + + /** Returns angle of the value. */ + value2angle(value: number); + } + + class GaugeBand { + /** Opacity of band fill. Will use axis.bandAlpha if not set any. */ + alpha: number; + + /** When rolled-over, band will display balloon if you set some text for this property. */ + balloonText: string; + + /** Color of a band. */ + color: string; + + /** End value of a fill. */ + endValue: number + + /** Example: [-0.2, 0, -0.2]. Will make bands to be filled with color gradients. Negative value means the color will be darker than the original, and positive number means the color will be lighter. + @default [] + */ + gradientRatio: [number]; + + /** Unique id of a band. */ + id: string; + + /** Inner radius of a band. If not set any, the band will end with the end of minor ticks. Set 0 if you want the band to be drawn to the axis center. */ + innerRadius: any; + + /** Band radius. If not set any, the band will start with the axis outline. */ + radius: any; + + /** Start value of a fill. */ + startValue: number; + + /** Gauge band can be clickable and can lead to some page. */ + url: string; + + /** Sets end value for the band. */ + setEndValue(value); + + /** Sets start value for the band. */ + setStartValue(value); + } + class PeriodSelector { /** Date format of date input fields. Check [[http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/formatters/DateFormatter.html DD-MM-YYYY */ dateFormat: string; diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index 88a59bdd2a..15d4d6a137 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -6,8 +6,6 @@ * License: MIT */ -/* tslint:disable:no-empty no-shadowed-variable */ - class AuthService { /** * Holds all the requests which failed due to 401 response, diff --git a/types/appdmg/appdmg-tests.ts b/types/appdmg/appdmg-tests.ts new file mode 100644 index 0000000000..47800d622f --- /dev/null +++ b/types/appdmg/appdmg-tests.ts @@ -0,0 +1,47 @@ +import appdmg = require("appdmg"); +import { Options, Specification, SpecificationOptions } from "appdmg"; + +const proc = appdmg({ + target: "/foo/bar.dmg", + basepath: "/baz", + specification: { + title: "Happy", + icon: "happy.icns", + background: "happy.tiff", + format: "UDBZ", + "icon-size": 98, + contents: [ + { + x: 405, + y: 150, + type: "link", + path: "/Applications" + }, + { + x: 127, + y: 150, + type: "file", + path: "/foo/bar.app" + } + ] + } +}); + +proc.on("progress", info => { + if (info.type === "step-begin") { + process.stdout.write(`${info.title}... `); + } + + if (info.type === "step-end") { + process.stdout.write(`${info.status}\n`); + } +}); + +proc.on("finish", () => { + console.log('Installer was created successfully!'); +}); + +proc.on("error", (err) => { + console.error('Installer could not be created', err); + process.exit(1); +}); diff --git a/types/appdmg/index.d.ts b/types/appdmg/index.d.ts new file mode 100644 index 0000000000..2e23009f44 --- /dev/null +++ b/types/appdmg/index.d.ts @@ -0,0 +1,70 @@ +// Type definitions for appdmg 0.5 +// Project: https://github.com/LinusU/node-appdmg#readme +// Definitions by: Daniel Perez Alvarez +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace appdmg { + interface Progress { + current: number; + total: number; + type: "step-begin" | "step-end"; + title: string; + status: "ok" | "skip" | "fail"; + } + + interface EventEmitter extends NodeJS.EventEmitter { + on(event: "progress", listener: (info: Progress) => void): this; + on(event: "finish", listener: () => void): this; + on(event: "error", listener: (err: any) => void): this; + } + + interface SpecificationOptions { + app: string; + background: string; + icon: string; + iconSize: number; + title: string; + } + + interface SpecificationWindow { + position?: { x: number; y: number }; + size?: { width: number; height: number }; + } + + interface SpecificationContents { + x: number; + y: number; + type: "link" | "file" | "position"; + path: string; + name?: string; + } + + interface SpecificationCodeSign { + "signing-identity": string; + identifier?: string; + } + + interface Specification { + title: string; + icon?: string; + background?: string; + "background-color"?: string; + "icon-size"?: number; + window?: SpecificationWindow; + format: "UDRW" | "UDRO" | "UDCO" | "UDZO" | "UDBZ" | "ULFO"; + contents: SpecificationContents[]; + "code-sign"?: SpecificationCodeSign; + } + + interface Options { + target: string; + basepath: string; + specification: Specification; + } +} + +declare function appdmg(options?: appdmg.Options): appdmg.EventEmitter; + +export = appdmg; diff --git a/types/left-pad/tsconfig.json b/types/appdmg/tsconfig.json similarity index 94% rename from types/left-pad/tsconfig.json rename to types/appdmg/tsconfig.json index 383ebedf76..f4ca0f95c5 100644 --- a/types/left-pad/tsconfig.json +++ b/types/appdmg/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "left-pad-tests.ts" + "appdmg-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/appdmg/tslint.json b/types/appdmg/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/appdmg/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/ascii2mathml/ascii2mathml-tests.ts b/types/ascii2mathml/ascii2mathml-tests.ts index 7280900922..cbd63e649f 100644 --- a/types/ascii2mathml/ascii2mathml-tests.ts +++ b/types/ascii2mathml/ascii2mathml-tests.ts @@ -1,6 +1,6 @@ import * as ascii2mathml from 'ascii2mathml'; -const fn = ascii2mathml({}); // $ExpectType any +const fn = ascii2mathml({}); // $ExpectType ascii2mathml fn(''); // $ExpectType string ascii2mathml('', {}); // $ExpectType string diff --git a/types/asynciterator/index.d.ts b/types/asynciterator/index.d.ts index a7be809137..950fb16bbd 100644 --- a/types/asynciterator/index.d.ts +++ b/types/asynciterator/index.d.ts @@ -9,16 +9,16 @@ import { EventEmitter } from "events"; export abstract class AsyncIterator extends NodeJS.EventEmitter { - protected static STATES: ['INIT', 'OPEN', 'CLOSING', 'CLOSED', 'ENDED']; - protected static INIT: 0; - protected static OPEN: 1; - protected static CLOSING: 2; - protected static CLOSED: 3; - protected static ENDED: 4; + static STATES: ['INIT', 'OPEN', 'CLOSING', 'CLOSED', 'ENDED']; + static INIT: 0; + static OPEN: 1; + static CLOSING: 2; + static CLOSED: 3; + static ENDED: 4; - protected _state: number; - protected _readable: boolean; - protected _destination?: AsyncIterator; + _state: number; + _readable: boolean; + _destination?: AsyncIterator; readable: boolean; closed: boolean; @@ -30,11 +30,11 @@ export abstract class AsyncIterator extends NodeJS.EventEmitter { each(callback: (data: T) => void, self?: any): void; close(): void; - protected _changeState(newState: number, eventAsync?: boolean): void; + _changeState(newState: number, eventAsync?: boolean): void; private _hasListeners(eventName: string | symbol): boolean; // tslint:disable-next-line ban-types private _addSingleListener(eventName: string | symbol, listener: Function): void; - protected _end(): void; + _end(): void; getProperty(propertyName: string, callback?: (value: any) => void): any; setProperty(propertyName: string, value: any): void; @@ -43,7 +43,7 @@ export abstract class AsyncIterator extends NodeJS.EventEmitter { copyProperties(source: AsyncIterator, propertyNames: string[]): void; toString(): string; - protected _toStringDetails(): string; + _toStringDetails(): string; transform(options?: SimpleTransformIteratorOptions): SimpleTransformIterator; map(mapper: (item: T) => T2, self?: object): SimpleTransformIterator; @@ -78,9 +78,9 @@ export interface IntegerIteratorOptions { } export class IntegerIterator extends AsyncIterator { - protected _step: number; - protected _last: number; - protected _next: number; + _step: number; + _last: number; + _next: number; constructor(options?: IntegerIteratorOptions); } @@ -92,16 +92,16 @@ export interface BufferedIteratorOptions { export class BufferedIterator extends AsyncIterator { maxBufferSize: number; - protected _pushedCount: number; - protected _buffer: T[]; + _pushedCount: number; + _buffer: T[]; - protected _init(autoStart: boolean): void; - protected _begin(done: () => void): void; - protected _read(count: number, done: () => void): void; - protected _push(item: T): void; - protected _fillBuffer(): void; - protected _completeClose(): void; - protected _flush(done: () => void): void; + _init(autoStart: boolean): void; + _begin(done: () => void): void; + _read(count: number, done: () => void): void; + _push(item: T): void; + _fillBuffer(): void; + _completeClose(): void; + _flush(done: () => void): void; constructor(options?: BufferedIteratorOptions); } @@ -112,12 +112,12 @@ export interface TransformIteratorOptions extends BufferedIteratorOptions { } export class TransformIterator extends BufferedIterator { - protected _optional: boolean; + _optional: boolean; source: AsyncIterator; - protected _validateSource(source: AsyncIterator, allowDestination?: boolean): void; - protected _transform(item: S, done: (result: T) => void): void; - protected _closeWhenDone(): void; + _validateSource(source: AsyncIterator, allowDestination?: boolean): void; + _transform(item: S, done: (result: T) => void): void; + _closeWhenDone(): void; constructor(source?: AsyncIterator | TransformIteratorOptions, options?: TransformIteratorOptions); } @@ -134,16 +134,16 @@ export interface SimpleTransformIteratorOptions extends TransformIteratorO } export class SimpleTransformIterator extends TransformIterator { - protected _offset: number; - protected _limit: number; - protected _prepender?: ArrayIterator; - protected _appender?: ArrayIterator; + _offset: number; + _limit: number; + _prepender?: ArrayIterator; + _appender?: ArrayIterator; - protected _filter?(item: S): boolean; - protected _map?(item: S): T; - protected _transform(item: S, done: (result: T) => void): void; + _filter?(item: S): boolean; + _map?(item: S): T; + _transform(item: S, done: (result: T) => void): void; - protected _insert(inserter: AsyncIterator, done: () => void): void; + _insert(inserter: AsyncIterator, done: () => void): void; constructor(source?: AsyncIterator | SimpleTransformIteratorOptions, options?: SimpleTransformIteratorOptions); @@ -152,7 +152,7 @@ export class SimpleTransformIterator extends TransformIterator { export class MultiTransformIterator extends TransformIterator { _transformerQueue: S[]; - protected _createTransformer(): AsyncIterator; + _createTransformer(element: S): AsyncIterator; constructor(source?: AsyncIterator | TransformIteratorOptions, options?: TransformIteratorOptions); } diff --git a/types/auth0-js/auth0-js-tests.ts b/types/auth0-js/auth0-js-tests.ts index d425cca21a..d05ee2251e 100644 --- a/types/auth0-js/auth0-js-tests.ts +++ b/types/auth0-js/auth0-js-tests.ts @@ -174,6 +174,23 @@ webAuth.login({username: 'bar', password: 'foo'}, (err, data) => {}); webAuth.crossOriginAuthenticationCallback(); +webAuth.checkSession({ + audience: 'https://mystore.com/api/v2', + scope: 'read:order write:order', + redirectUri: 'https://example.com/auth/silent-callback' + }, (err, authResult) => { + // Authentication tokens or error +}); + +webAuth.checkSession({ + audience: 'https://mystore.com/api/v2', + scope: 'read:order write:order', + redirectUri: 'https://example.com/auth/silent-callback', + usePostMessage: true + }, (err, authResult) => { + // Renewed tokens or error +}); + const authentication = new auth0.Authentication({ domain: 'me.auth0.com', clientID: '...', diff --git a/types/auth0-js/index.d.ts b/types/auth0-js/index.d.ts index 340f14e15b..6110f2fe52 100644 --- a/types/auth0-js/index.d.ts +++ b/types/auth0-js/index.d.ts @@ -268,6 +268,14 @@ export class WebAuth { * @param options: */ passwordlessVerify(options: PasswordlessVerifyOptions, callback: Auth0Callback): void; + + /** + * Renews an existing session on Auth0's servers using `response_mode=web_message` (i.e. Auth0's hosted login page) + * + * @param options options used in {@link authorize} call + * @param callback: any(err, token_payload) + */ + checkSession(options: CheckSessionOptions, callback: Auth0Callback): void; } export class Redirect { @@ -753,3 +761,10 @@ export interface AuthorizeOptions { scope?: string; audience?: string; } + +export interface CheckSessionOptions extends AuthorizeOptions { + /** + * optional parameter for auth0 to use postMessage to communicate between the silent callback and the SPA. + */ + usePostMessage?: boolean; +} diff --git a/types/auth0-lock/auth0-lock-tests.ts b/types/auth0-lock/auth0-lock-tests.ts index 0642453a13..c2107b11e4 100644 --- a/types/auth0-lock/auth0-lock-tests.ts +++ b/types/auth0-lock/auth0-lock-tests.ts @@ -10,6 +10,17 @@ lock.show(); lock.hide(); lock.logout(() => {}); +lock.checkSession({}, function(error: auth0.Auth0Error, authResult: AuthResult): void { + if (error || !authResult) { + lock.show(); + } else { + // user has an active session, so we can use the accessToken directly. + lock.getUserInfo(authResult.accessToken, function(error, profile) { + console.log(error, profile); + }); + } +}); + // Show supports UI arguments const showOptions : Auth0LockShowOptions = { @@ -37,7 +48,7 @@ lock.show(showOptions); // "on" event-driven example -lock.on("authenticated", function(authResult : any) { +lock.on("authenticated", function(authResult: AuthResult) { lock.getProfile(authResult.idToken, function(error: auth0.Auth0Error, profile: auth0.Auth0UserProfile) { if (error) { // Handle error @@ -49,7 +60,7 @@ lock.on("authenticated", function(authResult : any) { }); }); -lock.on("authenticated", function(authResult : any) { +lock.on("authenticated", function(authResult: AuthResult) { lock.getUserInfo(authResult.accessToken, function(error, profile) { if (error) { // Handle error diff --git a/types/auth0-lock/index.d.ts b/types/auth0-lock/index.d.ts index 0a57d988ce..8ed6b50c87 100644 --- a/types/auth0-lock/index.d.ts +++ b/types/auth0-lock/index.d.ts @@ -154,6 +154,7 @@ interface Auth0LockStatic { // deprecated getProfile(token: string, callback: (error: auth0.Auth0Error, profile: auth0.Auth0UserProfile) => void): void; getUserInfo(token: string, callback: (error: auth0.Auth0Error, profile: auth0.Auth0UserProfile) => void): void; + checkSession(options: any, callback: (error: auth0.Auth0Error, authResult: AuthResult | undefined) => void): void; // https://github.com/auth0/lock#resumeauthhash-callback resumeAuth(hash: string, callback: (error: auth0.Auth0Error, authResult: AuthResult) => void): void; show(options?: Auth0LockShowOptions): void; diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index d21f477be0..7cd969b6c6 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -109,6 +109,101 @@ str = apiGwEvt.queryStringParameters["example"]; str = apiGwEvt.stageVariables["example"]; apiGwEvtReqCtx = apiGwEvt.requestContext; +/* DynamoDB Stream Event */ +var dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = { + Records: [ + { + eventID: '1', + eventVersion: '1.0', + dynamodb: { + Keys: { + Id: { + N: 101 + } + }, + NewImage: { + Message: { + S: 'New item!' + }, + Id: { + N: 101 + } + }, + StreamViewType: 'NEW_AND_OLD_IMAGES', + SequenceNumber: '111', + SizeBytes: 26 + }, + awsRegion: 'us-west-2', + eventName: 'INSERT', + eventSourceARN: + 'arn:aws:dynamodb:us-west-2:account-id:table/ExampleTableWithStream/stream/2015-06-27T00:48:05.899', + eventSource: 'aws:dynamodb' + }, + { + eventID: '2', + eventVersion: '1.0', + dynamodb: { + OldImage: { + Message: { + S: 'New item!' + }, + Id: { + N: 101 + } + }, + SequenceNumber: '222', + Keys: { + Id: { + N: 101 + } + }, + SizeBytes: 59, + NewImage: { + Message: { + S: 'This item has changed' + }, + Id: { + N: 101 + } + }, + StreamViewType: 'NEW_AND_OLD_IMAGES' + }, + awsRegion: 'us-west-2', + eventName: 'MODIFY', + eventSourceARN: + 'arn:aws:dynamodb:us-west-2:account-id:table/ExampleTableWithStream/stream/2015-06-27T00:48:05.899', + eventSource: 'aws:dynamodb' + }, + { + eventID: '3', + eventVersion: '1.0', + dynamodb: { + Keys: { + Id: { + N: 101 + } + }, + SizeBytes: 38, + SequenceNumber: '333', + OldImage: { + Message: { + S: 'This item has changed' + }, + Id: { + N: 101 + } + }, + StreamViewType: 'NEW_AND_OLD_IMAGES' + }, + awsRegion: 'us-west-2', + eventName: 'REMOVE', + eventSourceARN: + 'arn:aws:dynamodb:us-west-2:account-id:table/ExampleTableWithStream/stream/2015-06-27T00:48:05.899', + eventSource: 'aws:dynamodb' + } + ] +}; + /* SNS Event */ snsEvtRecs = snsEvt.Records; @@ -315,6 +410,131 @@ function customAuthorizerCallback(cb: AWSLambda.CustomAuthorizerCallback) { cb(null, authResponse); } +/* CloudFront events, see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html */ +var CloudFrontRequestEvent: AWSLambda.CloudFrontRequestEvent = { + "Records": [ + { + "cf": { + "config": { + "distributionId": "EDFDVBD6EXAMPLE", + "requestId": "MRVMF7KydIvxMWfJIglgwHQwZsbG2IhRJ07sn9AkKUFSHS9EXAMPLE==" + }, + "request": { + "clientIp": "2001:0db8:85a3:0:0:8a2e:0370:7334", + "method": "GET", + "uri": "/picture.jpg", + "querystring": "size=large", + "headers": { + "host": [ + { + "key": "Host", + "value": "d111111abcdef8.cloudfront.net" + } + ], + "user-agent": [ + { + "key": "User-Agent", + "value": "curl/7.51.0" + } + ] + }, + "origin": { + "custom": { + "customHeaders": { + "my-origin-custom-header": [ + { + "key": "My-Origin-Custom-Header", + "value": "Test" + } + ] + }, + "domainName": "example.com", + "keepaliveTimeout": 5, + "path": "/custom_path", + "port": 443, + "protocol": "https", + "readTimeout": 5, + "sslProtocols": [ + "TLSv1", + "TLSv1.1" + ] + }, + "s3": { + "authMethod": "origin-access-identity", + "customHeaders": { + "my-origin-custom-header": [ + { + "key": "My-Origin-Custom-Header", + "value": "Test" + } + ] + }, + "domainName": "my-bucket.s3.amazonaws.com", + "path": "/s3_path", + "region": "us-east-1" + } + } + } + } + } + ] +}; + +var CloudFrontResponseEvent: AWSLambda.CloudFrontResponseEvent = { + "Records": [ + { + "cf": { + "config": { + "distributionId": "EDFDVBD6EXAMPLE", + "requestId": "xGN7KWpVEmB9Dp7ctcVFQC4E-nrcOcEKS3QyAez--06dV7TEXAMPLE==" + }, + "request": { + "clientIp": "2001:0db8:85a3:0:0:8a2e:0370:7334", + "method": "GET", + "uri": "/picture.jpg", + "querystring": "size=large", + "headers": { + "host": [ + { + "key": "Host", + "value": "d111111abcdef8.cloudfront.net" + } + ], + "user-agent": [ + { + "key": "User-Agent", + "value": "curl/7.18.1" + } + ] + } + }, + "response": { + "status": "200", + "statusDescription": "OK", + "headers": { + "server": [ + { + "key": "Server", + "value": "MyCustomOrigin" + } + ], + "set-cookie": [ + { + "key": "Set-Cookie", + "value": "theme=light" + }, + { + "key": "Set-Cookie", + "value": "sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT" + } + ] + } + } + } + } + ] +}; + /* Compatibility functions */ context.done(); context.done(error); diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index d6b50ff5e6..172ee69210 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -8,8 +8,10 @@ // Yoriki Yamaguchi // wwwy3y3 // Ishaan Malhi +// Michael Marner // Daniel Cottone // Kostya Misura +// Markus Tacker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -64,6 +66,53 @@ interface CustomAuthorizerEvent { requestContext?: APIGatewayEventRequestContext; } +// Context +// http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_AttributeValue.html +interface AttributeValue { + B?: string; + BS?: Array; + BOOL?: boolean; + L?: Array; + M?: { [id: string]: AttributeValue }; + N?: number; + NS?: Array; + NULL?: boolean; + S?: string; + SS?: Array; +} + +// Context +// http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_StreamRecord.html +interface StreamRecord { + ApproximateCreationTime?: number; + Keys?: { [key: string]: AttributeValue }; + NewImage?: { [key: string]: AttributeValue }; + OldImage?: { [key: string]: AttributeValue }; + SequenceNumber?: string; + SizeBytes?: number; + StreamViewType?: 'KEYS_ONLY' | 'NEW_IMAGE' | 'OLD_IMAGE' | 'NEW_AND_OLD_IMAGES'; +} + +// Context +// http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_Record.html +interface DynamoDBRecord { + awsRegion?: string; + dynamodb?: StreamRecord; + eventID?: string; + eventName?: 'INSERT' | 'MODIFY' | 'REMOVE'; + eventSource?: string; + eventSourceARN?: string; + eventVersion?: string; + userIdentity?: any; +} + +// AWS Lambda Stream event +// Context +// http://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-ddb-update +interface DynamoDBStreamEvent { + Records: Array; +} + // SNS "event" interface SNSMessageAttribute { Type: string; @@ -346,6 +395,55 @@ interface AuthResponseContext { [name: string]: string | number | boolean; } +/** + * CloudFront events + * http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html + */ +type CloudFrontHeaders = { + [name: string]: { + key: string; + value: string; + }[] +}; + +type CloudFrontResponse = { + status: string; + statusDescription: string; + headers: CloudFrontHeaders; +}; + +type CloudFrontRequest = { + clientIp: string; + method: string; + uri: string; + querystring: string; + headers: CloudFrontHeaders; +}; + +type CloudFrontEvent = { + config: { + distributionId: string; + requestId: string; + } +} + +export type CloudFrontResponseEvent = { + Records: { + cf: CloudFrontEvent & { + request: CloudFrontRequest; + response: CloudFrontResponse; + } + }[] +}; + +export type CloudFrontRequestEvent = { + Records: { + cf: CloudFrontEvent & { + request: CloudFrontRequest; + } + }[] +}; + /** * AWS Lambda handler function. * http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html diff --git a/types/azure-sb/azure-sb-tests.ts b/types/azure-sb/azure-sb-tests.ts index 68b0fc8df7..411862a3b2 100644 --- a/types/azure-sb/azure-sb-tests.ts +++ b/types/azure-sb/azure-sb-tests.ts @@ -1,16 +1,82 @@ +import { Azure } from 'azure-sb'; +import AzureSB = require('azure-sb'); +import Models = Azure.ServiceBus.Results.Models; -var nh = new Azure.ServiceBus.NotificationHubService(); -nh.send('tag', '', function (error, result) {}); -nh.send('tag', '', { headers: {} }, function (error, result) {}); +function createResultCallback() { + return (err: Error | null, result: T, response: Azure.ServiceBus.Response) => { + }; +} -nh.apns.send('tag', { payload: { } }, function (error, result) {}); -nh.apns.send(['tag'], { payload: { } }, function (error, result) {}); -nh.gcm.send('tag', { }, function (error, result) {}); -nh.gcm.send(['tag'], { }, function (error, result) {}); -nh.wns.send('tag', '', 'wns/toast', function (error, result) {}); -nh.wns.send(['tag'], '', 'wns/toast', function (error, result) {}); -nh.wns.send('tag', '', 'wns/toast', { headers: {} }, function (error, result) {}); -nh.wns.sendToastText01('tag', '', function (error, result) {}); -nh.wns.sendToastText01(['tag'], '', function (error, result) {}); -nh.wns.sendToastText01('tag', '', { headers: {} }, function (error, result) {}); \ No newline at end of file +function ResponseCallback(err: Error | null, response: Azure.ServiceBus.Response) { +} + +const ServiceBus = AzureSB.createServiceBusService('connectionstring'); + +// Queues +ServiceBus.listQueues('', createResultCallback()); +ServiceBus.createQueue('test', createResultCallback()); +ServiceBus.createQueueIfNotExists('test', createResultCallback()); +ServiceBus.getQueue('test', createResultCallback()); +ServiceBus.deleteQueue('test', ResponseCallback); + +// Topics +ServiceBus.listTopics('', createResultCallback()); +ServiceBus.createTopic('test', createResultCallback()); +ServiceBus.createTopicIfNotExists('test', createResultCallback()); +ServiceBus.getTopic('test', createResultCallback()); +ServiceBus.deleteTopic('test', ResponseCallback); + +// Subscriptions +ServiceBus.listSubscriptions('test', createResultCallback()); +ServiceBus.createSubscription('test', 'test', createResultCallback()); +ServiceBus.createSubscription('test', 'test', { + DefaultMessageTimeToLive: 'PT10M' +}, createResultCallback()); +ServiceBus.getSubscription('test', 'test', createResultCallback()); +ServiceBus.deleteSubscription('test', 'test', ResponseCallback); + +ServiceBus.listRules('testTopic', 'testSub', createResultCallback()); +ServiceBus.createRule('testTopic', 'testSub', 'testRule', createResultCallback()); +ServiceBus.getRule('testTopic', 'testSub', 'testRule', createResultCallback()); +ServiceBus.deleteRule('testTopic', 'testSub', 'testRule', ResponseCallback); + +// Messages +ServiceBus.sendQueueMessage('testTopic', 'My data', ResponseCallback); +ServiceBus.sendQueueMessage('testTopic', { + body: '{"data":"MyData"}', + contentType: 'application/json', + brokerProperties: { + CorrelationId: '123' + } +}, ResponseCallback); +ServiceBus.receiveQueueMessage('testQueue', createResultCallback()); + +ServiceBus.sendTopicMessage('testTopic', 'My data', ResponseCallback); +ServiceBus.sendTopicMessage('testTopic', { + body: '{"data":"MyData"}', + contentType: 'application/json', + brokerProperties: { + CorrelationId: '123' + } +}, ResponseCallback); +ServiceBus.receiveSubscriptionMessage('testTopic', 'testSub', createResultCallback()); + +ServiceBus.renewLockForMessage('test', ResponseCallback); +ServiceBus.unlockMessage('test', ResponseCallback); +ServiceBus.deleteMessage('test', ResponseCallback); + +// NotificationHub +const nh = AzureSB.createNotificationHubService('test'); +nh.send('tag', '', ResponseCallback); +nh.send('tag', '', { headers: {} }, ResponseCallback); +nh.apns.send('tag', { payload: {} }, ResponseCallback); +nh.apns.send(['tag'], { payload: {} }, ResponseCallback); +nh.gcm.send('tag', {}, ResponseCallback); +nh.gcm.send(['tag'], {}, ResponseCallback); +nh.wns.send('tag', '', 'wns/toast', ResponseCallback); +nh.wns.send(['tag'], '', 'wns/toast', ResponseCallback); +nh.wns.send('tag', '', 'wns/toast', { headers: {} }, ResponseCallback); +nh.wns.sendToastText01('tag', '', ResponseCallback); +nh.wns.sendToastText01(['tag'], '', ResponseCallback); +nh.wns.sendToastText01('tag', '', { headers: {} }, ResponseCallback); diff --git a/types/azure-sb/index.d.ts b/types/azure-sb/index.d.ts index bae1af04a9..ba92395c0f 100644 --- a/types/azure-sb/index.d.ts +++ b/types/azure-sb/index.d.ts @@ -2,172 +2,322 @@ // Project: https://github.com/Azure/azure-sdk-for-node/tree/master/lib/services/serviceBus // Definitions by: Microsoft Azure // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 -declare namespace Azure.ServiceBus { - interface Callback { - (error: any, response: any): void; +export import ServiceBusService = require('./lib/servicebusservice'); +export import NotificationHubService = require('./lib/notificationhubservice'); +export import WrapService = require('./lib/wrapservice'); + +export function createServiceBusService(namespaceOrConnectionString?: string, + accessKey?: string, + issuer?: string, + acsNamespace?: string, + host?: string, + authenticationProvider?: object): ServiceBusService; + +export function createNotificationHubService(hubName: string, + endpointOrConnectionString?: string, + sharedAccessKeyName?: string, + sharedAccessKeyValue?: string): NotificationHubService; + +export function createWrapService(acsHost: string, + issuer?: string, + accessKey?: string): WrapService; + +export namespace Azure.ServiceBus { + export type Duration = string; + export type DateString = string; + + export interface Dictionary { + [k: string]: T; } - interface NotificationHubRegistration { - RegistrationId: string; + export interface ReceiveQueueMessageOptions { + timeoutIntervalInS?: number; + } + + export interface ReceiveSubscriptionMessageOptions extends ReceiveQueueMessageOptions { + isPeekLock?: boolean; + } + + interface IBrokerPropertiesResponse { + readonly DeliveryCount: number; + readonly LockedUntil: DateString; + readonly LockToken: string; + readonly SequenceNumber: number; + } + + interface IBrokerProperties { + CorrelationId: string; + Label: string; + MessageId: string; + PartitionKey: string; + ReplyTo: string; + ReplyToSessionId: string; + ScheduledEnqueueTimeUtc: string; + SessionId: string; + TimeToLive: string; + To: string; + } + + export interface Message { + body: string; + brokerProperties?: BrokerProperties; + contentType?: string; + customProperties?: Dictionary; + } + + /* + * Options interfaces + */ + + interface CreateOptions { + DefaultMessageTimeToLive: string; + DuplicateDetectionHistoryTimeWindow: string; + EnablePartitioning: boolean; + MaxSizeInMegaBytes: number; + RequiresDuplicateDetection: boolean; + } + + interface IQueueOptions extends CreateOptions { + AutoDeleteOnIdle: string; + DeadLetteringOnMessageExpiration: boolean; + LockDuration: string; + RequiresSession: boolean; + } + + interface ICreateTopicOptions extends CreateOptions { + EnableBatchedOperations: boolean; + SizeInBytes: boolean; + SupportOrdering: boolean; + } + + interface ICreateTopicIfNotExistsOptions extends ICreateTopicOptions { + EnableDeadLetteringOnFilterEvaluationExceptions: boolean; + EnableDeadLetteringOnMessageExpiration: boolean; + MaxCorrelationFiltersPerTopic: number; + MaxSqlFiltersPerTopic: number; + MaxSubscriptionsPerTopic: number; + } + + interface ICreateSubscriptionOptions { + DefaultMessageTimeToLive: string; + EnableDeadLetteringOnFilterEvaluationExceptions: boolean; + EnableDeadLetteringOnMessageExpiration: boolean; + LockDuration: string; + RequiresSession: boolean; + } + + interface PaginationOptions { + top: number; + skip: number; + } + + interface ICreateRuleOptions { + trueFilter: string; + falseFilter: string; + sqlExpressionFilter: string; + correlationIdFilter: string; + sqlRuleAction: string; + } + + interface ICreateNotificationHubOptions { + apns: Dictionary; + gcm: Dictionary; + mpns: Dictionary; + wns: Dictionary; + } + + export interface NotificationHubRegistration { + BodyTemplate?: any; ChannelUri?: string; DeviceToken?: string; - gcmRegistrationId?: string; - Tags?: string; - BodyTemplate?: any; - WnsHeaders?: any; - MpnsHeaders?: any; Expiry?: Date; + gcmRegistrationId?: string; + MpnsHeaders?: any; + RegistrationId: string; + Tags?: string; + WnsHeaders?: any; } - export class NotificationHubService { - new(hubName: string, endpointOrConnectionString: string, sharedAccessKeyName?: string, sharedAccessKeyValue?: string): NotificationHubService; - hubName: string; - wns: Wns.Service; - apns: Apns.Service; - gcm: Gcm.Service; - mpns: Mpns.Service; - send(tags: string, payload: Object | string, optionsOrCallback?: { headers: Object } | Callback, callback?: Callback): void; - - createOrUpdateInstallation(installation: string, options: any, callback?: Callback): void; - patchInstallation(installationId: string, partialUpdateOperations: any[], options: any, callback?: Callback): void; - deleteInstallation(installationId: string, options: any, callback?: Callback): void; - getInstallation(installationId: string, options: any, callback?: Callback): void; - - /* - // old school? - createRegistrationId(callback?: Callback): void; - getRegistration(registrationId: string, options: any, callback?: Callback): void; - deleteRegistration(registrationId: string, options?: { etag: any }, callback?: Callback): void; - updateRegistration(registration: NotificationHubRegistration, options?: { etag: any }, callback?: Callback): void; - createOrUpdateRegistration(registration: NotificationHubRegistration, options?: { etag: any }, callback?: Callback): void; - listRegistrations(options?: { top: number, skip: number }, callback?: Callback): void; - listRegistrationsByTag(tag: string, options?: { top: number, skip: number }, callback?: Callback): void; - */ + export interface Response { + body: Dictionary; + headers: Dictionary; + isSuccessful: boolean; + md5?: string; + statusCode: number; } - export module Apns { - interface Payload { - expiry?: Date; - aps?: Object; - badge?: number; - alert?: string; - sound?: string; - payload: Object; + export interface ErrorResponse extends Response { + body: { + Error: { + Code: string; + Detail: string; + }; + }; + } + + export namespace Results.Models { + export enum EntityStatus { + Active = 'Active', + Creating = 'Creating', + Deleting = 'Deleting', + Disabled = 'Disabled', + ReceiveDisabled = 'ReceiveDisabled', + Renaming = 'Renaming', + Restoring = 'Restoring', + SendDisabled = 'SendDisabled', + Unknown = 'Unknown' } - interface Service { - new(service: NotificationHubService): Service; - send(tags: string | string[], payload: Apns.Payload, callback?: Callback): void; - createNativeRegistration(token: string, tags: string | string[], optionsOrCallback?: Object | Callback, callback?: Callback): void; - createOrUpdateNativeRegistration(registrationId: string, token: string, tags: string | string[], optionsOrCallback?: Object | Callback, callback?: Callback): void; - createTemplateRegistration(token: string, tags: string | string[], template: Apns.Payload, optionsOrCallback?: Object | Callback, callback?: Callback): void; - createOrUpdateTemplateRegistration(registrationId: string, token: string, tags: string | string[], template: Apns.Payload, optionsOrCallback?: Object | Callback, callback?: Callback): void; - updateTemplateRegistration(registrationId: string, token: string, tags: string | string[], template: Apns.Payload, optionsOrCallback?: Object | Callback, callback?: Callback): void; - listRegistrationsByToken(token: string, optionsOrCallback?: { top: number, skip: number } | Callback, callback?: Callback): void; + export enum EntityAvailabilityStatus { + Available = 'Available', + Limited = 'Limited', + Renaming = 'Renaming', + Restoring = 'Restoring', + Unknown = 'Unknown' } - } - export module Gcm { - interface Service { - new(service: NotificationHubService): Service; - send(tags: string | string[], payload: any, callback?: Callback): void; - createNativeRegistration(gcmRegistrationId: string, tags: string | string[], optionsOrCallback?: Object | Callback, callback?: Callback): void; - createOrUpdateNativeRegistration(registrationId: string, gcmRegistrationId: string, tags: string | string[], optionsOrCallback?: Object | Callback, callback?: Callback): void; - createTemplateRegistration(gcmRegistrationId: string, tags: string | string[], template: any, optionsOrCallback?: Object | Callback, callback?: Callback): void; - createOrUpdateTemplateRegistration(registrationId: string, gcmRegistrationId: string, tags: string | string[], template: any, optionsOrCallback?: Object | Callback, callback?: Callback): void; - updateTemplateRegistration(registrationId: string, gcmRegistrationId: string, tags: string | string[], template: any, optionsOrCallback?: Object | Callback, callback?: Callback): void; - listRegistrationsByGcmRegistrationId(gcmRegistrationId: string, optionsOrCallback?: { top: number, skip: number } | Callback, callback?: Callback): void; + + interface Base { + _: { + ContentRootElement: string; + id: string; + title: string; + published: DateString; + updated: DateString; + author?: { + name: string; + }; + link: string; + }; + CreatedAt: DateString; + } + + interface ExtendedBase extends Base { + AuthorizationRules: string; + AutoDeleteOnIdle: string; + DefaultMessageTimeToLive: string; + DuplicateDetectionHistoryTimeWindow: Duration; + EnableBatchedOperations: string; + EnableExpress: string; + EnablePartitioning: string; + EntityAvailabilityStatus: string; + IsAnonymousAccessible: string; + MaxSizeInMegabytes: string; + RequiresDuplicateDetection: string; + SizeInBytes: string; + Status: EntityStatus; + UpdatedAt: DateString; + } + + // export interface Generic extends Base { + // [x: string]: string | Dictionary; + // } + + export interface Topic extends ExtendedBase { + AccessedAt: DateString; + CountDetails: { + 'd2p1:ActiveMessageCount': string; + 'd2p1:DeadLetterMessageCount': string; + 'd2p1:ScheduledMessageCount': string; + 'd2p1:TransferMessageCount': string; + 'd2p1:TransferDeadLetterMessageCount': string; + }; + EnableSubscriptionPartitioning: string; + FilteringMessagesBeforePublishing: string; + IsExpress: string; + SubscriptionCount: string; + SupportOrdering: string; + TopicName: string; + } + + export interface Queue extends ExtendedBase { + DeadLetteringOnMessageExpiration: string; + LockDuration: Duration; + MaxDeliveryCount: string; + MessageCount: string; + QueueName: string; + RequiresSession: string; + SupportOrdering: string; + } + + export interface Subscription extends ExtendedBase { + CountDetails: { + 'd3p1:ActiveMessageCount': string; + 'd3p1:DeadLetterMessageCount': string; + 'd3p1:ScheduledMessageCount': string; + 'd3p1:TransferMessageCount': string; + 'd3p1:TransferDeadLetterMessageCount': string; + }; + DeadLetteringOnFilterEvaluationExceptions: string; + DeadLetteringOnMessageExpiration: string; + LockDuration: string; + MaxDeliveryCount: string; + MessageCount: string; + RequiresSession: string; + SubscriptionName: string; + TopicName: string; + } + + /** + * @see https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-messaging-sql-filter + */ + interface SqlFilter { + readonly CompatibilityLevel: string; + Parameters?: Dictionary; + RequiresPreprocessing?: string; + SqlExpression: string; + } + + type CorrelationFilter = Partial<{ + ContentType: string; + CorrelationId: string; + Label: string; + Properties: string; + ReplyTo: string; + ReplyToSessionId: string; + RequiresPreprocessing: string; + SessionId: string; + To: string; + }>; + + export interface Rule extends Base { + Action: string | SqlFilter; + Filter: SqlFilter | CorrelationFilter; + Name: string; + TopicName: string; + SubscriptionName: string; + RuleName: string; } } - export module Mpns { interface Service { } } + /* + * Callbacks + */ + export type ResponseCallback = (error: Error | null, response: Response) => void; - export module Wns { - interface Payload { - text1?: string; - text2?: string; - text3?: string; - text4?: string; - image1src?: string; - image1alt?: string; - image2src?: string; - image2alt?: string; - image3src?: string; - image3alt?: string; - image4src?: string; - image4alt?: string; - lang?: string; - type?: string; - } + export type ResultAndResponseCallback = (error: Error | null, + result: boolean | Results.Models.Base | Results.Models.Base[], + response: Response) => void; - interface Options { - headers: Object; - } + export type TypedResultAndResponseCallback = (error: Error | null, + result: T, + response: Response) => void; - interface Service { - new(service: NotificationHubService): Service; - sendTileSquareBlock(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileSquareText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileSquareText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileSquareText03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileSquareText04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideText03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideText04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideText05(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideText06(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideText07(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideText08(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideText09(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideText10(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideText11(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileSquareImage(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileSquarePeekImageAndText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileSquarePeekImageAndText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileSquarePeekImageAndText03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileSquarePeekImageAndText04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideImage(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideImageCollection(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideImageAndText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideImageAndText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideBlockAndText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideBlockAndText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideSmallImageAndText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideSmallImageAndText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideSmallImageAndText03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideSmallImageAndText04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWideSmallImageAndText05(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWidePeekImageCollection01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWidePeekImageCollection02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWidePeekImageCollection03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWidePeekImageCollection04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWidePeekImageCollection05(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWidePeekImageCollection06(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWidePeekImageAndText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWidePeekImageAndText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWidePeekImage01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWidePeekImage02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWidePeekImage03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWidePeekImage04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWidePeekImage05(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendTileWidePeekImage06(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendToastText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendToastText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendToastText03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendToastText04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendToastImageAndText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendToastImageAndText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendToastImageAndText03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendToastImageAndText04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - // badges = ['none','activity','alert','available','away','busy','newMessage','paused','playing','unavailable','error', 'attention'] - sendBadge(tags: string | string[], value: string | number, optionsOrCallback?: Options | Callback, callback?: Callback): void; - sendRaw(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; - // types = ['wns/toast', 'wns/badge', 'wns/tile', 'wns/raw'] - send(tags: string | string[], payload: string, type: string, optionsOrCallback?: Options | Callback, callback?: Callback): void; - createNativeRegistration(channel: string, tags: string | string[], optionsOrCallback?: Options | Callback, callback?: Callback): void; - createOrUpdateNativeRegistration(registrationId: string, channel: string, tags: string | string[], optionsOrCallback?: Options | Callback, callback?: Callback): void; - listRegistrationsByChannel(channel: string, optionsOrCallback?: { top: number, skip: number } | Callback, callback?: Callback): void; - } - } + /* + * Options interfaces with all properties as optional + */ + export type BrokerProperties = Partial; + export type BrokerPropertiesResponse = IBrokerPropertiesResponse & Partial; + export type CreateQueueOptions = Partial; + export type CreateTopicOptions = Partial; + export type CreateTopicIfNotExistsOptions = Partial; + export type CreateSubscriptionOptions = Partial; + export type ListSubscriptionsOptions = Partial; + export type ListRulesOptions = Partial; + export type CreateRuleOptions = Partial; + export type CreateNotificationHubOptions = Partial; + export type ListNotificationHubsOptions = Partial; + + export type MessageOrName = Message | string; } diff --git a/types/azure-sb/lib/apnsservice.d.ts b/types/azure-sb/lib/apnsservice.d.ts new file mode 100644 index 0000000000..05ca2f7b43 --- /dev/null +++ b/types/azure-sb/lib/apnsservice.d.ts @@ -0,0 +1,83 @@ +import { Azure } from '../index'; +import NotificationHubService = require('azure-sb/lib/notificationhubservice'); +import ResponseCallback = Azure.ServiceBus.ResponseCallback; +import NotificationHubRegistration = Azure.ServiceBus.NotificationHubRegistration; +import ListNotificationHubsOptions = Azure.ServiceBus.ListNotificationHubsOptions; +import Dictionary = Azure.ServiceBus.Dictionary; + +type Template = Partial<{ + expiry: Date; + aps: object; + badge: number; + alert: string; + sound: string; + payload: object; +}>; + +declare class ApnsService { + constructor(notificationHubService: NotificationHubService); + + public notificationHubService: NotificationHubService; + + public send(tags: string | string[], + payload: object | string, + callback: ResponseCallback): void; + + public send(tags: string | string[], + payload: object | string, + options: { headers: Dictionary }, + callback: ResponseCallback): void; + + public createNativeRegistration(token: string, + tags: string | string[], + callback: ResponseCallback): void; + + public createNativeRegistration(token: string, + tags: string | string[], + options: object, + callback: ResponseCallback): void; + + public createOrUpdateNativeRegistration(registrationId: string, + token: string, + tags: string | string[], + callback: ResponseCallback): void; + + public createOrUpdateNativeRegistration(registrationId: string, + token: string, + tags: string | string[], + options: object, + callback: ResponseCallback): void; + + public createTemplateRegistration(token: string, + tags: string | string[], + template: Template | string, + callback: ResponseCallback): void; + + public createTemplateRegistration(token: string, + tags: string | string[], + template: Template | string, + options: object, + callback: ResponseCallback): void; + + public updateTemplateRegistration(registrationId: string, + token: string, + tags: string | string[], + template: Template | string, + callback: ResponseCallback): void; + + public updateTemplateRegistration(registrationId: string, + token: string, + tags: string | string[], + template: Template | string, + options: { headers: Dictionary }, + callback: ResponseCallback): void; + + public listRegistrationsByToken(token: string, + callback: ResponseCallback): void; + + public listRegistrationsByToken(token: string, + options: ListNotificationHubsOptions, + callback: ResponseCallback): void; +} + +export = ApnsService; diff --git a/types/azure-sb/lib/gcmservice.d.ts b/types/azure-sb/lib/gcmservice.d.ts new file mode 100644 index 0000000000..4d1c8f203c --- /dev/null +++ b/types/azure-sb/lib/gcmservice.d.ts @@ -0,0 +1,71 @@ +import { Azure } from '../index'; +import NotificationHubService = require('azure-sb/lib/notificationhubservice'); +import ResponseCallback = Azure.ServiceBus.ResponseCallback; +import NotificationHubRegistration = Azure.ServiceBus.NotificationHubRegistration; +import ListNotificationHubsOptions = Azure.ServiceBus.ListNotificationHubsOptions; +import Dictionary = Azure.ServiceBus.Dictionary; + +type Template = Partial<{}>; + +declare class GcmService { + constructor(notificationHubService: NotificationHubService); + + public notificationHubService: NotificationHubService; + + public send(tags: string | string[], + payload: object | string, + callback: ResponseCallback): void; + + public createNativeRegistration(gcmRegistrationId: string, + tags: string | string[], + callback: ResponseCallback): void; + + public createNativeRegistration(token: string, + tags: string | string[], + options: object, + callback: ResponseCallback): void; + + public createOrUpdateNativeRegistration(registrationId: string, + gcmRegistrationId: string, + tags: string | string[], + callback: ResponseCallback): void; + + public createOrUpdateNativeRegistration(registrationId: string, + gcmRegistrationId: string, + tags: string | string[], + options: object, + callback: ResponseCallback): void; + + public createTemplateRegistration(gcmRegistrationId: string, + tags: string | string[], + template: Template | string, + callback: ResponseCallback): void; + + public createTemplateRegistration(gcmRegistrationId: string, + tags: string | string[], + template: Template | string, + options: object, + callback: ResponseCallback): void; + + public updateTemplateRegistration(registrationId: string, + gcmRegistrationId: string, + tags: string | string[], + template: Template | string, + callback: ResponseCallback): void; + + public updateTemplateRegistration(registrationId: string, + gcmRegistrationId: string, + tags: string | string[], + template: Template | string, + options: { headers: Dictionary }, + callback: ResponseCallback): void; + + public listRegistrationsByGcmRegistrationId(gcmRegistrationId: string, + callback: ResponseCallback): void; + + public listRegistrationsByGcmRegistrationId(gcmRegistrationId: string, + options: ListNotificationHubsOptions, + callback: ResponseCallback): void; +} + +export = GcmService; diff --git a/types/azure-sb/lib/models/acstokenresult.d.ts b/types/azure-sb/lib/models/acstokenresult.d.ts new file mode 100644 index 0000000000..531c606de1 --- /dev/null +++ b/types/azure-sb/lib/models/acstokenresult.d.ts @@ -0,0 +1,29 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import { Azure } from 'azure-sb'; +import Dictionary = Azure.ServiceBus.Dictionary; + +export namespace Azure.ServiceBus.Results { + export interface AcsTokenResponse extends Dictionary> { + WrapAccessToken: Dictionary; + WrapAccessTokenExpiresIn: Dictionary; + } + + export interface AcsTokenResult { + parse(acsTokenQueryString: string): AcsTokenResponse; + } +} diff --git a/types/azure-sb/lib/models/notificationhubresult.d.ts b/types/azure-sb/lib/models/notificationhubresult.d.ts new file mode 100644 index 0000000000..1aef66c3d6 --- /dev/null +++ b/types/azure-sb/lib/models/notificationhubresult.d.ts @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import { Azure } from 'azure-sb'; +import Dictionary = Azure.ServiceBus.Dictionary; + +export namespace Azure.ServiceBus.Results { + export interface NotificationHubResult { + serialize(resource: Azure.ServiceBus.CreateNotificationHubOptions): string; + + parse(xml: object): object | object[]; + } +} diff --git a/types/azure-sb/lib/models/queuemessageresult.d.ts b/types/azure-sb/lib/models/queuemessageresult.d.ts new file mode 100644 index 0000000000..a50d0965cb --- /dev/null +++ b/types/azure-sb/lib/models/queuemessageresult.d.ts @@ -0,0 +1,40 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Module dependencies. +import { Azure } from 'azure-sb'; +import Dictionary = Azure.ServiceBus.Dictionary; + +export namespace Azure.ServiceBus.Results { + export interface QueueResponse { + body: any; + headers: Dictionary + } + + export interface QueueMessageResponse { + body: any; + brokerProperties?: Azure.ServiceBus.BrokerProperties; + customProperties?: Dictionary; + contentType?: string; + location?: string; + } + + export interface QueueMessageResult { + parse(responseObject: object): QueueMessageResponse; + + isRFC1123(value: string | any): boolean; + } +} diff --git a/types/azure-sb/lib/models/queueresult.d.ts b/types/azure-sb/lib/models/queueresult.d.ts new file mode 100644 index 0000000000..abeed96dff --- /dev/null +++ b/types/azure-sb/lib/models/queueresult.d.ts @@ -0,0 +1,41 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import { Azure } from 'azure-sb'; +import Dictionary = Azure.ServiceBus.Dictionary; + +export namespace Azure.ServiceBus.Results { + export interface QueueProperties { + DeadLetteringOnMessageExpiration: string; + DefaultMessageTimeToLive: string; + DuplicateDetectionHistoryTimeWindow: string; + EnableBatchedOperations: boolean; + EnablePartitioning: boolean; + LockDuration: string; + MaxDeliveryCount: number; + MaxSizeInMegabytes: number; + MessageCount: number; + RequiresDuplicateDetection: boolean; + RequiresSession: boolean; + SizeInBytes: number; + } + + export interface QueueResult { + serialize(resource: QueueProperties): string; + + parse(xml: object): object | object[]; + } +} diff --git a/types/azure-sb/lib/models/registrationresult.d.ts b/types/azure-sb/lib/models/registrationresult.d.ts new file mode 100644 index 0000000000..81c1fdd824 --- /dev/null +++ b/types/azure-sb/lib/models/registrationresult.d.ts @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import { Azure } from 'azure-sb'; +import Dictionary = Azure.ServiceBus.Dictionary; + +export namespace Azure.ServiceBus.Results { + export interface RegistrationResult { + serialize(type: string, resource: object, properties: string[]): string; + + parse(xml: object): object | object[]; + } +} diff --git a/types/azure-sb/lib/models/resourceresult.d.ts b/types/azure-sb/lib/models/resourceresult.d.ts new file mode 100644 index 0000000000..b9654b0438 --- /dev/null +++ b/types/azure-sb/lib/models/resourceresult.d.ts @@ -0,0 +1,28 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import { Azure } from 'azure-sb'; +import Dictionary = Azure.ServiceBus.Dictionary; + +export namespace Azure.ServiceBus.Results { + export interface ResourceResult { + setName(entry: Dictionary | { _: { id: string } }, nameProperty: string): void; + + serialize(resourceName: string, resource: object, properties: string[]): string; + + parse(resourceName: string, nameProperty: string, xml: object): object | object[]; + } +} diff --git a/types/azure-sb/lib/models/ruleresult.d.ts b/types/azure-sb/lib/models/ruleresult.d.ts new file mode 100644 index 0000000000..369a4ddeb7 --- /dev/null +++ b/types/azure-sb/lib/models/ruleresult.d.ts @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Module dependencies. +import { Azure } from 'azure-sb'; + +export namespace Azure.ServiceBus.Results { + export interface RuleResult { + serialize(rule: Azure.ServiceBus.CreateRuleOptions): string; + + parse(xml: object): object | object[]; + } +} diff --git a/types/azure-sb/lib/models/subscriptionresult.d.ts b/types/azure-sb/lib/models/subscriptionresult.d.ts new file mode 100644 index 0000000000..003c085da0 --- /dev/null +++ b/types/azure-sb/lib/models/subscriptionresult.d.ts @@ -0,0 +1,37 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import { Azure } from 'azure-sb'; + +export namespace Azure.ServiceBus.Results { + export interface SubscriptionProperties { + LockDuration: string; + RequiresSession: boolean; + DefaultMessageTimeToLive: string; + DeadLetteringOnMessageExpiration: string; + DeadLetteringOnFilterEvaluationExceptions: string; + MessageCount: number; + MaxDeliveryCount: number; + EnableBatchedOperations: boolean; + AutoDeleteOnIdle: boolean; + } + + export interface SubscriptionResult { + serialize(resource: SubscriptionProperties): string; + + parse(xml: object): object | object[]; + } +} diff --git a/types/azure-sb/lib/models/topicresult.d.ts b/types/azure-sb/lib/models/topicresult.d.ts new file mode 100644 index 0000000000..7f20125b51 --- /dev/null +++ b/types/azure-sb/lib/models/topicresult.d.ts @@ -0,0 +1,32 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +export namespace Azure.ServiceBus.Results { + export interface TopicProperties { + DefaultMessageTimeToLive: string; + MaxSizeInMegabytes: number; + RequiresDuplicateDetection: boolean; + DuplicateDetectionHistoryTimeWindow: string; + EnableBatchedOperations: boolean; + SizeInBytes: number; + SupportOrdering: boolean; + EnablePartitioning: boolean; + } +} + +export function serialize(resource: Azure.ServiceBus.Results.TopicProperties): string; + +export function parse(xml: object): object | object[]; diff --git a/types/azure-sb/lib/mpnservice.d.ts b/types/azure-sb/lib/mpnservice.d.ts new file mode 100644 index 0000000000..d476f4d984 --- /dev/null +++ b/types/azure-sb/lib/mpnservice.d.ts @@ -0,0 +1,116 @@ +import { Azure } from '../index'; +import NotificationHubService = require('azure-sb/lib/notificationhubservice'); +import ResponseCallback = Azure.ServiceBus.ResponseCallback; +import NotificationHubRegistration = Azure.ServiceBus.NotificationHubRegistration; +import ListNotificationHubsOptions = Azure.ServiceBus.ListNotificationHubsOptions; +import Dictionary = Azure.ServiceBus.Dictionary; + +type Template = TileTemplate | FlipTileTemplate | ToastTemplate; + +interface TileTemplate { + backgroundImage: string; + count: string; + title: string; + backBackgroundImage: string; + backTitle: string; + backContent: string; + id: string; +} + +interface FlipTileTemplate extends TileTemplate { + smallBackgroundImage: string; + wideBackgroundImage: string; + wideBackContent: string; + wideBackBackgroundImage: string; +} + +interface ToastTemplate { + text1: string; + text2: string; + param?: string; +} + +declare class MpnsService { + constructor(notificationHubService: NotificationHubService); + + public notificationHubService: NotificationHubService; + + public send(tags: string | string[], + payload: object | string, + targetName: string, + notificationClass: string, + callback: ResponseCallback): void; + + public send(tags: string | string[], + payload: object | string, + targetName: string, + notificationClass: string, + options: { headers: Dictionary }, + callback: ResponseCallback): void; + + public createNativeRegistration(channel: string, + tags: string | string[], + callback: ResponseCallback): void; + + public createNativeRegistration(channel: string, + tags: string | string[], + options: object, + callback: ResponseCallback): void; + + public createOrUpdateNativeRegistration(registrationId: string, + channel: string, + tags: string | string[], + callback: ResponseCallback): void; + + public createOrUpdateNativeRegistration(registrationId: string, + channel: string, + tags: string | string[], + options: object, + callback: ResponseCallback): void; + + public createRawTemplateRegistration(channel: string, + tags: string | string[], + template: Template | string, + callback: ResponseCallback): void; + + public createRawTemplateRegistration(channel: string, + tags: string | string[], + template: Template | string, + options: object, + callback: ResponseCallback): void; + + public createOrUpdateRawTemplateRegistration(registrationId: string, + channel: string, + tags: string | string[], + template: Template | string, + callback: ResponseCallback): void; + + public createOrUpdateRawTemplateRegistration(registrationId: string, + channel: string, + tags: string | string[], + template: Template | string, + options: object, + callback: ResponseCallback): void; + + public updatesRawTemplateRegistration(registrationId: string, + channel: string, + tags: string | string[], + template: Template | string, + callback: ResponseCallback): void; + + public updatesRawTemplateRegistration(registrationId: string, + channel: string, + tags: string | string[], + template: Template | string, + options: object, + callback: ResponseCallback): void; + + public listRegistrationsByChannel(channel: string, + callback: ResponseCallback): void; + + public listRegistrationsByChannel(channel: string, + options: ListNotificationHubsOptions, + callback: ResponseCallback): void; +} + +export = MpnsService; diff --git a/types/azure-sb/lib/notificationhubservice.d.ts b/types/azure-sb/lib/notificationhubservice.d.ts new file mode 100644 index 0000000000..d56b53d9d5 --- /dev/null +++ b/types/azure-sb/lib/notificationhubservice.d.ts @@ -0,0 +1,102 @@ +import { Azure } from 'azure-sb'; +import Callback = Azure.ServiceBus.ResponseCallback; +import NotificationHubRegistration = Azure.ServiceBus.NotificationHubRegistration; +import ListNotificationHubsOptions = Azure.ServiceBus.ListNotificationHubsOptions; + +import ApnsService = require('./apnsservice'); +import GcmService = require('./gcmservice'); +import MpnsService = require('./mpnservice'); +import WnsService = require('./wnsservice'); + +declare class NotificationHubService { + constructor(hubName: string, + endpointOrConnectionString: string, + sharedAccessKeyName: string, + sharedAccessKeyValue: string); + + public hubName: string; + public wns: WnsService; + public apns: ApnsService; + public gcm: GcmService; + public mpns: MpnsService; + + public send(tags: string, + payload: object | string, + callback: Callback): void; + + public send(tags: string, + payload: object | string, + options: { headers: object }, + callback: Callback): void; + + public createOrUpdateInstallation(installation: string, + callback: Callback): void; + + public createOrUpdateInstallation(installation: string, + options: any, + callback: Callback): void; + + public patchInstallation(installationId: string, + partialUpdateOperations: any[], + callback: Callback): void; + + public patchInstallation(installationId: string, + partialUpdateOperations: any[], + options: any, + callback: Callback): void; + + public deleteInstallation(installationId: string, + callback: Callback): void; + + public deleteInstallation(installationId: string, + options: any, + callback: Callback): void; + + public getInstallation(installationId: string, + callback: Callback): void; + + public getInstallation(installationId: string, + options: any, + callback: Callback): void; + + public createRegistrationId(callback: Callback): void; + + public getRegistration(registrationId: string, + callback: Callback): void; + + public getRegistration(registrationId: string, + options: any, + callback: Callback): void; + + public deleteRegistration(registrationId: string, + callback: Callback): void; + + public deleteRegistration(registrationId: string, + options: { etag: any }, + callback: Callback): void; + + public updateRegistration(registration: NotificationHubRegistration, + callback: Callback): void; + + public updateRegistration(registration: NotificationHubRegistration, + options: { etag: any }, + callback: Callback): void; + + public createOrUpdateRegistration(registration: NotificationHubRegistration, + options: { etag: any }, + callback: Callback): void; + + public listRegistrations(callback: Callback): void; + + public listRegistrations(options: ListNotificationHubsOptions, + callback: Callback): void; + + public listRegistrationsByTag(tag: string, + callback: Callback): void; + + public listRegistrationsByTag(tag: string, + options: ListNotificationHubsOptions, + callback: Callback): void; +} + +export = NotificationHubService; diff --git a/types/azure-sb/lib/servicebusservice.d.ts b/types/azure-sb/lib/servicebusservice.d.ts new file mode 100644 index 0000000000..44f2b2c522 --- /dev/null +++ b/types/azure-sb/lib/servicebusservice.d.ts @@ -0,0 +1,206 @@ +import { Azure } from '../index'; + +import ServiceBusServiceBase = require('./servicebusservicebase'); + +import CreateNotificationHubOptions = Azure.ServiceBus.CreateNotificationHubOptions; +import CreateQueueOptions = Azure.ServiceBus.CreateQueueOptions; +import CreateRuleOptions = Azure.ServiceBus.CreateRuleOptions; +import CreateSubscriptionOptions = Azure.ServiceBus.CreateSubscriptionOptions; +import CreateTopicIfNotExistsOptions = Azure.ServiceBus.CreateTopicIfNotExistsOptions; +import CreateTopicOptions = Azure.ServiceBus.CreateTopicOptions; +import ListNotificationHubsOptions = Azure.ServiceBus.ListNotificationHubsOptions; +import ListRulesOptions = Azure.ServiceBus.ListRulesOptions; +import ListSubscriptionsOptions = Azure.ServiceBus.ListSubscriptionsOptions; +import MessageOrName = Azure.ServiceBus.MessageOrName; +import Queue = Azure.ServiceBus.Results.Models.Queue; +import ReceiveQueueMessageOptions = Azure.ServiceBus.ReceiveQueueMessageOptions; +import ReceiveSubscriptionMessageOptions = Azure.ServiceBus.ReceiveSubscriptionMessageOptions; +import ResponseCallback = Azure.ServiceBus.ResponseCallback; +import ResultAndResponseCallback = Azure.ServiceBus.ResultAndResponseCallback; +import Rule = Azure.ServiceBus.Results.Models.Rule; +import Subscription = Azure.ServiceBus.Results.Models.Subscription; +import Topic = Azure.ServiceBus.Results.Models.Topic; +import TypedResultAndResponseCallback = Azure.ServiceBus.TypedResultAndResponseCallback; +import Message = Azure.ServiceBus.Message; + +declare class ServiceBusService extends ServiceBusServiceBase { + constructor(configOrNamespaceOrConnectionString?: string, + accessKey?: string, + issuer?: string, + acsNamespace?: string, + host?: string, + authenticationProvider?: object); + + public receiveQueueMessage(queuePath: string, + callback: TypedResultAndResponseCallback): void; + + public receiveQueueMessage(queuePath: string, + options: ReceiveQueueMessageOptions, + callback: TypedResultAndResponseCallback): void; + + public receiveSubscriptionMessage(topicPath: string, + subscriptionPath: string, + callback: TypedResultAndResponseCallback): void; + + public receiveSubscriptionMessage(topicPath: string, + subscriptionPath: string, + options: ReceiveSubscriptionMessageOptions, + callback: TypedResultAndResponseCallback): void; + + public deleteMessage(message: MessageOrName, + callback: ResponseCallback): void; + + public unlockMessage(message: MessageOrName, + callback: ResponseCallback): void; + + public renewLockForMessage(message: MessageOrName, + callback: ResponseCallback): void; + + public sendQueueMessage(queuePath: string, + message: MessageOrName, + callback: ResponseCallback): void; + + public sendTopicMessage(topicPath: string, + message: MessageOrName, + callback: ResponseCallback): void; + + /* + * Queue Management functions + */ + + public createQueue(queuePath: string, + callback: TypedResultAndResponseCallback): void; + + public createQueue(queuePath: string, + options: CreateQueueOptions, + callback: TypedResultAndResponseCallback): void; + + public createQueueIfNotExists(queuePath: string, + callback: TypedResultAndResponseCallback): void; + + public createQueueIfNotExists(queuePath: string, + options: CreateQueueOptions, + callback: TypedResultAndResponseCallback): void; + + public deleteQueue(queuePath: string, + callback: ResponseCallback): void; + + public getQueue(queuePath: string, + callback: TypedResultAndResponseCallback): void; + + public listQueues(queuePath: string, + callback: TypedResultAndResponseCallback): void; + + /* + * Topic Management functions + */ + + public createTopic(topicPath: string, + callback: TypedResultAndResponseCallback): void; + + public createTopic(topicPath: string, + options: CreateTopicOptions, + callback: TypedResultAndResponseCallback): void; + + public createTopicIfNotExists(topicPath: string, + callback: TypedResultAndResponseCallback): void; + + public createTopicIfNotExists(topicPath: string, + options: CreateTopicIfNotExistsOptions, + callback: TypedResultAndResponseCallback): void; + + public deleteTopic(topicPath: string, + callback: ResponseCallback): void; + + public getTopic(topicPath: string, + callback: TypedResultAndResponseCallback): void; + + public listTopics(topicPath: string, + callback: TypedResultAndResponseCallback): void; + + /* + * Subscription functions + */ + + public createSubscription(topicPath: string, + subscriptionPath: string, + callback: TypedResultAndResponseCallback): void; + + public createSubscription(topicPath: string, + subscriptionPath: string, + options: CreateSubscriptionOptions, + callback: TypedResultAndResponseCallback): void; + + public deleteSubscription(topicPath: string, + subscriptionPath: string, + callback: ResponseCallback): void; + + public getSubscription(topicPath: string, + subscriptionPath: string, + callback: TypedResultAndResponseCallback): void; + + public listSubscriptions(topicPath: string, + callback: TypedResultAndResponseCallback): void; + + public listSubscriptions(topicPath: string, + options: ListSubscriptionsOptions, + callback: TypedResultAndResponseCallback): void; + + /* + * Rule functions + */ + + public createRule(topicPath: string, + subscriptionPath: string, + rulePath: string, + callback: TypedResultAndResponseCallback): void; + + public createRule(topicPath: string, + subscriptionPath: string, + rulePath: string, + options: CreateRuleOptions, + callback: TypedResultAndResponseCallback): void; + + public deleteRule(topicPath: string, + subscriptionPath: string, + rulePath: string, + callback: ResponseCallback): void; + + public getRule(topicPath: string, + subscriptionPath: string, + rulePath: string, + callback: TypedResultAndResponseCallback): void; + + public listRules(topicPath: string, + subscriptionPath: string, + callback: TypedResultAndResponseCallback): void; + + public listRules(topicPath: string, + subscriptionPath: string, + options: ListRulesOptions, + callback: TypedResultAndResponseCallback): void; + + /* + * NotificationHub functions + */ + + public createNotificationHub(hubPath: string, + callback: ResultAndResponseCallback): void; + + public createNotificationHub(hubPath: string, + options: CreateNotificationHubOptions, + callback: ResultAndResponseCallback): void; + + public getNotificationHub(hubPath: string, + callback: ResultAndResponseCallback): void; + + public listNotificationHubs(callback: ResultAndResponseCallback): void; + + public listNotificationHubs(options: ListNotificationHubsOptions, + callback: ResultAndResponseCallback): void; + + public deleteNotificationHub(hubPath: string, + callback: ResponseCallback): void; +} + +export = ServiceBusService; diff --git a/types/azure-sb/lib/servicebusservicebase.d.ts b/types/azure-sb/lib/servicebusservicebase.d.ts new file mode 100644 index 0000000000..c29ead478c --- /dev/null +++ b/types/azure-sb/lib/servicebusservicebase.d.ts @@ -0,0 +1,12 @@ +import ServiceBusServiceClient = require('azure-sb/lib/servicebusserviceclient'); + +declare class ServiceBusServiceBase extends ServiceBusServiceClient { + constructor(configOrNamespaceOrConnectionString: string, + accessKey?: string, + issuer?: string, + acsNamespace?: string, + host?: string, + authenticationProvider?: object); +} + +export = ServiceBusServiceBase; diff --git a/types/azure-sb/lib/servicebusserviceclient.d.ts b/types/azure-sb/lib/servicebusserviceclient.d.ts new file mode 100644 index 0000000000..c97b1e3107 --- /dev/null +++ b/types/azure-sb/lib/servicebusserviceclient.d.ts @@ -0,0 +1,14 @@ +/// +import EventEmitter = NodeJS.EventEmitter; + +declare class ServiceBusServiceClient extends EventEmitter { + constructor(accessKey?: string, + issuer?: string, + sharedAccessKeyName?: string, + sharedAccessKeyValue?: string, + host?: string, + acsHost?: string, + authenticationProvider?: object); +} + +export = ServiceBusServiceClient; diff --git a/types/azure-sb/lib/wnsservice.d.ts b/types/azure-sb/lib/wnsservice.d.ts new file mode 100644 index 0000000000..1fef2da042 --- /dev/null +++ b/types/azure-sb/lib/wnsservice.d.ts @@ -0,0 +1,377 @@ +import NotificationHubService = require('azure-sb/lib/notificationhubservice'); +import Callback = Azure.ServiceBus.ResponseCallback; +import { Azure } from 'azure-sb'; +import ListNotificationHubsOptions = Azure.ServiceBus.ListNotificationHubsOptions; +import Dictionary = Azure.ServiceBus.Dictionary; + +type Payload = Partial<{ + text1: string; + text2: string; + text3: string; + text4: string; + image1src: string; + image1alt: string; + image2src: string; + image2alt: string; + image3src: string; + image3alt: string; + image4src: string; + image4alt: string; + lang: string; + type: string; +}>; + +interface Options { + headers: Dictionary; +} + +type badges = + 'none' + | 'activity' + | 'alert' + | 'available' + | 'away' + | 'busy' + | 'newMessage' + | 'paused' + | 'playing' + | 'unavailable' + | 'error' + | 'attention'; + +type types = 'wns/toast' | 'wns/badge' | 'wns/tile' | 'wns/raw'; + +declare class WnsService { + constructor(service: NotificationHubService); + + public notificationHubService: NotificationHubService; + + sendTileSquareBlock(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileSquareText01(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileSquareText02(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileSquareText03(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileSquareText04(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideText01(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideText02(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideText03(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideText04(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideText05(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideText06(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideText07(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideText08(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideText09(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideText10(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideText11(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileSquareImage(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileSquarePeekImageAndText01(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileSquarePeekImageAndText02(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileSquarePeekImageAndText03(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileSquarePeekImageAndText04(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideImage(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideImageCollection(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideImageAndText01(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideImageAndText02(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideBlockAndText01(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideBlockAndText02(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideSmallImageAndText01(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideSmallImageAndText02(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideSmallImageAndText03(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideSmallImageAndText04(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWideSmallImageAndText05(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWidePeekImageCollection01(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWidePeekImageCollection02(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWidePeekImageCollection03(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWidePeekImageCollection04(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWidePeekImageCollection05(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWidePeekImageCollection06(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWidePeekImageAndText01(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWidePeekImageAndText02(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWidePeekImage01(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWidePeekImage02(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWidePeekImage03(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWidePeekImage04(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWidePeekImage05(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendTileWidePeekImage06(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendToastText01(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendToastText02(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendToastText03(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendToastText04(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendToastImageAndText01(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendToastImageAndText02(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendToastImageAndText03(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendToastImageAndText04(tags: string | string[], + payload: any, + optionsOrCallback: Options | Callback, + callback?: Callback): void; + + sendBadge(tags: badges | badges[], + value: string | number, + callback?: Callback): void; + + sendBadge(tags: badges | badges[], + value: string | number, + options: Options, + callback?: Callback): void; + + sendRaw(tags: string | string[], + payload: any, + callback?: Callback): void; + + sendRaw(tags: string | string[], + payload: any, + options: Options, + callback?: Callback): void; + + send(tags: string | string[], + payload: string, + type: types, + callback?: Callback): void; + + send(tags: string | string[], + payload: string, + type: types, + options: Options, + callback: Callback): void; + + createNativeRegistration(channel: string, + tags: string | string[], + callback: Callback): void; + + createNativeRegistration(channel: string, + tags: string | string[], + options: Options, + callback: Callback): void; + + createOrUpdateNativeRegistration(registrationId: string, + channel: string, + tags: string | string[], + callback: Callback): void; + + createOrUpdateNativeRegistration(registrationId: string, + channel: string, + tags: string | string[], + options: Options, + callback: Callback): void; + + listRegistrationsByChannel(channel: string, + callback: Callback): void; + + listRegistrationsByChannel(channel: string, + options: ListNotificationHubsOptions, + callback: Callback): void; + +} + +export = WnsService; diff --git a/types/azure-sb/lib/wrapservice.d.ts b/types/azure-sb/lib/wrapservice.d.ts new file mode 100644 index 0000000000..5fbbc87345 --- /dev/null +++ b/types/azure-sb/lib/wrapservice.d.ts @@ -0,0 +1,21 @@ +import { Azure } from 'azure-sb'; + +declare class WrapService { + constructor(acsHost: string, issuer?: string, accessKey?: string); + + public issuer?: string; + public accessKey?: string; + public authenticationProvider: { + signRequest(webResource: any, callback: () => void): void; + }; + public strictSSL: boolean; + + public wrapAccessToken(uri: string, + callback: Azure.ServiceBus.ResponseCallback): void; + + public wrapAccessToken(uri: string, + options: object, + callback: Azure.ServiceBus.ResponseCallback): void; +} + +export = WrapService; diff --git a/types/azure-sb/tsconfig.json b/types/azure-sb/tsconfig.json index 525d24577e..09c9a2a9e4 100644 --- a/types/azure-sb/tsconfig.json +++ b/types/azure-sb/tsconfig.json @@ -17,7 +17,26 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts", - "azure-sb-tests.ts" + "lib/servicebusservice.d.ts", + "lib/wrapservice.d.ts", + "lib/servicebusservicebase.d.ts", + "lib/notificationhubservice.d.ts", + "lib/models/topicresult.d.ts", + "lib/models/queuemessageresult.d.ts", + "lib/models/acstokenresult.d.ts", + "lib/models/registrationresult.d.ts", + "lib/models/ruleresult.d.ts", + "lib/models/queueresult.d.ts", + "lib/models/subscriptionresult.d.ts", + "lib/models/notificationhubresult.d.ts", + "lib/models/resourceresult.d.ts", + "lib/servicebusserviceclient.d.ts", + "lib/gcmservice.d.ts", + "lib/wnsservice.d.ts", + "lib/mpnservice.d.ts", + "lib/apnsservice.d.ts", + "azure-sb-tests.ts", + "index.d.ts" ] -} \ No newline at end of file +} + diff --git a/types/big.js/index.d.ts b/types/big.js/index.d.ts index cf197e8cfc..eac22f59c7 100644 --- a/types/big.js/index.d.ts +++ b/types/big.js/index.d.ts @@ -280,11 +280,9 @@ export interface Big { export const Big: BigConstructor; // Helpers to allow referencing Big and BigConstructor from inside the global declaration without creating a self reference -/* tslint:disable:strict-export-declare-modifiers */ -type Big_ = Big; -type BigConstructor_ = BigConstructor; -type BigSource_ = BigSource; -/* tslint:enable:strict-export-declare-modifiers */ +export type Big_ = Big; +export type BigConstructor_ = BigConstructor; +export type BigSource_ = BigSource; declare global { namespace BigJs { diff --git a/types/bindings/bindings-tests.ts b/types/bindings/bindings-tests.ts new file mode 100644 index 0000000000..e66ab51353 --- /dev/null +++ b/types/bindings/bindings-tests.ts @@ -0,0 +1,4 @@ +import bindings = require('bindings'); + +// Use your bindings defined in your C files +const result = bindings('binding.node').your_c_function(); diff --git a/types/bindings/index.d.ts b/types/bindings/index.d.ts new file mode 100644 index 0000000000..9403a7a92b --- /dev/null +++ b/types/bindings/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for bindings 1.3 +// Project: https://github.com/TooTallNate/node-bindings +// Definitions by: Daniel Perez Alvarez +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * The main `bindings()` function loads the compiled bindings for a given module. + * It uses V8's Error API to determine the parent filename that this function is + * being invoked from, which is then used to find the root directory. + */ +declare function bindings(mod: string): any; + +export = bindings; diff --git a/types/bindings/tsconfig.json b/types/bindings/tsconfig.json new file mode 100644 index 0000000000..fb9350642a --- /dev/null +++ b/types/bindings/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bindings-tests.ts" + ] +} diff --git a/types/bindings/tslint.json b/types/bindings/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/bindings/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/bootstrap-notify/index.d.ts b/types/bootstrap-notify/index.d.ts index 0517b62cf8..540f200d9c 100644 --- a/types/bootstrap-notify/index.d.ts +++ b/types/bootstrap-notify/index.d.ts @@ -6,10 +6,7 @@ /// -/* tslint:disable: interface-name no-any */ - interface JQueryStatic { - /* tslint:enable: interface-name */ notify(message: string): NotifyReturn; notify(opts: NotifyOptions, settings?: NotifySettings): NotifyReturn; notifyDefaults(settings: NotifySettings): void; diff --git a/types/bson/index.d.ts b/types/bson/index.d.ts index 6aeeabe3d9..380e6e380c 100644 --- a/types/bson/index.d.ts +++ b/types/bson/index.d.ts @@ -58,6 +58,9 @@ export class Code { } export class DBRef { constructor(namespace: string, oid: ObjectID, db?: string); + namespace: string; + oid: ObjectID; + db?: string; } export class Double { constructor(value: number); diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index 1e9e3b55bc..810377184e 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -16,12 +16,10 @@ import * as Promise from "bluebird"; * Everytime the same queue is instantiated it tries to process all the old jobs that may exist from a previous unfinished session. */ declare const Bull: { - // tslint:disable:unified-signatures (queueName: string, opts?: Bull.QueueOptions): Bull.Queue; - (queueName: string, url?: string): Bull.Queue; + (queueName: string, url?: string): Bull.Queue; // tslint:disable-line unified-signatures new (queueName: string, opts?: Bull.QueueOptions): Bull.Queue; - new (queueName: string, url?: string): Bull.Queue; - // tslint:enable:unified-signatures + new (queueName: string, url?: string): Bull.Queue; // tslint:disable-line unified-signatures }; declare namespace Bull { @@ -520,8 +518,6 @@ declare namespace Bull { */ clean(grace: number, status?: JobStatus, limit?: number): Promise; - // tslint:disable:unified-signatures - /** * Listens to queue events */ @@ -566,7 +562,7 @@ declare namespace Bull { /** * The queue has been resumed */ - on(event: 'resumed', callback: EventCallback): this; + on(event: 'resumed', callback: EventCallback): this; // tslint:disable-line unified-signatures /** * Old jobs have been cleaned from the queue. @@ -575,8 +571,6 @@ declare namespace Bull { * @see Queue#clean() for details */ on(event: 'cleaned', callback: CleanedEventCallback): this; - - // tslint:enable:unified-signatures } type EventCallback = () => void; diff --git a/types/bunyan/index.d.ts b/types/bunyan/index.d.ts index 0a0c648220..4ee972d29c 100644 --- a/types/bunyan/index.d.ts +++ b/types/bunyan/index.d.ts @@ -24,8 +24,6 @@ declare class Logger extends EventEmitter { fields: any; src: boolean; - /* tslint:disable:unified-signatures */ - /** * Returns a boolean: is the `trace` level enabled? * @@ -199,8 +197,6 @@ declare class Logger extends EventEmitter { * Uses `util.format` for msg formatting. */ fatal(format: any, ...params: any[]): void; - - /* tslint:enable:unified-signatures */ } declare namespace Logger { diff --git a/types/bunyan/tslint.json b/types/bunyan/tslint.json index 09f94cd344..2204f23ff3 100644 --- a/types/bunyan/tslint.json +++ b/types/bunyan/tslint.json @@ -2,6 +2,7 @@ "extends": "dtslint/dt.json", "rules": { // ban-types needs to be disabled to support TypeScript <2.2 - "ban-types": false + "ban-types": false, + "unified-signatures": false } } diff --git a/types/cancan/cancan-tests.ts b/types/cancan/cancan-tests.ts new file mode 100644 index 0000000000..0d6ab3e9a7 --- /dev/null +++ b/types/cancan/cancan-tests.ts @@ -0,0 +1,32 @@ +import CanCan = require('cancan'); + +const cancan = new CanCan(); + +// $ExpectType void +cancan.allow('admin', 'manage', 'all'); + +// $ExpectType void +cancan.allow('user', 'read', 'post', {public: true}); + +// $ExpectType boolean +cancan.can('user', 'read', 'post'); + +// $ExpectType boolean +cancan.cannot('user', 'delete', 'post'); + +// $ExpectType void +cancan.authorize('user', 'delete', 'post'); + +// $ExpectType boolean +cancan.can('user', 'read', 'post', {fields: ['title']}); + +// $ExpectType boolean +cancan.cannot('user', 'delete', 'post', {fields: ['title']}); + +// $ExpectType void +cancan.authorize('user', 'delete', 'post', {fields: ['title']}); + +const cancanWithOption = new CanCan({ + instanceOf: (_instance, _model) => true, + createError: () => true +}); diff --git a/types/cancan/index.d.ts b/types/cancan/index.d.ts new file mode 100644 index 0000000000..e739af1ef5 --- /dev/null +++ b/types/cancan/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for cancan 3.1 +// Project: https://github.com/vadimdemedes/cancan +// Definitions by: Vincent Pang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +declare namespace CanCan { + interface Option { + instanceOf?: (instance: any, model: any) => boolean; + createError?: () => any; + } +} + +declare class CanCan { + constructor(options?: CanCan.Option); + + allow(model: any, + actions: string | ReadonlyArray, + targets: T | ReadonlyArray | string | ReadonlyArray, + condition?: object | ((performer: any, target: any, options?: any) => boolean)): void; + + can(performer: any, action: string, target: any, options?: any): boolean; + + cannot(performer: any, action: string, target: any, options?: any): boolean; + + authorize(performer: any, action: string, target: any, options?: any): void; +} + +export = CanCan; diff --git a/types/cancan/tsconfig.json b/types/cancan/tsconfig.json new file mode 100644 index 0000000000..8aace9dd52 --- /dev/null +++ b/types/cancan/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cancan-tests.ts" + ] +} diff --git a/types/cancan/tslint.json b/types/cancan/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/cancan/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index 7d18eb39a8..614fbe26ef 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -364,7 +364,7 @@ declare namespace Chart { interface TickOptions { autoSkip?: boolean; - autoSkipPadding?: boolean; + autoSkipPadding?: number; callback?(value: any, index: any, values: any): string|number; display?: boolean; fontColor?: ChartColor; diff --git a/types/chocolatechipjs/index.d.ts b/types/chocolatechipjs/index.d.ts index 4c1d49f6d1..2b53368f08 100644 --- a/types/chocolatechipjs/index.d.ts +++ b/types/chocolatechipjs/index.d.ts @@ -10,7 +10,6 @@ interface ChocolateChipStatic { * * @param selector A string containing a selector expression * @param context A DOM HTMLElement to use as context - * @return HTMLElement[] */ (selector: string | HTMLElement | Document, context?: HTMLElement | ChocolateChipElementArray): ChocolateChipElementArray; @@ -18,7 +17,6 @@ interface ChocolateChipStatic { * Binds a function to be executed when the DOM has finished loading. * * @param callback A function to execute after the DOM is ready. - * @return void */ (callback: () => any): void; @@ -26,7 +24,6 @@ interface ChocolateChipStatic { * Accepts a string containing a CSS selector which is then used to match a set of elements. * * @param element A DOM element to wrap in an array. - * @return HTMLElement[] */ (element: HTMLElement): ChocolateChipElementArray; @@ -34,7 +31,6 @@ interface ChocolateChipStatic { * Accepts a string containing a CSS selector which is then used to match a set of elements. * * @param elementArray An array of DOM elements to convert into a ChocolateChip Collection. - * @return HTMLElement[] */ (elementArray: ChocolateChipElementArray): ChocolateChipElementArray; @@ -42,13 +38,11 @@ interface ChocolateChipStatic { * Accepts the document element and returns it wrapped in an array. * * @param document The document object. - * @return document[] */ (document: Document): Document[]; /** * If no argument is provided, return the document as a ChocolateChipElementArray. - * @return Document[] */ (): Document[]; @@ -94,8 +88,6 @@ interface ChocolateChipStatic { /** * An empty function. - * - * @return void. */ noop(): void; @@ -106,40 +98,27 @@ interface ChocolateChipStatic { /** * Create a random number to use as a uuid. - * - * @return number. */ uuidNum(): number; /** * Creates a uuid using uuidNum(). - * - * @return A string. */ makeUuid(): string; /** * Create a ChocolateChip collection object by creating elements from an HTML string. - * - * @param selector - * @return any */ make(selector: string): ChocolateChipElementArray; /** * Create a ChocolateChip collection object by creating elements from an HTML string. This is an alias for $.make. - * - * @param selector - * @return any */ html(selector: string): ChocolateChipElementArray; /** * Replace one element with another. - * - * @param new HTMLElement - * @param old HTMLElement - * @return HTMLElement[] + * @return {HTMLElement[]} */ replace(newElement: ChocolateChipElementArray, oldElement: ChocolateChipElementArray): void; @@ -148,7 +127,7 @@ interface ChocolateChipStatic { * * @param url A string containing the URL where the script resides. * @param callback A callback function that is executed after the script loads. - * @return void + * @return {void} */ require(url: string, callback: Function): Function; @@ -157,7 +136,7 @@ interface ChocolateChipStatic { * * @param url A string containing the URL where the script resides. * @param callback A callback function that is executed after the script loads. - * @return Function + * @return {Function} */ processJSON(json: string, name?: string): any; @@ -173,7 +152,6 @@ interface ChocolateChipStatic { * Parse the data in a Promise response as JSON. * * @param response The response from a Promise. - * @result */ json(reponse: Response): JSON; @@ -182,7 +160,6 @@ interface ChocolateChipStatic { * * @param callback A function to execute. * @param duration The number of milliseconds to delay execution. - * @return any */ delay(callback: Function, duration?: number): any; @@ -190,7 +167,6 @@ interface ChocolateChipStatic { * The method will defer the execution of its callback until the call stack is clear. * * @param callback A callback to execute after a delay. - * @return Function. */ defer(callback: Function): Function; @@ -215,16 +191,14 @@ interface ChocolateChipStatic { /** * This method will concatenate strings or values as a cleaner alternative to using the '+' operator. * - * @param string or number A comma separated series of strings to concatenate. - * @return string + * @param {string | number} A comma separated series of strings to concatenate. */ concat(...string: string[]): string; /** * This method takes a space-delimited string of words and returns it as an array where the individual words are indices. * - * @param string Any string with values separated by spaces. - * @return string[] + * @param Any string with values separated by spaces. */ w(string: string): string[]; @@ -232,7 +206,6 @@ interface ChocolateChipStatic { * This method converts a string of hyphenated tokens into a camel cased string. * * @param string A string of hyphenated tokens. - * @return string */ camelize(string: string): string; @@ -240,16 +213,11 @@ interface ChocolateChipStatic { * This method converts a camel case string into lowercase with hyphens. * * @param string A camel case string. - * @return string */ deCamelize(string: string): string; /** * This method capitalizes the first letter of a string. - * - * @param string A string. - * @param boolean A boolean value. - * @return string */ capitalize(string: string, boolean?: boolean): string; @@ -257,7 +225,6 @@ interface ChocolateChipStatic { * Determine whether the argument is a string. * * @param obj Object to test whether or not it is a string. - * @return boolean */ isString(obj: any): boolean; @@ -265,7 +232,6 @@ interface ChocolateChipStatic { * Determine whether the argument is an array. * * @param obj Object to test whether or not it is an array. - * @return boolean */ isArray(obj: any): boolean; @@ -273,7 +239,6 @@ interface ChocolateChipStatic { * Determine whether the argument is a function. * * @param obj Object to test whether or not it is an function. - * @return boolean */ isFunction(obj: any): boolean; @@ -281,7 +246,6 @@ interface ChocolateChipStatic { * Determine whether the argument is an object. * * @param obj Object to test whether or not it is an object. - * @return boolean */ isObject(obj: any): boolean; @@ -297,7 +261,6 @@ interface ChocolateChipStatic { * Determine whether the argument is an empty object. * * @param obj Object to test whether or not it is an empty object. - * @return boolean */ isEmptyObject(obj: any): boolean; @@ -305,7 +268,6 @@ interface ChocolateChipStatic { * Determine whether the argument is a number. * * @param obj Object to test whether or not it is a number. - * @return boolean */ isNumber(obj: any): boolean; @@ -313,7 +275,6 @@ interface ChocolateChipStatic { * Determine whether the argument is an integer. * * @param obj Object to test whether or not it is an integer. - * @return boolean */ isInteger(obj: any): boolean; @@ -321,7 +282,6 @@ interface ChocolateChipStatic { * Determine whether the argument is a float. * * @param obj Object to test whether or not it is a float. - * @return boolean */ isFloat(obj: any): boolean; @@ -443,8 +403,8 @@ interface ChocolateChipStatic { /** * Grabs values from a form and converts them into a JSON object. * - * @param rootNode: string | HTMLElement A form whose values you want to convert to JSON. - * @param delimiter string A delimiter to namespace your form values. The default is "." + * @param rootNode: A form whose values you want to convert to JSON. + * @param delimiter A delimiter to namespace your form values. The default is "." * You use the form input's name to set up the namespace structure for your JSON, e.g. name="newUser.name.first". */ form2JSON(rootNode: string | HTMLElement, delimiter: string): Object; @@ -453,35 +413,33 @@ interface ChocolateChipStatic { * Subscribe to a publication. You provide the topic you want to subscribe to, as well as a callback to execute when a publication occurs. * Any data passed by the publisher is exposed to the callback as its second parameter. The callback's first parameter is the published topic. * - * @param topic string A topic to subscribe to. This can be a single term, or any type of namespaced term with delimiters. - * @data any You can receive any type: string, number, array, object, etc. - * @return any + * @param topic A topic to subscribe to. This can be a single term, or any type of namespaced term with delimiters. + * @param callback You can receive any type: string, number, array, object, etc. */ subscribe(topic: string, callback: (topic: string, data: any) => any): boolean; /** * Unsubscribe from a topic. Pass this the topic you wish to unsubscribe from. The subscription will be terminated immediately. * - * @param topic string The name of the topic to unsubscribe from. - * @return void + * @param topic The name of the topic to unsubscribe from. */ unsubscribe(topic: string): void; /** * Publish a topic with data for the topic's subscribers to receive. * - * @param topic string The topic you wish to publish. + * @param topic The topic you wish to publish. * @param data The data to send with the publication. This can be of any type: string, number, array, object, etc. - * @return void + * @return {void} */ publish(topic: string, data: any): string; /** * Object used to store string templates and parsed templates. * - * @param string A string defining the template. - * @param string A label used to access an object's properties in the template. If none is provided it defaults to "data": [[= data.name]]. - * @return void + * @param {strin} A string defining the template. + * @param {string} A label used to access an object's properties in the template. If none is provided it defaults to "data": [[= data.name]]. + * @return {void} */ templates: Object; @@ -495,7 +453,6 @@ interface ChocolateChipStatic { * * @param template A string of markup to use as a template. * @param variable An option name to use in the template. If it were "myData": [[= myData.name]]. Otherwise it defaults to "data": [[= data.name]]. - * @return A function. */ (template: string, variable?: string): Function; @@ -514,7 +471,6 @@ interface ChocolateChipStatic { * @param element The target container into which the content will be inserted. * @param template A string of markup. * @param data The iterable data the template will consume. - * @return void. */ (element: ChocolateChipElementArray, template: string, data: any): void; } @@ -523,7 +479,6 @@ interface ChocolateChipStatic { * An object that holds the reference to the controller for a repeater. * This is used to cache the data that a repeater uses. After the repeater is rendered, the reference is deleted from this object. * Example: $.template.data["myRepeater"] = [{name: "Joe"}, {name: "Sue"}]; - * */ data: any; @@ -567,16 +522,11 @@ interface ChocolateChipStatic { interface ChocolateChipElementArray extends Array { /** * Iterate over an Array object, executing a function for each matched element. - * - * @param Function - * @return void */ each(func: (ctx: any, idx: number) => void): void; /** * Sorts an array and removes duplicates before returning it. - * - * @return Array */ unique(): ChocolateChipElementArray; @@ -585,16 +535,13 @@ interface ChocolateChipElementArray extends Array { * When dealing with document nodes, this allows you to cherry pick a node from its collection based on its * position amongst its siblings. * - * @param number Index value indicating the node you wish to access from a collection. This is zero-based. - * @return HTMLElement + * @param index Value indicating the node you wish to access from a collection. This is zero-based. */ eq(index: number): ChocolateChipElementArray; /** * Search for a given element from among the matched elements on a collection. * This method returns the index value as an integer. - * - * @return number */ index(): number; @@ -603,7 +550,6 @@ interface ChocolateChipElementArray extends Array { * This method returns the index value as an integer. * * @param selector A selector representing an element to look for in a collection of elements. - * @return number */ index(selector: string | HTMLElement[]): number; @@ -612,7 +558,6 @@ interface ChocolateChipElementArray extends Array { * if it matches the given arguments. * * @param selector A string containing a selector expression to match elements against. - * @return HTMLElement[] */ is(selector: string): ChocolateChipElementArray; @@ -621,7 +566,6 @@ interface ChocolateChipElementArray extends Array { * if it matches the given arguments. * * @param elements One or more elements to match the current set of elements against. - * @ return HTMLElement[] */ is(element: any): ChocolateChipElementArray; @@ -630,7 +574,6 @@ interface ChocolateChipElementArray extends Array { * if it does not match the given arguments. * * @param selector A string containing a selector expression to match elements against. - * @ return HTMLElement[] */ isnt(selector: string): ChocolateChipElementArray; @@ -639,7 +582,6 @@ interface ChocolateChipElementArray extends Array { * if it does not match the given arguments. * * @param elements One or more elements to match the current set of elements against. - * @ return HTMLElement[] */ isnt(element: any): ChocolateChipElementArray; @@ -647,7 +589,6 @@ interface ChocolateChipElementArray extends Array { * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. * * @param selector A string containing a selector expression to match elements against. - * @ return HTMLElement[] */ has(selector: string): ChocolateChipElementArray; @@ -655,7 +596,6 @@ interface ChocolateChipElementArray extends Array { * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. * * @param contained A DOM element to match elements against. - * @ return HTMLElement[] */ has(contained: HTMLElement): ChocolateChipElementArray; @@ -671,7 +611,6 @@ interface ChocolateChipElementArray extends Array { * Reduce the set of matched elements to those that have a descendant that does not match the selector or DOM element. * * @param contained A DOM element to match elements against. - * @ return HTMLElement[] */ hasnt(contained: HTMLElement): ChocolateChipElementArray; @@ -684,7 +623,6 @@ interface ChocolateChipElementArray extends Array { * Get the descendants of each element in the current set of matched elements, filtered by a selector or element. * * @param selector A string containing a selector expression to match elements against. - * @ return HTMLElement[] */ find(selector: string): ChocolateChipElementArray; @@ -692,21 +630,16 @@ interface ChocolateChipElementArray extends Array { * Get the descendants of each element in the current set of matched elements, filtered by a selector or element. * * @param element An element to match elements against. - * @ return HTMLElement[] */ find(element: HTMLElement): ChocolateChipElementArray; /** * Get the immediately preceding sibling of each element in the set of matched elements. - * - * @ return HTMLElement[] */ prev(): ChocolateChipElementArray; /** * Get the immediately following sibling of each element in the set of matched elements. - * - * @ return HTMLElement[] */ next(): ChocolateChipElementArray; @@ -717,8 +650,6 @@ interface ChocolateChipElementArray extends Array { /** * Reduce the set of matched elements to the last in the set. - * - * @return HTMLElement[] */ last(): ChocolateChipElementArray; @@ -726,7 +657,6 @@ interface ChocolateChipElementArray extends Array { * Get the children of each element in the set of matched elements, optionally filtered by a selector. * * @param selector A string containing a selector expression to match elements against. - * @return HTMLElement[] */ children(selector?: string): ChocolateChipElementArray; @@ -735,7 +665,6 @@ interface ChocolateChipElementArray extends Array { * If multiple elements have the same parent, only one instance of the parent is returned. * * @param selector A string containing a selector expression to match elements against. - * @return HTMLElement[] */ parent(selector?: string): ChocolateChipElementArray; @@ -745,7 +674,6 @@ interface ChocolateChipElementArray extends Array { * retrieving that ancestor based on its distance from the element. * * @param selector A string containing a selector expression to match elements against. - * @return HTMLElement[] */ ancestor(selector: string | number): ChocolateChipElementArray; @@ -754,7 +682,6 @@ interface ChocolateChipElementArray extends Array { * itself and traversing up through its ancestors in the DOM tree. * * @param selector A string containing a selector expression to match elements against. - * @return HTMLElement[] */ closest(selector: string | number): ChocolateChipElementArray; @@ -762,14 +689,11 @@ interface ChocolateChipElementArray extends Array { * Get the siblings of each element in the set of matched elements, optionally filtered by a selector. * * @param selector A string containing a selector expression to match elements against. - * @return HTMLElement[] */ siblings(selector?: string): ChocolateChipElementArray; /** * Get the HTML contents of the first element in the set of matched elements. - * - * @return HTMLElement[] */ html(): ChocolateChipElementArray; @@ -777,7 +701,6 @@ interface ChocolateChipElementArray extends Array { * Set the HTML contents of each element in the set of matched elements. * * @param htmlString A string of HTML to set as the content of each matched element. - * @return HTMLElement[] */ html(htmlString: string): ChocolateChipElementArray; @@ -785,7 +708,6 @@ interface ChocolateChipElementArray extends Array { * Get the value of style properties for the first element in the set of matched elements. * * @param propertyName A CSS property. - * @return string */ css(propertyName: string): string; @@ -794,7 +716,6 @@ interface ChocolateChipElementArray extends Array { * * @param propertyName A CSS property name. * @param value A value to set for the property. - * @return HTMLElement[] */ css(propertyName: string, value: string): ChocolateChipElementArray; @@ -802,7 +723,6 @@ interface ChocolateChipElementArray extends Array { * Set one or more CSS properties for the set of matched elements. * * @param properties An object of property-value pairs to set. - * @return HTMLElement[] */ css(properties: Object): ChocolateChipElementArray; @@ -819,7 +739,6 @@ interface ChocolateChipElementArray extends Array { * * @param attributeName A string indicating the attribute to set. * @param value A string indicating the value to set the attribute to. - * @return HTMLElement[] */ attr(attributeName: string, value: string): ChocolateChipElementArray; @@ -827,7 +746,6 @@ interface ChocolateChipElementArray extends Array { * Remove an attribute from a node. * * @param attributeName A string indicating the attribute to remove. - * @return HTMLElement[] */ removeAttr(attributeName: string): ChocolateChipElementArray; @@ -835,7 +753,6 @@ interface ChocolateChipElementArray extends Array { * Return any of the matched elements that have the given attribute. * * @param className The class name to search for. - * @return HTMLElement[] */ hasAttr(attributeName: string): ChocolateChipElementArray; @@ -843,7 +760,6 @@ interface ChocolateChipElementArray extends Array { * Test whether an attribute exists on the first element in the set of matched elements. The value returned is a boolean. * * @param attributeName The name of the attribute to get. - * @return boolean */ prop(propertyName: string): boolean; @@ -852,7 +768,6 @@ interface ChocolateChipElementArray extends Array { * * @param propertyName A string indicating the property to set. * @param value A string indicating the value to set the property to. - * @return HTMLElement[] */ prop(propertyName: string, value: any | boolean): ChocolateChipElementArray; @@ -860,7 +775,6 @@ interface ChocolateChipElementArray extends Array { * Remove an element property. * * @param property The property to remove. - * @return HTMLElement[] */ removeProp(property: string): ChocolateChipElementArray; @@ -868,7 +782,6 @@ interface ChocolateChipElementArray extends Array { * Adds the specified class(es) to each of the set of matched elements. * * @param className One or more space-separated classes to be added to the class attribute of each matched element. - * @return HTMLElement[] */ addClass(className: string): ChocolateChipElementArray; @@ -876,7 +789,6 @@ interface ChocolateChipElementArray extends Array { * Remove a single class or multiple classes from each element in the set of matched elements. * * @param className One or more space-separated classes to be removed from the class attribute of each matched element. - * @return HTMLElement[] */ removeClass(className?: string): ChocolateChipElementArray; @@ -884,7 +796,6 @@ interface ChocolateChipElementArray extends Array { * Add or remove a classe from each element in the set of matched elements, depending on whether the class is present or not. * * @param className One or more class names (separated by spaces) to be toggled for each element in the matched set. - * @return HTMLElement[] */ toggleClass(className: string, swtch?: boolean): ChocolateChipElementArray; @@ -892,7 +803,6 @@ interface ChocolateChipElementArray extends Array { * Return any of the matched elements that have the given class. * * @param className The class name to search for. - * @return HTMLElement[] */ hasClass(className: string): ChocolateChipElementArray; @@ -901,7 +811,6 @@ interface ChocolateChipElementArray extends Array { * * @param key A string naming the piece of data to set. * @param value The new data value; it can be any Javascript type including Array or Object. - * @return HTMLElement[] */ data(key: string, value: any): ChocolateChipElementArray; @@ -910,7 +819,6 @@ interface ChocolateChipElementArray extends Array { * data(name). * * @param key Name of the data stored. - * @return any */ data(key: string): any; @@ -918,7 +826,6 @@ interface ChocolateChipElementArray extends Array { * Remove the value at the named data store for the first element in the element collection, as set by data(name, value). * * @param key Name of the data stored. - * @return any */ removeData(key?: string): any; @@ -927,7 +834,6 @@ interface ChocolateChipElementArray extends Array { * * @param key A string naming the piece of data to set. * @param value The new data value; it must be a string. You can convert JSON into a string to use with this. - * @return HTMLElement[] */ dataset(key: string, value: any): ChocolateChipElementArray; @@ -935,7 +841,6 @@ interface ChocolateChipElementArray extends Array { * Retrieve a dataset key's value for the first element in the element collection. * * @param key A string naming the piece of data to set. - * @return HTMLElement[] */ dataset(key: string): ChocolateChipElementArray; @@ -943,7 +848,6 @@ interface ChocolateChipElementArray extends Array { * Return the value at the named data store for the first element in the element collection, as set by data(name, value). * * @param key Name of the data stored. - * @return any */ data(key: string): any; @@ -952,7 +856,6 @@ interface ChocolateChipElementArray extends Array { * * @param key A string naming the piece of data to set. * @param value The new data value; it can be any Javascript type including Array or Object. - * @return HTMLElement[] */ data(key: string, value?: any): ChocolateChipElementArray; @@ -966,21 +869,16 @@ interface ChocolateChipElementArray extends Array { * * @param value A string of text or an array of strings corresponding to the value of each matched element * to set as selected/checked. - * @return any */ val(value: string): ChocolateChipElementArray; /** * Set the property of an element to enabled by removing the "disabled" attribute. - * - * @return HTMLElement[] */ enable(): ChocolateChipElementArray; /** * Set the property of an element to "disabled". - * - * @return HTMLElement[] */ disable(): ChocolateChipElementArray; @@ -989,7 +887,6 @@ interface ChocolateChipElementArray extends Array { * * @param speed A string or number determining how long the animation will run. * @param callback A function to call once the animation is complete. - * @return HTMLElement[] */ show(duration?: number | string, callback?: Function): ChocolateChipElementArray; @@ -998,7 +895,6 @@ interface ChocolateChipElementArray extends Array { * * @param duration A string or number determining how long the animation will run. * @param callback A function to call once the animation is complete. - * @return HTMLElement[] */ hide(duration?: number | string, callback?: Function): ChocolateChipElementArray; @@ -1006,7 +902,6 @@ interface ChocolateChipElementArray extends Array { * Insert content, specified by the parameter, before each element in the set of matched elements. * * @param content HTML string, DOM element, array of elements to insert before each element in the set of matched elements. - * @return HTMLElement[] */ before(content: ChocolateChipElementArray | HTMLElement | string): ChocolateChipElementArray; @@ -1014,7 +909,6 @@ interface ChocolateChipElementArray extends Array { * Insert content, specified by the parameter, after each element in the set of matched elements. * * @param content HTML string, DOM element, array of elements to insert after each element in the set of matched elements. - * @return HTMLElement[] */ after(content: ChocolateChipElementArray | HTMLElement | string): ChocolateChipElementArray; @@ -1023,7 +917,6 @@ interface ChocolateChipElementArray extends Array { * * @param content DOM element, array of elements, or HTML string to insert at the end of each element in the set * of matched elements. - * @return HTMLElement[] */ append(content: ChocolateChipElementArray | HTMLElement | Text | string): ChocolateChipElementArray; @@ -1031,7 +924,6 @@ interface ChocolateChipElementArray extends Array { * Insert content, specified by the parameter, at the beginning of each element in the set of matched elements. * * @param content DOM element, array of elements, or HTML string to insert at the beginning of each element in the set of matched elements. - * @return HTMLElement[] */ prepend(content: ChocolateChipElementArray | HTMLElement | Text | string): ChocolateChipElementArray; @@ -1039,7 +931,6 @@ interface ChocolateChipElementArray extends Array { * Insert every element in the set of matched elements to the beginning of the target. * * @param target A selector, element, or HTML string. The matched set of elements will be inserted at the beginning of the element specified by this parameter. - * @return HTMLElement[] */ prependTo(target: any[] | HTMLElement | string): ChocolateChipElementArray; @@ -1048,14 +939,11 @@ interface ChocolateChipElementArray extends Array { * * @param target A selector, element, or HTML string. The matched set of elements will be inserted at the end of the element specified by this parameter. * If no position value is provided it will simply append the content to the target. - * @return HTMLElement[] */ appendTo(target: any[] | HTMLElement | string): ChocolateChipElementArray; /** * Insert element(s) into the target element. - * - * @return HTMLElement[] */ insert(content: string, position?: number | string): ChocolateChipElementArray; @@ -1063,7 +951,6 @@ interface ChocolateChipElementArray extends Array { * Create a copy of the set of matched elements. * * @param value A Boolean indicating whether to copy the element(s) with their children. A true value copies the children. - * @return HTMLElement[] */ clone(value?: boolean): ChocolateChipElementArray; @@ -1071,14 +958,11 @@ interface ChocolateChipElementArray extends Array { * Wrap an HTML structure around each element in the set of matched elements. * * @param wrappingElement A selector or HTML string specifying the structure to wrap around the matched elements. - * @return HTMLElement[] */ wrap(wrappingElement: string): ChocolateChipElementArray; /** * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. - * - * @return HTMLElement[] */ unwrap(): ChocolateChipElementArray; @@ -1086,21 +970,17 @@ interface ChocolateChipElementArray extends Array { * Remove the set of matched elements from the DOM. If there are any attached events, this will remove them to prevent memory leaks. * * @param selector A selector expression that filters the set of matched elements to be removed. - * @return HTMLElement[] */ remove(selector?: string): ChocolateChipElementArray; /** * Remove all child nodes of the set of matched elements from the DOM. - * - * @return HTMLElement[] */ empty(): ChocolateChipElementArray; /** * Get an object of the current coordinates of the first element in the set of matched elements, relative to the document. * These are: top, left, bottom and right. The values are numbers representing pixel values. - * @return Object */ offset(): { top: number; @@ -1112,23 +992,17 @@ interface ChocolateChipElementArray extends Array { /** * Get the current computed width for the first element in the set of matched elements, * including padding but excluding borders. - * - * @return number */ width(): number; /** * Get the current computed height for the first element in the set of matched elements, * including padding but excluding borders. - * - * @return number */ height(): number; /** - * Get the combined text contents of each element in the set of matched elements, including their descendants. - * - * @return string + * Get the combined text contents of each element in the set of matched elements, including their descendants */ text(): string; @@ -1139,7 +1013,6 @@ interface ChocolateChipElementArray extends Array { * The text to set as the content of each matched element. * When Number is supplied, it will be converted to a String representation. * To delete text, use ChocolateChipElementArray.empty() or ChocolateChipElementArray.remove(). - * @return HTMLElement */ text(text: string | number): HTMLElement; @@ -1149,7 +1022,6 @@ interface ChocolateChipElementArray extends Array { * @param options And object of key value pairs define the CSS properties and values to animate. * @param duration A string representing the time. Should have a time identifier: "200s", "200ms", etc. * @param easing A string indicating the easing for the animation, such as "ease-out", "ease-in", "ease-in-out". - * @return void */ animate(options: Object, duration?: string, easing?: string): void; @@ -1159,7 +1031,6 @@ interface ChocolateChipElementArray extends Array { * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. * @param handler A function to execute each time the event is triggered. * @param useCapture Setting the third argument to true will trigger event bubbling. The default is false. - * @return ChocolateChipStatic */ bind(eventType: string, handler: (eventObject: Event) => any, useCapture?: boolean): ChocolateChipStatic; @@ -1169,7 +1040,6 @@ interface ChocolateChipElementArray extends Array { * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. * @param handler A function to execute each time the event is triggered. * @param useCapture Setting the third argument to true will trigger event bubbling. The default is false. - * @return ChocolateChipStatic */ unbind(eventType?: string, handler?: (eventObject: Event) => any, useCapture?: boolean): ChocolateChipStatic; @@ -1181,7 +1051,6 @@ interface ChocolateChipElementArray extends Array { * @param handler A function to execute each time the event is triggered. The keyword "this" will refer * to the element receiving the event. * @param useCapture Setting the third argument to true will trigger event bubbling. The default is false. - * @return ChocolateChipStatic */ delegate(selector: any, eventType: string, handler: (eventObject: Event) => any, useCapture?: boolean): ChocolateChipStatic; @@ -1192,7 +1061,6 @@ interface ChocolateChipElementArray extends Array { * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. * @param handler A function handler assigned to this event. * @param useCapture Setting the third argument to true will trigger event bubbling. The default is false. - * @return ChocolateChipStatic */ undelegate(selector?: any, eventType?: string, handler?: (eventObject: Event) => any, useCapture?: boolean): ChocolateChipStatic; @@ -1203,7 +1071,6 @@ interface ChocolateChipElementArray extends Array { * @param selector A string defining the descendant elements are listening for the event. * @param handler A function handler assigned to this event. * @param useCapture Setting the third argument to true will trigger event bubbling. The default is false. - * @return ChocolateChipStatic */ on(eventType: string, selector: any, handler?: (eventObject: Event) => any, capturePhase?: boolean): ChocolateChipStatic; @@ -1215,7 +1082,6 @@ interface ChocolateChipElementArray extends Array { * @param selector A string defining the descendant elements are listening for the event. * @param handler A function handler assigned to this event. * @param useCapture Setting the third argument to true will trigger event bubbling. The default is false. - * @return ChocolateChipStatic */ off(eventType?: string, selector?: any, handler?: (eventObject: Event) => any, capturePhase?: boolean): ChocolateChipStatic; @@ -1223,7 +1089,6 @@ interface ChocolateChipElementArray extends Array { * Trigger an event on an element. * * @param eventType The event to trigger. - * @return void */ trigger(eventType: string): void; } diff --git a/types/chocolatechipjs/tslint.json b/types/chocolatechipjs/tslint.json index ce367ade18..9969e961d1 100644 --- a/types/chocolatechipjs/tslint.json +++ b/types/chocolatechipjs/tslint.json @@ -7,6 +7,10 @@ "dt-header": false, "no-any-union": false, "unified-signatures": false, - "no-unnecessary-generics": false + "no-unnecessary-generics": false, + // TODO: left in redundant jsdoc that conflicts with type declarations + // Need to go over each and decide whether the jsdoc or type is correct + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false } } diff --git a/types/chrome/chrome-app.d.ts b/types/chrome/chrome-app.d.ts index 561544c00c..4ecf1d344a 100644 --- a/types/chrome/chrome-app.d.ts +++ b/types/chrome/chrome-app.d.ts @@ -1,20 +1,20 @@ // Type definitions for Chrome packaged application development // Project: http://developer.chrome.com/apps/ -// Definitions by: Adam Lay , MIZUNE Pine , MIZUSHIMA Junki , Ingvar Stepanyan , Adam Pyle +// Definitions by: Adam Lay , MIZUNE Pine , MIZUSHIMA Junki , Ingvar Stepanyan , Adam Pyle , Nikolai Ommundsen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// /// //////////////////// // App //////////////////// declare namespace chrome.app { - interface AppDetails extends chrome.runtime.Manifest { - id: string; - } + export interface AppDetails extends chrome.runtime.Manifest { + id: string; + } - export function getDetails(): AppDetails; + export function getDetails(): AppDetails; } //////////////////// @@ -56,31 +56,31 @@ declare namespace chrome.app.runtime { actionData?: {}; } - interface LaunchDataItem { + export interface LaunchDataItem { entry: FileEntry; type: string; } - interface LaunchedEvent extends chrome.events.Event<(launchData: LaunchData) => void> {} + export interface LaunchedEvent extends chrome.events.Event<(launchData: LaunchData) => void> { } - interface RestartedEvent extends chrome.events.Event<() => void> {} + export interface RestartedEvent extends chrome.events.Event<() => void> { } - var onLaunched: LaunchedEvent; - var onRestarted: RestartedEvent; + export var onLaunched: LaunchedEvent; + export var onRestarted: RestartedEvent; } //////////////////// // App Window //////////////////// declare namespace chrome.app.window { - interface ContentBounds { + export interface ContentBounds { left?: number; top?: number; width?: number; height?: number; } - interface BoundsSpecification { + export interface BoundsSpecification { left?: number; top?: number; width?: number; @@ -91,7 +91,7 @@ declare namespace chrome.app.window { maxHeight?: number; } - interface Bounds { + export interface Bounds { left: number; top: number; width: number; @@ -105,14 +105,14 @@ declare namespace chrome.app.window { setMinimumSize(minWidth: number, minHeight: number): void; setMaximumSize(maxWidth: number, maxHeight: number): void; } - interface FrameOptions { + export interface FrameOptions { type?: string; color?: string; activeColor?: string; inactiveColor?: string; } - interface CreateWindowOptions { + export interface CreateWindowOptions { id?: string; innerBounds?: BoundsSpecification; outerBounds?: BoundsSpecification; @@ -120,10 +120,20 @@ declare namespace chrome.app.window { minHeight?: number; maxWidth?: number; maxHeight?: number; - frame?: any; // string ("none", "chrome") or FrameOptions + /** + * @description + * @type {(string | FrameOptions)} string ("none", "chrome") or FrameOptions + * @memberof CreateWindowOptions + */ + frame?: string | FrameOptions; bounds?: ContentBounds; alphaEnabled?: boolean; - state?: string; // "normal", "fullscreen", "maximized", "minimized" + /** + * @description + * @type {string} "normal", "fullscreen", "maximized", "minimized" + * @memberof CreateWindowOptions + */ + state?: string; hidden?: boolean; resizable?: boolean; singleton?: boolean; @@ -132,7 +142,7 @@ declare namespace chrome.app.window { visibleOnAllWorkspaces?: boolean; } - interface AppWindow { + export interface AppWindow { focus: () => void; fullscreen: () => void; isFullscreen: () => boolean; @@ -171,14 +181,14 @@ declare namespace chrome.app.window { export function getAll(): AppWindow[]; export function canSetVisibleOnAllWorkspaces(): boolean; - interface WindowEvent extends chrome.events.Event<() => void> {} + export interface WindowEvent extends chrome.events.Event<() => void> { } - var onBoundsChanged: WindowEvent; - var onClosed: WindowEvent; - var onFullscreened: WindowEvent; - var onMaximized: WindowEvent; - var onMinimized: WindowEvent; - var onRestored: WindowEvent; + export var onBoundsChanged: WindowEvent; + export var onClosed: WindowEvent; + export var onFullscreened: WindowEvent; + export var onMaximized: WindowEvent; + export var onMinimized: WindowEvent; + export var onRestored: WindowEvent; } //////////////////// @@ -186,13 +196,13 @@ declare namespace chrome.app.window { //////////////////// declare namespace chrome.fileSystem { - interface AcceptOptions { + export interface AcceptOptions { description?: string; mimeTypes?: string[]; extensions?: string[]; } - interface ChooseEntryOptions { + export interface ChooseEntryOptions { type?: string; suggestedName?: string; accepts?: AcceptOptions[]; @@ -216,11 +226,11 @@ declare namespace chrome.fileSystem { // Media Galleries //////////////////// declare namespace chrome.mediaGalleries { - interface MediaFileSystemsOptions { + export interface MediaFileSystemsOptions { interactive?: 'no' | 'yes' | 'if_needed'; } - interface MediaFileSystemMetadata { + export interface MediaFileSystemMetadata { name: string; galleryId: string; deviceId?: string; @@ -229,16 +239,16 @@ declare namespace chrome.mediaGalleries { isAvailable: boolean; } - interface MetadataOptions { + export interface MetadataOptions { metadataType: 'all' | 'mimeTypeAndTags' | 'mimeTypeOnly'; } - interface RawTag { + export interface RawTag { type: string; tags: { [name: string]: string; }; } - interface Metadata { + export interface Metadata { // The browser sniffed mime type. mimeType: string; // Defined for images and video. In pixels. @@ -275,17 +285,17 @@ declare namespace chrome.mediaGalleries { attachedImages: Blob[]; } - interface GalleryWatchResult { + export interface GalleryWatchResult { galleryId: string; success: boolean; } - interface GalleryChangedEventArgs { + export interface GalleryChangedEventArgs { type: 'contents_changed' | 'watch_dropped'; galleryId: string; } - interface ScanProgressEventArgs { + export interface ScanProgressEventArgs { // The type of progress event, i.e. start, finish, etc. type: 'start' | 'cancel' | 'finish' | 'error'; // The number of Galleries found. @@ -312,40 +322,40 @@ declare namespace chrome.mediaGalleries { export function getAllGalleryWatch(callback: (galleryIds: string[]) => void): void; export function removeAllGalleryWatch(): void; - var onGalleryChanged: chrome.events.Event<(args: GalleryChangedEventArgs) => void>; - var onScanProgress: chrome.events.Event<(args: ScanProgressEventArgs) => void>; + export var onGalleryChanged: chrome.events.Event<(args: GalleryChangedEventArgs) => void>; + export var onScanProgress: chrome.events.Event<(args: ScanProgressEventArgs) => void>; } //////////////////// // Sockets //////////////////// declare namespace chrome.sockets.tcp { - interface CreateInfo { + export interface CreateInfo { socketId: number; } - interface SendInfo { + export interface SendInfo { resultCode: number; bytesSent?: number; } - interface ReceiveEventArgs { + export interface ReceiveEventArgs { socketId: number; data: ArrayBuffer; } - interface ReceiveErrorEventArgs { + export interface ReceiveErrorEventArgs { socketId: number; resultCode: number; } - interface SocketProperties { + export interface SocketProperties { persistent?: boolean; name?: string; bufferSize?: number; } - interface SocketInfo { + export interface SocketInfo { socketId: number; persistent: boolean; name?: string; @@ -378,8 +388,8 @@ declare namespace chrome.sockets.tcp { export function getInfo(socketId: number, callback: (socketInfo: SocketInfo) => void): void; export function getSockets(callback: (socketInfos: SocketInfo[]) => void): void; - var onReceive: chrome.events.Event<(args: ReceiveEventArgs) => void>; - var onReceiveError: chrome.events.Event<(args: ReceiveErrorEventArgs) => void>; + export var onReceive: chrome.events.Event<(args: ReceiveEventArgs) => void>; + export var onReceiveError: chrome.events.Event<(args: ReceiveErrorEventArgs) => void>; } /** @@ -391,23 +401,23 @@ declare namespace chrome.sockets.tcp { * @see https://developer.chrome.com/apps/sockets_udp */ declare namespace chrome.sockets.udp { - interface CreateInfo { + export interface CreateInfo { socketId: number; } - interface SendInfo { + export interface SendInfo { resultCode: number; bytesSent?: number; } - interface ReceiveEventArgs { + export interface ReceiveEventArgs { socketId: number; data: ArrayBuffer; remoteAddress: string; remotePort: number; } - interface ReceiveErrorEventArgs { + export interface ReceiveErrorEventArgs { socketId: number; resultCode: number; } @@ -415,7 +425,7 @@ declare namespace chrome.sockets.udp { /** * @see https://developer.chrome.com/apps/sockets_udp#type-SocketProperties */ - interface SocketProperties { + export interface SocketProperties { /** * Flag indicating if the socket is left open when the event page of the * application is unloaded. The default value is "false." When the @@ -439,7 +449,7 @@ declare namespace chrome.sockets.udp { /** * @see https://developer.chrome.com/apps/sockets_udp#type-SocketInfo */ - interface SocketInfo { + export interface SocketInfo { /** The socket identifier. */ socketId: number; @@ -663,7 +673,7 @@ declare namespace chrome.sockets.udp { * * @see https://developer.chrome.com/apps/sockets_udp#event-onReceive */ - var onReceive: chrome.events.Event<(args: ReceiveEventArgs) => void>; + export var onReceive: chrome.events.Event<(args: ReceiveEventArgs) => void>; /** * Event raised when a network error occured while the runtime was waiting @@ -673,7 +683,7 @@ declare namespace chrome.sockets.udp { * * @see https://developer.chrome.com/apps/sockets_udp#event-onReceiveError */ - var onReceiveError: chrome.events.Event<(args: ReceiveErrorEventArgs) => void>; + export var onReceiveError: chrome.events.Event<(args: ReceiveErrorEventArgs) => void>; } /** @@ -685,16 +695,16 @@ declare namespace chrome.sockets.udp { * @see https://developer.chrome.com/apps/sockets_tcpServer */ declare namespace chrome.sockets.tcpServer { - interface CreateInfo { + export interface CreateInfo { socketId: number; } - interface AcceptEventArgs { + export interface AcceptEventArgs { socketId: number; clientSocketId: number; } - interface AcceptErrorEventArgs { + export interface AcceptErrorEventArgs { socketId: number; resultCode: number; } @@ -702,7 +712,7 @@ declare namespace chrome.sockets.tcpServer { /** * @see https://developer.chrome.com/apps/sockets_tcpServer#type-SocketProperties */ - interface SocketProperties { + export interface SocketProperties { /** * Flag indicating if the socket remains open when the event page of the * application is unloaded. The default value is "false." When the @@ -720,7 +730,7 @@ declare namespace chrome.sockets.tcpServer { /** * @see https://developer.chrome.com/apps/sockets_tcpServer#type-SocketInfo */ - interface SocketInfo { + export interface SocketInfo { /** The socket identifier. */ socketId: number; @@ -863,7 +873,7 @@ declare namespace chrome.sockets.tcpServer { * * @see https://developer.chrome.com/apps/sockets_tcpServer#event-onAccept */ - var onAccept: chrome.events.Event<(args: AcceptEventArgs) => void>; + export var onAccept: chrome.events.Event<(args: AcceptEventArgs) => void>; /** * Event raised when a network error occured while the runtime was waiting @@ -873,7 +883,7 @@ declare namespace chrome.sockets.tcpServer { * * @see https://developer.chrome.com/apps/sockets_tcpServer#event-onAcceptError */ - var onAcceptError: chrome.events.Event<(args: AcceptErrorEventArgs) => void>; + export var onAcceptError: chrome.events.Event<(args: AcceptErrorEventArgs) => void>; } //////////////////// @@ -885,7 +895,7 @@ declare namespace chrome.sockets.tcpServer { * @since Chrome 30. */ declare namespace chrome.system.display { - interface Bounds { + export interface Bounds { /** The x-coordinate of the upper-left corner. */ left: number; /** The y-coordinate of the upper-left corner. */ @@ -896,7 +906,7 @@ declare namespace chrome.system.display { height: number; } - interface Insets { + export interface Insets { /** The x-axis distance from the left bound. */ left: number; /** The y-axis distance from the top bound. */ @@ -907,7 +917,141 @@ declare namespace chrome.system.display { bottom: number; } - interface DisplayInfo { + /** + * @since Chrome 57 + */ + export interface Point { + /** The x-coordinate of the point. */ + x: number; + /** The y-coordinate of the point. */ + y: number; + } + + /** + * @since Chrome 57 + */ + export interface TouchCalibrationPair { + /** The coordinates of the display point. */ + displayPoint: Point; + /** The coordinates of the touch point corresponding to the display point. */ + touchPoint: Point; + } + + /** + * @since Chrome 52 + */ + export interface DisplayMode { + /** The display mode width in device independent (user visible) pixels. */ + width: number; + + /** The display mode height in device independent (user visible) pixels. */ + height: number; + + /** The display mode width in native pixels. */ + widthInNativePixels: number; + + /** The display mode height in native pixels. */ + heightInNativePixels: number; + + /** The display mode UI scale factor. */ + uiScale: number; + + /** The display mode device scale factor. */ + deviceScaleFactor: number; + + /** True if the mode is the display's native mode. */ + isNative: boolean; + + /** True if the display mode is currently selected. */ + isSelected: boolean; + } + + /** + * @since Chrome 53 + */ + export interface DisplayLayout { + /** The unique identifier of the display. */ + id: string; + /** The unique identifier of the parent display. Empty if this is the root. */ + parentId: string; + /** The layout position of this display relative to the parent. This will be ignored for the root. */ + position: 'top' | 'right' | 'bottom' | 'left'; + /** The offset of the display along the connected edge. 0 indicates that the topmost or leftmost corners are aligned. */ + offset: number; + } + + /** + * @description The pairs of point used to calibrate the display. + * @export + * @interface TouchCalibrationPairs + */ + export interface TouchCalibrationPairs { + /** First pair of touch and display point required for touch calibration. */ + pair1: TouchCalibrationPair, + /** Second pair of touch and display point required for touch calibration. */ + pair2: TouchCalibrationPair, + /** Third pair of touch and display point required for touch calibration. */ + pair3: TouchCalibrationPair, + /** Fourth pair of touch and display point required for touch calibration. */ + pair4: TouchCalibrationPair + } + + /** + * @description Representation of info data to be used in chrome.system.display.setDisplayProperties() + * @export + * @interface DisplayPropertiesInfo + */ + export interface DisplayPropertiesInfo { + /** + * @description Chrome OS only. If set to true, changes the display mode to unified desktop (see enableUnifiedDesktop for details). If set to false, unified desktop mode will be disabled. This is only valid for the primary display. If provided, mirroringSourceId must not be provided and other properties may not apply. This is has no effect if not provided. + * @since Chrome 59 + * */ + isUnified?: boolean; + + /** + * Chrome OS only. If set and not empty, enables mirroring for this display. Otherwise disables mirroring for this display. This value should indicate the id of the source display to mirror, which must not be the same as the id passed to setDisplayProperties. If set, no other property may be set. + */ + mirroringSourceId?: string; + + /** If set to true, makes the display primary. No-op if set to false. */ + isPrimary?: boolean; + + /** If set, sets the display's overscan insets to the provided values. Note that overscan values may not be negative or larger than a half of the screen's size. Overscan cannot be changed on the internal monitor. It's applied after isPrimary parameter. */ + overscan?: Insets; + + /** If set, updates the display's rotation. Legal values are [0, 90, 180, 270]. The rotation is set clockwise, relative to the display's vertical position. It's applied after overscan paramter. */ + rotation?: 0 | 90 | 180 | 270; + + /** If set, updates the display's logical bounds origin along x-axis. Applied together with boundsOriginY, if boundsOriginY is set. Note that, when updating the display origin, some constraints will be applied, so the final bounds origin may be different than the one set. The final bounds can be retrieved using getInfo. The bounds origin is applied after rotation. The bounds origin cannot be changed on the primary display. Note that is also invalid to set bounds origin values if isPrimary is also set (as isPrimary parameter is applied first). */ + boundsOriginX?: number; + + /** If set, updates the display's logical bounds origin along y-axis. See documentation for boundsOriginX parameter. */ + boundsOriginY: number; + + /** + * @since Chrome 52 + * @description If set, updates the display mode to the mode matching this value. + */ + displayMode?: DisplayMode; + } + + /** + * @description Options affecting how the information is returned. + * @since Chrome 59 + * @export + * @interface DisplayInfoFlags + */ + export interface DisplayInfoFlags { + /** + * @description If set to true, only a single DisplayUnitInfo will be returned by getInfo when in unified desktop mode (see enableUnifiedDesktop). Defaults to false. + * @type {boolean} + * @memberof DisplayInfoFlags + */ + singleUnified?: boolean; + } + + /** Information about display properties. */ + export interface DisplayInfo { /** The unique identifier of the display. */ id: string; /** The user-friendly name (e.g. "HP LCD monitor"). */ @@ -935,7 +1079,7 @@ declare namespace chrome.system.display { } /** The information about display properties that should be changed. A property will be changed only if a new value for it is specified in |info|. */ - interface DisplayProps { + export interface DisplayProps { /** If set and not empty, starts mirroring between this and the display with the provided id (the system will determine which of the displays is actually mirrored). If set and not empty, stops mirroring between this and the display with the specified id (if mirroring is in progress). If set, no other parameter may be set. */ mirroringSourceId?: string; /** If set to true, makes the display primary. No-op if set to false. */ @@ -950,14 +1094,131 @@ declare namespace chrome.system.display { boundsOriginY?: number; } - interface DisplayChangedEvent extends chrome.events.Event<() => void> { } + /** + * @description Fired when anything changes to the display configuration. + * @export + * @interface DisplayChangedEvent + * @extends {chrome.events.Event<() => void>} + */ + export interface DisplayChangedEvent extends chrome.events.Event<() => void> { } - /** Queries basic CPU information of the system. */ + /** + * @description Requests the information for all attached display devices. + * @export + * @param {(info: DisplayInfo[]) => void} callback The callback to invoke with the results. + */ export function getInfo(callback: (info: DisplayInfo[]) => void): void; + /** + * @description Requests the information for all attached display devices. + * @export + * @since Chrome 59 + * @param {DisplayInfoFlags} [flags] Options affecting how the information is returned. + * @param {(info: DisplayInfo[]) => void} callback The callback to invoke with the results. + */ + export function getInfo(flags: DisplayInfoFlags, callback: (info: DisplayInfo[]) => void): void; - /** Updates the properties for the display specified by |id|, according to the information provided in |info|. On failure, runtime.lastError will be set. */ - export function setDisplayProperties(id: string, info: DisplayInfo, callback?: () => void): void; + /** + * @description Requests the layout info for all displays. NOTE: This is only available to Chrome OS Kiosk apps and Web UI. + * @since Chrome 53 + * @export + * @param {(layouts: DisplayLayout[]) => void} callback The callback to invoke with the results. + */ + export function getDisplayLayout(callback: (layouts: DisplayLayout[]) => void): void; + /** + * @description Updates the properties for the display specified by |id|, according to the information provided in |info|. On failure, runtime.lastError will be set. NOTE: This is only available to Chrome OS Kiosk apps and Web UI. + * @export + * @param {string} id The display's unique identifier. + * @param {DisplayPropertiesInfo} info The information about display properties that should be changed. A property will be changed only if a new value for it is specified in |info|. + * @param {() => void} [callback] Empty function called when the function finishes. To find out whether the function succeeded, runtime.lastError should be queried. + */ + export function setDisplayProperties(id: string, info: DisplayPropertiesInfo, callback?: () => void): void; + + /** + * @description Set the layout for all displays. Any display not included will use the default layout. If a layout would overlap or be otherwise invalid it will be adjusted to a valid layout. After layout is resolved, an onDisplayChanged event will be triggered. NOTE: This is only available to Chrome OS Kiosk apps and Web UI. + * @since Chrome 53 + * @export + * @param {DisplayLayout[]} layouts The layout information, required for all displays except the primary display. + * @param {() => void} callback Empty function called when the function finishes. To find out whether the function succeeded, runtime.lastError should be queried. + */ + export function setDisplayLayout(layouts: DisplayLayout[], callback?: () => void): void; + + /** + * @description Enables/disables the unified desktop feature. Note that this simply enables the feature, but will not change the actual desktop mode. (That is, if the desktop is in mirror mode, it will stay in mirror mode) NOTE: This is only available to Chrome OS Kiosk apps and Web UI. + * @since Chrome 46 + * @export + * @param {boolean} enabled True if unified desktop should be enabled. + */ + export function enableUnifiedDesktop(enabled: boolean): void; + /** + * @description Starts overscan calibration for a display. This will show an overlay on the screen indicating the current overscan insets. If overscan calibration for display |id| is in progress this will reset calibration. + * @since Chrome 53 + * @export + * @param {string} id The display's unique identifier. + */ + export function overscanCalibrationStart(id: string): void; + /** + * @description Adjusts the current overscan insets for a display. Typically this should etiher move the display along an axis (e.g. left+right have the same value) or scale it along an axis (e.g. top+bottom have opposite values). Each Adjust call is cumulative with previous calls since Start. + * @since Chrome 53 + * @export + * @param {string} id The display's unique identifier. + * @param {Insets} delta The amount to change the overscan insets. + */ + export function overscanCalibrationAdjust(id: string, delta: Insets): void; + + /** + * @description Resets the overscan insets for a display to the last saved value (i.e before Start was called). + * @since Chrome 53 + * @export + * @param {string} id The display's unique identifier. + */ + export function overscanCalibrationReset(id: string): void; + + /** + * @description Complete overscan adjustments for a display by saving the current values and hiding the overlay. + * @since Chrome 53 + * @export + * @param {string} id The display's unique identifier. + */ + export function overscanCalibrationComplete(id: string): void; + + /** + * @description Displays the native touch calibration UX for the display with |id| as display id. This will show an overlay on the screen with required instructions on how to proceed. The callback will be invoked in case of successful calibraion only. If the calibration fails, this will throw an error. + * @since Chrome 57 + * @export + * @param {string} id The display's unique identifier. + * @param {(success) => void} callback Optional callback to inform the caller that the touch calibration has ended. The argument of the callback informs if the calibration was a success or not. + */ + export function showNativeTouchCalibration(id: string, callback: (success) => void): void; + + /** + * @description Starts custom touch calibration for a display. This should be called when using a custom UX for collecting calibration data. If another touch calibration is already in progress this will throw an error. + * @since Chrome 57 + * @export + * @param {string} id The display's unique identifier. + */ + export function startCustomTouchCalibration(id: string): void; + + /** + * @description Sets the touch calibration pairs for a display. These |pairs| would be used to calibrate the touch screen for display with |id| called in startCustomTouchCalibration(). Always call |startCustomTouchCalibration| before calling this method. If another touch calibration is already in progress this will throw an error. + * @since Chrome 57 + * @export + * @param {TouchCalibrationPairs} pairs The pairs of point used to calibrate the display. + * @param {Bounds} bounds Bounds of the display when the touch calibration was performed. |bounds.left| and |bounds.top| values are ignored. + */ + export function completeCustomTouchCalibration(pairs: TouchCalibrationPairs, bounds: Bounds): void; + /** + * @description Resets the touch calibration for the display and brings it back to its default state by clearing any touch calibration data associated with the display. + * @since Chrome 57 + * @export + * @param {string} id The display's unique identifier. + */ + export function clearTouchCalibration(id: string): void; + + /** + * @description Fired when anything changes to the display configuration. + * @export + */ export var onDisplayChanged: DisplayChangedEvent; } @@ -965,7 +1226,7 @@ declare namespace chrome.system.display { // System - Network //////////////////// declare namespace chrome.system.network { - interface NetworkInterface { + export interface NetworkInterface { name: string; address: string; prefixLength: number; @@ -975,159 +1236,268 @@ declare namespace chrome.system.network { } declare namespace chrome.runtime { - interface Manifest { - app?: { - background?: { - scripts?: string[]; - } - }, - bluetooth?: { - uuids?: string[]; - socket?: boolean; - low_energy?: boolean; - peripheral?: boolean; - }, - file_handlers?: { - [name: string]: { - types?: string[]; - extensions?: string[]; - title?: string; - } - }, - kiosk_enabled?: boolean, - kiosk_only?: boolean, - url_handlers?: { - [name: string]: { - matches: string[]; - title?: string; - } - }, - usb_printers?: { - filters: { - vendorId?: number; - productId?: number; - interfaceClass?: number; - interfaceSubclass?: number; - interfaceProtocol?: number; - }[] - }, - webview?: { - partitions?: { - name: string; - accessible_resources: string[]; - }[] - } - } + export interface Manifest { + app?: { + background?: { + scripts?: string[]; + } + }, + bluetooth?: { + uuids?: string[]; + socket?: boolean; + low_energy?: boolean; + peripheral?: boolean; + }, + file_handlers?: { + [name: string]: { + types?: string[]; + extensions?: string[]; + title?: string; + } + }, + kiosk_enabled?: boolean, + kiosk_only?: boolean, + url_handlers?: { + [name: string]: { + matches: string[]; + title?: string; + } + }, + usb_printers?: { + filters: { + vendorId?: number; + productId?: number; + interfaceClass?: number; + interfaceSubclass?: number; + interfaceProtocol?: number; + }[] + }, + webview?: { + partitions?: { + name: string; + accessible_resources: string[]; + }[] + } + } } //////////////////// // USB //////////////////// declare namespace chrome.usb { - type Direction = 'in' | 'out'; + type Direction = 'in' | 'out'; - interface Device { - device: number, - vendorId: number, - productId: number, - productName: string, - manufacturerName: string, - serialNumber: string - } + export interface Device { + device: number, + vendorId: number, + productId: number, + productName: string, + manufacturerName: string, + serialNumber: string + } - interface ConnectionHandle { - handle: number, - vendorId: number, - productId: number - } + export interface ConnectionHandle { + handle: number, + vendorId: number, + productId: number + } - interface EndpointDescriptor { - address: number, - type: 'control' | 'interrupt' | 'isochronous' | 'bulk', - direction: Direction, - maximumPacketSize: number, - synchronization?: 'asynchronous' | 'adaptive' | 'synchronous', - usage?: 'data' | 'feedback' | 'explicitFeedback', - pollingInterval?: number, - extra_data: ArrayBuffer - } + export interface EndpointDescriptor { + address: number, + type: 'control' | 'interrupt' | 'isochronous' | 'bulk', + direction: Direction, + maximumPacketSize: number, + synchronization?: 'asynchronous' | 'adaptive' | 'synchronous', + usage?: 'data' | 'feedback' | 'explicitFeedback', + pollingInterval?: number, + extra_data: ArrayBuffer + } - interface InterfaceDescriptor { - interfaceNumber: number, - alternateSetting: number, - interfaceClass: number, - interfaceSubclass: number, - interfaceProtocol: number, - description?: string, - endpoints: EndpointDescriptor[], - extra_data: ArrayBuffer - } + export interface InterfaceDescriptor { + interfaceNumber: number, + alternateSetting: number, + interfaceClass: number, + interfaceSubclass: number, + interfaceProtocol: number, + description?: string, + endpoints: EndpointDescriptor[], + extra_data: ArrayBuffer + } - interface ConfigDescriptor { - active: boolean, - configurationValue: number, - description?: string, - selfPowered: boolean, - remoteWakeup: boolean, - maxPower: number, - interfaces: InterfaceDescriptor[], - extra_data: ArrayBuffer - } + export interface ConfigDescriptor { + active: boolean, + configurationValue: number, + description?: string, + selfPowered: boolean, + remoteWakeup: boolean, + maxPower: number, + interfaces: InterfaceDescriptor[], + extra_data: ArrayBuffer + } - interface GenericTransferInfo { - direction: Direction, - endpoint: number, - length?: number, - data?: ArrayBuffer, - timeout?: number - } + export interface GenericTransferInfo { + direction: Direction, + endpoint: number, + length?: number, + data?: ArrayBuffer, + timeout?: number + } - interface TransferResultInfo { - resultCode: number, - data?: ArrayBuffer - } + export interface TransferResultInfo { + resultCode: number, + data?: ArrayBuffer + } - interface DeviceFilter { - vendorId?: number, - productId?: number, - interfaceClass?: number, - interfaceSubclass?: number, - interfaceProtocol?: number - } + export interface DeviceFilter { + vendorId?: number, + productId?: number, + interfaceClass?: number, + interfaceSubclass?: number, + interfaceProtocol?: number + } - interface TransferInfo { - direction: Direction; - recipient: 'device' | 'interface' | 'endpoint' | 'other'; - requestType: 'standard' | 'class' | 'vendor' | 'reserved'; - request: number; - value: number; - index: number; - length?: number; - data?: ArrayBuffer; - timeout?: number; - } + export interface TransferInfo { + direction: Direction; + recipient: 'device' | 'interface' | 'endpoint' | 'other'; + requestType: 'standard' | 'class' | 'vendor' | 'reserved'; + request: number; + value: number; + index: number; + length?: number; + data?: ArrayBuffer; + timeout?: number; + } - interface DeviceEvent extends chrome.events.Event<(device: Device) => void> {} + export interface DeviceEvent extends chrome.events.Event<(device: Device) => void> { } - export var onDeviceAdded: DeviceEvent; - export var onDeviceRemoved: DeviceEvent; + export var onDeviceAdded: DeviceEvent; + export var onDeviceRemoved: DeviceEvent; - export function getDevices(options: { vendorId?: number, productId?: number, filters?: DeviceFilter[] }, callback: (devices: Device[]) => void): void; - export function getUserSelectedDevices(options: { multiple?: boolean, filters?: DeviceFilter[] }, callback: (devices: Device[]) => void): void; - export function getConfigurations(device: Device, callback: (configs: ConfigDescriptor[]) => void): void; - export function requestAccess(device: Device, interfaceId: number, callback: (success: boolean) => void): void; - export function openDevice(device: Device, callback: (handle: ConnectionHandle) => void): void; - export function findDevices(options: { vendorId: number, productId: number, interfaceId?: number }, callback: (handles: ConnectionHandle[]) => void): void; - export function closeDevice(handle: ConnectionHandle, callback?: () => void): void; - export function setConfiguration(handle: ConnectionHandle, configurationValue: number, callback: () => void): void; - export function getConfiguration(handle: ConnectionHandle, callback: (config: ConfigDescriptor) => void): void; - export function listInterfaces(handle: ConnectionHandle, callback: (descriptors: InterfaceDescriptor[]) => void): void; - export function claimInterface(handle: ConnectionHandle, interfaceNumber: number, callback: () => void): void; - export function releaseInterface(handle: ConnectionHandle, interfaceNumber: number, callback: () => void): void; - export function setInterfaceAlternateSetting(handle: ConnectionHandle, interfaceNumber: number, alternateSetting: number, callback: () => void): void; - export function controlTransfer(handle: ConnectionHandle, transferInfo: TransferInfo, callback: (info: TransferResultInfo) => void): void; - export function bulkTransfer(handle: ConnectionHandle, transferInfo: GenericTransferInfo, callback: (info: TransferResultInfo) => void): void; - export function interruptTransfer(handle: ConnectionHandle, transferInfo: GenericTransferInfo, callback: (info: TransferResultInfo) => void): void; - export function isochronousTransfer(handle: ConnectionHandle, transferInfo: { transferInfo: GenericTransferInfo, packets: number, packetLength: number }, callback: (info: TransferResultInfo) => void): void; - export function resetDevice(handle: ConnectionHandle, callback: (success: boolean) => void): void; + export function getDevices(options: { vendorId?: number, productId?: number, filters?: DeviceFilter[] }, callback: (devices: Device[]) => void): void; + export function getUserSelectedDevices(options: { multiple?: boolean, filters?: DeviceFilter[] }, callback: (devices: Device[]) => void): void; + export function getConfigurations(device: Device, callback: (configs: ConfigDescriptor[]) => void): void; + export function requestAccess(device: Device, interfaceId: number, callback: (success: boolean) => void): void; + export function openDevice(device: Device, callback: (handle: ConnectionHandle) => void): void; + export function findDevices(options: { vendorId: number, productId: number, interfaceId?: number }, callback: (handles: ConnectionHandle[]) => void): void; + export function closeDevice(handle: ConnectionHandle, callback?: () => void): void; + export function setConfiguration(handle: ConnectionHandle, configurationValue: number, callback: () => void): void; + export function getConfiguration(handle: ConnectionHandle, callback: (config: ConfigDescriptor) => void): void; + export function listInterfaces(handle: ConnectionHandle, callback: (descriptors: InterfaceDescriptor[]) => void): void; + export function claimInterface(handle: ConnectionHandle, interfaceNumber: number, callback: () => void): void; + export function releaseInterface(handle: ConnectionHandle, interfaceNumber: number, callback: () => void): void; + export function setInterfaceAlternateSetting(handle: ConnectionHandle, interfaceNumber: number, alternateSetting: number, callback: () => void): void; + export function controlTransfer(handle: ConnectionHandle, transferInfo: TransferInfo, callback: (info: TransferResultInfo) => void): void; + export function bulkTransfer(handle: ConnectionHandle, transferInfo: GenericTransferInfo, callback: (info: TransferResultInfo) => void): void; + export function interruptTransfer(handle: ConnectionHandle, transferInfo: GenericTransferInfo, callback: (info: TransferResultInfo) => void): void; + export function isochronousTransfer(handle: ConnectionHandle, transferInfo: { transferInfo: GenericTransferInfo, packets: number, packetLength: number }, callback: (info: TransferResultInfo) => void): void; + export function resetDevice(handle: ConnectionHandle, callback: (success: boolean) => void): void; +} + +declare namespace chrome.networking.onc { + export type ActivationStateType = 'Activated' | 'Activating' | 'NotActivated' | 'PartiallyActivated'; + export type CaptivePortalStatus = 'Unknown' | 'Offline' | 'Online' | 'Portal' | 'ProxyAuthRequired'; + export type ConnectionStateType = 'Connected' | 'Connecting' | 'NotConnected'; + export type IPConfigType = 'DHCP' | 'Static'; + export type NetworkType = 'All' | 'Cellular' | 'Ethernet' | 'VPN' | 'Wireless' | 'WiFi' | 'WiMAX'; + export type ProxySettingsType = 'Direct' | 'Manual' | 'PAC' | 'WPAD'; + export interface ManagedBoolean { + /** + * @description The active value currently used by the network configuration manager (e.g. Shill). + * @type {boolean} + * @memberof ManagedBoolean + */ + Active?: boolean, + /** + * @description The source from which the effective property value was determined. + * @type {string} + * @memberof ManagedBoolean + */ + Effective?: string, + /** + * @description The property value provided by the user policy. + * @type {boolean} + * @memberof ManagedBoolean + */ + UserPolicy?: boolean, + /** + * @description The property value provided by the device policy. + * @type {boolean} + * @memberof ManagedBoolean + */ + DevicePolicy?: boolean, + /** + * @description The property value set by the logged in user. Only provided if |UserEditable| is true. + * @type {boolean} + * @memberof ManagedBoolean + */ + UserSettings?: boolean, + /** + * @description The value set for all users of the device. Only provided if |DeviceEditiable| is true. + * @type {boolean} + * @memberof ManagedBoolean + */ + SharedSettings?: boolean, + /** + * @description Whether a UserPolicy for the property exists and allows the property to be edited (i.e. the policy set recommended property value). Defaults to false. + * @type {boolean} + * @memberof ManagedBoolean + */ + UserEditable?: boolean, + /** + * @description Whether a DevicePolicy for the property exists and allows the property to be edited (i.e. the policy set recommended property value). Defaults to false. + * @type {boolean} + * @memberof ManagedBoolean + */ + DeviceEditable?: boolean + } + export interface ManagedLong { + /** + * @description The active value currently used by the network configuration manager (e.g. Shill). + * @type {number} + * @memberof ManagedLong + */ + Active?: number, + /** + * @description The source from which the effective property value was determined. + * @type {string} + * @memberof ManagedLong + */ + Effective?: string, + /** + * @description The property value provided by the user policy. + * @type {number} + * @memberof ManagedLong + */ + UserPolicy?: number, + /** + * @description The property value provided by the device policy. + * @type {number} + * @memberof ManagedLong + */ + DevicePolicy?: number, + /** + * @description The property value set by the logged in user. Only provided if |UserEditable| is true. + * @type {number} + * @memberof ManagedLong + */ + UserSettings?: number, + /** + * @description The value set for all users of the device. Only provided if |DeviceEditiable| is true. + * @type {number} + * @memberof ManagedLong + */ + SharedSettings?: number, + /** + * @description Whether a UserPolicy for the property exists and allows the property to be edited (i.e. the policy set recommended property value). Defaults to false. + * @type {boolean} + * @memberof ManagedLong + */ + UserEditable?: boolean, + /** + * @description Whether a DevicePolicy for the property exists and allows the property to be edited (i.e. the policy set recommended property value). Defaults to false. + * @type {boolean} + * @memberof ManagedLong + */ + DeviceEditable?: boolean + } } diff --git a/types/chrome/chrome-cast.d.ts b/types/chrome/chrome-cast.d.ts index 081d3de1bf..5c240ff25c 100644 --- a/types/chrome/chrome-cast.d.ts +++ b/types/chrome/chrome-cast.d.ts @@ -12,7 +12,7 @@ declare namespace chrome.cast { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.AutoJoinPolicy */ - interface AutoJoinPolicy { + export interface AutoJoinPolicy { TAB_AND_ORIGIN_SCOPED: string; ORIGIN_SCOPED: string; PAGE_SCOPED: string; @@ -22,7 +22,7 @@ declare namespace chrome.cast { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.DefaultActionPolicy */ - interface DefaultActionPolicy { + export interface DefaultActionPolicy { CREATE_SESSION: string; CAST_THIS_TAB: string; } @@ -31,7 +31,7 @@ declare namespace chrome.cast { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Capability */ - interface Capability { + export interface Capability { VIDEO_OUT: string; AUDIO_OUT: string; VIDEO_IN: string; @@ -42,7 +42,7 @@ declare namespace chrome.cast { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ErrorCode */ - interface ErrorCode { + export interface ErrorCode { CANCEL: string; TIMEOUT: string; API_NOT_INITIALIZED: string; @@ -59,7 +59,7 @@ declare namespace chrome.cast { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ReceiverAvailability */ - interface ReceiverAvailability { + export interface ReceiverAvailability { AVAILABLE: string; UNAVAILABLE: string; } @@ -68,7 +68,7 @@ declare namespace chrome.cast { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.SenderPlatform */ - interface SenderPlatform { + export interface SenderPlatform { CHROME: string; IOS: string; ANDROID: string; @@ -78,7 +78,7 @@ declare namespace chrome.cast { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ReceiverType */ - interface ReceiverType { + export interface ReceiverType { CAST: string; HANGOUT: string; CUSTOM: string; @@ -88,7 +88,7 @@ declare namespace chrome.cast { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ReceiverAction */ - interface ReceiverAction { + export interface ReceiverAction { CAST: string; STOP: string; } @@ -99,7 +99,7 @@ declare namespace chrome.cast { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.SessionStatus */ - interface SessionStatus { + export interface SessionStatus { CONNECTED: string; DISCONNECTED: string; STOPPED: string; @@ -109,13 +109,13 @@ declare namespace chrome.cast { * @const {!Array} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.VERSION */ - var VERSION: Array; + export var VERSION: Array; /** * @type {boolean} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.isAvailable */ - var isAvailable: boolean; + export var isAvailable: boolean; /** * @param {!chrome.cast.ApiConfig} apiConfig @@ -191,7 +191,7 @@ declare namespace chrome.cast { errorCallback: (error: chrome.cast.Error) => void ): void - interface ApiConfig { + export interface ApiConfig { /** * @param {!chrome.cast.SessionRequest} sessionRequest * @param {function(!chrome.cast.Session)} sessionListener @@ -217,7 +217,7 @@ declare namespace chrome.cast { defaultActionPolicy: chrome.cast.DefaultActionPolicy; } - interface Error { + export interface Error { /** * @param {!chrome.cast.ErrorCode} code * @param {string=} opt_description @@ -237,7 +237,7 @@ declare namespace chrome.cast { } - interface Image { + export interface Image { /** * @param {string} url * @constructor @@ -252,7 +252,7 @@ declare namespace chrome.cast { width?: number; } - interface SenderApplication { + export interface SenderApplication { /** * @param {!chrome.cast.SenderPlatform} platform * @constructor @@ -267,7 +267,7 @@ declare namespace chrome.cast { packageId?: string; } - interface SessionRequest { + export interface SessionRequest { /** * @param {string} appId * @param {!Array=} opt_capabilities @@ -287,7 +287,7 @@ declare namespace chrome.cast { language?: string; } - interface Session { + export interface Session { /** * @param {string} sessionId * @param {string} appId @@ -437,7 +437,7 @@ declare namespace chrome.cast { ):void } - interface Receiver { + export interface Receiver { /** * @param {string} label * @param {string} friendlyName @@ -461,7 +461,7 @@ declare namespace chrome.cast { displayStatus: chrome.cast.ReceiverDisplayStatus; } - interface ReceiverDisplayStatus { + export interface ReceiverDisplayStatus { /** * @param {string} statusText * @param {!Array} appImages @@ -477,7 +477,7 @@ declare namespace chrome.cast { appImages: Array; } - interface Volume { + export interface Volume { /** * @param {?number=} opt_level * @param {?boolean=} opt_muted @@ -496,13 +496,13 @@ declare namespace chrome.cast { declare namespace chrome.cast.media { - var DEFAULT_MEDIA_RECEIVER_APP_ID: string; + export var DEFAULT_MEDIA_RECEIVER_APP_ID: string; /** * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MediaCommand */ - interface MediaCommand { + export interface MediaCommand { PAUSE: string; SEEK: string; STREAM_VOLUME: string; @@ -513,7 +513,7 @@ declare namespace chrome.cast.media { * @enum {number} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MetadataType */ - interface MetadataType { + export interface MetadataType { GENERIC: number; TV_SHOW: number; MOVIE: number; @@ -525,7 +525,7 @@ declare namespace chrome.cast.media { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PlayerState */ - interface PlayerState { + export interface PlayerState { IDLE: string; PLAYING: string; PAUSED: string; @@ -536,7 +536,7 @@ declare namespace chrome.cast.media { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.ResumeState */ - interface ResumeState { + export interface ResumeState { PLAYBACK_START: string; PLAYBACK_PAUSE: string; } @@ -545,7 +545,7 @@ declare namespace chrome.cast.media { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.StreamType */ - interface StreamType { + export interface StreamType { BUFFERED: string; LIVE: string; OTHER: string; @@ -555,7 +555,7 @@ declare namespace chrome.cast.media { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.IdleReason */ - interface IdleReason { + export interface IdleReason { CANCELLED: string; INTERRUPTED: string; FINISHED: string; @@ -566,14 +566,14 @@ declare namespace chrome.cast.media { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.RepeatMode */ - interface RepeatMode { + export interface RepeatMode { OFF:string; ALL:string; SINGLE:string; ALL_AND_SHUFFLE:string; } - interface QueueItem { + export interface QueueItem { /** * @param {!chrome.cast.media.MediaInfo} mediaInfo * @constructor @@ -592,7 +592,7 @@ declare namespace chrome.cast.media { startTime: number; } - interface QueueLoadRequest { + export interface QueueLoadRequest { /** * @param {!Array} items * @constructor @@ -608,7 +608,7 @@ declare namespace chrome.cast.media { startIndex: number; } - interface QueueInsertItemsRequest { + export interface QueueInsertItemsRequest { /** * @param {!Array} * @constructor @@ -623,7 +623,7 @@ declare namespace chrome.cast.media { items: Array; } - interface QueueRemoveItemsRequest { + export interface QueueRemoveItemsRequest { /** * @param {!Array} * @constructor @@ -637,7 +637,7 @@ declare namespace chrome.cast.media { itemIds: Array; } - interface QueueReorderItemsRequest { + export interface QueueReorderItemsRequest { /** * @param {!Array} * @constructor @@ -652,7 +652,7 @@ declare namespace chrome.cast.media { itemIds: Array; } - interface QueueUpdateItemsRequest { + export interface QueueUpdateItemsRequest { /** * @param {!Array} * @constructor @@ -670,7 +670,7 @@ declare namespace chrome.cast.media { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TrackType */ - interface TrackType { + export interface TrackType { TEXT: string; AUDIO: string; VIDEO: string; @@ -680,7 +680,7 @@ declare namespace chrome.cast.media { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackType */ - interface TextTrackType { + export interface TextTrackType { SUBTITLES: string; CAPTIONS: string; DESCRIPTIONS: string; @@ -692,7 +692,7 @@ declare namespace chrome.cast.media { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackEdgeType */ - interface TextTrackEdgeType { + export interface TextTrackEdgeType { NONE: string; OUTLINE: string; DROP_SHADOW: string; @@ -704,7 +704,7 @@ declare namespace chrome.cast.media { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackWindowType */ - interface TextTrackWindowType { + export interface TextTrackWindowType { NONE: string; NORMAL: string; ROUNDED_CORNERS: string; @@ -714,7 +714,7 @@ declare namespace chrome.cast.media { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackFontGenericFamily */ - interface TextTrackFontGenericFamily { + export interface TextTrackFontGenericFamily { SANS_SERIF: string; MONOSPACED_SANS_SERIF: string; SERIF: string; @@ -728,14 +728,14 @@ declare namespace chrome.cast.media { * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackFontStyle */ - interface TextTrackFontStyle { + export interface TextTrackFontStyle { NORMAL: string; BOLD: string; BOLD_ITALIC: string; ITALIC: string; } - interface GetStatusRequest { + export interface GetStatusRequest { /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.GetStatusRequest @@ -745,7 +745,7 @@ declare namespace chrome.cast.media { customData: Object; } - interface PauseRequest { + export interface PauseRequest { /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PauseRequest @@ -755,7 +755,7 @@ declare namespace chrome.cast.media { customData: Object; } - interface PlayRequest { + export interface PlayRequest { /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PlayRequest @@ -765,7 +765,7 @@ declare namespace chrome.cast.media { customData: Object; } - interface SeekRequest { + export interface SeekRequest { /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.SeekRequest @@ -777,7 +777,7 @@ declare namespace chrome.cast.media { customData: Object; } - interface StopRequest { + export interface StopRequest { /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.StopRequest @@ -787,7 +787,7 @@ declare namespace chrome.cast.media { customData: Object; } - interface VolumeRequest { + export interface VolumeRequest { /** * @param {!chrome.cast.Volume} volume * @constructor @@ -801,7 +801,7 @@ declare namespace chrome.cast.media { customData: Object; } - interface LoadRequest { + export interface LoadRequest { /** * @param {!chrome.cast.media.MediaInfo} mediaInfo * @constructor @@ -818,7 +818,7 @@ declare namespace chrome.cast.media { media: chrome.cast.media.MediaInfo; } - interface EditTracksInfoRequest { + export interface EditTracksInfoRequest { /** * @param {Array=} opt_activeTrackIds * @param {chrome.cast.media.TextTrackStyle=} opt_textTrackStyle @@ -834,7 +834,7 @@ declare namespace chrome.cast.media { textTrackStyle: chrome.cast.media.TextTrackStyle; } - interface GenericMediaMetadata { + export interface GenericMediaMetadata { /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.GenericMediaMetadata @@ -852,7 +852,7 @@ declare namespace chrome.cast.media { type: chrome.cast.media.MetadataType; } - interface MovieMediaMetadata { + export interface MovieMediaMetadata { /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MovieMediaMetadata @@ -871,7 +871,7 @@ declare namespace chrome.cast.media { type: chrome.cast.media.MetadataType; } - interface TvShowMediaMetadata { + export interface TvShowMediaMetadata { /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TvShowMediaMetadata @@ -898,7 +898,7 @@ declare namespace chrome.cast.media { releaseYear: number; } - interface MusicTrackMediaMetadata { + export interface MusicTrackMediaMetadata { /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MusicTrackMediaMetadata @@ -925,7 +925,7 @@ declare namespace chrome.cast.media { releaseYear: number; } - interface PhotoMediaMetadata { + export interface PhotoMediaMetadata { /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PhotoMediaMetadata @@ -947,7 +947,7 @@ declare namespace chrome.cast.media { type: chrome.cast.media.MetadataType; } - interface MediaInfo { + export interface MediaInfo { /** * @param {string} contentId * @param {string} contentType @@ -969,7 +969,7 @@ declare namespace chrome.cast.media { customData: Object; } - interface Media { + export interface Media { /** * @param {string} sessionId * @param {number} mediaSessionId @@ -1215,7 +1215,7 @@ declare namespace chrome.cast.media { } - interface Track { + export interface Track { /** * @param {number} trackId * @param {!chrome.cast.media.TrackType} trackType @@ -1237,7 +1237,7 @@ declare namespace chrome.cast.media { customData: Object; } - interface TextTrackStyle { + export interface TextTrackStyle { /** * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackStyle @@ -1264,17 +1264,17 @@ declare namespace chrome.cast.media { * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.timeout */ declare namespace chrome.cast.media.timeout { - var load: number; - var getStatus: number; - var play: number; - var pause: number; - var seek: number; - var stop: number; - var setVolume: number; - var editTracksInfo: number; - var queueInsert: number; - var queueLoad: number; - var queueRemove: number; - var queueReorder: number; - var queueUpdate: number; + export var load: number; + export var getStatus: number; + export var play: number; + export var pause: number; + export var seek: number; + export var stop: number; + export var setVolume: number; + export var editTracksInfo: number; + export var queueInsert: number; + export var queueLoad: number; + export var queueRemove: number; + export var queueReorder: number; + export var queueUpdate: number; } diff --git a/types/chrome/chrome-webview.d.ts b/types/chrome/chrome-webview.d.ts new file mode 100644 index 0000000000..e2e0b7c429 --- /dev/null +++ b/types/chrome/chrome-webview.d.ts @@ -0,0 +1,109 @@ +/// + +// Project: http://developer.chrome.com/apps/ +// Definitions by: Nikolai Ommundsen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 +// +// WebView ref: https://chromium.googlesource.com/chromium/src/+/64.0.3274.2/chrome/common/extensions/api/webview_tag.json +// + + +/////////////////// +// Tag +/////////////////// +/** + * Use the webview tag to actively load live content from the web over the network and embed it in your Chrome App. Your app can control the appearance of the webview and interact with the web content, initiate navigations in an embedded web page, react to error events that happen within it, and more (see Usage). + */ +declare namespace chrome.webviewTag { + /** Options that determine what data should be cleared by `clearData`. */ + export interface ClearDataOptions { + /** Clear data accumulated on or after this date, represented in milliseconds since the epoch (accessible via the getTime method of the JavaScript Date object). If absent, defaults to 0 (which would remove all browsing data). */ + since: number; + } + export interface WindowEvent extends chrome.events.Event<() => void> {} + + export interface ConsoleEvent extends Event { + /** + * @description The severity level of the log message. Ranges from 0 to 4. + * @type {number} + * @memberof ConsoleEvent + */ + level: number, + /** + * @description The logged message contents. + * @type {string} + * @memberof ConsoleEvent + */ + message: string, + /** + * @description The line number of the message source. + * @type {number} + * @memberof ConsoleEvent + */ + line: number, + /** + * @description A string identifying the resource which logged the message. + * @type {string} + * @memberof ConsoleEvent + */ + sourceId: string + } + + /** Description of a declarative rule for handling events. */ + export interface Rule { + /** Optional priority of this rule. Defaults to 100. */ + priority?: number; + /** List of conditions that can trigger the actions. */ + conditions: any[]; + /** Optional. Optional identifier that allows referencing this rule. */ + id?: string; + /** List of actions that are triggered if one of the condtions is fulfilled. */ + actions: any[]; + /** + * @description Tags can be used to annotate rules and perform operations on sets of rules.¨ + * @since Chrome 28 + * @type {string[]} + * @memberof Rule + */ + tags?: string[]; + } + + /** + * @description Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time. + * @export + * @interface InjectDetails + */ + export interface InjectDetails { + /** + * @description JavaScript or CSS code to inject.

Warning:
Be careful using the code parameter. Incorrect use of it may open your app to cross site scripting attacks. + * @type {string} + * @memberof InjectDetails + */ + code?: string, + /** + * @description JavaScript or CSS file to inject. + * @type {string} + * @memberof InjectDetails + */ + file?: string + } + + export interface WebViewElementEventMap extends ElementEventMap { + 'message': ConsoleEvent + } + + /** + * @description + * @export + * @interface HTMLWebViewElement + * @extends {Element} + */ + export interface HTMLWebViewElement extends Element { + executeScript?: (details: InjectDetails, callback?: (result: any) => void) => void, + src: string, + contentWindow: Window + addEventListener(type: K, listener: (this: HTMLWebViewElement, ev: WebViewElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + } +} diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index 16ed80730f..9946c79c38 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -23,12 +23,12 @@ interface Window { * Important: This API works only on Chrome OS. */ declare namespace chrome.accessibilityFeatures { - interface AccessibilityFeaturesGetArg { + export interface AccessibilityFeaturesGetArg { /** Optional. Whether to return the value that applies to the incognito session (default false). */ incognito?: boolean; } - interface AccessibilityFeaturesCallbackArg { + export interface AccessibilityFeaturesCallbackArg { /** The value of the setting. */ value: any; /** @@ -43,7 +43,7 @@ declare namespace chrome.accessibilityFeatures { incognitoSpecific?: boolean; } - interface AccessibilityFeaturesSetArg { + export interface AccessibilityFeaturesSetArg { /** * The value of the setting. * Note that every setting has a specific value type, which is described together with the setting. An extension should not set a value of a different type. @@ -60,7 +60,7 @@ declare namespace chrome.accessibilityFeatures { scope?: string; } - interface AccessibilityFeaturesClearArg { + export interface AccessibilityFeaturesClearArg { /** * Optional. * The scope of the ChromeSetting. One of @@ -72,7 +72,7 @@ declare namespace chrome.accessibilityFeatures { scope?: string; } - interface AccessibilityFeaturesSetting { + export interface AccessibilityFeaturesSetting { /** * Gets the value of a setting. * @param details Which setting to consider. @@ -98,14 +98,14 @@ declare namespace chrome.accessibilityFeatures { clear(details: AccessibilityFeaturesClearArg, callback?: () => void): void; } - var spokenFeedback: AccessibilityFeaturesSetting; - var largeCursor: AccessibilityFeaturesSetting; - var stickyKeys: AccessibilityFeaturesSetting; - var highContrast: AccessibilityFeaturesSetting; - var screenMagnifier: AccessibilityFeaturesSetting; - var autoclick: AccessibilityFeaturesSetting; - var virtualKeyboard: AccessibilityFeaturesSetting; - var animationPolicy: AccessibilityFeaturesSetting; + export var spokenFeedback: AccessibilityFeaturesSetting; + export var largeCursor: AccessibilityFeaturesSetting; + export var stickyKeys: AccessibilityFeaturesSetting; + export var highContrast: AccessibilityFeaturesSetting; + export var screenMagnifier: AccessibilityFeaturesSetting; + export var autoclick: AccessibilityFeaturesSetting; + export var virtualKeyboard: AccessibilityFeaturesSetting; + export var animationPolicy: AccessibilityFeaturesSetting; } //////////////////// @@ -117,7 +117,7 @@ declare namespace chrome.accessibilityFeatures { * Permissions: "alarms" */ declare namespace chrome.alarms { - interface AlarmCreateInfo { + export interface AlarmCreateInfo { /** Optional. Length of time in minutes after which the onAlarm event should fire. */ delayInMinutes?: number; /** Optional. If set, the onAlarm event should fire every periodInMinutes minutes after the initial event specified by when or delayInMinutes. If not set, the alarm will only fire once. */ @@ -126,7 +126,7 @@ declare namespace chrome.alarms { when?: number; } - interface Alarm { + export interface Alarm { /** Optional. If not null, the alarm is a repeating alarm and will fire again in periodInMinutes minutes. */ periodInMinutes?: number; /** Time at which this alarm was scheduled to fire, in milliseconds past the epoch (e.g. Date.now() + n). For performance reasons, the alarm may have been delayed an arbitrary amount beyond this. */ @@ -135,7 +135,7 @@ declare namespace chrome.alarms { name: string; } - interface AlarmEvent extends chrome.events.Event<(alarm: Alarm) => void> {} + export interface AlarmEvent extends chrome.events.Event<(alarm: Alarm) => void> {} /** * Creates an alarm. Near the time(s) specified by alarmInfo, the onAlarm event is fired. If there is another alarm with the same name (or no name if none is specified), it will be cancelled and replaced by this alarm. @@ -192,15 +192,16 @@ declare namespace chrome.alarms { export function get(name: string, callback: (alarm: Alarm) => void): void; /** Fired when an alarm has elapsed. Useful for event pages. */ - var onAlarm: AlarmEvent; + export var onAlarm: AlarmEvent; } + /** * Use the chrome.browser API to interact with the Chrome browser associated with * the current application and Chrome profile. */ declare namespace chrome.browser { - interface Options { + export interface Options { /** The URL to navigate to when the new tab is initially opened. */ url: string; } @@ -234,7 +235,7 @@ declare namespace chrome.browser { */ declare namespace chrome.bookmarks { /** A node (either a bookmark or a folder) in the bookmark tree. Child nodes are ordered within their parent folder. */ - interface BookmarkTreeNode { + export interface BookmarkTreeNode { /** Optional. The 0-based position of this node within its parent folder. */ index?: number; /** Optional. When this node was created, in milliseconds since the epoch (new Date(dateAdded)). */ @@ -259,48 +260,48 @@ declare namespace chrome.bookmarks { unmodifiable?: any; } - interface BookmarkRemoveInfo { + export interface BookmarkRemoveInfo { index: number; parentId: string; } - interface BookmarkMoveInfo { + export interface BookmarkMoveInfo { index: number; oldIndex: number; parentId: string; oldParentId: string; } - interface BookmarkChangeInfo { + export interface BookmarkChangeInfo { url?: string; title: string; } - interface BookmarkReorderInfo { + export interface BookmarkReorderInfo { childIds: string[]; } - interface BookmarkRemovedEvent extends chrome.events.Event<(id: string, removeInfo: BookmarkRemoveInfo) => void> {} + export interface BookmarkRemovedEvent extends chrome.events.Event<(id: string, removeInfo: BookmarkRemoveInfo) => void> {} - interface BookmarkImportEndedEvent extends chrome.events.Event<() => void> {} + export interface BookmarkImportEndedEvent extends chrome.events.Event<() => void> {} - interface BookmarkMovedEvent extends chrome.events.Event<(id: string, moveInfo: BookmarkMoveInfo) => void> {} + export interface BookmarkMovedEvent extends chrome.events.Event<(id: string, moveInfo: BookmarkMoveInfo) => void> {} - interface BookmarkImportBeganEvent extends chrome.events.Event<() => void> {} + export interface BookmarkImportBeganEvent extends chrome.events.Event<() => void> {} - interface BookmarkChangedEvent extends chrome.events.Event<(id: string, changeInfo: BookmarkChangeInfo) => void> {} + export interface BookmarkChangedEvent extends chrome.events.Event<(id: string, changeInfo: BookmarkChangeInfo) => void> {} - interface BookmarkCreatedEvent extends chrome.events.Event<(id: string, bookmark: BookmarkTreeNode) => void> {} + export interface BookmarkCreatedEvent extends chrome.events.Event<(id: string, bookmark: BookmarkTreeNode) => void> {} - interface BookmarkChildrenReordered extends chrome.events.Event<(id: string, reorderInfo: BookmarkReorderInfo) => void> {} + export interface BookmarkChildrenReordered extends chrome.events.Event<(id: string, reorderInfo: BookmarkReorderInfo) => void> {} - interface BookmarkSearchQuery { + export interface BookmarkSearchQuery { query?: string; url?: string; title?: string; } - interface BookmarkCreateArg { + export interface BookmarkCreateArg { /** Optional. Defaults to the Other Bookmarks folder. */ parentId?: string; index?: number; @@ -308,20 +309,20 @@ declare namespace chrome.bookmarks { url?: string; } - interface BookmarkDestinationArg { + export interface BookmarkDestinationArg { parentId?: string; index?: number; } - interface BookmarkChangesArg { + export interface BookmarkChangesArg { title?: string; url?: string; } /** @deprecated since Chrome 38. Bookmark write operations are no longer limited by Chrome. */ - var MAX_WRITE_OPERATIONS_PER_HOUR: number; + export var MAX_WRITE_OPERATIONS_PER_HOUR: number; /** @deprecated since Chrome 38. Bookmark write operations are no longer limited by Chrome. */ - var MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: number; + export var MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: number; /** * Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties. @@ -410,19 +411,19 @@ declare namespace chrome.bookmarks { export function removeTree(id: string, callback?: Function): void; /** Fired when a bookmark or folder is removed. When a folder is removed recursively, a single notification is fired for the folder, and none for its contents. */ - var onRemoved: BookmarkRemovedEvent; + export var onRemoved: BookmarkRemovedEvent; /** Fired when a bookmark import session is ended. */ - var onImportEnded: BookmarkImportEndedEvent; + export var onImportEnded: BookmarkImportEndedEvent; /** Fired when a bookmark import session is begun. Expensive observers should ignore onCreated updates until onImportEnded is fired. Observers should still handle other notifications immediately. */ - var onImportBegan: BookmarkImportBeganEvent; + export var onImportBegan: BookmarkImportBeganEvent; /** Fired when a bookmark or folder changes. Note: Currently, only title and url changes trigger this. */ - var onChanged: BookmarkChangedEvent; + export var onChanged: BookmarkChangedEvent; /** Fired when a bookmark or folder is moved to a different parent folder. */ - var onMoved: BookmarkMovedEvent; + export var onMoved: BookmarkMovedEvent; /** Fired when a bookmark or folder is created. */ - var onCreated: BookmarkCreatedEvent; + export var onCreated: BookmarkCreatedEvent; /** Fired when the children of a folder have changed their order due to the order being sorted in the UI. This is not called as a result of a move(). */ - var onChildrenReordered: BookmarkChildrenReordered; + export var onChildrenReordered: BookmarkChildrenReordered; } //////////////////// @@ -434,35 +435,35 @@ declare namespace chrome.bookmarks { * Manifest: "browser_action": {...} */ declare namespace chrome.browserAction { - interface BadgeBackgroundColorDetails { + export interface BadgeBackgroundColorDetails { /** An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is [255, 0, 0, 255]. Can also be a string with a CSS value, with opaque red being #FF0000 or #F00. */ color: string | ColorArray; /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */ tabId?: number; } - interface BadgeTextDetails { + export interface BadgeTextDetails { /** Any number of characters can be passed, but only about four can fit in the space. */ text: string; /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */ tabId?: number; } - type ColorArray = [number, number, number, number]; + export type ColorArray = [number, number, number, number]; - interface TitleDetails { + export interface TitleDetails { /** The string the browser action should display when moused over. */ title: string; /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */ tabId?: number; } - interface TabDetails { + export interface TabDetails { /** Optional. Specify the tab to get the information. If no tab is specified, the non-tab-specific information is returned. */ tabId?: number; } - interface TabIconDetails { + export interface TabIconDetails { /** Optional. Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}' */ path?: any; /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */ @@ -471,14 +472,14 @@ declare namespace chrome.browserAction { imageData?: ImageData; } - interface PopupDetails { + export interface PopupDetails { /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */ tabId?: number; /** The html file to show in a popup. If set to the empty string (''), no popup is shown. */ popup: string; } - interface BrowserClickedEvent extends chrome.events.Event<(tab: chrome.tabs.Tab) => void> {} + export interface BrowserClickedEvent extends chrome.events.Event<(tab: chrome.tabs.Tab) => void> {} /** * Since Chrome 22. @@ -536,7 +537,7 @@ declare namespace chrome.browserAction { export function setIcon(details: TabIconDetails, callback?: Function): void; /** Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup. */ - var onClicked: BrowserClickedEvent; + export var onClicked: BrowserClickedEvent; } //////////////////// @@ -548,7 +549,7 @@ declare namespace chrome.browserAction { * Permissions: "browsingData" */ declare namespace chrome.browsingData { - interface OriginTypes { + export interface OriginTypes { /** Optional. Websites that have been installed as hosted applications (be careful!). */ protectedWeb?: boolean; /** Optional. Extensions and packaged applications a user has installed (be _really_ careful!). */ @@ -558,7 +559,7 @@ declare namespace chrome.browsingData { } /** Options that determine exactly what data will be removed. */ - interface RemovalOptions { + export interface RemovalOptions { /** * Optional. * Since Chrome 21. @@ -573,7 +574,7 @@ declare namespace chrome.browsingData { * Since Chrome 27. * A set of data types. Missing data types are interpreted as false. */ - interface DataTypeSet { + export interface DataTypeSet { /** Optional. Websites' WebSQL data. */ webSQL?: boolean; /** Optional. Websites' IndexedDB data. */ @@ -608,7 +609,7 @@ declare namespace chrome.browsingData { serviceWorkers?: boolean; } - interface SettingsCallback { + export interface SettingsCallback { options: RemovalOptions; /** All of the types will be present in the result, with values of true if they are both selected to be removed and permitted to be removed, otherwise false. */ dataToRemove: DataTypeSet; @@ -726,7 +727,7 @@ declare namespace chrome.browsingData { * Manifest: "commands": {...} */ declare namespace chrome.commands { - interface Command { + export interface Command { /** Optional. The name of the Extension Command */ name?: string; /** Optional. The Extension Command description */ @@ -735,7 +736,7 @@ declare namespace chrome.commands { shortcut?: string; } - interface CommandEvent extends chrome.events.Event<(command: string) => void> {} + export interface CommandEvent extends chrome.events.Event<(command: string) => void> {} /** * Returns all the registered extension commands for this extension and their shortcut (if active). @@ -746,7 +747,7 @@ declare namespace chrome.commands { export function getAll(callback: (commands: Command[]) => void): void; /** Fired when a registered command is activated using a keyboard shortcut. */ - var onCommand: CommandEvent; + export var onCommand: CommandEvent; } //////////////////// @@ -758,7 +759,7 @@ declare namespace chrome.commands { * Permissions: "contentSettings" */ declare namespace chrome.contentSettings { - interface ClearDetails { + export interface ClearDetails { /** * Optional. * Where to clear the setting (default: regular). @@ -769,7 +770,7 @@ declare namespace chrome.contentSettings { scope?: string; } - interface SetDetails { + export interface SetDetails { /** Optional. The resource identifier for the content type. */ resourceIdentifier?: ResourceIdentifier; /** The setting applied by this rule. See the description of the individual ContentSetting objects for the possible values. */ @@ -782,7 +783,7 @@ declare namespace chrome.contentSettings { primaryPattern: string; } - interface GetDetails { + export interface GetDetails { /** Optional. The secondary URL for which the content setting should be retrieved. Defaults to the primary URL. Note that the meaning of a secondary URL depends on the content type, and not all content types use secondary URLs. */ secondaryUrl?: string; /** Optional. A more specific identifier of the type of content for which the settings should be retrieved. */ @@ -793,12 +794,12 @@ declare namespace chrome.contentSettings { primaryUrl: string; } - interface ReturnedDetails { + export interface ReturnedDetails { /** The content setting. See the description of the individual ContentSetting objects for the possible values. */ setting: any; } - interface ContentSetting { + export interface ContentSetting { /** * Clear all content setting rules set by this extension. * @param callback If you specify the callback parameter, it should be a function that looks like this: @@ -826,7 +827,7 @@ declare namespace chrome.contentSettings { } /** The only content type using resource identifiers is contentSettings.plugins. For more information, see Resource Identifiers. */ - interface ResourceIdentifier { + export interface ResourceIdentifier { /** The resource identifier for the given content type. */ id: string; /** Optional. A human readable description of the resource. */ @@ -841,7 +842,7 @@ declare namespace chrome.contentSettings { * Default is allow. * The primary URL is the URL representing the cookie origin. The secondary URL is the URL of the top-level frame. */ - var cookies: ContentSetting; + export var cookies: ContentSetting; /** * Whether to allow sites to show pop-ups. One of * allow: Allow sites to show pop-ups, @@ -849,7 +850,7 @@ declare namespace chrome.contentSettings { * Default is block. * The primary URL is the URL of the top-level frame. The secondary URL is not used. */ - var popups: ContentSetting; + export var popups: ContentSetting; /** * Whether to run JavaScript. One of * allow: Run JavaScript, @@ -857,7 +858,7 @@ declare namespace chrome.contentSettings { * Default is allow. * The primary URL is the URL of the top-level frame. The secondary URL is not used. */ - var javascript: ContentSetting; + export var javascript: ContentSetting; /** * Whether to allow sites to show desktop notifications. One of * allow: Allow sites to show desktop notifications, @@ -866,7 +867,7 @@ declare namespace chrome.contentSettings { * Default is ask. * The primary URL is the URL of the document which wants to show the notification. The secondary URL is not used. */ - var notifications: ContentSetting; + export var notifications: ContentSetting; /** * Whether to run plugins. One of * allow: Run plugins automatically, @@ -875,7 +876,7 @@ declare namespace chrome.contentSettings { * Default is allow. * The primary URL is the URL of the top-level frame. The secondary URL is not used. */ - var plugins: ContentSetting; + export var plugins: ContentSetting; /** * Whether to show images. One of * allow: Show images, @@ -883,7 +884,7 @@ declare namespace chrome.contentSettings { * Default is allow. * The primary URL is the URL of the top-level frame. The secondary URL is the URL of the image. */ - var images: ContentSetting; + export var images: ContentSetting; /** * Since Chrome 42. * Whether to allow Geolocation. One of @@ -893,7 +894,7 @@ declare namespace chrome.contentSettings { * Default is ask. * The primary URL is the URL of the document which requested location data. The secondary URL is the URL of the top-level frame (which may or may not differ from the requesting URL). */ - var location: ContentSetting; + export var location: ContentSetting; /** * Since Chrome 42. * Whether to allow sites to toggle the fullscreen mode. One of @@ -902,7 +903,7 @@ declare namespace chrome.contentSettings { * Default is ask. * The primary URL is the URL of the document which requested to toggle the fullscreen mode. The secondary URL is the URL of the top-level frame (which may or may not differ from the requesting URL). */ - var fullscreen: ContentSetting; + export var fullscreen: ContentSetting; /** * Since Chrome 42. * Whether to allow sites to disable the mouse cursor. One of @@ -912,7 +913,7 @@ declare namespace chrome.contentSettings { * Default is ask. * The primary URL is the URL of the top-level frame. The secondary URL is not used. */ - var mouselock: ContentSetting; + export var mouselock: ContentSetting; /** * Since Chrome 42. * Whether to allow sites to run plugins unsandboxed. One of @@ -922,7 +923,7 @@ declare namespace chrome.contentSettings { * Default is ask. * The primary URL is the URL of the top-level frame. The secondary URL is not used. */ - var unsandboxedPlugins: ContentSetting; + export var unsandboxedPlugins: ContentSetting; /** * Since Chrome 42. * Whether to allow sites to download multiple files automatically. One of @@ -932,7 +933,7 @@ declare namespace chrome.contentSettings { * Default is ask. * The primary URL is the URL of the top-level frame. The secondary URL is not used. */ - var automaticDownloads: ContentSetting; + export var automaticDownloads: ContentSetting; } //////////////////// @@ -944,7 +945,7 @@ declare namespace chrome.contentSettings { * Permissions: "contextMenus" */ declare namespace chrome.contextMenus { - interface OnClickData { + export interface OnClickData { /** * Optional. * Since Chrome 35. @@ -1010,7 +1011,7 @@ declare namespace chrome.contextMenus { srcUrl?: string; } - interface CreateProperties { + export interface CreateProperties { /** Optional. Lets you restrict the item to apply only to documents whose URL matches one of the given patterns. (This applies to frames as well.) For details on the format of a pattern, see Match Patterns. */ documentUrlPatterns?: string[]; /** Optional. The initial state of a checkbox or radio item: true for selected and false for unselected. Only one radio item can be selected at a time in a given group of radio items. */ @@ -1046,7 +1047,7 @@ declare namespace chrome.contextMenus { id?: string; } - interface UpdateProperties { + export interface UpdateProperties { documentUrlPatterns?: string[]; checked?: boolean; title?: string; @@ -1060,13 +1061,13 @@ declare namespace chrome.contextMenus { type?: string; } - interface MenuClickedEvent extends chrome.events.Event<(info: OnClickData, tab?: chrome.tabs.Tab) => void> {} + export interface MenuClickedEvent extends chrome.events.Event<(info: OnClickData, tab?: chrome.tabs.Tab) => void> {} /** * Since Chrome 38. * The maximum number of top level extension items that can be added to an extension action context menu. Any items beyond this limit will be ignored. */ - var ACTION_MENU_TOP_LEVEL_LIMIT: number; + export var ACTION_MENU_TOP_LEVEL_LIMIT: number; /** * Removes all context menu items added by this extension. @@ -1121,7 +1122,7 @@ declare namespace chrome.contextMenus { * Since Chrome 21. * Fired when a context menu item is clicked. */ - var onClicked: MenuClickedEvent; + export var onClicked: MenuClickedEvent; } //////////////////// @@ -1134,7 +1135,7 @@ declare namespace chrome.contextMenus { */ declare namespace chrome.cookies { /** Represents information about an HTTP cookie. */ - interface Cookie { + export interface Cookie { /** The domain of the cookie (e.g. "www.google.com", "example.com"). */ domain: string; /** The name of the cookie. */ @@ -1158,14 +1159,14 @@ declare namespace chrome.cookies { } /** Represents a cookie store in the browser. An incognito mode window, for instance, uses a separate cookie store from a non-incognito window. */ - interface CookieStore { + export interface CookieStore { /** The unique identifier for the cookie store. */ id: string; /** Identifiers of all the browser tabs that share this cookie store. */ tabIds: number[]; } - interface GetAllDetails { + export interface GetAllDetails { /** Optional. Restricts the retrieved cookies to those whose domains match or are subdomains of this one. */ domain?: string; /** Optional. Filters the cookies by name. */ @@ -1182,7 +1183,7 @@ declare namespace chrome.cookies { secure?: boolean; } - interface SetDetails { + export interface SetDetails { /** Optional. The domain of the cookie. If omitted, the cookie becomes a host-only cookie. */ domain?: string; /** Optional. The name of the cookie. Empty by default if omitted. */ @@ -1203,13 +1204,13 @@ declare namespace chrome.cookies { secure?: boolean; } - interface Details { + export interface Details { name: string; url: string; storeId?: string; } - interface CookieChangeInfo { + export interface CookieChangeInfo { /** Information about the cookie that was set or removed. */ cookie: Cookie; /** True if a cookie was removed. */ @@ -1221,7 +1222,7 @@ declare namespace chrome.cookies { cause: string; } - interface CookieChangedEvent extends chrome.events.Event<(changeInfo: CookieChangeInfo) => void> {} + export interface CookieChangedEvent extends chrome.events.Event<(changeInfo: CookieChangeInfo) => void> {} /** * Lists all existing cookie stores. @@ -1263,7 +1264,7 @@ declare namespace chrome.cookies { export function get(details: Details, callback: (cookie: Cookie | null) => void): void; /** Fired when a cookie is set or removed. As a special case, note that updating a cookie's properties is implemented as a two step process: the cookie to be updated is first removed entirely, generating a notification with "cause" of "overwrite" . Afterwards, a new cookie is written with the updated values, generating a second notification with "cause" "explicit". */ - var onChanged: CookieChangedEvent; + export var onChanged: CookieChangedEvent; } //////////////////// @@ -1277,7 +1278,7 @@ declare namespace chrome.cookies { declare module chrome { namespace _debugger { /** Debuggee identifier. Either tabId or extensionId must be specified */ - interface Debuggee { + export interface Debuggee { /** Optional. The id of the tab which you intend to debug. */ tabId?: number; /** @@ -1298,7 +1299,7 @@ declare module chrome { * Since Chrome 28. * Debug target information */ - interface TargetInfo { + export interface TargetInfo { /** Target type. */ type: string; /** Target id. */ @@ -1325,9 +1326,9 @@ declare module chrome { faviconUrl?: string; } - interface DebuggerDetachedEvent extends chrome.events.Event<(source: Debuggee, reason: string) => void> {} + export interface DebuggerDetachedEvent extends chrome.events.Event<(source: Debuggee, reason: string) => void> {} - interface DebuggerEventEvent extends chrome.events.Event<(source: Debuggee, method: string, params?: Object) => void> {} + export interface DebuggerEventEvent extends chrome.events.Event<(source: Debuggee, method: string, params?: Object) => void> {} /** * Attaches debugger to the given target. @@ -1367,9 +1368,9 @@ declare module chrome { export function getTargets(callback: (result: TargetInfo[]) => void): void; /** Fired when browser terminates debugging session for the tab. This happens when either the tab is being closed or Chrome DevTools is being invoked for the attached tab. */ - var onDetach: DebuggerDetachedEvent; + export var onDetach: DebuggerDetachedEvent; /** Fired whenever debugging target issues instrumentation event. */ - var onEvent: DebuggerEventEvent; + export var onEvent: DebuggerEventEvent; } export {_debugger as debugger} @@ -1383,7 +1384,7 @@ declare module chrome { * Permissions: "declarativeContent" */ declare namespace chrome.declarativeContent { - interface PageStateUrlDetails { + export interface PageStateUrlDetails { /** Optional. Matches if the host name of the URL contains a specified string. To test whether a host name component has a prefix 'foo', use hostContains: '.foo'. This matches 'www.foobar.com' and 'foo.com', because an implicit dot is added at the beginning of the host name. Similarly, hostContains can be used to match against component suffix ('foo.') and to exactly match against components ('.foo.'). Suffix- and exact-matching for the last components need to be done separately using hostSuffix, because no implicit dot is added at the end of the host name. */ hostContains?: string; /** Optional. Matches if the host name of the URL is equal to a specified string. */ @@ -1426,7 +1427,7 @@ declare namespace chrome.declarativeContent { ports?: (number | number[])[]; } - class PageStateMatcherProperties { + export class PageStateMatcherProperties { /** Optional. Filters URLs for various criteria. See event filtering. All criteria are case sensitive. */ pageUrl?: PageStateUrlDetails; /** Optional. Matches if all of the CSS selectors in the array match displayed elements in a frame with the same origin as the page's main frame. All selectors in this array must be compound selectors to speed up matching. Note that listing hundreds of CSS selectors or CSS selectors that match hundreds of times per page can still slow down web sites. */ @@ -1440,24 +1441,24 @@ declare namespace chrome.declarativeContent { } /** Matches the state of a web page by various criteria. */ - class PageStateMatcher { + export class PageStateMatcher { constructor(options: PageStateMatcherProperties); } /** Declarative event action that shows the extension's page action while the corresponding conditions are met. */ - class ShowPageAction {} + export class ShowPageAction {} /** Provides the Declarative Event API consisting of addRules, removeRules, and getRules. */ - interface PageChangedEvent extends chrome.events.Event<() => void> {} + export interface PageChangedEvent extends chrome.events.Event<() => void> {} - var onPageChanged: PageChangedEvent; + export var onPageChanged: PageChangedEvent; } //////////////////// // Declarative Web Request //////////////////// declare namespace chrome.declarativeWebRequest { - interface HeaderFilter { + export interface HeaderFilter { nameEquals?: string; valueContains?: any; nameSuffix?: string; @@ -1468,21 +1469,21 @@ declare namespace chrome.declarativeWebRequest { namePrefix?: string; } - interface AddResponseHeader { + export interface AddResponseHeader { name: string; value: string; } - interface RemoveResponseCookie { + export interface RemoveResponseCookie { filter: ResponseCookie; } - interface RemoveResponseHeader { + export interface RemoveResponseHeader { name: string; value?: string; } - interface RequestMatcher { + export interface RequestMatcher { contentType?: string[]; url?: chrome.events.UrlFilter; excludeContentType?: string[]; @@ -1491,17 +1492,17 @@ declare namespace chrome.declarativeWebRequest { responseHeaders?: HeaderFilter[]; } - interface IgnoreRules { + export interface IgnoreRules { lowerPriorityThan: number; } - interface RedirectToEmptyDocument { } + export interface RedirectToEmptyDocument { } - interface RedirectRequest { + export interface RedirectRequest { redirectUrl: string; } - interface ResponseCookie { + export interface ResponseCookie { domain?: string; name?: string; expires?: string; @@ -1512,54 +1513,54 @@ declare namespace chrome.declarativeWebRequest { secure?: string; } - interface AddResponseCookie { + export interface AddResponseCookie { cookie: ResponseCookie; } - interface EditResponseCookie { + export interface EditResponseCookie { filter: ResponseCookie; modification: ResponseCookie; } - interface CancelRequest { } + export interface CancelRequest { } - interface RemoveRequestHeader { + export interface RemoveRequestHeader { name: string; } - interface EditRequestCookie { + export interface EditRequestCookie { filter: RequestCookie; modification: RequestCookie; } - interface SetRequestHeader { + export interface SetRequestHeader { name: string; value: string; } - interface RequestCookie { + export interface RequestCookie { name?: string; value?: string; } - interface RedirectByRegEx { + export interface RedirectByRegEx { to: string; from: string; } - interface RedirectToTransparentImage { } + export interface RedirectToTransparentImage { } - interface AddRequestCookie { + export interface AddRequestCookie { cookie: RequestCookie; } - interface RemoveRequestCookie { + export interface RemoveRequestCookie { filter: RequestCookie; } - interface RequestedEvent extends chrome.events.Event {} + export interface RequestedEvent extends chrome.events.Event {} - var onRequest: RequestedEvent; + export var onRequest: RequestedEvent; } //////////////////// @@ -1604,7 +1605,7 @@ declare namespace chrome.desktopCapture { */ declare namespace chrome.devtools.inspectedWindow { /** A resource within the inspected page, such as a document, a script, or an image. */ - interface Resource { + export interface Resource { /** The URL of the resource. */ url: string; /** @@ -1628,7 +1629,7 @@ declare namespace chrome.devtools.inspectedWindow { setContent(content: string, commit: boolean, callback?: (error: Object) => void): void; } - interface ReloadOptions { + export interface ReloadOptions { /** Optional. If specified, the string will override the value of the User-Agent HTTP header that's sent while loading the resources of the inspected page. The string will also override the value of the navigator.userAgent property that's returned to any scripts that are running within the inspected page. */ userAgent?: string; /** Optional. When true, the loader will ignore the cache for all inspected page resources loaded before the load event is fired. The effect is similar to pressing Ctrl+Shift+R in the inspected window or within the Developer Tools window. */ @@ -1643,7 +1644,7 @@ declare namespace chrome.devtools.inspectedWindow { preprocessorScript?: string; } - interface EvaluationExceptionInfo { + export interface EvaluationExceptionInfo { /** Set if the error occurred on the DevTools side before the expression is evaluated. */ isError: boolean; /** Set if the error occurred on the DevTools side before the expression is evaluated. */ @@ -1658,12 +1659,12 @@ declare namespace chrome.devtools.inspectedWindow { value: string; } - interface ResourceAddedEvent extends chrome.events.Event<(resource: Resource) => void> {} + export interface ResourceAddedEvent extends chrome.events.Event<(resource: Resource) => void> {} - interface ResourceContentCommittedEvent extends chrome.events.Event<(resource: Resource, content: string) => void> {} + export interface ResourceContentCommittedEvent extends chrome.events.Event<(resource: Resource, content: string) => void> {} /** The ID of the tab being inspected. This ID may be used with chrome.tabs.* API. */ - var tabId: number; + export var tabId: number; /** Reloads the inspected page. */ export function reload(reloadOptions: ReloadOptions): void; @@ -1686,9 +1687,9 @@ declare namespace chrome.devtools.inspectedWindow { export function getResources(callback: (resources: Resource[]) => void): void; /** Fired when a new resource is added to the inspected page. */ - var onResourceAdded: ResourceAddedEvent; + export var onResourceAdded: ResourceAddedEvent; /** Fired when a new revision of the resource is committed (e.g. user saves an edited version of the resource in the Developer Tools). */ - var onResourceContentCommitted: ResourceContentCommittedEvent; + export var onResourceContentCommitted: ResourceContentCommittedEvent; } //////////////////// @@ -1700,7 +1701,7 @@ declare namespace chrome.devtools.inspectedWindow { */ declare namespace chrome.devtools.network { /** Represents a network request for a document resource (script, image and so on). See HAR Specification for reference. */ - interface Request { + export interface Request { /** * Returns content of the response body. * @param callback A function that receives the response body when the request completes. @@ -1712,9 +1713,9 @@ declare namespace chrome.devtools.network { getContent(callback: (content: string, encoding: string) => void): void; } - interface RequestFinishedEvent extends chrome.events.Event<(request: Request) => void> {} + export interface RequestFinishedEvent extends chrome.events.Event<(request: Request) => void> {} - interface NavigatedEvent extends chrome.events.Event<(url: string) => void> {} + export interface NavigatedEvent extends chrome.events.Event<(url: string) => void> {} /** * Returns HAR log that contains all known network requests. @@ -1726,9 +1727,9 @@ declare namespace chrome.devtools.network { export function getHAR(callback: (harLog: Object) => void): void; /** Fired when a network request is finished and all request data are available. */ - var onRequestFinished: RequestFinishedEvent; + export var onRequestFinished: RequestFinishedEvent; /** Fired when the inspected window navigates to a new page. */ - var onNavigated: NavigatedEvent; + export var onNavigated: NavigatedEvent; } //////////////////// @@ -1739,14 +1740,14 @@ declare namespace chrome.devtools.network { * Availability: Since Chrome 18. */ declare namespace chrome.devtools.panels { - interface PanelShownEvent extends chrome.events.Event<(window: chrome.windows.Window) => void> {} + export interface PanelShownEvent extends chrome.events.Event<(window: chrome.windows.Window) => void> {} - interface PanelHiddenEvent extends chrome.events.Event<() => void> {} + export interface PanelHiddenEvent extends chrome.events.Event<() => void> {} - interface PanelSearchEvent extends chrome.events.Event<(action: string, queryString?: string) => void> {} + export interface PanelSearchEvent extends chrome.events.Event<(action: string, queryString?: string) => void> {} /** Represents a panel created by extension. */ - interface ExtensionPanel { + export interface ExtensionPanel { /** * Appends a button to the status bar of the panel. * @param iconPath Path to the icon of the button. The file should contain a 64x24-pixel image composed of two 32x24 icons. The left icon is used when the button is inactive; the right icon is displayed when the button is pressed. @@ -1762,10 +1763,10 @@ declare namespace chrome.devtools.panels { onSearch: PanelSearchEvent; } - interface ButtonClickedEvent extends chrome.events.Event<() => void> {} + export interface ButtonClickedEvent extends chrome.events.Event<() => void> {} /** A button created by the extension. */ - interface Button { + export interface Button { /** * Updates the attributes of the button. If some of the arguments are omitted or null, the corresponding attributes are not updated. * @param iconPath Path to the new icon of the button. @@ -1777,10 +1778,10 @@ declare namespace chrome.devtools.panels { onClicked: ButtonClickedEvent; } - interface SelectionChangedEvent extends chrome.events.Event<() => void> {} + export interface SelectionChangedEvent extends chrome.events.Event<() => void> {} /** Represents the Elements panel. */ - interface ElementsPanel { + export interface ElementsPanel { /** * Creates a pane within panel's sidebar. * @param title Text that is displayed in sidebar caption. @@ -1798,7 +1799,7 @@ declare namespace chrome.devtools.panels { * Since Chrome 41. * Represents the Sources panel. */ - interface SourcesPanel { + export interface SourcesPanel { /** * Creates a pane within panel's sidebar. * @param title Text that is displayed in sidebar caption. @@ -1812,12 +1813,12 @@ declare namespace chrome.devtools.panels { onSelectionChanged: SelectionChangedEvent; } - interface ExtensionSidebarPaneShownEvent extends chrome.events.Event<(window: chrome.windows.Window) => void> {} + export interface ExtensionSidebarPaneShownEvent extends chrome.events.Event<(window: chrome.windows.Window) => void> {} - interface ExtensionSidebarPaneHiddenEvent extends chrome.events.Event<() => void> {} + export interface ExtensionSidebarPaneHiddenEvent extends chrome.events.Event<() => void> {} /** A sidebar created by the extension. */ - interface ExtensionSidebarPane { + export interface ExtensionSidebarPane { /** * Sets the height of the sidebar. * @param height A CSS-like size specification, such as '100px' or '12ex'. @@ -1869,12 +1870,12 @@ declare namespace chrome.devtools.panels { } /** Elements panel. */ - var elements: ElementsPanel; + export var elements: ElementsPanel; /** * Since Chrome 38. * Sources panel. */ - var sources: SourcesPanel; + export var sources: SourcesPanel; /** * Creates an extension panel. @@ -1917,14 +1918,14 @@ declare namespace chrome.devtools.panels { * Important: This API works only on Chrome OS. */ declare namespace chrome.documentScan { - interface DocumentScanOptions { + export interface DocumentScanOptions { /** Optional. The MIME types that are accepted by the caller. */ mimeTypes?: string[]; /** Optional. The number of scanned images allowed (defaults to 1). */ maxImages?: number; } - interface DocumentScanCallbackArg { + export interface DocumentScanCallbackArg { /** The data image URLs in a form that can be passed as the "src" value to an image tag. */ dataUrls: string[]; /** The MIME type of dataUrls. */ @@ -1950,14 +1951,14 @@ declare namespace chrome.documentScan { * Permissions: "downloads" */ declare namespace chrome.downloads { - interface HeaderNameValuePair { + export interface HeaderNameValuePair { /** Name of the HTTP header. */ name: string; /** Value of the HTTP header. */ value: string; } - interface DownloadOptions { + export interface DownloadOptions { /** Optional. Post body. */ body?: string; /** Optional. Use a file-chooser to allow the user to select a filename regardless of whether filename is set or already exists. */ @@ -1974,7 +1975,7 @@ declare namespace chrome.downloads { conflictAction?: string; } - interface DownloadDelta { + export interface DownloadDelta { /** Optional. The change in danger, if any. */ danger?: StringDelta; /** Optional. The change in url, if any. */ @@ -2005,23 +2006,23 @@ declare namespace chrome.downloads { exists?: BooleanDelta; } - interface BooleanDelta { + export interface BooleanDelta { current?: boolean; previous?: boolean; } /** Since Chrome 34. */ - interface DoubleDelta { + export interface DoubleDelta { current?: number; previous?: number; } - interface StringDelta { + export interface StringDelta { current?: string; previous?: string; } - interface DownloadItem { + export interface DownloadItem { /** Number of bytes received so far from the host, without considering file compression. */ bytesReceived: number; /** Indication of whether this download is thought to be safe or known to be suspicious. */ @@ -2064,13 +2065,13 @@ declare namespace chrome.downloads { byExtensionName?: string; } - interface GetFileIconOptions { + export interface GetFileIconOptions { /** Optional. * The size of the returned icon. The icon will be square with dimensions size * size pixels. The default and largest size for the icon is 32x32 pixels. The only supported sizes are 16 and 32. It is an error to specify any other size. */ size?: number; } - interface DownloadQuery { + export interface DownloadQuery { /** Optional. Set elements of this array to DownloadItem properties in order to sort search results. For example, setting orderBy=['startTime'] sorts the DownloadItem by their start time in ascending order. To specify descending order, prefix with a hyphen: '-startTime'. */ orderBy?: string[]; /** Optional. Limits results to DownloadItem whose url matches the given regular expression. */ @@ -2123,20 +2124,20 @@ declare namespace chrome.downloads { exists?: boolean; } - interface DownloadFilenameSuggestion { + export interface DownloadFilenameSuggestion { /** The DownloadItem's new target DownloadItem.filename, as a path relative to the user's default Downloads directory, possibly containing subdirectories. Absolute paths, empty paths, and paths containing back-references ".." will be ignored. */ filename: string; /** Optional. The action to take if filename already exists. */ conflictAction?: string; } - interface DownloadChangedEvent extends chrome.events.Event<(downloadDelta: DownloadDelta) => void> {} + export interface DownloadChangedEvent extends chrome.events.Event<(downloadDelta: DownloadDelta) => void> {} - interface DownloadCreatedEvent extends chrome.events.Event<(downloadItem: DownloadItem) => void> {} + export interface DownloadCreatedEvent extends chrome.events.Event<(downloadItem: DownloadItem) => void> {} - interface DownloadErasedEvent extends chrome.events.Event<(downloadId: number) => void> {} + export interface DownloadErasedEvent extends chrome.events.Event<(downloadId: number) => void> {} - interface DownloadDeterminingFilenameEvent extends chrome.events.Event<(downloadItem: DownloadItem, suggest: (suggestion?: DownloadFilenameSuggestion) => void) => void> {} + export interface DownloadDeterminingFilenameEvent extends chrome.events.Event<(downloadItem: DownloadItem, suggest: (suggestion?: DownloadFilenameSuggestion) => void) => void> {} /** * Find DownloadItem. Set query to the empty object to get all DownloadItem. To get a specific DownloadItem, set only the id field. To page through a large number of items, set orderBy: ['-startTime'], set limit to the number of items per page, and set startedAfter to the startTime of the last item from the last page. @@ -2230,13 +2231,13 @@ declare namespace chrome.downloads { export function setShelfEnabled(enabled: boolean): void; /** When any of a DownloadItem's properties except bytesReceived and estimatedEndTime changes, this event fires with the downloadId and an object containing the properties that changed. */ - var onChanged: DownloadChangedEvent; + export var onChanged: DownloadChangedEvent; /** This event fires with the DownloadItem object when a download begins. */ - var onCreated: DownloadCreatedEvent; + export var onCreated: DownloadCreatedEvent; /** Fires with the downloadId when a download is erased from history. */ - var onErased: DownloadErasedEvent; + export var onErased: DownloadErasedEvent; /** During the filename determination process, extensions will be given the opportunity to override the target DownloadItem.filename. Each extension may not register more than one listener for this event. Each listener must call suggest exactly once, either synchronously or asynchronously. If the listener calls suggest asynchronously, then it must return true. If the listener neither calls suggest synchronously nor returns true, then suggest will be called automatically. The DownloadItem will not complete until all listeners have called suggest. Listeners may call suggest without any arguments in order to allow the download to use downloadItem.filename for its filename, or pass a suggestion object to suggest in order to override the target filename. If more than one extension overrides the filename, then the last extension installed whose listener passes a suggestion object to suggest wins. In order to avoid confusion regarding which extension will win, users should not install extensions that may conflict. If the download is initiated by download and the target filename is known before the MIME type and tentative filename have been determined, pass filename to download instead. */ - var onDeterminingFilename: DownloadDeterminingFilenameEvent; + export var onDeterminingFilename: DownloadDeterminingFilenameEvent; } //////////////////// @@ -2250,7 +2251,7 @@ declare namespace chrome.downloads { * Note: This API is only for extensions pre-installed by policy. */ declare namespace chrome.enterprise.platformKeys { - interface Token { + export interface Token { /** * Uniquely identifies this Token. * Static IDs are "user" and "system", referring to the platform's user-specific and the system-wide hardware token, respectively. Any other tokens (with other identifiers) might be returned by enterprise.platformKeys.getTokens. @@ -2301,6 +2302,25 @@ declare namespace chrome.enterprise.platformKeys { export function removeCertificate(tokenId: string, certificate: ArrayBuffer, callback?: () => void): void; } +//////////////////// +// Enterprise Device Attributes +//////////////////// +/** + * Use the chrome.enterprise.deviceAttributes API to read device attributes. + * Permissions: "enterprise.deviceAttributes" + * Since: Chrome 46 + * Important: This API works only on Chrome OS. + * Note: This API is only for extensions pre-installed by policy. + */ +declare namespace chrome.enterprise.deviceAttributes { + /** + * @description Fetches the value of the device identifier of the directory API, that is generated by the server and identifies the cloud record of the device for querying in the cloud directory API. + * @export + * @param {(deviceId) => void} callback Called with the device identifier of the directory API when received. + */ + export function getDirectoryDeviceId(callback: (deviceId) => void): void; +} + //////////////////// // Events //////////////////// @@ -2310,7 +2330,7 @@ declare namespace chrome.enterprise.platformKeys { */ declare namespace chrome.events { /** Filters URLs for various criteria. See event filtering. All criteria are case sensitive. */ - interface UrlFilter { + export interface UrlFilter { /** Optional. Matches if the scheme of the URL is equal to any of the schemes specified in the array. */ schemes?: string[]; /** @@ -2362,7 +2382,7 @@ declare namespace chrome.events { } /** An object which allows the addition and removal of listeners for a Chrome event. */ - interface Event { + export interface Event { /** * Registers an event listener callback to an event. * @param callback Called when an event occurs. The parameters of this function depend on the type of event. @@ -2426,7 +2446,7 @@ declare namespace chrome.events { } /** Description of a declarative rule for handling events. */ - interface Rule { + export interface Rule { /** Optional. Optional priority of this rule. Defaults to 100. */ priority?: number; /** List of conditions that can trigger the actions. */ @@ -2452,27 +2472,27 @@ declare namespace chrome.events { * Availability: Since Chrome 5. */ declare namespace chrome.extension { - interface FetchProperties { + export interface FetchProperties { /** Optional. The window to restrict the search to. If omitted, returns all views. */ windowId?: number; /** Optional. The type of view to get. If omitted, returns all views (including background pages and tabs). Valid values: 'tab', 'notification', 'popup'. */ type?: string; } - interface LastError { + export interface LastError { /** Description of the error that has taken place. */ message: string; } - interface OnRequestEvent extends chrome.events.Event<((request: any, sender: runtime.MessageSender, sendResponse: (response: any) => void) => void) | ((sender: runtime.MessageSender, sendResponse: (response: any) => void) => void)> {} + export interface OnRequestEvent extends chrome.events.Event<((request: any, sender: runtime.MessageSender, sendResponse: (response: any) => void) => void) | ((sender: runtime.MessageSender, sendResponse: (response: any) => void) => void)> {} /** * Since Chrome 7. * True for content scripts running inside incognito tabs, and for extension pages running inside an incognito process. The latter only applies to extensions with 'split' incognito_behavior. */ - var inIncognitoContext: boolean; + export var inIncognitoContext: boolean; /** Set for the lifetime of a callback if an ansychronous extension api has resulted in an error. If no error has occured lastError will be undefined. */ - var lastError: LastError; + export var lastError: LastError; /** Returns the JavaScript 'window' object for the background page running inside the current extension. Returns null if the extension has no background page. */ export function getBackgroundPage(): Window | null; @@ -2531,12 +2551,12 @@ declare namespace chrome.extension { * Fired when a request is sent from either an extension process or a content script. * @deprecated Deprecated since Chrome 33. Please use runtime.onMessage. */ - var onRequest: OnRequestEvent; + export var onRequest: OnRequestEvent; /** * Fired when a request is sent from another extension. * @deprecated Deprecated since Chrome 33. Please use runtime.onMessageExternal. */ - var onRequestExternal: OnRequestEvent; + export var onRequestExternal: OnRequestEvent; } //////////////////// @@ -2549,7 +2569,7 @@ declare namespace chrome.extension { * Important: This API works only on Chrome OS. */ declare namespace chrome.fileBrowserHandler { - interface SelectionParams { + export interface SelectionParams { /** * Optional. * List of file extensions that the selected file can have. The list is also used to specify what files to be shown in the select file dialog. Files with the listed extensions are only shown in the dialog. Extensions should not include the leading '.'. Example: ['jpg', 'png'] @@ -2560,7 +2580,7 @@ declare namespace chrome.fileBrowserHandler { suggestedName: string; } - interface SelectionResult { + export interface SelectionResult { /** Optional. Selected file entry. It will be null if a file hasn't been selected. */ entry?: Object | null; /** Whether the file has been selected. */ @@ -2568,14 +2588,14 @@ declare namespace chrome.fileBrowserHandler { } /** Event details payload for fileBrowserHandler.onExecute event. */ - interface FileHandlerExecuteEventDetails { + export interface FileHandlerExecuteEventDetails { /** Optional. The ID of the tab that raised this event. Tab IDs are unique within a browser session. */ tab_id?: number; /** Array of Entry instances representing files that are targets of this action (selected in ChromeOS file browser). */ entries: any[]; } - interface FileBrowserHandlerExecuteEvent extends chrome.events.Event<(id: string, details: FileHandlerExecuteEventDetails) => void> {} + export interface FileBrowserHandlerExecuteEvent extends chrome.events.Event<(id: string, details: FileHandlerExecuteEventDetails) => void> {} /** * Prompts user to select file path under which file should be saved. When the file is selected, file access permission required to use the file (read, write and create) are granted to the caller. The file will not actually get created during the function call, so function caller must ensure its existence before using it. The function has to be invoked with a user gesture. @@ -2589,7 +2609,7 @@ declare namespace chrome.fileBrowserHandler { export function selectFile(selectionParams: SelectionParams, callback: (result: SelectionResult) => void): void; /** Fired when file system action is executed from ChromeOS file browser. */ - var onExecute: FileBrowserHandlerExecuteEvent; + export var onExecute: FileBrowserHandlerExecuteEvent; } //////////////////// @@ -2602,7 +2622,7 @@ declare namespace chrome.fileBrowserHandler { * Important: This API works only on Chrome OS. */ declare namespace chrome.fileSystemProvider { - interface OpenedFileInfo { + export interface OpenedFileInfo { /** A request ID to be be used by consecutive read/write and close requests. */ openRequestId: number; /** The path of the opened file. */ @@ -2611,7 +2631,7 @@ declare namespace chrome.fileSystemProvider { mode: string; } - interface FileWatchersInfo { + export interface FileWatchersInfo { /** The path of the entry being observed. */ entryPath: string; /** Whether watching should include all child entries recursively. It can be true for directories only. */ @@ -2620,7 +2640,7 @@ declare namespace chrome.fileSystemProvider { lastTag?: string; } - interface EntryMetadata { + export interface EntryMetadata { /** True if it is a directory. */ isDirectory: boolean; /** Name of this entry (not full path name). Must not contain '/'. For root it must be empty. */ @@ -2635,7 +2655,7 @@ declare namespace chrome.fileSystemProvider { thumbnail?: string; } - interface FileSystemInfo { + export interface FileSystemInfo { /** The identifier of the file system. */ fileSystemId: string; /** A human-readable name for the file system. */ @@ -2666,7 +2686,7 @@ declare namespace chrome.fileSystemProvider { } /** @since Since Chrome 45. Warning: this is the current Beta channel. */ - interface GetActionsRequestedOptions { + export interface GetActionsRequestedOptions { /** The identifier of the file system related to this operation. */ fileSystemId: string; /** The unique identifier of this request. */ @@ -2676,7 +2696,7 @@ declare namespace chrome.fileSystemProvider { } /** @since Since Chrome 45. Warning: this is the current Beta channel. */ - interface Action { + export interface Action { /** The identifier of the action. Any string or CommonActionId for common actions. */ id: string; /** Optional. The title of the action. It may be ignored for common actions. */ @@ -2684,7 +2704,7 @@ declare namespace chrome.fileSystemProvider { } /** @since Since Chrome 45. Warning: this is the current Beta channel. */ - interface ExecuteActionRequestedOptions { + export interface ExecuteActionRequestedOptions { /** The identifier of the file system related to this operation. */ fileSystemId: string; /** The unique identifier of this request. */ @@ -2695,7 +2715,7 @@ declare namespace chrome.fileSystemProvider { actionId: string; } - interface MountOptions { + export interface MountOptions { /** The string indentifier of the file system. Must be unique per each extension. */ fileSystemId: string; /** A human-readable name for the file system. */ @@ -2716,19 +2736,19 @@ declare namespace chrome.fileSystemProvider { supportsNotifyTag?: boolean; } - interface UnmountOptions { + export interface UnmountOptions { /** The identifier of the file system to be unmounted. */ fileSystemId: string; } - interface NotificationChange { + export interface NotificationChange { /** The path of the changed entry. */ entryPath: string; /** The type of the change which happened to the entry. */ changeType: string; } - interface NotificationOptions { + export interface NotificationOptions { /** The identifier of the file system related to this change. */ fileSystemId: string; /** The path of the observed entry. */ @@ -2743,111 +2763,111 @@ declare namespace chrome.fileSystemProvider { tag?: string; } - interface RequestedEventOptions { + export interface RequestedEventOptions { /** The identifier of the file system related to this operation. */ fileSystemId: string; /** The unique identifier of this request. */ requestId: number; } - interface EntryPathRequestedEventOptions extends RequestedEventOptions { + export interface EntryPathRequestedEventOptions extends RequestedEventOptions { /** The path of the entry to which this operation is related to. */ entryPath: string; } - interface MetadataRequestedEventOptions extends EntryPathRequestedEventOptions { + export interface MetadataRequestedEventOptions extends EntryPathRequestedEventOptions { /** Set to true if the thumbnail is requested. */ thumbnail: boolean; } - interface DirectoryPathRequestedEventOptions extends RequestedEventOptions { + export interface DirectoryPathRequestedEventOptions extends RequestedEventOptions { /** The path of the directory which is to be operated on. */ directoryPath: string; } - interface FilePathRequestedEventOptions extends RequestedEventOptions { + export interface FilePathRequestedEventOptions extends RequestedEventOptions { /** The path of the entry for the operation */ filePath: string; } - interface OpenFileRequestedEventOptions extends FilePathRequestedEventOptions { + export interface OpenFileRequestedEventOptions extends FilePathRequestedEventOptions { /** Whether the file will be used for reading or writing. */ mode: string; } - interface OpenedFileRequestedEventOptions extends RequestedEventOptions { + export interface OpenedFileRequestedEventOptions extends RequestedEventOptions { /** A request ID used to open the file. */ openRequestId: number; } - interface OpenedFileOffsetRequestedEventOptions extends OpenedFileRequestedEventOptions { + export interface OpenedFileOffsetRequestedEventOptions extends OpenedFileRequestedEventOptions { /** Position in the file (in bytes) to start reading from. */ offset: number; /** Number of bytes to be returned. */ length: number; } - interface DirectoryPathRecursiveRequestedEventOptions extends DirectoryPathRequestedEventOptions { + export interface DirectoryPathRecursiveRequestedEventOptions extends DirectoryPathRequestedEventOptions { /** Whether the operation is recursive (for directories only). */ recursive: boolean; } - interface EntryPathRecursiveRequestedEventOptions extends EntryPathRequestedEventOptions { + export interface EntryPathRecursiveRequestedEventOptions extends EntryPathRequestedEventOptions { /** Whether the operation is recursive (for directories only). */ recursive: boolean; } - interface SourceTargetPathRequestedEventOptions extends RequestedEventOptions { + export interface SourceTargetPathRequestedEventOptions extends RequestedEventOptions { /** The source path for the operation. */ sourcePath: string; /** The destination path for the operation. */ targetPath: string; } - interface FilePathLengthRequestedEventOptions extends FilePathRequestedEventOptions { + export interface FilePathLengthRequestedEventOptions extends FilePathRequestedEventOptions { /** Number of bytes to be retained after the operation completes. */ length: number; } - interface OpenedFileIoRequestedEventOptions extends OpenedFileRequestedEventOptions { + export interface OpenedFileIoRequestedEventOptions extends OpenedFileRequestedEventOptions { /** Position in the file (in bytes) to start operating from. */ offset: number; /** Buffer of bytes to be operated on the file. */ data: ArrayBuffer; } - interface OperationRequestedEventOptions extends RequestedEventOptions { + export interface OperationRequestedEventOptions extends RequestedEventOptions { /** An ID of the request to which this operation is related. */ operationRequestId: number; } - interface RequestedEvent extends chrome.events.Event<(options: RequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + export interface RequestedEvent extends chrome.events.Event<(options: RequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface MetadataRequestedEvent extends chrome.events.Event<(options: MetadataRequestedEventOptions, successCallback: (metadata: EntryMetadata) => void, errorCallback: (error: string) => void) => void> {} + export interface MetadataRequestedEvent extends chrome.events.Event<(options: MetadataRequestedEventOptions, successCallback: (metadata: EntryMetadata) => void, errorCallback: (error: string) => void) => void> {} - interface DirectoryPathRequestedEvent extends chrome.events.Event<(options: DirectoryPathRequestedEventOptions, successCallback: (entries: EntryMetadata[], hasMore: boolean) => void, errorCallback: (error: string) => void) => void> {} + export interface DirectoryPathRequestedEvent extends chrome.events.Event<(options: DirectoryPathRequestedEventOptions, successCallback: (entries: EntryMetadata[], hasMore: boolean) => void, errorCallback: (error: string) => void) => void> {} - interface OpenFileRequestedEvent extends chrome.events.Event<(options: OpenFileRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + export interface OpenFileRequestedEvent extends chrome.events.Event<(options: OpenFileRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface OpenedFileRequestedEvent extends chrome.events.Event<(options: OpenedFileRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + export interface OpenedFileRequestedEvent extends chrome.events.Event<(options: OpenedFileRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface OpenedFileOffsetRequestedEvent extends chrome.events.Event<(options: OpenedFileOffsetRequestedEventOptions, successCallback: (data: ArrayBuffer, hasMore: boolean) => void, errorCallback: (error: string) => void) => void> {} + export interface OpenedFileOffsetRequestedEvent extends chrome.events.Event<(options: OpenedFileOffsetRequestedEventOptions, successCallback: (data: ArrayBuffer, hasMore: boolean) => void, errorCallback: (error: string) => void) => void> {} - interface DirectoryPathRecursiveRequestedEvent extends chrome.events.Event<(options: DirectoryPathRecursiveRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + export interface DirectoryPathRecursiveRequestedEvent extends chrome.events.Event<(options: DirectoryPathRecursiveRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface EntryPathRecursiveRequestedEvent extends chrome.events.Event<(options: EntryPathRecursiveRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + export interface EntryPathRecursiveRequestedEvent extends chrome.events.Event<(options: EntryPathRecursiveRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface FilePathRequestedEvent extends chrome.events.Event<(options: FilePathRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + export interface FilePathRequestedEvent extends chrome.events.Event<(options: FilePathRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface SourceTargetPathRequestedEvent extends chrome.events.Event<(options: SourceTargetPathRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + export interface SourceTargetPathRequestedEvent extends chrome.events.Event<(options: SourceTargetPathRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface FilePathLengthRequestedEvent extends chrome.events.Event<(options: FilePathLengthRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + export interface FilePathLengthRequestedEvent extends chrome.events.Event<(options: FilePathLengthRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface OpenedFileIoRequestedEvent extends chrome.events.Event<(options: OpenedFileIoRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + export interface OpenedFileIoRequestedEvent extends chrome.events.Event<(options: OpenedFileIoRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface OperationRequestedEvent extends chrome.events.Event<(options: OperationRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + export interface OperationRequestedEvent extends chrome.events.Event<(options: OperationRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface OptionlessRequestedEvent extends chrome.events.Event<(successCallback: Function, errorCallback: (error: string) => void) => void> {} + export interface OptionlessRequestedEvent extends chrome.events.Event<(successCallback: Function, errorCallback: (error: string) => void) => void> {} /** * Mounts a file system with the given fileSystemId and displayName. displayName will be shown in the left panel of Files.app. displayName can contain any characters including '/', but cannot be an empty string. displayName must be descriptive but doesn't have to be unique. The fileSystemId must not be an empty string. @@ -2895,53 +2915,53 @@ declare namespace chrome.fileSystemProvider { export function notify(options: NotificationOptions, callback: () => void): void; /** Raised when unmounting for the file system with the fileSystemId identifier is requested. In the response, the unmount API method must be called together with successCallback. If unmounting is not possible (eg. due to a pending operation), then errorCallback must be called. */ - var onUnmountRequested: RequestedEvent; + export var onUnmountRequested: RequestedEvent; /** Raised when metadata of a file or a directory at entryPath is requested. The metadata must be returned with the successCallback call. In case of an error, errorCallback must be called. */ - var onGetMetadataRequested: MetadataRequestedEvent; + export var onGetMetadataRequested: MetadataRequestedEvent; /** Raised when contents of a directory at directoryPath are requested. The results must be returned in chunks by calling the successCallback several times. In case of an error, errorCallback must be called. */ - var onReadDirectoryRequested: DirectoryPathRequestedEvent; + export var onReadDirectoryRequested: DirectoryPathRequestedEvent; /** Raised when opening a file at filePath is requested. If the file does not exist, then the operation must fail. Maximum number of files opened at once can be specified with MountOptions. */ - var onOpenFileRequested: OpenFileRequestedEvent; + export var onOpenFileRequested: OpenFileRequestedEvent; /** Raised when opening a file previously opened with openRequestId is requested to be closed. */ - var onCloseFileRequested: OpenedFileRequestedEvent; + export var onCloseFileRequested: OpenedFileRequestedEvent; /** Raised when reading contents of a file opened previously with openRequestId is requested. The results must be returned in chunks by calling successCallback several times. In case of an error, errorCallback must be called. */ - var onReadFileRequested: OpenedFileOffsetRequestedEvent; + export var onReadFileRequested: OpenedFileOffsetRequestedEvent; /** Raised when creating a directory is requested. The operation must fail with the EXISTS error if the target directory already exists. If recursive is true, then all of the missing directories on the directory path must be created. */ - var onCreateDirectoryRequested: DirectoryPathRecursiveRequestedEvent; + export var onCreateDirectoryRequested: DirectoryPathRecursiveRequestedEvent; /** Raised when deleting an entry is requested. If recursive is true, and the entry is a directory, then all of the entries inside must be recursively deleted as well. */ - var onDeleteEntryRequested: EntryPathRecursiveRequestedEvent; + export var onDeleteEntryRequested: EntryPathRecursiveRequestedEvent; /** Raised when creating a file is requested. If the file already exists, then errorCallback must be called with the "EXISTS" error code. */ - var onCreateFileRequested: FilePathRequestedEvent; + export var onCreateFileRequested: FilePathRequestedEvent; /** Raised when copying an entry (recursively if a directory) is requested. If an error occurs, then errorCallback must be called. */ - var onCopyEntryRequested: SourceTargetPathRequestedEvent; + export var onCopyEntryRequested: SourceTargetPathRequestedEvent; /** Raised when moving an entry (recursively if a directory) is requested. If an error occurs, then errorCallback must be called. */ - var onMoveEntryRequested: SourceTargetPathRequestedEvent; + export var onMoveEntryRequested: SourceTargetPathRequestedEvent; /** Raised when truncating a file to a desired length is requested. If an error occurs, then errorCallback must be called. */ - var onTruncateRequested: FilePathLengthRequestedEvent; + export var onTruncateRequested: FilePathLengthRequestedEvent; /** Raised when writing contents to a file opened previously with openRequestId is requested. */ - var onWriteFileRequested: OpenedFileIoRequestedEvent; + export var onWriteFileRequested: OpenedFileIoRequestedEvent; /** Raised when aborting an operation with operationRequestId is requested. The operation executed with operationRequestId must be immediately stopped and successCallback of this abort request executed. If aborting fails, then errorCallback must be called. Note, that callbacks of the aborted operation must not be called, as they will be ignored. Despite calling errorCallback, the request may be forcibly aborted. */ - var onAbortRequested: OperationRequestedEvent; + export var onAbortRequested: OperationRequestedEvent; /** * Raised when showing a configuration dialog for fileSystemId is requested. If it's handled, the file_system_provider.configurable manfiest option must be set to true. * @since Since Chrome 44. */ - var onConfigureRequested: RequestedEvent; + export var onConfigureRequested: RequestedEvent; /** * Raised when showing a dialog for mounting a new file system is requested. If the extension/app is a file handler, then this event shouldn't be handled. Instead app.runtime.onLaunched should be handled in order to mount new file systems when a file is opened. For multiple mounts, the file_system_provider.multiple_mounts manifest option must be set to true. * @since Since Chrome 44. */ - var onMountRequested: OptionlessRequestedEvent; + export var onMountRequested: OptionlessRequestedEvent; /** * Raised when setting a new directory watcher is requested. If an error occurs, then errorCallback must be called. * @since Since Chrome 45. Warning: this is the current Beta channel. */ - var onAddWatcherRequested: EntryPathRecursiveRequestedEvent; + export var onAddWatcherRequested: EntryPathRecursiveRequestedEvent; /** * Raised when the watcher should be removed. If an error occurs, then errorCallback must be called. * @since Since Chrome 45. Warning: this is the current Beta channel. */ - var onRemoveWatcherRequested: EntryPathRecursiveRequestedEvent; + export var onRemoveWatcherRequested: EntryPathRecursiveRequestedEvent; } //////////////////// @@ -2954,26 +2974,26 @@ declare namespace chrome.fileSystemProvider { */ declare namespace chrome.fontSettings { /** Represents a font name. */ - interface FontName { + export interface FontName { /** The display name of the font. */ displayName: string; /** The font ID. */ fontId: string; } - interface DefaultFontSizeDetails { + export interface DefaultFontSizeDetails { /** The font size in pixels. */ pixelSize: number; } - interface FontDetails { + export interface FontDetails { /** The generic font family for the font. */ genericFamily: string; /** Optional. The script for the font. If omitted, the global script font setting is affected. */ script?: string; } - interface FullFontDetails { + export interface FullFontDetails { /** The generic font family for which the font setting has changed. */ genericFamily: string; /** The level of control this extension has over the setting. */ @@ -2984,37 +3004,37 @@ declare namespace chrome.fontSettings { fontId: string; } - interface FontDetailsResult { + export interface FontDetailsResult { /** The level of control this extension has over the setting. */ levelOfControl: string; /** The font ID. Rather than the literal font ID preference value, this may be the ID of the font that the system resolves the preference value to. So, fontId can differ from the font passed to setFont, if, for example, the font is not available on the system. The empty string signifies fallback to the global script font setting. */ fontId: string; } - interface FontSizeDetails { + export interface FontSizeDetails { /** The font size in pixels. */ pixelSize: number; /** The level of control this extension has over the setting. */ levelOfControl: string; } - interface SetFontSizeDetails { + export interface SetFontSizeDetails { /** The font size in pixels. */ pixelSize: number; } - interface SetFontDetails extends FontDetails { + export interface SetFontDetails extends FontDetails { /** The font ID. The empty string means to fallback to the global script font setting. */ fontId: string; } - interface DefaultFixedFontSizeChangedEvent extends chrome.events.Event<(details: FontSizeDetails) => void> {} + export interface DefaultFixedFontSizeChangedEvent extends chrome.events.Event<(details: FontSizeDetails) => void> {} - interface DefaultFontSizeChangedEvent extends chrome.events.Event<(details: FontSizeDetails) => void> {} + export interface DefaultFontSizeChangedEvent extends chrome.events.Event<(details: FontSizeDetails) => void> {} - interface MinimumFontSizeChangedEvent extends chrome.events.Event<(details: FontSizeDetails) => void> {} + export interface MinimumFontSizeChangedEvent extends chrome.events.Event<(details: FontSizeDetails) => void> {} - interface FontChangedEvent extends chrome.events.Event<(details: FullFontDetails) => void> {} + export interface FontChangedEvent extends chrome.events.Event<(details: FullFontDetails) => void> {} /** * Sets the default font size. @@ -3102,13 +3122,13 @@ declare namespace chrome.fontSettings { export function clearDefaultFixedFontSize(details: Object, callback?: Function): void; /** Fired when the default fixed font size setting changes. */ - var onDefaultFixedFontSizeChanged: DefaultFixedFontSizeChangedEvent; + export var onDefaultFixedFontSizeChanged: DefaultFixedFontSizeChangedEvent; /** Fired when the default font size setting changes. */ - var onDefaultFontSizeChanged: DefaultFontSizeChangedEvent; + export var onDefaultFontSizeChanged: DefaultFontSizeChangedEvent; /** Fired when the minimum font size setting changes. */ - var onMinimumFontSizeChanged: MinimumFontSizeChangedEvent; + export var onMinimumFontSizeChanged: MinimumFontSizeChangedEvent; /** Fired when a font setting changes. */ - var onFontChanged: FontChangedEvent; + export var onFontChanged: FontChangedEvent; } //////////////////// @@ -3120,7 +3140,7 @@ declare namespace chrome.fontSettings { * Permissions: "gcm" */ declare namespace chrome.gcm { - interface OutgoingMessage { + export interface OutgoingMessage { /** The ID of the server to send the message to as assigned by Google API Console. */ destinationId: string; /** The ID of the message. It must be unique for each message in scope of the applications. See the Cloud Messaging documentation for advice for picking and handling an ID. */ @@ -3131,7 +3151,7 @@ declare namespace chrome.gcm { data: Object; } - interface IncomingMessage { + export interface IncomingMessage { /** The message data. */ data: Object; /** @@ -3147,7 +3167,7 @@ declare namespace chrome.gcm { collapseKey?: string; } - interface GcmError { + export interface GcmError { /** The error message describing the problem. */ errorMessage: string; /** Optional. The ID of the message with this error, if error is related to a specific message. */ @@ -3156,14 +3176,14 @@ declare namespace chrome.gcm { detail: Object; } - interface MessageReceptionEvent extends chrome.events.Event<(message: IncomingMessage) => void> {} + export interface MessageReceptionEvent extends chrome.events.Event<(message: IncomingMessage) => void> {} - interface MessageDeletionEvent extends chrome.events.Event<() => void> {} + export interface MessageDeletionEvent extends chrome.events.Event<() => void> {} - interface GcmErrorEvent extends chrome.events.Event<(error: GcmError) => void> {} + export interface GcmErrorEvent extends chrome.events.Event<(error: GcmError) => void> {} /** The maximum size (in bytes) of all key/value pairs in a message. */ - var MAX_MESSAGE_SIZE: number; + export var MAX_MESSAGE_SIZE: number; /** * Registers the application with GCM. The registration ID will be returned by the callback. If register is called again with the same list of senderIds, the same registration ID will be returned. @@ -3192,11 +3212,11 @@ declare namespace chrome.gcm { export function send(message: OutgoingMessage, callback: (messageId: string) => void): void; /** Fired when a message is received through GCM. */ - var onMessage: MessageReceptionEvent; + export var onMessage: MessageReceptionEvent; /** Fired when a GCM server had to delete messages sent by an app server to the application. See Messages deleted event section of Cloud Messaging documentation for details on handling this event. */ - var onMessagesDeleted: MessageDeletionEvent; + export var onMessagesDeleted: MessageDeletionEvent; /** Fired when it was not possible to send a message to the GCM server. */ - var onSendError: GcmErrorEvent; + export var onSendError: GcmErrorEvent; } //////////////////// @@ -3209,7 +3229,7 @@ declare namespace chrome.gcm { */ declare namespace chrome.history { /** An object encapsulating one visit to a URL. */ - interface VisitItem { + export interface VisitItem { /** The transition type for this visit from its referrer. */ transition: string; /** Optional. When this visit occurred, represented in milliseconds since the epoch. */ @@ -3223,7 +3243,7 @@ declare namespace chrome.history { } /** An object encapsulating one result of a history query. */ - interface HistoryItem { + export interface HistoryItem { /** Optional. The number of times the user has navigated to this page by typing in the address. */ typedCount?: number; /** Optional. The title of the page when it was last loaded. */ @@ -3238,7 +3258,7 @@ declare namespace chrome.history { id: string; } - interface HistoryQuery { + export interface HistoryQuery { /** A free-text query to the history service. Leave empty to retrieve all pages. */ text: string; /** Optional. The maximum number of results to retrieve. Defaults to 100. */ @@ -3249,28 +3269,28 @@ declare namespace chrome.history { endTime?: number; } - interface Url { + export interface Url { /** The URL for the operation. It must be in the format as returned from a call to history.search. */ url: string; } - interface Range { + export interface Range { /** Items added to history before this date, represented in milliseconds since the epoch. */ endTime: number; /** Items added to history after this date, represented in milliseconds since the epoch. */ startTime: number; } - interface RemovedResult { + export interface RemovedResult { /** True if all history was removed. If true, then urls will be empty. */ allHistory: boolean; /** Optional. */ urls?: string[]; } - interface HistoryVisitedEvent extends chrome.events.Event<(result: HistoryItem) => void> {} + export interface HistoryVisitedEvent extends chrome.events.Event<(result: HistoryItem) => void> {} - interface HistoryVisitRemovedEvent extends chrome.events.Event<(removed: RemovedResult) => void> {} + export interface HistoryVisitRemovedEvent extends chrome.events.Event<(removed: RemovedResult) => void> {} /** * Searches the history for the last visit time of each page matching the query. @@ -3310,9 +3330,9 @@ declare namespace chrome.history { export function deleteUrl(details: Url, callback?: () => void): void; /** Fired when a URL is visited, providing the HistoryItem data for that URL. This event fires before the page has loaded. */ - var onVisited: HistoryVisitedEvent; + export var onVisited: HistoryVisitedEvent; /** Fired when one or more URLs are removed from the history service. When all visits have been removed the URL is purged from history. */ - var onVisitRemoved: HistoryVisitRemovedEvent; + export var onVisitRemoved: HistoryVisitRemovedEvent; } //////////////////// @@ -3324,7 +3344,7 @@ declare namespace chrome.history { */ declare namespace chrome.i18n { /** Holds detected ISO language code and its percentage in the input string */ - interface DetectedLanguage { + export interface DetectedLanguage { /** An ISO language code such as 'en' or 'fr'. * For a complete list of languages supported by this method, see [kLanguageInfoTable]{@link https://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/languages/internal/languages.cc}. * For an unknown language, 'und' will be returned, which means that [percentage] of the text is unknown to CLD */ @@ -3335,7 +3355,7 @@ declare namespace chrome.i18n { } /** Holds detected language reliability and array of DetectedLanguage */ - interface LanguageDetectionResult { + export interface LanguageDetectionResult { /** CLD detected language reliability */ isReliable: boolean; @@ -3379,12 +3399,12 @@ declare namespace chrome.i18n { */ declare namespace chrome.identity { /** @since Chrome 32. */ - interface AccountInfo { + export interface AccountInfo { /** A unique identifier for the account. This ID will not change for the lifetime of the account. */ id: string; } - interface TokenDetails { + export interface TokenDetails { /** * Optional. * Fetching a token may require the user to sign-in to Chrome, or approve the application's requested scopes. If the interactive flag is true, getAuthToken will prompt the user as necessary. When the flag is false or omitted, getAuthToken will return failure any time a prompt would be required. @@ -3406,19 +3426,19 @@ declare namespace chrome.identity { scopes?: string[]; } - interface UserInfo { + export interface UserInfo { /** An email address for the user account signed into the current profile. Empty if the user is not signed in or the identity.email manifest permission is not specified. */ email: string; /** A unique identifier for the account. This ID will not change for the lifetime of the account. Empty if the user is not signed in or (in M41+) the identity.email manifest permission is not specified. */ id: string; } - interface TokenInformation { + export interface TokenInformation { /** The specific token that should be removed from the cache. */ token: string; } - interface WebAuthFlowOptions { + export interface WebAuthFlowOptions { /** The URL that initiates the auth flow. */ url: string; /** @@ -3430,7 +3450,7 @@ declare namespace chrome.identity { interactive?: boolean; } - interface SignInChangeEvent extends chrome.events.Event<(account: AccountInfo, signedIn: boolean) => void> {} + export interface SignInChangeEvent extends chrome.events.Event<(account: AccountInfo, signedIn: boolean) => void> {} /** * Retrieves a list of AccountInfo objects describing the accounts present on the profile. @@ -3485,7 +3505,7 @@ declare namespace chrome.identity { * Fired when signin state changes for an account on the user's profile. * @since Chrome 33. */ - var onSignInChanged: SignInChangeEvent; + export var onSignInChanged: SignInChangeEvent; } //////////////////// @@ -3497,7 +3517,7 @@ declare namespace chrome.identity { * @since Chrome 6. */ declare namespace chrome.idle { - interface IdleStateChangedEvent extends chrome.events.Event<(newState: string) => void> {} + export interface IdleStateChangedEvent extends chrome.events.Event<(newState: string) => void> {} /** * Returns "locked" if the system is locked, "idle" if the user has not generated any input for a specified number of seconds, or "active" otherwise. @@ -3515,7 +3535,7 @@ declare namespace chrome.idle { export function setDetectionInterval(intervalInSeconds: number): void; /** Fired when the system changes to an active, idle or locked state. The event fires with "locked" if the screen is locked or the screensaver activates, "idle" if the system is unlocked and the user has not generated any input for a specified number of seconds, and "active" when the user generates input on an idle system. */ - var onStateChanged: IdleStateChangedEvent; + export var onStateChanged: IdleStateChangedEvent; } //////////////////// @@ -3528,7 +3548,7 @@ declare namespace chrome.idle { */ declare namespace chrome.input.ime { /** See http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent */ - interface KeyboardEvent { + export interface KeyboardEvent { /** * Optional. * Whether or not the SHIFT key is pressed. @@ -3577,7 +3597,7 @@ declare namespace chrome.input.ime { } /** Describes an input Context */ - interface InputContext { + export interface InputContext { /** This is used to specify targets of text field operations. This ID becomes invalid as soon as onBlur is called. */ contextID: number; /** Type of value this text field edits, (Text, Number, URL, etc) */ @@ -3603,7 +3623,7 @@ declare namespace chrome.input.ime { * A menu item used by an input method to interact with the user from the language menu. * @since Chrome 30. */ - interface MenuItem { + export interface MenuItem { /** String that will be passed to callbacks referencing this MenuItem. */ id: string; /** Optional. Text displayed in the menu for this item. */ @@ -3618,28 +3638,28 @@ declare namespace chrome.input.ime { enabled?: boolean; } - interface ImeParameters { + export interface ImeParameters { /** MenuItems to use. */ items: MenuItem[]; /** ID of the engine to use */ engineID: string; } - interface CommitTextParameters { + export interface CommitTextParameters { /** The text to commit */ text: string; /** ID of the context where the text will be committed */ contextID: number; } - interface CandidateUsage { + export interface CandidateUsage { /** The title string of details description. */ title: string; /** The body string of detail description. */ body: string; } - interface CandidateTemplate { + export interface CandidateTemplate { /** The candidate */ candidate: string; /** The candidate's id */ @@ -3666,14 +3686,14 @@ declare namespace chrome.input.ime { usage?: CandidateUsage; } - interface CandidatesParameters { + export interface CandidatesParameters { /** ID of the context that owns the candidate window. */ contextID: number; /** List of candidates to show in the candidate window */ candidates: CandidateTemplate[]; } - interface CompositionParameterSegment { + export interface CompositionParameterSegment { /** Index of the character to start this segment at */ start: number; /** Index of the character to end this segment after. */ @@ -3682,7 +3702,7 @@ declare namespace chrome.input.ime { style: string; } - interface CompositionParameters { + export interface CompositionParameters { /** ID of the context where the composition text will be set */ contextID: number; /** Text to set */ @@ -3697,12 +3717,12 @@ declare namespace chrome.input.ime { selectionEnd?: number; } - interface MenuItemParameters { + export interface MenuItemParameters { items: Object[]; engineId: string; } - interface CandidateWindowParameterProperties { + export interface CandidateWindowParameterProperties { /** * Optional. * True to show the cursor, false to hide it. @@ -3741,32 +3761,32 @@ declare namespace chrome.input.ime { windowPosition?: string; } - interface CandidateWindowParameter { + export interface CandidateWindowParameter { /** ID of the engine to set properties on. */ engineID: string; properties: CandidateWindowParameterProperties; } - interface ClearCompositionParameters { + export interface ClearCompositionParameters { /** ID of the context where the composition will be cleared */ contextID: number; } - interface CursorPositionParameters { + export interface CursorPositionParameters { /** ID of the candidate to select. */ candidateID: number; /** ID of the context that owns the candidate window. */ contextID: number; } - interface SendKeyEventParameters { + export interface SendKeyEventParameters { /** ID of the context where the key events will be sent, or zero to send key events to non-input field. */ contextID: number; /** Data on the key event. */ keyData: KeyboardEvent[]; } - interface DeleteSurroundingTextParameters { + export interface DeleteSurroundingTextParameters { /** ID of the engine receiving the event. */ engineID: string; /** ID of the context where the surrounding text will be deleted. */ @@ -3777,7 +3797,7 @@ declare namespace chrome.input.ime { length: number; } - interface SurroundingTextInfo { + export interface SurroundingTextInfo { /** The text around cursor. */ text: string; /** The ending position of the selection. This value indicates caret position if there is no selection. */ @@ -3786,25 +3806,25 @@ declare namespace chrome.input.ime { anchor: number; } - interface BlurEvent extends chrome.events.Event<(contextID: number) => void> {} + export interface BlurEvent extends chrome.events.Event<(contextID: number) => void> {} - interface CandidateClickedEvent extends chrome.events.Event<(engineID: string, candidateID: number, button: string) => void> {} + export interface CandidateClickedEvent extends chrome.events.Event<(engineID: string, candidateID: number, button: string) => void> {} - interface KeyEventEvent extends chrome.events.Event<(engineID: string, keyData: KeyboardEvent) => void> {} + export interface KeyEventEvent extends chrome.events.Event<(engineID: string, keyData: KeyboardEvent) => void> {} - interface DeactivatedEvent extends chrome.events.Event<(engineID: string) => void> {} + export interface DeactivatedEvent extends chrome.events.Event<(engineID: string) => void> {} - interface InputContextUpdateEvent extends chrome.events.Event<(context: InputContext) => void> {} + export interface InputContextUpdateEvent extends chrome.events.Event<(context: InputContext) => void> {} - interface ActivateEvent extends chrome.events.Event<(engineID: string, screen: string) => void> {} + export interface ActivateEvent extends chrome.events.Event<(engineID: string, screen: string) => void> {} - interface FocusEvent extends chrome.events.Event<(context: InputContext) => void> {} + export interface FocusEvent extends chrome.events.Event<(context: InputContext) => void> {} - interface MenuItemActivatedEvent extends chrome.events.Event<(engineID: string, name: string) => void> {} + export interface MenuItemActivatedEvent extends chrome.events.Event<(engineID: string, name: string) => void> {} - interface SurroundingTextChangedEvent extends chrome.events.Event<(engineID: string, surroundingInfo: SurroundingTextInfo) => void> {} + export interface SurroundingTextChangedEvent extends chrome.events.Event<(engineID: string, surroundingInfo: SurroundingTextInfo) => void> {} - interface InputResetEvent extends chrome.events.Event<(engineID: string) => void> {} + export interface InputResetEvent extends chrome.events.Event<(engineID: string) => void> {} /** * Adds the provided menu items to the language menu when this IME is active. @@ -3888,31 +3908,31 @@ declare namespace chrome.input.ime { export function keyEventHandled(requestId: string, response: boolean): void; /** This event is sent when focus leaves a text box. It is sent to all extensions that are listening to this event, and enabled by the user. */ - var onBlur: BlurEvent; + export var onBlur: BlurEvent; /** This event is sent if this extension owns the active IME. */ - var onCandidateClicked: CandidateClickedEvent; + export var onCandidateClicked: CandidateClickedEvent; /** This event is sent if this extension owns the active IME. */ - var onKeyEvent: KeyEventEvent; + export var onKeyEvent: KeyEventEvent; /** This event is sent when an IME is deactivated. It signals that the IME will no longer be receiving onKeyPress events. */ - var onDeactivated: DeactivatedEvent; + export var onDeactivated: DeactivatedEvent; /** This event is sent when the properties of the current InputContext change, such as the the type. It is sent to all extensions that are listening to this event, and enabled by the user. */ - var onInputContextUpdate: InputContextUpdateEvent; + export var onInputContextUpdate: InputContextUpdateEvent; /** This event is sent when an IME is activated. It signals that the IME will be receiving onKeyPress events. */ - var onActivate: ActivateEvent; + export var onActivate: ActivateEvent; /** This event is sent when focus enters a text box. It is sent to all extensions that are listening to this event, and enabled by the user. */ - var onFocus: FocusEvent; + export var onFocus: FocusEvent; /** Called when the user selects a menu item */ - var onMenuItemActivated: MenuItemActivatedEvent; + export var onMenuItemActivated: MenuItemActivatedEvent; /** * Called when the editable string around caret is changed or when the caret position is moved. The text length is limited to 100 characters for each back and forth direction. * @since Chrome 27. */ - var onSurroundingTextChanged: SurroundingTextChangedEvent; + export var onSurroundingTextChanged: SurroundingTextChangedEvent; /** * This event is sent when chrome terminates ongoing text input session. * @since Chrome 29. */ - var onReset: InputResetEvent; + export var onReset: InputResetEvent; } //////////////////// @@ -3925,7 +3945,7 @@ declare namespace chrome.input.ime { */ declare namespace chrome.management { /** Information about an installed extension, app, or theme. */ - interface ExtensionInfo { + export interface ExtensionInfo { /** * Optional. * A reason the item is disabled. @@ -4021,14 +4041,14 @@ declare namespace chrome.management { } /** Information about an icon belonging to an extension, app, or theme. */ - interface IconInfo { + export interface IconInfo { /** The URL for this icon image. To display a grayscale version of the icon (to indicate that an extension is disabled, for example), append ?grayscale=true to the URL. */ url: string; /** A number representing the width and height of the icon. Likely values include (but are not limited to) 128, 48, 24, and 16. */ size: number; } - interface UninstallOptions { + export interface UninstallOptions { /** * Optional. * Whether or not a confirm-uninstall dialog should prompt the user. Defaults to false for self uninstalls. If an extension uninstalls another extension, this parameter is ignored and the dialog is always shown. @@ -4036,13 +4056,13 @@ declare namespace chrome.management { showConfirmDialog?: boolean; } - interface ManagementDisabledEvent extends chrome.events.Event<(info: ExtensionInfo) => void> {} + export interface ManagementDisabledEvent extends chrome.events.Event<(info: ExtensionInfo) => void> {} - interface ManagementUninstalledEvent extends chrome.events.Event<(id: string) => void> {} + export interface ManagementUninstalledEvent extends chrome.events.Event<(id: string) => void> {} - interface ManagementInstalledEvent extends chrome.events.Event<(info: ExtensionInfo) => void> {} + export interface ManagementInstalledEvent extends chrome.events.Event<(info: ExtensionInfo) => void> {} - interface ManagementEnabledEvent extends chrome.events.Event<(info: ExtensionInfo) => void> {} + export interface ManagementEnabledEvent extends chrome.events.Event<(info: ExtensionInfo) => void> {} /** * Enables or disables an app or extension. @@ -4155,13 +4175,13 @@ declare namespace chrome.management { export function generateAppForLink(url: string, title: string, callback?: (result: ExtensionInfo) => void): void; /** Fired when an app or extension has been disabled. */ - var onDisabled: ManagementDisabledEvent; + export var onDisabled: ManagementDisabledEvent; /** Fired when an app or extension has been uninstalled. */ - var onUninstalled: ManagementUninstalledEvent; + export var onUninstalled: ManagementUninstalledEvent; /** Fired when an app or extension has been installed. */ - var onInstalled: ManagementInstalledEvent; + export var onInstalled: ManagementInstalledEvent; /** Fired when an app or extension has been enabled. */ - var onEnabled: ManagementEnabledEvent; + export var onEnabled: ManagementEnabledEvent; } //////////////////// @@ -4174,7 +4194,7 @@ declare namespace chrome.management { * @since Chrome 43. */ declare namespace chrome.networking.config { - interface NetworkInfo { + export interface NetworkInfo { /** Currently only WiFi supported. */ Type: string; /** Optional. A unique identifier of the network. */ @@ -4189,7 +4209,7 @@ declare namespace chrome.networking.config { Security?: string; } - interface CaptivePorttalDetectedEvent extends chrome.events.Event<(networkInfo: NetworkInfo) => void> {} + export interface CaptivePorttalDetectedEvent extends chrome.events.Event<(networkInfo: NetworkInfo) => void> {} /** * Allows an extension to define network filters for the networks it can handle. A call to this function will remove all filters previously installed by the extension before setting the new list. @@ -4214,7 +4234,7 @@ declare namespace chrome.networking.config { export function finishAuthentication(GUID: string, result: string, callback?: () => void): void; /** This event fires everytime a captive portal is detected on a network matching any of the currently registered network filters and the user consents to use the extension for authentication. Network filters may be set using the setNetworkFilter. Upon receiving this event the extension should start its authentication attempt with the captive portal. When the extension finishes its attempt, it must call finishAuthentication with the GUID received with this event and the appropriate authentication result. */ - var onCaptivePortalDetected: CaptivePorttalDetectedEvent; + export var onCaptivePortalDetected: CaptivePorttalDetectedEvent; } //////////////////// @@ -4227,19 +4247,19 @@ declare namespace chrome.networking.config { * @since Chrome 28. */ declare namespace chrome.notifications { - interface ButtonOptions { + export interface ButtonOptions { title: string; iconUrl?: string; } - interface ItemOptions { + export interface ItemOptions { /** Title of one item of a list notification. */ title: string; /** Additional details about this item. */ message: string; } - interface NotificationOptions { + export interface NotificationOptions { /** Optional. Which type of notification to display. Required for notifications.create method. */ type?: string; /** @@ -4294,15 +4314,15 @@ declare namespace chrome.notifications { requireInteraction?: boolean; } - interface NotificationClosedEvent extends chrome.events.Event<(notificationId: string, byUser: boolean) => void> {} + export interface NotificationClosedEvent extends chrome.events.Event<(notificationId: string, byUser: boolean) => void> {} - interface NotificationClickedEvent extends chrome.events.Event<(notificationId: string) => void> {} + export interface NotificationClickedEvent extends chrome.events.Event<(notificationId: string) => void> {} - interface NotificationButtonClickedEvent extends chrome.events.Event<(notificationId: string, buttonIndex: number) => void> {} + export interface NotificationButtonClickedEvent extends chrome.events.Event<(notificationId: string, buttonIndex: number) => void> {} - interface NotificationPermissionLevelChangedEvent extends chrome.events.Event<(level: string) => void> {} + export interface NotificationPermissionLevelChangedEvent extends chrome.events.Event<(level: string) => void> {} - interface NotificationShowSettingsEvent extends chrome.events.Event<() => void> {} + export interface NotificationShowSettingsEvent extends chrome.events.Event<() => void> {} /** The notification closed, either by the system or by user action. */ export var onClosed: NotificationClosedEvent; @@ -4390,25 +4410,25 @@ declare namespace chrome.notifications { */ declare namespace chrome.omnibox { /** A suggest result. */ - interface SuggestResult { + export interface SuggestResult { /** The text that is put into the URL bar, and that is sent to the extension when the user chooses this entry. */ content: string; /** The text that is displayed in the URL dropdown. Can contain XML-style markup for styling. The supported tags are 'url' (for a literal URL), 'match' (for highlighting text that matched what the user's query), and 'dim' (for dim helper text). The styles can be nested, eg. dimmed match. You must escape the five predefined entities to display them as text: stackoverflow.com/a/1091953/89484 */ description: string; } - interface Suggestion { + export interface Suggestion { /** The text that is displayed in the URL dropdown. Can contain XML-style markup for styling. The supported tags are 'url' (for a literal URL), 'match' (for highlighting text that matched what the user's query), and 'dim' (for dim helper text). The styles can be nested, eg. dimmed match. */ description: string; } - interface OmniboxInputEnteredEvent extends chrome.events.Event<(text: string) => void> {} + export interface OmniboxInputEnteredEvent extends chrome.events.Event<(text: string) => void> {} - interface OmniboxInputChangedEvent extends chrome.events.Event<(text: string, suggest: (suggestResults: SuggestResult[]) => void) => void> {} + export interface OmniboxInputChangedEvent extends chrome.events.Event<(text: string, suggest: (suggestResults: SuggestResult[]) => void) => void> {} - interface OmniboxInputStartedEvent extends chrome.events.Event<() => void> {} + export interface OmniboxInputStartedEvent extends chrome.events.Event<() => void> {} - interface OmniboxInputCancelledEvent extends chrome.events.Event<() => void> {} + export interface OmniboxInputCancelledEvent extends chrome.events.Event<() => void> {} /** * Sets the description and styling for the default suggestion. The default suggestion is the text that is displayed in the first suggestion row underneath the URL bar. @@ -4417,13 +4437,13 @@ declare namespace chrome.omnibox { export function setDefaultSuggestion(suggestion: Suggestion): void; /** User has accepted what is typed into the omnibox. */ - var onInputEntered: OmniboxInputEnteredEvent; + export var onInputEntered: OmniboxInputEnteredEvent; /** User has changed what is typed into the omnibox. */ - var onInputChanged: OmniboxInputChangedEvent; + export var onInputChanged: OmniboxInputChangedEvent; /** User has started a keyword input session by typing the extension's keyword. This is guaranteed to be sent exactly once per input session, and before any onInputChanged events. */ - var onInputStarted: OmniboxInputStartedEvent; + export var onInputStarted: OmniboxInputStartedEvent; /** User has ended the keyword input session without accepting the input. */ - var onInputCancelled: OmniboxInputCancelledEvent; + export var onInputCancelled: OmniboxInputCancelledEvent; } //////////////////// @@ -4435,28 +4455,28 @@ declare namespace chrome.omnibox { * @since Chrome 5. */ declare namespace chrome.pageAction { - interface PageActionClickedEvent extends chrome.events.Event<(tab: chrome.tabs.Tab) => void> {} + export interface PageActionClickedEvent extends chrome.events.Event<(tab: chrome.tabs.Tab) => void> {} - interface TitleDetails { + export interface TitleDetails { /** The id of the tab for which you want to modify the page action. */ tabId: number; /** The tooltip string. */ title: string; } - interface GetDetails { + export interface GetDetails { /** Specify the tab to get the title from. */ tabId: number; } - interface PopupDetails { + export interface PopupDetails { /** The id of the tab for which you want to modify the page action. */ tabId: number; /** The html file to show in a popup. If set to the empty string (''), no popup is shown. */ popup: string; } - interface IconDetails { + export interface IconDetails { /** The id of the tab for which you want to modify the page action. */ tabId: number; /** @@ -4512,7 +4532,7 @@ declare namespace chrome.pageAction { export function setIcon(details: IconDetails, callback?: () => void): void; /** Fired when a page action icon is clicked. This event will not fire if the page action has a popup. */ - var onClicked: PageActionClickedEvent; + export var onClicked: PageActionClickedEvent; } //////////////////// @@ -4524,7 +4544,7 @@ declare namespace chrome.pageAction { * @since Chrome 18. */ declare namespace chrome.pageCapture { - interface SaveDetails { + export interface SaveDetails { /** The id of the tab to save as MHTML. */ tabId: number; } @@ -4547,7 +4567,7 @@ declare namespace chrome.pageCapture { * @since Chrome 16. */ declare namespace chrome.permissions { - interface Permissions { + export interface Permissions { /** * Optional. * List of named permissions (does not include hosts or origins). Anything listed here must appear in the optional_permissions list in the manifest. @@ -4560,7 +4580,7 @@ declare namespace chrome.permissions { permissions?: string[]; } - interface PermissionsRemovedEvent { + export interface PermissionsRemovedEvent { /** * @param callback The callback parameter should be a function that looks like this: * function( Permissions permissions) {...}; @@ -4569,7 +4589,7 @@ declare namespace chrome.permissions { addListener(callback: (permissions: Permissions) => void): void; } - interface PermissionsAddedEvent { + export interface PermissionsAddedEvent { /** * @param callback The callback parameter should be a function that looks like this: * function( Permissions permissions) {...}; @@ -4608,9 +4628,9 @@ declare namespace chrome.permissions { export function remove(permissions: Permissions, callback?: (removed: boolean) => void): void; /** Fired when access to permissions has been removed from the extension. */ - var onRemoved: PermissionsRemovedEvent; + export var onRemoved: PermissionsRemovedEvent; /** Fired when the extension acquires new permissions. */ - var onAdded: PermissionsAddedEvent; + export var onAdded: PermissionsAddedEvent; } //////////////////// @@ -4623,21 +4643,21 @@ declare namespace chrome.permissions { * @since Chrome 45. */ declare namespace chrome.platformKeys { - interface Match { + export interface Match { /** The DER encoding of a X.509 certificate. */ certificate: ArrayBuffer; /** The KeyAlgorithm of the certified key. This contains algorithm parameters that are inherent to the key of the certificate (e.g. the key length). Other parameters like the hash function used by the sign function are not included. */ keyAlgorithm: KeyAlgorithm; } - interface ClientCertificateSelectRequestDetails { + export interface ClientCertificateSelectRequestDetails { /** This field is a list of the types of certificates requested, sorted in order of the server's preference. Only certificates of a type contained in this list will be retrieved. If certificateTypes is the empty list, however, certificates of any type will be returned. */ certificateTypes: string[]; /** List of distinguished names of certificate authorities allowed by the server. Each entry must be a DER-encoded X.509 DistinguishedName. */ certificateAuthorities: ArrayBuffer[]; } - interface ClientCertificateSelectDetails { + export interface ClientCertificateSelectDetails { /** Only certificates that match this request will be returned. */ request: ClientCertificateSelectRequestDetails; /** @@ -4649,14 +4669,14 @@ declare namespace chrome.platformKeys { interactive: boolean; } - interface ServerCertificateVerificationDetails { + export interface ServerCertificateVerificationDetails { /** Each chain entry must be the DER encoding of a X.509 certificate, the first entry must be the server certificate and each entry must certify the entry preceding it. */ serverCertificateChain: ArrayBuffer[]; /** The hostname of the server to verify the certificate for, e.g. the server that presented the serverCertificateChain. */ hostname: string; } - interface ServerCertificateVerificationResult { + export interface ServerCertificateVerificationResult { /** The result of the trust verification: true if trust for the given verification details could be established and false if trust is rejected for any reason. */ trusted: boolean; /** @@ -4717,7 +4737,7 @@ declare namespace chrome.power { * @since Chrome 44. */ declare namespace chrome.printerProvider { - interface PrinterInfo { + export interface PrinterInfo { /** Unique printer ID. */ id: string; /** Printer's human readable name. */ @@ -4726,12 +4746,12 @@ declare namespace chrome.printerProvider { description?: string; } - interface PrinterCapabilities { + export interface PrinterCapabilities { /** Device capabilities in CDD format. */ capabilities: any; } - interface PrintJob { + export interface PrintJob { /** ID of the printer which should handle the job. */ printerId: string; /** The print job title. */ @@ -4744,13 +4764,13 @@ declare namespace chrome.printerProvider { document: Blob; } - interface PrinterRequestedEvent extends chrome.events.Event<(resultCallback: (printerInfo: PrinterInfo[]) => void) => void> {} + export interface PrinterRequestedEvent extends chrome.events.Event<(resultCallback: (printerInfo: PrinterInfo[]) => void) => void> {} - interface PrinterInfoRequestedEvent extends chrome.events.Event<(device: any, resultCallback: (printerInfo?: PrinterInfo) => void) => void> {} + export interface PrinterInfoRequestedEvent extends chrome.events.Event<(device: any, resultCallback: (printerInfo?: PrinterInfo) => void) => void> {} - interface CapabilityRequestedEvent extends chrome.events.Event<(printerId: string, resultCallback: (capabilities: PrinterCapabilities) => void) => void> {} + export interface CapabilityRequestedEvent extends chrome.events.Event<(printerId: string, resultCallback: (capabilities: PrinterCapabilities) => void) => void> {} - interface PrintRequestedEvent extends chrome.events.Event<(printJob: PrintJob, resultCallback: (result: string) => void) => void> {} + export interface PrintRequestedEvent extends chrome.events.Event<(printJob: PrintJob, resultCallback: (result: string) => void) => void> {} /** Event fired when print manager requests printers provided by extensions. */ export var onGetPrintersRequested: PrinterRequestedEvent; @@ -4776,7 +4796,7 @@ declare namespace chrome.printerProvider { * @since Chrome 18. */ declare namespace chrome.privacy { - interface Services { + export interface Services { /** since Chrome 20. */ spellingServiceEnabled: chrome.types.ChromeSetting; searchSuggestEnabled: chrome.types.ChromeSetting; @@ -4793,7 +4813,7 @@ declare namespace chrome.privacy { safeBrowsingExtendedReportingEnabled: chrome.types.ChromeSetting; } - interface Network { + export interface Network { networkPredictionEnabled: chrome.types.ChromeSetting; /** @since Chrome 42. */ webRTCMultipleRoutesEnabled: chrome.types.ChromeSetting; @@ -4801,7 +4821,7 @@ declare namespace chrome.privacy { webRTCNonProxiedUdpEnabled: chrome.types.ChromeSetting; } - interface Websites { + export interface Websites { thirdPartyCookiesAllowed: chrome.types.ChromeSetting; referrersEnabled: chrome.types.ChromeSetting; hyperlinkAuditingEnabled: chrome.types.ChromeSetting; @@ -4810,11 +4830,11 @@ declare namespace chrome.privacy { } /** Settings that enable or disable features that require third-party network services provided by Google and your default search provider. */ - var services: Services; + export var services: Services; /** Settings that influence Chrome's handling of network connections in general. */ - var network: Network; + export var network: Network; /** Settings that determine what information Chrome makes available to websites. */ - var websites: Websites; + export var websites: Websites; } //////////////////// @@ -4827,7 +4847,7 @@ declare namespace chrome.privacy { */ declare namespace chrome.proxy { /** An object holding proxy auto-config information. Exactly one of the fields should be non-empty. */ - interface PacScript { + export interface PacScript { /** Optional. URL of the PAC file to be used. */ url?: string; /** Optional. If true, an invalid PAC script will prevent the network stack from falling back to direct connections. Defaults to false. */ @@ -4837,7 +4857,7 @@ declare namespace chrome.proxy { } /** An object encapsulating a complete proxy configuration. */ - interface ProxyConfig { + export interface ProxyConfig { /** Optional. The proxy rules describing this configuration. Use this for 'fixed_servers' mode. */ rules?: ProxyRules; /** Optional. The proxy auto-config (PAC) script for this configuration. Use this for 'pac_script' mode. */ @@ -4853,7 +4873,7 @@ declare namespace chrome.proxy { } /** An object encapsulating a single proxy server's specification. */ - interface ProxyServer { + export interface ProxyServer { /** The URI of the proxy server. This must be an ASCII hostname (in Punycode format). IDNA is not supported, yet. */ host: string; /** Optional. The scheme (protocol) of the proxy server itself. Defaults to 'http'. */ @@ -4863,7 +4883,7 @@ declare namespace chrome.proxy { } /** An object encapsulating the set of proxy rules for all protocols. Use either 'singleProxy' or (a subset of) 'proxyForHttp', 'proxyForHttps', 'proxyForFtp' and 'fallbackProxy'. */ - interface ProxyRules { + export interface ProxyRules { /** Optional. The proxy server to be used for FTP requests. */ proxyForFtp?: ProxyServer; /** Optional. The proxy server to be used for HTTP requests. */ @@ -4878,7 +4898,7 @@ declare namespace chrome.proxy { bypassList?: string[]; } - interface ErrorDetails { + export interface ErrorDetails { /** Additional details about the error such as a JavaScript runtime error. */ details: string; /** The error description. */ @@ -4887,11 +4907,11 @@ declare namespace chrome.proxy { fatal: boolean; } - interface ProxyErrorEvent extends chrome.events.Event<(details: ErrorDetails) => void> {} + export interface ProxyErrorEvent extends chrome.events.Event<(details: ErrorDetails) => void> {} - var settings: chrome.types.ChromeSetting; + export var settings: chrome.types.ChromeSetting; /** Notifies about proxy errors. */ - var onProxyError: ProxyErrorEvent; + export var onProxyError: ProxyErrorEvent; } //////////////////// @@ -4903,20 +4923,20 @@ declare namespace chrome.proxy { */ declare namespace chrome.runtime { /** This will be defined during an API method callback if there was an error */ - var lastError: LastError | undefined; + export var lastError: LastError | undefined; /** The ID of the extension/app. */ - var id: string; + export var id: string; - interface LastError { + export interface LastError { /** Optional. Details about the error which occurred. */ message?: string; } - interface ConnectInfo { + export interface ConnectInfo { name?: string; } - interface InstalledDetails { + export interface InstalledDetails { /** * The reason that this event is being dispatched. * One of: "install", "update", "chrome_update", or "shared_module_update" @@ -4935,7 +4955,7 @@ declare namespace chrome.runtime { id?: string; } - interface MessageOptions { + export interface MessageOptions { /** Whether the TLS channel ID will be passed into onMessageExternal for processes that are listening for the connection event. */ includeTlsChannelId?: boolean; } @@ -4944,7 +4964,7 @@ declare namespace chrome.runtime { * An object containing information about the script context that sent a message or request. * @since Chrome 26. */ - interface MessageSender { + export interface MessageSender { /** The ID of the extension or app that opened the connection, if any. */ id?: string; /** The tabs.Tab which opened the connection, if any. This property will only be present when the connection was opened from a tab (including content scripts), and only if the receiver is an extension, not an app. */ @@ -4970,7 +4990,7 @@ declare namespace chrome.runtime { * An object containing information about the current platform. * @since Chrome 36. */ - interface PlatformInfo { + export interface PlatformInfo { /** * The operating system chrome is running on. * One of: "mac", "win", "android", "cros", "linux", or "openbsd" @@ -4992,7 +5012,7 @@ declare namespace chrome.runtime { * An object which allows two way communication with other pages. * @since Chrome 26. */ - interface Port { + export interface Port { postMessage: (message: Object) => void; disconnect: () => void; /** @@ -5007,43 +5027,43 @@ declare namespace chrome.runtime { name: string; } - interface UpdateAvailableDetails { + export interface UpdateAvailableDetails { /** The version number of the available update. */ version: string; } - interface UpdateCheckDetails { + export interface UpdateCheckDetails { /** The version of the available update. */ version: string; } - interface PortDisconnectEvent extends chrome.events.Event<(port: Port) => void> {} + export interface PortDisconnectEvent extends chrome.events.Event<(port: Port) => void> {} - interface PortMessageEvent extends chrome.events.Event<(message: Object, port: Port) => void> {} + export interface PortMessageEvent extends chrome.events.Event<(message: Object, port: Port) => void> {} - interface ExtensionMessageEvent extends chrome.events.Event<(message: any, sender: MessageSender, sendResponse: (response: any) => void) => void> {} + export interface ExtensionMessageEvent extends chrome.events.Event<(message: any, sender: MessageSender, sendResponse: (response: any) => void) => void> {} - interface ExtensionConnectEvent extends chrome.events.Event<(port: Port) => void> {} + export interface ExtensionConnectEvent extends chrome.events.Event<(port: Port) => void> {} - interface RuntimeInstalledEvent extends chrome.events.Event<(details: InstalledDetails) => void> {} + export interface RuntimeInstalledEvent extends chrome.events.Event<(details: InstalledDetails) => void> {} - interface RuntimeEvent extends chrome.events.Event<() => void> {} + export interface RuntimeEvent extends chrome.events.Event<() => void> {} - interface RuntimeRestartRequiredEvent extends chrome.events.Event<(reason: string) => void> {} + export interface RuntimeRestartRequiredEvent extends chrome.events.Event<(reason: string) => void> {} - interface RuntimeUpdateAvailableEvent extends chrome.events.Event<(details: UpdateAvailableDetails) => void> {} + export interface RuntimeUpdateAvailableEvent extends chrome.events.Event<(details: UpdateAvailableDetails) => void> {} - interface ManifestIcons { + export interface ManifestIcons { [size: number]: string; } - interface ManifestAction { + export interface ManifestAction { default_icon?: ManifestIcons; default_title?: string; default_popup?: string; } - interface SearchProvider { + export interface SearchProvider { name?: string; keyword?: string; favicon_url?: string; @@ -5061,7 +5081,7 @@ declare namespace chrome.runtime { is_default?: boolean; } - interface Manifest { + export interface Manifest { // Required manifest_version: number; name: string; @@ -5358,74 +5378,74 @@ declare namespace chrome.runtime { * Fired when a connection is made from either an extension process or a content script. * @since Chrome 26. */ - var onConnect: ExtensionConnectEvent; + export var onConnect: ExtensionConnectEvent; /** * Fired when a connection is made from another extension. * @since Chrome 26. */ - var onConnectExternal: ExtensionConnectEvent; + export var onConnectExternal: ExtensionConnectEvent; /** Sent to the event page just before it is unloaded. This gives the extension opportunity to do some clean up. Note that since the page is unloading, any asynchronous operations started while handling this event are not guaranteed to complete. If more activity for the event page occurs before it gets unloaded the onSuspendCanceled event will be sent and the page won't be unloaded. */ - var onSuspend: RuntimeEvent; + export var onSuspend: RuntimeEvent; /** * Fired when a profile that has this extension installed first starts up. This event is not fired when an incognito profile is started, even if this extension is operating in 'split' incognito mode. * @since Chrome 23. */ - var onStartup: RuntimeEvent; + export var onStartup: RuntimeEvent; /** Fired when the extension is first installed, when the extension is updated to a new version, and when Chrome is updated to a new version. */ - var onInstalled: RuntimeInstalledEvent; + export var onInstalled: RuntimeInstalledEvent; /** Sent after onSuspend to indicate that the app won't be unloaded after all. */ - var onSuspendCanceled: RuntimeEvent; + export var onSuspendCanceled: RuntimeEvent; /** * Fired when a message is sent from either an extension process or a content script. * @since Chrome 26. */ - var onMessage: ExtensionMessageEvent; + export var onMessage: ExtensionMessageEvent; /** * Fired when a message is sent from another extension/app. Cannot be used in a content script. * @since Chrome 26. */ - var onMessageExternal: ExtensionMessageEvent; + export var onMessageExternal: ExtensionMessageEvent; /** * Fired when an app or the device that it runs on needs to be restarted. The app should close all its windows at its earliest convenient time to let the restart to happen. If the app does nothing, a restart will be enforced after a 24-hour grace period has passed. Currently, this event is only fired for Chrome OS kiosk apps. * @since Chrome 29. */ - var onRestartRequired: RuntimeRestartRequiredEvent; + export var onRestartRequired: RuntimeRestartRequiredEvent; /** * Fired when an update is available, but isn't installed immediately because the app is currently running. If you do nothing, the update will be installed the next time the background page gets unloaded, if you want it to be installed sooner you can explicitly call chrome.runtime.reload(). If your extension is using a persistent background page, the background page of course never gets unloaded, so unless you call chrome.runtime.reload() manually in response to this event the update will not get installed until the next time chrome itself restarts. If no handlers are listening for this event, and your extension has a persistent background page, it behaves as if chrome.runtime.reload() is called in response to this event. * @since Chrome 25. */ - var onUpdateAvailable: RuntimeUpdateAvailableEvent; + export var onUpdateAvailable: RuntimeUpdateAvailableEvent; /** * @deprecated since Chrome 33. Please use chrome.runtime.onRestartRequired. * Fired when a Chrome update is available, but isn't installed immediately because a browser restart is required. */ - var onBrowserUpdateAvailable: RuntimeEvent; + export var onBrowserUpdateAvailable: RuntimeEvent; } //////////////////// // Script Badge //////////////////// declare namespace chrome.scriptBadge { - interface GetPopupDetails { + export interface GetPopupDetails { tabId: number; } - interface AttentionDetails { + export interface AttentionDetails { tabId: number; } - interface SetPopupDetails { + export interface SetPopupDetails { tabId: number; popup: string; } - interface ScriptBadgeClickedEvent extends chrome.events.Event<(tab: chrome.tabs.Tab) => void> {} + export interface ScriptBadgeClickedEvent extends chrome.events.Event<(tab: chrome.tabs.Tab) => void> {} export function getPopup(details: GetPopupDetails, callback: Function): void; export function getAttention(details: AttentionDetails): void; export function setPopup(details: SetPopupDetails): void; - var onClicked: ScriptBadgeClickedEvent; + export var onClicked: ScriptBadgeClickedEvent; } //////////////////// @@ -5437,7 +5457,7 @@ declare namespace chrome.scriptBadge { * @since Chrome 37. */ declare namespace chrome.sessions { - interface Filter { + export interface Filter { /** * Optional. * The maximum number of entries to be fetched in the requested list. Omit this parameter to fetch the maximum number of entries (sessions.MAX_SESSION_RESULTS). @@ -5445,7 +5465,7 @@ declare namespace chrome.sessions { maxResults?: number; } - interface Session { + export interface Session { /** The time when the window or tab was closed or modified, represented in milliseconds since the epoch. */ lastModified: number; /** @@ -5460,14 +5480,14 @@ declare namespace chrome.sessions { window?: windows.Window; } - interface Device { + export interface Device { /** The name of the foreign device. */ deviceName: string; /** A list of open window sessions for the foreign device, sorted from most recently to least recently modified session. */ sessions: Session[]; } - interface SessionChangedEvent extends chrome.events.Event<() => void> {} + export interface SessionChangedEvent extends chrome.events.Event<() => void> {} /** The maximum number of sessions.Session that will be included in a requested list. */ export var MAX_SESSION_RESULTS: number; @@ -5518,7 +5538,7 @@ declare namespace chrome.sessions { * @since Chrome 20. */ declare namespace chrome.storage { - interface StorageArea { + export interface StorageArea { /** * Gets the amount of space (in bytes) being used by one or more items. * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). @@ -5569,19 +5589,19 @@ declare namespace chrome.storage { get(keys: string | string[] | Object | null, callback: (items: { [key: string]: any }) => void): void; } - interface StorageChange { + export interface StorageChange { /** Optional. The new value of the item, if there is a new value. */ newValue?: any; /** Optional. The old value of the item, if there was an old value. */ oldValue?: any; } - interface LocalStorageArea extends StorageArea { + export interface LocalStorageArea extends StorageArea { /** The maximum amount (in bytes) of data that can be stored in local storage, as measured by the JSON stringification of every value plus every key's length. This value will be ignored if the extension has the unlimitedStorage permission. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ QUOTA_BYTES: number; } - interface SyncStorageArea extends StorageArea { + export interface SyncStorageArea extends StorageArea { /** @deprecated since Chrome 40. The storage.sync API no longer has a sustained write operation quota. */ MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: number; /** The maximum total amount (in bytes) of data that can be stored in sync storage, as measured by the JSON stringification of every value plus every key's length. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ @@ -5603,53 +5623,53 @@ declare namespace chrome.storage { MAX_WRITE_OPERATIONS_PER_MINUTE: number; } - interface StorageChangedEvent extends chrome.events.Event<(changes: { [key: string]: StorageChange }, areaName: string) => void> {} + export interface StorageChangedEvent extends chrome.events.Event<(changes: { [key: string]: StorageChange }, areaName: string) => void> {} /** Items in the local storage area are local to each machine. */ - var local: LocalStorageArea; + export var local: LocalStorageArea; /** Items in the sync storage area are synced using Chrome Sync. */ - var sync: SyncStorageArea; + export var sync: SyncStorageArea; /** * Items in the managed storage area are set by the domain administrator, and are read-only for the extension; trying to modify this namespace results in an error. * @since Chrome 33. */ - var managed: StorageArea; + export var managed: StorageArea; /** Fired when one or more items change. */ - var onChanged: StorageChangedEvent; + export var onChanged: StorageChangedEvent; } //////////////////// // Socket //////////////////// declare namespace chrome.socket { - interface CreateInfo { + export interface CreateInfo { socketId: number; } - interface AcceptInfo { + export interface AcceptInfo { resultCode: number; socketId?: number; } - interface ReadInfo { + export interface ReadInfo { resultCode: number; data: ArrayBuffer; } - interface WriteInfo { + export interface WriteInfo { bytesWritten: number; } - interface RecvFromInfo { + export interface RecvFromInfo { resultCode: number; data: ArrayBuffer; port: number; address: string; } - interface SocketInfo { + export interface SocketInfo { socketType: string; localPort?: number; peerAddress?: string; @@ -5658,7 +5678,7 @@ declare namespace chrome.socket { connected: boolean; } - interface NetworkInterface { + export interface NetworkInterface { name: string; address: string; } @@ -5689,7 +5709,7 @@ declare namespace chrome.socket { * @since Chrome 32. */ declare namespace chrome.system.cpu { - interface ProcessorUsage { + export interface ProcessorUsage { /** The cumulative time used by userspace programs on this processor. */ user: number; /** The cumulative time used by kernel programs on this processor. */ @@ -5700,12 +5720,12 @@ declare namespace chrome.system.cpu { total: number; } - interface ProcessorInfo { + export interface ProcessorInfo { /** Cumulative usage info for this logical processor. */ usage: ProcessorUsage; } - interface CpuInfo { + export interface CpuInfo { /** The number of logical processors. */ numOfProcessors: number; /** The architecture name of the processors. */ @@ -5734,7 +5754,7 @@ declare namespace chrome.system.cpu { * @since Chrome 32. */ declare namespace chrome.system.memory { - interface MemoryInfo { + export interface MemoryInfo { /** The total amount of physical memory capacity, in bytes. */ capacity: number; /** The amount of available capacity, in bytes. */ @@ -5754,7 +5774,7 @@ declare namespace chrome.system.memory { * @since Chrome 30. */ declare namespace chrome.system.storage { - interface StorageUnitInfo { + 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. */ @@ -5770,16 +5790,16 @@ declare namespace chrome.system.storage { capacity: number; } - interface StorageCapacityInfo { + export interface StorageCapacityInfo { /** A copied |id| of getAvailableCapacity function parameter |id|. */ id: string; /** The available capacity of the storage device, in bytes. */ availableCapacity: number; } - interface SystemStorageAttachedEvent extends chrome.events.Event<(info: StorageUnitInfo) => void> {} + export interface SystemStorageAttachedEvent extends chrome.events.Event<(info: StorageUnitInfo) => void> {} - interface SystemStorageDetachedEvent extends chrome.events.Event<(id: string) => 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; @@ -5810,7 +5830,7 @@ declare namespace chrome.system.storage { * @since Chrome 31. */ declare namespace chrome.tabCapture { - interface CaptureInfo { + export interface CaptureInfo { /** The id of the tab whose status changed. */ tabId: number; /** @@ -5822,7 +5842,7 @@ declare namespace chrome.tabCapture { fullscreen: boolean; } - interface CaptureOptions { + export interface CaptureOptions { /** Optional. */ audio?: boolean; /** Optional. */ @@ -5833,7 +5853,7 @@ declare namespace chrome.tabCapture { videoConstraints?: MediaStreamConstraints; } - interface CaptureStatusChangedEvent extends chrome.events.Event<(info: CaptureInfo) => void> {} + export interface CaptureStatusChangedEvent extends chrome.events.Event<(info: CaptureInfo) => void> {} /** * Captures the visible area of the currently active tab. Capture can only be started on the currently active tab after the extension has been invoked. Capture is maintained across page navigations within the tab, and stops when the tab is closed, or the media stream is closed by the extension. @@ -5848,7 +5868,7 @@ declare namespace chrome.tabCapture { export function getCapturedTabs(callback: (result: CaptureInfo[]) => void): void; /** Event fired when the capture status of a tab changes. This allows extension authors to keep track of the capture status of tabs to keep UI elements like page actions in sync. */ - var onStatusChanged: CaptureStatusChangedEvent; + export var onStatusChanged: CaptureStatusChangedEvent; } //////////////////// @@ -5864,7 +5884,7 @@ declare namespace chrome.tabs { * Tab muted state and the reason for the last state change. * @since Chrome 46. Warning: this is the current Beta channel. */ - interface MutedInfo { + export interface MutedInfo { /** Whether the tab is prevented from playing sound (but hasn't necessarily recently produced sound). Equivalent to whether the muted audio indicator is showing. */ muted: boolean; /** @@ -5882,7 +5902,7 @@ declare namespace chrome.tabs { extensionId?: string; } - interface Tab { + export interface Tab { /** * Optional. * Either loading or complete. @@ -5973,7 +5993,7 @@ declare namespace chrome.tabs { * Defines how zoom changes in a tab are handled and at what scope. * @since Chrome 38. */ - interface ZoomSettings { + export interface ZoomSettings { /** * Optional. * Defines how zoom changes are handled, i.e. which entity is responsible for the actual scaling of the page; defaults to "automatic". @@ -5997,7 +6017,7 @@ declare namespace chrome.tabs { defaultZoomFactor?: number; } - interface InjectDetails { + export interface InjectDetails { /** * Optional. * If allFrames is true, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's false and is only injected into the top frame. @@ -6030,7 +6050,7 @@ declare namespace chrome.tabs { matchAboutBlank?: boolean; } - interface CreateProperties { + export interface CreateProperties { /** Optional. The position the tab should take in the window. The provided value will be clamped to between zero and the number of tabs in the window. */ index?: number; /** @@ -6064,14 +6084,14 @@ declare namespace chrome.tabs { selected?: boolean; } - interface MoveProperties { + export interface MoveProperties { /** The position to move the window to. -1 will place the tab at the end of the window. */ index: number; /** Optional. Defaults to the window the tab is currently in. */ windowId?: number; } - interface UpdateProperties { + export interface UpdateProperties { /** * Optional. Whether the tab should be pinned. * @since Chrome 9. @@ -6106,7 +6126,7 @@ declare namespace chrome.tabs { muted?: boolean; } - interface CaptureVisibleTabOptions { + export interface CaptureVisibleTabOptions { /** * Optional. * When format is "jpeg", controls the quality of the resulting image. This value is ignored for PNG images. As quality is decreased, the resulting image will have more visual artifacts, and the number of bytes needed to store it will decrease. @@ -6119,12 +6139,12 @@ declare namespace chrome.tabs { format?: string; } - interface ReloadProperties { + export interface ReloadProperties { /** Optional. Whether using any local cache. Default is false. */ bypassCache?: boolean; } - interface ConnectInfo { + export interface ConnectInfo { /** Optional. Will be passed into onConnect for content scripts that are listening for the connection event. */ name?: string; /** @@ -6134,19 +6154,19 @@ declare namespace chrome.tabs { frameId?: number; } - interface MessageSendOptions { + export interface MessageSendOptions { /** Optional. Send a message to a specific frame identified by frameId instead of all frames in the tab. */ frameId?: number; } - interface HighlightInfo { + export interface HighlightInfo { /** One or more tab indices to highlight. */ tabs: number | number[]; /** Optional. The window that contains the tabs. */ windowId?: number; } - interface QueryInfo { + export interface QueryInfo { /** * Optional. Whether the tabs have completed loading. * One of: "loading", or "complete" @@ -6196,12 +6216,12 @@ declare namespace chrome.tabs { muted?: boolean; } - interface TabHighlightInfo { + export interface TabHighlightInfo { windowId: number; tabIds: number[]; } - interface TabRemoveInfo { + export interface TabRemoveInfo { /** * The window whose tab is closed. * @since Chrome 25. @@ -6211,12 +6231,12 @@ declare namespace chrome.tabs { isWindowClosing: boolean; } - interface TabAttachInfo { + export interface TabAttachInfo { newPosition: number; newWindowId: number; } - interface TabChangeInfo { + export interface TabChangeInfo { /** Optional. The status of the tab. Can be either loading or complete. */ status?: string; /** @@ -6248,57 +6268,57 @@ declare namespace chrome.tabs { title?: string; } - interface TabMoveInfo { + export interface TabMoveInfo { toIndex: number; windowId: number; fromIndex: number; } - interface TabDetachInfo { + export interface TabDetachInfo { oldWindowId: number; oldPosition: number; } - interface TabActiveInfo { + export interface TabActiveInfo { /** The ID of the tab that has become active. */ tabId: number; /** The ID of the window the active tab changed inside of. */ windowId: number; } - interface TabWindowInfo { + export interface TabWindowInfo { /** The ID of the window of where the tab is located. */ windowId: number; } - interface ZoomChangeInfo { + export interface ZoomChangeInfo { tabId: number; oldZoomFactor: number; newZoomFactor: number; zoomSettings: ZoomSettings; } - interface TabHighlightedEvent extends chrome.events.Event<(highlightInfo: HighlightInfo) => void> {} + export interface TabHighlightedEvent extends chrome.events.Event<(highlightInfo: HighlightInfo) => void> {} - interface TabRemovedEvent extends chrome.events.Event<(tabId: number, removeInfo: TabRemoveInfo) => void> {} + export interface TabRemovedEvent extends chrome.events.Event<(tabId: number, removeInfo: TabRemoveInfo) => void> {} - interface TabUpdatedEvent extends chrome.events.Event<(tabId: number, changeInfo: TabChangeInfo, tab: Tab) => void> {} + export interface TabUpdatedEvent extends chrome.events.Event<(tabId: number, changeInfo: TabChangeInfo, tab: Tab) => void> {} - interface TabAttachedEvent extends chrome.events.Event<(tabId: number, attachInfo: TabAttachInfo) => void> {} + export interface TabAttachedEvent extends chrome.events.Event<(tabId: number, attachInfo: TabAttachInfo) => void> {} - interface TabMovedEvent extends chrome.events.Event<(tabId: number, moveInfo: TabMoveInfo) => void> {} + export interface TabMovedEvent extends chrome.events.Event<(tabId: number, moveInfo: TabMoveInfo) => void> {} - interface TabDetachedEvent extends chrome.events.Event<(tabId: number, detachInfo: TabDetachInfo) => void> {} + export interface TabDetachedEvent extends chrome.events.Event<(tabId: number, detachInfo: TabDetachInfo) => void> {} - interface TabCreatedEvent extends chrome.events.Event<(tab: Tab) => void> {} + export interface TabCreatedEvent extends chrome.events.Event<(tab: Tab) => void> {} - interface TabActivatedEvent extends chrome.events.Event<(activeInfo: TabActiveInfo) => void> {} + export interface TabActivatedEvent extends chrome.events.Event<(activeInfo: TabActiveInfo) => void> {} - interface TabReplacedEvent extends chrome.events.Event<(addedTabId: number, removedTabId: number) => void> {} + export interface TabReplacedEvent extends chrome.events.Event<(addedTabId: number, removedTabId: number) => void> {} - interface TabSelectedEvent extends chrome.events.Event<(tabId: number, selectInfo: TabWindowInfo) => void> {} + export interface TabSelectedEvent extends chrome.events.Event<(tabId: number, selectInfo: TabWindowInfo) => void> {} - interface TabZoomChangeEvent extends chrome.events.Event<(ZoomChangeInfo: ZoomChangeInfo) => void> {} + export interface TabZoomChangeEvent extends chrome.events.Event<(ZoomChangeInfo: ZoomChangeInfo) => void> {} /** * Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc. @@ -6560,57 +6580,57 @@ declare namespace chrome.tabs { * Fired when the highlighted or selected tabs in a window changes. * @since Chrome 18. */ - var onHighlighted: TabHighlightedEvent; + export var onHighlighted: TabHighlightedEvent; /** Fired when a tab is closed. */ - var onRemoved: TabRemovedEvent; + export var onRemoved: TabRemovedEvent; /** Fired when a tab is updated. */ - var onUpdated: TabUpdatedEvent; + export var onUpdated: TabUpdatedEvent; /** Fired when a tab is attached to a window, for example because it was moved between windows. */ - var onAttached: TabAttachedEvent; + export var onAttached: TabAttachedEvent; /** * Fired when a tab is moved within a window. Only one move event is fired, representing the tab the user directly moved. Move events are not fired for the other tabs that must move in response. This event is not fired when a tab is moved between windows. For that, see tabs.onDetached. */ - var onMoved: TabMovedEvent; + export var onMoved: TabMovedEvent; /** Fired when a tab is detached from a window, for example because it is being moved between windows. */ - var onDetached: TabDetachedEvent; + export var onDetached: TabDetachedEvent; /** Fired when a tab is created. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events to be notified when a URL is set. */ - var onCreated: TabCreatedEvent; + export var onCreated: TabCreatedEvent; /** * Fires when the active tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events to be notified when a URL is set. * @since Chrome 18. */ - var onActivated: TabActivatedEvent; + export var onActivated: TabActivatedEvent; /** * Fired when a tab is replaced with another tab due to prerendering or instant. * @since Chrome 26. */ - var onReplaced: TabReplacedEvent; + export var onReplaced: TabReplacedEvent; /** * @deprecated since Chrome 33. Please use tabs.onActivated. * Fires when the selected tab in a window changes. */ - var onSelectionChanged: TabSelectedEvent; + export var onSelectionChanged: TabSelectedEvent; /** * @deprecated since Chrome 33. Please use tabs.onActivated. * Fires when the selected tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to tabs.onUpdated events to be notified when a URL is set. */ - var onActiveChanged: TabSelectedEvent; + export var onActiveChanged: TabSelectedEvent; /** * @deprecated since Chrome 33. Please use tabs.onHighlighted. * Fired when the highlighted or selected tabs in a window changes. */ - var onHighlightChanged: TabHighlightedEvent; + export var onHighlightChanged: TabHighlightedEvent; /** * Fired when a tab is zoomed. * @since Chrome 38. */ - var onZoomChange: TabZoomChangeEvent; + export var onZoomChange: TabZoomChangeEvent; /** * An ID which represents the absence of a browser tab. * @since Chrome 46. */ - var TAB_ID_NONE: -1; + export var TAB_ID_NONE: -1; } //////////////////// @@ -6623,7 +6643,7 @@ declare namespace chrome.tabs { */ declare namespace chrome.topSites { /** An object encapsulating a most visited URL, such as the URLs on the new tab page. */ - interface MostVisitedURL { + export interface MostVisitedURL { /** The most visited URL. */ url: string; /** The title of the page */ @@ -6644,7 +6664,7 @@ declare namespace chrome.topSites { */ declare namespace chrome.tts { /** An event from the TTS engine to communicate the status of an utterance. */ - interface TtsEvent { + export interface TtsEvent { /** Optional. The index of the current character in the utterance. */ charIndex?: number; /** Optional. The error description, if the event type is 'error'. */ @@ -6657,7 +6677,7 @@ declare namespace chrome.tts { } /** A description of a voice available for speech synthesis. */ - interface TtsVoice { + export interface TtsVoice { /** Optional. The language that this voice supports, in the form language-region. Examples: 'en', 'en-US', 'en-GB', 'zh-CN'. */ lang?: string; /** @@ -6678,7 +6698,7 @@ declare namespace chrome.tts { remote?: boolean; } - interface SpeakOptions { + export interface SpeakOptions { /** Optional. Speaking volume between 0 and 1 inclusive, with 0 being lowest and 1 being highest, with a default of 1.0. */ volume?: number; /** @@ -6758,7 +6778,7 @@ declare namespace chrome.tts { * @since Chrome 14. */ declare namespace chrome.ttsEngine { - interface SpeakOptions { + export interface SpeakOptions { /** Optional. The language to be used for synthesis, in the form language-region. Examples: 'en', 'en-US', 'en-GB', 'zh-CN'. */ lang?: string; /** Optional. The name of the voice to use for synthesis. */ @@ -6779,22 +6799,22 @@ declare namespace chrome.ttsEngine { pitch?: number; } - interface TtsEngineSpeakEvent extends chrome.events.Event<(utterance: string, options: SpeakOptions, sendTtsEvent: (event: chrome.tts.TtsEvent) => void) => void> {} + export interface TtsEngineSpeakEvent extends chrome.events.Event<(utterance: string, options: SpeakOptions, sendTtsEvent: (event: chrome.tts.TtsEvent) => void) => void> {} /** Called when the user makes a call to tts.speak() and one of the voices from this extension's manifest is the first to match the options object. */ - var onSpeak: TtsEngineSpeakEvent; + export var onSpeak: TtsEngineSpeakEvent; /** Fired when a call is made to tts.stop and this extension may be in the middle of speaking. If an extension receives a call to onStop and speech is already stopped, it should do nothing (not raise an error). If speech is in the paused state, this should cancel the paused state. */ - var onStop: chrome.events.Event<() => void>; + export var onStop: chrome.events.Event<() => void>; /** * Optional: if an engine supports the pause event, it should pause the current utterance being spoken, if any, until it receives a resume event or stop event. Note that a stop event should also clear the paused state. * @since Chrome 29. */ - var onPause: chrome.events.Event<() => void>; + export var onPause: chrome.events.Event<() => void>; /** * Optional: if an engine supports the pause event, it should also support the resume event, to continue speaking the current utterance, if any. Note that a stop event should also clear the paused state. * @since Chrome 29. */ - var onResume: chrome.events.Event<() => void>; + export var onResume: chrome.events.Event<() => void>; } //////////////////// @@ -6805,7 +6825,7 @@ declare namespace chrome.ttsEngine { * @since Chrome 13. */ declare namespace chrome.types { - interface ChromeSettingClearDetails { + export interface ChromeSettingClearDetails { /** * Optional. * The scope of the ChromeSetting. One of @@ -6817,7 +6837,7 @@ declare namespace chrome.types { scope?: string; } - interface ChromeSettingSetDetails extends ChromeSettingClearDetails { + export interface ChromeSettingSetDetails extends ChromeSettingClearDetails { /** * The value of the setting. * Note that every setting has a specific value type, which is described together with the setting. An extension should not set a value of a different type. @@ -6834,7 +6854,7 @@ declare namespace chrome.types { scope?: string; } - interface ChromeSettingGetDetails { + export interface ChromeSettingGetDetails { /** Optional. Whether to return the value that applies to the incognito session (default false). */ incognito?: boolean; } @@ -6842,9 +6862,9 @@ declare namespace chrome.types { /** * @param details Details of the currently effective value. */ - type DetailsCallback = (details: ChromeSettingGetResultDetails) => void; + export type DetailsCallback = (details: ChromeSettingGetResultDetails) => void; - interface ChromeSettingGetResultDetails { + export interface ChromeSettingGetResultDetails { /** * One of * • not_controllable: cannot be controlled by any extension @@ -6863,10 +6883,10 @@ declare namespace chrome.types { incognitoSpecific?: boolean; } - interface ChromeSettingChangedEvent extends chrome.events.Event {} + export interface ChromeSettingChangedEvent extends chrome.events.Event {} /** An interface that allows access to a Chrome browser setting. See accessibilityFeatures for an example. */ - interface ChromeSetting { + export interface ChromeSetting { /** * Sets the value of a setting. * @param details Which setting to change. @@ -6899,7 +6919,7 @@ declare namespace chrome.types { * @since Chrome 43. */ declare namespace chrome.vpnProvider { - interface VpnSessionParameters { + export interface VpnSessionParameters { /** IP address for the VPN interface in CIDR notation. IPv4 is currently the only supported mode. */ address: string; /** Optional. Broadcast address for the VPN interface. (default: deduced from IP address and mask) */ @@ -6920,15 +6940,15 @@ declare namespace chrome.vpnProvider { dnsServer: string[]; } - interface VpnPlatformMessageEvent extends chrome.events.Event<(id: string, message: string, error: string) => void> {} + export interface VpnPlatformMessageEvent extends chrome.events.Event<(id: string, message: string, error: string) => void> {} - interface VpnPacketReceptionEvent extends chrome.events.Event<(data: ArrayBuffer) => void> {} + export interface VpnPacketReceptionEvent extends chrome.events.Event<(data: ArrayBuffer) => void> {} - interface VpnConfigRemovalEvent extends chrome.events.Event<(id: string) => void> {} + export interface VpnConfigRemovalEvent extends chrome.events.Event<(id: string) => void> {} - interface VpnConfigCreationEvent extends chrome.events.Event<(id: string, name: string, data: Object) => void> {} + export interface VpnConfigCreationEvent extends chrome.events.Event<(id: string, name: string, data: Object) => void> {} - interface VpnUiEvent extends chrome.events.Event<(event: string, id?: string) => void> {} + export interface VpnUiEvent extends chrome.events.Event<(event: string, id?: string) => void> {} /** * Creates a new VPN configuration that persists across multiple login sessions of the user. @@ -6965,15 +6985,15 @@ declare namespace chrome.vpnProvider { export function notifyConnectionStateChanged(state: string, callback?: Function): void; /** Triggered when a message is received from the platform for a VPN configuration owned by the extension. */ - var onPlatformMessage: VpnPlatformMessageEvent; + export var onPlatformMessage: VpnPlatformMessageEvent; /** Triggered when an IP packet is received via the tunnel for the VPN session owned by the extension. */ - var onPacketReceived: VpnPacketReceptionEvent; + export var onPacketReceived: VpnPacketReceptionEvent; /** Triggered when a configuration created by the extension is removed by the platform. */ - var onConfigRemoved: VpnConfigRemovalEvent; + export var onConfigRemoved: VpnConfigRemovalEvent; /** Triggered when a configuration is created by the platform for the extension. */ - var onConfigCreated: VpnConfigCreationEvent; + export var onConfigCreated: VpnConfigCreationEvent; /** Triggered when there is a UI event for the extension. UI events are signals from the platform that indicate to the app that a UI dialog needs to be shown to the user. */ - var onUIEvent: VpnUiEvent; + export var onUIEvent: VpnUiEvent; } //////////////////// @@ -6986,7 +7006,7 @@ declare namespace chrome.vpnProvider { * @since Chrome 43. */ declare namespace chrome.wallpaper { - interface WallpaperDetails { + export interface WallpaperDetails { /** Optional. The jpeg or png encoded wallpaper image. */ data?: any; /** Optional. The URL of the wallpaper to be set. */ @@ -7019,7 +7039,7 @@ declare namespace chrome.wallpaper { * @since Chrome 16. */ declare namespace chrome.webNavigation { - interface GetFrameDetails { + export interface GetFrameDetails { /** * The ID of the process runs the renderer for this tab. * @since Chrome 22. @@ -7032,7 +7052,7 @@ declare namespace chrome.webNavigation { frameId: number; } - interface GetFrameResultDetails { + export interface GetFrameResultDetails { /** The URL currently associated with this frame, if the frame identified by the frameId existed at one point in the given tab. The fact that an URL is associated with a given frameId does not imply that the corresponding frame still exists. */ url: string; /** True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired. */ @@ -7041,35 +7061,35 @@ declare namespace chrome.webNavigation { parentFrameId: number; } - interface GetAllFrameDetails { + export interface GetAllFrameDetails { /** The ID of the tab. */ tabId: number; } - interface GetAllFrameResultDetails extends GetFrameResultDetails { + export interface GetAllFrameResultDetails extends GetFrameResultDetails { /** The ID of the process runs the renderer for this tab. */ processId: number; /** The ID of the frame. 0 indicates that this is the main frame; a positive value indicates the ID of a subframe. */ frameId: number; } - interface WebNavigationCallbackDetails { + export interface WebNavigationCallbackDetails { /** The ID of the tab in which the navigation is about to occur. */ tabId: number; /** The time when the browser was about to start the navigation, in milliseconds since the epoch. */ timeStamp: number; } - interface WebNavigationUrlCallbackDetails extends WebNavigationCallbackDetails { + export interface WebNavigationUrlCallbackDetails extends WebNavigationCallbackDetails { url: string; } - interface WebNavigationReplacementCallbackDetails extends WebNavigationCallbackDetails { + export interface WebNavigationReplacementCallbackDetails extends WebNavigationCallbackDetails { /** The ID of the tab that was replaced. */ replacedTabId: number; } - interface WebNavigationFramedCallbackDetails extends WebNavigationUrlCallbackDetails { + export interface WebNavigationFramedCallbackDetails extends WebNavigationUrlCallbackDetails { /** 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique for a given tab and process. */ frameId: number; /** @@ -7079,12 +7099,12 @@ declare namespace chrome.webNavigation { processId: number; } - interface WebNavigationFramedErrorCallbackDetails extends WebNavigationFramedCallbackDetails { + export interface WebNavigationFramedErrorCallbackDetails extends WebNavigationFramedCallbackDetails { /** The error description. */ error: string; } - interface WebNavigationSourceCallbackDetails extends WebNavigationUrlCallbackDetails { + export interface WebNavigationSourceCallbackDetails extends WebNavigationUrlCallbackDetails { /** The ID of the tab in which the navigation is triggered. */ sourceTabId: number; /** @@ -7096,7 +7116,7 @@ declare namespace chrome.webNavigation { sourceFrameId: number; } - interface WebNavigationParentedCallbackDetails extends WebNavigationFramedCallbackDetails { + export interface WebNavigationParentedCallbackDetails extends WebNavigationFramedCallbackDetails { /** * ID of frame that wraps the frame. Set to -1 of no parent frame exists. * @since Chrome 24. @@ -7104,7 +7124,7 @@ declare namespace chrome.webNavigation { parentFrameId: number; } - interface WebNavigationTransitionCallbackDetails extends WebNavigationFramedCallbackDetails { + export interface WebNavigationTransitionCallbackDetails extends WebNavigationFramedCallbackDetails { /** * Cause of the navigation. * One of: "link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "start_page", "form_submit", "reload", "keyword", or "keyword_generated" @@ -7117,26 +7137,26 @@ declare namespace chrome.webNavigation { transitionQualifiers: string[]; } - interface WebNavigationEventFilter { + export interface WebNavigationEventFilter { /** Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of UrlFilter are ignored for this event. */ url: chrome.events.UrlFilter[]; } - interface WebNavigationEvent extends chrome.events.Event<(details: T) => void> { + export interface WebNavigationEvent extends chrome.events.Event<(details: T) => void> { addListener(callback: (details: T) => void, filters?: WebNavigationEventFilter): void; } - interface WebNavigationFramedEvent extends WebNavigationEvent {} + export interface WebNavigationFramedEvent extends WebNavigationEvent {} - interface WebNavigationFramedErrorEvent extends WebNavigationEvent {} + export interface WebNavigationFramedErrorEvent extends WebNavigationEvent {} - interface WebNavigationSourceEvent extends WebNavigationEvent {} + export interface WebNavigationSourceEvent extends WebNavigationEvent {} - interface WebNavigationParentedEvent extends WebNavigationEvent {} + export interface WebNavigationParentedEvent extends WebNavigationEvent {} - interface WebNavigationTransitionalEvent extends WebNavigationEvent {} + export interface WebNavigationTransitionalEvent extends WebNavigationEvent {} - interface WebNavigationReplacementEvent extends WebNavigationEvent {} + export interface WebNavigationReplacementEvent extends WebNavigationEvent {} /** * Retrieves information about the given frame. A frame refers to an