@adminide-stack/form-builder-core 5.1.4-alpha.81 → 6.0.1-alpha.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/LICENSE CHANGED
@@ -1,21 +1,30 @@
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.
1
+ PROPRIETARY SOFTWARE LICENSE
2
+
3
+ Copyright (c) 2025 CDMBase. All Rights Reserved.
4
+
5
+ This software and associated documentation files (the "Software") are the
6
+ proprietary and confidential property of CDMBase.
7
+
8
+ ALL RIGHTS RESERVED.
9
+
10
+ No part of this Software may be reproduced, distributed, transmitted,
11
+ displayed, published, or broadcast in any form or by any means, electronic,
12
+ mechanical, photocopying, recording, or otherwise, without the prior written
13
+ permission of CDMBase.
14
+
15
+ The Software is provided to authorized users only under separate written
16
+ agreement and may not be used, copied, modified, merged, published, distributed,
17
+ sublicensed, and/or sold without express written permission from CDMBase.
18
+
19
+ UNAUTHORIZED USE, REPRODUCTION, OR DISTRIBUTION OF THIS SOFTWARE, OR ANY
20
+ PORTION OF IT, MAY RESULT IN SEVERE CIVIL AND CRIMINAL PENALTIES, AND WILL
21
+ BE PROSECUTED TO THE MAXIMUM EXTENT POSSIBLE UNDER LAW.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26
+ CDMBase BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
+
30
+ For licensing inquiries, please contact: legal@cdmbase.com
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- export{generateFunctionCode,generateHandlerBody,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
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
@@ -2,6 +2,7 @@ import type { InngestFunctionDef, ExtractedFunction, StepFunction, GeneratedFunc
2
2
  export { cleanStepCode, extractStepVarName } from './stepGenerator';
3
3
  export declare function generateFunctionCode(def: InngestFunctionDef): string;
4
4
  export declare function generateHandlerBody(def: InngestFunctionDef): string;
5
+ export declare function generateHandlerBodyWithReturn(def: InngestFunctionDef): string;
5
6
  export declare function generateStepFunctionsFromDB(functionId: string, events: string[], extractedFunctions: ExtractedFunction[]): GeneratedFunctionResult;
6
7
  export declare function wrapStepsInInngestFunction(functionDef: InngestFunctionDef, stepFunctions: StepFunction[]): string;
7
8
  export declare function generateStepFromFunction(stepFunction: StepFunction, index: number): string;
@@ -1 +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;AA2DpE,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,kBAAkB,GAAG,MAAM,CAWpE;AAGD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,kBAAkB,GAAG,MAAM,CAInE;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"}
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"}
@@ -23,6 +23,16 @@ function formatCode(code) {
23
23
  // Basic formatting - in production, you'd use a proper formatter
24
24
  return code.split('\n').map(line => line.trimEnd()).join('\n').replace(/\n{3,}/g, '\n\n'); // Remove excessive blank lines
25
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
+ }
26
36
  function generateStepBlock(step, position) {
27
37
  const stepVar = (step.code || '').match(/const\s+(\w+)\s*=/)?.[1] || `step_${position}`;
28
38
  // If caller supplied code, embed it inside step.run wrapper by default for consistency
@@ -34,7 +44,7 @@ ${body}`;
34
44
  }
35
45
  const inner = extractFunctionBody(step.code || '') || 'return { success: true };';
36
46
  return `// ${step.description || step.name || `Step ${position}`}
37
- const ${stepVar}_result = await step.run('${stepVar}', async (event, step) => {
47
+ const ${stepVar}_result = await step.run('${stepVar}', async () => {
38
48
  ${indent(inner, 2)}
39
49
  });`;
40
50
  }
@@ -57,6 +67,65 @@ function generateHandlerBody(def) {
57
67
  // Footer removed: callers should append their own consolidated return as needed
58
68
  return `${stepBlocks}`;
59
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
+ }
60
129
  // Generate Inngest function from database-extracted functions
61
130
  function generateStepFunctionsFromDB(functionId, events, extractedFunctions) {
62
131
  if (!extractedFunctions || extractedFunctions.length === 0) {
@@ -93,5 +162,5 @@ function generateStepFromFunction(stepFunction, index) {
93
162
  if (hasDirectOps) {
94
163
  return `// ${stepFunction.name || `Step ${index}`}\n${cleanedBody}`;
95
164
  }
96
- return `// ${stepFunction.name || `Step ${index}`}\nconst ${stepVar}_result = await step.run('${stepVar}', async (event, step) => {\n${indent(cleanedBody, 2)}\n});`;
97
- }export{cleanStepCode,extractStepVarName,generateFunctionCode,generateHandlerBody,generateStepFromFunction,generateStepFunctionsFromDB,wrapStepsInInngestFunction};//# sourceMappingURL=generateFunctionCode.js.map
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
@@ -1 +1 @@
1
- {"version":3,"file":"generateFunctionCode.js","sources":["../../src/inngest/generateFunctionCode.ts"],"sourcesContent":[null],"names":[],"mappings":"qHAyFA;AAOA,SAAA;AAoBA,EAAA,OAAA,+CAA2C,CAAA,IAAA,CAAW,IAAE,CAAA;AAcxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminide-stack/form-builder-core",
3
- "version": "5.1.4-alpha.81",
3
+ "version": "6.0.1-alpha.0",
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": "883372f3751305aa9c87265af7b7b75ac9eee30e"
27
+ "gitHead": "3b03b6491950e7c03b51a00014c3ff879a21fcdf"
28
28
  }
package/CHANGELOG.md DELETED
@@ -1,56 +0,0 @@
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.81](https://github.com/CDEBase/forms-stack/compare/v5.1.4-alpha.80...v5.1.4-alpha.81) (2025-10-24)
7
-
8
- **Note:** Version bump only for package @adminide-stack/form-builder-core
9
-
10
- ## [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)
11
-
12
- **Note:** Version bump only for package @adminide-stack/form-builder-core
13
-
14
- ## [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)
15
-
16
- **Note:** Version bump only for package @adminide-stack/form-builder-core
17
-
18
- ## [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)
19
-
20
- **Note:** Version bump only for package @adminide-stack/form-builder-core
21
-
22
- ## [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)
23
-
24
- **Note:** Version bump only for package @adminide-stack/form-builder-core
25
-
26
- ## [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)
27
-
28
- **Note:** Version bump only for package @adminide-stack/form-builder-core
29
-
30
- ## [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)
31
-
32
- **Note:** Version bump only for package @adminide-stack/form-builder-core
33
-
34
- ## [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)
35
-
36
- **Note:** Version bump only for package @adminide-stack/form-builder-core
37
-
38
- ## [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)
39
-
40
- **Note:** Version bump only for package @adminide-stack/form-builder-core
41
-
42
- ## [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)
43
-
44
- **Note:** Version bump only for package @adminide-stack/form-builder-core
45
-
46
- ## [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)
47
-
48
- **Note:** Version bump only for package @adminide-stack/form-builder-core
49
-
50
- ## [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)
51
-
52
- **Note:** Version bump only for package @adminide-stack/form-builder-core
53
-
54
- ## [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)
55
-
56
- **Note:** Version bump only for package @adminide-stack/form-builder-core
package/rollup.config.mjs DELETED
@@ -1,33 +0,0 @@
1
- import { createRollupConfig } from '../../../rollup.config.base.mjs';
2
-
3
- // Define any additional plugins specific to this bundle
4
- const additionalPlugins = [];
5
-
6
- // Use the createRollupConfig function to merge the base and specific configurations
7
- export default (commandLineArgs) => {
8
- const isWatchMode = commandLineArgs.watch;
9
- return [
10
- createRollupConfig(
11
- {
12
- input: ['src/index.ts'],
13
- plugins: [
14
- // Spread in additional plugins specific to this config
15
- ...additionalPlugins,
16
- ],
17
- output: [
18
- {
19
- dir: 'lib',
20
- format: 'es',
21
- name: 'form-stack-server',
22
- compact: true,
23
- exports: 'named',
24
- sourcemap: true,
25
- preserveModules: true,
26
- chunkFileNames: '[name]-[hash].[format].js',
27
- },
28
- ],
29
- },
30
- isWatchMode,
31
- ),
32
- ];
33
- };
package/src/index.ts DELETED
@@ -1,5 +0,0 @@
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';