azure-devops-extension-sdk
Advanced tools
Comparing version 2.0.11 to 3.1.1
{ | ||
"name": "azure-devops-extension-sdk", | ||
"version": "2.0.11", | ||
"version": "3.1.1", | ||
"description": "Azure DevOps web extension JavaScript library.", | ||
@@ -19,2 +19,5 @@ "repository": { | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://aka.ms/AAk5pcm" | ||
}, | ||
"homepage": "https://docs.microsoft.com/en-us/azure/devops/integrate", | ||
@@ -24,4 +27,4 @@ "main": "SDK.js", | ||
"dependencies": { | ||
"es6-promise": "^4.2.5", | ||
"es6-object-assign": "^1.1.0" | ||
"es6-object-assign": "^1.1.0", | ||
"es6-promise": "^4.2.5" | ||
}, | ||
@@ -31,3 +34,3 @@ "devDependencies": { | ||
"recursive-copy": "~2.0.7", | ||
"shelljs": "~0.7.8", | ||
"shelljs": "^0.8.5", | ||
"typescript": "^2.9.2", | ||
@@ -34,0 +37,0 @@ "uglify-es": "~3.1.3" |
91
SDK.d.ts
/** | ||
* Web SDK version number. Can be specified in an extension's set of demands like: vss-sdk-version/3.0 | ||
*/ | ||
export declare const sdkVersion = 3; | ||
export declare const sdkVersion = 3.1; | ||
/** | ||
@@ -50,2 +50,3 @@ * Options for extension initialization -- passed to DevOps.init() | ||
export declare enum HostType { | ||
Unknown = 0, | ||
/** | ||
@@ -84,2 +85,6 @@ * The Deployment host | ||
type: HostType; | ||
/** | ||
* Distinguish between Azure DevOps Services (true) and Azure DevOps Server (false) | ||
*/ | ||
isHosted: boolean; | ||
} | ||
@@ -108,2 +113,73 @@ /** | ||
/** | ||
* Information about the current DevOps team | ||
*/ | ||
export interface ITeamContext { | ||
/** | ||
* Unique GUID for this team | ||
*/ | ||
id: string; | ||
/** | ||
* Name of team | ||
*/ | ||
name: string; | ||
} | ||
export interface GlobalizationContext { | ||
culture: string; | ||
/** | ||
* Gets the explicitly-set theme, or the empty string if a theme was not explicitly set. An explicitly-set theme is set either in the query string (?theme=[themename]) or in the user's profile. However, the default theme set in the profile is not considered to be an explicitly-set theme. | ||
*/ | ||
explicitTheme: string; | ||
theme: string; | ||
timeZoneId: string; | ||
timezoneOffset: number; | ||
typeAheadDisabled: boolean; | ||
} | ||
interface DaylightSavingsAdjustmentEntry { | ||
/** | ||
* Millisecond adjustment from UTC | ||
*/ | ||
offset: number; | ||
/** | ||
* Date that the offset adjustment starts | ||
*/ | ||
start: Date; | ||
} | ||
interface TimeZonesConfiguration { | ||
daylightSavingsAdjustments: DaylightSavingsAdjustmentEntry[]; | ||
} | ||
/** | ||
* Global context placed on each web page | ||
*/ | ||
export interface IPageContext { | ||
/** | ||
* Globalization data for the current page based on the current user's settings | ||
*/ | ||
globalization: GlobalizationContext; | ||
/** | ||
* Contains global time zone configuration information (e.g. which dates DST changes) | ||
*/ | ||
timeZonesConfiguration: TimeZonesConfiguration; | ||
/** | ||
* The web context information for the given page request | ||
*/ | ||
webContext: IWebContext; | ||
} | ||
export interface ContextIdentifier { | ||
id: string; | ||
name: string; | ||
} | ||
/** | ||
* Context information for all web access requests | ||
*/ | ||
interface IWebContext { | ||
/** | ||
* Information about the project used in the current request (may be null) | ||
*/ | ||
project: ContextIdentifier; | ||
/** | ||
* Information about the team used in the current request (may be null) | ||
*/ | ||
team: ITeamContext; | ||
} | ||
/** | ||
* Initiates the handshake with the host window. | ||
@@ -150,2 +226,14 @@ * | ||
/** | ||
* Gets information about the team that the page is targeting | ||
*/ | ||
export declare function getTeamContext(): ITeamContext; | ||
/** | ||
* Get the context about the host page | ||
*/ | ||
export declare function getPageContext(): IPageContext; | ||
/** | ||
* Get the context about the web | ||
*/ | ||
export declare function getWebContext(): IWebContext; | ||
/** | ||
* Get the contribution with the given contribution id. The returned contribution has a method to get a registered object within that contribution. | ||
@@ -190,1 +278,2 @@ * | ||
}): void; | ||
export {}; |
40
SDK.js
@@ -50,3 +50,3 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
*/ | ||
exports.sdkVersion = 3.0; | ||
exports.sdkVersion = 3.1; | ||
var global = window; | ||
@@ -62,2 +62,3 @@ if (global._AzureDevOpsSDKVersion) { | ||
(function (HostType) { | ||
HostType[HostType["Unknown"] = 0] = "Unknown"; | ||
/** | ||
@@ -79,2 +80,6 @@ * The Deployment host | ||
var parentChannel = XDM_1.channelManager.addChannel(window.parent); | ||
var teamContext; | ||
var webContext; | ||
; | ||
var hostPageContext; | ||
var extensionContext; | ||
@@ -118,2 +123,5 @@ var initialConfiguration; | ||
parentChannel.invokeRemoteMethod("initialHandshake", hostControlId, [initOptions]).then(function (handshakeData) { | ||
hostPageContext = handshakeData.pageContext; | ||
webContext = handshakeData ? hostPageContext.webContext : undefined; | ||
teamContext = webContext ? webContext.team : undefined; | ||
initialConfiguration = handshakeData.initialConfig || {}; | ||
@@ -217,2 +225,32 @@ initialContributionId = handshakeData.contributionId; | ||
/** | ||
* Gets information about the team that the page is targeting | ||
*/ | ||
function getTeamContext() { | ||
if (!teamContext) { | ||
throw new Error(getWaitForReadyError("getTeamContext")); | ||
} | ||
return teamContext; | ||
} | ||
exports.getTeamContext = getTeamContext; | ||
/** | ||
* Get the context about the host page | ||
*/ | ||
function getPageContext() { | ||
if (!hostPageContext) { | ||
throw new Error(getWaitForReadyError("getPageContext")); | ||
} | ||
return hostPageContext; | ||
} | ||
exports.getPageContext = getPageContext; | ||
/** | ||
* Get the context about the web | ||
*/ | ||
function getWebContext() { | ||
if (!webContext) { | ||
throw new Error(getWaitForReadyError("getWebContext")); | ||
} | ||
return webContext; | ||
} | ||
exports.getWebContext = getWebContext; | ||
/** | ||
* Get the contribution with the given contribution id. The returned contribution has a method to get a registered object within that contribution. | ||
@@ -219,0 +257,0 @@ * |
@@ -1,1 +0,1 @@ | ||
var __assign=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},__awaiter=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function u(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,u)}c((r=r.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){function n(n){return function(a){return function(n){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,o&&(i=2&n[0]?o.return:n[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,n[1])).done)return i;switch(o=0,i&&(n=[2&n[0],i.value]),n[0]){case 0:case 1:i=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(i=u.trys,!(i=i.length>0&&i[i.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!i||n[1]>i[0]&&n[1]<i[3])){u.label=n[1];break}if(6===n[0]&&u.label<i[1]){u.label=i[1],i=n;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(n);break}i[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{r=i=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,a])}}var r,o,i,a,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};define(["require","exports","./XDM"],function(e,t,n){"use strict";function r(e,t){var n,r=window;"function"==typeof r.CustomEvent?n=new r.CustomEvent(e,t):(t=t||{bubbles:!1,cancelable:!1},(n=document.createEvent("CustomEvent")).initCustomEvent(e,t.bubbles,t.cancelable,t.detail)),window.dispatchEvent(n)}function o(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){return[2,y]})})}function i(e){return"Attempted to call "+e+"() before init() was complete. Wait for init to complete or place within a ready() callback."}function a(e){h||((h=document.createElement("style")).type="text/css",document.head.appendChild(h));var t=[];if(e)for(var n in e)t.push("--"+n+": "+e[n]);h.innerText=":root { "+t.join("; ")+" } body { color: var(--text-primary-color) }",r("themeApplied",{detail:e})}Object.defineProperty(t,"__esModule",{value:!0}),t.sdkVersion=3;var u=window;u._AzureDevOpsSDKVersion&&console.error("The AzureDevOps SDK is already loaded. Only one version of this module can be loaded in a given document."),u._AzureDevOpsSDKVersion=t.sdkVersion;!function(e){e[e.Deployment=1]="Deployment",e[e.Enterprise=2]="Enterprise",e[e.Organization=4]="Organization"}(t.HostType||(t.HostType={}));var c,s,f,l,d,h,p,v="DevOps.HostControl",g="DevOps.ServiceManager",w=n.channelManager.addChannel(window.parent),y=new Promise(function(e){p=e});w.getObjectRegistry().register("DevOps.SdkClient",{dispatchEvent:r}),t.init=function(e){return new Promise(function(n){var r=__assign({},e,{sdkVersion:t.sdkVersion});w.invokeRemoteMethod("initialHandshake",v,[r]).then(function(e){s=e.initialConfig||{},f=e.contributionId;var t=e.context;c=t.extension,l=t.user,d=t.host,e.themeData&&(a(e.themeData),window.addEventListener("themeChanged",function(e){a(e.detail.data)})),p(),n()})})},t.ready=o,t.notifyLoadSucceeded=function(){return w.invokeRemoteMethod("notifyLoadSucceeded",v)},t.notifyLoadFailed=function(e){return w.invokeRemoteMethod("notifyLoadFailed",v,[e])},t.getConfiguration=function(){if(!s)throw new Error(i("getConfiguration"));return s},t.getContributionId=function(){if(!f)throw new Error(i("getContributionId"));return f},t.getUser=function(){if(!l)throw new Error(i("getUser"));return l},t.getHost=function(){if(!d)throw new Error(i("getHost"));return d},t.getExtensionContext=function(){if(!c)throw new Error(i("getExtensionContext"));return c},t.getService=function(e){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){return[2,o().then(function(){return w.invokeRemoteMethod("getService",g,[e])})]})})},t.register=function(e,t){w.getObjectRegistry().register(e,t)},t.unregister=function(e){w.getObjectRegistry().unregister(e)},t.getAccessToken=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){return[2,w.invokeRemoteMethod("getAccessToken",v).then(function(e){return e.token})]})})},t.getAppToken=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){return[2,w.invokeRemoteMethod("getAppToken",v).then(function(e){return e.token})]})})},t.resize=function(e,t){var n=document.body;if(n){var r="number"==typeof e?e:n?n.scrollWidth:void 0,o="number"==typeof t?t:n?n.scrollHeight:void 0;w.invokeRemoteMethod("resize",v,[r,o])}},t.applyTheme=a}); | ||
var __assign=this&&this.__assign||Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},__awaiter=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function u(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(a,u)}c((o=o.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){function n(n){return function(a){return function(n){if(o)throw new TypeError("Generator is already executing.");for(;u;)try{if(o=1,r&&(i=2&n[0]?r.return:n[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,n[1])).done)return i;switch(r=0,i&&(n=[2&n[0],i.value]),n[0]){case 0:case 1:i=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,r=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(i=u.trys,!(i=i.length>0&&i[i.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!i||n[1]>i[0]&&n[1]<i[3])){u.label=n[1];break}if(6===n[0]&&u.label<i[1]){u.label=i[1],i=n;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(n);break}i[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],r=0}finally{o=i=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,a])}}var o,r,i,a,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};define(["require","exports","./XDM"],function(e,t,n){"use strict";function o(e,t){var n,o=window;"function"==typeof o.CustomEvent?n=new o.CustomEvent(e,t):(t=t||{bubbles:!1,cancelable:!1},(n=document.createEvent("CustomEvent")).initCustomEvent(e,t.bubbles,t.cancelable,t.detail)),window.dispatchEvent(n)}function r(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){return[2,_]})})}function i(e){return"Attempted to call "+e+"() before init() was complete. Wait for init to complete or place within a ready() callback."}function a(e){p||((p=document.createElement("style")).type="text/css",document.head.appendChild(p));var t=[];if(e)for(var n in e)t.push("--"+n+": "+e[n]);p.innerText=":root { "+t.join("; ")+" } body { color: var(--text-primary-color) }",o("themeApplied",{detail:e})}Object.defineProperty(t,"__esModule",{value:!0}),t.sdkVersion=3.1;var u=window;u._AzureDevOpsSDKVersion&&console.error("The AzureDevOps SDK is already loaded. Only one version of this module can be loaded in a given document."),u._AzureDevOpsSDKVersion=t.sdkVersion;!function(e){e[e.Unknown=0]="Unknown",e[e.Deployment=1]="Deployment",e[e.Enterprise=2]="Enterprise",e[e.Organization=4]="Organization"}(t.HostType||(t.HostType={}));var c,s,f,d,l,h,g,v,p,w,b="DevOps.HostControl",y="DevOps.ServiceManager",m=n.channelManager.addChannel(window.parent),_=new Promise(function(e){w=e});m.getObjectRegistry().register("DevOps.SdkClient",{dispatchEvent:o}),t.init=function(e){return new Promise(function(n){var o=__assign({},e,{sdkVersion:t.sdkVersion});m.invokeRemoteMethod("initialHandshake",b,[o]).then(function(e){f=e.pageContext,s=e?f.webContext:void 0,c=s?s.team:void 0,l=e.initialConfig||{},h=e.contributionId;var t=e.context;d=t.extension,g=t.user,v=t.host,e.themeData&&(a(e.themeData),window.addEventListener("themeChanged",function(e){a(e.detail.data)})),w(),n()})})},t.ready=r,t.notifyLoadSucceeded=function(){return m.invokeRemoteMethod("notifyLoadSucceeded",b)},t.notifyLoadFailed=function(e){return m.invokeRemoteMethod("notifyLoadFailed",b,[e])},t.getConfiguration=function(){if(!l)throw new Error(i("getConfiguration"));return l},t.getContributionId=function(){if(!h)throw new Error(i("getContributionId"));return h},t.getUser=function(){if(!g)throw new Error(i("getUser"));return g},t.getHost=function(){if(!v)throw new Error(i("getHost"));return v},t.getExtensionContext=function(){if(!d)throw new Error(i("getExtensionContext"));return d},t.getTeamContext=function(){if(!c)throw new Error(i("getTeamContext"));return c},t.getPageContext=function(){if(!f)throw new Error(i("getPageContext"));return f},t.getWebContext=function(){if(!s)throw new Error(i("getWebContext"));return s},t.getService=function(e){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){return[2,r().then(function(){return m.invokeRemoteMethod("getService",y,[e])})]})})},t.register=function(e,t){m.getObjectRegistry().register(e,t)},t.unregister=function(e){m.getObjectRegistry().unregister(e)},t.getAccessToken=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){return[2,m.invokeRemoteMethod("getAccessToken",b).then(function(e){return e.token})]})})},t.getAppToken=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){return[2,m.invokeRemoteMethod("getAppToken",b).then(function(e){return e.token})]})})},t.resize=function(e,t){var n=document.body;if(n){var o="number"==typeof e?e:n?n.scrollWidth:void 0,r="number"==typeof t?t:n?n.scrollHeight:void 0;m.invokeRemoteMethod("resize",b,[o,r])}},t.applyTheme=a}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
73179
1340
0