@blokjs/lsp-server 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/completion.d.ts +11 -0
- package/dist/completion.js +269 -0
- package/dist/completion.js.map +1 -0
- package/dist/constants.d.ts +37 -0
- package/dist/constants.js +161 -0
- package/dist/constants.js.map +1 -0
- package/dist/diagnostics.d.ts +17 -0
- package/dist/diagnostics.js +466 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/hover.d.ts +12 -0
- package/dist/hover.js +118 -0
- package/dist/hover.js.map +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +130 -0
- package/dist/server.js.map +1 -0
- package/editors/emacs-lsp.el +21 -0
- package/editors/helix-languages.toml +12 -0
- package/editors/neovim.lua +59 -0
- package/editors/sublime-lsp.json +16 -0
- package/package.json +40 -0
- package/src/__tests__/completion.test.ts +184 -0
- package/src/__tests__/constants.test.ts +142 -0
- package/src/__tests__/diagnostics.test.ts +513 -0
- package/src/__tests__/hover.test.ts +227 -0
- package/src/completion.ts +308 -0
- package/src/constants.ts +194 -0
- package/src/diagnostics.ts +493 -0
- package/src/hover.ts +135 -0
- package/src/server.ts +162 -0
- package/tsconfig.json +18 -0
- package/vitest.config.ts +9 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @blokjs/lsp-server
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Initial public release of Blok packages.
|
|
8
|
+
|
|
9
|
+
This release includes:
|
|
10
|
+
|
|
11
|
+
- Core packages: @blokjs/shared, @blokjs/helper, @blokjs/runner
|
|
12
|
+
- Node packages: @blokjs/api-call, @blokjs/if-else, @blokjs/react
|
|
13
|
+
- Trigger packages: pubsub, queue, webhook, websocket, worker, cron, grpc
|
|
14
|
+
- CLI tool: blokctl
|
|
15
|
+
- Editor support: @blokjs/lsp-server, @blokjs/syntax
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CompletionItem } from "vscode-languageserver";
|
|
2
|
+
/**
|
|
3
|
+
* Provides contextual auto-completion for Blok workflow JSON files via LSP.
|
|
4
|
+
*
|
|
5
|
+
* Offers completions for:
|
|
6
|
+
* - Trigger types, HTTP methods, step types, runtime kinds
|
|
7
|
+
* - Queue/pubsub providers, webhook sources
|
|
8
|
+
* - Node packages, condition types
|
|
9
|
+
* - Top-level and context-specific keys
|
|
10
|
+
*/
|
|
11
|
+
export declare function getCompletions(text: string, offset: number): CompletionItem[];
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCompletions = getCompletions;
|
|
4
|
+
const vscode_languageserver_1 = require("vscode-languageserver");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
/**
|
|
7
|
+
* Provides contextual auto-completion for Blok workflow JSON files via LSP.
|
|
8
|
+
*
|
|
9
|
+
* Offers completions for:
|
|
10
|
+
* - Trigger types, HTTP methods, step types, runtime kinds
|
|
11
|
+
* - Queue/pubsub providers, webhook sources
|
|
12
|
+
* - Node packages, condition types
|
|
13
|
+
* - Top-level and context-specific keys
|
|
14
|
+
*/
|
|
15
|
+
function getCompletions(text, offset) {
|
|
16
|
+
const lines = text.split("\n");
|
|
17
|
+
const pos = offsetToLineChar(text, offset);
|
|
18
|
+
const lineText = lines[pos.line] || "";
|
|
19
|
+
const textBefore = lineText.substring(0, pos.character);
|
|
20
|
+
// Detect which key we're providing a value for
|
|
21
|
+
const keyMatch = textBefore.match(/"(\w+)"\s*:\s*"?$/);
|
|
22
|
+
const parentKey = keyMatch?.[1];
|
|
23
|
+
// Detect enclosing context
|
|
24
|
+
const context = detectContext(text, offset);
|
|
25
|
+
const items = [];
|
|
26
|
+
// Trigger type completions
|
|
27
|
+
if (context === "trigger" || parentKey === "trigger") {
|
|
28
|
+
items.push(...createTriggerTypeCompletions());
|
|
29
|
+
}
|
|
30
|
+
// HTTP method completions
|
|
31
|
+
if (parentKey === "method" && (context === "trigger" || context === "http")) {
|
|
32
|
+
items.push(...createHttpMethodCompletions());
|
|
33
|
+
}
|
|
34
|
+
// Step type completions
|
|
35
|
+
if (parentKey === "type" && context === "steps") {
|
|
36
|
+
items.push(...createStepTypeCompletions());
|
|
37
|
+
}
|
|
38
|
+
// Runtime completions
|
|
39
|
+
if (parentKey === "runtime") {
|
|
40
|
+
items.push(...createRuntimeCompletions());
|
|
41
|
+
}
|
|
42
|
+
// Node package completions
|
|
43
|
+
if (parentKey === "node") {
|
|
44
|
+
items.push(...createNodeCompletions());
|
|
45
|
+
}
|
|
46
|
+
// Queue provider completions
|
|
47
|
+
if (parentKey === "provider" && context === "queue") {
|
|
48
|
+
items.push(...createQueueProviderCompletions());
|
|
49
|
+
}
|
|
50
|
+
// Pubsub provider completions
|
|
51
|
+
if (parentKey === "provider" && context === "pubsub") {
|
|
52
|
+
items.push(...createPubsubProviderCompletions());
|
|
53
|
+
}
|
|
54
|
+
// Webhook source completions
|
|
55
|
+
if (parentKey === "source" && context === "webhook") {
|
|
56
|
+
items.push(...createWebhookSourceCompletions());
|
|
57
|
+
}
|
|
58
|
+
// Condition type completions
|
|
59
|
+
if (parentKey === "type" && context === "conditions") {
|
|
60
|
+
items.push(...createConditionTypeCompletions());
|
|
61
|
+
}
|
|
62
|
+
// Top-level key completions
|
|
63
|
+
if (textBefore.match(/^\s*"$/)) {
|
|
64
|
+
items.push(...createTopLevelKeyCompletions(context));
|
|
65
|
+
}
|
|
66
|
+
return items;
|
|
67
|
+
}
|
|
68
|
+
function detectContext(text, offset) {
|
|
69
|
+
let depth = 0;
|
|
70
|
+
for (let i = offset - 1; i >= 0; i--) {
|
|
71
|
+
if (text[i] === "}" || text[i] === "]")
|
|
72
|
+
depth++;
|
|
73
|
+
if (text[i] === "{" || text[i] === "[") {
|
|
74
|
+
if (depth === 0) {
|
|
75
|
+
const before = text.substring(Math.max(0, i - 100), i);
|
|
76
|
+
const keyMatch = before.match(/"(\w+)"\s*:\s*$/);
|
|
77
|
+
if (keyMatch)
|
|
78
|
+
return keyMatch[1];
|
|
79
|
+
const arrayMatch = before.match(/"(\w+)"\s*:\s*\[[\s\S]*$/);
|
|
80
|
+
if (arrayMatch)
|
|
81
|
+
return arrayMatch[1];
|
|
82
|
+
}
|
|
83
|
+
depth--;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return "root";
|
|
87
|
+
}
|
|
88
|
+
function offsetToLineChar(text, offset) {
|
|
89
|
+
let line = 0;
|
|
90
|
+
let character = 0;
|
|
91
|
+
for (let i = 0; i < offset && i < text.length; i++) {
|
|
92
|
+
if (text[i] === "\n") {
|
|
93
|
+
line++;
|
|
94
|
+
character = 0;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
character++;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return { line, character };
|
|
101
|
+
}
|
|
102
|
+
function createTriggerTypeCompletions() {
|
|
103
|
+
const triggers = [
|
|
104
|
+
{ label: "http", detail: "HTTP trigger", docs: "Trigger on HTTP requests (GET, POST, PUT, DELETE)" },
|
|
105
|
+
{ label: "grpc", detail: "gRPC trigger", docs: "Trigger on gRPC method calls" },
|
|
106
|
+
{ label: "manual", detail: "Manual trigger", docs: "No auto-trigger, invoke programmatically" },
|
|
107
|
+
{ label: "cron", detail: "Cron trigger", docs: "Scheduled execution with cron expressions" },
|
|
108
|
+
{ label: "queue", detail: "Queue trigger", docs: "Message queue consumer (Kafka, RabbitMQ, SQS)" },
|
|
109
|
+
{ label: "pubsub", detail: "Pub/Sub trigger", docs: "Pub/Sub subscriber (GCP, AWS, Azure, Redis, NATS)" },
|
|
110
|
+
{ label: "worker", detail: "Worker trigger", docs: "Background job processing with retries" },
|
|
111
|
+
{ label: "webhook", detail: "Webhook trigger", docs: "External webhook events (GitHub, Stripe, Shopify)" },
|
|
112
|
+
{ label: "websocket", detail: "WebSocket trigger", docs: "Real-time bidirectional communication" },
|
|
113
|
+
{ label: "sse", detail: "SSE trigger", docs: "Server-Sent Events streaming" },
|
|
114
|
+
];
|
|
115
|
+
return triggers.map((t) => ({
|
|
116
|
+
label: t.label,
|
|
117
|
+
kind: vscode_languageserver_1.CompletionItemKind.Enum,
|
|
118
|
+
detail: t.detail,
|
|
119
|
+
documentation: { kind: vscode_languageserver_1.MarkupKind.Markdown, value: t.docs },
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
function createHttpMethodCompletions() {
|
|
123
|
+
const methods = [
|
|
124
|
+
{ label: "GET", docs: "Retrieve resources" },
|
|
125
|
+
{ label: "POST", docs: "Create resources" },
|
|
126
|
+
{ label: "PUT", docs: "Replace resources" },
|
|
127
|
+
{ label: "DELETE", docs: "Delete resources" },
|
|
128
|
+
{ label: "PATCH", docs: "Partially update resources" },
|
|
129
|
+
{ label: "ANY", docs: "Match any HTTP method" },
|
|
130
|
+
];
|
|
131
|
+
return methods.map((m) => ({
|
|
132
|
+
label: m.label,
|
|
133
|
+
kind: vscode_languageserver_1.CompletionItemKind.EnumMember,
|
|
134
|
+
documentation: m.docs,
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
137
|
+
function createStepTypeCompletions() {
|
|
138
|
+
const types = [
|
|
139
|
+
{ label: "module", docs: "Node from npm package (e.g., @blok/api-call)", priority: "1" },
|
|
140
|
+
{ label: "local", docs: "Node defined locally in the project (e.g., ./nodes/my-node)", priority: "2" },
|
|
141
|
+
{ label: "runtime.nodejs", docs: "Execute using Node.js runtime adapter", priority: "3" },
|
|
142
|
+
{ label: "runtime.python3", docs: "Execute using Python 3 runtime adapter (via gRPC)", priority: "4" },
|
|
143
|
+
{ label: "runtime.go", docs: "Execute using Go runtime adapter (Docker container)", priority: "5" },
|
|
144
|
+
{ label: "runtime.java", docs: "Execute using Java runtime adapter (Docker container)", priority: "6" },
|
|
145
|
+
{ label: "runtime.rust", docs: "Execute using Rust runtime adapter (Docker/WASM)", priority: "7" },
|
|
146
|
+
{ label: "runtime.php", docs: "Execute using PHP runtime adapter (Docker container)", priority: "8" },
|
|
147
|
+
{ label: "runtime.csharp", docs: "Execute using C#/.NET runtime adapter", priority: "9" },
|
|
148
|
+
{ label: "runtime.ruby", docs: "Execute using Ruby runtime adapter", priority: "a" },
|
|
149
|
+
];
|
|
150
|
+
return types.map((t) => ({
|
|
151
|
+
label: t.label,
|
|
152
|
+
kind: vscode_languageserver_1.CompletionItemKind.EnumMember,
|
|
153
|
+
documentation: t.docs,
|
|
154
|
+
sortText: t.priority,
|
|
155
|
+
}));
|
|
156
|
+
}
|
|
157
|
+
function createRuntimeCompletions() {
|
|
158
|
+
const runtimes = [
|
|
159
|
+
{ label: "nodejs", docs: "Node.js in-process execution (fastest)" },
|
|
160
|
+
{ label: "bun", docs: "Bun runtime execution" },
|
|
161
|
+
{ label: "python3", docs: "Python 3 via gRPC protocol" },
|
|
162
|
+
{ label: "go", docs: "Go via Docker container" },
|
|
163
|
+
{ label: "java", docs: "Java via Docker container" },
|
|
164
|
+
{ label: "rust", docs: "Rust via Docker container or WASM" },
|
|
165
|
+
{ label: "php", docs: "PHP via Docker container" },
|
|
166
|
+
{ label: "csharp", docs: "C#/.NET via Docker container" },
|
|
167
|
+
{ label: "ruby", docs: "Ruby via Docker container" },
|
|
168
|
+
{ label: "docker", docs: "Generic Docker container runtime" },
|
|
169
|
+
{ label: "wasm", docs: "WebAssembly runtime" },
|
|
170
|
+
];
|
|
171
|
+
return runtimes.map((r) => ({
|
|
172
|
+
label: r.label,
|
|
173
|
+
kind: vscode_languageserver_1.CompletionItemKind.EnumMember,
|
|
174
|
+
documentation: r.docs,
|
|
175
|
+
}));
|
|
176
|
+
}
|
|
177
|
+
function createNodeCompletions() {
|
|
178
|
+
return constants_1.NODE_PACKAGES.map((n) => ({
|
|
179
|
+
label: n.name,
|
|
180
|
+
kind: vscode_languageserver_1.CompletionItemKind.Module,
|
|
181
|
+
documentation: n.description,
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
function createQueueProviderCompletions() {
|
|
185
|
+
const providers = [
|
|
186
|
+
{ label: "kafka", docs: "Apache Kafka distributed event streaming" },
|
|
187
|
+
{ label: "rabbitmq", docs: "RabbitMQ message broker (AMQP)" },
|
|
188
|
+
{ label: "sqs", docs: "AWS Simple Queue Service" },
|
|
189
|
+
{ label: "redis", docs: "Redis-based queue (BullMQ)" },
|
|
190
|
+
{ label: "beanstalk", docs: "Beanstalk work queue" },
|
|
191
|
+
];
|
|
192
|
+
return providers.map((p) => ({
|
|
193
|
+
label: p.label,
|
|
194
|
+
kind: vscode_languageserver_1.CompletionItemKind.EnumMember,
|
|
195
|
+
documentation: p.docs,
|
|
196
|
+
}));
|
|
197
|
+
}
|
|
198
|
+
function createPubsubProviderCompletions() {
|
|
199
|
+
const providers = [
|
|
200
|
+
{ label: "gcp", docs: "Google Cloud Pub/Sub" },
|
|
201
|
+
{ label: "aws", docs: "AWS SNS (Simple Notification Service)" },
|
|
202
|
+
{ label: "azure", docs: "Azure Service Bus" },
|
|
203
|
+
{ label: "redis", docs: "Redis Pub/Sub" },
|
|
204
|
+
{ label: "nats", docs: "NATS messaging system" },
|
|
205
|
+
];
|
|
206
|
+
return providers.map((p) => ({
|
|
207
|
+
label: p.label,
|
|
208
|
+
kind: vscode_languageserver_1.CompletionItemKind.EnumMember,
|
|
209
|
+
documentation: p.docs,
|
|
210
|
+
}));
|
|
211
|
+
}
|
|
212
|
+
function createWebhookSourceCompletions() {
|
|
213
|
+
const sources = [
|
|
214
|
+
{ label: "github", docs: "GitHub webhook events (push, PR, issues, etc.)" },
|
|
215
|
+
{ label: "stripe", docs: "Stripe payment events (checkout, invoice, etc.)" },
|
|
216
|
+
{ label: "shopify", docs: "Shopify e-commerce events (order, product, etc.)" },
|
|
217
|
+
{ label: "custom", docs: "Custom webhook source with HMAC verification" },
|
|
218
|
+
];
|
|
219
|
+
return sources.map((s) => ({
|
|
220
|
+
label: s.label,
|
|
221
|
+
kind: vscode_languageserver_1.CompletionItemKind.EnumMember,
|
|
222
|
+
documentation: s.docs,
|
|
223
|
+
}));
|
|
224
|
+
}
|
|
225
|
+
function createConditionTypeCompletions() {
|
|
226
|
+
return [
|
|
227
|
+
{
|
|
228
|
+
label: "if",
|
|
229
|
+
kind: vscode_languageserver_1.CompletionItemKind.Keyword,
|
|
230
|
+
documentation: "Conditional branch - executes steps when condition is true",
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
label: "else",
|
|
234
|
+
kind: vscode_languageserver_1.CompletionItemKind.Keyword,
|
|
235
|
+
documentation: "Default branch - executes when no 'if' condition matches",
|
|
236
|
+
},
|
|
237
|
+
];
|
|
238
|
+
}
|
|
239
|
+
function createTopLevelKeyCompletions(context) {
|
|
240
|
+
if (context === "root") {
|
|
241
|
+
const keys = [
|
|
242
|
+
{ label: "name", docs: "Workflow name" },
|
|
243
|
+
{ label: "description", docs: "Workflow description" },
|
|
244
|
+
{ label: "version", docs: "Semantic version (e.g., 1.0.0)" },
|
|
245
|
+
{ label: "trigger", docs: "Workflow trigger configuration" },
|
|
246
|
+
{ label: "steps", docs: "Ordered list of execution steps" },
|
|
247
|
+
{ label: "nodes", docs: "Node configuration map" },
|
|
248
|
+
];
|
|
249
|
+
return keys.map((k) => ({
|
|
250
|
+
label: k.label,
|
|
251
|
+
kind: vscode_languageserver_1.CompletionItemKind.Property,
|
|
252
|
+
documentation: k.docs,
|
|
253
|
+
}));
|
|
254
|
+
}
|
|
255
|
+
if (context === "http") {
|
|
256
|
+
return ["method", "path", "accept", "jwt_secret"].map((k) => ({
|
|
257
|
+
label: k,
|
|
258
|
+
kind: vscode_languageserver_1.CompletionItemKind.Property,
|
|
259
|
+
}));
|
|
260
|
+
}
|
|
261
|
+
if (context === "steps") {
|
|
262
|
+
return ["name", "node", "type", "runtime"].map((k) => ({
|
|
263
|
+
label: k,
|
|
264
|
+
kind: vscode_languageserver_1.CompletionItemKind.Property,
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
return [];
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=completion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../src/completion.ts"],"names":[],"mappings":";;AAqBA,wCAkEC;AAvFD,iEAA8G;AAC9G,2CASqB;AAErB;;;;;;;;GAQG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,MAAc;IAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,GAAG,GAAG,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACvC,MAAM,UAAU,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;IAExD,+CAA+C;IAC/C,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvD,MAAM,SAAS,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;IAEhC,2BAA2B;IAC3B,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAE5C,MAAM,KAAK,GAAqB,EAAE,CAAC;IAEnC,2BAA2B;IAC3B,IAAI,OAAO,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QACtD,KAAK,CAAC,IAAI,CAAC,GAAG,4BAA4B,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,0BAA0B;IAC1B,IAAI,SAAS,KAAK,QAAQ,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,MAAM,CAAC,EAAE,CAAC;QAC7E,KAAK,CAAC,IAAI,CAAC,GAAG,2BAA2B,EAAE,CAAC,CAAC;IA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AAkB,CAAC,QAAQ;SACjC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;QACzB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACtD,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,0CAAkB,CAAC,QAAQ;SACjC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants for Blok workflow validation, completion, and documentation.
|
|
3
|
+
* These are IDE-agnostic and used by both the LSP server and VS Code extension.
|
|
4
|
+
*/
|
|
5
|
+
export declare const VALID_TRIGGERS: readonly ["http", "grpc", "manual", "cron", "queue", "pubsub", "worker", "webhook", "websocket", "sse"];
|
|
6
|
+
export declare const VALID_HTTP_METHODS: readonly ["GET", "POST", "PUT", "DELETE", "PATCH", "ANY"];
|
|
7
|
+
export declare const VALID_STEP_TYPES: readonly ["local", "module", "runtime.nodejs", "runtime.python3", "runtime.go", "runtime.java", "runtime.rust", "runtime.php", "runtime.csharp", "runtime.ruby"];
|
|
8
|
+
export declare const VALID_RUNTIMES: readonly ["nodejs", "bun", "python3", "go", "java", "rust", "php", "csharp", "ruby", "docker", "wasm"];
|
|
9
|
+
export declare const QUEUE_PROVIDERS: readonly ["kafka", "rabbitmq", "sqs", "redis", "beanstalk"];
|
|
10
|
+
export declare const PUBSUB_PROVIDERS: readonly ["gcp", "aws", "azure", "redis", "nats"];
|
|
11
|
+
export declare const WEBHOOK_SOURCES: readonly ["github", "stripe", "shopify", "custom"];
|
|
12
|
+
export declare const NODE_PACKAGES: readonly [{
|
|
13
|
+
readonly name: "@blok/api-call";
|
|
14
|
+
readonly description: "HTTP API call node - makes requests to external services";
|
|
15
|
+
}, {
|
|
16
|
+
readonly name: "@blok/if-else";
|
|
17
|
+
readonly description: "Conditional branching node - evaluates conditions for routing";
|
|
18
|
+
}, {
|
|
19
|
+
readonly name: "@blok/react";
|
|
20
|
+
readonly description: "React SSR node - server-side rendering";
|
|
21
|
+
}];
|
|
22
|
+
export interface WorkflowJson {
|
|
23
|
+
name?: unknown;
|
|
24
|
+
version?: unknown;
|
|
25
|
+
description?: unknown;
|
|
26
|
+
trigger?: Record<string, unknown>;
|
|
27
|
+
steps?: unknown[];
|
|
28
|
+
nodes?: Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
export interface HoverDoc {
|
|
31
|
+
title: string;
|
|
32
|
+
description: string;
|
|
33
|
+
example?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare const TRIGGER_DOCS: Record<string, HoverDoc>;
|
|
36
|
+
export declare const FIELD_DOCS: Record<string, HoverDoc>;
|
|
37
|
+
export declare const STEP_FIELD_DOCS: Record<string, HoverDoc>;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared constants for Blok workflow validation, completion, and documentation.
|
|
4
|
+
* These are IDE-agnostic and used by both the LSP server and VS Code extension.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.STEP_FIELD_DOCS = exports.FIELD_DOCS = exports.TRIGGER_DOCS = exports.NODE_PACKAGES = exports.WEBHOOK_SOURCES = exports.PUBSUB_PROVIDERS = exports.QUEUE_PROVIDERS = exports.VALID_RUNTIMES = exports.VALID_STEP_TYPES = exports.VALID_HTTP_METHODS = exports.VALID_TRIGGERS = void 0;
|
|
8
|
+
exports.VALID_TRIGGERS = [
|
|
9
|
+
"http",
|
|
10
|
+
"grpc",
|
|
11
|
+
"manual",
|
|
12
|
+
"cron",
|
|
13
|
+
"queue",
|
|
14
|
+
"pubsub",
|
|
15
|
+
"worker",
|
|
16
|
+
"webhook",
|
|
17
|
+
"websocket",
|
|
18
|
+
"sse",
|
|
19
|
+
];
|
|
20
|
+
exports.VALID_HTTP_METHODS = ["GET", "POST", "PUT", "DELETE", "PATCH", "ANY"];
|
|
21
|
+
exports.VALID_STEP_TYPES = [
|
|
22
|
+
"local",
|
|
23
|
+
"module",
|
|
24
|
+
"runtime.nodejs",
|
|
25
|
+
"runtime.python3",
|
|
26
|
+
"runtime.go",
|
|
27
|
+
"runtime.java",
|
|
28
|
+
"runtime.rust",
|
|
29
|
+
"runtime.php",
|
|
30
|
+
"runtime.csharp",
|
|
31
|
+
"runtime.ruby",
|
|
32
|
+
];
|
|
33
|
+
exports.VALID_RUNTIMES = [
|
|
34
|
+
"nodejs",
|
|
35
|
+
"bun",
|
|
36
|
+
"python3",
|
|
37
|
+
"go",
|
|
38
|
+
"java",
|
|
39
|
+
"rust",
|
|
40
|
+
"php",
|
|
41
|
+
"csharp",
|
|
42
|
+
"ruby",
|
|
43
|
+
"docker",
|
|
44
|
+
"wasm",
|
|
45
|
+
];
|
|
46
|
+
exports.QUEUE_PROVIDERS = ["kafka", "rabbitmq", "sqs", "redis", "beanstalk"];
|
|
47
|
+
exports.PUBSUB_PROVIDERS = ["gcp", "aws", "azure", "redis", "nats"];
|
|
48
|
+
exports.WEBHOOK_SOURCES = ["github", "stripe", "shopify", "custom"];
|
|
49
|
+
exports.NODE_PACKAGES = [
|
|
50
|
+
{ name: "@blok/api-call", description: "HTTP API call node - makes requests to external services" },
|
|
51
|
+
{ name: "@blok/if-else", description: "Conditional branching node - evaluates conditions for routing" },
|
|
52
|
+
{ name: "@blok/react", description: "React SSR node - server-side rendering" },
|
|
53
|
+
];
|
|
54
|
+
exports.TRIGGER_DOCS = {
|
|
55
|
+
http: {
|
|
56
|
+
title: "HTTP Trigger",
|
|
57
|
+
description: "Triggers workflow on HTTP requests. Supports GET, POST, PUT, DELETE, PATCH, and ANY methods.",
|
|
58
|
+
example: `"http": {\n "method": "POST",\n "path": "/api/users",\n "accept": "application/json"\n}`,
|
|
59
|
+
},
|
|
60
|
+
grpc: {
|
|
61
|
+
title: "gRPC Trigger",
|
|
62
|
+
description: "Triggers workflow on gRPC method calls using Connect RPC protocol.",
|
|
63
|
+
example: `"grpc": {\n "service": "UserService",\n "method": "GetUser"\n}`,
|
|
64
|
+
},
|
|
65
|
+
manual: {
|
|
66
|
+
title: "Manual Trigger",
|
|
67
|
+
description: "No automatic triggering. Workflow must be invoked programmatically.",
|
|
68
|
+
example: `"manual": {}`,
|
|
69
|
+
},
|
|
70
|
+
cron: {
|
|
71
|
+
title: "Cron Trigger",
|
|
72
|
+
description: "Triggers workflow on a schedule using cron expressions. Supports timezone and overlap control.",
|
|
73
|
+
example: `"cron": {\n "schedule": "*/5 * * * *",\n "timezone": "America/New_York",\n "overlap": false\n}`,
|
|
74
|
+
},
|
|
75
|
+
queue: {
|
|
76
|
+
title: "Queue Trigger",
|
|
77
|
+
description: "Triggers workflow when messages arrive on a queue. Supports Kafka, RabbitMQ, SQS, Redis, and Beanstalk.",
|
|
78
|
+
example: `"queue": {\n "provider": "kafka",\n "topic": "user-events",\n "consumerGroup": "blok-workers"\n}`,
|
|
79
|
+
},
|
|
80
|
+
pubsub: {
|
|
81
|
+
title: "Pub/Sub Trigger",
|
|
82
|
+
description: "Triggers workflow on pub/sub messages. Supports GCP Pub/Sub, AWS SNS, Azure Service Bus, Redis, and NATS.",
|
|
83
|
+
example: `"pubsub": {\n "provider": "gcp",\n "topic": "notifications",\n "subscription": "blok-sub"\n}`,
|
|
84
|
+
},
|
|
85
|
+
worker: {
|
|
86
|
+
title: "Worker Trigger",
|
|
87
|
+
description: "Background job processing with configurable concurrency, timeouts, and retries.",
|
|
88
|
+
example: `"worker": {\n "queue": "email-jobs",\n "concurrency": 5,\n "timeout": 30000,\n "retries": 3\n}`,
|
|
89
|
+
},
|
|
90
|
+
webhook: {
|
|
91
|
+
title: "Webhook Trigger",
|
|
92
|
+
description: "Triggers workflow when external services send webhook events. Supports HMAC signature verification.",
|
|
93
|
+
example: `"webhook": {\n "source": "github",\n "events": ["push", "pull_request"],\n "secret": "WEBHOOK_SECRET"\n}`,
|
|
94
|
+
},
|
|
95
|
+
websocket: {
|
|
96
|
+
title: "WebSocket Trigger",
|
|
97
|
+
description: "Real-time bidirectional communication. Supports rooms, authentication, and message rate limiting.",
|
|
98
|
+
example: `"websocket": {\n "path": "/ws",\n "events": ["message", "join", "leave"],\n "maxConnections": 1000\n}`,
|
|
99
|
+
},
|
|
100
|
+
sse: {
|
|
101
|
+
title: "SSE Trigger",
|
|
102
|
+
description: "Server-Sent Events for real-time unidirectional streaming. Supports channels and replay.",
|
|
103
|
+
example: `"sse": {\n "path": "/events",\n "channels": ["updates", "alerts"],\n "retryInterval": 3000\n}`,
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
exports.FIELD_DOCS = {
|
|
107
|
+
name: {
|
|
108
|
+
title: "Workflow Name",
|
|
109
|
+
description: "Human-readable name identifying this workflow. Used for logging, monitoring, and display purposes.",
|
|
110
|
+
},
|
|
111
|
+
version: {
|
|
112
|
+
title: "Workflow Version",
|
|
113
|
+
description: "Semantic version of this workflow (e.g., 1.0.0). Follows SemVer format: MAJOR.MINOR.PATCH.",
|
|
114
|
+
},
|
|
115
|
+
description: {
|
|
116
|
+
title: "Workflow Description",
|
|
117
|
+
description: "Detailed description of what this workflow does. Shown in documentation and monitoring dashboards.",
|
|
118
|
+
},
|
|
119
|
+
trigger: {
|
|
120
|
+
title: "Workflow Trigger",
|
|
121
|
+
description: "Defines how this workflow is invoked. Each workflow has exactly one trigger type: http, grpc, manual, cron, queue, pubsub, worker, webhook, websocket, or sse.",
|
|
122
|
+
},
|
|
123
|
+
steps: {
|
|
124
|
+
title: "Workflow Steps",
|
|
125
|
+
description: "Ordered array of steps to execute. Each step references a node and defines its type (local or module). Steps execute sequentially; use conditional nodes for branching.",
|
|
126
|
+
},
|
|
127
|
+
nodes: {
|
|
128
|
+
title: "Node Configurations",
|
|
129
|
+
description: 'Maps step names to their configurations. Each key matches a step\'s "name" field and contains inputs, conditions, or nested steps.',
|
|
130
|
+
},
|
|
131
|
+
inputs: {
|
|
132
|
+
title: "Node Inputs",
|
|
133
|
+
description: "Input values for the node. Supports static values, template variables (${ctx.request.body.field}), JavaScript evaluation (js/ prefix), and context variable references.",
|
|
134
|
+
example: `"inputs": {\n "url": "https://api.example.com/users",\n "userId": "\${ctx.request.params.id}",\n "computed": "js/ctx.response.data.items.length"\n}`,
|
|
135
|
+
},
|
|
136
|
+
conditions: {
|
|
137
|
+
title: "Conditional Branches",
|
|
138
|
+
description: "Array of if/else conditions for branching logic. Use with @blok/if-else node. Each condition has a JavaScript expression and nested steps.",
|
|
139
|
+
example: `"conditions": [\n {\n "type": "if",\n "condition": "ctx.request.query.type === 'admin'",\n "steps": [...]\n },\n {\n "type": "else",\n "steps": [...]\n }\n]`,
|
|
140
|
+
},
|
|
141
|
+
set_var: {
|
|
142
|
+
title: "Set Context Variable",
|
|
143
|
+
description: "When true, stores the step's output in ctx.vars['step-name']. This makes the result accessible to downstream steps via ctx.vars.",
|
|
144
|
+
example: `"my-step": {\n "set_var": true,\n "inputs": { ... }\n}\n// Later: ctx.vars['my-step'] contains the result`,
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
exports.STEP_FIELD_DOCS = {
|
|
148
|
+
node: {
|
|
149
|
+
title: "Step Node Reference",
|
|
150
|
+
description: "The node package or local path to execute. For modules: @blok/api-call. For local nodes: ./nodes/my-node.",
|
|
151
|
+
},
|
|
152
|
+
type: {
|
|
153
|
+
title: "Step Type",
|
|
154
|
+
description: "How the node should be resolved.\n- **local**: Node defined in the project\n- **module**: npm package node\n- **runtime.X**: Language-specific runtime (nodejs, python3, go, java, rust, php, csharp, ruby)",
|
|
155
|
+
},
|
|
156
|
+
runtime: {
|
|
157
|
+
title: "Step Runtime",
|
|
158
|
+
description: "Override the default runtime for this step. Available: nodejs, bun, python3, go, java, rust, php, csharp, ruby, docker, wasm.",
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
//#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;QACZ,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EAAE,oGAAoG;KACjH;IACD,OAAO,EAAE;QACR,KAAK,EAAE,kBAAkB;QACzB,WAAW,EACV,gKAAgK;KACjK;IACD,KAAK,EAAE;QACN,KAAK,EAAE,gBAAgB;QACvB,WAAW,EACV,yKAAyK;KAC1K;IACD,KAAK,EAAE;QACN,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EACV,oIAAoI;KACrI;IACD,MAAM,EAAE;QACP,KAAK,EAAE,aAAa;QACpB,WAAW,EACV,yKAAyK;QAC1K,OAAO,EAAE,wJAAwJ;KACjK;IACD,UAAU,EAAE;QACX,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EACV,4IAA4I;QAC7I,OAAO,EAAE,iLAAiL;KAC1L;IACD,OAAO,EAAE;QACR,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EACV,kIAAkI;QACnI,OAAO,EAAE,6GAA6G;KACtH;CACD,CAAC;AAEW,QAAA,eAAe,GAA6B;IACxD,IAAI,EAAE;QACL,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EACV,2GAA2G;KAC5G;IACD,IAAI,EAAE;QACL,KAAK,EAAE,WAAW;QAClB,WAAW,EACV,6MAA6M;KAC9M;IACD,OAAO,EAAE;QACR,KAAK,EAAE,cAAc;QACrB,WAAW,EACV,+HAA+H;KAChI;CACD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Diagnostic, Position, Range } from "vscode-languageserver";
|
|
2
|
+
/**
|
|
3
|
+
* Provides workflow validation diagnostics for the LSP server.
|
|
4
|
+
*
|
|
5
|
+
* Validates:
|
|
6
|
+
* - Required fields (name, version, trigger, steps, nodes)
|
|
7
|
+
* - Version format (semver)
|
|
8
|
+
* - Trigger configuration (type-specific validation)
|
|
9
|
+
* - Step structure (name, node, type)
|
|
10
|
+
* - Node configuration references
|
|
11
|
+
* - Unused nodes
|
|
12
|
+
* - Runtime field validation
|
|
13
|
+
*/
|
|
14
|
+
export declare function validateWorkflow(text: string): Diagnostic[];
|
|
15
|
+
export declare function findKeyRange(text: string, key: string): Range;
|
|
16
|
+
export declare function findValueRange(text: string, key: string, value: string): Range;
|
|
17
|
+
export declare function offsetToPosition(text: string, offset: number): Position;
|