From b379cd44aa6302f0dd81b436ad7b1a37d2d5e6bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=98=84=EC=84=B1=ED=95=84?= Date: Wed, 17 Jan 2024 18:01:06 +0900 Subject: [PATCH] =?UTF-8?q?ApiTestManager=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/static/js/APIClient.js | 201 - src/main/resources/static/js/APIScenario.js | 371 - .../static/js/APIScenarioExecutor.js | 228 - src/main/resources/static/js/APITester.js | 1171 -- src/main/resources/static/js/LayoutUtil.js | 116 - src/main/resources/static/js/docs.min.js | 24 - .../apitestmanager/6f75249988833dd9f429.ttf | 1 + .../plugins/apitestmanager/app.bundle.js | 11129 ++++++++++++++++ .../apitestmanager/css.worker.bundle.js | 749 ++ .../apitestmanager/editor.worker.bundle.js | 739 + .../apitestmanager/html.worker.bundle.js | 749 ++ .../apitestmanager/json.worker.bundle.js | 749 ++ ..._vs_basic-languages_apex_apex_js.bundle.js | 22 + ...s_basic-languages_azcli_azcli_js.bundle.js | 22 + ...sm_vs_basic-languages_bat_bat_js.bundle.js | 22 + ...s_basic-languages_bicep_bicep_js.bundle.js | 22 + ...c-languages_cameligo_cameligo_js.bundle.js | 22 + ...basic-languages_coffee_coffee_js.bundle.js | 22 + ...sm_vs_basic-languages_cpp_cpp_js.bundle.js | 22 + ...basic-languages_csharp_csharp_js.bundle.js | 22 + ...sm_vs_basic-languages_csp_csp_js.bundle.js | 22 + ...sm_vs_basic-languages_css_css_js.bundle.js | 22 + ...basic-languages_cypher_cypher_js.bundle.js | 22 + ..._vs_basic-languages_dart_dart_js.bundle.js | 22 + ...nguages_dockerfile_dockerfile_js.bundle.js | 22 + ...sm_vs_basic-languages_ecl_ecl_js.bundle.js | 22 + ...s_basic-languages_flow9_flow9_js.bundle.js | 22 + ...basic-languages_fsharp_fsharp_js.bundle.js | 22 + ..._esm_vs_basic-languages_go_go_js.bundle.js | 22 + ...sic-languages_graphql_graphql_js.bundle.js | 22 + ...sm_vs_basic-languages_hcl_hcl_js.bundle.js | 22 + ..._vs_basic-languages_html_html_js.bundle.js | 22 + ...sm_vs_basic-languages_ini_ini_js.bundle.js | 22 + ..._vs_basic-languages_java_java_js.bundle.js | 22 + ...basic-languages_kotlin_kotlin_js.bundle.js | 22 + ..._vs_basic-languages_less_less_js.bundle.js | 22 + ...s_basic-languages_lexon_lexon_js.bundle.js | 22 + ...basic-languages_liquid_liquid_js.bundle.js | 22 + ...sm_vs_basic-languages_lua_lua_js.bundle.js | 22 + ..._esm_vs_basic-languages_m3_m3_js.bundle.js | 22 + ...c-languages_markdown_markdown_js.bundle.js | 22 + ...sm_vs_basic-languages_mdx_mdx_js.bundle.js | 22 + ..._vs_basic-languages_mips_mips_js.bundle.js | 22 + ...s_basic-languages_msdax_msdax_js.bundle.js | 22 + ...uages_objective-c_objective-c_js.bundle.js | 22 + ...basic-languages_pascal_pascal_js.bundle.js | 22 + ...languages_pascaligo_pascaligo_js.bundle.js | 22 + ...sm_vs_basic-languages_pla_pla_js.bundle.js | 22 + ...nguages_powershell_powershell_js.bundle.js | 22 + ...sm_vs_basic-languages_pug_pug_js.bundle.js | 22 + ...basic-languages_python_python_js.bundle.js | 22 + ...basic-languages_qsharp_qsharp_js.bundle.js | 22 + ...or_esm_vs_basic-languages_r_r_js.bundle.js | 22 + ...s_basic-languages_redis_redis_js.bundle.js | 22 + ...ructuredtext_restructuredtext_js.bundle.js | 22 + ..._vs_basic-languages_rust_rust_js.bundle.js | 22 + ..._esm_vs_basic-languages_sb_sb_js.bundle.js | 22 + ...basic-languages_scheme_scheme_js.bundle.js | 22 + ..._vs_basic-languages_scss_scss_js.bundle.js | 22 + ...s_basic-languages_shell_shell_js.bundle.js | 22 + ...basic-languages_sophia_sophia_js.bundle.js | 22 + ...basic-languages_sparql_sparql_js.bundle.js | 22 + ...s_basic-languages_swift_swift_js.bundle.js | 22 + ...sm_vs_basic-languages_tcl_tcl_js.bundle.js | 22 + ..._vs_basic-languages_twig_twig_js.bundle.js | 22 + ...nguages_typescript_typescript_js.bundle.js | 22 + ..._esm_vs_basic-languages_vb_vb_js.bundle.js | 22 + ..._vs_basic-languages_wgsl_wgsl_js.bundle.js | 22 + ...sm_vs_basic-languages_xml_xml_js.bundle.js | 22 + ..._vs_basic-languages_yaml_yaml_js.bundle.js | 22 + .../apitestmanager/ts.worker.bundle.js | 761 ++ ..._vs_basic-languages_abap_abap_js.bundle.js | 22 + ...sic-languages_clojure_clojure_js.bundle.js | 22 + ...basic-languages_elixir_elixir_js.bundle.js | 22 + ...uages_freemarker2_freemarker2_js.bundle.js | 22 + ...nguages_handlebars_handlebars_js.bundle.js | 22 + ...nguages_javascript_javascript_js.bundle.js | 32 + ...s_basic-languages_julia_julia_js.bundle.js | 22 + ...s_basic-languages_mysql_mysql_js.bundle.js | 22 + ..._vs_basic-languages_perl_perl_js.bundle.js | 22 + ...s_basic-languages_pgsql_pgsql_js.bundle.js | 22 + ...sm_vs_basic-languages_php_php_js.bundle.js | 22 + ...c-languages_postiats_postiats_js.bundle.js | 22 + ...nguages_powerquery_powerquery_js.bundle.js | 22 + ...c-languages_protobuf_protobuf_js.bundle.js | 22 + ...s_basic-languages_razor_razor_js.bundle.js | 22 + ...c-languages_redshift_redshift_js.bundle.js | 22 + ..._vs_basic-languages_ruby_ruby_js.bundle.js | 22 + ...s_basic-languages_scala_scala_js.bundle.js | 22 + ...c-languages_solidity_solidity_js.bundle.js | 22 + ...sm_vs_basic-languages_sql_sql_js.bundle.js | 22 + ..._esm_vs_basic-languages_st_st_js.bundle.js | 22 + ...s_systemverilog_systemverilog_js.bundle.js | 22 + ...r_esm_vs_language_css_cssMode_js.bundle.js | 22 + ...esm_vs_language_html_htmlMode_js.bundle.js | 22 + ...esm_vs_language_json_jsonMode_js.bundle.js | 22 + ...vs_language_typescript_tsMode_js.bundle.js | 22 + 97 files changed, 16735 insertions(+), 2111 deletions(-) delete mode 100644 src/main/resources/static/js/APIClient.js delete mode 100644 src/main/resources/static/js/APIScenario.js delete mode 100644 src/main/resources/static/js/APIScenarioExecutor.js delete mode 100644 src/main/resources/static/js/APITester.js delete mode 100644 src/main/resources/static/js/LayoutUtil.js delete mode 100644 src/main/resources/static/js/docs.min.js create mode 100644 src/main/resources/static/plugins/apitestmanager/6f75249988833dd9f429.ttf create mode 100644 src/main/resources/static/plugins/apitestmanager/app.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/css.worker.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/editor.worker.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/html.worker.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/json.worker.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_apex_apex_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_azcli_azcli_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_bat_bat_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_bicep_bicep_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_cameligo_cameligo_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_coffee_coffee_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_cpp_cpp_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_csharp_csharp_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_csp_csp_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_css_css_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_cypher_cypher_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_dart_dart_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_dockerfile_dockerfile_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_ecl_ecl_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_flow9_flow9_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_fsharp_fsharp_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_go_go_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_graphql_graphql_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_hcl_hcl_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_html_html_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_ini_ini_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_java_java_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_kotlin_kotlin_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_less_less_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_lexon_lexon_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_liquid_liquid_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_lua_lua_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_m3_m3_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_markdown_markdown_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_mdx_mdx_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_mips_mips_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_msdax_msdax_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_objective-c_objective-c_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_pascal_pascal_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_pascaligo_pascaligo_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_pla_pla_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_powershell_powershell_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_pug_pug_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_python_python_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_qsharp_qsharp_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_r_r_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_redis_redis_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_restructuredtext_restructuredtext_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_rust_rust_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_sb_sb_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_scheme_scheme_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_scss_scss_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_shell_shell_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_sophia_sophia_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_sparql_sparql_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_swift_swift_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_tcl_tcl_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_twig_twig_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_typescript_typescript_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_vb_vb_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_wgsl_wgsl_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_xml_xml_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/node_modules_monaco-editor_esm_vs_basic-languages_yaml_yaml_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/ts.worker.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_abap_abap_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_clojure_clojure_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_elixir_elixir_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_freemarker2_freemarker2_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_handlebars_handlebars_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_javascript_javascript_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_julia_julia_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_mysql_mysql_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_perl_perl_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_pgsql_pgsql_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_php_php_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_postiats_postiats_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_powerquery_powerquery_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_protobuf_protobuf_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_razor_razor_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_redshift_redshift_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_ruby_ruby_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_scala_scala_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_solidity_solidity_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_sql_sql_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_st_st_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_basic-languages_systemverilog_systemverilog_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_language_css_cssMode_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_language_html_htmlMode_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_language_json_jsonMode_js.bundle.js create mode 100644 src/main/resources/static/plugins/apitestmanager/vendors-node_modules_monaco-editor_esm_vs_language_typescript_tsMode_js.bundle.js diff --git a/src/main/resources/static/js/APIClient.js b/src/main/resources/static/js/APIClient.js deleted file mode 100644 index ecfd7aa..0000000 --- a/src/main/resources/static/js/APIClient.js +++ /dev/null @@ -1,201 +0,0 @@ -/** - * 처리 순서 - * 1. preRequestScript 실행 -> executePreRequestScript - * 2. 변수 치환 -> replacePlaceholdersWithVariables - * 3. API 호출 -> sendAPIRequest - * 4. postRequestScript 실행 -> executePostRequestScript - */ - -class APIClient { - constructor() { - window.globals = {}; - this.variables = {}; - this.abortController = null; - } - - async sendAPIRequest(model, preProcessCallback, consoleOutput) { - try { - const updatedModel = await this.executePreRequestScript(model, consoleOutput); - let processedRequest = this.replacePlaceholdersWithVariables(updatedModel); - - if (preProcessCallback) { - preProcessCallback(processedRequest); - } - const response = await this.makeAjaxRequest(processedRequest, model, consoleOutput); - const responseData = await response.json(); // Parse the JSON response - - if (!response.ok) { - const errorMessage = responseData.error || 'Unknown error'; - throw new Error(`API 호출 중 오류가 발생했습니다. 사유[${errorMessage}]`); - } - - const finalResponse = this.formatResponse(responseData); - return this.executePostRequestScript(model.postRequestScript, finalResponse, consoleOutput) - .catch(error => { - $('.toast-body').text(error); - $('.toast').toast('show'); - return finalResponse; // Return the original response even if there's an error in the post-request script - }); - - } catch (error) { - throw error; - } - } - - formatResponse(data) { - // Format response as needed before post-request script - let response = {}; - response.body = data.body; - response.status = data.status; - response.headers = {}; - response.size = data.size; - _.forEach(data.headers, (header) => { - response.headers[header.key] = header.value; - }); - return response; - } - - abort() { - if (this.abortController) { - this.abortController.abort(); // abort the fetch - this.abortController = null; // reset the controller - } - } - - makeAjaxRequest(processedRequest, model) { - this.abortController = new AbortController(); - const {signal} = this.abortController; - - try { - return fetch('/mgmt/api/test.do', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'X-XSRF-TOKEN': $('meta[name="_csrf"]').attr('content') - }, - body: JSON.stringify(processedRequest), - signal: signal // pass the signal to the fetch - }); - } catch (error) { - if (error.name !== 'AbortError') { - console.error('Network request failed:', error); - } - throw error; - } - } - - - replacePlaceholdersWithVariables(original) { - let request = JSON.parse(JSON.stringify(original)); - - let mergedVariables = {}; - _.forEach(window.globals, (value, key) => { - mergedVariables[key] = value; - }); - - if (this.variables) { - _.forEach(this.variables, (value, key) => { - mergedVariables[key] = value; - }); - } - - _.forEach(mergedVariables, (value, key) => { - const placeholder = `{{${key}}}`; - // Replace in path - request.path = request.path.replace(new RegExp(placeholder, 'g'), value); - - // Replace in requestBody - if (request.requestBody) { - request.requestBody = request.requestBody.replace(new RegExp(placeholder, 'g'), value); - } - - // Replace in headers - if (request.headers) { - let replaced = JSON.stringify(request.headers).replace(new RegExp(placeholder, 'g'), value); - request.headers = JSON.parse(replaced); - } - - // Replace in queryParams - if (request.queryParams) { - let replaced = JSON.stringify(request.queryParams).replace(new RegExp(placeholder, 'g'), value); - request.queryParams = JSON.parse(replaced); - } - }); - - return request; - } - - - executePreRequestScript(model, consoleOutput) { - return new Promise((resolve, reject) => { - let script = model.preRequestScript; - let resultFrame = document.getElementById('preRequest'); - - this.variables = {}; - - window.preRequestComplete = (updatedModel, error) => { - if (error) { - reject(error); - } else { - resolve(updatedModel); - } - }; - - window.temp_variable = this.variables; - window.currentRequest = model; - window.consoleOutput = consoleOutput; - resultFrame.srcdoc = ``; - }); - } - - executePostRequestScript(script, response, consoleOutput) { - return new Promise((resolve, reject) => { - let resultFrame = document.getElementById('postRequest'); - window.response = response; - window.temp_variable = this.variables; - window.postRequestComplete = (response, error) => { - if (error) { - reject(error); - } else { - resolve(response); - } - }; - window.consoleOutput = consoleOutput; - resultFrame.srcdoc = ``; - }); - } -} \ No newline at end of file diff --git a/src/main/resources/static/js/APIScenario.js b/src/main/resources/static/js/APIScenario.js deleted file mode 100644 index 01a2505..0000000 --- a/src/main/resources/static/js/APIScenario.js +++ /dev/null @@ -1,371 +0,0 @@ -require.config({paths: {'vs': '/plugins/vs'}}); - -class APIScenario { - - - constructor(apiTester) { - this.scenarioList = []; - this.currentIndex = -1; - this.currentScenario = null; - this.apiTester = apiTester; - } - - init() { - console.log('init'); - this.loadScenarioList(); - require(['vs/editor/editor.main'], () => { - this.outputEditor = monaco.editor.create(document.getElementById('output'), { - value: '', - language: 'text/plain', - theme: 'vs-light', - automaticLayout: true - }); - }); - this.bindEvents(); - - let id = document.getElementById('drawflow'); - this.editor = new Drawflow(id); - this.editor.reroute = true; - this.editor.reroute_fix_curvature = true; - this.editor.force_first_input = true; - this.editor.start(); - - this.showOutput = true; - } - - loadScenarioList(callback) { - const me = this; - this.currentAjaxRequest = $.ajax({ - url: '/mgmt/api_scenario/list.do', - type: 'GET', - contentType: 'application/json', - success: function (data) { - me.scenarioList = data; - let drawflowData = {drawflow: {Home: {data: {}}}}; - data.forEach((scenario) => { - let scenarioData = null; - try { - scenarioData = JSON.parse(scenario.scenario) - } catch (e) { - scenarioData = {}; - } - drawflowData.drawflow[scenario.id] = {data: scenarioData}; - }); - - me.editor.import(drawflowData); - me.editor.changeModule('Home'); - }, - error: function (response, textStatus, errorThrown) { - me.hideLoadingOverlay(); - $('.toast-body').text(response.responseJSON.error); - $('.toast').toast('show'); - }, - complete: function () { - me.renderScenarioList(); - if (callback) { - callback(); - } - me.hideLoadingOverlay(); - } - }); - } - - getScenarioList() { - return this.scenarioList; - } - - openScenario(event) { - event.preventDefault(); - let scenarioId = $(event.target).closest('li').data('id'); - this.openScenarioById(scenarioId); - } - openScenarioById(scenarioId) { - let all = document.querySelectorAll(".api-scenario-list li"); - - for (let i = 0; i < all.length; i++) { - all[i].classList.remove('selected'); - } - - //find li by data-id and add class selected - - document.querySelector(`.api-scenario-list li[data-id="${scenarioId}"]`).classList.add('selected'); - - this.editor.changeModule(scenarioId); - this.currentScenario = scenarioId; - } - - getScenario(scenarioId) { - return this.getScenarioList().find((scenario) => scenario.id === scenarioId); - } - - showLoadingOverlay() { - $("#loading-overlay").show(); - } - - hideLoadingOverlay() { - $("#loading-overlay").hide(); - } - - showNewScenarioModal() { - $('#new_scenario_modal').find('input').val(''); - $('#new_scenario_modal').modal('show'); - } - - createScenario() { - const name = $('#new_scenario_name').val(); - const me = this; - me.showLoadingOverlay(); - this.currentAjaxRequest = $.ajax({ - url: '/mgmt/api_scenario/create.do', - type: 'POST', - contentType: 'application/json', - data: JSON.stringify({name: name, scenario: "{}", description: ""}), - success: function (data) { - me.loadScenarioList(()=> { - me.openScenarioById(data.id); - let start = ` -
-
Start
-
- `; - me.editor.addNode('Start', 0, 1, 100, 100, 'start', {}, start); - }); - }, - error: function (response, textStatus, errorThrown) { - me.hideLoadingOverlay(); - $('.toast-body').text(response.responseJSON.error); - $('.toast').toast('show'); - }, - complete: function () { - - me.hideLoadingOverlay(); - $('#new_scenario_modal').modal('hide'); - } - }); - } - - saveScenario() { - if (this.currentScenario !== null) { - let data = this.editor.export(); - console.log(data.drawflow[this.currentScenario].data); - let updatedScenario = this.getScenario(this.currentScenario); - updatedScenario.scenario = JSON.stringify(data.drawflow[this.currentScenario].data); - - const me = this; - me.showLoadingOverlay(); - this.currentAjaxRequest = $.ajax({ - url: '/mgmt/api_scenario/update.do', - type: 'POST', - contentType: 'application/json', - data: JSON.stringify(updatedScenario), - error: function (response, textStatus, errorThrown) { - me.hideLoadingOverlay(); - $('.toast-body').text(response.responseJSON.error); - $('.toast').toast('show'); - }, - complete: function () { - me.hideLoadingOverlay(); - $('.toast-body').text('저장되었습니다.'); - $('.toast').toast('show'); - } - }); - } - } - - showDeleteModal(event) { - const id = $(event.currentTarget).closest('li').data('id'); - $('#confirm_delete_scenario_modal').find('.confirm_delete_scenario').data('id', id); - $('#confirm_delete_scenario_modal').modal('show'); - } - - removeScenario(event) { - const id = $(event.currentTarget).data('id'); - const me = this; - me.showLoadingOverlay(); - this.currentAjaxRequest = $.ajax({ - url: '/mgmt/api_scenario/delete.do', - type: 'POST', - contentType: 'application/json', - data: JSON.stringify({id: id}), - error: function (response, textStatus, errorThrown) { - me.hideLoadingOverlay(); - $('.toast-body').text(response.responseJSON.error); - $('.toast').toast('show'); - }, - complete: function () { - me.hideLoadingOverlay(); - $('#confirm_delete_scenario_modal').modal('hide'); - $('.toast-body').text('삭제되었습니다.'); - $('.toast').toast('show'); - me.editor.changeModule('Home'); - me.loadScenarioList(); - } - }); - } - - toggleOutput() { - // Define your selectors as constants for easy changes and better readability - const scenarioContentSelector = '.api-scenario-content'; - const scenarioOutputSelector = '.api-scenario-output'; - const scenarioOutputBodySelector = '.api-scenario-output-body'; - const drawflowSelector = '#drawflow'; - const scenarioEditorSelector = '.scenario_editor'; - - // Ensure parentHeight is a number - let parentHeight = parseInt($(scenarioContentSelector).css('height'), 10); - - // Toggle the showOutput state - this.showOutput = !this.showOutput; - - if (!this.showOutput) { - $(scenarioOutputSelector).css('flex', '0'); - $(scenarioOutputBodySelector).hide(); - - let editorHeight = $(scenarioEditorSelector).css('height'); - $(drawflowSelector).css('height', editorHeight); - $(scenarioOutputSelector).removeClass('halfHeight'); - $(drawflowSelector).removeClass('halfHeight'); - } else { - $(scenarioOutputSelector).css('flex', '1'); - $(scenarioOutputSelector).addClass('halfHeight'); - $(scenarioOutputBodySelector).show(); - $(drawflowSelector).addClass('halfHeight'); - $(drawflowSelector).css('height', parentHeight / 2); - } - - // Adjustments for when parentHeight isn't a valid number - if (isNaN(parentHeight)) { - console.error('parentHeight is not a number. Check the height of the api-scenario-content element.'); - // Fallback or additional error handling can be placed here - } - } - - - resizeEditor() { - //FIXME: 창 크기 변경시 자동으로 editor 크기가 조정되지 않아서, 0으로 강제 변경후 다시 layout() 호출 - this.outputEditor.layout({ - width: 0 - }); - this.outputEditor.layout({}); - - } - - runScript() { - console.log(this.editor.export().drawflow); - let graph = APIScenarioExecutor.extractGraphFromStart(this.editor.export().drawflow[this.currentScenario].data); - this.executor = new APIScenarioExecutor(graph, this.apiTester, this.outputEditor); - } - - runScenarioAll() { - if (!this.executor) { - this.runScript(); - } - if (!this.executor.isDone) { - this.executor.executeAll(); - } else { - this.executor.reset(); - } - } - - - runScenarioStep() { - if (!this.executor) { - this.runScript(); - } - if (!this.executor.isDone) { - this.executor.executeCurrentNode(); - this.executor.moveToNextNode(); - } else { - this.executor.reset(); - } - - } - - resetScenario() { - - } - - pauseScenario() { - - } - - stopScenario() { - if (this.executor) - this.executor.reset(); - this.outputEditor.setValue(''); - } - - addStart() { - let start = ` -
-
Start
-
- `; - this.editor.addNode('Start', 0, 1, 100, 100, 'start', {}, start); - } - - bindEvents() { - const events = [ - {type: 'click', selector: '.open_scenario', action: this.openScenario.bind(this)}, - {type: 'click', selector: '.export', action: this.runScript.bind(this)}, - {type: 'click', selector: '.toggle_output', action: this.toggleOutput.bind(this)}, - {type: 'click', selector: '.run_scenario_step', action: this.runScenarioStep.bind(this)}, - {type: 'click', selector: '.run_scenario_all', action: this.runScenarioAll.bind(this)}, - {type: 'click', selector: '.reset_scenario', action: this.resetScenario.bind(this)}, - {type: 'click', selector: '.pause_scenario', action: this.pauseScenario.bind(this)}, - {type: 'click', selector: '.stop_scenario', action: this.stopScenario.bind(this)}, - {type: 'click', selector: '#new_scenario', action: this.showNewScenarioModal.bind(this)}, - {type: 'click', selector: '.create_scenario', action: this.createScenario.bind(this)}, - {type: 'click', selector: '.save_scenario', action: this.saveScenario.bind(this)}, - // {type: 'click', selector: '.add_start', action: this.addStart.bind(this)}, - {type: 'click', selector: '.delete_scenario', action: this.showDeleteModal.bind(this)}, - {type: 'click', selector: '.confirm_delete_scenario', action: this.removeScenario.bind(this)}, - {type: 'click', selector: '.stop_scenario', action: this.stopScenario.bind(this)} - ]; - - for (let event of events) { - $(document).on(event.type, event.selector, event.action); - } - - window.addEventListener('resize', this.resizeEditor.bind(this)); - var me = this; - - $('#drawflow').droppable({ - drop: function (event, ui) { - const x = ui.offset.left - $(this).offset().left; - const y = ui.offset.top - $(this).offset().top; - - const dataset = ui.draggable[0].dataset; - var node = `
API
${dataset.name}
`; - - me.editor.addNode(dataset.name, 1, 1, x, y, dataset.nodeType, dataset, node); - } - }); - } - - scenarioListTemplate(scenario) { - return ` -
  • - ${scenario.name} -
    - - -
    -
  • - `; - } - - renderScenarioList() { - let scenarioList = this.getScenarioList(); - let scenarioListHtml = scenarioList.map((scenario) => this.scenarioListTemplate(scenario)).join(''); - $('.api-scenario-list').html(scenarioListHtml); - let nodes = document.querySelectorAll(".api-scenario-list li"); - nodes.forEach((node) => { - if ($(node).data('id') === this.currentScenario) { - node.classList.add('selected'); - } - }); - } - - -} \ No newline at end of file diff --git a/src/main/resources/static/js/APIScenarioExecutor.js b/src/main/resources/static/js/APIScenarioExecutor.js deleted file mode 100644 index cd9f9e4..0000000 --- a/src/main/resources/static/js/APIScenarioExecutor.js +++ /dev/null @@ -1,228 +0,0 @@ -class APIScenarioExecutor { - constructor(graph, apiTester, outputEditor) { - this.graph = graph; // The graph data - this.apiClient = new APIClient(); - this.apiTester = apiTester; - this.outputEditor = outputEditor; - this.reset(); - } - - // Helper method to find the start node ID - findStartNodeId() { - for (let nodeId in this.graph) { - if (this.graph[nodeId].class === 'start') { - return nodeId; - } - } - return null; // Return null if no start node is found - } - - reset() { - this.currentNodeId = this.findStartNodeId(); // Initialize at the 'start' node - this.visitedNodes = new Set(); // Keep track of visited nodes - this.isRunning = false; - this.isDone = false; - - let allNodes = document.querySelector('#drawflow').querySelectorAll('.drawflow-node'); - allNodes.forEach(node => { - node.classList.remove('current-execution'); - node.classList.remove('result-success'); - node.classList.remove('result-error'); - node.classList.remove('result-abort'); - }); - } - - executeCurrentNode() { - return new Promise((resolve, reject) => { - console.log(this.currentNodeId) - - let allNodes = document.querySelector('#drawflow').querySelectorAll('.drawflow-node'); - allNodes.forEach(node => { - node.classList.remove('current-execution'); - }); - - if (!this.currentNodeId) { - console.log('No current node to execute.'); - return; - } - - const currentNode = this.graph[this.currentNodeId]; - - if (currentNode) { - this.isRunning = true; - this.visitedNodes.add(this.currentNodeId); // Mark this node as visited - - let nodeElement = document.querySelector('#drawflow').querySelector(`.drawflow-node[id="node-${this.currentNodeId}"]`); - if (nodeElement) { - nodeElement.classList.add('current-execution'); - } else { - console.error('Node with ID ' + this.currentNodeId + ' not found'); - } - - if (currentNode.class === 'api') { - let model = JSON.parse(JSON.stringify(this.apiTester.getApiRequestModel(currentNode.data.id))); - model.responseModel = {}; - this.appendLog(`Executing API [${model.name}]`); - this.apiClient.sendAPIRequest(model, this.logHttpRequest.bind(this)) - .then(response => { - this.isRunning = false; - this.logHttpResponse(response); - if (response.status === 200 || response.status === 201) { - nodeElement.classList.add('result-success'); - } else { - nodeElement.classList.add('result-error'); - } - resolve(); - }) - .catch(error => { - nodeElement.classList.add('result-abort'); - $('.toast-body').text(error.message); - $('.toast').toast('show'); - this.appendLog(error.message); - reject(error); - }); - console.log(`Executing API request for node: ${currentNode.id} - ${currentNode.name}`); - } else if (currentNode.class === 'start') { - this.appendLog('Starting API scenario\n'); - nodeElement.classList.add('result-success'); - resolve(); - } else { - console.log(`Executing script for node: ${currentNode.id} - ${currentNode.name}`); - resolve(); - } - - } - }); - - } - - appendLog(text) { - var range = new monaco.Range(this.outputEditor.getModel().getLineCount(), 1, this.outputEditor.getModel().getLineCount(), 1); - var id = {major: 1, minor: 1}; - var op = {identifier: id, range: range, text: text + '\n', forceMoveMarkers: true}; - this.outputEditor.executeEdits("my-source", [op]); - } - - logHttpRequest(model) { - console.log(model); - let log = `[API Request]\n${model.method} ${model.path} HTTP/1.1\n[Request Headers]\n${this.parseRequestHeaders(model.headers)}\n[Request Body]\n${model.requestBody}`; - this.appendLog(log); - } - - logHttpResponse(response) { - let log = `[Response]\nHTTP/1.1 ${response.status}\n[Response Headers]\n${this.parseHeaders(response.headers)}\n[Response Body]\n${response.body}`; - this.appendLog(log); - } - - parseRequestHeaders(headers) { - let parsedHeaders = ''; - headers.forEach(header => { - if (header.enabled){ - parsedHeaders += `${header.key}: ${header.value}\n`; - } - }); - - - return parsedHeaders; - } - - parseHeaders(headers) { - //convert object to string with \n separation - //sort header by key - - let parsedHeaders = ''; - const sortedKeys = Object.keys(headers).sort(); // Sorting the keys alphabetically - sortedKeys.forEach(key => { - parsedHeaders += `${key}: ${headers[key]}\n`; - }); - return parsedHeaders; - } - - - // Method to move to the next node - moveToNextNode() { - const currentNode = this.graph[this.currentNodeId]; - console.log(currentNode); - - if (currentNode && currentNode.connections.length > 0) { - // Find the next unvisited node - const nextNode = currentNode.connections.find(nodeId => !this.visitedNodes.has(nodeId)); - if (nextNode) { - this.currentNodeId = nextNode; - } else { - console.log('No more unvisited connections to move to.'); - this.currentNodeId = null; // No more nodes to visit - } - } else { - console.log('Current node has no connections or does not exist.'); - this.currentNodeId = null; // No more nodes to visit - this.isDone = true; - } - } - - async executeAll() { - while (this.currentNodeId) { - console.log(this.currentNodeId); - try { - await this.executeCurrentNode(); - } catch (error) { - console.error('Error executing node: ', error); - // Handle error or break loop if necessary - } - await this.moveToNextNodeWithDelay(250); - } - console.log('Completed execution of all API nodes.'); - } - - moveToNextNodeWithDelay(delay) { - return new Promise(resolve => { - setTimeout(() => { - this.moveToNextNode(); - resolve(); - }, delay); - }); - } - - static extractGraphFromStart(graphData) { - console.log(graphData) - let graph = {}; - - // Helper function to recursively build the graph - function buildGraph(nodeId) { - const node = graphData[nodeId]; - if (!node || graph[nodeId]) { - // If the node doesn't exist or has already been visited, stop the recursion - return; - } - - // Initialize the node in the graph - graph[nodeId] = { - id: node.id, - name: node.name, - class: node.class, - data: node.data, - connections: [] - }; - - // If the node has outputs, recursively add connected nodes - if (node.outputs) { - Object.values(node.outputs).forEach(output => { - output.connections.forEach(connection => { - graph[nodeId].connections.push(connection.node); - buildGraph(connection.node); // Recurse - }); - }); - } - } - - // Find the start node - for (let nodeId in graphData) { - if (graphData[nodeId].class === 'start') { - buildGraph(nodeId); // Start building the graph from the 'start' node - break; // Assuming there's only one start node - } - } - - return graph; - } -} \ No newline at end of file diff --git a/src/main/resources/static/js/APITester.js b/src/main/resources/static/js/APITester.js deleted file mode 100644 index f5df96f..0000000 --- a/src/main/resources/static/js/APITester.js +++ /dev/null @@ -1,1171 +0,0 @@ -require.config({paths: {'vs': '/plugins/vs'}}); - - -class APITester { - - constructor() { - this.servers = []; - this.apiTabTitleTarget = '#apiRequestTabTitle'; - this.apiTabContentTarget = '#apiRequestTabContent'; - this.collectionTarget = '#side_menubar'; - this.currentIndex = 0; - this.apiRequests = []; //탭 열린 API - this.collections = []; //API 컬렉션 - this.requestEditors = []; //API request body editor - this.responseEditors = []; //API response body editor - this.consoleEditors = []; //API console editor - this.preRequestEditors = []; - this.postRequestEditors = []; - - this.apiClient = new APIClient(); - } - - renderServers(selectedServer) { - const optionsHtml = this.servers.map(server => ` - - `).join(''); - - return ``; - } - - basePath(serverId) { - if (serverId === undefined || serverId === null) { - return this.servers[0].basePath; - } - return this.servers.filter(server => server.id == serverId)[0].basePath; // == : 타입 비교 없이 값만 비교 - } - - apiRequestTemplate(apiRequest, index) { - return ` -
    -
    ${apiRequest.collectionName} > ${apiRequest.name}
    -
    -
    - - -
    -
    - ${this.renderServers(apiRequest.server)} - -
    -
    -
    - - -
    -
    -
    -
    - - -
    - -
    - -
    - -
    -
    - - - - - - - - - - - ${this.renderParams(apiRequest.queryParams)} - -
    #이름 - -
    -
    -
    - - - - - - - - - - - ${this.renderHeaders(apiRequest.headers)} - -
    #이름 - -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - Response - - - -
    - -
    -
    -
    -
    -
    - - - - - - - - - -
    이름
    -
    -
    -
    -
    -
    -
    - `; - } - - queryParamTemplate(queryParam, index) { - return ` - - -
    - -
    - - - - - - - - - - - - `; - } - - headerTemplate(header, index) { - return ` - - -
    - -
    - - - - - - - - - - - - `; - } - - responseHeaderTemplate(key, value) { - return ` - - - - - - - - - `; - } - - collectionTemplate(collection, index) { - return ` -
  • -
    - -
    - - -
    -
    -
    -
      - ${collection.apis.map((api, apiIndex) => this.collectionApiTemplate(api, apiIndex, collection.id)).join('')} -
    -
    -
  • - `; - } - - collectionApiTemplate(api, apiIndex, collectionId) { - return ` -
  • - ${api.name} -
    - - -
    -
  • - `; - } - - init(servers) { - if (servers) { - this.servers = servers; - if (this.servers.length === 0) { - $('.toast-body').text('서버관리에서 서버를 등록해주세요.'); - $('.toast').toast('show'); - } - } - this.bindEvents(); - this.loadCollections(); - } - - bindEvents() { - const events = [ - {selector: '.btn_add_header', action: this.addHeader.bind(this)}, - {selector: '.btn_remove_header', action: this.removeHeader.bind(this)}, - {selector: '.btn_add_query', action: this.addQueryParam.bind(this)}, - {selector: '.btn_remove_query', action: this.removeQueryParam.bind(this)}, - {selector: '.send', action: this.handleSendAPIRequest.bind(this)}, - {selector: '.save', action: this.saveAPIRequest.bind(this)}, - {selector: '.save_collection', action: this.addCollection.bind(this)}, - {selector: '#cancel-ajax', action: this.cancelAjaxRequest.bind(this)}, - {selector: '#new_collection', action: this.showNewCollectionModal.bind(this)}, - {selector: '#new_request', action: this.showNewApiRequestModal.bind(this)}, - {selector: '.edit_collection', action: this.showCollectionEditModal.bind(this)}, - {selector: '.delete_collection', action: this.showCollectionDeleteModal.bind(this)}, - {selector: '.confirm_delete', action: this.removeCollection.bind(this)}, - {selector: '.add_new_request', action: this.addAPIRequest.bind(this)}, - {selector: '.edit_api_request', action: this.showEditNameModal.bind(this)}, - {selector: '.delete_api_request', action: this.showDeleteApiRequestModal.bind(this)}, - {selector: '.open_api_request', action: this.openApiRequest.bind(this)}, - {selector: '.confirm_delete_api', action: this.deleteApiRequest.bind(this)}, - {selector: '.close_tab', action: this.closeTab.bind(this)} - - ]; - - for (let event of events) { - $(document).on('click', event.selector, event.action); - } - - $(document).on('input', '.query_params input', this.handleUIUpdate.bind(this)); - $(document).on('input', '.query_params input', this.buildPath.bind(this)); - $(document).on('change', '.query_params input', this.handleUIUpdate.bind(this)); - $(document).on('change', '.query_params input', this.buildPath.bind(this)); - $(document).on('input', '.path', this.parseParam.bind(this)); - $(document).on('change', '.request_headers input', this.handleUIUpdate.bind(this)); - $(document).on('change', '.api_request_info select, .api_request_info input', this.handleUIUpdate.bind(this)); - $(document).on('change', '.api_request_info select', this.handleUpdateServer.bind(this)); - - window.addEventListener('resize', this.resizeEditor.bind(this)); - - - } - - resizeEditor() { - //FIXME: 창 크기 변경시 자동으로 editor 크기가 조정되지 않아서, 0으로 강제 변경후 다시 layout() 호출 - - for (let i = 0; i < this.requestEditors.length; i++) { - this.requestEditors[i].layout({ - width: 0 - }); - } - for (let i = 0; i < this.responseEditors.length; i++) { - this.responseEditors[i].layout({ - width: 0 - }); - } - for (let i = 0; i < this.preRequestEditors.length; i++) { - this.preRequestEditors[i].layout({ - width: 0 - }); - } - for (let i = 0; i < this.postRequestEditors.length; i++) { - this.postRequestEditors[i].layout({ - width: 0 - }); - } - - for (let i = 0; i < this.requestEditors.length; i++) { - this.requestEditors[i].layout({}); - } - for (let i = 0; i < this.responseEditors.length; i++) { - this.responseEditors[i].layout({}); - } - for (let i = 0; i < this.preRequestEditors.length; i++) { - this.preRequestEditors[i].layout({}); - } - for (let i = 0; i < this.postRequestEditors.length; i++) { - this.postRequestEditors[i].layout({}); - } - - } - - showCollectionDeleteModal(event) { - const collectionId = $(event.currentTarget).closest('button').data('collection'); - $('#confirm_delete_modal').find('.confirm_delete').data('id', collectionId); - $('#confirm_delete_modal').modal('show'); - } - - getApiRequestModel(apiId) { - let foundApi = null; - this.collections.forEach(function (collection) { - collection.apis.forEach(function (api) { - if (api.id === apiId) { - foundApi = api; - } - }); - }); - - return foundApi; - } - - showCollectionEditModal(event) { - const me = this; - const collectionId = $(event.currentTarget).closest('button').data('collection'); - const collection = this.collections.filter(function (collection) { - return collection.id === collectionId; - })[0]; - - $('#edit_name_modal').find('input').val(''); - $('#edit_name_modal').modal('show'); - - let saveBtn = $('#edit_name_modal').find('button.change_name'); - saveBtn.off('click'); - - saveBtn.on('click', function () { - collection.name = $('#edit_name_modal').find('input').val(); - me.saveCollection(collection.id, collection.name); - me.renderCollections(); - $('#edit_name_modal').modal('hide'); - }); - } - - showDeleteApiRequestModal(event) { - let collectionId = $(event.currentTarget).closest('li').data('collection'); - let apiId = $(event.currentTarget).closest('li').data('id'); - $('#confirm_delete_api_modal').find('.confirm_delete_api').data('id', apiId); - $('#confirm_delete_api_modal').find('.confirm_delete_api').data('collection', collectionId); - $('#confirm_delete_api_modal').modal('show'); - } - - showNewApiRequestModal(event) { - if (this.collections.length == 0) { - $('.toast-body').text('새로운 컬렉션을 추가해 주세요.'); - $('.toast').toast('show'); - return; - } - $('#new_api_request_modal').modal('show'); - } - - showNewCollectionModal(event) { - $('#new_collection_modal').find('input').val(''); - $('#new_collection_modal').modal('show'); - } - - showEditNameModal(event) { - const me = this; - const apiId = $(event.currentTarget).closest('li').data('id'); - const collectionId = $(event.currentTarget).closest('li').data('collection'); - - const collection = this.collections.filter(function (collection) { - return collection.id === collectionId; - })[0]; - - let apiRequest = collection.apis.filter(function (api) { - return api.id === apiId; - })[0]; - - apiRequest.collectionId = collectionId; - - let saveBtn = $('#edit_name_modal').find('button.change_name'); - saveBtn.off('click'); - saveBtn.on('click', function () { - apiRequest.name = $('#edit_name_modal').find('input').val(); - me.changeAPIName(apiRequest); - me.renderCollections(); - $('#edit_name_modal').modal('hide'); - - //탭이 열려 있으면, 닫았다가 다시 열어야 함. - me.renderTabHeader(); - me.renderTabContent(apiRequest.index); - - }); - $('#edit_name_modal').find('input').val(''); - $('#edit_name_modal').modal('show'); - } - - getFieldValue(element) { - if ($(element).is('select') || $(element).is('input[type="text"]')) { - return $(element).val(); - } - if ($(element).is('input[type="checkbox"]')) { - return $(element).is(':checked'); - } - } - - handleUIUpdate(event) { - if (event) { - event.preventDefault(); - const element = event.currentTarget; - const fieldName = $(element).attr('name'); - const newValue = this.getFieldValue(element); - const tabIndex = $('#apiRequestTabContent').children().index($(event.currentTarget).closest('.api_request')); - let model = this.apiRequests[tabIndex]; - - if (fieldName !== '') { - _.set(model, fieldName, newValue); - } - } - } - - handleUpdateServer(event) { - const tabIndex = $('#apiRequestTabContent').children().index($(event.currentTarget).closest('.api_request')); - let model = this.apiRequests[tabIndex]; - let target = $('#api_request_' + model.id); - target.find('input[name="basePath"]').val(this.basePath(model.server)); - } - - renderParams(params) { - return params.map((param, index) => this.queryParamTemplate(param, index)).join(''); - } - - renderHeaders(headers) { - return headers.map((header, index) => this.headerTemplate(header, index)).join(''); - } - - renderTabHeader() { - let apiRequestTabTitle = $('#apiRequestTabTitle'); - apiRequestTabTitle.empty(); - - for (let idx = 0; idx < this.apiRequests.length; idx++) { - let li = ``; - apiRequestTabTitle.append(li); - } - } - - renderTabContent(index) { - var me = this; - let apiRequestTabContent = $(this.apiTabContentTarget); - let model = this.apiRequests[index]; - - apiRequestTabContent.append(this.apiRequestTemplate(model, index)); - - this.openTab(model.id); - let target = $('#api_request_' + model.id); - - require(['vs/editor/editor.main'], () => { - let requestBodyEditor = monaco.editor.create(target.find(".request_body")[0], { - value: model.requestBody, - language: 'json', - theme: 'vs-light', - automaticLayout: true - }); - me.requestEditors.push(requestBodyEditor); - target.find(".request_body")[0].addEventListener('shown.bs.tab', () => { - me.requestEditors[index].layout(); - }); - - me.requestEditors[index].onDidChangeModelContent((e) => { - model.requestBody = requestBodyEditor.getValue(); - }); - - target.find('.request_body_type').on('change', () => { - let model = requestBodyEditor.getModel(); - monaco.editor.setModelLanguage(model, $(this).val()); - }); - - let responseBodyEditor = monaco.editor.create(target.find(".response_body")[0], { - value: '', - language: 'json', - theme: 'vs-light', - automaticLayout: true - }); - me.responseEditors.push(responseBodyEditor); - - let consoleEditor = monaco.editor.create(target.find(".console")[0], { - value: '', - language: 'text/plain', - theme: 'vs-light', - automaticLayout: true - }); - - me.consoleEditors.push(consoleEditor); - - - let preRequestEditor = monaco.editor.create(target.find(".pre-request")[0], { - value: model.preRequestScript, - language: 'javascript', - theme: 'vs-light', - automaticLayout: true - }); - me.preRequestEditors.push(preRequestEditor); - target.find(".pre-request")[0].addEventListener('shown.bs.tab', () => { - me.preRequestEditors[index].layout(); - }); - - me.preRequestEditors[index].onDidChangeModelContent((e) => { - model.preRequestScript = preRequestEditor.getValue(); - }); - - let postRequestEditor = monaco.editor.create(target.find(".post-request")[0], { - value: model.postRequestScript, - language: 'javascript', - theme: 'vs-light', - automaticLayout: true - }); - me.postRequestEditors.push(postRequestEditor); - target.find(".post-request")[0].addEventListener('shown.bs.tab', () => { - me.postRequestEditors[index].layout(); - }); - - me.postRequestEditors[index].onDidChangeModelContent((e) => { - model.postRequestScript = postRequestEditor.getValue(); - }); - - }); - } - - renderResponse(tabIndex) { - let model = this.apiRequests[tabIndex]; - let target = $('#api_request_' + model.id); - target.find('.response_headers').empty(); - target.find(".response_status").empty(); - - try { - const parsedJson = JSON.parse(model.responseModel.body); - const formattedJson = JSON.stringify(parsedJson, null, 2); - this.responseEditors[tabIndex].setValue(formattedJson); - } catch (e) { - this.responseEditors[tabIndex].setValue(model.responseModel.body); - } - if (model.responseModel && model.responseModel.headers) { - const headers = model.responseModel.headers; - Object.entries(headers).forEach(([key, value]) => { - target.find('.response_headers').append(this.responseHeaderTemplate(key, value)); - }); - } - - target.find(".response_status").text("status: " + model.responseModel.status); - target.find(".response_time").text("time: " + model.responseModel.time + "ms"); - target.find(".response_size").text("size: " + model.responseModel.size + "bytes"); - - } - - customHelper(event) { - // Create and return the custom helper element - let name = $(event.target).closest('.api_request_sortable').find('.open_api_request').text().trim(); - let apiId = $(event.target).closest('.api_request_sortable').data('id'); - return `
    -
    ${name}
    -
    `; - } - - renderCollections() { - let select = $('#modal_collection'); - let sidemenu = $(this.collectionTarget); - select.empty(); - sidemenu.empty(); - - for (let i = 0; i < this.collections.length; i++) { - sidemenu.append(this.renderCollection(this.collections[i], i)); - let option = $('`).join(''); - - return ` -
    - - -
    - `; - } - - static createTextAreaInput(elementModel) { - return ` -
    - - -
    `; - } - - static createFormElement(elementModel) { - switch (elementModel.type) { - case "boolean": - return this.createBooleanInput(elementModel); - case "text": - return this.createTextInput(elementModel); - case "select": - return this.createSelectInput(elementModel); - case "textarea": - return this.createTextAreaInput(elementModel); - default: - console.error("Unsupported element type: " + elementModel.type); - return ''; - } - } - - static createForm(model) { - let formHtml = ''; - model.forEach(group => { - formHtml += this.createGroup(group); - }); - return formHtml; - } - - static getFieldValue(element) { - if ($(element).is('select') || $(element).is('input[type="text"]') || $(element).is('textarea')) { - return $(element).val(); - } - if ($(element).is('input[type="checkbox"]')) { - return $(element).is(':checked'); - } - } - - static echartReplacer(key, value) { - if (key === 'echart' || key === 'series') { - return undefined; - } - return value; - } -} \ No newline at end of file diff --git a/src/main/resources/static/js/docs.min.js b/src/main/resources/static/js/docs.min.js deleted file mode 100644 index 3171000..0000000 --- a/src/main/resources/static/js/docs.min.js +++ /dev/null @@ -1,24 +0,0 @@ -/*! - -Holder - 2.3.2 - client side image placeholders -(c) 2012-2014 Ivan Malopinsky / http://imsky.co - -Provided under the MIT License. -Commercial use requires attribution. - -*/ -var Holder=Holder||{};!function(a,b){function c(a,b,c){b=parseInt(b,10),a=parseInt(a,10);var d=Math.max(b,a),e=Math.min(b,a),f=1/12,g=Math.min(.75*e,.75*d*f);return{height:Math.round(Math.max(c.size,g))}}function d(a){var b=[];for(p in a)a.hasOwnProperty(p)&&b.push(p+":"+a[p]);return b.join(";")}function e(a){var b=a.ctx,d=a.dimensions,e=a.template,f=a.ratio,g=a.holder,h="literal"==g.textmode,i="exact"==g.textmode,j=c(d.width,d.height,e),k=j.height,l=d.width*f,m=d.height*f,n=e.font?e.font:"Arial,Helvetica,sans-serif";canvas.width=l,canvas.height=m,b.textAlign="center",b.textBaseline="middle",b.fillStyle=e.background,b.fillRect(0,0,l,m),b.fillStyle=e.foreground,b.font="bold "+k+"px "+n;var o=e.text?e.text:Math.floor(d.width)+"x"+Math.floor(d.height);if(h){var d=g.dimensions;o=d.width+"x"+d.height}else if(i&&g.exact_dimensions){var d=g.exact_dimensions;o=Math.floor(d.width)+"x"+Math.floor(d.height)}var p=b.measureText(o).width;return p/l>=.75&&(k=Math.floor(.75*k*(l/p))),b.font="bold "+k*f+"px "+n,b.fillText(o,l/2,m/2,l),canvas.toDataURL("image/png")}function f(a){var b=a.dimensions,d=a.template,e=a.holder,f="literal"==e.textmode,g="exact"==e.textmode,h=c(b.width,b.height,d),i=h.height,j=b.width,k=b.height,l=d.font?d.font:"Arial,Helvetica,sans-serif",m=d.text?d.text:Math.floor(b.width)+"x"+Math.floor(b.height);if(f){var b=e.dimensions;m=b.width+"x"+b.height}else if(g&&e.exact_dimensions){var b=e.exact_dimensions;m=Math.floor(b.width)+"x"+Math.floor(b.height)}var n=z({text:m,width:j,height:k,text_height:i,font:l,template:d});return"data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(n)))}function g(a){return r.use_canvas&&!r.use_svg?e(a):f(a)}function h(a,b,c,d){var e=c.dimensions,f=c.theme,h=c.text?decodeURIComponent(c.text):c.text,i=e.width+"x"+e.height;f=h?o(f,{text:h}):f,f=c.font?o(f,{font:c.font}):f,b.setAttribute("data-src",d),c.theme=f,b.holder_data=c,"image"==a?(b.setAttribute("alt",h?h:f.text?f.text+" ["+i+"]":i),(r.use_fallback||!c.auto)&&(b.style.width=e.width+"px",b.style.height=e.height+"px"),r.use_fallback?b.style.backgroundColor=f.background:(b.setAttribute("src",g({ctx:w,dimensions:e,template:f,ratio:x,holder:c})),c.textmode&&"exact"==c.textmode&&(v.push(b),k(b)))):"background"==a?r.use_fallback||(b.style.backgroundImage="url("+g({ctx:w,dimensions:e,template:f,ratio:x,holder:c})+")",b.style.backgroundSize=e.width+"px "+e.height+"px"):"fluid"==a&&(b.setAttribute("alt",h?h:f.text?f.text+" ["+i+"]":i),"%"==e.height.slice(-1)?b.style.height=e.height:null!=c.auto&&c.auto||(b.style.height=e.height+"px"),"%"==e.width.slice(-1)?b.style.width=e.width:null!=c.auto&&c.auto||(b.style.width=e.width+"px"),("inline"==b.style.display||""===b.style.display||"none"==b.style.display)&&(b.style.display="block"),j(b),r.use_fallback?b.style.backgroundColor=f.background:(v.push(b),k(b)))}function i(a,b){var c={height:a.clientHeight,width:a.clientWidth};return c.height||c.width?(a.removeAttribute("data-holder-invisible"),c):(a.setAttribute("data-holder-invisible",!0),void b.call(this,a))}function j(b){if(b.holder_data){var c=i(b,a.invisible_error_fn(j));if(c){var d=b.holder_data;d.initial_dimensions=c,d.fluid_data={fluid_height:"%"==d.dimensions.height.slice(-1),fluid_width:"%"==d.dimensions.width.slice(-1),mode:null},d.fluid_data.fluid_width&&!d.fluid_data.fluid_height?(d.fluid_data.mode="width",d.fluid_data.ratio=d.initial_dimensions.width/parseFloat(d.dimensions.height)):!d.fluid_data.fluid_width&&d.fluid_data.fluid_height&&(d.fluid_data.mode="height",d.fluid_data.ratio=parseFloat(d.dimensions.width)/d.initial_dimensions.height)}}}function k(b){var c;c=null==b.nodeType?v:[b];for(var d in c)if(c.hasOwnProperty(d)){var e=c[d];if(e.holder_data){var f=e.holder_data,h=i(e,a.invisible_error_fn(k));if(h){if(f.fluid){if(f.auto)switch(f.fluid_data.mode){case"width":h.height=h.width/f.fluid_data.ratio;break;case"height":h.width=h.height*f.fluid_data.ratio}e.setAttribute("src",g({ctx:w,dimensions:h,template:f.theme,ratio:x,holder:f}))}f.textmode&&"exact"==f.textmode&&(f.exact_dimensions=h,e.setAttribute("src",g({ctx:w,dimensions:f.dimensions,template:f.theme,ratio:x,holder:f})))}}}}function l(b,c){for(var d={theme:o(y.themes.gray,{})},e=!1,f=b.length,g=0;f>g;g++){var h=b[g];a.flags.dimensions.match(h)?(e=!0,d.dimensions=a.flags.dimensions.output(h)):a.flags.fluid.match(h)?(e=!0,d.dimensions=a.flags.fluid.output(h),d.fluid=!0):a.flags.textmode.match(h)?d.textmode=a.flags.textmode.output(h):a.flags.colors.match(h)?d.theme=a.flags.colors.output(h):c.themes[h]?c.themes.hasOwnProperty(h)&&(d.theme=o(c.themes[h],{})):a.flags.font.match(h)?d.font=a.flags.font.output(h):a.flags.auto.match(h)?d.auto=!0:a.flags.text.match(h)&&(d.text=a.flags.text.output(h))}return e?d:!1}function m(a,b){var c="complete",d="readystatechange",e=!1,f=e,g=!0,h=a.document,i=h.documentElement,j=h.addEventListener?"addEventListener":"attachEvent",k=h.addEventListener?"removeEventListener":"detachEvent",l=h.addEventListener?"":"on",m=function(g){(g.type!=d||h.readyState==c)&&(("load"==g.type?a:h)[k](l+g.type,m,e),!f&&(f=!0)&&b.call(a,null))},n=function(){try{i.doScroll("left")}catch(a){return void setTimeout(n,50)}m("poll")};if(h.readyState==c)b.call(a,"lazy");else{if(h.createEventObject&&i.doScroll){try{g=!a.frameElement}catch(o){}g&&n()}h[j](l+"DOMContentLoaded",m,e),h[j](l+d,m,e),a[j](l+"load",m,e)}}function n(a,b){var a=a.match(/^(\W)?(.*)/),b=b||document,c=b["getElement"+(a[1]?"#"==a[1]?"ById":"sByClassName":"sByTagName")],d=c.call(b,a[2]),e=[];return null!==d&&(e=d.length||0===d.length?d:[d]),e}function o(a,b){var c={};for(var d in a)a.hasOwnProperty(d)&&(c[d]=a[d]);for(var d in b)b.hasOwnProperty(d)&&(c[d]=b[d]);return c}var q={use_svg:!1,use_canvas:!1,use_fallback:!1},r={},s=!1;canvas=document.createElement("canvas");var t=1,u=1,v=[];if(canvas.getContext)if(canvas.toDataURL("image/png").indexOf("data:image/png")<0)q.use_fallback=!0;else var w=canvas.getContext("2d");else q.use_fallback=!0;document.createElementNS&&document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect&&(q.use_svg=!0,q.use_canvas=!1),q.use_fallback||(t=window.devicePixelRatio||1,u=w.webkitBackingStorePixelRatio||w.mozBackingStorePixelRatio||w.msBackingStorePixelRatio||w.oBackingStorePixelRatio||w.backingStorePixelRatio||1);var x=t/u,y={domain:"holder.js",images:"img",bgnodes:".holderjs",themes:{gray:{background:"#eee",foreground:"#aaa",size:12},social:{background:"#3a5a97",foreground:"#fff",size:12},industrial:{background:"#434A52",foreground:"#C2F200",size:12},sky:{background:"#0D8FDB",foreground:"#fff",size:12},vine:{background:"#39DBAC",foreground:"#1E292C",size:12},lava:{background:"#F8591A",foreground:"#1C2846",size:12}},stylesheet:""};a.flags={dimensions:{regex:/^(\d+)x(\d+)$/,output:function(a){var b=this.regex.exec(a);return{width:+b[1],height:+b[2]}}},fluid:{regex:/^([0-9%]+)x([0-9%]+)$/,output:function(a){var b=this.regex.exec(a);return{width:b[1],height:b[2]}}},colors:{regex:/#([0-9a-f]{3,})\:#([0-9a-f]{3,})/i,output:function(a){var b=this.regex.exec(a);return{size:y.themes.gray.size,foreground:"#"+b[2],background:"#"+b[1]}}},text:{regex:/text\:(.*)/,output:function(a){return this.regex.exec(a)[1]}},font:{regex:/font\:(.*)/,output:function(a){return this.regex.exec(a)[1]}},auto:{regex:/^auto$/},textmode:{regex:/textmode\:(.*)/,output:function(a){return this.regex.exec(a)[1]}}};var z=function(){if(window.XMLSerializer){var a=new XMLSerializer,b="http://www.w3.org/2000/svg",c=document.createElementNS(b,"svg");c.webkitMatchesSelector&&c.setAttribute("xmlns","http://www.w3.org/2000/svg");var e=document.createElementNS(b,"rect"),f=document.createElementNS(b,"text"),g=document.createTextNode(null);return f.setAttribute("text-anchor","middle"),f.appendChild(g),c.appendChild(e),c.appendChild(f),function(b){return c.setAttribute("width",b.width),c.setAttribute("height",b.height),e.setAttribute("width",b.width),e.setAttribute("height",b.height),e.setAttribute("fill",b.template.background),f.setAttribute("x",b.width/2),f.setAttribute("y",b.height/2),g.nodeValue=b.text,f.setAttribute("style",d({fill:b.template.foreground,"font-weight":"bold","font-size":b.text_height+"px","font-family":b.font,"dominant-baseline":"central"})),a.serializeToString(c)}}}();for(var A in a.flags)a.flags.hasOwnProperty(A)&&(a.flags[A].match=function(a){return a.match(this.regex)});a.invisible_error_fn=function(){return function(a){if(a.hasAttribute("data-holder-invisible"))throw new Error("Holder: invisible placeholder")}},a.add_theme=function(b,c){return null!=b&&null!=c&&(y.themes[b]=c),a},a.add_image=function(b,c){var d=n(c);if(d.length)for(var e=0,f=d.length;f>e;e++){var g=document.createElement("img");g.setAttribute("data-src",b),d[e].appendChild(g)}return a},a.run=function(b){r=o({},q),s=!0;var c=o(y,b),d=[],e=[],f=[];for(null!=c.use_canvas&&c.use_canvas&&(r.use_canvas=!0,r.use_svg=!1),"string"==typeof c.images?e=n(c.images):window.NodeList&&c.images instanceof window.NodeList?e=c.images:window.Node&&c.images instanceof window.Node?e=[c.images]:window.HTMLCollection&&c.images instanceof window.HTMLCollection&&(e=c.images),"string"==typeof c.bgnodes?f=n(c.bgnodes):window.NodeList&&c.elements instanceof window.NodeList?f=c.bgnodes:window.Node&&c.bgnodes instanceof window.Node&&(f=[c.bgnodes]),k=0,j=e.length;j>k;k++)d.push(e[k]);var g=document.getElementById("holderjs-style");g||(g=document.createElement("style"),g.setAttribute("id","holderjs-style"),g.type="text/css",document.getElementsByTagName("head")[0].appendChild(g)),c.nocss||(g.styleSheet?g.styleSheet.cssText+=c.stylesheet:c.stylesheet.length&&g.appendChild(document.createTextNode(c.stylesheet)));for(var i=new RegExp(c.domain+'/(.*?)"?\\)'),j=f.length,k=0;j>k;k++){var m=window.getComputedStyle(f[k],null).getPropertyValue("background-image"),p=m.match(i),t=f[k].getAttribute("data-background-src");if(p){var u=l(p[1].split("/"),c);u&&h("background",f[k],u,m)}else if(null!=t){var u=l(t.substr(t.lastIndexOf(c.domain)+c.domain.length+1).split("/"),c);u&&h("background",f[k],u,m)}}for(j=d.length,k=0;j>k;k++){var v,w;w=v=m=null;try{w=d[k].getAttribute("src"),attr_datasrc=d[k].getAttribute("data-src")}catch(x){}if(null==attr_datasrc&&w&&w.indexOf(c.domain)>=0?m=w:attr_datasrc&&attr_datasrc.indexOf(c.domain)>=0&&(m=attr_datasrc),m){var u=l(m.substr(m.lastIndexOf(c.domain)+c.domain.length+1).split("/"),c);u&&(u.fluid?h("fluid",d[k],u,m):h("image",d[k],u,m))}}return a},m(b,function(){window.addEventListener?(window.addEventListener("resize",k,!1),window.addEventListener("orientationchange",k,!1)):window.attachEvent("onresize",k),s||a.run({}),"object"==typeof window.Turbolinks&&document.addEventListener("page:change",function(){a.run({})})}),"function"==typeof define&&define.amd&&define([],function(){return a}),function(){function a(a){this.message=a}var b="undefined"!=typeof exports?exports:this,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";a.prototype=Error(),a.prototype.name="InvalidCharacterError",b.btoa||(b.btoa=function(b){for(var d,e,f=0,g=c,h="";b.charAt(0|f)||(g="=",f%1);h+=g.charAt(63&d>>8-8*(f%1))){if(e=b.charCodeAt(f+=.75),e>255)throw new a("'btoa' failed");d=d<<8|e}return h}),b.atob||(b.atob=function(b){if(b=b.replace(/=+$/,""),1==b.length%4)throw new a("'atob' failed");for(var d,e,f=0,g=0,h="";e=b.charAt(g++);~e&&(d=f%4?64*d+e:e,f++%4)?h+=String.fromCharCode(255&d>>(6&-2*f)):0)e=c.indexOf(e);return h})}(),document.getElementsByClassName||(document.getElementsByClassName=function(a){var b,c,d,e=document,f=[];if(e.querySelectorAll)return e.querySelectorAll("."+a);if(e.evaluate)for(c=".//*[contains(concat(' ', @class, ' '), ' "+a+" ')]",b=e.evaluate(c,e,null,0,null);d=b.iterateNext();)f.push(d);else for(b=e.getElementsByTagName("*"),c=new RegExp("(^|\\s)"+a+"(\\s|$)"),d=0;d=10}var d,e={bridge:null,version:"0.0.0",disabled:null,outdated:null,ready:null},f={},g=0,h={},i=0,j={},k=null,l=null,m=function(){var a,b,c,d,e="ZeroClipboard.swf";if(document.currentScript&&(d=document.currentScript.src));else{var f=document.getElementsByTagName("script");if("readyState"in f[0])for(a=f.length;a--&&("interactive"!==f[a].readyState||!(d=f[a].src)););else if("loading"===document.readyState)d=f[f.length-1].src;else{for(a=f.length;a--;){if(c=f[a].src,!c){b=null;break}if(c=c.split("#")[0].split("?")[0],c=c.slice(0,c.lastIndexOf("/")+1),null==b)b=c;else if(b!==c){b=null;break}}null!==b&&(d=b)}}return d&&(d=d.split("#")[0].split("?")[0],e=d.slice(0,d.lastIndexOf("/")+1)+e),e}(),n=function(){var a=/\-([a-z])/g,b=function(a,b){return b.toUpperCase()};return function(c){return c.replace(a,b)}}(),o=function(b,c){var d,e,f;return a.getComputedStyle?d=a.getComputedStyle(b,null).getPropertyValue(c):(e=n(c),d=b.currentStyle?b.currentStyle[e]:b.style[e]),"cursor"!==c||d&&"auto"!==d||(f=b.tagName.toLowerCase(),"a"!==f)?d:"pointer"},p=function(b){b||(b=a.event);var c;this!==a?c=this:b.target?c=b.target:b.srcElement&&(c=b.srcElement),K.activate(c)},q=function(a,b,c){a&&1===a.nodeType&&(a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c))},r=function(a,b,c){a&&1===a.nodeType&&(a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent&&a.detachEvent("on"+b,c))},s=function(a,b){if(!a||1!==a.nodeType)return a;if(a.classList)return a.classList.contains(b)||a.classList.add(b),a;if(b&&"string"==typeof b){var c=(b||"").split(/\s+/);if(1===a.nodeType)if(a.className){for(var d=" "+a.className+" ",e=a.className,f=0,g=c.length;g>f;f++)d.indexOf(" "+c[f]+" ")<0&&(e+=" "+c[f]);a.className=e.replace(/^\s+|\s+$/g,"")}else a.className=b}return a},t=function(a,b){if(!a||1!==a.nodeType)return a;if(a.classList)return a.classList.contains(b)&&a.classList.remove(b),a;if(b&&"string"==typeof b||void 0===b){var c=(b||"").split(/\s+/);if(1===a.nodeType&&a.className)if(b){for(var d=(" "+a.className+" ").replace(/[\n\t]/g," "),e=0,f=c.length;f>e;e++)d=d.replace(" "+c[e]+" "," ");a.className=d.replace(/^\s+|\s+$/g,"")}else a.className=""}return a},u=function(){var a,b,c,d=1;return"function"==typeof document.body.getBoundingClientRect&&(a=document.body.getBoundingClientRect(),b=a.right-a.left,c=document.body.offsetWidth,d=Math.round(b/c*100)/100),d},v=function(b,c){var d={left:0,top:0,width:0,height:0,zIndex:B(c)-1};if(b.getBoundingClientRect){var e,f,g,h=b.getBoundingClientRect();"pageXOffset"in a&&"pageYOffset"in a?(e=a.pageXOffset,f=a.pageYOffset):(g=u(),e=Math.round(document.documentElement.scrollLeft/g),f=Math.round(document.documentElement.scrollTop/g));var i=document.documentElement.clientLeft||0,j=document.documentElement.clientTop||0;d.left=h.left+e-i,d.top=h.top+f-j,d.width="width"in h?h.width:h.right-h.left,d.height="height"in h?h.height:h.bottom-h.top}return d},w=function(a,b){var c=null==b||b&&b.cacheBust===!0&&b.useNoCache===!0;return c?(-1===a.indexOf("?")?"?":"&")+"noCache="+(new Date).getTime():""},x=function(b){var c,d,e,f=[],g=[],h=[];if(b.trustedOrigins&&("string"==typeof b.trustedOrigins?g.push(b.trustedOrigins):"object"==typeof b.trustedOrigins&&"length"in b.trustedOrigins&&(g=g.concat(b.trustedOrigins))),b.trustedDomains&&("string"==typeof b.trustedDomains?g.push(b.trustedDomains):"object"==typeof b.trustedDomains&&"length"in b.trustedDomains&&(g=g.concat(b.trustedDomains))),g.length)for(c=0,d=g.length;d>c;c++)if(g.hasOwnProperty(c)&&g[c]&&"string"==typeof g[c]){if(e=E(g[c]),!e)continue;if("*"===e){h=[e];break}h.push.apply(h,[e,"//"+e,a.location.protocol+"//"+e])}return h.length&&f.push("trustedOrigins="+encodeURIComponent(h.join(","))),"string"==typeof b.jsModuleId&&b.jsModuleId&&f.push("jsModuleId="+encodeURIComponent(b.jsModuleId)),f.join("&")},y=function(a,b,c){if("function"==typeof b.indexOf)return b.indexOf(a,c);var d,e=b.length;for("undefined"==typeof c?c=0:0>c&&(c=e+c),d=c;e>d;d++)if(b.hasOwnProperty(d)&&b[d]===a)return d;return-1},z=function(a){if("string"==typeof a)throw new TypeError("ZeroClipboard doesn't accept query strings.");return a.length?a:[a]},A=function(b,c,d,e){e?a.setTimeout(function(){b.apply(c,d)},0):b.apply(c,d)},B=function(a){var b,c;return a&&("number"==typeof a&&a>0?b=a:"string"==typeof a&&(c=parseInt(a,10))&&!isNaN(c)&&c>0&&(b=c)),b||("number"==typeof N.zIndex&&N.zIndex>0?b=N.zIndex:"string"==typeof N.zIndex&&(c=parseInt(N.zIndex,10))&&!isNaN(c)&&c>0&&(b=c)),b||0},C=function(a,b){if(a&&b!==!1&&"undefined"!=typeof console&&console&&(console.warn||console.log)){var c="`"+a+"` is deprecated. See docs for more info:\n https://github.com/zeroclipboard/zeroclipboard/blob/master/docs/instructions.md#deprecations";console.warn?console.warn(c):console.log(c)}},D=function(){var a,b,c,d,e,f,g=arguments[0]||{};for(a=1,b=arguments.length;b>a;a++)if(null!=(c=arguments[a]))for(d in c)if(c.hasOwnProperty(d)){if(e=g[d],f=c[d],g===f)continue;void 0!==f&&(g[d]=f)}return g},E=function(a){if(null==a||""===a)return null;if(a=a.replace(/^\s+|\s+$/g,""),""===a)return null;var b=a.indexOf("//");a=-1===b?a:a.slice(b+2);var c=a.indexOf("/");return a=-1===c?a:-1===b||0===c?null:a.slice(0,c),a&&".swf"===a.slice(-4).toLowerCase()?null:a||null},F=function(){var a=function(a,b){var c,d,e;if(null!=a&&"*"!==b[0]&&("string"==typeof a&&(a=[a]),"object"==typeof a&&"length"in a))for(c=0,d=a.length;d>c;c++)if(a.hasOwnProperty(c)&&(e=E(a[c]))){if("*"===e){b.length=0,b.push("*");break}-1===y(e,b)&&b.push(e)}},b={always:"always",samedomain:"sameDomain",never:"never"};return function(c,d){var e,f=d.allowScriptAccess;if("string"==typeof f&&(e=f.toLowerCase())&&/^always|samedomain|never$/.test(e))return b[e];var g=E(d.moviePath);null===g&&(g=c);var h=[];a(d.trustedOrigins,h),a(d.trustedDomains,h);var i=h.length;if(i>0){if(1===i&&"*"===h[0])return"always";if(-1!==y(c,h))return 1===i&&c===g?"sameDomain":"always"}return"never"}}(),G=function(a){if(null==a)return[];if(Object.keys)return Object.keys(a);var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b},H=function(a){if(a)for(var b in a)a.hasOwnProperty(b)&&delete a[b];return a},I=function(){try{return document.activeElement}catch(a){}return null},J=function(){var a=!1;if("boolean"==typeof e.disabled)a=e.disabled===!1;else{if("function"==typeof ActiveXObject)try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash")&&(a=!0)}catch(b){}!a&&navigator.mimeTypes["application/x-shockwave-flash"]&&(a=!0)}return a},K=function(a,b){return this instanceof K?(this.id=""+g++,h[this.id]={instance:this,elements:[],handlers:{}},a&&this.clip(a),"undefined"!=typeof b&&(C("new ZeroClipboard(elements, options)",N.debug),K.config(b)),this.options=K.config(),"boolean"!=typeof e.disabled&&(e.disabled=!J()),void(e.disabled===!1&&e.outdated!==!0&&null===e.bridge&&(e.outdated=!1,e.ready=!1,O()))):new K(a,b)};K.prototype.setText=function(a){return a&&""!==a&&(f["text/plain"]=a,e.ready===!0&&e.bridge&&"function"==typeof e.bridge.setText?e.bridge.setText(a):e.ready=!1),this},K.prototype.setSize=function(a,b){return e.ready===!0&&e.bridge&&"function"==typeof e.bridge.setSize?e.bridge.setSize(a,b):e.ready=!1,this};var L=function(a){e.ready===!0&&e.bridge&&"function"==typeof e.bridge.setHandCursor?e.bridge.setHandCursor(a):e.ready=!1};K.prototype.destroy=function(){this.unclip(),this.off(),delete h[this.id]};var M=function(){var a,b,c,d=[],e=G(h);for(a=0,b=e.length;b>a;a++)c=h[e[a]].instance,c&&c instanceof K&&d.push(c);return d};K.version="1.3.5";var N={swfPath:m,trustedDomains:a.location.host?[a.location.host]:[],cacheBust:!0,forceHandCursor:!1,zIndex:999999999,debug:!0,title:null,autoActivate:!0};K.config=function(a){if("object"==typeof a&&null!==a&&D(N,a),"string"!=typeof a||!a){var b={};for(var c in N)N.hasOwnProperty(c)&&(b[c]="object"==typeof N[c]&&null!==N[c]?"length"in N[c]?N[c].slice(0):D({},N[c]):N[c]);return b}return N.hasOwnProperty(a)?N[a]:void 0},K.destroy=function(){K.deactivate();for(var a in h)if(h.hasOwnProperty(a)&&h[a]){var b=h[a].instance;b&&"function"==typeof b.destroy&&b.destroy()}var c=P(e.bridge);c&&c.parentNode&&(c.parentNode.removeChild(c),e.ready=null,e.bridge=null)},K.activate=function(a){d&&(t(d,N.hoverClass),t(d,N.activeClass)),d=a,s(a,N.hoverClass),Q();var b=N.title||a.getAttribute("title");if(b){var c=P(e.bridge);c&&c.setAttribute("title",b)}var f=N.forceHandCursor===!0||"pointer"===o(a,"cursor");L(f)},K.deactivate=function(){var a=P(e.bridge);a&&(a.style.left="0px",a.style.top="-9999px",a.removeAttribute("title")),d&&(t(d,N.hoverClass),t(d,N.activeClass),d=null)};var O=function(){var b,c,d=document.getElementById("global-zeroclipboard-html-bridge");if(!d){var f=K.config();f.jsModuleId="string"==typeof k&&k||"string"==typeof l&&l||null;var g=F(a.location.host,N),h=x(f),i=N.moviePath+w(N.moviePath,N),j=' ';d=document.createElement("div"),d.id="global-zeroclipboard-html-bridge",d.setAttribute("class","global-zeroclipboard-container"),d.style.position="absolute",d.style.left="0px",d.style.top="-9999px",d.style.width="15px",d.style.height="15px",d.style.zIndex=""+B(N.zIndex),document.body.appendChild(d),d.innerHTML=j}b=document["global-zeroclipboard-flash-bridge"],b&&(c=b.length)&&(b=b[c-1]),e.bridge=b||d.children[0].lastElementChild},P=function(a){for(var b=/^OBJECT|EMBED$/,c=a&&a.parentNode;c&&b.test(c.nodeName)&&c.parentNode;)c=c.parentNode;return c||null},Q=function(){if(d){var a=v(d,N.zIndex),b=P(e.bridge);b&&(b.style.top=a.top+"px",b.style.left=a.left+"px",b.style.width=a.width+"px",b.style.height=a.height+"px",b.style.zIndex=a.zIndex+1),e.ready===!0&&e.bridge&&"function"==typeof e.bridge.setSize?e.bridge.setSize(a.width,a.height):e.ready=!1}return this};K.prototype.on=function(a,b){var c,d,f,g={},i=h[this.id]&&h[this.id].handlers;if("string"==typeof a&&a)f=a.toLowerCase().split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof b)for(c in a)a.hasOwnProperty(c)&&"string"==typeof c&&c&&"function"==typeof a[c]&&this.on(c,a[c]);if(f&&f.length){for(c=0,d=f.length;d>c;c++)a=f[c].replace(/^on/,""),g[a]=!0,i[a]||(i[a]=[]),i[a].push(b);g.noflash&&e.disabled&&T.call(this,"noflash",{}),g.wrongflash&&e.outdated&&T.call(this,"wrongflash",{flashVersion:e.version}),g.load&&e.ready&&T.call(this,"load",{flashVersion:e.version})}return this},K.prototype.off=function(a,b){var c,d,e,f,g,i=h[this.id]&&h[this.id].handlers;if(0===arguments.length)f=G(i);else if("string"==typeof a&&a)f=a.split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof b)for(c in a)a.hasOwnProperty(c)&&"string"==typeof c&&c&&"function"==typeof a[c]&&this.off(c,a[c]);if(f&&f.length)for(c=0,d=f.length;d>c;c++)if(a=f[c].toLowerCase().replace(/^on/,""),g=i[a],g&&g.length)if(b)for(e=y(b,g);-1!==e;)g.splice(e,1),e=y(b,g,e);else i[a].length=0;return this},K.prototype.handlers=function(a){var b,c=null,d=h[this.id]&&h[this.id].handlers;if(d){if("string"==typeof a&&a)return d[a]?d[a].slice(0):null;c={};for(b in d)d.hasOwnProperty(b)&&d[b]&&(c[b]=d[b].slice(0))}return c};var R=function(b,c,d,e){var f=h[this.id]&&h[this.id].handlers[b];if(f&&f.length){var g,i,j,k=c||this;for(g=0,i=f.length;i>g;g++)j=f[g],c=k,"string"==typeof j&&"function"==typeof a[j]&&(j=a[j]),"object"==typeof j&&j&&"function"==typeof j.handleEvent&&(c=j,j=j.handleEvent),"function"==typeof j&&A(j,c,d,e)}return this};K.prototype.clip=function(a){a=z(a);for(var b=0;bd;d++)f=h[c[d]].instance,f&&f instanceof K&&g.push(f);return g};N.hoverClass="zeroclipboard-is-hover",N.activeClass="zeroclipboard-is-active",N.trustedOrigins=null,N.allowScriptAccess=null,N.useNoCache=!0,N.moviePath="ZeroClipboard.swf",K.detectFlashSupport=function(){return C("ZeroClipboard.detectFlashSupport",N.debug),J()},K.dispatch=function(a,b){if("string"==typeof a&&a){var c=a.toLowerCase().replace(/^on/,"");if(c)for(var e=d&&N.autoActivate===!0?S(d):M(),f=0,g=e.length;g>f;f++)T.call(e[f],c,b)}},K.prototype.setHandCursor=function(a){return C("ZeroClipboard.prototype.setHandCursor",N.debug),a="boolean"==typeof a?a:!!a,L(a),N.forceHandCursor=a,this},K.prototype.reposition=function(){return C("ZeroClipboard.prototype.reposition",N.debug),Q()},K.prototype.receiveEvent=function(a,b){if(C("ZeroClipboard.prototype.receiveEvent",N.debug),"string"==typeof a&&a){var c=a.toLowerCase().replace(/^on/,"");c&&T.call(this,c,b)}},K.prototype.setCurrent=function(a){return C("ZeroClipboard.prototype.setCurrent",N.debug),K.activate(a),this},K.prototype.resetBridge=function(){return C("ZeroClipboard.prototype.resetBridge",N.debug),K.deactivate(),this},K.prototype.setTitle=function(a){if(C("ZeroClipboard.prototype.setTitle",N.debug),a=a||N.title||d&&d.getAttribute("title")){var b=P(e.bridge);b&&b.setAttribute("title",a)}return this},K.setDefaults=function(a){C("ZeroClipboard.setDefaults",N.debug),K.config(a)},K.prototype.addEventListener=function(a,b){return C("ZeroClipboard.prototype.addEventListener",N.debug),this.on(a,b)},K.prototype.removeEventListener=function(a,b){return C("ZeroClipboard.prototype.removeEventListener",N.debug),this.off(a,b)},K.prototype.ready=function(){return C("ZeroClipboard.prototype.ready",N.debug),e.ready===!0};var T=function(a,g){a=a.toLowerCase().replace(/^on/,"");var h=g&&g.flashVersion&&b(g.flashVersion)||null,i=d,j=!0;switch(a){case"load":if(h){if(!c(h))return void T.call(this,"onWrongFlash",{flashVersion:h});e.outdated=!1,e.ready=!0,e.version=h}break;case"wrongflash":h&&!c(h)&&(e.outdated=!0,e.ready=!1,e.version=h);break;case"mouseover":s(i,N.hoverClass);break;case"mouseout":N.autoActivate===!0&&K.deactivate();break;case"mousedown":s(i,N.activeClass);break;case"mouseup":t(i,N.activeClass);break;case"datarequested":if(i){var k=i.getAttribute("data-clipboard-target"),l=k?document.getElementById(k):null;if(l){var m=l.value||l.textContent||l.innerText;m&&this.setText(m)}else{var n=i.getAttribute("data-clipboard-text");n&&this.setText(n)}}j=!1;break;case"complete":H(f),i&&i!==I()&&i.focus&&i.focus()}var o=i,p=[this,g];return R.call(this,a,o,p,j)};"function"==typeof define&&define.amd?define(["require","exports","module"],function(a,b,c){return k=c&&c.id||null,K}):"object"==typeof module&&module&&"object"==typeof module.exports&&module.exports&&"function"==typeof a.require?(l=module.id||null,module.exports=K):a.ZeroClipboard=K}(function(){return this}()),/*! - * JavaScript for Bootstrap's docs (http://getbootstrap.com) - * Copyright 2011-2014 Twitter, Inc. - * Licensed under the Creative Commons Attribution 3.0 Unported License. For - * details, see http://creativecommons.org/licenses/by/3.0/. - */ -!function(a){"use strict";a(function(){var b=a(window),c=a(document.body);c.scrollspy({target:".bs-docs-sidebar"}),b.on("load",function(){c.scrollspy("refresh")}),a(".bs-docs-container [href=#]").click(function(a){a.preventDefault()}),setTimeout(function(){var b=a(".bs-docs-sidebar");b.affix({offset:{top:function(){var c=b.offset().top,d=parseInt(b.children(0).css("margin-top"),10),e=a(".bs-docs-nav").height();return this.top=c-e-d},bottom:function(){return this.bottom=a(".bs-docs-footer").outerHeight(!0)}}})},100),setTimeout(function(){a(".bs-top").affix()},100),function(){var b=a("#bs-theme-stylesheet"),c=a(".bs-docs-theme-toggle");c.click(function(){var a=b.attr("href");a&&0!==a.indexOf("data")?(b.attr("href",""),c.text("Preview theme")):(b.attr("href",b.attr("data-href")),c.text("Disable theme preview"))})}(),a(".tooltip-demo").tooltip({selector:'[data-toggle="tooltip"]',container:"body"}),a(".popover-demo").popover({selector:'[data-toggle="popover"]',container:"body"}),a(".tooltip-test").tooltip(),a(".popover-test").popover(),a(".bs-docs-popover").popover(),a(".bs-docs-popover-dismiss").popover({trigger:"focus"}),a("#loading-example-btn").click(function(){var b=a(this);b.button("loading"),setTimeout(function(){b.button("reset")},3e3)}),ZeroClipboard.config({moviePath:"/assets/flash/ZeroClipboard.swf",hoverClass:"btn-clipboard-hover"}),a(".highlight").each(function(){var b=a(this),c=b.prev(),d='
    Copy
    ';c.hasClass("bs-example")?c.before(d.replace(/btn-clipboard/,"btn-clipboard with-example")):b.before(d)});var d=new ZeroClipboard(a(".btn-clipboard")),e=a("#global-zeroclipboard-html-bridge");d.on("load",function(){e.data("placement","top").attr("title","Copy to clipboard").tooltip()}),d.on("dataRequested",function(b){var c=a(this).parent().nextAll(".highlight").first();b.setText(c.text())}),d.on("complete",function(){e.attr("title","Copied!").tooltip("fixTitle").tooltip("show").attr("title","Copy to clipboard").tooltip("fixTitle")}),d.on("noflash wrongflash",function(){e.attr("title","Flash required").tooltip("fixTitle").tooltip("show")})})}(jQuery); \ No newline at end of file diff --git a/src/main/resources/static/plugins/apitestmanager/6f75249988833dd9f429.ttf b/src/main/resources/static/plugins/apitestmanager/6f75249988833dd9f429.ttf new file mode 100644 index 0000000..82f6fd0 --- /dev/null +++ b/src/main/resources/static/plugins/apitestmanager/6f75249988833dd9f429.ttf @@ -0,0 +1 @@ +export default __webpack_public_path__ + "fonts/codicon.ttf"; \ No newline at end of file diff --git a/src/main/resources/static/plugins/apitestmanager/app.bundle.js b/src/main/resources/static/plugins/apitestmanager/app.bundle.js new file mode 100644 index 0000000..d437e75 --- /dev/null +++ b/src/main/resources/static/plugins/apitestmanager/app.bundle.js @@ -0,0 +1,11129 @@ +/* + * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["APITestManager"] = factory(); + else + root["APITestManager"] = factory(); +})((typeof self !== 'undefined' ? self : this), () => { +return /******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ "./src/APIClient.js": +/*!**************************!*\ + !*** ./src/APIClient.js ***! + \**************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * 처리 순서\n * 1. preRequestScript 실행 -> executePreRequestScript\n * 2. 변수 치환 -> replacePlaceholdersWithVariables\n * 3. API 호출 -> sendAPIRequest\n * 4. postRequestScript 실행 -> executePostRequestScript\n */\nvar APIClient = /*#__PURE__*/function () {\n function APIClient() {\n _classCallCheck(this, APIClient);\n window.globals = {};\n this.variables = {};\n this.abortController = null;\n }\n _createClass(APIClient, [{\n key: \"sendAPIRequest\",\n value: function () {\n var _sendAPIRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(model, preProcessCallback, consoleOutput) {\n var updatedModel, processedRequest, response, responseData, errorMessage, finalResponse;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _context.prev = 0;\n _context.next = 3;\n return this.executePreRequestScript(model, consoleOutput);\n case 3:\n updatedModel = _context.sent;\n processedRequest = this.replacePlaceholdersWithVariables(updatedModel);\n if (preProcessCallback) {\n preProcessCallback(processedRequest);\n }\n _context.next = 8;\n return this.makeAjaxRequest(processedRequest, model, consoleOutput);\n case 8:\n response = _context.sent;\n _context.next = 11;\n return response.json();\n case 11:\n responseData = _context.sent;\n if (response.ok) {\n _context.next = 15;\n break;\n }\n errorMessage = responseData.error || 'Unknown error';\n throw new Error(\"API \\uD638\\uCD9C \\uC911 \\uC624\\uB958\\uAC00 \\uBC1C\\uC0DD\\uD588\\uC2B5\\uB2C8\\uB2E4. \\uC0AC\\uC720[\".concat(errorMessage, \"]\"));\n case 15:\n finalResponse = this.formatResponse(responseData);\n return _context.abrupt(\"return\", this.executePostRequestScript(model.postRequestScript, finalResponse, consoleOutput)[\"catch\"](function (error) {\n $('.toast-body').text(error);\n $('.toast').toast('show');\n return finalResponse; // Return the original response even if there's an error in the post-request script\n }));\n case 19:\n _context.prev = 19;\n _context.t0 = _context[\"catch\"](0);\n throw _context.t0;\n case 22:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this, [[0, 19]]);\n }));\n function sendAPIRequest(_x, _x2, _x3) {\n return _sendAPIRequest.apply(this, arguments);\n }\n return sendAPIRequest;\n }()\n }, {\n key: \"formatResponse\",\n value: function formatResponse(data) {\n // Format response as needed before post-request script\n var response = {};\n response.body = data.body;\n response.status = data.status;\n response.headers = {};\n response.size = data.size;\n _.forEach(data.headers, function (header) {\n response.headers[header.key] = header.value;\n });\n return response;\n }\n }, {\n key: \"abort\",\n value: function abort() {\n if (this.abortController) {\n this.abortController.abort(); // abort the fetch\n this.abortController = null; // reset the controller\n }\n }\n }, {\n key: \"makeAjaxRequest\",\n value: function makeAjaxRequest(processedRequest, model) {\n this.abortController = new AbortController();\n var signal = this.abortController.signal;\n try {\n return fetch('/mgmt/api/test.do', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'X-XSRF-TOKEN': $('meta[name=\"_csrf\"]').attr('content')\n },\n body: JSON.stringify(processedRequest),\n signal: signal // pass the signal to the fetch\n });\n } catch (error) {\n if (error.name !== 'AbortError') {\n console.error('Network request failed:', error);\n }\n throw error;\n }\n }\n }, {\n key: \"replacePlaceholdersWithVariables\",\n value: function replacePlaceholdersWithVariables(original) {\n var request = JSON.parse(JSON.stringify(original));\n var mergedVariables = {};\n _.forEach(window.globals, function (value, key) {\n mergedVariables[key] = value;\n });\n if (this.variables) {\n _.forEach(this.variables, function (value, key) {\n mergedVariables[key] = value;\n });\n }\n _.forEach(mergedVariables, function (value, key) {\n var placeholder = \"{{\".concat(key, \"}}\");\n // Replace in path\n request.path = request.path.replace(new RegExp(placeholder, 'g'), value);\n\n // Replace in requestBody\n if (request.requestBody) {\n request.requestBody = request.requestBody.replace(new RegExp(placeholder, 'g'), value);\n }\n\n // Replace in headers\n if (request.headers) {\n var replaced = JSON.stringify(request.headers).replace(new RegExp(placeholder, 'g'), value);\n request.headers = JSON.parse(replaced);\n }\n\n // Replace in queryParams\n if (request.queryParams) {\n var _replaced = JSON.stringify(request.queryParams).replace(new RegExp(placeholder, 'g'), value);\n request.queryParams = JSON.parse(_replaced);\n }\n });\n return request;\n }\n }, {\n key: \"executePreRequestScript\",\n value: function executePreRequestScript(model, consoleOutput) {\n var _this = this;\n return new Promise(function (resolve, reject) {\n var script = model.preRequestScript;\n var resultFrame = document.getElementById('preRequest');\n _this.variables = {};\n window.preRequestComplete = function (updatedModel, error) {\n if (error) {\n reject(error);\n } else {\n resolve(updatedModel);\n }\n };\n window.temp_variable = _this.variables;\n window.currentRequest = model;\n window.consoleOutput = consoleOutput;\n resultFrame.srcdoc = \"\");\n });\n }\n }, {\n key: \"executePostRequestScript\",\n value: function executePostRequestScript(script, response, consoleOutput) {\n var _this2 = this;\n return new Promise(function (resolve, reject) {\n var resultFrame = document.getElementById('postRequest');\n window.response = response;\n window.temp_variable = _this2.variables;\n window.postRequestComplete = function (response, error) {\n if (error) {\n reject(error);\n } else {\n resolve(response);\n }\n };\n window.consoleOutput = consoleOutput;\n resultFrame.srcdoc = \"\");\n });\n }\n }]);\n return APIClient;\n}();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (APIClient);\n\n//# sourceURL=webpack://APITestManager/./src/APIClient.js?"); + +/***/ }), + +/***/ "./src/APIScenario.js": +/*!****************************!*\ + !*** ./src/APIScenario.js ***! + \****************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var monaco_editor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! monaco-editor */ \"./node_modules/monaco-editor/esm/vs/editor/editor.main.js\");\n/* harmony import */ var _APIScenarioExecutor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./APIScenarioExecutor */ \"./src/APIScenarioExecutor.js\");\n/* harmony import */ var drawflow__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! drawflow */ \"./node_modules/drawflow/dist/drawflow.min.js\");\n/* harmony import */ var drawflow__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(drawflow__WEBPACK_IMPORTED_MODULE_2__);\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n// require.config({paths: {'vs': '/plugins/vs'}});\n\n\n\nvar APIScenario = /*#__PURE__*/function () {\n function APIScenario(apiTester) {\n _classCallCheck(this, APIScenario);\n this.scenarioList = [];\n this.currentIndex = -1;\n this.currentScenario = null;\n this.apiTester = apiTester;\n console.log('constructor');\n }\n _createClass(APIScenario, [{\n key: \"init\",\n value: function init() {\n var _this = this;\n console.log('init');\n this.loadScenarioList();\n this.outputEditor = monaco_editor__WEBPACK_IMPORTED_MODULE_0__.editor.create(document.getElementById('output'), {\n value: '',\n automaticLayout: true\n });\n this.bindEvents();\n var id = document.getElementById('drawflow');\n this.editor = new (drawflow__WEBPACK_IMPORTED_MODULE_2___default())(id);\n this.editor.reroute = true;\n this.editor.reroute_fix_curvature = true;\n this.editor.force_first_input = true;\n this.editor.start();\n this.editor.on('contextmenu', function (event) {\n console.log(event);\n console.log('contextmenu');\n //get class of target node\n\n console.log(event.target.id);\n var node = _this.editor.getNodeFromId(event.target.id);\n console.log(node);\n });\n this.showOutput = true;\n }\n }, {\n key: \"loadScenarioList\",\n value: function loadScenarioList(callback) {\n var me = this;\n this.currentAjaxRequest = $.ajax({\n url: '/mgmt/api_scenario/list.do',\n type: 'GET',\n contentType: 'application/json',\n success: function success(data) {\n me.scenarioList = data;\n var drawflowData = {\n drawflow: {\n Home: {\n data: {}\n }\n }\n };\n data.forEach(function (scenario) {\n var scenarioData = null;\n try {\n scenarioData = JSON.parse(scenario.scenario);\n } catch (e) {\n scenarioData = {};\n }\n drawflowData.drawflow[scenario.id] = {\n data: scenarioData\n };\n });\n me.editor[\"import\"](drawflowData);\n me.editor.changeModule('Home');\n },\n error: function error(response, textStatus, errorThrown) {\n me.hideLoadingOverlay();\n $('.toast-body').text(response.responseJSON.error);\n $('.toast').toast('show');\n },\n complete: function complete() {\n me.renderScenarioList();\n if (callback) {\n callback();\n }\n me.hideLoadingOverlay();\n }\n });\n }\n }, {\n key: \"getScenarioList\",\n value: function getScenarioList() {\n return this.scenarioList;\n }\n }, {\n key: \"openScenario\",\n value: function openScenario(event) {\n event.preventDefault();\n var scenarioId = $(event.target).closest('li').data('id');\n this.openScenarioById(scenarioId);\n }\n }, {\n key: \"openScenarioById\",\n value: function openScenarioById(scenarioId) {\n document.querySelectorAll(\".api-scenario-list li\").forEach(function (node) {\n node.classList.remove('selected');\n });\n\n //find li by data-id and add class selected\n document.querySelector(\".api-scenario-list li[data-id=\\\"\".concat(scenarioId, \"\\\"]\")).classList.add('selected');\n this.editor.changeModule(scenarioId);\n this.currentScenario = scenarioId;\n }\n }, {\n key: \"getScenario\",\n value: function getScenario(scenarioId) {\n return this.getScenarioList().find(function (scenario) {\n return scenario.id === scenarioId;\n });\n }\n }, {\n key: \"showLoadingOverlay\",\n value: function showLoadingOverlay() {\n $(\"#loading-overlay\").show();\n }\n }, {\n key: \"hideLoadingOverlay\",\n value: function hideLoadingOverlay() {\n $(\"#loading-overlay\").hide();\n }\n }, {\n key: \"showNewScenarioModal\",\n value: function showNewScenarioModal() {\n $('#new_scenario_modal').find('input').val('');\n $('#new_scenario_modal').modal('show');\n }\n }, {\n key: \"createScenario\",\n value: function createScenario() {\n var name = $('#new_scenario_name').val();\n var me = this;\n me.showLoadingOverlay();\n this.currentAjaxRequest = $.ajax({\n url: '/mgmt/api_scenario/create.do',\n type: 'POST',\n contentType: 'application/json',\n data: JSON.stringify({\n name: name,\n scenario: \"{}\",\n description: \"\"\n }),\n success: function success(data) {\n me.loadScenarioList(function () {\n me.openScenarioById(data.id);\n var start = \"\\n
    \\n
    Start
    \\n
    \\n \";\n me.editor.addNode('Start', 0, 1, 100, 100, 'start', {}, start);\n me.saveScenario();\n });\n },\n error: function error(response, textStatus, errorThrown) {\n me.hideLoadingOverlay();\n $('.toast-body').text(response.responseJSON.error);\n $('.toast').toast('show');\n },\n complete: function complete() {\n me.hideLoadingOverlay();\n $('#new_scenario_modal').modal('hide');\n }\n });\n }\n }, {\n key: \"saveScenario\",\n value: function saveScenario() {\n if (this.currentScenario !== null) {\n var data = this.editor[\"export\"]();\n console.log(data.drawflow[this.currentScenario].data);\n var updatedScenario = this.getScenario(this.currentScenario);\n updatedScenario.scenario = JSON.stringify(data.drawflow[this.currentScenario].data);\n var me = this;\n me.showLoadingOverlay();\n this.currentAjaxRequest = $.ajax({\n url: '/mgmt/api_scenario/update.do',\n type: 'POST',\n contentType: 'application/json',\n data: JSON.stringify(updatedScenario),\n error: function error(response, textStatus, errorThrown) {\n me.hideLoadingOverlay();\n $('.toast-body').text(response.responseJSON.error);\n $('.toast').toast('show');\n },\n complete: function complete() {\n me.hideLoadingOverlay();\n $('.toast-body').text('저장되었습니다.');\n $('.toast').toast('show');\n }\n });\n }\n }\n }, {\n key: \"showDeleteModal\",\n value: function showDeleteModal(event) {\n var id = $(event.currentTarget).closest('li').data('id');\n $('#confirm_delete_scenario_modal').find('.confirm_delete_scenario').data('id', id);\n $('#confirm_delete_scenario_modal').modal('show');\n }\n }, {\n key: \"removeScenario\",\n value: function removeScenario(event) {\n var id = $(event.currentTarget).data('id');\n var me = this;\n me.showLoadingOverlay();\n this.currentAjaxRequest = $.ajax({\n url: '/mgmt/api_scenario/delete.do',\n type: 'POST',\n contentType: 'application/json',\n data: JSON.stringify({\n id: id\n }),\n error: function error(response, textStatus, errorThrown) {\n me.hideLoadingOverlay();\n $('.toast-body').text(response.responseJSON.error);\n $('.toast').toast('show');\n },\n complete: function complete() {\n me.hideLoadingOverlay();\n $('#confirm_delete_scenario_modal').modal('hide');\n $('.toast-body').text('삭제되었습니다.');\n $('.toast').toast('show');\n me.editor.changeModule('Home');\n me.loadScenarioList(function () {\n if (me.getScenarioList().length > 0) me.openScenarioById(me.getScenarioList()[0].id);\n });\n }\n });\n }\n }, {\n key: \"toggleOutput\",\n value: function toggleOutput() {\n // Define your selectors as constants for easy changes and better readability\n var scenarioContentSelector = '.api-scenario-content';\n var scenarioOutputSelector = '.api-scenario-output';\n var scenarioOutputBodySelector = '.api-scenario-output-body';\n var drawflowSelector = '#drawflow';\n var scenarioEditorSelector = '.scenario_editor';\n\n // Ensure parentHeight is a number\n var parentHeight = parseInt($(scenarioContentSelector).css('height'), 10);\n\n // Toggle the showOutput state\n this.showOutput = !this.showOutput;\n if (!this.showOutput) {\n $(scenarioOutputSelector).css('flex', '0');\n $(scenarioOutputBodySelector).hide();\n var editorHeight = $(scenarioEditorSelector).css('height');\n $(drawflowSelector).css('height', editorHeight);\n $(scenarioOutputSelector).removeClass('halfHeight');\n $(drawflowSelector).removeClass('halfHeight');\n } else {\n $(scenarioOutputSelector).css('flex', '1');\n $(scenarioOutputSelector).addClass('halfHeight');\n $(scenarioOutputBodySelector).show();\n $(drawflowSelector).addClass('halfHeight');\n $(drawflowSelector).css('height', parentHeight / 2);\n }\n\n // Adjustments for when parentHeight isn't a valid number\n if (isNaN(parentHeight)) {\n console.error('parentHeight is not a number. Check the height of the api-scenario-content element.');\n // Fallback or additional error handling can be placed here\n }\n }\n }, {\n key: \"resizeEditor\",\n value: function resizeEditor() {\n //FIXME: 창 크기 변경시 자동으로 editor 크기가 조정되지 않아서, 0으로 강제 변경후 다시 layout() 호출\n this.outputEditor.layout({\n width: 0\n });\n this.outputEditor.layout({});\n }\n }, {\n key: \"runScript\",\n value: function runScript() {\n console.log(this.editor[\"export\"]().drawflow);\n var graph = _APIScenarioExecutor__WEBPACK_IMPORTED_MODULE_1__[\"default\"].extractGraphFromStart(this.editor[\"export\"]().drawflow[this.currentScenario].data);\n this.executor = new _APIScenarioExecutor__WEBPACK_IMPORTED_MODULE_1__[\"default\"](graph, this.apiTester, this.outputEditor);\n }\n }, {\n key: \"runScenarioAll\",\n value: function runScenarioAll() {\n if (!this.executor) {\n this.runScript();\n }\n if (!this.executor.isDone) {\n this.executor.executeAll();\n } else {\n this.executor.reset();\n }\n }\n }, {\n key: \"runScenarioStep\",\n value: function runScenarioStep() {\n if (!this.executor) {\n this.runScript();\n }\n if (!this.executor.isDone) {\n this.executor.executeCurrentNode();\n this.executor.moveToNextNode();\n } else {\n this.executor.reset();\n }\n }\n }, {\n key: \"resetScenario\",\n value: function resetScenario() {}\n }, {\n key: \"pauseScenario\",\n value: function pauseScenario() {}\n }, {\n key: \"stopScenario\",\n value: function stopScenario() {\n if (this.executor) this.executor.reset();\n this.outputEditor.setValue('');\n }\n }, {\n key: \"addStart\",\n value: function addStart() {\n var start = \"\\n
    \\n
    Start
    \\n
    \\n \";\n this.editor.addNode('Start', 0, 1, 100, 100, 'start', {}, start);\n }\n }, {\n key: \"bindEvents\",\n value: function bindEvents() {\n var events = [{\n type: 'click',\n selector: '.open_scenario',\n action: this.openScenario.bind(this)\n }, {\n type: 'click',\n selector: '.export',\n action: this.runScript.bind(this)\n }, {\n type: 'click',\n selector: '.toggle_output',\n action: this.toggleOutput.bind(this)\n }, {\n type: 'click',\n selector: '.run_scenario_step',\n action: this.runScenarioStep.bind(this)\n }, {\n type: 'click',\n selector: '.run_scenario_all',\n action: this.runScenarioAll.bind(this)\n }, {\n type: 'click',\n selector: '.reset_scenario',\n action: this.resetScenario.bind(this)\n }, {\n type: 'click',\n selector: '.pause_scenario',\n action: this.pauseScenario.bind(this)\n }, {\n type: 'click',\n selector: '.stop_scenario',\n action: this.stopScenario.bind(this)\n }, {\n type: 'click',\n selector: '#new_scenario',\n action: this.showNewScenarioModal.bind(this)\n }, {\n type: 'click',\n selector: '.create_scenario',\n action: this.createScenario.bind(this)\n }, {\n type: 'click',\n selector: '.save_scenario',\n action: this.saveScenario.bind(this)\n },\n // {type: 'click', selector: '.add_start', action: this.addStart.bind(this)},\n {\n type: 'click',\n selector: '.delete_scenario',\n action: this.showDeleteModal.bind(this)\n }, {\n type: 'click',\n selector: '.confirm_delete_scenario',\n action: this.removeScenario.bind(this)\n }, {\n type: 'click',\n selector: '.stop_scenario',\n action: this.stopScenario.bind(this)\n }];\n for (var _i = 0, _events = events; _i < _events.length; _i++) {\n var event = _events[_i];\n $(document).on(event.type, event.selector, event.action);\n }\n window.addEventListener('resize', this.resizeEditor.bind(this));\n var me = this;\n $('#drawflow').droppable({\n drop: function drop(event, ui) {\n var x = ui.offset.left - $(this).offset().left;\n var y = ui.offset.top - $(this).offset().top;\n var dataset = ui.draggable[0].dataset;\n var node = \"
    API
    \".concat(dataset.name, \"
    \");\n me.editor.addNode(dataset.name, 1, 1, x, y, dataset.nodeType, dataset, node);\n }\n });\n }\n }, {\n key: \"scenarioListTemplate\",\n value: function scenarioListTemplate(scenario) {\n return \"\\n
  • \\n \").concat(scenario.name, \"\\n
    \\n \\n \\n
    \\n
  • \\n \");\n }\n }, {\n key: \"renderScenarioList\",\n value: function renderScenarioList() {\n var _this2 = this;\n var scenarioList = this.getScenarioList();\n var scenarioListHtml = scenarioList.map(function (scenario) {\n return _this2.scenarioListTemplate(scenario);\n }).join('');\n $('.api-scenario-list').html(scenarioListHtml);\n var nodes = document.querySelectorAll(\".api-scenario-list li\");\n nodes.forEach(function (node) {\n if ($(node).data('id') === _this2.currentScenario) {\n node.classList.add('selected');\n }\n });\n }\n }]);\n return APIScenario;\n}();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (APIScenario);\n\n//# sourceURL=webpack://APITestManager/./src/APIScenario.js?"); + +/***/ }), + +/***/ "./src/APIScenarioExecutor.js": +/*!************************************!*\ + !*** ./src/APIScenarioExecutor.js ***! + \************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var monaco_editor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! monaco-editor */ \"./node_modules/monaco-editor/esm/vs/editor/editor.main.js\");\n/* harmony import */ var _APIClient__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./APIClient */ \"./src/APIClient.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n\n\nvar APIScenarioExecutor = /*#__PURE__*/function () {\n function APIScenarioExecutor(graph, apiTester, outputEditor) {\n _classCallCheck(this, APIScenarioExecutor);\n this.graph = graph; // The graph data\n this.apiClient = new _APIClient__WEBPACK_IMPORTED_MODULE_1__[\"default\"]();\n this.apiTester = apiTester;\n this.outputEditor = outputEditor;\n this.reset();\n }\n\n // Helper method to find the start node ID\n _createClass(APIScenarioExecutor, [{\n key: \"findStartNodeId\",\n value: function findStartNodeId() {\n for (var nodeId in this.graph) {\n if (this.graph[nodeId][\"class\"] === 'start') {\n return nodeId;\n }\n }\n return null; // Return null if no start node is found\n }\n }, {\n key: \"reset\",\n value: function reset() {\n this.currentNodeId = this.findStartNodeId(); // Initialize at the 'start' node\n this.visitedNodes = new Set(); // Keep track of visited nodes\n this.isRunning = false;\n this.isDone = false;\n var allNodes = document.querySelector('#drawflow').querySelectorAll('.drawflow-node');\n allNodes.forEach(function (node) {\n node.classList.remove('current-execution');\n node.classList.remove('result-success');\n node.classList.remove('result-error');\n node.classList.remove('result-abort');\n });\n }\n }, {\n key: \"executeCurrentNode\",\n value: function executeCurrentNode() {\n var _this = this;\n return new Promise(function (resolve, reject) {\n console.log(_this.currentNodeId);\n var allNodes = document.querySelector('#drawflow').querySelectorAll('.drawflow-node');\n allNodes.forEach(function (node) {\n node.classList.remove('current-execution');\n });\n if (!_this.currentNodeId) {\n console.log('No current node to execute.');\n return;\n }\n var currentNode = _this.graph[_this.currentNodeId];\n if (currentNode) {\n _this.isRunning = true;\n _this.visitedNodes.add(_this.currentNodeId); // Mark this node as visited\n\n var nodeElement = document.querySelector('#drawflow').querySelector(\".drawflow-node[id=\\\"node-\".concat(_this.currentNodeId, \"\\\"]\"));\n if (nodeElement) {\n nodeElement.classList.add('current-execution');\n } else {\n console.error('Node with ID ' + _this.currentNodeId + ' not found');\n }\n if (currentNode[\"class\"] === 'api') {\n var model = JSON.parse(JSON.stringify(_this.apiTester.getApiRequestModel(currentNode.data.id)));\n model.responseModel = {};\n _this.appendLog(\"Executing API [\".concat(model.name, \"]\"));\n _this.apiClient.sendAPIRequest(model, _this.logHttpRequest.bind(_this)).then(function (response) {\n _this.isRunning = false;\n _this.logHttpResponse(response);\n if (response.status === 200 || response.status === 201) {\n nodeElement.classList.add('result-success');\n } else {\n nodeElement.classList.add('result-error');\n }\n resolve();\n })[\"catch\"](function (error) {\n nodeElement.classList.add('result-abort');\n $('.toast-body').text(error.message);\n $('.toast').toast('show');\n _this.appendLog(error.message);\n reject(error);\n });\n console.log(\"Executing API request for node: \".concat(currentNode.id, \" - \").concat(currentNode.name));\n } else if (currentNode[\"class\"] === 'start') {\n _this.appendLog('Starting API scenario\\n');\n nodeElement.classList.add('result-success');\n resolve();\n } else {\n console.log(\"Executing script for node: \".concat(currentNode.id, \" - \").concat(currentNode.name));\n resolve();\n }\n }\n });\n }\n }, {\n key: \"appendLog\",\n value: function appendLog(text) {\n var range = new monaco_editor__WEBPACK_IMPORTED_MODULE_0__.Range(this.outputEditor.getModel().getLineCount(), 1, this.outputEditor.getModel().getLineCount(), 1);\n var id = {\n major: 1,\n minor: 1\n };\n var op = {\n identifier: id,\n range: range,\n text: text + '\\n',\n forceMoveMarkers: true\n };\n this.outputEditor.executeEdits(\"my-source\", [op]);\n }\n }, {\n key: \"logHttpRequest\",\n value: function logHttpRequest(model) {\n console.log(model);\n var log = \"[API Request]\\n\".concat(model.method, \" \").concat(model.path, \" HTTP/1.1\\n[Request Headers]\\n\").concat(this.parseRequestHeaders(model.headers), \"\\n[Request Body]\\n\").concat(model.requestBody);\n this.appendLog(log);\n }\n }, {\n key: \"logHttpResponse\",\n value: function logHttpResponse(response) {\n var log = \"[Response]\\nHTTP/1.1 \".concat(response.status, \"\\n[Response Headers]\\n\").concat(this.parseHeaders(response.headers), \"\\n[Response Body]\\n\").concat(response.body);\n this.appendLog(log);\n }\n }, {\n key: \"parseRequestHeaders\",\n value: function parseRequestHeaders(headers) {\n var parsedHeaders = '';\n headers.forEach(function (header) {\n if (header.enabled) {\n parsedHeaders += \"\".concat(header.key, \": \").concat(header.value, \"\\n\");\n }\n });\n return parsedHeaders;\n }\n }, {\n key: \"parseHeaders\",\n value: function parseHeaders(headers) {\n //convert object to string with \\n separation\n //sort header by key\n\n var parsedHeaders = '';\n var sortedKeys = Object.keys(headers).sort(); // Sorting the keys alphabetically\n sortedKeys.forEach(function (key) {\n parsedHeaders += \"\".concat(key, \": \").concat(headers[key], \"\\n\");\n });\n return parsedHeaders;\n }\n\n // Method to move to the next node\n }, {\n key: \"moveToNextNode\",\n value: function moveToNextNode() {\n var _this2 = this;\n var currentNode = this.graph[this.currentNodeId];\n console.log(currentNode);\n if (currentNode && currentNode.connections.length > 0) {\n // Find the next unvisited node\n var nextNode = currentNode.connections.find(function (nodeId) {\n return !_this2.visitedNodes.has(nodeId);\n });\n if (nextNode) {\n this.currentNodeId = nextNode;\n } else {\n console.log('No more unvisited connections to move to.');\n this.currentNodeId = null; // No more nodes to visit\n }\n } else {\n console.log('Current node has no connections or does not exist.');\n this.currentNodeId = null; // No more nodes to visit\n this.isDone = true;\n }\n }\n }, {\n key: \"executeAll\",\n value: function () {\n var _executeAll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n if (!this.currentNodeId) {\n _context.next = 14;\n break;\n }\n console.log(this.currentNodeId);\n _context.prev = 2;\n _context.next = 5;\n return this.executeCurrentNode();\n case 5:\n _context.next = 10;\n break;\n case 7:\n _context.prev = 7;\n _context.t0 = _context[\"catch\"](2);\n console.error('Error executing node: ', _context.t0);\n // Handle error or break loop if necessary\n case 10:\n _context.next = 12;\n return this.moveToNextNodeWithDelay(250);\n case 12:\n _context.next = 0;\n break;\n case 14:\n console.log('Completed execution of all API nodes.');\n case 15:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this, [[2, 7]]);\n }));\n function executeAll() {\n return _executeAll.apply(this, arguments);\n }\n return executeAll;\n }()\n }, {\n key: \"moveToNextNodeWithDelay\",\n value: function moveToNextNodeWithDelay(delay) {\n var _this3 = this;\n return new Promise(function (resolve) {\n setTimeout(function () {\n _this3.moveToNextNode();\n resolve();\n }, delay);\n });\n }\n }], [{\n key: \"extractGraphFromStart\",\n value: function extractGraphFromStart(graphData) {\n console.log(graphData);\n var graph = {};\n\n // Helper function to recursively build the graph\n function buildGraph(nodeId) {\n var node = graphData[nodeId];\n if (!node || graph[nodeId]) {\n // If the node doesn't exist or has already been visited, stop the recursion\n return;\n }\n\n // Initialize the node in the graph\n graph[nodeId] = {\n id: node.id,\n name: node.name,\n \"class\": node[\"class\"],\n data: node.data,\n connections: []\n };\n\n // If the node has outputs, recursively add connected nodes\n if (node.outputs) {\n Object.values(node.outputs).forEach(function (output) {\n output.connections.forEach(function (connection) {\n graph[nodeId].connections.push(connection.node);\n buildGraph(connection.node); // Recurse\n });\n });\n }\n }\n\n // Find the start node\n for (var nodeId in graphData) {\n if (graphData[nodeId][\"class\"] === 'start') {\n buildGraph(nodeId); // Start building the graph from the 'start' node\n break; // Assuming there's only one start node\n }\n }\n return graph;\n }\n }]);\n return APIScenarioExecutor;\n}();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (APIScenarioExecutor);\n\n//# sourceURL=webpack://APITestManager/./src/APIScenarioExecutor.js?"); + +/***/ }), + +/***/ "./src/APITester.js": +/*!**************************!*\ + !*** ./src/APITester.js ***! + \**************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var monaco_editor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! monaco-editor */ \"./node_modules/monaco-editor/esm/vs/editor/editor.main.js\");\n/* harmony import */ var _APIClient__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./APIClient */ \"./src/APIClient.js\");\n/* harmony import */ var _components_EditableInput__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/EditableInput */ \"./src/components/EditableInput.js\");\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n\n\n\nvar APITester = /*#__PURE__*/function () {\n function APITester() {\n _classCallCheck(this, APITester);\n this.servers = [];\n this.apiTabTitleTarget = '#apiRequestTabTitle';\n this.apiTabContentTarget = '#apiRequestTabContent';\n this.collectionTarget = '#side_menubar';\n this.currentIndex = 0;\n this.apiRequests = []; //탭 열린 API\n this.collections = []; //API 컬렉션\n this.requestEditors = []; //API request body editor\n this.responseEditors = []; //API response body editor\n this.consoleEditors = []; //API console editor\n this.preRequestEditors = [];\n this.postRequestEditors = [];\n this.apiClient = new _APIClient__WEBPACK_IMPORTED_MODULE_1__[\"default\"]();\n console.log('test');\n }\n _createClass(APITester, [{\n key: \"renderServers\",\n value: function renderServers(selectedServer) {\n var optionsHtml = this.servers.map(function (server) {\n return \"\\n \\n \");\n }).join('');\n return \"\");\n }\n }, {\n key: \"basePath\",\n value: function basePath(serverId) {\n if (serverId === undefined || serverId === null || serverId === '') {\n return '';\n }\n return this.servers.filter(function (server) {\n return server.id == serverId;\n })[0].basePath; // == : 타입 비교 없이 값만 비교\n }\n }, {\n key: \"apiRequestTemplate\",\n value: function apiRequestTemplate(apiRequest, index) {\n return \"\\n
    \\n
    \").concat(apiRequest.collectionName, \" > \").concat(apiRequest.name, \"
    \\n
    \\n
    \\n \\n \\n
    \\n
    \\n \").concat(this.renderServers(apiRequest.server), \"\\n \\n
    \\n
    \\n \\n \\n
    \\n
    \\n
    \\n \\n \\n
    \\n
      \\n
    • \\n \\n
    • \\n
    • \\n \\n
    • \\n
    • \\n \\n
    • \\n
    • \\n \\n
    • \\n
    • \\n \\n
    • \\n
    \\n
    \\n
    \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \").concat(this.renderParams(apiRequest.queryParams), \"\\n \\n
    #\\uC774\\uB984\\uAC12\\n \\n
    \\n
    \\n
    \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \").concat(this.renderHeaders(apiRequest.headers), \"\\n \\n
    #\\uC774\\uB984\\uAC12\\n \\n
    \\n
    \\n
    \\n \\n
    \\n
    \\n
    \\n
    \\n
    \\n
    \\n
    \\n
    \\n
    \\n
    \\n Response\\n \\n \\n \\n
    \\n
      \\n
    • \\n \\n
    • \\n
    • \\n \\n
    • \\n
    • \\n \\n
    • \\n
    \\n
    \\n
    \\n
    \\n
    \\n
    \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n
    \\uC774\\uB984\\uAC12
    \\n
    \\n
    \\n
    \\n
    \\n
    \\n
    \\n \");\n }\n }, {\n key: \"queryParamTemplate\",\n value: function queryParamTemplate(queryParam, index) {\n return \"\\n \\n \\n
    \\n \\n
    \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \");\n }\n }, {\n key: \"headerTemplate\",\n value: function headerTemplate(header, index) {\n return \"\\n \\n \\n
    \\n \\n
    \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \");\n }\n }, {\n key: \"responseHeaderTemplate\",\n value: function responseHeaderTemplate(key, value) {\n return \"\\n \\n \\n \\n \\n \\n \\n \\n \\n \");\n }\n }, {\n key: \"collectionTemplate\",\n value: function collectionTemplate(collection, index) {\n var _this = this;\n return \"\\n
  • \\n
    \\n \\n
    \\n \\n \\n
    \\n
    \\n
    \\n
      \\n \").concat(collection.apis.map(function (api, apiIndex) {\n return _this.collectionApiTemplate(api, apiIndex, collection.id);\n }).join(''), \"\\n
    \\n
    \\n
  • \\n \");\n }\n }, {\n key: \"collectionApiTemplate\",\n value: function collectionApiTemplate(api, apiIndex, collectionId) {\n return \"\\n
  • \\n \").concat(api.name, \"\\n
    \\n \\n \\n
    \\n
  • \\n \");\n }\n }, {\n key: \"init\",\n value: function init(servers) {\n if (servers) {\n this.servers = servers;\n if (this.servers.length === 0) {\n $('.toast-body').text('서버관리에서 서버를 등록해주세요.');\n $('.toast').toast('show');\n }\n }\n this.bindEvents();\n this.loadCollections();\n }\n }, {\n key: \"bindEvents\",\n value: function bindEvents() {\n var events = [{\n selector: '.btn_add_header',\n action: this.addHeader.bind(this)\n }, {\n selector: '.btn_remove_header',\n action: this.removeHeader.bind(this)\n }, {\n selector: '.btn_add_query',\n action: this.addQueryParam.bind(this)\n }, {\n selector: '.btn_remove_query',\n action: this.removeQueryParam.bind(this)\n }, {\n selector: '.send',\n action: this.handleSendAPIRequest.bind(this)\n }, {\n selector: '.save',\n action: this.saveAPIRequest.bind(this)\n }, {\n selector: '.save_collection',\n action: this.addCollection.bind(this)\n }, {\n selector: '#cancel-ajax',\n action: this.cancelAjaxRequest.bind(this)\n }, {\n selector: '#new_collection',\n action: this.showNewCollectionModal.bind(this)\n }, {\n selector: '#new_request',\n action: this.showNewApiRequestModal.bind(this)\n }, {\n selector: '.edit_collection',\n action: this.showCollectionEditModal.bind(this)\n }, {\n selector: '.delete_collection',\n action: this.showCollectionDeleteModal.bind(this)\n }, {\n selector: '.confirm_delete',\n action: this.removeCollection.bind(this)\n }, {\n selector: '.add_new_request',\n action: this.addAPIRequest.bind(this)\n }, {\n selector: '.edit_api_request',\n action: this.showEditNameModal.bind(this)\n }, {\n selector: '.delete_api_request',\n action: this.showDeleteApiRequestModal.bind(this)\n }, {\n selector: '.open_api_request',\n action: this.openApiRequest.bind(this)\n }, {\n selector: '.confirm_delete_api',\n action: this.deleteApiRequest.bind(this)\n }, {\n selector: '.close_tab',\n action: this.closeTab.bind(this)\n }];\n for (var _i = 0, _events = events; _i < _events.length; _i++) {\n var event = _events[_i];\n $(document).on('click', event.selector, event.action);\n }\n $(document).on('input', '.query_params input', this.handleUIUpdate.bind(this));\n $(document).on('input', '.query_params input', this.buildPath.bind(this));\n $(document).on('change', '.query_params input', this.handleUIUpdate.bind(this));\n $(document).on('change', '.query_params input', this.buildPath.bind(this));\n $(document).on('change', '.path', this.parseParam.bind(this));\n $(document).on('change', '.request_headers input', this.handleUIUpdate.bind(this));\n $(document).on('change', '.api_request_info select, .api_request_info input', this.handleUIUpdate.bind(this));\n $(document).on('change', '.api_request_info select', this.handleUpdateServer.bind(this));\n window.addEventListener('resize', this.resizeEditor.bind(this));\n }\n }, {\n key: \"resizeEditor\",\n value: function resizeEditor() {\n //FIXME: 창 크기 변경시 자동으로 editor 크기가 조정되지 않아서, 0으로 강제 변경후 다시 layout() 호출\n\n for (var i = 0; i < this.requestEditors.length; i++) {\n this.requestEditors[i].layout({\n width: 0\n });\n }\n for (var _i2 = 0; _i2 < this.responseEditors.length; _i2++) {\n this.responseEditors[_i2].layout({\n width: 0\n });\n }\n for (var _i3 = 0; _i3 < this.preRequestEditors.length; _i3++) {\n this.preRequestEditors[_i3].layout({\n width: 0\n });\n }\n for (var _i4 = 0; _i4 < this.postRequestEditors.length; _i4++) {\n this.postRequestEditors[_i4].layout({\n width: 0\n });\n }\n for (var _i5 = 0; _i5 < this.requestEditors.length; _i5++) {\n this.requestEditors[_i5].layout({});\n }\n for (var _i6 = 0; _i6 < this.responseEditors.length; _i6++) {\n this.responseEditors[_i6].layout({});\n }\n for (var _i7 = 0; _i7 < this.preRequestEditors.length; _i7++) {\n this.preRequestEditors[_i7].layout({});\n }\n for (var _i8 = 0; _i8 < this.postRequestEditors.length; _i8++) {\n this.postRequestEditors[_i8].layout({});\n }\n }\n }, {\n key: \"showCollectionDeleteModal\",\n value: function showCollectionDeleteModal(event) {\n var collectionId = $(event.currentTarget).closest('button').data('collection');\n $('#confirm_delete_modal').find('.confirm_delete').data('id', collectionId);\n $('#confirm_delete_modal').modal('show');\n }\n }, {\n key: \"getApiRequestModel\",\n value: function getApiRequestModel(apiId) {\n var foundApi = null;\n this.collections.forEach(function (collection) {\n collection.apis.forEach(function (api) {\n if (api.id === apiId) {\n foundApi = api;\n }\n });\n });\n return foundApi;\n }\n }, {\n key: \"showCollectionEditModal\",\n value: function showCollectionEditModal(event) {\n var me = this;\n var collectionId = $(event.currentTarget).closest('button').data('collection');\n var collection = this.collections.filter(function (collection) {\n return collection.id === collectionId;\n })[0];\n $('#edit_name_modal').find('input').val('');\n $('#edit_name_modal').modal('show');\n var saveBtn = $('#edit_name_modal').find('button.change_name');\n saveBtn.off('click');\n saveBtn.on('click', function () {\n collection.name = $('#edit_name_modal').find('input').val();\n me.saveCollection(collection.id, collection.name);\n me.renderCollections();\n $('#edit_name_modal').modal('hide');\n });\n }\n }, {\n key: \"showDeleteApiRequestModal\",\n value: function showDeleteApiRequestModal(event) {\n var collectionId = $(event.currentTarget).closest('li').data('collection');\n var apiId = $(event.currentTarget).closest('li').data('id');\n $('#confirm_delete_api_modal').find('.confirm_delete_api').data('id', apiId);\n $('#confirm_delete_api_modal').find('.confirm_delete_api').data('collection', collectionId);\n $('#confirm_delete_api_modal').modal('show');\n }\n }, {\n key: \"showNewApiRequestModal\",\n value: function showNewApiRequestModal(event) {\n if (this.collections.length == 0) {\n $('.toast-body').text('새로운 컬렉션을 추가해 주세요.');\n $('.toast').toast('show');\n return;\n }\n $('#new_api_request_modal').modal('show');\n }\n }, {\n key: \"showNewCollectionModal\",\n value: function showNewCollectionModal(event) {\n $('#new_collection_modal').find('input').val('');\n $('#new_collection_modal').modal('show');\n }\n }, {\n key: \"showEditNameModal\",\n value: function showEditNameModal(event) {\n var me = this;\n var apiId = $(event.currentTarget).closest('li').data('id');\n var collectionId = $(event.currentTarget).closest('li').data('collection');\n var collection = this.collections.filter(function (collection) {\n return collection.id === collectionId;\n })[0];\n var apiRequest = collection.apis.filter(function (api) {\n return api.id === apiId;\n })[0];\n apiRequest.collectionId = collectionId;\n var saveBtn = $('#edit_name_modal').find('button.change_name');\n saveBtn.off('click');\n saveBtn.on('click', function () {\n apiRequest.name = $('#edit_name_modal').find('input').val();\n me.changeAPIName(apiRequest);\n me.renderCollections();\n $('#edit_name_modal').modal('hide');\n\n //탭이 열려 있으면, 닫았다가 다시 열어야 함.\n me.renderTabHeader();\n me.renderTabContent(apiRequest.index);\n });\n $('#edit_name_modal').find('input').val('');\n $('#edit_name_modal').modal('show');\n }\n }, {\n key: \"getFieldValue\",\n value: function getFieldValue(element) {\n if ($(element).is('select') || $(element).is('input[type=\"text\"]')) {\n return $(element).val();\n }\n if ($(element).is('input[type=\"checkbox\"]')) {\n return $(element).is(':checked');\n }\n }\n }, {\n key: \"handleUIUpdate\",\n value: function handleUIUpdate(event) {\n if (event) {\n event.preventDefault();\n var element = event.currentTarget;\n var fieldName = $(element).attr('name');\n var newValue = this.getFieldValue(element);\n var tabIndex = $('#apiRequestTabContent').children().index($(event.currentTarget).closest('.api_request'));\n var model = this.apiRequests[tabIndex];\n if (fieldName !== '') {\n _.set(model, fieldName, newValue);\n }\n }\n }\n }, {\n key: \"handleUpdateServer\",\n value: function handleUpdateServer(event) {\n var tabIndex = $('#apiRequestTabContent').children().index($(event.currentTarget).closest('.api_request'));\n var model = this.apiRequests[tabIndex];\n var target = $('#api_request_' + model.id);\n target.find('input[name=\"basePath\"]').val(this.basePath(model.server));\n }\n }, {\n key: \"renderParams\",\n value: function renderParams(params) {\n var _this2 = this;\n return params.map(function (param, index) {\n return _this2.queryParamTemplate(param, index);\n }).join('');\n }\n }, {\n key: \"renderHeaders\",\n value: function renderHeaders(headers) {\n var _this3 = this;\n return headers.map(function (header, index) {\n return _this3.headerTemplate(header, index);\n }).join('');\n }\n }, {\n key: \"renderTabHeader\",\n value: function renderTabHeader() {\n var apiRequestTabTitle = $('#apiRequestTabTitle');\n apiRequestTabTitle.empty();\n for (var idx = 0; idx < this.apiRequests.length; idx++) {\n var li = \"
  • \\n \\n
  • \");\n apiRequestTabTitle.append(li);\n }\n }\n }, {\n key: \"renderTabContent\",\n value: function renderTabContent(index) {\n var me = this;\n var apiRequestTabContent = $(this.apiTabContentTarget);\n var model = this.apiRequests[index];\n apiRequestTabContent.append(this.apiRequestTemplate(model, index));\n apiRequestTabContent.find(\"#api_request_\".concat(model.id)).find('.editableInput').each(function () {\n var editableInput = new _components_EditableInput__WEBPACK_IMPORTED_MODULE_2__[\"default\"]({\n name: 'path',\n value: model.path,\n placeholder: 'Enter text here...',\n label: 'Path'\n });\n console.log(this);\n editableInput.init(this, function (event) {\n me.parseParam(event);\n });\n });\n this.openTab(model.id);\n var target = $('#api_request_' + model.id);\n var requestBodyEditor = monaco_editor__WEBPACK_IMPORTED_MODULE_0__.editor.create(target.find(\".request_body\")[0], {\n value: model.requestBody,\n language: 'json',\n automaticLayout: true\n });\n me.requestEditors.push(requestBodyEditor);\n target.find(\".request_body\")[0].addEventListener('shown.bs.tab', function () {\n me.requestEditors[index].layout();\n });\n me.requestEditors[index].onDidChangeModelContent(function (e) {\n model.requestBody = requestBodyEditor.getValue();\n });\n target.find('.request_body_type').on('change', function () {\n var model = requestBodyEditor.getModel();\n monaco_editor__WEBPACK_IMPORTED_MODULE_0__.editor.setModelLanguage(model, $(this).val());\n });\n var responseBodyEditor = monaco_editor__WEBPACK_IMPORTED_MODULE_0__.editor.create(target.find(\".response_body\")[0], {\n value: '',\n language: 'json',\n automaticLayout: true\n });\n me.responseEditors.push(responseBodyEditor);\n var consoleEditor = monaco_editor__WEBPACK_IMPORTED_MODULE_0__.editor.create(target.find(\".console\")[0], {\n value: '',\n automaticLayout: true\n });\n me.consoleEditors.push(consoleEditor);\n var preRequestEditor = monaco_editor__WEBPACK_IMPORTED_MODULE_0__.editor.create(target.find(\".pre-request\")[0], {\n value: model.preRequestScript,\n language: 'javascript',\n automaticLayout: true\n });\n me.preRequestEditors.push(preRequestEditor);\n target.find(\".pre-request\")[0].addEventListener('shown.bs.tab', function () {\n me.preRequestEditors[index].layout();\n });\n me.preRequestEditors[index].onDidChangeModelContent(function (e) {\n model.preRequestScript = preRequestEditor.getValue();\n });\n var postRequestEditor = monaco_editor__WEBPACK_IMPORTED_MODULE_0__.editor.create(target.find(\".post-request\")[0], {\n value: model.postRequestScript,\n language: 'javascript',\n automaticLayout: true\n });\n me.postRequestEditors.push(postRequestEditor);\n target.find(\".post-request\")[0].addEventListener('shown.bs.tab', function () {\n me.postRequestEditors[index].layout();\n });\n me.postRequestEditors[index].onDidChangeModelContent(function (e) {\n model.postRequestScript = postRequestEditor.getValue();\n });\n }\n }, {\n key: \"renderResponse\",\n value: function renderResponse(tabIndex) {\n var _this4 = this;\n var model = this.apiRequests[tabIndex];\n var target = $('#api_request_' + model.id);\n target.find('.response_headers').empty();\n target.find(\".response_status\").empty();\n try {\n var parsedJson = JSON.parse(model.responseModel.body);\n var formattedJson = JSON.stringify(parsedJson, null, 2);\n this.responseEditors[tabIndex].setValue(formattedJson);\n } catch (e) {\n this.responseEditors[tabIndex].setValue(model.responseModel.body);\n }\n if (model.responseModel && model.responseModel.headers) {\n var headers = model.responseModel.headers;\n Object.entries(headers).forEach(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n key = _ref2[0],\n value = _ref2[1];\n target.find('.response_headers').append(_this4.responseHeaderTemplate(key, value));\n });\n }\n target.find(\".response_status\").text(\"status: \" + model.responseModel.status);\n target.find(\".response_time\").text(\"time: \" + model.responseModel.time + \"ms\");\n target.find(\".response_size\").text(\"size: \" + model.responseModel.size + \"bytes\");\n }\n }, {\n key: \"customHelper\",\n value: function customHelper(event) {\n // Create and return the custom helper element\n var name = $(event.target).closest('.api_request_sortable').find('.open_api_request').text().trim();\n var apiId = $(event.target).closest('.api_request_sortable').data('id');\n return \"
    \\n
    \").concat(name, \"
    \\n
    \");\n }\n }, {\n key: \"renderCollections\",\n value: function renderCollections() {\n var select = $('#modal_collection');\n var sidemenu = $(this.collectionTarget);\n select.empty();\n sidemenu.empty();\n for (var i = 0; i < this.collections.length; i++) {\n sidemenu.append(this.renderCollection(this.collections[i], i));\n var option = $('