@adminide-stack/form-builder-core 5.1.4-alpha.62 → 5.1.4-alpha.66
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 +4 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/inngest/monacoAutocompleteIntegration.d.ts +48 -0
- package/lib/inngest/monacoAutocompleteIntegration.d.ts.map +1 -0
- package/lib/inngest/monacoAutocompleteIntegration.js +341 -0
- package/lib/inngest/monacoAutocompleteIntegration.js.map +1 -0
- package/lib/inngest/stepGenerator.d.ts +41 -0
- package/lib/inngest/stepGenerator.d.ts.map +1 -1
- package/lib/inngest/stepGenerator.js +139 -1
- package/lib/inngest/stepGenerator.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/inngest/MONACO_INTEGRATION_EXAMPLE.md +406 -0
- package/src/inngest/README_AUTOCOMPLETE.md +380 -0
- package/src/inngest/monacoAutocompleteIntegration.ts +432 -0
- package/src/inngest/stepGenerator.ts +183 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [5.1.4-alpha.66](https://github.com/CDEBase/forms-stack/compare/v5.1.4-alpha.65...v5.1.4-alpha.66) (2025-10-16)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @adminide-stack/form-builder-core
|
|
9
|
+
|
|
6
10
|
## [5.1.4-alpha.62](https://github.com/CDEBase/forms-stack/compare/v5.1.4-alpha.61...v5.1.4-alpha.62) (2025-10-11)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @adminide-stack/form-builder-core
|
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AACzE,cAAc,yCAAyC,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{generateFunctionCode,generateHandlerBody,generateStepFromFunction,generateStepFunctionsFromDB,wrapStepsInInngestFunction}from'./inngest/generateFunctionCode.js';export{cleanStepCode,extractStepVarName,generateFromExtractedFunctions}from'./inngest/stepGenerator.js';//# sourceMappingURL=index.js.map
|
|
1
|
+
export{generateFunctionCode,generateHandlerBody,generateStepFromFunction,generateStepFunctionsFromDB,wrapStepsInInngestFunction}from'./inngest/generateFunctionCode.js';export{cleanStepCode,extractStepVarName,generateFromExtractedFunctions}from'./inngest/stepGenerator.js';export{getAvailableDefinitions,installLibraryForAutocomplete,setupMonacoAutocomplete,setupStepAutocomplete,updateAutocompleteConfig}from'./inngest/monacoAutocompleteIntegration.js';//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Monaco Editor Integration for JavaScript Autocomplete
|
|
3
|
+
*
|
|
4
|
+
* Integrates with the js-autocomplete-extension via command execution
|
|
5
|
+
* to provide intelligent code completions in step function editors.
|
|
6
|
+
*/
|
|
7
|
+
import type { InngestStep } from './interfaces/types';
|
|
8
|
+
export interface MonacoAutocompleteOptions {
|
|
9
|
+
/** Enable Inngest step functions context */
|
|
10
|
+
enableInngestContext?: boolean;
|
|
11
|
+
/** Custom scope variables */
|
|
12
|
+
customScope?: string[];
|
|
13
|
+
/** Enable type info on hover */
|
|
14
|
+
enableHoverInfo?: boolean;
|
|
15
|
+
/** Command service for executing extension commands */
|
|
16
|
+
commandService?: any;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Setup JavaScript autocomplete for Monaco Editor using extension commands
|
|
20
|
+
*
|
|
21
|
+
* @param monaco Monaco editor instance
|
|
22
|
+
* @param options Configuration options
|
|
23
|
+
* @param commandService Service for executing extension commands
|
|
24
|
+
*/
|
|
25
|
+
export declare function setupMonacoAutocomplete(monaco: any, options?: MonacoAutocompleteOptions, commandService?: any): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Setup autocomplete for a specific Inngest step
|
|
28
|
+
* Provides step-specific context and completions
|
|
29
|
+
*/
|
|
30
|
+
export declare function setupStepAutocomplete(monaco: any, step: InngestStep, code: string, commandService: any): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Install a library for autocomplete
|
|
33
|
+
*/
|
|
34
|
+
export declare function installLibraryForAutocomplete(commandService: any, url: string, accessors: string[]): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Update autocomplete configuration
|
|
37
|
+
*/
|
|
38
|
+
export declare function updateAutocompleteConfig(commandService: any, config: {
|
|
39
|
+
includeDefaults?: boolean;
|
|
40
|
+
includeLibraries?: boolean;
|
|
41
|
+
enableDynamicLibraries?: boolean;
|
|
42
|
+
customDefinitions?: string[];
|
|
43
|
+
}): Promise<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* Get available type definitions
|
|
46
|
+
*/
|
|
47
|
+
export declare function getAvailableDefinitions(commandService: any): Promise<string[]>;
|
|
48
|
+
//# sourceMappingURL=monacoAutocompleteIntegration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monacoAutocompleteIntegration.d.ts","sourceRoot":"","sources":["../../src/inngest/monacoAutocompleteIntegration.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,WAAW,yBAAyB;IACtC,4CAA4C;IAC5C,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,gCAAgC;IAChC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uDAAuD;IACvD,cAAc,CAAC,EAAE,GAAG,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CACzC,MAAM,EAAE,GAAG,EACX,OAAO,GAAE,yBAA8B,EACvC,cAAc,CAAC,EAAE,GAAG,iBAyOvB;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,iBAiB5G;AAED;;GAEG;AACH,wBAAsB,6BAA6B,CAC/C,cAAc,EAAE,GAAG,EACnB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,OAAO,CAAC,CAYlB;AAED;;GAEG;AACH,wBAAsB,wBAAwB,CAC1C,cAAc,EAAE,GAAG,EACnB,MAAM,EAAE;IACJ,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC,GACF,OAAO,CAAC,OAAO,CAAC,CAYlB;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,cAAc,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAWpF"}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import {getStepCompletionContext,getStepTypeDefinitions}from'./stepGenerator.js';/**
|
|
2
|
+
* Monaco Editor Integration for JavaScript Autocomplete
|
|
3
|
+
*
|
|
4
|
+
* Integrates with the js-autocomplete-extension via command execution
|
|
5
|
+
* to provide intelligent code completions in step function editors.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Setup JavaScript autocomplete for Monaco Editor using extension commands
|
|
9
|
+
*
|
|
10
|
+
* @param monaco Monaco editor instance
|
|
11
|
+
* @param options Configuration options
|
|
12
|
+
* @param commandService Service for executing extension commands
|
|
13
|
+
*/
|
|
14
|
+
async function setupMonacoAutocomplete(monaco, options = {}, commandService) {
|
|
15
|
+
const {
|
|
16
|
+
enableInngestContext = true,
|
|
17
|
+
customScope = [],
|
|
18
|
+
enableHoverInfo = true
|
|
19
|
+
} = options;
|
|
20
|
+
const commands = commandService || options.commandService;
|
|
21
|
+
if (!commands) {
|
|
22
|
+
console.warn('No command service provided, autocomplete will not be available');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// Build scope context
|
|
26
|
+
const scope = [...customScope];
|
|
27
|
+
if (enableInngestContext) {
|
|
28
|
+
scope.push('step', 'event', 'run', 'sleep', 'sendEvent', 'waitForEvent');
|
|
29
|
+
}
|
|
30
|
+
// Configure TypeScript/JavaScript compiler options to prevent worker errors
|
|
31
|
+
const compilerOptions = {
|
|
32
|
+
target: monaco.languages.typescript.ScriptTarget.ES2020,
|
|
33
|
+
allowNonTsExtensions: true,
|
|
34
|
+
moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,
|
|
35
|
+
module: monaco.languages.typescript.ModuleKind.CommonJS,
|
|
36
|
+
noEmit: true,
|
|
37
|
+
esModuleInterop: true,
|
|
38
|
+
allowJs: true,
|
|
39
|
+
checkJs: false,
|
|
40
|
+
noSemanticValidation: false,
|
|
41
|
+
noSyntaxValidation: false
|
|
42
|
+
};
|
|
43
|
+
// Set compiler options for both JavaScript and TypeScript
|
|
44
|
+
monaco.languages.typescript.javascriptDefaults.setCompilerOptions(compilerOptions);
|
|
45
|
+
monaco.languages.typescript.typescriptDefaults.setCompilerOptions(compilerOptions);
|
|
46
|
+
// Configure diagnostics options to prevent unnecessary worker calls
|
|
47
|
+
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
|
|
48
|
+
noSemanticValidation: false,
|
|
49
|
+
noSyntaxValidation: false,
|
|
50
|
+
diagnosticCodesToIgnore: [1108] // Ignore "A 'return' statement can only be used within a function body"
|
|
51
|
+
});
|
|
52
|
+
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
53
|
+
noSemanticValidation: false,
|
|
54
|
+
noSyntaxValidation: false
|
|
55
|
+
});
|
|
56
|
+
// Disable eager model sync to prevent worker trying to access non-existent models
|
|
57
|
+
monaco.languages.typescript.javascriptDefaults.setEagerModelSync(false);
|
|
58
|
+
monaco.languages.typescript.typescriptDefaults.setEagerModelSync(false);
|
|
59
|
+
// Register completion provider for JavaScript
|
|
60
|
+
monaco.languages.registerCompletionItemProvider('javascript', {
|
|
61
|
+
triggerCharacters: ['.', ' '],
|
|
62
|
+
provideCompletionItems: async (model, position) => {
|
|
63
|
+
try {
|
|
64
|
+
const text = model.getValue();
|
|
65
|
+
const offset = model.getOffsetAt(position);
|
|
66
|
+
// Call the autocomplete extension command
|
|
67
|
+
const result = await commands.executeCommand({
|
|
68
|
+
command: 'jsAutocomplete.getCompletions',
|
|
69
|
+
arguments: [text, offset, scope.length > 0 ? scope : undefined]
|
|
70
|
+
});
|
|
71
|
+
if (!result || !result.completions) {
|
|
72
|
+
return {
|
|
73
|
+
suggestions: []
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
// Convert to Monaco completion items
|
|
77
|
+
const suggestions = result.completions.map(completion => ({
|
|
78
|
+
label: completion.name,
|
|
79
|
+
kind: determineCompletionKind(completion.type, monaco),
|
|
80
|
+
documentation: formatDocumentation(completion),
|
|
81
|
+
insertText: completion.name,
|
|
82
|
+
detail: completion.type || 'any',
|
|
83
|
+
sortText: getSortText(completion)
|
|
84
|
+
}));
|
|
85
|
+
return {
|
|
86
|
+
suggestions,
|
|
87
|
+
incomplete: result.isIncomplete || false
|
|
88
|
+
};
|
|
89
|
+
} catch (error) {
|
|
90
|
+
console.error('Autocomplete error:', error);
|
|
91
|
+
return {
|
|
92
|
+
suggestions: []
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
resolveCompletionItem: async item => {
|
|
97
|
+
if (!enableHoverInfo) {
|
|
98
|
+
return item;
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
// Get detailed type info for the completion
|
|
102
|
+
const typeInfo = await commands.executeCommand({
|
|
103
|
+
command: 'jsAutocomplete.getTypeInfo',
|
|
104
|
+
arguments: [item.label, scope.length > 0 ? scope : undefined]
|
|
105
|
+
});
|
|
106
|
+
if (typeInfo) {
|
|
107
|
+
item.documentation = {
|
|
108
|
+
value: formatDetailedDocumentation(item.label, typeInfo),
|
|
109
|
+
isTrusted: true
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
} catch (error) {
|
|
113
|
+
console.error('Type info resolution error:', error);
|
|
114
|
+
}
|
|
115
|
+
return item;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
// Register completion provider for TypeScript
|
|
119
|
+
monaco.languages.registerCompletionItemProvider('typescript', {
|
|
120
|
+
triggerCharacters: ['.', ' '],
|
|
121
|
+
provideCompletionItems: async (model, position) => {
|
|
122
|
+
try {
|
|
123
|
+
const text = model.getValue();
|
|
124
|
+
const offset = model.getOffsetAt(position);
|
|
125
|
+
// Call the autocomplete extension command
|
|
126
|
+
const result = await commands.executeCommand({
|
|
127
|
+
command: 'jsAutocomplete.getCompletions',
|
|
128
|
+
arguments: [text, offset, scope.length > 0 ? scope : undefined]
|
|
129
|
+
});
|
|
130
|
+
if (!result || !result.completions) {
|
|
131
|
+
return {
|
|
132
|
+
suggestions: []
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
// Convert to Monaco completion items
|
|
136
|
+
const suggestions = result.completions.map(completion => ({
|
|
137
|
+
label: completion.name,
|
|
138
|
+
kind: determineCompletionKind(completion.type, monaco),
|
|
139
|
+
documentation: formatDocumentation(completion),
|
|
140
|
+
insertText: completion.name,
|
|
141
|
+
detail: completion.type || 'any',
|
|
142
|
+
sortText: getSortText(completion)
|
|
143
|
+
}));
|
|
144
|
+
return {
|
|
145
|
+
suggestions,
|
|
146
|
+
incomplete: result.isIncomplete || false
|
|
147
|
+
};
|
|
148
|
+
} catch (error) {
|
|
149
|
+
console.error('TypeScript autocomplete error:', error);
|
|
150
|
+
return {
|
|
151
|
+
suggestions: []
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
// Register hover provider for type information
|
|
157
|
+
if (enableHoverInfo) {
|
|
158
|
+
monaco.languages.registerHoverProvider('javascript', {
|
|
159
|
+
provideHover: async (model, position) => {
|
|
160
|
+
try {
|
|
161
|
+
const word = model.getWordAtPosition(position);
|
|
162
|
+
if (!word) {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
// Get type info via extension command
|
|
166
|
+
const typeInfo = await commands.executeCommand({
|
|
167
|
+
command: 'jsAutocomplete.getTypeInfo',
|
|
168
|
+
arguments: [word.word, scope.length > 0 ? scope : undefined]
|
|
169
|
+
});
|
|
170
|
+
if (!typeInfo) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
range: new monaco.Range(position.lineNumber, word.startColumn, position.lineNumber, word.endColumn),
|
|
175
|
+
contents: [{
|
|
176
|
+
value: `**${word.word}**: \`${typeInfo.type || 'any'}\``
|
|
177
|
+
}, {
|
|
178
|
+
value: typeInfo.doc || 'No documentation available'
|
|
179
|
+
}]
|
|
180
|
+
};
|
|
181
|
+
} catch (error) {
|
|
182
|
+
console.error('Hover provider error:', error);
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
monaco.languages.registerHoverProvider('typescript', {
|
|
188
|
+
provideHover: async (model, position) => {
|
|
189
|
+
try {
|
|
190
|
+
const word = model.getWordAtPosition(position);
|
|
191
|
+
if (!word) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
const typeInfo = await commands.executeCommand({
|
|
195
|
+
command: 'jsAutocomplete.getTypeInfo',
|
|
196
|
+
arguments: [word.word, scope.length > 0 ? scope : undefined]
|
|
197
|
+
});
|
|
198
|
+
if (!typeInfo) {
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
range: new monaco.Range(position.lineNumber, word.startColumn, position.lineNumber, word.endColumn),
|
|
203
|
+
contents: [{
|
|
204
|
+
value: `**${word.word}**: \`${typeInfo.type || 'any'}\``
|
|
205
|
+
}, {
|
|
206
|
+
value: typeInfo.doc || 'No documentation available'
|
|
207
|
+
}]
|
|
208
|
+
};
|
|
209
|
+
} catch (error) {
|
|
210
|
+
console.error('TypeScript hover provider error:', error);
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
console.log('Monaco autocomplete integration setup complete');
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Setup autocomplete for a specific Inngest step
|
|
220
|
+
* Provides step-specific context and completions
|
|
221
|
+
*/
|
|
222
|
+
async function setupStepAutocomplete(monaco, step, code, commandService) {
|
|
223
|
+
const context = getStepCompletionContext(step, code);
|
|
224
|
+
await setupMonacoAutocomplete(monaco, {
|
|
225
|
+
enableInngestContext: true,
|
|
226
|
+
customScope: [...context.scope, ...context.variables],
|
|
227
|
+
enableHoverInfo: true,
|
|
228
|
+
commandService
|
|
229
|
+
}, commandService);
|
|
230
|
+
// Add step-specific type definitions
|
|
231
|
+
const typeDefinitions = getStepTypeDefinitions();
|
|
232
|
+
monaco.languages.typescript.javascriptDefaults.addExtraLib(typeDefinitions, 'file:///inngest-step-types.d.ts');
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Install a library for autocomplete
|
|
236
|
+
*/
|
|
237
|
+
async function installLibraryForAutocomplete(commandService, url, accessors) {
|
|
238
|
+
try {
|
|
239
|
+
await commandService.executeCommand({
|
|
240
|
+
command: 'jsAutocomplete.installLibrary',
|
|
241
|
+
arguments: [url, accessors]
|
|
242
|
+
});
|
|
243
|
+
console.log(`Library installed: ${accessors.join(', ')}`);
|
|
244
|
+
return true;
|
|
245
|
+
} catch (error) {
|
|
246
|
+
console.error('Failed to install library:', error);
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Update autocomplete configuration
|
|
252
|
+
*/
|
|
253
|
+
async function updateAutocompleteConfig(commandService, config) {
|
|
254
|
+
try {
|
|
255
|
+
await commandService.executeCommand({
|
|
256
|
+
command: 'jsAutocomplete.updateConfig',
|
|
257
|
+
arguments: [config]
|
|
258
|
+
});
|
|
259
|
+
console.log('Autocomplete config updated');
|
|
260
|
+
return true;
|
|
261
|
+
} catch (error) {
|
|
262
|
+
console.error('Failed to update autocomplete config:', error);
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Get available type definitions
|
|
268
|
+
*/
|
|
269
|
+
async function getAvailableDefinitions(commandService) {
|
|
270
|
+
try {
|
|
271
|
+
const definitions = await commandService.executeCommand({
|
|
272
|
+
command: 'jsAutocomplete.getAvailableDefinitions',
|
|
273
|
+
arguments: []
|
|
274
|
+
});
|
|
275
|
+
return definitions || [];
|
|
276
|
+
} catch (error) {
|
|
277
|
+
console.error('Failed to get available definitions:', error);
|
|
278
|
+
return [];
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
// Helper functions
|
|
282
|
+
function determineCompletionKind(type, monaco) {
|
|
283
|
+
if (!type) {
|
|
284
|
+
return monaco.languages.CompletionItemKind.Variable;
|
|
285
|
+
}
|
|
286
|
+
if (type.includes('fn(') || type.includes('=>')) {
|
|
287
|
+
return monaco.languages.CompletionItemKind.Function;
|
|
288
|
+
}
|
|
289
|
+
if (type.startsWith('class ') || type.includes('{}')) {
|
|
290
|
+
return monaco.languages.CompletionItemKind.Class;
|
|
291
|
+
}
|
|
292
|
+
if (type.includes('[]')) {
|
|
293
|
+
return monaco.languages.CompletionItemKind.Field;
|
|
294
|
+
}
|
|
295
|
+
if (type === 'number' || type === 'string' || type === 'boolean') {
|
|
296
|
+
return monaco.languages.CompletionItemKind.Keyword;
|
|
297
|
+
}
|
|
298
|
+
return monaco.languages.CompletionItemKind.Variable;
|
|
299
|
+
}
|
|
300
|
+
function formatDocumentation(completion) {
|
|
301
|
+
const parts = [];
|
|
302
|
+
if (completion.type) {
|
|
303
|
+
parts.push(`\`${completion.type}\``);
|
|
304
|
+
}
|
|
305
|
+
if (completion.doc) {
|
|
306
|
+
parts.push(completion.doc);
|
|
307
|
+
}
|
|
308
|
+
if (completion.url) {
|
|
309
|
+
parts.push(`[Documentation](${completion.url})`);
|
|
310
|
+
}
|
|
311
|
+
return parts.join('\n\n') || completion.name;
|
|
312
|
+
}
|
|
313
|
+
function formatDetailedDocumentation(name, typeInfo) {
|
|
314
|
+
const parts = [];
|
|
315
|
+
parts.push(`## ${name}`);
|
|
316
|
+
parts.push('');
|
|
317
|
+
if (typeInfo.type) {
|
|
318
|
+
parts.push('```typescript');
|
|
319
|
+
parts.push(typeInfo.type);
|
|
320
|
+
parts.push('```');
|
|
321
|
+
parts.push('');
|
|
322
|
+
}
|
|
323
|
+
if (typeInfo.doc) {
|
|
324
|
+
parts.push(typeInfo.doc);
|
|
325
|
+
parts.push('');
|
|
326
|
+
}
|
|
327
|
+
if (typeInfo.url) {
|
|
328
|
+
parts.push(`[View Documentation](${typeInfo.url})`);
|
|
329
|
+
}
|
|
330
|
+
return parts.join('\n');
|
|
331
|
+
}
|
|
332
|
+
function getSortText(completion) {
|
|
333
|
+
// Prioritize functions and commonly used types
|
|
334
|
+
if (completion.type?.includes('fn(') || completion.type?.includes('=>')) {
|
|
335
|
+
return `0_${completion.name}`;
|
|
336
|
+
}
|
|
337
|
+
if (completion.type?.startsWith('class ')) {
|
|
338
|
+
return `1_${completion.name}`;
|
|
339
|
+
}
|
|
340
|
+
return `2_${completion.name}`;
|
|
341
|
+
}export{getAvailableDefinitions,installLibraryForAutocomplete,setupMonacoAutocomplete,setupStepAutocomplete,updateAutocompleteConfig};//# sourceMappingURL=monacoAutocompleteIntegration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monacoAutocompleteIntegration.js","sources":["../../src/inngest/monacoAutocompleteIntegration.ts"],"sourcesContent":[null],"names":[],"mappings":"iFAAA;;;;;AAKG;AAKH;;;;AAII;;;AAGA,eAAA,uBAAA,CAAA,MAAA,EAAA,OAAuD,GAAA,EAAA,EAAA,cAAA,EAAA;QACvD;AACH,IAAA,oBAAA,GAAA,IAAA;AAED,IAAA,WAAA,GAAA,EAAA;;;;;;AAMG,IAAA;AACH,EAAA;AA8OA;;;AAGG,IAAA,KAAA,CAAA,IAAA,CAAA,MAAA,EAAA,OAAA,EAAA,KAAA,EAAA,OAAA,EAAA,WAAA,EAAA,cAAA,CAAA;AACH,EAAA;AAmBA;;AAEG,IAAA,MAAA,EAAA,MAAA,CAAA,SAAA,CAAA,UAAA,CAAA,YAAA,CAAA,MAAA;AACH,IAAA,oBAAsB;AAkBtB,IAAA,gBAAA,EAAA,MAAA,CAAA,SAAA,CAAA,UAAA,CAAA,oBAAA,CAAA,MAAA;;AAEG,IAAA,MAAA,EAAA,IAAA;AACH,IAAA,eAAA,EAAA;IAGQ,OAAA,EAAA,IAAA;IACA,OAAA,EAAA,KAAA;IACA,oBAAA,EAAsB,KAAG;AACzB,IAAA,kBAAkB,EAAE;AACvB,GAAA;AAeL;;AAEG,EAAA,MAAA,CAAA,SAAA,CAAA,UAAA,CAAA,kBAAA,CAAA,kBAAA,CAAA,eAAA,CAAA;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,7 +3,48 @@ export type { ExtractedFunction } from './interfaces/types';
|
|
|
3
3
|
/**
|
|
4
4
|
* Step function generation utilities for unified code generation
|
|
5
5
|
* Used by both browser editor and server execution
|
|
6
|
+
*
|
|
7
|
+
* Integrates with js-autocomplete-extension for intelligent code completion
|
|
6
8
|
*/
|
|
9
|
+
/**
|
|
10
|
+
* Get scope context for code completion in step functions
|
|
11
|
+
* Returns available variables and their types for autocomplete
|
|
12
|
+
*/
|
|
13
|
+
export declare function getStepCompletionScope(): string[];
|
|
14
|
+
/**
|
|
15
|
+
* Get type definitions for step function context
|
|
16
|
+
* Used by Monaco editor for enhanced IntelliSense
|
|
17
|
+
*/
|
|
18
|
+
export declare function getStepTypeDefinitions(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Get autocomplete suggestions for a specific step type
|
|
21
|
+
* Returns context-specific completions based on step type
|
|
22
|
+
*/
|
|
23
|
+
export declare function getStepTypeCompletions(stepType: string): Array<{
|
|
24
|
+
name: string;
|
|
25
|
+
snippet: string;
|
|
26
|
+
doc: string;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Extract variable names from step code for completion context
|
|
30
|
+
* Returns all declared variables in the step function
|
|
31
|
+
*/
|
|
32
|
+
export declare function extractVariablesFromCode(code: string): string[];
|
|
33
|
+
/**
|
|
34
|
+
* Get completion context for a step at a specific position
|
|
35
|
+
* Used by Monaco editor to provide context-aware completions
|
|
36
|
+
*/
|
|
37
|
+
export interface CompletionContext {
|
|
38
|
+
scope: string[];
|
|
39
|
+
typeDefinitions: string;
|
|
40
|
+
snippets: Array<{
|
|
41
|
+
name: string;
|
|
42
|
+
snippet: string;
|
|
43
|
+
doc: string;
|
|
44
|
+
}>;
|
|
45
|
+
variables: string[];
|
|
46
|
+
}
|
|
47
|
+
export declare function getStepCompletionContext(step: InngestStep, code: string): CompletionContext;
|
|
7
48
|
export declare function cleanStepCode(code: string): string;
|
|
8
49
|
export declare function extractStepVarName(code: string): string | null;
|
|
9
50
|
export declare function generateDefaultStepFunction(stepVar: string, stepType: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stepGenerator.d.ts","sourceRoot":"","sources":["../../src/inngest/stepGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGzE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;GAGG;
|
|
1
|
+
{"version":3,"file":"stepGenerator.d.ts","sourceRoot":"","sources":["../../src/inngest/stepGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGzE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;;GAKG;AAEH;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAejD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CA+C/C;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAsD9G;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAmB/D;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChE,SAAS,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAS3F;AAGD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAGD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG9D;AAGD,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CA4FrF;AAGD,wBAAgB,oBAAoB,CAChC,IAAI,EAAE,WAAW,GAAG,iBAAiB,EACrC,KAAK,EAAE,MAAM,GACd;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAYnC;AAGD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA0E/D;AAED,wBAAgB,yBAAyB,CACrC,YAAY,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAC/C,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAClB,MAAM,CAsER;AAGD,wBAAgB,gCAAgC,CAC5C,aAAa,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GACvF,MAAM,CAgCR;AAGD,wBAAgB,8BAA8B,CAAC,kBAAkB,EAAE,iBAAiB,EAAE,GAAG,MAAM,CA6B9F"}
|
|
@@ -1,7 +1,145 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Step function generation utilities for unified code generation
|
|
3
3
|
* Used by both browser editor and server execution
|
|
4
|
+
*
|
|
5
|
+
* Integrates with js-autocomplete-extension for intelligent code completion
|
|
4
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
* Get scope context for code completion in step functions
|
|
9
|
+
* Returns available variables and their types for autocomplete
|
|
10
|
+
*/
|
|
11
|
+
function getStepCompletionScope() {
|
|
12
|
+
return ['step', 'event', 'run', 'sleep', 'sendEvent', 'waitForEvent', 'Promise', 'console', 'Date', 'JSON', 'Array', 'Object'];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get type definitions for step function context
|
|
16
|
+
* Used by Monaco editor for enhanced IntelliSense
|
|
17
|
+
*/
|
|
18
|
+
function getStepTypeDefinitions() {
|
|
19
|
+
return `
|
|
20
|
+
// Inngest Step API
|
|
21
|
+
declare const step: {
|
|
22
|
+
run<T>(id: string, fn: (event: any, step: any) => Promise<T> | T): Promise<T>;
|
|
23
|
+
sendEvent(id: string, input: { name: string; data?: any }): Promise<void>;
|
|
24
|
+
waitForEvent<T = any>(id: string, opts: { event: string; timeout?: string | number }): Promise<T>;
|
|
25
|
+
sleep(id: string, ms: string | number): Promise<void>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// Event context
|
|
29
|
+
declare const event: {
|
|
30
|
+
data: any;
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
ts: number;
|
|
34
|
+
user?: any;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// Common utilities available in step functions
|
|
38
|
+
declare const console: {
|
|
39
|
+
log(...args: any[]): void;
|
|
40
|
+
error(...args: any[]): void;
|
|
41
|
+
warn(...args: any[]): void;
|
|
42
|
+
info(...args: any[]): void;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// Promise and async utilities
|
|
46
|
+
declare class Promise<T> {
|
|
47
|
+
then<TResult>(onfulfilled?: (value: T) => TResult | Promise<TResult>): Promise<TResult>;
|
|
48
|
+
catch<TResult>(onrejected?: (reason: any) => TResult | Promise<TResult>): Promise<TResult>;
|
|
49
|
+
finally(onfinally?: () => void): Promise<T>;
|
|
50
|
+
static all<T>(promises: Promise<T>[]): Promise<T[]>;
|
|
51
|
+
static race<T>(promises: Promise<T>[]): Promise<T>;
|
|
52
|
+
static resolve<T>(value: T): Promise<T>;
|
|
53
|
+
static reject(reason?: any): Promise<never>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Date utilities
|
|
57
|
+
declare class Date {
|
|
58
|
+
constructor();
|
|
59
|
+
constructor(value: number | string);
|
|
60
|
+
toISOString(): string;
|
|
61
|
+
getTime(): number;
|
|
62
|
+
static now(): number;
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get autocomplete suggestions for a specific step type
|
|
68
|
+
* Returns context-specific completions based on step type
|
|
69
|
+
*/
|
|
70
|
+
function getStepTypeCompletions(stepType) {
|
|
71
|
+
const completions = {
|
|
72
|
+
sleep: [{
|
|
73
|
+
name: 'step.sleep',
|
|
74
|
+
snippet: "await step.sleep('${1:step-id}', '${2:5s}');",
|
|
75
|
+
doc: 'Sleep for a specified duration. Accepts time strings like "5s", "1m", "1h"'
|
|
76
|
+
}],
|
|
77
|
+
sendEvent: [{
|
|
78
|
+
name: 'step.sendEvent',
|
|
79
|
+
snippet: `await step.sendEvent('\${1:step-id}', {
|
|
80
|
+
name: '\${2:event.name}',
|
|
81
|
+
data: {
|
|
82
|
+
\${3:key}: \${4:value}
|
|
83
|
+
}
|
|
84
|
+
});`,
|
|
85
|
+
doc: 'Send an event to trigger other workflows'
|
|
86
|
+
}],
|
|
87
|
+
waitForEvent: [{
|
|
88
|
+
name: 'step.waitForEvent',
|
|
89
|
+
snippet: `const \${1:result} = await step.waitForEvent('\${2:step-id}', {
|
|
90
|
+
event: '\${3:event.name}',
|
|
91
|
+
timeout: '\${4:60s}'
|
|
92
|
+
});`,
|
|
93
|
+
doc: 'Wait for a specific event before continuing'
|
|
94
|
+
}],
|
|
95
|
+
run: [{
|
|
96
|
+
name: 'step.run',
|
|
97
|
+
snippet: `const \${1:result} = await step.run('\${2:step-id}', async () => {
|
|
98
|
+
\${3:// Your logic here}
|
|
99
|
+
return { success: true };
|
|
100
|
+
});`,
|
|
101
|
+
doc: 'Run a unit of work with automatic retries and error handling'
|
|
102
|
+
}],
|
|
103
|
+
parallel: [{
|
|
104
|
+
name: 'Promise.all',
|
|
105
|
+
snippet: `const results = await Promise.all([
|
|
106
|
+
\${1:step.run('step-1', async () => { return 1; })},
|
|
107
|
+
\${2:step.run('step-2', async () => { return 2; })}
|
|
108
|
+
]);`,
|
|
109
|
+
doc: 'Execute multiple steps in parallel'
|
|
110
|
+
}]
|
|
111
|
+
};
|
|
112
|
+
return completions[stepType] || completions.run;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Extract variable names from step code for completion context
|
|
116
|
+
* Returns all declared variables in the step function
|
|
117
|
+
*/
|
|
118
|
+
function extractVariablesFromCode(code) {
|
|
119
|
+
const variables = [];
|
|
120
|
+
// Match const/let/var declarations
|
|
121
|
+
const declRegex = /(?:const|let|var)\s+(\w+)/g;
|
|
122
|
+
let match;
|
|
123
|
+
while ((match = declRegex.exec(code)) !== null) {
|
|
124
|
+
variables.push(match[1]);
|
|
125
|
+
}
|
|
126
|
+
// Match function parameters
|
|
127
|
+
const paramRegex = /(?:async\s+)?\(([^)]*)\)\s*=>/g;
|
|
128
|
+
while ((match = paramRegex.exec(code)) !== null) {
|
|
129
|
+
const params = match[1].split(',').map(p => p.trim().split(/\s+/)[0]);
|
|
130
|
+
variables.push(...params.filter(p => p && p !== ''));
|
|
131
|
+
}
|
|
132
|
+
return [...new Set(variables)]; // Remove duplicates
|
|
133
|
+
}
|
|
134
|
+
function getStepCompletionContext(step, code) {
|
|
135
|
+
const stepType = step.type || 'run';
|
|
136
|
+
return {
|
|
137
|
+
scope: getStepCompletionScope(),
|
|
138
|
+
typeDefinitions: getStepTypeDefinitions(),
|
|
139
|
+
snippets: getStepTypeCompletions(stepType),
|
|
140
|
+
variables: extractVariablesFromCode(code)
|
|
141
|
+
};
|
|
142
|
+
}
|
|
5
143
|
// Pass through code without any cleaning/validation
|
|
6
144
|
function cleanStepCode(code) {
|
|
7
145
|
return code;
|
|
@@ -102,4 +240,4 @@ function generateFromExtractedFunctions(extractedFunctions) {
|
|
|
102
240
|
// Fallback: return the code as-is if we can't parse it
|
|
103
241
|
console.warn('Could not parse function format, returning code as-is');
|
|
104
242
|
return func.code || 'return { success: false, error: "No code available" };';
|
|
105
|
-
}export{cleanStepCode,extractFunctionBody,extractStepVarName,generateFromExtractedFunctions};//# sourceMappingURL=stepGenerator.js.map
|
|
243
|
+
}export{cleanStepCode,extractFunctionBody,extractStepVarName,extractVariablesFromCode,generateFromExtractedFunctions,getStepCompletionContext,getStepCompletionScope,getStepTypeCompletions,getStepTypeDefinitions};//# sourceMappingURL=stepGenerator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stepGenerator.js","sources":["../../src/inngest/stepGenerator.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AAGA;AAEA;;;AAGG,
|
|
1
|
+
{"version":3,"file":"stepGenerator.js","sources":["../../src/inngest/stepGenerator.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AAGA;AAEA;;;;;AAKG;AAEH;;;AAGG,EAAA,OAAA,CAAA,MAAA,EAAA,OAAA,EAAA,KAAA,EAAA,OAAA,EAAA,WAAA,EAAA,cAAA,EAAA,SAAA,EAAA,SAAA,EAAA,MAAA,EAAA,MAAA,EAAA,OAAA,EAAA,QAAA,CAAA;AACH;AAiBA;;;AAGG;AACH,SAAA,sBAAgB,GAAA;AAiDhB,EAAA,OAAA;;;AAGG;AACH;;;;;AAwDA;;;AAGG;AACH;AAqBA;;;;AAIA;;;;;;;;;AAKC;AAED;AAYA;AAKA;AAMA;AA+FA;;;;;AA8FA;;;;AA6EA;;;;;;AAqCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminide-stack/form-builder-core",
|
|
3
|
-
"version": "5.1.4-alpha.
|
|
3
|
+
"version": "5.1.4-alpha.66",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "38642244b69e8c665139fb1a3cbc5f4c524f99d5"
|
|
28
28
|
}
|
package/src/index.ts
CHANGED