azure-devops-extension-api 4.230.0 → 4.231.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Alert/Alert.d.ts CHANGED
@@ -60,6 +60,10 @@ export interface Alert {
60
60
  * Tools that have detected this issue.
61
61
  */
62
62
  tools: Tool[];
63
+ /**
64
+ * A truncated/obfuscated version of the secret pertaining to the alert (if applicable).
65
+ */
66
+ truncatedSecret: string;
63
67
  /**
64
68
  * ValidationFingerprints for the secret liveness check. Only return on demanded
65
69
  */
@@ -509,7 +513,7 @@ export declare enum ResultType {
509
513
  */
510
514
  export interface Rule {
511
515
  /**
512
- * Additional properties of this rule
516
+ * Additional properties of this rule dependent on the rule type. For example, dependency rules may include the CVE ID if it is available.
513
517
  */
514
518
  additionalProperties: {
515
519
  [key: string]: any;
@@ -596,12 +600,19 @@ export interface SearchCriteria {
596
600
  * If provided, only return alerts last seen before this date. \<br /\>Otherwise return all alerts.
597
601
  */
598
602
  toDate: Date;
603
+ /**
604
+ * If provided with toolName, only return alerts detected by this tool. \<br /\>Otherwise, return alerts detected by all tools.
605
+ */
606
+ toolName: string;
599
607
  }
600
608
  export declare enum Severity {
601
609
  Low = 0,
602
610
  Medium = 1,
603
611
  High = 2,
604
- Critical = 3
612
+ Critical = 3,
613
+ Note = 4,
614
+ Warning = 5,
615
+ Error = 6
605
616
  }
606
617
  export declare enum State {
607
618
  /**
@@ -659,6 +670,7 @@ export interface UxFilters {
659
670
  * Alert states to show. If empty show all alert states
660
671
  */
661
672
  states: State[];
673
+ tools: Tool[];
662
674
  }
663
675
  export interface ValidationFingerprint {
664
676
  validationFingerprintHash: string;
package/Alert/Alert.js CHANGED
@@ -155,6 +155,9 @@ define(["require", "exports"], function (require, exports) {
155
155
  Severity[Severity["Medium"] = 1] = "Medium";
156
156
  Severity[Severity["High"] = 2] = "High";
157
157
  Severity[Severity["Critical"] = 3] = "Critical";
158
+ Severity[Severity["Note"] = 4] = "Note";
159
+ Severity[Severity["Warning"] = 5] = "Warning";
160
+ Severity[Severity["Error"] = 6] = "Error";
158
161
  })(Severity = exports.Severity || (exports.Severity = {}));
159
162
  var State;
160
163
  (function (State) {
@@ -1 +1 @@
1
- define(["require","exports"],function(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});!function(e){e[e.Unknown=0]="Unknown",e[e.Dependency=1]="Dependency",e[e.Secret=2]="Secret",e[e.Code=3]="Code"}(n.AlertType||(n.AlertType={}));!function(e){e[e.Default=0]="Default",e[e.AdoPipeline=1]="AdoPipeline"}(n.AnalysisConfigurationType||(n.AnalysisConfigurationType={}));!function(e){e[e.Unknown=0]="Unknown",e[e.NuGet=1]="NuGet",e[e.Npm=2]="Npm",e[e.Maven=3]="Maven",e[e.Git=4]="Git",e[e.Other=5]="Other",e[e.RubyGems=6]="RubyGems",e[e.Cargo=7]="Cargo",e[e.Pip=8]="Pip",e[e.File=9]="File",e[e.Go=10]="Go",e[e.DockerImage=11]="DockerImage",e[e.Pod=12]="Pod",e[e.Linux=13]="Linux",e[e.Conda=14]="Conda",e[e.DockerReference=15]="DockerReference",e[e.Vcpkg=16]="Vcpkg"}(n.ComponentType||(n.ComponentType={}));!function(e){e[e.Unknown=0]="Unknown",e[e.Fixed=1]="Fixed",e[e.AcceptedRisk=2]="AcceptedRisk",e[e.FalsePositive=3]="FalsePositive"}(n.DismissalType||(n.DismissalType={}));!function(e){e[e.None=0]="None",e[e.ValidationFingerprint=1]="ValidationFingerprint"}(n.ExpandOption||(n.ExpandOption={}));!function(e){e[e.Unknown=0]="Unknown",e[e.Dependency=1]="Dependency",e[e.VersionControl=2]="VersionControl"}(n.ResultType||(n.ResultType={}));!function(e){e[e.Low=0]="Low",e[e.Medium=1]="Medium",e[e.High=2]="High",e[e.Critical=3]="Critical"}(n.Severity||(n.Severity={}));!function(e){e[e.Unknown=0]="Unknown",e[e.Active=1]="Active",e[e.Dismissed=2]="Dismissed",e[e.Fixed=4]="Fixed",e[e.AutoDismissed=8]="AutoDismissed"}(n.State||(n.State={}))});
1
+ define(["require","exports"],function(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});!function(e){e[e.Unknown=0]="Unknown",e[e.Dependency=1]="Dependency",e[e.Secret=2]="Secret",e[e.Code=3]="Code"}(n.AlertType||(n.AlertType={}));!function(e){e[e.Default=0]="Default",e[e.AdoPipeline=1]="AdoPipeline"}(n.AnalysisConfigurationType||(n.AnalysisConfigurationType={}));!function(e){e[e.Unknown=0]="Unknown",e[e.NuGet=1]="NuGet",e[e.Npm=2]="Npm",e[e.Maven=3]="Maven",e[e.Git=4]="Git",e[e.Other=5]="Other",e[e.RubyGems=6]="RubyGems",e[e.Cargo=7]="Cargo",e[e.Pip=8]="Pip",e[e.File=9]="File",e[e.Go=10]="Go",e[e.DockerImage=11]="DockerImage",e[e.Pod=12]="Pod",e[e.Linux=13]="Linux",e[e.Conda=14]="Conda",e[e.DockerReference=15]="DockerReference",e[e.Vcpkg=16]="Vcpkg"}(n.ComponentType||(n.ComponentType={}));!function(e){e[e.Unknown=0]="Unknown",e[e.Fixed=1]="Fixed",e[e.AcceptedRisk=2]="AcceptedRisk",e[e.FalsePositive=3]="FalsePositive"}(n.DismissalType||(n.DismissalType={}));!function(e){e[e.None=0]="None",e[e.ValidationFingerprint=1]="ValidationFingerprint"}(n.ExpandOption||(n.ExpandOption={}));!function(e){e[e.Unknown=0]="Unknown",e[e.Dependency=1]="Dependency",e[e.VersionControl=2]="VersionControl"}(n.ResultType||(n.ResultType={}));!function(e){e[e.Low=0]="Low",e[e.Medium=1]="Medium",e[e.High=2]="High",e[e.Critical=3]="Critical",e[e.Note=4]="Note",e[e.Warning=5]="Warning",e[e.Error=6]="Error"}(n.Severity||(n.Severity={}));!function(e){e[e.Unknown=0]="Unknown",e[e.Active=1]="Active",e[e.Dismissed=2]="Dismissed",e[e.Fixed=4]="Fixed",e[e.AutoDismissed=8]="AutoDismissed"}(n.State||(n.State={}))});
package/Build/Build.d.ts CHANGED
@@ -214,7 +214,7 @@ export interface Build {
214
214
  */
215
215
  plans: TaskOrchestrationPlanReference[];
216
216
  /**
217
- * The build's priority.
217
+ * Azure Pipelines does not support job priority. This field is deprecated.
218
218
  */
219
219
  priority: QueuePriority;
220
220
  /**
@@ -0,0 +1,34 @@
1
+ /**
2
+ * From /Tfs/WebPlatform/Client/TFS/Dashboards/WidgetConfigHelpers.ts
3
+ */
4
+ import { EventArgs } from "./WidgetContracts";
5
+ export declare class ConfigurationEvent {
6
+ /**
7
+ * Configuration has changed. When this event is notified, the preview is updated and Save button is enabled.
8
+ *
9
+ * The payload expected when notifying this event: { data: customSettings }
10
+ *
11
+ * {customSettings} is the serialized custom config settings pertaining to the widget.
12
+ */
13
+ static ConfigurationChange: string;
14
+ /**
15
+ * Configuration tries to execute API calls and fails. When this event is notified, the config does not render a view and we pass an error message to the configuration host.
16
+ *
17
+ * The payload expected when notifying this event: { data: string }
18
+ *
19
+ * {string} is the error message that is displayed at the top of the configuration.
20
+ */
21
+ static ConfigurationError: string;
22
+ /**
23
+ * Widget configuration general settings changed. When this event is notified, the widget name or widget size is updated.
24
+ *
25
+ * The payload expected when notifying this event: { data: { IGeneralSettings } }
26
+ *
27
+ * {generalSettings} is the serialized object containing WidgetName and WidgetSize
28
+ */
29
+ static GeneralSettingsChanged: string;
30
+ /**
31
+ * @param payload the event arguments we pass when we want to notify the configuration.
32
+ */
33
+ static Args<T>(payload: T): EventArgs<T>;
34
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * From /Tfs/WebPlatform/Client/TFS/Dashboards/WidgetConfigHelpers.ts
3
+ */
4
+ define(["require", "exports"], function (require, exports) {
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var ConfigurationEvent = /** @class */ (function () {
8
+ function ConfigurationEvent() {
9
+ }
10
+ /**
11
+ * @param payload the event arguments we pass when we want to notify the configuration.
12
+ */
13
+ ConfigurationEvent.Args = function (payload) {
14
+ return {
15
+ data: payload
16
+ };
17
+ };
18
+ /**
19
+ * Configuration has changed. When this event is notified, the preview is updated and Save button is enabled.
20
+ *
21
+ * The payload expected when notifying this event: { data: customSettings }
22
+ *
23
+ * {customSettings} is the serialized custom config settings pertaining to the widget.
24
+ */
25
+ ConfigurationEvent.ConfigurationChange = "ms.vss-dashboards-web.configurationChange";
26
+ /**
27
+ * Configuration tries to execute API calls and fails. When this event is notified, the config does not render a view and we pass an error message to the configuration host.
28
+ *
29
+ * The payload expected when notifying this event: { data: string }
30
+ *
31
+ * {string} is the error message that is displayed at the top of the configuration.
32
+ */
33
+ ConfigurationEvent.ConfigurationError = "ms.vss-dashboards-web.configurationError";
34
+ /**
35
+ * Widget configuration general settings changed. When this event is notified, the widget name or widget size is updated.
36
+ *
37
+ * The payload expected when notifying this event: { data: { IGeneralSettings } }
38
+ *
39
+ * {generalSettings} is the serialized object containing WidgetName and WidgetSize
40
+ */
41
+ ConfigurationEvent.GeneralSettingsChanged = "ms.vss-dashboards-web.generalSettingsChanged";
42
+ return ConfigurationEvent;
43
+ }());
44
+ exports.ConfigurationEvent = ConfigurationEvent;
45
+ });
@@ -0,0 +1 @@
1
+ define(["require","exports"],function(n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function n(){}return n.Args=function(n){return{data:n}},n.ConfigurationChange="ms.vss-dashboards-web.configurationChange",n.ConfigurationError="ms.vss-dashboards-web.configurationError",n.GeneralSettingsChanged="ms.vss-dashboards-web.generalSettingsChanged",n}();e.ConfigurationEvent=r});
@@ -0,0 +1,213 @@
1
+ /**
2
+ * From /Tfs/WebPlatform/Client/TFS/Dashboards/WidgetContracts.ts
3
+ */
4
+ import { LightboxOptions, SemanticVersion, WidgetSize } from "./Dashboard";
5
+ /**
6
+ * settings of the widget that encapsulate their serialized data and version support.
7
+ */
8
+ export interface CustomSettings {
9
+ /**
10
+ * the settings data serialized as a string.
11
+ */
12
+ data: string;
13
+ /**
14
+ * (Optional) version for the settings represented as a semantic version object.
15
+ * If none is available, the version defaults to {major:1, minor:0, patch:0} or "1.0.0"
16
+ */
17
+ version?: SemanticVersion;
18
+ }
19
+ /**
20
+ * A description of widget state, satisfying requirements for rendering a widget (Does not contain grid centric information, or contribution metadata).
21
+ */
22
+ export interface WidgetSettings {
23
+ /**
24
+ * size of the widget (in case of configuration, this maps to the size sub section in the general section of the configuration panel)
25
+ */
26
+ size: WidgetSize;
27
+ /**
28
+ * name of the widget (in case of configuration, this maps to the name sub section in the general section of the configuration panel)
29
+ */
30
+ name: string;
31
+ /**
32
+ * settings of the widget
33
+ */
34
+ customSettings: CustomSettings;
35
+ /**
36
+ * Lightbox options
37
+ */
38
+ lightboxOptions?: LightboxOptions;
39
+ }
40
+ /**
41
+ * Used to differentiate between widget status helpers
42
+ */
43
+ export declare enum WidgetStatusType {
44
+ /**
45
+ * The widget loaded successfully
46
+ */
47
+ Success = 0,
48
+ /**
49
+ * The widget failed to load
50
+ */
51
+ Failure = 1,
52
+ /**
53
+ * The widget needs to be configured
54
+ */
55
+ Unconfigured = 2
56
+ }
57
+ /**
58
+ * The object encapsulating the result for an IWidget/IConfigurableWidget method call. This object is created using the WidgetStatusHelper library.
59
+ */
60
+ export interface WidgetStatus {
61
+ /**
62
+ * the rendered state of the widget serialized to a string.
63
+ */
64
+ state?: string;
65
+ /**
66
+ * Used to determine which widget status helper was called
67
+ */
68
+ statusType?: WidgetStatusType;
69
+ }
70
+ /**
71
+ * All widgets implement this interface
72
+ */
73
+ export interface IWidget {
74
+ /** widgets use the settings provided along with the any cached data they may have to paint an interactive state. No network calls should be made by the widget.
75
+ * @param {WidgetSettings} settings of the widget as available when the widget render is called by the host.
76
+ * @returns object wrapped in a promise that encapsulates the success of this operation.
77
+ * when this calls are completed and the experience is done loading.
78
+ */
79
+ preload: (widgetSettings: WidgetSettings) => Promise<WidgetStatus>;
80
+ /**
81
+ * Widgets use the settings provided as well as server side calls to complete their rendering experience.
82
+ * In the future, widgets are expected to provide a loading experience while the calls are being waited to be completed.
83
+ * Until then, the widget host will provide the loading experience
84
+ * @param {WidgetSettings} settings of the widget as available when the widget render is called by the host.
85
+ * @returns object wrapped in a promise that encapsulates the success of this operation.
86
+ * when this calls are completed and the experience is done loading.
87
+ */
88
+ load: (widgetSettings: WidgetSettings) => Promise<WidgetStatus>;
89
+ /**
90
+ * Widgets manage any operations that are not necessary for initial load but are required for the full widget experience.
91
+ */
92
+ onDashboardLoaded?: () => void;
93
+ /**
94
+ * The framework calls this method to determine if the widget should be disabled for users with stakeholder license
95
+ * @param {WidgetSettings} settings of the widget as available when the widget render is called by the host.
96
+ * @returns A boolean wrapped in a promise that determines if the widget should be disabled for users with stakeholder license
97
+ */
98
+ disableWidgetForStakeholders?: (widgetSettings: WidgetSettings) => Promise<boolean>;
99
+ /**
100
+ * Run widget in lightboxed mode
101
+ * @param {WidgetSettings} settings of the widget as available when the widget render is called by the host.
102
+ * @param {LightboxSize} size of the lightbox
103
+ * @returns object wrapped in a promise that encapsulates the success of this operation.
104
+ * when this calls are completed and the experience is done loading.
105
+ */
106
+ lightbox?: (widgetSettings: WidgetSettings, lightboxSize: Size) => Promise<WidgetStatus>;
107
+ /**
108
+ * Listen to message from host
109
+ * @param {string} type of event
110
+ * @param {eventArgs} arguments associated with the event.
111
+ */
112
+ listen?: <T>(event: string, eventArgs: EventArgs<T>) => void;
113
+ }
114
+ /**
115
+ * Configurable widgets implement this interface
116
+ */
117
+ export interface IConfigurableWidget extends IWidget {
118
+ /**
119
+ * When the configuration view is changed, the widget is expected to update its view.
120
+ * @param {WidgetSettings} the latest widget settings as available from the configuration view for the widget.
121
+ * @returns object wrapped in a promise that encapsulates the success of this operation.
122
+ */
123
+ reload: (newWidgetSettings: WidgetSettings) => Promise<WidgetStatus>;
124
+ }
125
+ /**
126
+ * Widget authors implement this interface for their configuration.
127
+ */
128
+ export interface IWidgetConfiguration {
129
+ /**
130
+ * Called by the host to setup the widget configuration, which uses the settings shared with the widget to complete its rendering experience.
131
+ * @param {WidgetSettings} settings of the widget as shared with the configuration.
132
+ * @param {IWidgetConfigurationContext} widgetConfigurationContext provided by the host of the widget configuration to allow for communication.
133
+ * @returns object wrapped in a promise that encapsulates the success of this operation.
134
+ * If load fails, returns error message via WidgetStatusHelper.Failure(errorMessage).
135
+ */
136
+ load: (widgetSettings: WidgetSettings, widgetConfigurationContext: IWidgetConfigurationContext) => Promise<WidgetStatus>;
137
+ /**
138
+ * Called by the host when the user clicks on the Save button.
139
+ * Widget author is expected to run validations if needed.
140
+ * If ready to save, then use WidgetHelpers.WidgetConfigurationSave.Valid() to return the serialized custom settings of the widget from the configuraton.
141
+ * If custom settings are not valid and so not ready to save, then use WidgetHelpers.WidgetConfigurationSave.Invalid() to notify the host to stop save.
142
+ * @returns object of type SaveStatus wrapped in a promise.
143
+ */
144
+ onSave: () => Promise<SaveStatus>;
145
+ /**
146
+ * (Optional) Called by the host when the configuration is ready to be saved (when the user clicks the save button on the configuration panel)
147
+ */
148
+ onSaveComplete?: () => void;
149
+ /**
150
+ * Listen to message from host
151
+ * @param {string} type of event
152
+ * @param {eventArgs} arguments associated with the event.
153
+ */
154
+ listen?: <T>(event: string, eventArgs: EventArgs<T>) => void;
155
+ }
156
+ /**
157
+ * The result of a notification being made by a widget configuration.
158
+ */
159
+ export interface NotifyResult {
160
+ /**
161
+ * Gets a response from the subscriber of the notification, if they provide one as part of the schema for the event.
162
+ * @returns A promise with the data representing the return payload serialized as a string.
163
+ */
164
+ getResponse(): Promise<string>;
165
+ }
166
+ /**
167
+ * Arguments associated with an event being passed by a widget or configurations.
168
+ */
169
+ export interface EventArgs<T> {
170
+ /**
171
+ * Data relevant to the event.
172
+ */
173
+ data: T;
174
+ }
175
+ /**
176
+ * Interface for the object passed to the widget configuration to communicate with its host.
177
+ */
178
+ export interface IWidgetConfigurationContext {
179
+ /**
180
+ * The widget configuration calls this method when it wants to notify any of the WidgetEvents to the host
181
+ * @param {string} type of event
182
+ * @param {eventArgs} arguments associated with the event which comes from the widget configuration.
183
+ * @returns a promise with the result of the notification. If arguments are malformed, the promise will be rejected. If multiple notifications are made for the same event
184
+ * only the promise for the latest notification is resolved and the rest are treated as stale. The subscriber of the notification can send back information in a serialized form.
185
+ */
186
+ notify: <T>(event: string, eventArgs: EventArgs<T>) => Promise<NotifyResult>;
187
+ }
188
+ /**
189
+ * Interface for the object passed to the host when user clicks on the Save button in the configuration pane
190
+ */
191
+ export interface SaveStatus {
192
+ /**
193
+ * The custom settings to save
194
+ */
195
+ customSettings?: CustomSettings;
196
+ /**
197
+ * Indicates validity of the customSettings. If false, then user will be shown a generic error message and settings will not be saved.
198
+ */
199
+ isValid: boolean;
200
+ }
201
+ /**
202
+ * Size of lightbox to draw widget in
203
+ */
204
+ export interface Size {
205
+ /**
206
+ * width in pixels
207
+ */
208
+ width: number;
209
+ /**
210
+ * height in pixels
211
+ */
212
+ height: number;
213
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * From /Tfs/WebPlatform/Client/TFS/Dashboards/WidgetContracts.ts
3
+ */
4
+ define(["require", "exports"], function (require, exports) {
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ /**
8
+ * Used to differentiate between widget status helpers
9
+ */
10
+ var WidgetStatusType;
11
+ (function (WidgetStatusType) {
12
+ /**
13
+ * The widget loaded successfully
14
+ */
15
+ WidgetStatusType[WidgetStatusType["Success"] = 0] = "Success";
16
+ /**
17
+ * The widget failed to load
18
+ */
19
+ WidgetStatusType[WidgetStatusType["Failure"] = 1] = "Failure";
20
+ /**
21
+ * The widget needs to be configured
22
+ */
23
+ WidgetStatusType[WidgetStatusType["Unconfigured"] = 2] = "Unconfigured";
24
+ })(WidgetStatusType = exports.WidgetStatusType || (exports.WidgetStatusType = {}));
25
+ });
@@ -0,0 +1 @@
1
+ define(["require","exports"],function(e,u){"use strict";Object.defineProperty(u,"__esModule",{value:!0});!function(e){e[e.Success=0]="Success",e[e.Failure=1]="Failure",e[e.Unconfigured=2]="Unconfigured"}(u.WidgetStatusType||(u.WidgetStatusType={}))});
@@ -0,0 +1,89 @@
1
+ /**
2
+ * From /Tfs/WebPlatform/Client/TFS/Dashboards/WidgetHelpers.ts
3
+ */
4
+ import { CustomSettings, SaveStatus, WidgetStatus } from "./WidgetContracts";
5
+ export declare class WidgetStatusHelper {
6
+ /**
7
+ * method to encapsulate a successful result for a widget loading operation (load, reload, openLightbox etc)
8
+ * @param state any state information to be passed to the initiator of the loading call.
9
+ * @param title title for the lightbox of a widget when available.
10
+ * @returns promise encapsulating the status of the widget loading operations.
11
+ */
12
+ static Success(state?: string): Promise<WidgetStatus>;
13
+ /**
14
+ * method to encapsulate a failed result for a widget loading operation (load, reload, openLightbox etc)
15
+ * @param message message to display as part within the widget error experience.
16
+ * @param isUserVisible indicates whether the message should be displayed to the user or a generic error message displayed. Defaults to true.
17
+ * @param isRichText indicates whether the message is an html that can be rendered as a rich experience. Defaults to false. Only trusted extensions are
18
+ * allowed to set this to true. For any 3rd party widgets passing this value as true, it will be ignored.
19
+ * @returns promise encapsulating the status of the widget loading operations.
20
+ */
21
+ static Failure(message: string, isUserVisible?: boolean, isRichText?: boolean): Promise<WidgetStatus>;
22
+ /**
23
+ * method to encapsulate a result for a widget loading operation that results in the widget being in an unconfigured state.
24
+ * @returns promise encapsulating the status of the widget loading operations.
25
+ */
26
+ static Unconfigured(): Promise<WidgetStatus>;
27
+ }
28
+ export declare class WidgetConfigurationSave {
29
+ /**
30
+ * method to encapsulate a valid state that is returned by the widget configuration
31
+ * @param customSettings settings from the widget configuration to be returned as part of this state.
32
+ * @returns promise encapsulating the state being returned.
33
+ */
34
+ static Valid(customSettings: CustomSettings): Promise<SaveStatus>;
35
+ /**
36
+ * method to encapsulate an invalid state that is returned by the widget configuration
37
+ * @returns promise encapsulating the state being returned.
38
+ */
39
+ static Invalid(): Promise<SaveStatus>;
40
+ }
41
+ export declare class WidgetSizeConverter {
42
+ /**
43
+ * Cell width of the grid that is used to draw the widgets, this includes the border around the widget (i.e. this is the size of the div, border included)
44
+ */
45
+ private static CellWidth;
46
+ /**
47
+ * Cell height of the grid that is used to draw the widgets, this includes the border around the widget (i.e. this is the size of the div, border included)
48
+ */
49
+ private static CellHeight;
50
+ /**
51
+ * Cell gutter width between the cells that is used to draw the widget, this excludes the border around the widget (i.e. this is distance between widgets)
52
+ */
53
+ private static CellMarginWidth;
54
+ /**
55
+ * Cell gutter height between the cells that is used to draw the widget, this excludes the border around the widget (i.e. this is distance between widgets)
56
+ */
57
+ private static CellMarginHeight;
58
+ /**
59
+ * Calculates a dimension in pixels, given widget cell size and grid dimensions
60
+ * @returns size in pixels
61
+ */
62
+ private static CalculatePixelSize;
63
+ /**
64
+ * @returns width in pixels for 1x1 widget
65
+ */
66
+ static GetWidgetWidth(): number;
67
+ /**
68
+ * @returns height in pixels for 1x1 widget
69
+ */
70
+ static GetWidgetHeight(): number;
71
+ /**
72
+ * @returns width in pixels for widget gutter
73
+ */
74
+ static GetWidgetMarginWidth(): number;
75
+ /**
76
+ * @returns height in pixels for widget gutter
77
+ */
78
+ static GetWidgetMarginHeight(): number;
79
+ /**
80
+ * Converts widget column span into pixels
81
+ * @returns width in pixels
82
+ */
83
+ static ColumnsToPixelWidth(columnSpan: number): number;
84
+ /**
85
+ * Converts widget row span into pixels
86
+ * @returns height in pixels
87
+ */
88
+ static RowsToPixelHeight(rowSpan: number): number;
89
+ }
@@ -0,0 +1,146 @@
1
+ /**
2
+ * From /Tfs/WebPlatform/Client/TFS/Dashboards/WidgetHelpers.ts
3
+ */
4
+ define(["require", "exports", "./WidgetContracts"], function (require, exports, WidgetContracts_1) {
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var WidgetStatusHelper = /** @class */ (function () {
8
+ function WidgetStatusHelper() {
9
+ }
10
+ /**
11
+ * method to encapsulate a successful result for a widget loading operation (load, reload, openLightbox etc)
12
+ * @param state any state information to be passed to the initiator of the loading call.
13
+ * @param title title for the lightbox of a widget when available.
14
+ * @returns promise encapsulating the status of the widget loading operations.
15
+ */
16
+ WidgetStatusHelper.Success = function (state) {
17
+ return Promise.resolve({
18
+ state: state,
19
+ statusType: WidgetContracts_1.WidgetStatusType.Success
20
+ });
21
+ };
22
+ /**
23
+ * method to encapsulate a failed result for a widget loading operation (load, reload, openLightbox etc)
24
+ * @param message message to display as part within the widget error experience.
25
+ * @param isUserVisible indicates whether the message should be displayed to the user or a generic error message displayed. Defaults to true.
26
+ * @param isRichText indicates whether the message is an html that can be rendered as a rich experience. Defaults to false. Only trusted extensions are
27
+ * allowed to set this to true. For any 3rd party widgets passing this value as true, it will be ignored.
28
+ * @returns promise encapsulating the status of the widget loading operations.
29
+ */
30
+ WidgetStatusHelper.Failure = function (message, isUserVisible, isRichText) {
31
+ if (isUserVisible === void 0) { isUserVisible = true; }
32
+ if (isRichText === void 0) { isRichText = false; }
33
+ return Promise.reject({
34
+ message: message,
35
+ isRichText: isRichText,
36
+ isUserVisible: isUserVisible
37
+ });
38
+ };
39
+ /**
40
+ * method to encapsulate a result for a widget loading operation that results in the widget being in an unconfigured state.
41
+ * @returns promise encapsulating the status of the widget loading operations.
42
+ */
43
+ WidgetStatusHelper.Unconfigured = function () {
44
+ return Promise.resolve({
45
+ statusType: WidgetContracts_1.WidgetStatusType.Unconfigured
46
+ });
47
+ };
48
+ return WidgetStatusHelper;
49
+ }());
50
+ exports.WidgetStatusHelper = WidgetStatusHelper;
51
+ var WidgetConfigurationSave = /** @class */ (function () {
52
+ function WidgetConfigurationSave() {
53
+ }
54
+ /**
55
+ * method to encapsulate a valid state that is returned by the widget configuration
56
+ * @param customSettings settings from the widget configuration to be returned as part of this state.
57
+ * @returns promise encapsulating the state being returned.
58
+ */
59
+ WidgetConfigurationSave.Valid = function (customSettings) {
60
+ return Promise.resolve({
61
+ customSettings: customSettings,
62
+ isValid: true
63
+ });
64
+ };
65
+ /**
66
+ * method to encapsulate an invalid state that is returned by the widget configuration
67
+ * @returns promise encapsulating the state being returned.
68
+ */
69
+ WidgetConfigurationSave.Invalid = function () {
70
+ return Promise.reject({
71
+ isValid: false
72
+ });
73
+ };
74
+ return WidgetConfigurationSave;
75
+ }());
76
+ exports.WidgetConfigurationSave = WidgetConfigurationSave;
77
+ var WidgetSizeConverter = /** @class */ (function () {
78
+ function WidgetSizeConverter() {
79
+ }
80
+ /**
81
+ * Calculates a dimension in pixels, given widget cell size and grid dimensions
82
+ * @returns size in pixels
83
+ */
84
+ WidgetSizeConverter.CalculatePixelSize = function (cellCount, gridCellSize, gridMarginSize) {
85
+ //the dimensions of a multi-celled widget are a combination of space of the occupied cells AND the margins between those cells
86
+ var marginCount = cellCount - 1;
87
+ return gridCellSize * cellCount + gridMarginSize * marginCount;
88
+ };
89
+ /**
90
+ * @returns width in pixels for 1x1 widget
91
+ */
92
+ WidgetSizeConverter.GetWidgetWidth = function () {
93
+ return WidgetSizeConverter.CellWidth;
94
+ };
95
+ /**
96
+ * @returns height in pixels for 1x1 widget
97
+ */
98
+ WidgetSizeConverter.GetWidgetHeight = function () {
99
+ return WidgetSizeConverter.CellHeight;
100
+ };
101
+ /**
102
+ * @returns width in pixels for widget gutter
103
+ */
104
+ WidgetSizeConverter.GetWidgetMarginWidth = function () {
105
+ return WidgetSizeConverter.CellMarginWidth;
106
+ };
107
+ /**
108
+ * @returns height in pixels for widget gutter
109
+ */
110
+ WidgetSizeConverter.GetWidgetMarginHeight = function () {
111
+ return WidgetSizeConverter.CellMarginHeight;
112
+ };
113
+ /**
114
+ * Converts widget column span into pixels
115
+ * @returns width in pixels
116
+ */
117
+ WidgetSizeConverter.ColumnsToPixelWidth = function (columnSpan) {
118
+ return this.CalculatePixelSize(columnSpan, WidgetSizeConverter.GetWidgetWidth(), WidgetSizeConverter.GetWidgetMarginWidth());
119
+ };
120
+ /**
121
+ * Converts widget row span into pixels
122
+ * @returns height in pixels
123
+ */
124
+ WidgetSizeConverter.RowsToPixelHeight = function (rowSpan) {
125
+ return this.CalculatePixelSize(rowSpan, WidgetSizeConverter.GetWidgetHeight(), WidgetSizeConverter.GetWidgetMarginHeight());
126
+ };
127
+ /**
128
+ * Cell width of the grid that is used to draw the widgets, this includes the border around the widget (i.e. this is the size of the div, border included)
129
+ */
130
+ WidgetSizeConverter.CellWidth = 160;
131
+ /**
132
+ * Cell height of the grid that is used to draw the widgets, this includes the border around the widget (i.e. this is the size of the div, border included)
133
+ */
134
+ WidgetSizeConverter.CellHeight = 160;
135
+ /**
136
+ * Cell gutter width between the cells that is used to draw the widget, this excludes the border around the widget (i.e. this is distance between widgets)
137
+ */
138
+ WidgetSizeConverter.CellMarginWidth = 10;
139
+ /**
140
+ * Cell gutter height between the cells that is used to draw the widget, this excludes the border around the widget (i.e. this is distance between widgets)
141
+ */
142
+ WidgetSizeConverter.CellMarginHeight = 10;
143
+ return WidgetSizeConverter;
144
+ }());
145
+ exports.WidgetSizeConverter = WidgetSizeConverter;
146
+ });
@@ -0,0 +1 @@
1
+ define(["require","exports","./WidgetContracts"],function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return e.Success=function(e){return Promise.resolve({state:e,statusType:i.WidgetStatusType.Success})},e.Failure=function(e,t,i){return void 0===t&&(t=!0),void 0===i&&(i=!1),Promise.reject({message:e,isRichText:i,isUserVisible:t})},e.Unconfigured=function(){return Promise.resolve({statusType:i.WidgetStatusType.Unconfigured})},e}();t.WidgetStatusHelper=n;var r=function(){function e(){}return e.Valid=function(e){return Promise.resolve({customSettings:e,isValid:!0})},e.Invalid=function(){return Promise.reject({isValid:!1})},e}();t.WidgetConfigurationSave=r;var u=function(){function e(){}return e.CalculatePixelSize=function(e,t,i){return t*e+i*(e-1)},e.GetWidgetWidth=function(){return e.CellWidth},e.GetWidgetHeight=function(){return e.CellHeight},e.GetWidgetMarginWidth=function(){return e.CellMarginWidth},e.GetWidgetMarginHeight=function(){return e.CellMarginHeight},e.ColumnsToPixelWidth=function(t){return this.CalculatePixelSize(t,e.GetWidgetWidth(),e.GetWidgetMarginWidth())},e.RowsToPixelHeight=function(t){return this.CalculatePixelSize(t,e.GetWidgetHeight(),e.GetWidgetMarginHeight())},e.CellWidth=160,e.CellHeight=160,e.CellMarginWidth=10,e.CellMarginHeight=10,e}();t.WidgetSizeConverter=u});
@@ -1,2 +1,5 @@
1
1
  export * from "./Dashboard";
2
2
  export * from "./DashboardClient";
3
+ export * from "./WidgetConfigHelpers";
4
+ export * from "./WidgetContracts";
5
+ export * from "./WidgetHelpers";