1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #include "yql_functions_servlet.h"
- #include <yt/yql/providers/yt/provider/yql_yt_provider.h>
- #include <yql/essentials/providers/config/yql_config_provider.h>
- #include <yql/essentials/providers/result/provider/yql_result_provider.h>
- #include <yql/essentials/core/type_ann/type_ann_core.h>
- namespace {
- void OutputKnownFunctions(TStringStream& out)
- {
- using namespace NYql;
- out <<
- "window.yql = {};\n"
- "window.yql.builtinFunctions = [";
- const auto& builtinFuncs = GetBuiltinFunctions();
- for (const auto& func: builtinFuncs) {
- out << '"' << func << "\",";
- }
- out << "];\n";
- out << "window.yql.supportedFunctions = [";
- const THashSet<TStringBuf>* functionsSet[] = {
- &YtDataSourceFunctions(),
- &YtDataSinkFunctions(),
- &ResultProviderFunctions(),
- &ConfigProviderFunctions()
- };
- for (const auto& funcs: functionsSet) {
- for (const auto& func: *funcs) {
- out << '"' << func << "\",";
- }
- }
- out << "];";
- }
- } // namspace
- namespace NYql {
- namespace NHttp {
- void TYqlFunctoinsServlet::DoGet(const TRequest& req, TResponse& resp) const
- {
- Y_UNUSED(req);
- TStringStream out;
- OutputKnownFunctions(out);
- resp.Body = TBlob::FromString(out.Str());
- resp.Headers.AddHeader(THttpInputHeader("Content-Type: text/javascript"));
- }
- } // namspace NNttp
- } // namspace NYql
|