azure-devops-extension-sdk
Advanced tools
Comparing version 1.141.4 to 1.141.5
@@ -502,2 +502,19 @@ // Copyright (C) Microsoft Corporation. All rights reserved. | ||
function dispatchEvent(eventName, params) { | ||
var evt; | ||
if (typeof window.CustomEvent === "function") { | ||
evt = new window.CustomEvent(eventName, params); | ||
} | ||
else { | ||
params = params || { bubbles: false, cancelable: false }; | ||
evt = document.createEvent('CustomEvent'); | ||
evt.initCustomEvent(eventName, params.bubbles, params.cancelable, params.detail); | ||
} | ||
window.dispatchEvent(evt); | ||
} | ||
parentChannel.getObjectRegistry().register("DevOps.SdkClient", { | ||
dispatchEvent: dispatchEvent | ||
}); | ||
/** | ||
@@ -684,2 +701,4 @@ * Initiates the handshake with the host window. | ||
themeElement.innerText = ":root { " + cssVariables.join("; ") + " } body { color: var(--text-primary-color) }"; | ||
dispatchEvent("themeApplied", { detail: themeData }); | ||
} | ||
@@ -686,0 +705,0 @@ |
@@ -1,1 +0,1 @@ | ||
(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):global.DevOps=factory()})(this,function(){"use strict";var XDM={};(function(XDM){var smallestRandom=parseInt("10000000000",36);var maxSafeInteger=Number.MAX_SAFE_INTEGER||9007199254740991;function newFingerprint(){return Math.floor(Math.random()*(maxSafeInteger-smallestRandom)+smallestRandom).toString(36)+Math.floor(Math.random()*(maxSafeInteger-smallestRandom)+smallestRandom).toString(36)}var XDMObjectRegistry=function(){function XDMObjectRegistry(){this._registeredObjects={}}XDMObjectRegistry.prototype.register=function(instanceId,instance){this._registeredObjects[instanceId]=instance};XDMObjectRegistry.prototype.unregister=function(instanceId){delete this._registeredObjects[instanceId]};XDMObjectRegistry.prototype.getInstance=function(instanceId,contextData){var instance=this._registeredObjects[instanceId];if(!instance){return null}if(typeof instance==="function"){return instance(contextData)}else{return instance}};return XDMObjectRegistry}();XDM.XDMObjectRegistry=XDMObjectRegistry;XDM.globalObjectRegistry=new XDMObjectRegistry;var MAX_XDM_DEPTH=100;var nextChannelId=1;var XDMChannel=function(){function XDMChannel(postToWindow,targetOrigin){this.promises={};this.nextMessageId=1;this.nextProxyId=1;this.proxyFunctions={};this.postToWindow=postToWindow;this.targetOrigin=targetOrigin;this.registry=new XDMObjectRegistry;this.channelId=nextChannelId++;if(!this.targetOrigin){this.handshakeToken=newFingerprint()}}XDMChannel.prototype.getObjectRegistry=function(){return this.registry};XDMChannel.prototype.invokeRemoteMethod=function(methodName,instanceId,params,instanceContextData,serializationSettings){var _this=this;var message={id:this.nextMessageId++,methodName:methodName,instanceId:instanceId,instanceContext:instanceContextData,params:this._customSerializeObject(params,serializationSettings),serializationSettings:serializationSettings};if(!this.targetOrigin){message.handshakeToken=this.handshakeToken}var promise=new Promise(function(resolve,reject){_this.promises[message.id]={resolve:resolve,reject:reject}});this._sendRpcMessage(message);return promise};XDMChannel.prototype.getRemoteObjectProxy=function(instanceId,contextData){return this.invokeRemoteMethod("",instanceId,undefined,contextData)};XDMChannel.prototype.invokeMethod=function(registeredInstance,rpcMessage){var _this=this;if(!rpcMessage.methodName){this._success(rpcMessage,registeredInstance,rpcMessage.handshakeToken);return}var method=registeredInstance[rpcMessage.methodName];if(typeof method!=="function"){this.error(rpcMessage,new Error("RPC method not found: "+rpcMessage.methodName));return}try{var methodArgs=[];if(rpcMessage.params){methodArgs=this._customDeserializeObject(rpcMessage.params,{})}var result=method.apply(registeredInstance,methodArgs);if(result&&result.then&&typeof result.then==="function"){result.then(function(asyncResult){_this._success(rpcMessage,asyncResult,rpcMessage.handshakeToken)},function(e){_this.error(rpcMessage,e)})}else{this._success(rpcMessage,result,rpcMessage.handshakeToken)}}catch(exception){this.error(rpcMessage,exception)}};XDMChannel.prototype.getRegisteredObject=function(instanceId,instanceContext){if(instanceId==="__proxyFunctions"){return this.proxyFunctions}var registeredObject=this.registry.getInstance(instanceId,instanceContext);if(!registeredObject){registeredObject=exports.globalObjectRegistry.getInstance(instanceId,instanceContext)}return registeredObject};XDMChannel.prototype.onMessage=function(rpcMessage){var _this=this;if(rpcMessage.instanceId){var registeredObject=this.getRegisteredObject(rpcMessage.instanceId,rpcMessage.instanceContext);if(!registeredObject){return false}if(typeof registeredObject["then"]==="function"){registeredObject.then(function(resolvedInstance){_this.invokeMethod(resolvedInstance,rpcMessage)},function(e){_this.error(rpcMessage,e)})}else{this.invokeMethod(registeredObject,rpcMessage)}}else{var promise=this.promises[rpcMessage.id];if(!promise){return false}if(rpcMessage.error){promise.reject(this._customDeserializeObject([rpcMessage.error],{})[0])}else{promise.resolve(this._customDeserializeObject([rpcMessage.result],{})[0])}delete this.promises[rpcMessage.id]}return true};XDMChannel.prototype.owns=function(source,origin,rpcMessage){if(this.postToWindow===source){if(this.targetOrigin){if(origin){return origin.toLowerCase()==="null"||this.targetOrigin.toLowerCase().indexOf(origin.toLowerCase())===0}else{return false}}else{if(rpcMessage.handshakeToken&&rpcMessage.handshakeToken===this.handshakeToken){this.targetOrigin=origin;return true}}}return false};XDMChannel.prototype.error=function(messageObj,errorObj){this._sendRpcMessage({id:messageObj.id,error:this._customSerializeObject([errorObj],messageObj.serializationSettings)[0],handshakeToken:messageObj.handshakeToken})};XDMChannel.prototype._success=function(messageObj,result,handshakeToken){this._sendRpcMessage({id:messageObj.id,result:this._customSerializeObject([result],messageObj.serializationSettings)[0],handshakeToken:handshakeToken})};XDMChannel.prototype._sendRpcMessage=function(message){this.postToWindow.postMessage(JSON.stringify(message),"*")};XDMChannel.prototype._customSerializeObject=function(obj,settings,prevParentObjects,nextCircularRefId,depth){var _this=this;if(nextCircularRefId===void 0){nextCircularRefId=1}if(depth===void 0){depth=1}if(!obj||depth>MAX_XDM_DEPTH){return undefined}if(obj instanceof Node||obj instanceof Window||obj instanceof Event){return undefined}var returnValue;var parentObjects;if(!prevParentObjects){parentObjects={newObjects:[],originalObjects:[]}}else{parentObjects=prevParentObjects}parentObjects.originalObjects.push(obj);var serializeMember=function(parentObject,newObject,key){var item;try{item=parentObject[key]}catch(ex){}var itemType=typeof item;if(itemType==="undefined"){return}var parentItemIndex=-1;if(itemType==="object"){parentItemIndex=parentObjects.originalObjects.indexOf(item)}if(parentItemIndex>=0){var parentItem=parentObjects.newObjects[parentItemIndex];if(!parentItem.__circularReferenceId){parentItem.__circularReferenceId=nextCircularRefId++}newObject[key]={__circularReference:parentItem.__circularReferenceId}}else{if(itemType==="function"){var proxyFunctionId=_this.nextProxyId++;newObject[key]={__proxyFunctionId:_this._registerProxyFunction(item,obj),_channelId:_this.channelId}}else if(itemType==="object"){if(item&&item instanceof Date){newObject[key]={__proxyDate:item.getTime()}}else{newObject[key]=_this._customSerializeObject(item,settings,parentObjects,nextCircularRefId,depth+1)}}else if(key!=="__proxyFunctionId"){newObject[key]=item}}};if(obj instanceof Array){returnValue=[];parentObjects.newObjects.push(returnValue);for(var i=0,l=obj.length;i<l;i++){serializeMember(obj,returnValue,i)}}else{returnValue={};parentObjects.newObjects.push(returnValue);var keys={};try{for(var key in obj){keys[key]=true}var ownProperties=Object.getOwnPropertyNames(obj);for(var i=0,l=ownProperties.length;i<l;i++){keys[ownProperties[i]]=true}}catch(ex){}for(var key in keys){if(key&&key[0]!=="_"||settings&&settings.includeUnderscoreProperties){serializeMember(obj,returnValue,key)}}}parentObjects.originalObjects.pop();parentObjects.newObjects.pop();return returnValue};XDMChannel.prototype._registerProxyFunction=function(func,context){var proxyFunctionId=this.nextProxyId++;this.proxyFunctions["proxy"+proxyFunctionId]=function(){return func.apply(context,Array.prototype.slice.call(arguments,0))};return proxyFunctionId};XDMChannel.prototype._customDeserializeObject=function(obj,circularRefs){var _this=this;var that=this;if(!obj){return null}var deserializeMember=function(parentObject,key){var item=parentObject[key];var itemType=typeof item;if(key==="__circularReferenceId"&&itemType==="number"){circularRefs[item]=parentObject;delete parentObject[key]}else if(itemType==="object"&&item){if(item.__proxyFunctionId){parentObject[key]=function(){return that.invokeRemoteMethod("proxy"+item.__proxyFunctionId,"__proxyFunctions",Array.prototype.slice.call(arguments,0),{},{includeUnderscoreProperties:true})}}else if(item.__proxyDate){parentObject[key]=new Date(item.__proxyDate)}else if(item.__circularReference){parentObject[key]=circularRefs[item.__circularReference]}else{_this._customDeserializeObject(item,circularRefs)}}};if(obj instanceof Array){for(var i=0,l=obj.length;i<l;i++){deserializeMember(obj,i)}}else if(typeof obj==="object"){for(var key in obj){deserializeMember(obj,key)}}return obj};return XDMChannel}();XDM.parentChannel=new XDMChannel(window.parent);window.addEventListener("message",function(event){var rpcMessage;if(typeof event.data==="string"){try{rpcMessage=JSON.parse(event.data)}catch(error){}}if(rpcMessage){var channel=XDM.parentChannel;if(channel.owns(event.source,event.origin,rpcMessage)){var handled=channel.onMessage(rpcMessage)||handled;if(!handled){if(window.console){console.error("No handler found for message: "+JSON.stringify(rpcMessage))}if(rpcMessage.instanceId){channel.error(rpcMessage,new Error("The registered object "+rpcMessage.instanceId+" could not be found."))}}}}})})(XDM);var DevOps={};(function(DevOps){DevOps.sdkVersion=3;var hostControlId="DevOps.HostControl";var serviceManagerId="DevOps.ServiceManager";var extensionContext;var initialConfiguration;var initialContributionId;var userContext;var hostContext;var isReady=false;var readyCallbacks=[];var themeElement;var parentChannel=XDM.parentChannel;DevOps.init=function(options){window.setTimeout(function(){var initOptions={};if(options){for(var key in options){initOptions[key]=options[key]}}initOptions.sdkVersion=DevOps.sdkVersion;parentChannel.invokeRemoteMethod("initialHandshake",hostControlId,[initOptions]).then(function(handshakeData){initialConfiguration=handshakeData.initialConfig||{};initialContributionId=handshakeData.contributionId;var context=handshakeData.context;if(context){extensionContext=context.extension;userContext=context.user;hostContext=context.host}if(handshakeData.themeData){DevOps.applyTheme(handshakeData.themeData)}triggerReady()})},0)};DevOps.ready=function(callback){if(isReady){window.setTimeout(callback,0)}else{readyCallbacks.push(callback)}};DevOps.notifyLoadSucceeded=function(){return parentChannel.invokeRemoteMethod("notifyLoadSucceeded",hostControlId)};DevOps.notifyLoadFailed=function(e){return parentChannel.invokeRemoteMethod("notifyLoadFailed",hostControlId,[e])};DevOps.getConfiguration=function(){return initialConfiguration};DevOps.getContributionId=function(){return initialContributionId};DevOps.getUser=function(){return userContext};DevOps.getHost=function(){return hostContext};DevOps.getExtensionContext=function(){return extensionContext};DevOps.getService=function(contributionId){return new Promise(function(resolve,reject){DevOps.ready(function(){parentChannel.invokeRemoteMethod("getService",serviceManagerId,[contributionId]).then(resolve,reject)})})};DevOps.register=function(instanceId,instance){parentChannel.getObjectRegistry().register(instanceId,instance)};DevOps.unregister=function(instanceId){parentChannel.getObjectRegistry().unregister(instanceId)};DevOps.getAccessToken=function(){return parentChannel.invokeRemoteMethod("getAccessToken",hostControlId).then(function(tokenObj){return tokenObj.token})};DevOps.getAppToken=function(){return parentChannel.invokeRemoteMethod("getAppToken",hostControlId).then(function(tokenObj){return tokenObj.token})};DevOps.resize=function(width,height){var body=document.body;if(body){var newWidth=typeof width==="number"?width:body?body.scrollWidth:undefined;var newHeight=typeof height==="number"?height:body?body.scrollHeight:undefined}parentChannel.invokeRemoteMethod("resize",hostControlId,[newWidth,newHeight])};DevOps.applyTheme=function(themeData){if(!themeElement){themeElement=document.createElement("style");themeElement.type="text/css";document.head.appendChild(themeElement)}var cssVariables=[];if(themeData){for(var varName in themeData){cssVariables.push("--"+varName+": "+themeData[varName])}}themeElement.innerText=":root { "+cssVariables.join("; ")+" } body { color: var(--text-primary-color) }"};function triggerReady(){isReady=true;if(readyCallbacks){var savedReadyCallbacks=readyCallbacks;readyCallbacks=[];savedReadyCallbacks.forEach(function(callback){callback()})}}})(DevOps);return DevOps}); | ||
(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):global.DevOps=factory()})(this,function(){"use strict";var XDM={};(function(XDM){var smallestRandom=parseInt("10000000000",36);var maxSafeInteger=Number.MAX_SAFE_INTEGER||9007199254740991;function newFingerprint(){return Math.floor(Math.random()*(maxSafeInteger-smallestRandom)+smallestRandom).toString(36)+Math.floor(Math.random()*(maxSafeInteger-smallestRandom)+smallestRandom).toString(36)}var XDMObjectRegistry=function(){function XDMObjectRegistry(){this._registeredObjects={}}XDMObjectRegistry.prototype.register=function(instanceId,instance){this._registeredObjects[instanceId]=instance};XDMObjectRegistry.prototype.unregister=function(instanceId){delete this._registeredObjects[instanceId]};XDMObjectRegistry.prototype.getInstance=function(instanceId,contextData){var instance=this._registeredObjects[instanceId];if(!instance){return null}if(typeof instance==="function"){return instance(contextData)}else{return instance}};return XDMObjectRegistry}();XDM.XDMObjectRegistry=XDMObjectRegistry;XDM.globalObjectRegistry=new XDMObjectRegistry;var MAX_XDM_DEPTH=100;var nextChannelId=1;var XDMChannel=function(){function XDMChannel(postToWindow,targetOrigin){this.promises={};this.nextMessageId=1;this.nextProxyId=1;this.proxyFunctions={};this.postToWindow=postToWindow;this.targetOrigin=targetOrigin;this.registry=new XDMObjectRegistry;this.channelId=nextChannelId++;if(!this.targetOrigin){this.handshakeToken=newFingerprint()}}XDMChannel.prototype.getObjectRegistry=function(){return this.registry};XDMChannel.prototype.invokeRemoteMethod=function(methodName,instanceId,params,instanceContextData,serializationSettings){var _this=this;var message={id:this.nextMessageId++,methodName:methodName,instanceId:instanceId,instanceContext:instanceContextData,params:this._customSerializeObject(params,serializationSettings),serializationSettings:serializationSettings};if(!this.targetOrigin){message.handshakeToken=this.handshakeToken}var promise=new Promise(function(resolve,reject){_this.promises[message.id]={resolve:resolve,reject:reject}});this._sendRpcMessage(message);return promise};XDMChannel.prototype.getRemoteObjectProxy=function(instanceId,contextData){return this.invokeRemoteMethod("",instanceId,undefined,contextData)};XDMChannel.prototype.invokeMethod=function(registeredInstance,rpcMessage){var _this=this;if(!rpcMessage.methodName){this._success(rpcMessage,registeredInstance,rpcMessage.handshakeToken);return}var method=registeredInstance[rpcMessage.methodName];if(typeof method!=="function"){this.error(rpcMessage,new Error("RPC method not found: "+rpcMessage.methodName));return}try{var methodArgs=[];if(rpcMessage.params){methodArgs=this._customDeserializeObject(rpcMessage.params,{})}var result=method.apply(registeredInstance,methodArgs);if(result&&result.then&&typeof result.then==="function"){result.then(function(asyncResult){_this._success(rpcMessage,asyncResult,rpcMessage.handshakeToken)},function(e){_this.error(rpcMessage,e)})}else{this._success(rpcMessage,result,rpcMessage.handshakeToken)}}catch(exception){this.error(rpcMessage,exception)}};XDMChannel.prototype.getRegisteredObject=function(instanceId,instanceContext){if(instanceId==="__proxyFunctions"){return this.proxyFunctions}var registeredObject=this.registry.getInstance(instanceId,instanceContext);if(!registeredObject){registeredObject=exports.globalObjectRegistry.getInstance(instanceId,instanceContext)}return registeredObject};XDMChannel.prototype.onMessage=function(rpcMessage){var _this=this;if(rpcMessage.instanceId){var registeredObject=this.getRegisteredObject(rpcMessage.instanceId,rpcMessage.instanceContext);if(!registeredObject){return false}if(typeof registeredObject["then"]==="function"){registeredObject.then(function(resolvedInstance){_this.invokeMethod(resolvedInstance,rpcMessage)},function(e){_this.error(rpcMessage,e)})}else{this.invokeMethod(registeredObject,rpcMessage)}}else{var promise=this.promises[rpcMessage.id];if(!promise){return false}if(rpcMessage.error){promise.reject(this._customDeserializeObject([rpcMessage.error],{})[0])}else{promise.resolve(this._customDeserializeObject([rpcMessage.result],{})[0])}delete this.promises[rpcMessage.id]}return true};XDMChannel.prototype.owns=function(source,origin,rpcMessage){if(this.postToWindow===source){if(this.targetOrigin){if(origin){return origin.toLowerCase()==="null"||this.targetOrigin.toLowerCase().indexOf(origin.toLowerCase())===0}else{return false}}else{if(rpcMessage.handshakeToken&&rpcMessage.handshakeToken===this.handshakeToken){this.targetOrigin=origin;return true}}}return false};XDMChannel.prototype.error=function(messageObj,errorObj){this._sendRpcMessage({id:messageObj.id,error:this._customSerializeObject([errorObj],messageObj.serializationSettings)[0],handshakeToken:messageObj.handshakeToken})};XDMChannel.prototype._success=function(messageObj,result,handshakeToken){this._sendRpcMessage({id:messageObj.id,result:this._customSerializeObject([result],messageObj.serializationSettings)[0],handshakeToken:handshakeToken})};XDMChannel.prototype._sendRpcMessage=function(message){this.postToWindow.postMessage(JSON.stringify(message),"*")};XDMChannel.prototype._customSerializeObject=function(obj,settings,prevParentObjects,nextCircularRefId,depth){var _this=this;if(nextCircularRefId===void 0){nextCircularRefId=1}if(depth===void 0){depth=1}if(!obj||depth>MAX_XDM_DEPTH){return undefined}if(obj instanceof Node||obj instanceof Window||obj instanceof Event){return undefined}var returnValue;var parentObjects;if(!prevParentObjects){parentObjects={newObjects:[],originalObjects:[]}}else{parentObjects=prevParentObjects}parentObjects.originalObjects.push(obj);var serializeMember=function(parentObject,newObject,key){var item;try{item=parentObject[key]}catch(ex){}var itemType=typeof item;if(itemType==="undefined"){return}var parentItemIndex=-1;if(itemType==="object"){parentItemIndex=parentObjects.originalObjects.indexOf(item)}if(parentItemIndex>=0){var parentItem=parentObjects.newObjects[parentItemIndex];if(!parentItem.__circularReferenceId){parentItem.__circularReferenceId=nextCircularRefId++}newObject[key]={__circularReference:parentItem.__circularReferenceId}}else{if(itemType==="function"){var proxyFunctionId=_this.nextProxyId++;newObject[key]={__proxyFunctionId:_this._registerProxyFunction(item,obj),_channelId:_this.channelId}}else if(itemType==="object"){if(item&&item instanceof Date){newObject[key]={__proxyDate:item.getTime()}}else{newObject[key]=_this._customSerializeObject(item,settings,parentObjects,nextCircularRefId,depth+1)}}else if(key!=="__proxyFunctionId"){newObject[key]=item}}};if(obj instanceof Array){returnValue=[];parentObjects.newObjects.push(returnValue);for(var i=0,l=obj.length;i<l;i++){serializeMember(obj,returnValue,i)}}else{returnValue={};parentObjects.newObjects.push(returnValue);var keys={};try{for(var key in obj){keys[key]=true}var ownProperties=Object.getOwnPropertyNames(obj);for(var i=0,l=ownProperties.length;i<l;i++){keys[ownProperties[i]]=true}}catch(ex){}for(var key in keys){if(key&&key[0]!=="_"||settings&&settings.includeUnderscoreProperties){serializeMember(obj,returnValue,key)}}}parentObjects.originalObjects.pop();parentObjects.newObjects.pop();return returnValue};XDMChannel.prototype._registerProxyFunction=function(func,context){var proxyFunctionId=this.nextProxyId++;this.proxyFunctions["proxy"+proxyFunctionId]=function(){return func.apply(context,Array.prototype.slice.call(arguments,0))};return proxyFunctionId};XDMChannel.prototype._customDeserializeObject=function(obj,circularRefs){var _this=this;var that=this;if(!obj){return null}var deserializeMember=function(parentObject,key){var item=parentObject[key];var itemType=typeof item;if(key==="__circularReferenceId"&&itemType==="number"){circularRefs[item]=parentObject;delete parentObject[key]}else if(itemType==="object"&&item){if(item.__proxyFunctionId){parentObject[key]=function(){return that.invokeRemoteMethod("proxy"+item.__proxyFunctionId,"__proxyFunctions",Array.prototype.slice.call(arguments,0),{},{includeUnderscoreProperties:true})}}else if(item.__proxyDate){parentObject[key]=new Date(item.__proxyDate)}else if(item.__circularReference){parentObject[key]=circularRefs[item.__circularReference]}else{_this._customDeserializeObject(item,circularRefs)}}};if(obj instanceof Array){for(var i=0,l=obj.length;i<l;i++){deserializeMember(obj,i)}}else if(typeof obj==="object"){for(var key in obj){deserializeMember(obj,key)}}return obj};return XDMChannel}();XDM.parentChannel=new XDMChannel(window.parent);window.addEventListener("message",function(event){var rpcMessage;if(typeof event.data==="string"){try{rpcMessage=JSON.parse(event.data)}catch(error){}}if(rpcMessage){var channel=XDM.parentChannel;if(channel.owns(event.source,event.origin,rpcMessage)){var handled=channel.onMessage(rpcMessage)||handled;if(!handled){if(window.console){console.error("No handler found for message: "+JSON.stringify(rpcMessage))}if(rpcMessage.instanceId){channel.error(rpcMessage,new Error("The registered object "+rpcMessage.instanceId+" could not be found."))}}}}})})(XDM);var DevOps={};(function(DevOps){DevOps.sdkVersion=3;var hostControlId="DevOps.HostControl";var serviceManagerId="DevOps.ServiceManager";var extensionContext;var initialConfiguration;var initialContributionId;var userContext;var hostContext;var isReady=false;var readyCallbacks=[];var themeElement;var parentChannel=XDM.parentChannel;function dispatchEvent(eventName,params){var evt;if(typeof window.CustomEvent==="function"){evt=new window.CustomEvent(eventName,params)}else{params=params||{bubbles:false,cancelable:false};evt=document.createEvent("CustomEvent");evt.initCustomEvent(eventName,params.bubbles,params.cancelable,params.detail)}window.dispatchEvent(evt)}parentChannel.getObjectRegistry().register("DevOps.SdkClient",{dispatchEvent:dispatchEvent});DevOps.init=function(options){window.setTimeout(function(){var initOptions={};if(options){for(var key in options){initOptions[key]=options[key]}}initOptions.sdkVersion=DevOps.sdkVersion;parentChannel.invokeRemoteMethod("initialHandshake",hostControlId,[initOptions]).then(function(handshakeData){initialConfiguration=handshakeData.initialConfig||{};initialContributionId=handshakeData.contributionId;var context=handshakeData.context;if(context){extensionContext=context.extension;userContext=context.user;hostContext=context.host}if(handshakeData.themeData){DevOps.applyTheme(handshakeData.themeData)}triggerReady()})},0)};DevOps.ready=function(callback){if(isReady){window.setTimeout(callback,0)}else{readyCallbacks.push(callback)}};DevOps.notifyLoadSucceeded=function(){return parentChannel.invokeRemoteMethod("notifyLoadSucceeded",hostControlId)};DevOps.notifyLoadFailed=function(e){return parentChannel.invokeRemoteMethod("notifyLoadFailed",hostControlId,[e])};DevOps.getConfiguration=function(){return initialConfiguration};DevOps.getContributionId=function(){return initialContributionId};DevOps.getUser=function(){return userContext};DevOps.getHost=function(){return hostContext};DevOps.getExtensionContext=function(){return extensionContext};DevOps.getService=function(contributionId){return new Promise(function(resolve,reject){DevOps.ready(function(){parentChannel.invokeRemoteMethod("getService",serviceManagerId,[contributionId]).then(resolve,reject)})})};DevOps.register=function(instanceId,instance){parentChannel.getObjectRegistry().register(instanceId,instance)};DevOps.unregister=function(instanceId){parentChannel.getObjectRegistry().unregister(instanceId)};DevOps.getAccessToken=function(){return parentChannel.invokeRemoteMethod("getAccessToken",hostControlId).then(function(tokenObj){return tokenObj.token})};DevOps.getAppToken=function(){return parentChannel.invokeRemoteMethod("getAppToken",hostControlId).then(function(tokenObj){return tokenObj.token})};DevOps.resize=function(width,height){var body=document.body;if(body){var newWidth=typeof width==="number"?width:body?body.scrollWidth:undefined;var newHeight=typeof height==="number"?height:body?body.scrollHeight:undefined}parentChannel.invokeRemoteMethod("resize",hostControlId,[newWidth,newHeight])};DevOps.applyTheme=function(themeData){if(!themeElement){themeElement=document.createElement("style");themeElement.type="text/css";document.head.appendChild(themeElement)}var cssVariables=[];if(themeData){for(var varName in themeData){cssVariables.push("--"+varName+": "+themeData[varName])}}themeElement.innerText=":root { "+cssVariables.join("; ")+" } body { color: var(--text-primary-color) }";dispatchEvent("themeApplied",{detail:themeData})};function triggerReady(){isReady=true;if(readyCallbacks){var savedReadyCallbacks=readyCallbacks;readyCallbacks=[];savedReadyCallbacks.forEach(function(callback){callback()})}}})(DevOps);return DevOps}); |
{ | ||
"name": "azure-devops-extension-sdk", | ||
"version": "1.141.4", | ||
"version": "1.141.5", | ||
"description": "Azure DevOps web extension JavaScript library and types.", | ||
@@ -5,0 +5,0 @@ "repository": { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
72707
1251
0