@adminide-stack/form-builder-core 5.1.4-alpha.105
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 +64 -0
- package/LICENSE +21 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -0
- package/lib/inngest/generateFunctionCode.d.ts +9 -0
- package/lib/inngest/generateFunctionCode.d.ts.map +1 -0
- package/lib/inngest/generateFunctionCode.js +166 -0
- package/lib/inngest/generateFunctionCode.js.map +1 -0
- package/lib/inngest/interfaces/index.d.ts +2 -0
- package/lib/inngest/interfaces/index.d.ts.map +1 -0
- package/lib/inngest/interfaces/types.d.ts +48 -0
- package/lib/inngest/interfaces/types.d.ts.map +1 -0
- 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 +67 -0
- package/lib/inngest/stepGenerator.d.ts.map +1 -0
- package/lib/inngest/stepGenerator.js +243 -0
- package/lib/inngest/stepGenerator.js.map +1 -0
- package/lib/utils/json.d.ts +3 -0
- package/lib/utils/json.d.ts.map +1 -0
- package/lib/utils/json.js +43 -0
- package/lib/utils/json.js.map +1 -0
- package/package.json +28 -0
- package/rollup.config.mjs +33 -0
- package/src/index.ts +5 -0
- package/src/inngest/MONACO_INTEGRATION_EXAMPLE.md +406 -0
- package/src/inngest/README_AUTOCOMPLETE.md +380 -0
- package/src/inngest/generateFunctionCode.ts +248 -0
- package/src/inngest/interfaces/index.ts +1 -0
- package/src/inngest/interfaces/types.ts +63 -0
- package/src/inngest/monacoAutocompleteIntegration.ts +432 -0
- package/src/inngest/stepGenerator.ts +538 -0
- package/src/utils/json.ts +50 -0
- package/tsconfig.json +14 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## [5.1.4-alpha.105](https://github.com/CDEBase/forms-stack/compare/v5.1.4-alpha.104...v5.1.4-alpha.105) (2025-11-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @adminide-stack/form-builder-core
|
|
9
|
+
|
|
10
|
+
## [5.1.4-alpha.82](https://github.com/CDEBase/forms-stack/compare/v5.1.4-alpha.81...v5.1.4-alpha.82) (2025-10-25)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @adminide-stack/form-builder-core
|
|
13
|
+
|
|
14
|
+
## [5.1.4-alpha.81](https://github.com/CDEBase/forms-stack/compare/v5.1.4-alpha.80...v5.1.4-alpha.81) (2025-10-24)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @adminide-stack/form-builder-core
|
|
17
|
+
|
|
18
|
+
## [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)
|
|
19
|
+
|
|
20
|
+
**Note:** Version bump only for package @adminide-stack/form-builder-core
|
|
21
|
+
|
|
22
|
+
## [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)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @adminide-stack/form-builder-core
|
|
25
|
+
|
|
26
|
+
## [5.1.4-alpha.61](https://github.com/CDEBase/forms-stack/compare/v5.1.4-alpha.60...v5.1.4-alpha.61) (2025-10-11)
|
|
27
|
+
|
|
28
|
+
**Note:** Version bump only for package @adminide-stack/form-builder-core
|
|
29
|
+
|
|
30
|
+
## [5.1.4-alpha.58](https://github.com/CDEBase/forms-stack/compare/v5.1.4-alpha.57...v5.1.4-alpha.58) (2025-10-06)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @adminide-stack/form-builder-core
|
|
33
|
+
|
|
34
|
+
## [5.1.4-alpha.57](https://github.com/CDEBase/forms-stack/compare/v5.1.4-alpha.56...v5.1.4-alpha.57) (2025-10-03)
|
|
35
|
+
|
|
36
|
+
**Note:** Version bump only for package @adminide-stack/form-builder-core
|
|
37
|
+
|
|
38
|
+
## [5.1.4-alpha.49](https://github.com/CDEBase/forms-stack/compare/v5.1.4-alpha.48...v5.1.4-alpha.49) (2025-09-24)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @adminide-stack/form-builder-core
|
|
41
|
+
|
|
42
|
+
## [5.1.4-alpha.48](https://github.com/CDEBase/forms-stack/compare/v5.1.4-alpha.47...v5.1.4-alpha.48) (2025-09-23)
|
|
43
|
+
|
|
44
|
+
**Note:** Version bump only for package @adminide-stack/form-builder-core
|
|
45
|
+
|
|
46
|
+
## [5.1.4-alpha.47](https://github.com/CDEBase/forms-stack/compare/v5.1.4-alpha.46...v5.1.4-alpha.47) (2025-09-23)
|
|
47
|
+
|
|
48
|
+
**Note:** Version bump only for package @adminide-stack/form-builder-core
|
|
49
|
+
|
|
50
|
+
## [5.1.4-alpha.46](https://github.com/CDEBase/forms-stack/compare/v5.1.4-alpha.45...v5.1.4-alpha.46) (2025-09-23)
|
|
51
|
+
|
|
52
|
+
**Note:** Version bump only for package @adminide-stack/form-builder-core
|
|
53
|
+
|
|
54
|
+
## [5.1.4-alpha.45](https://github.com/CDEBase/forms-stack/compare/v5.1.4-alpha.44...v5.1.4-alpha.45) (2025-09-23)
|
|
55
|
+
|
|
56
|
+
**Note:** Version bump only for package @adminide-stack/form-builder-core
|
|
57
|
+
|
|
58
|
+
## [5.1.4-alpha.44](https://github.com/CDEBase/forms-stack/compare/v5.1.4-alpha.43...v5.1.4-alpha.44) (2025-09-23)
|
|
59
|
+
|
|
60
|
+
**Note:** Version bump only for package @adminide-stack/form-builder-core
|
|
61
|
+
|
|
62
|
+
## [5.1.4-alpha.43](https://github.com/CDEBase/forms-stack/compare/v5.1.4-alpha.42...v5.1.4-alpha.43) (2025-09-23)
|
|
63
|
+
|
|
64
|
+
**Note:** Version bump only for package @adminide-stack/form-builder-core
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 CDMBase LLC.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './inngest/interfaces/types';
|
|
2
|
+
export * from './inngest/generateFunctionCode';
|
|
3
|
+
export { generateFromExtractedFunctions, extractFunctionBody } from './inngest/stepGenerator';
|
|
4
|
+
export * from './inngest/monacoAutocompleteIntegration';
|
|
5
|
+
export * from './utils/json';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9F,cAAc,yCAAyC,CAAC;AACxD,cAAc,cAAc,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{generateFunctionCode,generateHandlerBody,generateHandlerBodyWithReturn,generateStepFromFunction,generateStepFunctionsFromDB,wrapStepsInInngestFunction}from'./inngest/generateFunctionCode.js';export{cleanStepCode,extractFunctionBody,extractStepVarName,generateFromExtractedFunctions}from'./inngest/stepGenerator.js';export{getAvailableDefinitions,installLibraryForAutocomplete,setupMonacoAutocomplete,setupStepAutocomplete,updateAutocompleteConfig}from'./inngest/monacoAutocompleteIntegration.js';export{flatten,unflatten}from'./utils/json.js';//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { InngestFunctionDef, ExtractedFunction, StepFunction, GeneratedFunctionResult } from './interfaces/types';
|
|
2
|
+
export { cleanStepCode, extractStepVarName } from './stepGenerator';
|
|
3
|
+
export declare function generateFunctionCode(def: InngestFunctionDef): string;
|
|
4
|
+
export declare function generateHandlerBody(def: InngestFunctionDef): string;
|
|
5
|
+
export declare function generateHandlerBodyWithReturn(def: InngestFunctionDef): string;
|
|
6
|
+
export declare function generateStepFunctionsFromDB(functionId: string, events: string[], extractedFunctions: ExtractedFunction[]): GeneratedFunctionResult;
|
|
7
|
+
export declare function wrapStepsInInngestFunction(functionDef: InngestFunctionDef, stepFunctions: StepFunction[]): string;
|
|
8
|
+
export declare function generateStepFromFunction(stepFunction: StepFunction, index: number): string;
|
|
9
|
+
//# sourceMappingURL=generateFunctionCode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateFunctionCode.d.ts","sourceRoot":"","sources":["../../src/inngest/generateFunctionCode.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,kBAAkB,EAElB,iBAAiB,EACjB,YAAY,EACZ,uBAAuB,EAC1B,MAAM,oBAAoB,CAAC;AAS5B,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAyEpE,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,kBAAkB,GAAG,MAAM,CAWpE;AAGD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,kBAAkB,GAAG,MAAM,CAInE;AAiDD,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,kBAAkB,GAAG,MAAM,CAkC7E;AAGD,wBAAgB,2BAA2B,CACvC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EAAE,EAChB,kBAAkB,EAAE,iBAAiB,EAAE,GACxC,uBAAuB,CAazB;AAGD,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,kBAAkB,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,MAAM,CAWjH;AAGD,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAoB1F"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import {generateFromExtractedFunctions,extractStepVarName,extractFunctionBody,cleanStepCode}from'./stepGenerator.js';// Check if code contains direct step operations (sleep, sendEvent, etc)
|
|
2
|
+
function hasDirectStepOperations(code) {
|
|
3
|
+
return /step\.(sleep|sendEvent|waitForEvent|run)\s*\(/.test(code);
|
|
4
|
+
}
|
|
5
|
+
function getDefaultDirectBody(type, id, label) {
|
|
6
|
+
switch (type) {
|
|
7
|
+
case 'sleep':
|
|
8
|
+
return `const ${id}_result = await step.sleep('${id}', '5s');`;
|
|
9
|
+
case 'sendEvent':
|
|
10
|
+
return `const ${id}_result = await step.sendEvent('${id}', { name: 'my.custom.event', data: { source: '${label || id}', ts: new Date().toISOString() } });`;
|
|
11
|
+
case 'waitForEvent':
|
|
12
|
+
return `const ${id}_result = await step.waitForEvent('${id}', { event: 'my.waited.event', timeout: '60s' });`;
|
|
13
|
+
default:
|
|
14
|
+
return `// not supported`;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function indent(s, spaces) {
|
|
18
|
+
const pad = ' '.repeat(spaces);
|
|
19
|
+
return s.split('\n').map(l => l ? pad + l : l).join('\n');
|
|
20
|
+
}
|
|
21
|
+
// Simple code formatter
|
|
22
|
+
function formatCode(code) {
|
|
23
|
+
// Basic formatting - in production, you'd use a proper formatter
|
|
24
|
+
return code.split('\n').map(line => line.trimEnd()).join('\n').replace(/\n{3,}/g, '\n\n'); // Remove excessive blank lines
|
|
25
|
+
}
|
|
26
|
+
function sanitizeDirectStepCode(code) {
|
|
27
|
+
if (!code) {
|
|
28
|
+
return code;
|
|
29
|
+
}
|
|
30
|
+
return code
|
|
31
|
+
// Remove inline object returns (e.g. return { success: true };)
|
|
32
|
+
.replace(/\n\s*return\s*\{[\s\S]*?\};?/g, '')
|
|
33
|
+
// Remove simple expression returns (e.g. return result;)
|
|
34
|
+
.replace(/\n\s*return\s+[^\n;]+;?/g, '');
|
|
35
|
+
}
|
|
36
|
+
function generateStepBlock(step, position) {
|
|
37
|
+
const stepVar = (step.code || '').match(/const\s+(\w+)\s*=/)?.[1] || `step_${position}`;
|
|
38
|
+
// If caller supplied code, embed it inside step.run wrapper by default for consistency
|
|
39
|
+
if (step.type === 'sleep' || step.type === 'sendEvent' || step.type === 'waitForEvent') {
|
|
40
|
+
// Execute directly (these typically call step.* helpers)
|
|
41
|
+
const body = extractFunctionBody(step.code || '') || getDefaultDirectBody(step.type, stepVar, step.name);
|
|
42
|
+
return `// ${step.description || step.name || `Step ${position}`}
|
|
43
|
+
${body}`;
|
|
44
|
+
}
|
|
45
|
+
const inner = extractFunctionBody(step.code || '') || 'return { success: true };';
|
|
46
|
+
return `// ${step.description || step.name || `Step ${position}`}
|
|
47
|
+
const ${stepVar}_result = await step.run('${stepVar}', async () => {
|
|
48
|
+
${indent(inner, 2)}
|
|
49
|
+
});`;
|
|
50
|
+
}
|
|
51
|
+
// Minimal shared generator. Replace internals by moving editor logic here incrementally.
|
|
52
|
+
function generateFunctionCode(def) {
|
|
53
|
+
const eventsString = def.events.length > 0 ? def.events.map(e => `'${e}'`).join(', ') : `'app.event'`;
|
|
54
|
+
const safeId = def.id.replace(/[^a-zA-Z0-9]/g, '') || 'function';
|
|
55
|
+
const body = generateHandlerBody(def);
|
|
56
|
+
return `const ${safeId}Function = inngest.createFunction(
|
|
57
|
+
{ id: '${def.id}' },
|
|
58
|
+
{ event: [${eventsString}] },
|
|
59
|
+
async ({ event, step }) => {
|
|
60
|
+
${indent(body, 4)}
|
|
61
|
+
}
|
|
62
|
+
);`;
|
|
63
|
+
}
|
|
64
|
+
// New: return only the handler body that backend executes and editor displays
|
|
65
|
+
function generateHandlerBody(def) {
|
|
66
|
+
const stepBlocks = def.steps.map((step, index) => generateStepBlock(step, index + 1)).join('\n');
|
|
67
|
+
// Footer removed: callers should append their own consolidated return as needed
|
|
68
|
+
return `${stepBlocks}`;
|
|
69
|
+
}
|
|
70
|
+
function escapeSingleQuotes(value) {
|
|
71
|
+
return value.replace(/\\/g, '\\\\').replace(/'/g, "\\'");
|
|
72
|
+
}
|
|
73
|
+
function resolveStepVarName(step, index) {
|
|
74
|
+
const directMatch = (step.code || '').match(/const\s+(\w+)\s*=/);
|
|
75
|
+
if (directMatch) {
|
|
76
|
+
return directMatch[1];
|
|
77
|
+
}
|
|
78
|
+
if (typeof step.id === 'string' && step.id.trim()) {
|
|
79
|
+
return step.id;
|
|
80
|
+
}
|
|
81
|
+
return `step_${index + 1}`;
|
|
82
|
+
}
|
|
83
|
+
function resolveResultExpression(step, varName) {
|
|
84
|
+
switch (step.type) {
|
|
85
|
+
case 'sleep':
|
|
86
|
+
return 'sleepResult';
|
|
87
|
+
case 'sendEvent':
|
|
88
|
+
return 'eventResult';
|
|
89
|
+
case 'waitForEvent':
|
|
90
|
+
return 'waitResult';
|
|
91
|
+
default:
|
|
92
|
+
return `${varName}_result`;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function sanitizeSteps(def) {
|
|
96
|
+
const sanitizedSteps = def.steps.map(step => {
|
|
97
|
+
if (step.type === 'sleep' || step.type === 'sendEvent' || step.type === 'waitForEvent') {
|
|
98
|
+
return {
|
|
99
|
+
...step,
|
|
100
|
+
code: sanitizeDirectStepCode(step.code || '')
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
return step;
|
|
104
|
+
});
|
|
105
|
+
return {
|
|
106
|
+
...def,
|
|
107
|
+
steps: sanitizedSteps
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function generateHandlerBodyWithReturn(def) {
|
|
111
|
+
const sanitizedDef = sanitizeSteps(def);
|
|
112
|
+
const body = generateHandlerBody(sanitizedDef).trimEnd();
|
|
113
|
+
const resultLines = sanitizedDef.steps.map((step, index) => {
|
|
114
|
+
const varName = resolveStepVarName(step, index);
|
|
115
|
+
const resultExpr = resolveResultExpression(step, varName);
|
|
116
|
+
if (!resultExpr) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
return ` ${varName}: ${resultExpr},`;
|
|
120
|
+
}).filter(line => Boolean(line));
|
|
121
|
+
const escapedId = escapeSingleQuotes(def.id || 'new-function');
|
|
122
|
+
const returnLines = ['return {', ` functionId: '${escapedId}',`, ...resultLines, ' timestamp: new Date().toISOString()', '};'];
|
|
123
|
+
const returnBlock = returnLines.join('\n');
|
|
124
|
+
if (!body) {
|
|
125
|
+
return returnBlock;
|
|
126
|
+
}
|
|
127
|
+
return `${body}\n\n${returnBlock}`;
|
|
128
|
+
}
|
|
129
|
+
// Generate Inngest function from database-extracted functions
|
|
130
|
+
function generateStepFunctionsFromDB(functionId, events, extractedFunctions) {
|
|
131
|
+
if (!extractedFunctions || extractedFunctions.length === 0) {
|
|
132
|
+
throw new Error('No functions provided to generate');
|
|
133
|
+
}
|
|
134
|
+
// Use the new unified generator
|
|
135
|
+
const code = generateFromExtractedFunctions(extractedFunctions);
|
|
136
|
+
return {
|
|
137
|
+
code: formatCode(code),
|
|
138
|
+
functionId,
|
|
139
|
+
stepCount: extractedFunctions.length
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
// Wrap multiple step functions in a single Inngest function
|
|
143
|
+
function wrapStepsInInngestFunction(functionDef, stepFunctions) {
|
|
144
|
+
const extractedFunctions = stepFunctions.map(sf => ({
|
|
145
|
+
id: sf.id,
|
|
146
|
+
name: sf.name,
|
|
147
|
+
code: sf.code,
|
|
148
|
+
description: sf.description
|
|
149
|
+
}));
|
|
150
|
+
const result = generateStepFunctionsFromDB(functionDef.id, functionDef.events, extractedFunctions);
|
|
151
|
+
return result.code;
|
|
152
|
+
}
|
|
153
|
+
// Generate a single step from an extracted function
|
|
154
|
+
function generateStepFromFunction(stepFunction, index) {
|
|
155
|
+
const stepVar = extractStepVarName(stepFunction.code) || `step_${index}`;
|
|
156
|
+
const functionBody = extractFunctionBody(stepFunction.code);
|
|
157
|
+
if (!functionBody) {
|
|
158
|
+
return `// ${stepFunction.name || `Step ${index}`}\nconst ${stepVar}_result = { success: false, error: 'Invalid function format' };`;
|
|
159
|
+
}
|
|
160
|
+
const hasDirectOps = hasDirectStepOperations(stepFunction.code);
|
|
161
|
+
const cleanedBody = cleanStepCode(functionBody);
|
|
162
|
+
if (hasDirectOps) {
|
|
163
|
+
return `// ${stepFunction.name || `Step ${index}`}\n${cleanedBody}`;
|
|
164
|
+
}
|
|
165
|
+
return `// ${stepFunction.name || `Step ${index}`}\nconst ${stepVar}_result = await step.run('${stepVar}', async () => {\n${indent(cleanedBody, 2)}\n});`;
|
|
166
|
+
}export{cleanStepCode,extractStepVarName,generateFunctionCode,generateHandlerBody,generateHandlerBodyWithReturn,generateStepFromFunction,generateStepFunctionsFromDB,wrapStepsInInngestFunction};//# sourceMappingURL=generateFunctionCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateFunctionCode.js","sources":["../../src/inngest/generateFunctionCode.ts"],"sourcesContent":[null],"names":[],"mappings":"qHAuGA;AAqDA,SAAA;AAqCA,EAAA,OAAA,+CACI,CAAA,IAAA,CAAU,IAAE,CAAA;AAmBhB;AAcA,SAAA,oBAAgB,CAAA,IAAA,EAAA,EAAA,EAAA,KAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/inngest/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type InngestStepType = 'run' | 'sleep' | 'sendEvent' | 'waitForEvent' | 'retrieveData' | 'parallel' | 'validateForm';
|
|
2
|
+
export interface InngestStep {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
type: InngestStepType;
|
|
6
|
+
code?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface InngestFunctionDef {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
events: string[];
|
|
15
|
+
steps: InngestStep[];
|
|
16
|
+
concurrency?: number;
|
|
17
|
+
retries?: number;
|
|
18
|
+
timeout?: string | number;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
export interface ExtractedFunction {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
code?: string;
|
|
25
|
+
extensionId?: string;
|
|
26
|
+
extensionName?: string;
|
|
27
|
+
generatedCode?: string;
|
|
28
|
+
steps?: StepDefinition[];
|
|
29
|
+
originalStepName?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface StepFunction {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
code: string;
|
|
35
|
+
type?: InngestStepType;
|
|
36
|
+
description?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface StepDefinition {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
code: string;
|
|
42
|
+
}
|
|
43
|
+
export interface GeneratedFunctionResult {
|
|
44
|
+
code: string;
|
|
45
|
+
functionId: string;
|
|
46
|
+
stepCount: number;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/inngest/interfaces/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GACrB,KAAK,GACL,OAAO,GACP,WAAW,GACX,cAAc,GACd,cAAc,GACd,UAAU,GACV,cAAc,CAAC;AAErB,MAAM,WAAW,WAAW;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAGD,MAAM,WAAW,iBAAiB;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,YAAY;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,uBAAuB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -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"}
|