UNPKG

git-rest-wrapper

Version:

A "universal" / normalized API wrapper for common git hosting services.

1,213 lines (1,208 loc) 202 kB
(function (root, factory) { if (typeof define === 'function' && define.amd) define(['exports', 'kotlin', 'ktor-ktor-client-json-jsLegacy', 'ktor-ktor-client-serialization-jsLegacy', 'ktor-ktor-client-core-jsLegacy', 'kotlinx-serialization-kotlinx-serialization-json-jsLegacy', 'ktor-ktor-http-jsLegacy', 'kotlinx-serialization-kotlinx-serialization-core-jsLegacy', 'kotlinx-coroutines-core'], factory); else if (typeof exports === 'object') factory(module.exports, require('kotlin'), require('ktor-ktor-client-json-jsLegacy'), require('ktor-ktor-client-serialization-jsLegacy'), require('ktor-ktor-client-core-jsLegacy'), require('kotlinx-serialization-kotlinx-serialization-json-jsLegacy'), require('ktor-ktor-http-jsLegacy'), require('kotlinx-serialization-kotlinx-serialization-core-jsLegacy'), require('kotlinx-coroutines-core')); else { if (typeof kotlin === 'undefined') { throw new Error("Error loading module 'git-rest-wrapper-gitrest'. Its dependency 'kotlin' was not found. Please, check whether 'kotlin' is loaded prior to 'git-rest-wrapper-gitrest'."); }if (typeof this['ktor-ktor-client-json-jsLegacy'] === 'undefined') { throw new Error("Error loading module 'git-rest-wrapper-gitrest'. Its dependency 'ktor-ktor-client-json-jsLegacy' was not found. Please, check whether 'ktor-ktor-client-json-jsLegacy' is loaded prior to 'git-rest-wrapper-gitrest'."); }if (typeof this['ktor-ktor-client-serialization-jsLegacy'] === 'undefined') { throw new Error("Error loading module 'git-rest-wrapper-gitrest'. Its dependency 'ktor-ktor-client-serialization-jsLegacy' was not found. Please, check whether 'ktor-ktor-client-serialization-jsLegacy' is loaded prior to 'git-rest-wrapper-gitrest'."); }if (typeof this['ktor-ktor-client-core-jsLegacy'] === 'undefined') { throw new Error("Error loading module 'git-rest-wrapper-gitrest'. Its dependency 'ktor-ktor-client-core-jsLegacy' was not found. Please, check whether 'ktor-ktor-client-core-jsLegacy' is loaded prior to 'git-rest-wrapper-gitrest'."); }if (typeof this['kotlinx-serialization-kotlinx-serialization-json-jsLegacy'] === 'undefined') { throw new Error("Error loading module 'git-rest-wrapper-gitrest'. Its dependency 'kotlinx-serialization-kotlinx-serialization-json-jsLegacy' was not found. Please, check whether 'kotlinx-serialization-kotlinx-serialization-json-jsLegacy' is loaded prior to 'git-rest-wrapper-gitrest'."); }if (typeof this['ktor-ktor-http-jsLegacy'] === 'undefined') { throw new Error("Error loading module 'git-rest-wrapper-gitrest'. Its dependency 'ktor-ktor-http-jsLegacy' was not found. Please, check whether 'ktor-ktor-http-jsLegacy' is loaded prior to 'git-rest-wrapper-gitrest'."); }if (typeof this['kotlinx-serialization-kotlinx-serialization-core-jsLegacy'] === 'undefined') { throw new Error("Error loading module 'git-rest-wrapper-gitrest'. Its dependency 'kotlinx-serialization-kotlinx-serialization-core-jsLegacy' was not found. Please, check whether 'kotlinx-serialization-kotlinx-serialization-core-jsLegacy' is loaded prior to 'git-rest-wrapper-gitrest'."); }if (typeof this['kotlinx-coroutines-core'] === 'undefined') { throw new Error("Error loading module 'git-rest-wrapper-gitrest'. Its dependency 'kotlinx-coroutines-core' was not found. Please, check whether 'kotlinx-coroutines-core' is loaded prior to 'git-rest-wrapper-gitrest'."); }root['git-rest-wrapper-gitrest'] = factory(typeof this['git-rest-wrapper-gitrest'] === 'undefined' ? {} : this['git-rest-wrapper-gitrest'], kotlin, this['ktor-ktor-client-json-jsLegacy'], this['ktor-ktor-client-serialization-jsLegacy'], this['ktor-ktor-client-core-jsLegacy'], this['kotlinx-serialization-kotlinx-serialization-json-jsLegacy'], this['ktor-ktor-http-jsLegacy'], this['kotlinx-serialization-kotlinx-serialization-core-jsLegacy'], this['kotlinx-coroutines-core']); } }(this, function (_, Kotlin, $module$ktor_ktor_client_json_jsLegacy, $module$ktor_ktor_client_serialization_jsLegacy, $module$ktor_ktor_client_core_jsLegacy, $module$kotlinx_serialization_kotlinx_serialization_json_jsLegacy, $module$ktor_ktor_http_jsLegacy, $module$kotlinx_serialization_kotlinx_serialization_core_jsLegacy, $module$kotlinx_coroutines_core) { 'use strict'; var $$importsForInline$$ = _.$$importsForInline$$ || (_.$$importsForInline$$ = {}); var Unit = Kotlin.kotlin.Unit; var COROUTINE_SUSPENDED = Kotlin.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED; var CoroutineImpl = Kotlin.kotlin.coroutines.CoroutineImpl; var equals = Kotlin.equals; var RuntimeException_init = Kotlin.kotlin.RuntimeException_init_pdl1vj$; var List = Kotlin.kotlin.collections.List; var Any = Object; var throwCCE = Kotlin.throwCCE; var toString = Kotlin.toString; var Exception = Kotlin.kotlin.Exception; var HashMap_init = Kotlin.kotlin.collections.HashMap_init_q3lmfv$; var Kind_CLASS = Kotlin.Kind.CLASS; var Kind_INTERFACE = Kotlin.Kind.INTERFACE; var JsonFeature = $module$ktor_ktor_client_json_jsLegacy.io.ktor.client.features.json.JsonFeature; var KotlinxSerializer = $module$ktor_ktor_client_serialization_jsLegacy.io.ktor.client.features.json.serializer.KotlinxSerializer; var HttpClient = $module$ktor_ktor_client_core_jsLegacy.io.ktor.client.HttpClient_f0veat$; var isBlank = Kotlin.kotlin.text.isBlank_gw00vp$; var println = Kotlin.kotlin.io.println_s8jyv4$; var Json = $module$kotlinx_serialization_kotlinx_serialization_json_jsLegacy.kotlinx.serialization.json.Json_x26noe$; var removePrefix = Kotlin.kotlin.text.removePrefix_gsj5wt$; var hashCode = Kotlin.hashCode; var first = Kotlin.kotlin.collections.first_us0mfu$; var Regex_init = Kotlin.kotlin.text.Regex_init_61zpoe$; var ensureNotNull = Kotlin.ensureNotNull; var Kind_OBJECT = Kotlin.Kind.OBJECT; var getKClass = Kotlin.getKClass; var createKType = Kotlin.createKType; var createInvariantKTypeProjection = Kotlin.createInvariantKTypeProjection; var URLProtocol = $module$ktor_ktor_http_jsLegacy.io.ktor.http.URLProtocol; var header = $module$ktor_ktor_client_core_jsLegacy.io.ktor.client.request.header_xadl6p$; var defaultRequest = $module$ktor_ktor_client_core_jsLegacy.io.ktor.client.features.defaultRequest_fxc3ki$; var takeFrom = $module$ktor_ktor_client_core_jsLegacy.$$importsForInline$$['ktor-ktor-http-jsLegacy'].io.ktor.http.takeFrom_jl1sg7$; var utils = $module$ktor_ktor_client_core_jsLegacy.io.ktor.client.utils; var url = $module$ktor_ktor_client_core_jsLegacy.io.ktor.client.request.url_3rzbk2$; var HttpMethod = $module$ktor_ktor_client_core_jsLegacy.$$importsForInline$$['ktor-ktor-http-jsLegacy'].io.ktor.http.HttpMethod; var HttpRequestBuilder_init = $module$ktor_ktor_client_core_jsLegacy.io.ktor.client.request.HttpRequestBuilder; var HttpStatement_init = $module$ktor_ktor_client_core_jsLegacy.io.ktor.client.statement.HttpStatement; var HttpResponse = $module$ktor_ktor_client_core_jsLegacy.io.ktor.client.statement.HttpResponse; var complete = $module$ktor_ktor_client_core_jsLegacy.io.ktor.client.statement.complete_abn2de$; var call = $module$ktor_ktor_client_core_jsLegacy.io.ktor.client.call; var TypeInfo_init = $module$ktor_ktor_client_core_jsLegacy.io.ktor.client.call.TypeInfo; var NullableSerializer = $module$kotlinx_serialization_kotlinx_serialization_core_jsLegacy.kotlinx.serialization.internal.NullableSerializer; var PluginGeneratedSerialDescriptor = $module$kotlinx_serialization_kotlinx_serialization_core_jsLegacy.kotlinx.serialization.internal.PluginGeneratedSerialDescriptor; var internal = $module$kotlinx_serialization_kotlinx_serialization_core_jsLegacy.kotlinx.serialization.internal; var UnknownFieldException = $module$kotlinx_serialization_kotlinx_serialization_core_jsLegacy.kotlinx.serialization.UnknownFieldException; var GeneratedSerializer = $module$kotlinx_serialization_kotlinx_serialization_core_jsLegacy.kotlinx.serialization.internal.GeneratedSerializer; var PrimitiveClasses$stringClass = Kotlin.kotlin.reflect.js.internal.PrimitiveClasses.stringClass; var ReferenceArraySerializer = $module$kotlinx_serialization_kotlinx_serialization_core_jsLegacy.kotlinx.serialization.internal.ReferenceArraySerializer; var firstOrNull = Kotlin.kotlin.collections.firstOrNull_2p1efm$; var replace = Kotlin.kotlin.text.replace_680rmw$; var PrimitiveKind = $module$kotlinx_serialization_kotlinx_serialization_core_jsLegacy.kotlinx.serialization.descriptors.PrimitiveKind; var PrimitiveSerialDescriptor = $module$kotlinx_serialization_kotlinx_serialization_core_jsLegacy.kotlinx.serialization.descriptors.PrimitiveSerialDescriptor_xytc2a$; var kotlin_js_internal_StringCompanionObject = Kotlin.kotlin.js.internal.StringCompanionObject; var serializer = $module$kotlinx_serialization_kotlinx_serialization_core_jsLegacy.kotlinx.serialization.builtins.serializer_6eet4j$; var KSerializer = $module$kotlinx_serialization_kotlinx_serialization_core_jsLegacy.kotlinx.serialization.KSerializer; var split = Kotlin.kotlin.text.split_ip8yn$; var coroutines = $module$kotlinx_coroutines_core.kotlinx.coroutines; var promise = $module$kotlinx_coroutines_core.kotlinx.coroutines.promise_pda6u4$; var to = Kotlin.kotlin.to_ujzrz7$; var toMap = Kotlin.kotlin.collections.toMap_6hr0sd$; var collectionSizeOrDefault = Kotlin.kotlin.collections.collectionSizeOrDefault_ba2ldo$; var ArrayList_init = Kotlin.kotlin.collections.ArrayList_init_ww73n8$; var copyToArray = Kotlin.kotlin.collections.copyToArray; var await_0 = $module$kotlinx_coroutines_core.kotlinx.coroutines.await_t11jrl$; var toLong = Kotlin.kotlin.text.toLong_pdl1vz$; var startsWith = Kotlin.kotlin.text.startsWith_7epoxm$; var L864000000 = Kotlin.Long.fromInt(864000000); License.prototype = Object.create(DelegateResource.prototype); License.prototype.constructor = License; Repo.prototype = Object.create(DelegateResource.prototype); Repo.prototype.constructor = Repo; UrlType$HTTP.prototype = Object.create(UrlType.prototype); UrlType$HTTP.prototype.constructor = UrlType$HTTP; UrlType$HTTPS.prototype = Object.create(UrlType.prototype); UrlType$HTTPS.prototype.constructor = UrlType$HTTPS; UrlType$SSH.prototype = Object.create(UrlType.prototype); UrlType$SSH.prototype.constructor = UrlType$SSH; User.prototype = Object.create(DelegateResource.prototype); User.prototype.constructor = User; GiteaRepo.prototype = Object.create(Repo.prototype); GiteaRepo.prototype.constructor = GiteaRepo; GiteaUser.prototype = Object.create(User.prototype); GiteaUser.prototype.constructor = GiteaUser; GithubLicense.prototype = Object.create(License.prototype); GithubLicense.prototype.constructor = GithubLicense; GithubRepo.prototype = Object.create(Repo.prototype); GithubRepo.prototype.constructor = GithubRepo; GithubUser.prototype = Object.create(User.prototype); GithubUser.prototype.constructor = GithubUser; GitlabLicense.prototype = Object.create(License.prototype); GitlabLicense.prototype.constructor = GitlabLicense; GitlabRepo.prototype = Object.create(Repo.prototype); GitlabRepo.prototype.constructor = GitlabRepo; GitlabUser.prototype = Object.create(User.prototype); GitlabUser.prototype.constructor = GitlabUser; function gitrest(block) { var $receiver = new GitrestConfig(); block($receiver); var config = $receiver; return new GitrestClient(config); } function GitrestClient(config) { this.config_0 = config; this.providers_0 = HashMap_init(); } function Coroutine$get_0($this, str_0, endpointKey_0, block_0, continuation_0) { CoroutineImpl.call(this, continuation_0); this.exceptionState_0 = 8; this.$this = $this; this.local$tmp$_2 = void 0; this.local$tmp$_3 = void 0; this.local$providerStr = void 0; this.local$requestKey = void 0; this.local$tmp$_4 = void 0; this.local$str = str_0; this.local$endpointKey = endpointKey_0; this.local$block = block_0; } Coroutine$get_0.$metadata$ = { kind: Kotlin.Kind.CLASS, simpleName: null, interfaces: [CoroutineImpl] }; Coroutine$get_0.prototype = Object.create(CoroutineImpl.prototype); Coroutine$get_0.prototype.constructor = Coroutine$get_0; Coroutine$get_0.prototype.doResume = function () { do try { switch (this.state_0) { case 0: var tmp$, tmp$_0, tmp$_1; this.local$providerStr = ProviderString_init_1(this.local$str); this.local$requestKey = this.local$providerStr.toString() + ':' + this.local$endpointKey; this.state_0 = 1; this.result_0 = this.$this.config_0.cache.get_ytbaoo$(this.local$requestKey, this); if (this.result_0 === COROUTINE_SUSPENDED) return COROUTINE_SUSPENDED; continue; case 1: if ((tmp$ = this.result_0) != null) { this.$this.config_0.logDebug('GIT-REST: Returning cached entry for ' + this.local$providerStr); return tmp$; } else { this.state_0 = 2; continue; } case 2: var providerId = this.local$providerStr.provider + '@' + this.local$providerStr.hostname; var tmp$_2; if ((tmp$_0 = this.$this.providers_0.get_11rb$(providerId)) != null) tmp$_2 = tmp$_0; else { var tmp$_3, tmp$_4, tmp$_5; var tmp$_6; var $receiver = this.$this.config_0.providers; var firstOrNull$result; firstOrNull$break: do { var tmp$_7; for (tmp$_7 = 0; tmp$_7 !== $receiver.length; ++tmp$_7) { var element = $receiver[tmp$_7]; if (equals(element.key, this.local$providerStr.provider)) { firstOrNull$result = element; break firstOrNull$break; }} firstOrNull$result = null; } while (false); if ((tmp$_4 = (tmp$_3 = firstOrNull$result) != null ? tmp$_3.create_wf0mc2$(this.$this.config_0, this.local$providerStr.hostname) : null) != null) { this.$this.providers_0.put_xwzc9p$(providerId, tmp$_4); tmp$_6 = tmp$_4; } else tmp$_6 = null; tmp$_5 = tmp$_6; if (tmp$_5 == null) { throw RuntimeException_init('Provider not found: ' + providerId); }tmp$_2 = tmp$_5; } var provider = tmp$_2; this.exceptionState_0 = 6; this.state_0 = 3; this.result_0 = this.local$block(provider, this.local$providerStr.id, this); if (this.result_0 === COROUTINE_SUSPENDED) return COROUTINE_SUSPENDED; continue; case 3: var tmp$_8; if ((tmp$_1 = this.result_0) != null) { var tmp$_9, tmp$_10, tmp$_11, tmp$_12; if (((tmp$_10 = Kotlin.isType(tmp$_9 = tmp$_1, DelegateResource) ? tmp$_9 : null) != null ? (tmp$_10.setId_qtmmzu$(this.local$providerStr), Unit) : null) == null) { if ((tmp$_12 = Kotlin.isType(tmp$_11 = tmp$_1, List) ? tmp$_11 : null) != null) { var tmp$_13; tmp$_13 = tmp$_12.iterator(); while (tmp$_13.hasNext()) { var element_0 = tmp$_13.next(); element_0.setId_qtmmzu$(this.local$providerStr); } }}tmp$_8 = tmp$_1; } else tmp$_8 = null; if ((this.local$tmp$_2 = tmp$_8) != null) { var tmp$_14; this.state_0 = 4; this.result_0 = this.$this.config_0.cache.set_bm4g0d$(this.local$requestKey, Kotlin.isType(tmp$_14 = this.local$tmp$_2, Any) ? tmp$_14 : throwCCE(), this); if (this.result_0 === COROUTINE_SUSPENDED) return COROUTINE_SUSPENDED; continue; } else { this.local$tmp$_4 = null; this.state_0 = 5; continue; } case 4: this.local$tmp$_4 = this.local$tmp$_2; this.state_0 = 5; continue; case 5: this.local$tmp$_3 = this.local$tmp$_4; this.exceptionState_0 = 8; this.state_0 = 7; continue; case 6: this.exceptionState_0 = 8; var e = this.exception_0; if (Kotlin.isType(e, Exception)) { if (this.$this.config_0.strictMode) throw e; else this.$this.config_0.logError('GIT-REST: Error fetching ' + this.local$str + ': ' + toString(Kotlin.getKClassFromExpression(e).simpleName) + ' - ' + toString(e.message)); this.local$tmp$_3 = null; } else throw e; this.state_0 = 7; continue; case 7: return this.local$tmp$_3; case 8: throw this.exception_0; default:this.state_0 = 8; throw new Error('State Machine Unreachable execution'); } } catch (e) { if (this.state_0 === 8) { this.exceptionState_0 = this.state_0; throw e; } else { this.state_0 = this.exceptionState_0; this.exception_0 = e; } } while (true); }; GitrestClient.prototype.get_0 = function (str_0, endpointKey_0, block_0, continuation_0, suspended) { var instance = new Coroutine$get_0(this, str_0, endpointKey_0, block_0, continuation_0); if (suspended) return instance; else return instance.doResume(null); }; function Coroutine$GitrestClient$getUser$lambda(it_0, id_0, continuation_0) { CoroutineImpl.call(this, continuation_0); this.exceptionState_0 = 1; this.local$it = it_0; this.local$id = id_0; } Coroutine$GitrestClient$getUser$lambda.$metadata$ = { kind: Kotlin.Kind.CLASS, simpleName: null, interfaces: [CoroutineImpl] }; Coroutine$GitrestClient$getUser$lambda.prototype = Object.create(CoroutineImpl.prototype); Coroutine$GitrestClient$getUser$lambda.prototype.constructor = Coroutine$GitrestClient$getUser$lambda; Coroutine$GitrestClient$getUser$lambda.prototype.doResume = function () { do try { switch (this.state_0) { case 0: this.state_0 = 2; this.result_0 = this.local$it.getUser_61zpoe$(this.local$id, this); if (this.result_0 === COROUTINE_SUSPENDED) return COROUTINE_SUSPENDED; continue; case 1: throw this.exception_0; case 2: return this.result_0; default:this.state_0 = 1; throw new Error('State Machine Unreachable execution'); } } catch (e) { if (this.state_0 === 1) { this.exceptionState_0 = this.state_0; throw e; } else { this.state_0 = this.exceptionState_0; this.exception_0 = e; } } while (true); }; function GitrestClient$getUser$lambda(it_0, id_0, continuation_0, suspended) { var instance = new Coroutine$GitrestClient$getUser$lambda(it_0, id_0, continuation_0); if (suspended) return instance; else return instance.doResume(null); } GitrestClient.prototype.getUser_61zpoe$ = function (str, continuation) { return this.get_0(str, 'getUser', GitrestClient$getUser$lambda, continuation); }; function Coroutine$GitrestClient$getRepo$lambda(it_0, id_0, continuation_0) { CoroutineImpl.call(this, continuation_0); this.exceptionState_0 = 1; this.local$it = it_0; this.local$id = id_0; } Coroutine$GitrestClient$getRepo$lambda.$metadata$ = { kind: Kotlin.Kind.CLASS, simpleName: null, interfaces: [CoroutineImpl] }; Coroutine$GitrestClient$getRepo$lambda.prototype = Object.create(CoroutineImpl.prototype); Coroutine$GitrestClient$getRepo$lambda.prototype.constructor = Coroutine$GitrestClient$getRepo$lambda; Coroutine$GitrestClient$getRepo$lambda.prototype.doResume = function () { do try { switch (this.state_0) { case 0: this.state_0 = 2; this.result_0 = this.local$it.getRepo_61zpoe$(this.local$id, this); if (this.result_0 === COROUTINE_SUSPENDED) return COROUTINE_SUSPENDED; continue; case 1: throw this.exception_0; case 2: return this.result_0; default:this.state_0 = 1; throw new Error('State Machine Unreachable execution'); } } catch (e) { if (this.state_0 === 1) { this.exceptionState_0 = this.state_0; throw e; } else { this.state_0 = this.exceptionState_0; this.exception_0 = e; } } while (true); }; function GitrestClient$getRepo$lambda(it_0, id_0, continuation_0, suspended) { var instance = new Coroutine$GitrestClient$getRepo$lambda(it_0, id_0, continuation_0); if (suspended) return instance; else return instance.doResume(null); } GitrestClient.prototype.getRepo_61zpoe$ = function (str, continuation) { return this.get_0(str, 'getRepo', GitrestClient$getRepo$lambda, continuation); }; function Coroutine$GitrestClient$getRepoContributors$lambda(it_0, id_0, continuation_0) { CoroutineImpl.call(this, continuation_0); this.exceptionState_0 = 1; this.local$it = it_0; this.local$id = id_0; } Coroutine$GitrestClient$getRepoContributors$lambda.$metadata$ = { kind: Kotlin.Kind.CLASS, simpleName: null, interfaces: [CoroutineImpl] }; Coroutine$GitrestClient$getRepoContributors$lambda.prototype = Object.create(CoroutineImpl.prototype); Coroutine$GitrestClient$getRepoContributors$lambda.prototype.constructor = Coroutine$GitrestClient$getRepoContributors$lambda; Coroutine$GitrestClient$getRepoContributors$lambda.prototype.doResume = function () { do try { switch (this.state_0) { case 0: this.state_0 = 2; this.result_0 = this.local$it.getRepoContributors_61zpoe$(this.local$id, this); if (this.result_0 === COROUTINE_SUSPENDED) return COROUTINE_SUSPENDED; continue; case 1: throw this.exception_0; case 2: return this.result_0; default:this.state_0 = 1; throw new Error('State Machine Unreachable execution'); } } catch (e) { if (this.state_0 === 1) { this.exceptionState_0 = this.state_0; throw e; } else { this.state_0 = this.exceptionState_0; this.exception_0 = e; } } while (true); }; function GitrestClient$getRepoContributors$lambda(it_0, id_0, continuation_0, suspended) { var instance = new Coroutine$GitrestClient$getRepoContributors$lambda(it_0, id_0, continuation_0); if (suspended) return instance; else return instance.doResume(null); } GitrestClient.prototype.getRepoContributors_61zpoe$ = function (str, continuation) { return this.get_0(str, 'getRepoContributors', GitrestClient$getRepoContributors$lambda, continuation); }; function Coroutine$GitrestClient$getLicense$lambda(it_0, id_0, continuation_0) { CoroutineImpl.call(this, continuation_0); this.exceptionState_0 = 1; this.local$it = it_0; this.local$id = id_0; } Coroutine$GitrestClient$getLicense$lambda.$metadata$ = { kind: Kotlin.Kind.CLASS, simpleName: null, interfaces: [CoroutineImpl] }; Coroutine$GitrestClient$getLicense$lambda.prototype = Object.create(CoroutineImpl.prototype); Coroutine$GitrestClient$getLicense$lambda.prototype.constructor = Coroutine$GitrestClient$getLicense$lambda; Coroutine$GitrestClient$getLicense$lambda.prototype.doResume = function () { do try { switch (this.state_0) { case 0: this.state_0 = 2; this.result_0 = this.local$it.getLicense_61zpoe$(this.local$id, this); if (this.result_0 === COROUTINE_SUSPENDED) return COROUTINE_SUSPENDED; continue; case 1: throw this.exception_0; case 2: return this.result_0; default:this.state_0 = 1; throw new Error('State Machine Unreachable execution'); } } catch (e) { if (this.state_0 === 1) { this.exceptionState_0 = this.state_0; throw e; } else { this.state_0 = this.exceptionState_0; this.exception_0 = e; } } while (true); }; function GitrestClient$getLicense$lambda(it_0, id_0, continuation_0, suspended) { var instance = new Coroutine$GitrestClient$getLicense$lambda(it_0, id_0, continuation_0); if (suspended) return instance; else return instance.doResume(null); } GitrestClient.prototype.getLicense_61zpoe$ = function (str, continuation) { return this.get_0(str, 'getLicense', GitrestClient$getLicense$lambda, continuation); }; GitrestClient.$metadata$ = { kind: Kind_CLASS, simpleName: 'GitrestClient', interfaces: [RequestProvider] }; function RequestProvider() { } RequestProvider.$metadata$ = { kind: Kind_INTERFACE, simpleName: 'RequestProvider', interfaces: [] }; function ServiceBuilder() { } function ServiceBuilder$ktor$lambda$lambda(this$ktor) { return function ($receiver) { $receiver.serializer = new KotlinxSerializer(this$ktor.jsonSerializer); return Unit; }; } function ServiceBuilder$ktor$lambda(this$ktor, closure$block) { return function ($receiver) { $receiver.install_xlxg29$(JsonFeature.Feature, ServiceBuilder$ktor$lambda$lambda(this$ktor)); closure$block($receiver); return Unit; }; } ServiceBuilder.prototype.ktor_1v6kay$ = function ($receiver, block) { return HttpClient(ServiceBuilder$ktor$lambda($receiver, block)); }; ServiceBuilder.$metadata$ = { kind: Kind_INTERFACE, simpleName: 'ServiceBuilder', interfaces: [] }; function DelegateResource() { this.id_axp2ks$_0 = ''; this.hostname_sgm644$_0 = ''; this.provider_v1qh6e$_0 = ''; } Object.defineProperty(DelegateResource.prototype, 'id', { configurable: true, get: function () { return this.id_axp2ks$_0; }, set: function (id) { this.id_axp2ks$_0 = id; } }); Object.defineProperty(DelegateResource.prototype, 'hostname', { configurable: true, get: function () { return this.hostname_sgm644$_0; }, set: function (hostname) { this.hostname_sgm644$_0 = hostname; } }); Object.defineProperty(DelegateResource.prototype, 'provider', { configurable: true, get: function () { return this.provider_v1qh6e$_0; }, set: function (provider) { this.provider_v1qh6e$_0 = provider; } }); Object.defineProperty(DelegateResource.prototype, 'providerString', { configurable: true, get: function () { return ProviderString_init_0(this.provider, this.hostname, this.id); } }); DelegateResource.prototype.setId_qtmmzu$ = function (providerString) { this.hostname = providerString.hostname; this.provider = providerString.provider; if (isBlank(this.id)) throw RuntimeException_init('GIT-REST: Malformed response, .id not provided in ' + toString(Kotlin.getKClassFromExpression(this).simpleName) + ', requested ' + providerString); }; DelegateResource.$metadata$ = { kind: Kind_CLASS, simpleName: 'DelegateResource', interfaces: [] }; function GitrestConfig() { this.providers = [GithubProvider$Companion_getInstance(), GitlabProvider$Companion_getInstance(), GiteaProvider$Companion_getInstance()]; this.strictMode = false; this.logDebug = GitrestConfig$logDebug$lambda; this.logError = GitrestConfig$logError$lambda; this.jsonSerializer = Json(void 0, GitrestConfig$jsonSerializer$lambda); this.cache = new MemoryCache(); this.platformConfig = new PlatformConfig(); } GitrestConfig.prototype.platform_9or9kc$ = function (block) { block(this.platformConfig); }; function GitrestConfig$logDebug$lambda(it) { return Unit; } function GitrestConfig$logError$lambda(it) { println(it); return Unit; } function GitrestConfig$jsonSerializer$lambda($receiver) { $receiver.ignoreUnknownKeys = true; return Unit; } GitrestConfig.$metadata$ = { kind: Kind_CLASS, simpleName: 'GitrestConfig', interfaces: [] }; function License() { DelegateResource.call(this); this.name_hv9rx6$_0 = null; this.description_lwiggj$_0 = null; this.body_hox0f7$_0 = null; this.infoUrl_80v10y$_0 = null; this.permissions_4d9prp$_0 = null; this.conditions_x62ax9$_0 = null; this.limitations_do0i7e$_0 = null; } Object.defineProperty(License.prototype, 'name', { configurable: true, get: function () { return this.name_hv9rx6$_0; } }); Object.defineProperty(License.prototype, 'description', { configurable: true, get: function () { return this.description_lwiggj$_0; } }); Object.defineProperty(License.prototype, 'body', { configurable: true, get: function () { return this.body_hox0f7$_0; } }); Object.defineProperty(License.prototype, 'infoUrl', { configurable: true, get: function () { return this.infoUrl_80v10y$_0; } }); Object.defineProperty(License.prototype, 'permissions', { configurable: true, get: function () { return this.permissions_4d9prp$_0; } }); Object.defineProperty(License.prototype, 'conditions', { configurable: true, get: function () { return this.conditions_x62ax9$_0; } }); Object.defineProperty(License.prototype, 'limitations', { configurable: true, get: function () { return this.limitations_do0i7e$_0; } }); License.$metadata$ = { kind: Kind_CLASS, simpleName: 'License', interfaces: [DelegateResource] }; function ProviderString() { this.provider = null; this.hostname = null; this.id = null; } ProviderString.prototype.inferUrl_4sgkox$ = function (type) { if (type === void 0) type = UrlType$HTTPS_getInstance(); return type.getUrl_puj7f4$(removePrefix(this.hostname, 'api.'), this.id); }; ProviderString.prototype.toString = function () { return this.provider + '@' + this.hostname + ':' + this.id; }; ProviderString.prototype.equals = function (other) { var tmp$, tmp$_0, tmp$_1; return (tmp$_1 = (tmp$_0 = Kotlin.isType(tmp$ = other, ProviderString) ? tmp$ : null) != null ? equals(this.provider, tmp$_0.provider) && equals(this.hostname, other.hostname) && equals(this.id, tmp$_0.id) : null) != null ? tmp$_1 : this === other; }; ProviderString.prototype.hashCode = function () { var result = hashCode(this.provider); result = (31 * result | 0) + hashCode(this.hostname) | 0; result = (31 * result | 0) + hashCode(this.id) | 0; return result; }; ProviderString.$metadata$ = { kind: Kind_CLASS, simpleName: 'ProviderString', interfaces: [] }; function ProviderString_init(provider, hostname, $this) { $this = $this || Object.create(ProviderString.prototype); ProviderString.call($this); $this.provider = provider; $this.hostname = hostname; $this.id = ''; return $this; } function ProviderString_init_0(provider, hostname, id, $this) { $this = $this || Object.create(ProviderString.prototype); ProviderString_init_1(provider + '@' + hostname + ':' + id, $this); return $this; } function ProviderString_init_1(str, $this) { $this = $this || Object.create(ProviderString.prototype); ProviderString.call($this); var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3; if (str.length === 0) throw RuntimeException_init('GIT-REST: Empty ProviderString'); var providerRegex = Regex_init('(?:(\\w*)(?:@([\\w.]*))?:)?([\\w-_./]*)'); var hostnameRegex = Regex_init('(\\w+\\.\\w+)$'); tmp$_0 = (tmp$ = providerRegex.matchEntire_6bul2c$(str)) != null ? tmp$.destructured : null; if (tmp$_0 == null) { throw RuntimeException_init("GIT-REST: Unable to parse ProviderString '" + str + "'"); }var provider = tmp$_0.match.groupValues.get_za3lpa$(1); var hostname = tmp$_0.match.groupValues.get_za3lpa$(2); var id = tmp$_0.match.groupValues.get_za3lpa$(3); var tmp$_4 = provider.length === 0; if (tmp$_4) { tmp$_4 = hostname.length === 0; }if (tmp$_4) { var default_0 = first(DEFAULT_PROVIDERS); $this.provider = default_0.provider; $this.hostname = default_0.hostname; } else { if (provider.length === 0 || equals(provider, 'git')) { var $receiver = DEFAULT_PROVIDERS; var firstOrNull$result; firstOrNull$break: do { var tmp$_5; for (tmp$_5 = 0; tmp$_5 !== $receiver.length; ++tmp$_5) { var element = $receiver[tmp$_5]; var tmp$_6, tmp$_7; if (equals((tmp$_6 = hostnameRegex.find_905azu$(element.hostname)) != null ? tmp$_6.value : null, (tmp$_7 = hostnameRegex.find_905azu$(hostname)) != null ? tmp$_7.value : null)) { firstOrNull$result = element; break firstOrNull$break; }} firstOrNull$result = null; } while (false); tmp$_1 = firstOrNull$result; if (tmp$_1 == null) { throw RuntimeException_init("GIT-REST: Unable to find a default provider for '" + str + "'"); }var default_1 = tmp$_1; $this.provider = default_1.provider; $this.hostname = default_1.hostname; } else { if (hostname.length === 0) { var $receiver_0 = DEFAULT_PROVIDERS; var firstOrNull$result_0; firstOrNull$break: do { var tmp$_8; for (tmp$_8 = 0; tmp$_8 !== $receiver_0.length; ++tmp$_8) { var element_0 = $receiver_0[tmp$_8]; if (equals(element_0.provider, provider)) { firstOrNull$result_0 = element_0; break firstOrNull$break; }} firstOrNull$result_0 = null; } while (false); tmp$_2 = firstOrNull$result_0; if (tmp$_2 == null) { throw RuntimeException_init("GIT-REST: Unable to find a default context for '" + str + "'"); }var default_2 = tmp$_2; $this.provider = provider; $this.hostname = default_2.hostname; } else { var $receiver_1 = DEFAULT_PROVIDERS; var firstOrNull$result_1; firstOrNull$break: do { var tmp$_9; for (tmp$_9 = 0; tmp$_9 !== $receiver_1.length; ++tmp$_9) { var element_1 = $receiver_1[tmp$_9]; var tmp$_10, tmp$_11; if (equals(element_1.provider, provider) && equals((tmp$_10 = hostnameRegex.find_905azu$(element_1.hostname)) != null ? tmp$_10.value : null, (tmp$_11 = hostnameRegex.find_905azu$(hostname)) != null ? tmp$_11.value : null)) { firstOrNull$result_1 = element_1; break firstOrNull$break; }} firstOrNull$result_1 = null; } while (false); var default_3 = firstOrNull$result_1; $this.provider = provider; $this.hostname = (tmp$_3 = default_3 != null ? default_3.hostname : null) != null ? tmp$_3 : hostname; } } } $this.id = id; return $this; } function Repo() { DelegateResource.call(this); this.description_eirp3i$_0 = null; this.url_eun8ip$_0 = null; this.websiteUrl_dmzd2q$_0 = null; this.gitUrlHttp_hdynwf$_0 = null; this.gitUrlSsh_ivwby5$_0 = null; this.license_6si5jh$_0 = null; this.defaultBranch_4ygp4l$_0 = null; } Object.defineProperty(Repo.prototype, 'description', { configurable: true, get: function () { return this.description_eirp3i$_0; } }); Object.defineProperty(Repo.prototype, 'url', { configurable: true, get: function () { return this.url_eun8ip$_0; } }); Object.defineProperty(Repo.prototype, 'websiteUrl', { configurable: true, get: function () { return this.websiteUrl_dmzd2q$_0; } }); Object.defineProperty(Repo.prototype, 'gitUrlHttp', { configurable: true, get: function () { return this.gitUrlHttp_hdynwf$_0; } }); Object.defineProperty(Repo.prototype, 'gitUrlSsh', { configurable: true, get: function () { return this.gitUrlSsh_ivwby5$_0; } }); Object.defineProperty(Repo.prototype, 'license', { configurable: true, get: function () { return this.license_6si5jh$_0; } }); Object.defineProperty(Repo.prototype, 'defaultBranch', { configurable: true, get: function () { return this.defaultBranch_4ygp4l$_0; } }); Repo.prototype.setId_qtmmzu$ = function (providerString) { var tmp$; DelegateResource.prototype.setId_qtmmzu$.call(this, providerString); (tmp$ = this.license) != null ? (tmp$.setId_qtmmzu$(providerString), Unit) : null; }; Repo.prototype.getRawFileUrl_puj7f4$$default = function (branchName, filePath) { return null; }; Repo.prototype.getRawFileUrl_puj7f4$ = function (branchName, filePath, callback$default) { if (branchName === void 0) branchName = ensureNotNull(this.defaultBranch); return callback$default ? callback$default(branchName, filePath) : this.getRawFileUrl_puj7f4$$default(branchName, filePath); }; Repo.$metadata$ = { kind: Kind_CLASS, simpleName: 'Repo', interfaces: [DelegateResource] }; function UrlType(prefix, separator) { this.prefix = prefix; this.separator = separator; } UrlType.prototype.getUrl_puj7f4$ = function (hostname, path) { return this.prefix + hostname + this.separator + path; }; function UrlType$HTTP() { UrlType$HTTP_instance = this; UrlType.call(this, 'http://', '/'); } UrlType$HTTP.$metadata$ = { kind: Kind_OBJECT, simpleName: 'HTTP', interfaces: [UrlType] }; var UrlType$HTTP_instance = null; function UrlType$HTTP_getInstance() { if (UrlType$HTTP_instance === null) { new UrlType$HTTP(); }return UrlType$HTTP_instance; } function UrlType$HTTPS() { UrlType$HTTPS_instance = this; UrlType.call(this, 'https://', '/'); } UrlType$HTTPS.$metadata$ = { kind: Kind_OBJECT, simpleName: 'HTTPS', interfaces: [UrlType] }; var UrlType$HTTPS_instance = null; function UrlType$HTTPS_getInstance() { if (UrlType$HTTPS_instance === null) { new UrlType$HTTPS(); }return UrlType$HTTPS_instance; } function UrlType$SSH() { UrlType$SSH_instance = this; UrlType.call(this, 'git@', ':'); } UrlType$SSH.$metadata$ = { kind: Kind_OBJECT, simpleName: 'SSH', interfaces: [UrlType] }; var UrlType$SSH_instance = null; function UrlType$SSH_getInstance() { if (UrlType$SSH_instance === null) { new UrlType$SSH(); }return UrlType$SSH_instance; } UrlType.$metadata$ = { kind: Kind_CLASS, simpleName: 'UrlType', interfaces: [] }; function User() { DelegateResource.call(this); this.name_p9le18$_0 = null; this.url_33p196$_0 = null; this.avatarUrl_q68x0f$_0 = null; this.websiteUrl_beuvqt$_0 = null; this.email_6073dz$_0 = null; this.bio_341clv$_0 = null; } Object.defineProperty(User.prototype, 'name', { configurable: true, get: function () { return this.name_p9le18$_0; } }); Object.defineProperty(User.prototype, 'url', { configurable: true, get: function () { return this.url_33p196$_0; } }); Object.defineProperty(User.prototype, 'avatarUrl', { configurable: true, get: function () { return this.avatarUrl_q68x0f$_0; } }); Object.defineProperty(User.prototype, 'websiteUrl', { configurable: true, get: function () { return this.websiteUrl_beuvqt$_0; } }); Object.defineProperty(User.prototype, 'email', { configurable: true, get: function () { return this.email_6073dz$_0; } }); Object.defineProperty(User.prototype, 'bio', { configurable: true, get: function () { return this.bio_341clv$_0; } }); User.$metadata$ = { kind: Kind_CLASS, simpleName: 'User', interfaces: [DelegateResource] }; function get$lambda($receiver) { return Unit; } function GiteaProvider(client) { GiteaProvider$Companion_getInstance(); if (client === void 0) client = HttpClient(); this.client = client; } function Coroutine$getUser_61zpoe$($this, str_0, continuation_0) { CoroutineImpl.call(this, continuation_0); this.exceptionState_0 = 6; this.$this = $this; this.local$response = void 0; this.local$str = str_0; } Coroutine$getUser_61zpoe$.$metadata$ = { kind: Kotlin.Kind.CLASS, simpleName: null, interfaces: [CoroutineImpl] }; Coroutine$getUser_61zpoe$.prototype = Object.create(CoroutineImpl.prototype); Coroutine$getUser_61zpoe$.prototype.constructor = Coroutine$getUser_61zpoe$; Coroutine$getUser_61zpoe$.prototype.doResume = function () { do try { switch (this.state_0) { case 0: var $receiver_0 = this.$this.client; var urlString = 'api/v1/users/' + this.local$str; var host_0; var body_0; host_0 = 'localhost'; body_0 = utils.EmptyContent; var $receiver_1 = new HttpRequestBuilder_init(); url($receiver_1, 'http', host_0, 0, '/'); $receiver_1.method = HttpMethod.Companion.Get; $receiver_1.body = body_0; takeFrom($receiver_1.url, urlString); get$lambda($receiver_1); var $this_0 = new HttpStatement_init($receiver_1, $receiver_0); var tmp$_4, tmp$_5, tmp$_6; tmp$_4 = getKClass(GiteaUser); if (equals(tmp$_4, getKClass(HttpStatement_init))) { this.result_0 = (tmp$_5 = $this_0) == null || Kotlin.isType(tmp$_5, GiteaUser) ? tmp$_5 : throwCCE(); this.state_0 = 9; continue; } else { if (equals(tmp$_4, getKClass(HttpResponse))) { this.state_0 = 7; this.result_0 = $this_0.execute(this); if (this.result_0 === COROUTINE_SUSPENDED) return COROUTINE_SUSPENDED; continue; } else { this.state_0 = 1; this.result_0 = $this_0.executeUnsafe(this); if (this.result_0 === COROUTINE_SUSPENDED) return COROUTINE_SUSPENDED; continue; } } case 1: this.local$response = this.result_0; this.exceptionState_0 = 4; var tmp$_7; var tmp$_8 = this.local$response.call; var typeInfo$result_0; typeInfo$break: do { try { typeInfo$result_0 = new TypeInfo_init(getKClass(GiteaUser), call.JsType, createKType(getKClass(GiteaUser), [], true)); } catch (_) { typeInfo$result_0 = new TypeInfo_init(getKClass(GiteaUser), call.JsType); break typeInfo$break; } } while (false); this.state_0 = 2; this.result_0 = tmp$_8.receive_jo9acv$(typeInfo$result_0, this); if (this.result_0 === COROUTINE_SUSPENDED) return COROUTINE_SUSPENDED; continue; case 2: this.result_0 = (tmp$_7 = this.result_0) == null || Kotlin.isType(tmp$_7, GiteaUser) ? tmp$_7 : throwCCE(); this.exceptionState_0 = 6; this.finallyPath_0 = [3]; this.state_0 = 5; continue; case 3: this.state_0 = 8; continue; case 4: this.finallyPath_0 = [6]; this.state_0 = 5; continue; case 5: this.exceptionState_0 = 6; complete(this.local$response); this.state_0 = this.finallyPath_0.shift(); continue; case 6: throw this.exception_0; case 7: this.result_0 = (tmp$_6 = this.result_0) == null || Kotlin.isType(tmp$_6, GiteaUser) ? tmp$_6 : throwCCE(); this.state_0 = 8; continue; case 8: this.state_0 = 9; continue; case 9: this.result_0; return this.result_0; default:this.state_0 = 6; throw new Error('State Machine Unreachable execution'); } } catch (e) { if (this.state_0 === 6) { this.exceptionState_0 = this.state_0; throw e; } else { this.state_0 = this.exceptionState_0; this.exception_0 = e; } } while (true); }; GiteaProvider.prototype.getUser_61zpoe$ = function (str_0, continuation_0, suspended) { var instance = new Coroutine$getUser_61zpoe$(this, str_0, continuation_0); if (suspended) return instance; else return instance.doResume(null); }; function Coroutine$getRepo_61zpoe$($this, str_0, continuation_0) { CoroutineImpl.call(this, continuation_0); this.exceptionState_0 = 6; this.$this = $this; this.local$response = void 0; this.local$str = str_0; } Coroutine$getRepo_61zpoe$.$metadata$ = { kind: Kotlin.Kind.CLASS, simpleName: null, interfaces: [CoroutineImpl] }; Coroutine$getRepo_61zpoe$.prototype = Object.create(CoroutineImpl.prototype); Coroutine$getRepo_61zpoe$.prototype.constructor = Coroutine$getRepo_61zpoe$; Coroutine$getRepo_61zpoe$.prototype.doResume = function () { do try { switch (this.state_0) { case 0: var $receiver_0 = this.$this.client; var urlString = 'api/v1/repos/' + this.local$str; var host_0; var body_0; host_0 = 'localhost'; body_0 = utils.EmptyContent; var $receiver_1 = new HttpRequestBuilder_init(); url($receiver_1, 'http', host_0, 0, '/'); $receiver_1.method = HttpMethod.Companion.Get; $receiver_1.body = body_0; takeFrom($receiver_1.url, urlString); get$lambda($receiver_1); var $this_0 = new HttpStatement_init($receiver_1, $receiver_0); var tmp$_4, tmp$_5, tmp$_6; tmp$_4 = getKClass(GiteaRepo); if (equals(tmp$_4, getKClass(HttpStatement_init))) { this.result_0 = (tmp$_5 = $this_0) == null || Kotlin.isType(tmp$_5, GiteaRepo) ? tmp$_5 : throwCCE(); this.state_0 = 9; continue; } else { if (equals(tmp$_4, getKClass(HttpResponse))) { this.state_0 = 7; this.result_0 = $this_0.execute(this); if (this.result_0 === COROUTINE_SUSPENDED) return COROUTINE_SUSPENDED; continue; } else { this.state_0 = 1; this.result_0 = $this_0.executeUnsafe(this); if (this.result_0 === COROUTINE_SUSPENDED) return COROUTINE_SUSPENDED; continue; } } case 1: this.local$response = this.result_0; this.exceptionState_0 = 4; var tmp$_7; var tmp$_8 = this.local$response.call; var typeInfo$result_0; typeInfo$break: do { try { typeInfo$result_0 = new TypeInfo_init(getKClass(GiteaRepo), call.JsType, createKType(getKClass(GiteaRepo), [], true)); } catch (_) { typeInfo$result_0 = new TypeInfo_init(getKClass(GiteaRepo), call.JsType); break typeInfo$break; } } while (false); this.state_0 = 2; this.result_0 = tmp$_8.receive_jo9acv$(typeInfo$result_0, this); if (this.result_0 === COROUTINE_SUSPENDED) return COROUTINE_SUSPENDED; continue; case 2: this.result_0 = (tmp$_7 = this.result_0) == null || Kotlin.isType(tmp$_7, GiteaRepo) ? tmp$_7 : throwCCE(); this.exceptionState_0 = 6; this.finallyPath_0 = [3]; this.state_0 = 5; continue; case 3: this.state_0 = 8; continue; case 4: this.finallyPath_0 = [6]; this.state_0 = 5; continue; case 5: this.exceptionState_0 = 6; complete(this.local$response); this.state_0 = this.finallyPath_0.shift(); continue; case 6: throw this.exception_0; case 7: this.result_0 = (tmp$_6 = this.result_0) == null || Kotlin.isType(tmp$_6, GiteaRepo) ? tmp$_6 : throwCCE(); this.state_0 = 8; continue; case 8: this.state_0 = 9; continue; case 9: this.result_0; return this.result_0; default:this.state_0 = 6; throw new Error('State Machine Unreachable execution'); } } catch (e) { if (this.state_0 === 6) { this.exceptionState_0 = this.state_0; throw e; } else