npm package diff

Package: @forge/runtime-bootstrap

Versions: 1.11.0 - 1.11.1-next.0

File: package/out/bootstrap.js

Index: package/out/bootstrap.js
===================================================================
--- package/out/bootstrap.js
+++ package/out/bootstrap.js
@@ -1,1 +1,1 @@
-(()=>{"use strict";var e={};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();class r{constructor(e){this.serializer=e}serialize(e,r){return this.serializer(e,r)}}const t={release:!0,transfer:!1};class s{constructor(e,r){this.dispatch=e,this.ivm=r}externalCopy(e){return new this.ivm.ExternalCopy(e)}call(e,...r){return this.apply(this.dispatch,e,r)}callIgnored(e,...r){return this.applyIgnored(this.dispatch,e,r)}callSync(e,...r){return this.applySync(this.dispatch,e,r)}apply(e,r,t){return e.apply(void 0,[r,...t.map((e=>this.wrap(e)))])}applySync(e,r,t){return e.applySync(void 0,[r,...t.map((e=>this.wrap(e)))])}applyIgnored(e,...r){return e.applyIgnored(void 0,r.map((e=>this.wrap(e))))}wrap(e,t={}){if(!e)return e;if(e instanceof Error){const r={name:e.name||"",message:e.message||"",stack:e.stack||""};return this.wrapValue(r,{release:!!t.release,transfer:!1})}let s;e instanceof r&&(e=e.serialize((e=>this.externalCopy(e)),((e,r)=>this.wrapFunction(e,r))));try{s=e.constructor}catch(e){s=void 0}switch(s){case this.ivm.ExternalCopy:case this.ivm.Reference:case String:case Number:case Boolean:return e;case ArrayBuffer:case Uint8Array:case Int8Array:case Uint8ClampedArray:case Int16Array:case Uint16Array:case Int32Array:case Uint32Array:case Float32Array:case Float64Array:return this.wrapValue(e,t);case DataView:case Map:case Set:case RegExp:case Date:case Object:return this.wrapValue(e,{release:!!t.release,transfer:!1});case Array:return this.wrapArray(e,{release:!!t.release,transfer:!1});case Function:return this.wrapFunction(e);default:throw new Error(`Can't wrap a non-transferable value (constructor: '${s&&s.name||"unknown"}')`)}}wrapFunction(e,r={release:!0}){if(!Object.assign({},t,r||{}).release)return new this.ivm.Reference(e);const s=new this.ivm.Reference((function(...r){try{s.release()}catch(e){}finally{e(...r)}}));return s}wrapValue(e,r={release:!0}){const s=Object.assign({},t,r||{});return s.transfer?new this.ivm.ExternalCopy(e,{transferOut:!0}).copyInto({release:!!s.release,transferIn:!0}):new this.ivm.ExternalCopy(e).copyInto({release:!!s.release})}wrapArray(e,r={release:!0}){return this.wrapValue(e.map((e=>this.wrap(e))),r)}}const i=["api.log.info","api.log.debug","api.log.warn","api.log.error","api.log.fatal","logConsole"];class a extends Error{constructor(e){super(`You cannot call ${a.MAPPED_METHODS_NAMES[e]} methods in the snapshot context`)}}a.MAPPED_METHODS_NAMES={setTimeout:"timer",clearTimeout:"timer",setInterval:"timer",clearInterval:"timer",logConsole:"logging",getUserVars:"process.env","crypto.randomFillSync":"crypto","api.getAuthTokenReferences":"api","api.getAppAri":"api","api.fetch":"api","api.requestConfluence":"api","api.asApp.requestConfluence":"api","api.asUser.requestConfluence":"api","api.asUser.withProvider.fetch":"api","api.asUser.withProvider.requestCredentials":"api","api.asUser.withProvider.hasCredentials":"api","api.asUser.withProvider.listCredentials":"api","api.asUser.withProvider.getAccount":"api","api.asUser.withProvider.listAccounts":"api","api.requestRmsStore":"api","api.requestAiGateway":"api","api.requestJira":"api","api.asApp.requestJira":"api","api.asUser.requestJira":"api","api.asApp.requestAtlassian":"api","api.asUser.requestAtlassian":"api","api.asApp.requestBitbucket":"api","api.asUser.requestBitbucket":"api","api.requestBitbucket":"api","api.webTrigger.getUrl":"api","api.webTrigger.deleteUrl":"api","api.webTrigger.getUrlIds":"api","api.internalMetrics.invokeCounter":"api","api.internalMetrics.invokeGauge":"api","api.internalMetrics.invokeTimer":"api"};class n{define(e,r,t){this.bridge=e,this.defineGlobals(r,t)}defineGlobals(e,r){if(this.bridge instanceof s)return this.definePostBootstrap(e,r);this.definePreBootstrap(e,r)}}class o extends n{normalizeLogLevel(e){switch(e){case"warn":return"warning";case"log":return"info";default:return e}}definePreBootstrap(e){e.getSnapshotLogs=r=>{delete e.getSnapshotLogs;const t=e=>new r.ExternalCopy(e),s=this.bridge.getDeferedInvocations().map((({args:e})=>({level:this.normalizeLogLevel(e[0]),args:e[1].serialize(t)})));return new r.ExternalCopy(s,{release:!0,transferOut:!0}).copyInto()}}definePostBootstrap(e){}}function c(e,r,...t){return new Promise(((s,i)=>{e.callIgnored(r,...t,(e=>{const r={text:async()=>e.data,json:async()=>JSON.parse(e.data),arrayBuffer:async()=>e.arrayBufferData,headers:e.headers,ok:e.ok,status:e.status,statusText:e.statusText};s(r)}),(e=>{e.error&&i(e.error),i(e)}))}))}function l(e,r,...t){return new Promise(((s,i)=>{e.callIgnored(r,...t,s,i)}))}var p;!function(e){e[e.jira=0]="jira",e[e.confluence=1]="confluence"}(p||(p={}));class u extends n{constructor(){super(...arguments),this.requestJira=(e,r)=>c(this.bridge,"api.requestJira",e,r),this.requestRmsStore=(e,r)=>c(this.bridge,"api.requestRmsStore",e,r),this.ai=e=>({request:(r,t)=>c(this.bridge,"api.requestAiGateway",e,t)}),this.requestConfluence=(e,r)=>c(this.bridge,"api.requestConfluence",e,r),this.requestBitbucket=(e,r)=>c(this.bridge,"api.requestBitbucket",e,r),this.fetch=(e,r)=>c(this.bridge,"api.fetch",e,r),this.asUser=()=>{const e={requestJira:(e,r)=>c(this.bridge,"api.asUser.requestJira",e,r),requestConfluence:(e,r)=>c(this.bridge,"api.asUser.requestConfluence",e,r),requestGraph:(e,r)=>c(this.bridge,"api.asUser.requestAtlassian",e,r),requestBitbucket:(e,r)=>c(this.bridge,"api.asUser.requestBitbucket",e,r),requestConnectedData:(e,r)=>c(this.bridge,"api.asUser.requestAtlassian",e,r),withProvider:(e,r,t)=>({hasCredentials:r=>l(this.bridge,"api.asUser.withProvider.hasCredentials",e,r,void 0),requestCredentials:r=>l(this.bridge,"api.asUser.withProvider.requestCredentials",e,r,void 0),listCredentials:()=>l(this.bridge,"api.asUser.withProvider.listCredentials",e),listAccounts:()=>l(this.bridge,"api.asUser.withProvider.listAccounts",e),getAccount:()=>l(this.bridge,"api.asUser.withProvider.getAccount",e,void 0),fetch:(s,i)=>c(this.bridge,"api.asUser.withProvider.fetch",r,e,t,s,i,void 0),asAccount:s=>({hasCredentials:r=>l(this.bridge,"api.asUser.withProvider.hasCredentials",e,r,s),requestCredentials:r=>l(this.bridge,"api.asUser.withProvider.requestCredentials",e,r,s),getAccount:()=>l(this.bridge,"api.asUser.withProvider.getAccount",e,s),fetch:(i,a)=>c(this.bridge,"api.asUser.withProvider.fetch",r,e,t,i,a,s)})})};return Object.defineProperty(e,"__requestAtlassian",{configurable:!1,enumerable:!1,writable:!1,value:(e,r)=>c(this.bridge,"api.asUser.requestAtlassian",e,r)}),e},this.asApp=()=>{const e={requestJira:(e,r)=>c(this.bridge,"api.asApp.requestJira",e,r),requestConfluence:(e,r)=>c(this.bridge,"api.asApp.requestConfluence",e,r),requestGraph:(e,r)=>c(this.bridge,"api.asApp.requestAtlassian",e,r),requestBitbucket:(e,r)=>c(this.bridge,"api.asApp.requestBitbucket",e,r),requestConnectedData:(e,r)=>c(this.bridge,"api.asApp.requestAtlassian",e,r)};return Object.defineProperty(e,"__requestAtlassian",{configurable:!1,enumerable:!1,writable:!1,value:(e,r)=>c(this.bridge,"api.asApp.requestAtlassian",e,r)}),e},this.getAuthTokenReferences=e=>this.bridge.callSync("api.getAuthTokenReferences",e)}definePreBootstrap(e){e.api={ai:this.ai,asUser:this.asUser,asApp:this.asApp,fetch:this.fetch,requestJira:this.requestJira,requestConfluence:this.requestConfluence,requestBitbucket:this.requestBitbucket,requestRmsStore:this.requestRmsStore}}definePostBootstrap(e,r){r&&r.FFisMultiAuthEnabled&&(e.api.getAuthTokenReferences=this.getAuthTokenReferences)}}class d extends n{definePreBootstrap(e){Object.defineProperty(e,"__bridge",{configurable:!1,enumerable:!1,writable:!1,value:this.bridge})}definePostBootstrap(e){}}class g extends n{constructor(){super(...arguments),this.logConsole=e=>(...t)=>{this.bridge.call("logConsole",e,new r((e=>t.map((r=>((e,r)=>{const t=[],s=(r,t)=>e({value:r,prefix:t});return function e(r){const i=(r,i,a)=>{t.push(a);const n=e(Object.assign({},a));t.pop();const o=[r,i].filter((e=>""!==e)).join(" ");return s(n,o)};if("function"==typeof r)return s(`[Function${r.name?": "+r.name:""}]`,void 0);if("symbol"==typeof r)return s(r.toString(),void 0);if(r instanceof Error)return s(`${r.name}: ${r.message}`,void 0);if((a=r)&&"object"==typeof a){const a=(e=>{const r=Object.getOwnPropertyDescriptor(e,Symbol.toStringTag);return r&&!1===r.enumerable?`[${r.value}]`:""})(r);if(t.indexOf(r)>-1)return s("[Circular]",void 0);if(Array.isArray(r))r=r.map(e);else{if((e=>e.constructor===Promise)(r))return s("[Promise]",void 0);if((e=>null===Object.getPrototypeOf(e))(r))return i("[Object: null prototype]",a,r);if((e=>e.constructor===Object)(r)){if(a)return i("Object",a,r);t.push(r);const s={};Object.entries(r).forEach((([r,t])=>s[r]=e(t))),Object.getOwnPropertySymbols(r).forEach((t=>s[`[${t.toString()}]`]=e(r[t]))),r=s,t.pop()}else if(!(e=>{switch(e.constructor){case String:case Number:case Boolean:case ArrayBuffer:case Uint8Array:case Int8Array:case Uint8ClampedArray:case Int16Array:case Uint16Array:case Int32Array:case Uint32Array:case Float32Array:case Float64Array:case DataView:case Map:case Set:case RegExp:case Date:case Object:case Array:return!0;default:return!1}})(r))return i(r.constructor?r.constructor.name:"",a,r)}}var a;return r}(r)})(e,r))))))}}definePreBootstrap(e){e.console={debug:this.logConsole("debug"),error:this.logConsole("error"),warn:this.logConsole("warn"),info:this.logConsole("info"),log:this.logConsole("log")}}definePostBootstrap(){}}class h extends n{definePreBootstrap(e){Object.defineProperty(e,"crypto",{configurable:!1,enumerable:!1,writable:!1,value:{getRandomValues:e=>{if(!e||"Buffer"!==e.constructor.name&&!ArrayBuffer.isView(e))throw new Error(`getRandomvalues expected Buffer or Typed Array got '${typeof e}'.`);const r="Buffer"===e.constructor.name?new Uint32Array(e):e,t=this.bridge.callSync("crypto.randomFillSync",r);return e.set(t),e}}})}definePostBootstrap(e){}}class f extends n{definePreBootstrap(e){}definePostBootstrap(e){Object.defineProperty(e,"__invoke",{configurable:!1,enumerable:!1,writable:!1,value:(r,t,s,i,a)=>{const n=e[r]||exports[r];if(!n)throw new Error(`Can't invoke a function "${r}". Maybe it's not exported?`);const o=n.apply(void 0,[t,s]);Promise.resolve(o).then((e=>{this.bridge.applyIgnored(i,e)})).catch((e=>{this.bridge.applyIgnored(a,e)}))}})}}class b extends n{definePreBootstrap(e){const r=e.runtimeStaticConfig;function t(){}delete e.runtimeStaticConfig,e.process=Object.assign(Object.assign({},null==r?void 0:r.process),{nextTick:(r,...t)=>e.setTimeout(r,0,...t),stdin:b.createIOStream(0),stdout:b.createIOStream(1),stderr:b.createIOStream(2)}),Object.defineProperty(t.prototype,Symbol.toStringTag,{get:()=>"process"}),Object.setPrototypeOf(e.process,t.prototype)}definePostBootstrap(e){e.process.env=JSON.parse(this.bridge.callSync("getUserVars"))}}b.createIOStream=e=>({fd:e});class w extends n{constructor(){super(...arguments),this.deferred=!0,this.deferredTimers={Timeout:[],Interval:[]},this.setTimer=e=>{const t=this.deferredTimers[e];return(s,i,...a)=>{if(this.deferred){const r=t.length;return t.push({args:[s,i,...a]}),`deferred-${e}-${r}`}return this.bridge.callSync(`set${e}`,new r(((e,r)=>({callback:r((()=>s(...a))),ms:i}))))}},this.clearTimer=e=>{const r=new RegExp(`^deferred-${e}-(\\d+)$`),t=this.deferredTimers[e];return s=>{if("string"==typeof s){const e=s.match(r);if(e&&(s=t[e[1]].id,delete t[e[1]],void 0===s))return}if(!this.deferred)return this.bridge.callSync(`clear${e}`,(()=>({id:s})))}}}definePreBootstrap(e){e.setTimeout=this.setTimer("Timeout"),e.clearTimeout=this.clearTimer("Timeout"),e.setInterval=this.setTimer("Interval"),e.clearInterval=this.clearTimer("Interval")}definePostBootstrap(){this.deferred=!1,Object.entries(this.deferredTimers).forEach((([e,r])=>{const t=this.setTimer(e);r.forEach((({args:e},s)=>{r[s]={id:t(...e)}}))}))}}class y extends n{constructor(){super(...arguments),this.getAppAri=()=>this.bridge.callSync("api.getAppAri")}definePreBootstrap(e){e.api||(e.api={}),Object.defineProperty(e.api,"__getAppAri",{configurable:!1,enumerable:!1,writable:!1,value:()=>this.getAppAri()})}definePostBootstrap(e){}}class m extends n{constructor(){super(...arguments),this.getWebTriggerUrl=(e,r)=>new Promise(((t,s)=>{this.bridge.callIgnored("api.webTrigger.getUrl",e,r,(e=>{var r,i;try{e.ok||s(new Error(`Internal error occurred: Failed to get web trigger URL: ${e.statusText}.`));const a=JSON.parse(e.data);(null===(i=null===(r=null==a?void 0:a.data)||void 0===r?void 0:r.createWebTriggerUrl)||void 0===i?void 0:i.url)||s(new Error("Internal error occurred: Failed to get web trigger URL.")),t(a.data.createWebTriggerUrl.url)}catch(e){s(e)}}),(e=>{e.error&&s(e.error),s(e)}))})),this.deleteWebTriggerUrl=e=>new Promise(((r,t)=>{const s=e=>{var s,i,a,n;try{e.ok||t(new Error(`Internal error occurred: Failed to delete web trigger URL: ${e.statusText}.`));const o=JSON.parse(e.data);if(!(null===(i=null===(s=null==o?void 0:o.data)||void 0===s?void 0:s.deleteWebTriggerUrl)||void 0===i?void 0:i.success)){const e=(null===(n=null===(a=null==o?void 0:o.data)||void 0===a?void 0:a.deleteWebTriggerUrl)||void 0===n?void 0:n.message)||"unknown error";t(new Error(`Internal error occurred: Failed to delete web trigger URL: ${e}`))}r()}catch(e){t(e)}},i=e=>{e.error&&t(e.error),t(e)};this.getWebTriggerUrlIds(e).then((e=>{e.forEach((e=>this.bridge.callIgnored("api.webTrigger.deleteUrl",e,s,i)))})).catch(t)})),this.getWebTriggerUrlIds=e=>new Promise(((r,t)=>{this.bridge.callIgnored("api.webTrigger.getUrlIds",(s=>{var i;s.ok||t(Error(`Internal error occurred: Failed to get web trigger URLs: ${s.statusText}.`));const a=JSON.parse(s.data);(null===(i=null==a?void 0:a.data)||void 0===i?void 0:i.webTriggerUrlsByAppContext)&&0!=a.data.webTriggerUrlsByAppContext.length||t(Error("Internal error occurred: No web trigger URLs found"));const n=a.data.webTriggerUrlsByAppContext.filter((r=>r.url==e)).map((e=>e.id));n&&0!=n.length||t(Error("Internal error occurred: Web trigger URL matching URL not found")),r(n)}),(e=>{e.error&&t(e.error),t(e)}))}))}definePreBootstrap(e){e.api||(e.api={}),e.api.webTrigger={getUrl:(e,r=!1)=>this.getWebTriggerUrl(e,r),getUrlIds:e=>this.getWebTriggerUrlIds(e),deleteUrl:e=>this.deleteWebTriggerUrl(e)}}definePostBootstrap(e){}}class v extends n{definePreBootstrap(e){}definePostBootstrap(e){Object.defineProperty(e,"self",{configurable:!1,enumerable:!1,writable:!1,value:e})}}class A extends n{definePreBootstrap(e){e.api||(e.api={}),e.api.internalMetrics={invokeCounter:(e,r,t)=>{this.bridge.callSync("api.internalMetrics.invokeCounter",{method:e,counterName:r,value:t})},invokeGauge:(e,r)=>{this.bridge.callSync("api.internalMetrics.invokeGauge",{gaugeName:e,value:r})},invokeTimer:(e,r,t)=>this.bridge.callSync("api.internalMetrics.invokeTimer",{method:e,timerId:r,timerName:t})}}definePostBootstrap(e){}}class U{constructor(e){this.definitions=e,this.setup=(e,r,t)=>{this.definitions.forEach((s=>s.define(e,r,t)))}}static get(){return U.instance||(U.instance=new U([new d,new g,new h,new b,new w,new f,new u,new o,new y,new m,new v,new A])),U.instance}}U.get().setup(new class{constructor(){this.deferedCalls=[]}isDeferableMethod(e){return i.includes(e)}getDeferedInvocations(){const e=[...this.deferedCalls];return this.deferedCalls=[],e}call(e,...r){if(!this.isDeferableMethod(e))throw new a(e);this.deferedCalls.push({method:e,args:r})}callIgnored(e,...r){throw new a(e)}callSync(e,...r){throw new a(e)}},e.g),e.g.bootstrap=(r,t,i)=>{delete e.g.bootstrap,U.get().setup(new s(t,r),e.g,{FFisMultiAuthEnabled:i})}})();
\ No newline at end of file
+(()=>{"use strict";var e={};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();class r{serializer;constructor(e){this.serializer=e}serialize(e,r){return this.serializer(e,r)}}const t={release:!0,transfer:!1};class s{dispatch;ivm;constructor(e,r){this.dispatch=e,this.ivm=r}externalCopy(e){return new this.ivm.ExternalCopy(e)}call(e,...r){return this.apply(this.dispatch,e,r)}callIgnored(e,...r){return this.applyIgnored(this.dispatch,e,r)}callSync(e,...r){return this.applySync(this.dispatch,e,r)}apply(e,r,t){return e.apply(void 0,[r,...t.map((e=>this.wrap(e)))])}applySync(e,r,t){return e.applySync(void 0,[r,...t.map((e=>this.wrap(e)))])}applyIgnored(e,...r){return e.applyIgnored(void 0,r.map((e=>this.wrap(e))))}wrap(e,t={}){if(!e)return e;if(e instanceof Error){const r={name:e.name||"",message:e.message||"",stack:e.stack||""};return this.wrapValue(r,{release:!!t.release,transfer:!1})}let s;e instanceof r&&(e=e.serialize((e=>this.externalCopy(e)),((e,r)=>this.wrapFunction(e,r))));try{s=e.constructor}catch(e){s=void 0}switch(s){case this.ivm.ExternalCopy:case this.ivm.Reference:case String:case Number:case Boolean:return e;case ArrayBuffer:case Uint8Array:case Int8Array:case Uint8ClampedArray:case Int16Array:case Uint16Array:case Int32Array:case Uint32Array:case Float32Array:case Float64Array:return this.wrapValue(e,t);case DataView:case Map:case Set:case RegExp:case Date:case Object:return this.wrapValue(e,{release:!!t.release,transfer:!1});case Array:return this.wrapArray(e,{release:!!t.release,transfer:!1});case Function:return this.wrapFunction(e);default:throw new Error(`Can't wrap a non-transferable value (constructor: '${s&&s.name||"unknown"}')`)}}wrapFunction(e,r={release:!0}){if(!Object.assign({},t,r||{}).release)return new this.ivm.Reference(e);const s=new this.ivm.Reference((function(...r){try{s.release()}catch(e){}finally{e(...r)}}));return s}wrapValue(e,r={release:!0}){const s=Object.assign({},t,r||{});return s.transfer?new this.ivm.ExternalCopy(e,{transferOut:!0}).copyInto({release:!!s.release,transferIn:!0}):new this.ivm.ExternalCopy(e).copyInto({release:!!s.release})}wrapArray(e,r={release:!0}){return this.wrapValue(e.map((e=>this.wrap(e))),r)}}const a=["api.log.info","api.log.debug","api.log.warn","api.log.error","api.log.fatal","logConsole"];class i extends Error{static MAPPED_METHODS_NAMES={setTimeout:"timer",clearTimeout:"timer",setInterval:"timer",clearInterval:"timer",logConsole:"logging",getUserVars:"process.env","crypto.randomFillSync":"crypto","api.getAuthTokenReferences":"api","api.getAppAri":"api","api.fetch":"api","api.requestConfluence":"api","api.asApp.requestConfluence":"api","api.asUser.requestConfluence":"api","api.asUser.withProvider.fetch":"api","api.asUser.withProvider.requestCredentials":"api","api.asUser.withProvider.hasCredentials":"api","api.asUser.withProvider.listCredentials":"api","api.asUser.withProvider.getAccount":"api","api.asUser.withProvider.listAccounts":"api","api.requestRmsStore":"api","api.requestAiGateway":"api","api.requestJira":"api","api.asApp.requestJira":"api","api.asUser.requestJira":"api","api.asApp.requestAtlassian":"api","api.asUser.requestAtlassian":"api","api.asApp.requestBitbucket":"api","api.asUser.requestBitbucket":"api","api.requestBitbucket":"api","api.webTrigger.getUrl":"api","api.webTrigger.deleteUrl":"api","api.webTrigger.getUrlIds":"api","api.internalMetrics.invokeCounter":"api","api.internalMetrics.invokeGauge":"api","api.internalMetrics.invokeTimer":"api"};constructor(e){super(`You cannot call ${i.MAPPED_METHODS_NAMES[e]} methods in the snapshot context`)}}class n{bridge;define(e,r,t){this.bridge=e,this.defineGlobals(r,t)}defineGlobals(e,r){if(this.bridge instanceof s)return this.definePostBootstrap(e,r);this.definePreBootstrap(e,r)}}class o extends n{normalizeLogLevel(e){switch(e){case"warn":return"warning";case"log":return"info";default:return e}}definePreBootstrap(e){e.getSnapshotLogs=r=>{delete e.getSnapshotLogs;const t=e=>new r.ExternalCopy(e),s=this.bridge.getDeferedInvocations().map((({args:e})=>({level:this.normalizeLogLevel(e[0]),args:e[1].serialize(t)})));return new r.ExternalCopy(s,{release:!0,transferOut:!0}).copyInto()}}definePostBootstrap(e){}}function c(e,r,...t){return new Promise(((s,a)=>{e.callIgnored(r,...t,(e=>{const r={text:async()=>e.data,json:async()=>JSON.parse(e.data),arrayBuffer:async()=>e.arrayBufferData,headers:e.headers,ok:e.ok,status:e.status,statusText:e.statusText};s(r)}),(e=>{e.error&&a(e.error),a(e)}))}))}function l(e,r,...t){return new Promise(((s,a)=>{e.callIgnored(r,...t,s,a)}))}var p;!function(e){e[e.jira=0]="jira",e[e.confluence=1]="confluence"}(p||(p={}));class u extends n{requestJira=(e,r)=>c(this.bridge,"api.requestJira",e,r);requestRmsStore=(e,r)=>c(this.bridge,"api.requestRmsStore",e,r);ai=e=>({request:(r,t)=>c(this.bridge,"api.requestAiGateway",e,t)});requestConfluence=(e,r)=>c(this.bridge,"api.requestConfluence",e,r);requestBitbucket=(e,r)=>c(this.bridge,"api.requestBitbucket",e,r);fetch=(e,r)=>c(this.bridge,"api.fetch",e,r);asUser=()=>{const e={requestJira:(e,r)=>c(this.bridge,"api.asUser.requestJira",e,r),requestConfluence:(e,r)=>c(this.bridge,"api.asUser.requestConfluence",e,r),requestGraph:(e,r)=>c(this.bridge,"api.asUser.requestAtlassian",e,r),requestBitbucket:(e,r)=>c(this.bridge,"api.asUser.requestBitbucket",e,r),requestConnectedData:(e,r)=>c(this.bridge,"api.asUser.requestAtlassian",e,r),withProvider:(e,r,t)=>({hasCredentials:r=>l(this.bridge,"api.asUser.withProvider.hasCredentials",e,r,void 0),requestCredentials:r=>l(this.bridge,"api.asUser.withProvider.requestCredentials",e,r,void 0),listCredentials:()=>l(this.bridge,"api.asUser.withProvider.listCredentials",e),listAccounts:()=>l(this.bridge,"api.asUser.withProvider.listAccounts",e),getAccount:()=>l(this.bridge,"api.asUser.withProvider.getAccount",e,void 0),fetch:(s,a)=>c(this.bridge,"api.asUser.withProvider.fetch",r,e,t,s,a,void 0),asAccount:s=>({hasCredentials:r=>l(this.bridge,"api.asUser.withProvider.hasCredentials",e,r,s),requestCredentials:r=>l(this.bridge,"api.asUser.withProvider.requestCredentials",e,r,s),getAccount:()=>l(this.bridge,"api.asUser.withProvider.getAccount",e,s),fetch:(a,i)=>c(this.bridge,"api.asUser.withProvider.fetch",r,e,t,a,i,s)})})};return Object.defineProperty(e,"__requestAtlassian",{configurable:!1,enumerable:!1,writable:!1,value:(e,r)=>c(this.bridge,"api.asUser.requestAtlassian",e,r)}),e};asApp=()=>{const e={requestJira:(e,r)=>c(this.bridge,"api.asApp.requestJira",e,r),requestConfluence:(e,r)=>c(this.bridge,"api.asApp.requestConfluence",e,r),requestGraph:(e,r)=>c(this.bridge,"api.asApp.requestAtlassian",e,r),requestBitbucket:(e,r)=>c(this.bridge,"api.asApp.requestBitbucket",e,r),requestConnectedData:(e,r)=>c(this.bridge,"api.asApp.requestAtlassian",e,r)};return Object.defineProperty(e,"__requestAtlassian",{configurable:!1,enumerable:!1,writable:!1,value:(e,r)=>c(this.bridge,"api.asApp.requestAtlassian",e,r)}),e};definePreBootstrap(e){e.api={ai:this.ai,asUser:this.asUser,asApp:this.asApp,fetch:this.fetch,requestJira:this.requestJira,requestConfluence:this.requestConfluence,requestBitbucket:this.requestBitbucket,requestRmsStore:this.requestRmsStore}}getAuthTokenReferences=e=>this.bridge.callSync("api.getAuthTokenReferences",e);definePostBootstrap(e,r){r&&r.FFisMultiAuthEnabled&&(e.api.getAuthTokenReferences=this.getAuthTokenReferences)}}class d extends n{definePreBootstrap(e){Object.defineProperty(e,"__bridge",{configurable:!1,enumerable:!1,writable:!1,value:this.bridge})}definePostBootstrap(e){}}class g extends n{logConsole=e=>(...t)=>{this.bridge.call("logConsole",e,new r((e=>t.map((r=>((e,r)=>{const t=[],s=(r,t)=>e({value:r,prefix:t});return function e(r){const a=(r,a,i)=>{t.push(i);const n=e({...i});t.pop();const o=[r,a].filter((e=>""!==e)).join(" ");return s(n,o)};if("function"==typeof r)return s(`[Function${r.name?": "+r.name:""}]`,void 0);if("symbol"==typeof r)return s(r.toString(),void 0);if(r instanceof Error)return s(`${r.name}: ${r.message}`,void 0);if((i=r)&&"object"==typeof i){const i=(e=>{const r=Object.getOwnPropertyDescriptor(e,Symbol.toStringTag);return r&&!1===r.enumerable?`[${r.value}]`:""})(r);if(t.indexOf(r)>-1)return s("[Circular]",void 0);if(Array.isArray(r))r=r.map(e);else{if((e=>e.constructor===Promise)(r))return s("[Promise]",void 0);if((e=>null===Object.getPrototypeOf(e))(r))return a("[Object: null prototype]",i,r);if((e=>e.constructor===Object)(r)){if(i)return a("Object",i,r);t.push(r);const s={};Object.entries(r).forEach((([r,t])=>s[r]=e(t))),Object.getOwnPropertySymbols(r).forEach((t=>s[`[${t.toString()}]`]=e(r[t]))),r=s,t.pop()}else if(!(e=>{switch(e.constructor){case String:case Number:case Boolean:case ArrayBuffer:case Uint8Array:case Int8Array:case Uint8ClampedArray:case Int16Array:case Uint16Array:case Int32Array:case Uint32Array:case Float32Array:case Float64Array:case DataView:case Map:case Set:case RegExp:case Date:case Object:case Array:return!0;default:return!1}})(r))return a(r.constructor?r.constructor.name:"",i,r)}}var i;return r}(r)})(e,r))))))};definePreBootstrap(e){e.console={debug:this.logConsole("debug"),error:this.logConsole("error"),warn:this.logConsole("warn"),info:this.logConsole("info"),log:this.logConsole("log")}}definePostBootstrap(){}}class h extends n{definePreBootstrap(e){Object.defineProperty(e,"crypto",{configurable:!1,enumerable:!1,writable:!1,value:{getRandomValues:e=>{if(!e||"Buffer"!==e.constructor.name&&!ArrayBuffer.isView(e))throw new Error(`getRandomvalues expected Buffer or Typed Array got '${typeof e}'.`);const r="Buffer"===e.constructor.name?new Uint32Array(e):e,t=this.bridge.callSync("crypto.randomFillSync",r);return e.set(t),e}}})}definePostBootstrap(e){}}class f extends n{definePreBootstrap(e){}definePostBootstrap(e){Object.defineProperty(e,"__invoke",{configurable:!1,enumerable:!1,writable:!1,value:(r,t,s,a,i)=>{const n=e[r]||exports[r];if(!n)throw new Error(`Can't invoke a function "${r}". Maybe it's not exported?`);const o=n.apply(void 0,[t,s]);Promise.resolve(o).then((e=>{this.bridge.applyIgnored(a,e)})).catch((e=>{this.bridge.applyIgnored(i,e)}))}})}}class b extends n{static createIOStream=e=>({fd:e});definePreBootstrap(e){const r=e.runtimeStaticConfig;function t(){}delete e.runtimeStaticConfig,e.process={...r?.process,nextTick:(r,...t)=>e.setTimeout(r,0,...t),stdin:b.createIOStream(0),stdout:b.createIOStream(1),stderr:b.createIOStream(2)},Object.defineProperty(t.prototype,Symbol.toStringTag,{get:()=>"process"}),Object.setPrototypeOf(e.process,t.prototype)}definePostBootstrap(e){e.process.env=JSON.parse(this.bridge.callSync("getUserVars"))}}class w extends n{deferred=!0;deferredTimers={Timeout:[],Interval:[]};setTimer=e=>{const t=this.deferredTimers[e];return(s,a,...i)=>{if(this.deferred){const r=t.length;return t.push({args:[s,a,...i]}),`deferred-${e}-${r}`}return this.bridge.callSync(`set${e}`,new r(((e,r)=>({callback:r((()=>s(...i))),ms:a}))))}};clearTimer=e=>{const r=new RegExp(`^deferred-${e}-(\\d+)$`),t=this.deferredTimers[e];return s=>{if("string"==typeof s){const e=s.match(r);if(e&&(s=t[e[1]].id,delete t[e[1]],void 0===s))return}if(!this.deferred)return this.bridge.callSync(`clear${e}`,(()=>({id:s})))}};definePreBootstrap(e){e.setTimeout=this.setTimer("Timeout"),e.clearTimeout=this.clearTimer("Timeout"),e.setInterval=this.setTimer("Interval"),e.clearInterval=this.clearTimer("Interval")}definePostBootstrap(){this.deferred=!1,Object.entries(this.deferredTimers).forEach((([e,r])=>{const t=this.setTimer(e);r.forEach((({args:e},s)=>{r[s]={id:t(...e)}}))}))}}class y extends n{getAppAri=()=>this.bridge.callSync("api.getAppAri");definePreBootstrap(e){e.api||(e.api={}),Object.defineProperty(e.api,"__getAppAri",{configurable:!1,enumerable:!1,writable:!1,value:()=>this.getAppAri()})}definePostBootstrap(e){}}class m extends n{getWebTriggerUrl=(e,r)=>new Promise(((t,s)=>{this.bridge.callIgnored("api.webTrigger.getUrl",e,r,(e=>{try{e.ok||s(new Error(`Internal error occurred: Failed to get web trigger URL: ${e.statusText}.`));const r=JSON.parse(e.data);r?.data?.createWebTriggerUrl?.url||s(new Error("Internal error occurred: Failed to get web trigger URL.")),t(r.data.createWebTriggerUrl.url)}catch(e){s(e)}}),(e=>{e.error&&s(e.error),s(e)}))}));deleteWebTriggerUrl=e=>new Promise(((r,t)=>{const s=e=>{try{e.ok||t(new Error(`Internal error occurred: Failed to delete web trigger URL: ${e.statusText}.`));const s=JSON.parse(e.data);s?.data?.deleteWebTriggerUrl?.success||t(new Error(`Internal error occurred: Failed to delete web trigger URL: ${s?.data?.deleteWebTriggerUrl?.message||"unknown error"}`)),r()}catch(e){t(e)}},a=e=>{e.error&&t(e.error),t(e)};this.getWebTriggerUrlIds(e).then((e=>{e.forEach((e=>this.bridge.callIgnored("api.webTrigger.deleteUrl",e,s,a)))})).catch(t)}));getWebTriggerUrlIds=e=>new Promise(((r,t)=>{this.bridge.callIgnored("api.webTrigger.getUrlIds",(s=>{s.ok||t(Error(`Internal error occurred: Failed to get web trigger URLs: ${s.statusText}.`));const a=JSON.parse(s.data);a?.data?.webTriggerUrlsByAppContext&&0!=a.data.webTriggerUrlsByAppContext.length||t(Error("Internal error occurred: No web trigger URLs found"));const i=a.data.webTriggerUrlsByAppContext.filter((r=>r.url==e)).map((e=>e.id));i&&0!=i.length||t(Error("Internal error occurred: Web trigger URL matching URL not found")),r(i)}),(e=>{e.error&&t(e.error),t(e)}))}));definePreBootstrap(e){e.api||(e.api={}),e.api.webTrigger={getUrl:(e,r=!1)=>this.getWebTriggerUrl(e,r),getUrlIds:e=>this.getWebTriggerUrlIds(e),deleteUrl:e=>this.deleteWebTriggerUrl(e)}}definePostBootstrap(e){}}class A extends n{definePreBootstrap(e){}definePostBootstrap(e){Object.defineProperty(e,"self",{configurable:!1,enumerable:!1,writable:!1,value:e})}}class v extends n{definePreBootstrap(e){e.api||(e.api={}),e.api.internalMetrics={invokeCounter:(e,r,t)=>{this.bridge.callSync("api.internalMetrics.invokeCounter",{method:e,counterName:r,value:t})},invokeGauge:(e,r)=>{this.bridge.callSync("api.internalMetrics.invokeGauge",{gaugeName:e,value:r})},invokeTimer:(e,r,t)=>this.bridge.callSync("api.internalMetrics.invokeTimer",{method:e,timerId:r,timerName:t})}}definePostBootstrap(e){}}class U{definitions;constructor(e){this.definitions=e}static instance;setup=(e,r,t)=>{this.definitions.forEach((s=>s.define(e,r,t)))};static get(){return U.instance||(U.instance=new U([new d,new g,new h,new b,new w,new f,new u,new o,new y,new m,new A,new v])),U.instance}}U.get().setup(new class{deferedCalls=[];isDeferableMethod(e){return a.includes(e)}getDeferedInvocations(){const e=[...this.deferedCalls];return this.deferedCalls=[],e}call(e,...r){if(!this.isDeferableMethod(e))throw new i(e);this.deferedCalls.push({method:e,args:r})}callIgnored(e,...r){throw new i(e)}callSync(e,...r){throw new i(e)}},e.g),e.g.bootstrap=(r,t,a)=>{delete e.g.bootstrap,U.get().setup(new s(t,r),e.g,{FFisMultiAuthEnabled:a})}})();
\ No newline at end of file