@adminide-stack/form-builder-core 5.1.4-alpha.66 → 5.1.4-alpha.81

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 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.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
+
6
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)
7
11
 
8
12
  **Note:** Version bump only for package @adminide-stack/form-builder-core
package/lib/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './inngest/interfaces/types';
2
2
  export * from './inngest/generateFunctionCode';
3
- export { generateFromExtractedFunctions } from './inngest/stepGenerator';
3
+ export { generateFromExtractedFunctions, extractFunctionBody } from './inngest/stepGenerator';
4
4
  export * from './inngest/monacoAutocompleteIntegration';
5
+ export * from './utils/json';
5
6
  //# 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,MAAM,yBAAyB,CAAC;AACzE,cAAc,yCAAyC,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"}
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';export{getAvailableDefinitions,installLibraryForAutocomplete,setupMonacoAutocomplete,setupStepAutocomplete,updateAutocompleteConfig}from'./inngest/monacoAutocompleteIntegration.js';//# sourceMappingURL=index.js.map
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
@@ -0,0 +1,3 @@
1
+ export declare function flatten(obj: Record<string, unknown>, parentKey?: string, res?: Record<string, unknown>): Record<string, unknown>;
2
+ export declare function unflatten(obj: Record<string, unknown>): {};
3
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/utils/json.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,SAAK,EAAE,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,2BAoBtG;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,MA2BrD"}
@@ -0,0 +1,43 @@
1
+ function flatten(obj, parentKey = '', res = {}) {
2
+ Object.entries(obj).forEach(([key, value]) => {
3
+ const newKey = parentKey ? `${parentKey}.${key}` : key;
4
+ if (Array.isArray(value)) {
5
+ value.forEach((item, index) => {
6
+ if (item !== null && typeof item === 'object') {
7
+ flatten(item, `${newKey}.${index}`, res);
8
+ } else {
9
+ res[`${newKey}.${index}`] = item;
10
+ }
11
+ });
12
+ } else if (value !== null && typeof value === 'object') {
13
+ flatten(value, newKey, res);
14
+ } else {
15
+ res[newKey] = value;
16
+ }
17
+ });
18
+ return res;
19
+ }
20
+ function unflatten(obj) {
21
+ const result = {};
22
+ if (!obj || typeof obj !== 'object') return result;
23
+ for (const [flatKey, value] of Object.entries(obj)) {
24
+ const keys = flatKey.split('.');
25
+ keys.reduce((acc, cur, i) => {
26
+ const isLast = i === keys.length - 1;
27
+ const nextKey = keys[i + 1];
28
+ const curIsIndex = !Number.isNaN(Number(cur));
29
+ const nextIsIndex = !Number.isNaN(Number(nextKey));
30
+ // If current key is numeric, treat parent as an array
31
+ if (curIsIndex) {
32
+ if (!Array.isArray(acc)) return [];
33
+ }
34
+ if (isLast) {
35
+ acc[cur] = value;
36
+ } else if (acc[cur] == null) {
37
+ acc[cur] = nextIsIndex ? [] : {};
38
+ }
39
+ return acc[cur];
40
+ }, result);
41
+ }
42
+ return result;
43
+ }export{flatten,unflatten};//# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sources":["../../src/utils/json.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA,SAAA,OAAA,CAAgB,GAAA,EAAA,cAAmB,EAAC,GAAA,GAAM,EAAE,EAAA;AAsB5C,EAAA,MAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,OAAgB,CAAA,CAAA,CAAA,GAAU,EAAG,KAAE,CAAA,KAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminide-stack/form-builder-core",
3
- "version": "5.1.4-alpha.66",
3
+ "version": "5.1.4-alpha.81",
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": "38642244b69e8c665139fb1a3cbc5f4c524f99d5"
27
+ "gitHead": "883372f3751305aa9c87265af7b7b75ac9eee30e"
28
28
  }
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './inngest/interfaces/types';
2
2
  export * from './inngest/generateFunctionCode';
3
- export { generateFromExtractedFunctions } from './inngest/stepGenerator';
3
+ export { generateFromExtractedFunctions, extractFunctionBody } from './inngest/stepGenerator';
4
4
  export * from './inngest/monacoAutocompleteIntegration';
5
+ export * from './utils/json';
@@ -0,0 +1,50 @@
1
+ export function flatten(obj: Record<string, unknown>, parentKey = '', res: Record<string, unknown> = {}) {
2
+ Object.entries(obj).forEach(([key, value]) => {
3
+ const newKey = parentKey ? `${parentKey}.${key}` : key;
4
+
5
+ if (Array.isArray(value)) {
6
+ value.forEach((item, index) => {
7
+ if (item !== null && typeof item === 'object') {
8
+ flatten(item, `${newKey}.${index}`, res);
9
+ } else {
10
+ res[`${newKey}.${index}`] = item;
11
+ }
12
+ });
13
+ } else if (value !== null && typeof value === 'object') {
14
+ flatten(value as Record<string, unknown>, newKey, res);
15
+ } else {
16
+ res[newKey] = value;
17
+ }
18
+ });
19
+
20
+ return res;
21
+ }
22
+
23
+ export function unflatten(obj: Record<string, unknown>) {
24
+ const result = {};
25
+ if (!obj || typeof obj !== 'object') return result;
26
+ for (const [flatKey, value] of Object.entries(obj)) {
27
+ const keys = flatKey.split('.');
28
+ keys.reduce((acc, cur, i) => {
29
+ const isLast = i === keys.length - 1;
30
+ const nextKey = keys[i + 1];
31
+ const curIsIndex = !Number.isNaN(Number(cur));
32
+ const nextIsIndex = !Number.isNaN(Number(nextKey));
33
+
34
+ // If current key is numeric, treat parent as an array
35
+ if (curIsIndex) {
36
+ if (!Array.isArray(acc)) return [];
37
+ }
38
+
39
+ if (isLast) {
40
+ acc[cur] = value;
41
+ } else if (acc[cur] == null) {
42
+ acc[cur] = nextIsIndex ? [] : {};
43
+ }
44
+
45
+ return acc[cur];
46
+ }, result);
47
+ }
48
+
49
+ return result;
50
+ }