@adminide-stack/form-builder-core 5.1.4-alpha.165 → 5.1.4-alpha.194

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/lib/index.d.ts CHANGED
@@ -3,4 +3,5 @@ export * from './inngest/generateFunctionCode';
3
3
  export { generateFromExtractedFunctions, extractFunctionBody } from './inngest/stepGenerator';
4
4
  export * from './inngest/monacoAutocompleteIntegration';
5
5
  export * from './utils/json';
6
+ export * from './utils/deepMergeFormSteps';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -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,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9F,cAAc,yCAAyC,CAAC;AACxD,cAAc,cAAc,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,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9F,cAAc,yCAAyC,CAAC;AACxD,cAAc,cAAc,CAAC;AAC7B,cAAc,4BAA4B,CAAC"}
package/lib/index.js CHANGED
@@ -1 +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
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';export{deepMergeElements,deepMergeFormSteps}from'./utils/deepMergeFormSteps.js';//# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import {generateFromExtractedFunctions,extractStepVarName,extractFunctionBody,cleanStepCode}from'./stepGenerator.js';// Check if code contains direct step operations (sleep, sendEvent, etc)
1
+ import {extractStepVarName,extractFunctionBody,generateFromExtractedFunctions,cleanStepCode}from'./stepGenerator.js';// Check if code contains direct step operations (sleep, sendEvent, etc)
2
2
  function hasDirectStepOperations(code) {
3
3
  return /step\.(sleep|sendEvent|waitForEvent|run)\s*\(/.test(code);
4
4
  }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Deep merge preGeneratedFormSteps arrays by matching step/element ids recursively.
3
+ * When two steps share the same id (e.g. "credential"), their elements/children are
4
+ * recursively merged so that all unique template namespaces appear as siblings in the tree.
5
+ *
6
+ * This utility lives in core so it can be reused by both browser and server code.
7
+ */
8
+ export declare function deepMergeFormSteps(existingSteps: any[], newSteps: any[]): any[];
9
+ /**
10
+ * Recursively merge element/children arrays by matching on element id.
11
+ * Groups with matching ids have their children merged recursively;
12
+ * elements with unique ids are appended.
13
+ */
14
+ export declare function deepMergeElements(existingElements: any[], newElements: any[]): any[];
15
+ //# sourceMappingURL=deepMergeFormSteps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepMergeFormSteps.d.ts","sourceRoot":"","sources":["../../src/utils/deepMergeFormSteps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,CAmB/E;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,gBAAgB,EAAE,GAAG,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,CAyBpF"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Deep merge preGeneratedFormSteps arrays by matching step/element ids recursively.
3
+ * When two steps share the same id (e.g. "credential"), their elements/children are
4
+ * recursively merged so that all unique template namespaces appear as siblings in the tree.
5
+ *
6
+ * This utility lives in core so it can be reused by both browser and server code.
7
+ */
8
+ function deepMergeFormSteps(existingSteps, newSteps) {
9
+ const result = existingSteps.map(step => ({
10
+ ...step
11
+ }));
12
+ for (const newStep of newSteps) {
13
+ const existingIndex = result.findIndex(s => s.id === newStep.id);
14
+ if (existingIndex >= 0) {
15
+ // Same step id — deep merge elements
16
+ const existing = result[existingIndex];
17
+ result[existingIndex] = {
18
+ ...existing,
19
+ ...newStep,
20
+ elements: deepMergeElements(existing.elements || [], newStep.elements || [])
21
+ };
22
+ } else {
23
+ result.push({
24
+ ...newStep
25
+ });
26
+ }
27
+ }
28
+ return result;
29
+ }
30
+ /**
31
+ * Recursively merge element/children arrays by matching on element id.
32
+ * Groups with matching ids have their children merged recursively;
33
+ * elements with unique ids are appended.
34
+ */
35
+ function deepMergeElements(existingElements, newElements) {
36
+ const result = existingElements.map(el => ({
37
+ ...el
38
+ }));
39
+ for (const newEl of newElements) {
40
+ const existingIndex = result.findIndex(e => e.id === newEl.id);
41
+ if (existingIndex >= 0) {
42
+ const existing = result[existingIndex];
43
+ if (existing.children && newEl.children) {
44
+ // Both have children — recursively merge
45
+ result[existingIndex] = {
46
+ ...existing,
47
+ ...newEl,
48
+ children: deepMergeElements(existing.children, newEl.children)
49
+ };
50
+ } else if (newEl.children) {
51
+ // Only new has children — use new
52
+ result[existingIndex] = {
53
+ ...newEl
54
+ };
55
+ }
56
+ // If only existing has children or neither has, keep existing
57
+ } else {
58
+ result.push({
59
+ ...newEl
60
+ });
61
+ }
62
+ }
63
+ return result;
64
+ }export{deepMergeElements,deepMergeFormSteps};//# sourceMappingURL=deepMergeFormSteps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepMergeFormSteps.js","sources":["../../src/utils/deepMergeFormSteps.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;AAMG;AACH,SAAA,kBAAgB,CAAA,aAAmB,EAAA,QAAe;AAqBlD,EAAA,MAAA,MAAA,GAAA,aAAA,CAAA,GAAA,CAAA,IAAA,KAAA;;;;AAIG,IAAA,MAAA,aAAA,GAAA,MAAA,CAAA,SAAA,CAAA,CAAA,IAAA,CAAA,CAAA,EAAA,KAAA,OAAA,CAAA,EAAA,CAAA;AACH,IAAA,IAAA,aAAA,IAAgB,CAAA,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.165",
3
+ "version": "5.1.4-alpha.194",
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": "510d8c71063863bcf0edb864f66a7555c017476d"
27
+ "gitHead": "00c306608075b9c2dfd089d0982096f616a2ee59"
28
28
  }