feat: add websocket upstream adapter

This commit is contained in:
a.tolmachev
2026-04-06 13:23:45 +03:00
parent b5f80c5d2f
commit 45ea011b7f
27 changed files with 978 additions and 30 deletions
+1
View File
@@ -95,6 +95,7 @@
<option value="rest" selected>REST</option>
<option value="graphql">GraphQL</option>
<option value="grpc">gRPC</option>
<option value="websocket">WebSocket</option>
</select>
<div class="form-hint" data-i18n="workspace_setup.protocol_hint">Pre-selected in the operation wizard.</div>
</div>
+2 -2
View File
@@ -181,13 +181,13 @@
<svg class="chevron" width="10" height="10"><use href="icons/general/chevron-down.svg#icon"/></svg>
</button>
<div class="dropdown-menu" x-show="openDropdown === 'protocol'" x-transition>
<template x-for="p in ['rest','graphql','grpc']" :key="p">
<template x-for="p in ['rest','graphql','grpc','websocket']" :key="p">
<button
class="dropdown-item"
:class="{ selected: filterProtocol === p }"
@click="setProtocol(p)"
>
<span x-text="p === 'rest' ? 'REST' : p === 'graphql' ? 'GraphQL' : 'gRPC'"></span>
<span x-text="p === 'rest' ? 'REST' : p === 'graphql' ? 'GraphQL' : p === 'grpc' ? 'gRPC' : 'WebSocket'"></span>
<svg class="check" width="12" height="12"><use href="icons/general/check.svg#icon"/></svg>
</button>
</template>
+2
View File
@@ -416,12 +416,14 @@ document.addEventListener('alpine:init', function() {
protocolBadge(operation) {
if (operation.protocol === 'rest') return 'badge badge-rest';
if (operation.protocol === 'graphql') return 'badge badge-graphql';
if (operation.protocol === 'websocket') return 'badge badge-rest';
return 'badge badge-grpc';
},
protocolLabel(operation) {
if (operation.protocol === 'rest') return 'REST';
if (operation.protocol === 'graphql') return 'GQL';
if (operation.protocol === 'websocket') return 'WS';
return 'gRPC';
},
+1
View File
@@ -399,6 +399,7 @@ document.addEventListener('alpine:init', function() {
return operation.method ? ('REST · ' + operation.method) : 'REST';
}
if (operation.protocol === 'graphql') return 'GraphQL';
if (operation.protocol === 'websocket') return 'WebSocket';
return 'gRPC';
},
+6
View File
@@ -410,6 +410,7 @@ var TRANSLATIONS = {
'workspace_setup.custom_protocol.rest': 'REST',
'workspace_setup.custom_protocol.graphql': 'GraphQL',
'workspace_setup.custom_protocol.grpc': 'gRPC',
'workspace_setup.custom_protocol.websocket': 'WebSocket',
// Wizard
'wizard.back_catalog': 'Operations',
@@ -444,6 +445,8 @@ var TRANSLATIONS = {
'wizard.step1.graphql_tagline': 'Query and mutate a GraphQL schema. Supports queries and mutations over one fixed operation.',
'wizard.step1.grpc_name': 'gRPC',
'wizard.step1.grpc_tagline': 'High-performance binary RPC over HTTP/2. Ideal for low-latency internal services.',
'wizard.step1.websocket_name': 'WebSocket',
'wizard.step1.websocket_tagline': 'Stateful event streams and push-oriented integrations normalized into bounded MCP streaming tools.',
'wizard.step1.query': 'Query',
'wizard.step1.mutation': 'Mutation',
'wizard.step1.unary': 'Unary',
@@ -1192,6 +1195,7 @@ var TRANSLATIONS = {
'workspace_setup.custom_protocol.rest': 'REST',
'workspace_setup.custom_protocol.graphql': 'GraphQL',
'workspace_setup.custom_protocol.grpc': 'gRPC',
'workspace_setup.custom_protocol.websocket': 'WebSocket',
// Wizard
'wizard.back_catalog': 'Операции',
@@ -1226,6 +1230,8 @@ var TRANSLATIONS = {
'wizard.step1.graphql_tagline': 'Запросы и мутации к GraphQL-схеме. Поддерживаются query и mutation для одной фиксированной операции.',
'wizard.step1.grpc_name': 'gRPC',
'wizard.step1.grpc_tagline': 'Высокопроизводительный бинарный RPC поверх HTTP/2. Подходит для низколатентных внутренних сервисов.',
'wizard.step1.websocket_name': 'WebSocket',
'wizard.step1.websocket_tagline': 'Состояние соединения, event streams и push-oriented интеграции, нормализованные в bounded MCP streaming tools.',
'wizard.step1.query': 'Запрос',
'wizard.step1.mutation': 'Мутация',
'wizard.step1.unary': 'Unary',
+6
View File
@@ -58,6 +58,9 @@ document.addEventListener('DOMContentLoaded', function () {
if (protocol === 'grpc' || protocol === 'Grpc') {
return 'var(--accent)';
}
if (protocol === 'websocket' || protocol === 'Websocket') {
return 'var(--teal)';
}
return 'var(--blue)';
}
@@ -68,6 +71,9 @@ document.addEventListener('DOMContentLoaded', function () {
if (protocol === 'grpc' || protocol === 'Grpc') {
return 'gRPC';
}
if (protocol === 'websocket' || protocol === 'Websocket') {
return 'WebSocket';
}
return 'REST';
}
+5 -1
View File
@@ -1,6 +1,6 @@
var currentStep = 1;
var TOTAL_STEPS = 5;
var wizardProtocol = 'rest'; // 'rest' | 'graphql' | 'grpc'
var wizardProtocol = 'rest'; // 'rest' | 'graphql' | 'grpc' | 'websocket'
var wizardMode = 'create'; // 'create' | 'edit'
var wizardEditId = null;
var wizardWorkspaceId = null;
@@ -32,6 +32,10 @@ function defaultProtocolCapabilities() {
supports_execution_modes: ['unary', 'window', 'session', 'async_job'],
supports_transport_behaviors: ['request_response', 'server_stream'],
},
websocket: {
supports_execution_modes: ['window', 'session', 'async_job'],
supports_transport_behaviors: ['server_stream', 'stateful_session', 'deferred_result'],
},
};
}