@kaskad/core 0.0.7 → 0.0.8

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.
@@ -0,0 +1,156 @@
1
+ import { readFileSync, promises } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { DefinitionStore, registerPlugins, sys, common, browser, forms, initRuntime, templateRegistry, loadTemplates, unfoldNodeSchema, createRootNode, activateNode, ComponentTreeApi, activateStructure } from '@kaskad/core';
4
+ import { vi } from 'vitest';
5
+ import { parse } from 'yaml';
6
+
7
+ /// <reference types="node" />
8
+ let currentComponentId;
9
+ async function createView(rawSchema) {
10
+ vi.useFakeTimers();
11
+ const defStore = DefinitionStore.getInstance();
12
+ // Register common definitions if not already registered (for YAML schema tests)
13
+ // Core tests register these in beforeEach
14
+ if (Object.keys(defStore.components).length === 0) {
15
+ registerPlugins(sys, common, browser, forms);
16
+ initRuntime();
17
+ }
18
+ const url = 'my-schema';
19
+ const componentTypes = new Set();
20
+ const dependencies = new Set();
21
+ templateRegistry.set(url, rawSchema, componentTypes, dependencies);
22
+ await loadTemplates(rawSchema);
23
+ const schema = unfoldNodeSchema(rawSchema, { type: 'component' });
24
+ const root = createRootNode(url, schema, null, null, url);
25
+ activateNode(root);
26
+ await vi.runAllTimersAsync();
27
+ currentComponentId = root.extractedValue;
28
+ }
29
+ function loadYamlSchema(absolutePath) {
30
+ try {
31
+ const content = readFileSync(absolutePath, 'utf-8');
32
+ return parse(content);
33
+ }
34
+ catch (error) {
35
+ if (error.code === 'ENOENT') {
36
+ throw new Error(`YAML schema not found: ${absolutePath}`);
37
+ }
38
+ throw new Error(`Failed to load YAML schema ${absolutePath}: ${error}`);
39
+ }
40
+ }
41
+ function loadYamlSchemaFrom(baseDir, relativePath) {
42
+ const fullPath = join(baseDir, relativePath);
43
+ return loadYamlSchema(fullPath);
44
+ }
45
+ async function createViewFromFile(baseDir, relativePath) {
46
+ const schema = loadYamlSchemaFrom(baseDir, relativePath);
47
+ await createView(schema);
48
+ }
49
+ /**
50
+ * Sets up a fetch mock that resolves `/recipes/{path}.yml` URLs to actual files.
51
+ * Use this when testing recipes that use `templateUrl` to load external templates.
52
+ *
53
+ * @param recipesBaseDir - The base directory where recipe files are located
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * // In your test file
58
+ * import { setupRecipeFetch } from '@kaskad/core/testing';
59
+ * import * as path from 'node:path';
60
+ *
61
+ * setupRecipeFetch(path.resolve(__dirname, '../..'));
62
+ * ```
63
+ */
64
+ function setupRecipeFetch(recipesBaseDir) {
65
+ vi.stubGlobal('fetch', vi.fn(async (url) => {
66
+ // Handle /recipes/{path}.yml URLs
67
+ if (url.startsWith('/recipes/')) {
68
+ const recipePath = url.replace('/recipes/', '');
69
+ const filePath = join(recipesBaseDir, recipePath);
70
+ try {
71
+ const raw = await promises.readFile(filePath);
72
+ return new Response(raw, {
73
+ status: 200,
74
+ headers: { 'Content-Type': 'text/yaml' },
75
+ });
76
+ }
77
+ catch (err) {
78
+ if (err && typeof err === 'object' && 'code' in err && err.code === 'ENOENT') {
79
+ return new Response(`File not found: ${url}`, {
80
+ status: 404,
81
+ statusText: 'Not Found',
82
+ });
83
+ }
84
+ throw err;
85
+ }
86
+ }
87
+ return new Response('Not found', { status: 404 });
88
+ }));
89
+ }
90
+ function setCurrent(selector) {
91
+ const component = ComponentTreeApi.findComponent(currentComponentId, selector);
92
+ if (!component) {
93
+ throw new Error(`Component not found: ${selector}`);
94
+ }
95
+ currentComponentId = component.id;
96
+ }
97
+ function get(selector) {
98
+ const node = ComponentTreeApi.findNode(currentComponentId, selector);
99
+ return (node?.extractedValue ?? null);
100
+ }
101
+ function set(selector, value) {
102
+ ComponentTreeApi.setNodeRawSchema(currentComponentId, selector, value);
103
+ const node = ComponentTreeApi.findNode(currentComponentId, selector);
104
+ if (node) {
105
+ activateStructure(node);
106
+ }
107
+ }
108
+ async function run(selector, ...args) {
109
+ const commandPromise = ComponentTreeApi.runCommandNode(currentComponentId, selector, ...args);
110
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
111
+ commandPromise.catch(() => { });
112
+ await vi.runAllTimersAsync();
113
+ return commandPromise;
114
+ }
115
+ function select(selector) {
116
+ const component = ComponentTreeApi.findComponent(currentComponentId, selector);
117
+ if (!component) {
118
+ throw new Error(`Component not found: ${selector}`);
119
+ }
120
+ return component;
121
+ }
122
+ function selectAll(selector) {
123
+ const components = selector.split(',').flatMap((s) => ComponentTreeApi.findComponents(currentComponentId, s.trim()));
124
+ if (!components.length) {
125
+ throw new Error(`Components not found: ${selector}`);
126
+ }
127
+ return components;
128
+ }
129
+ function evaluating(selector) {
130
+ const node = ComponentTreeApi.findNode(currentComponentId, selector);
131
+ return node?.evaluating ?? false;
132
+ }
133
+ function running(selector) {
134
+ return ComponentTreeApi.isCommandRunning(currentComponentId, selector);
135
+ }
136
+ function getComponentType(selector) {
137
+ const component = ComponentTreeApi.findComponent(currentComponentId, selector);
138
+ if (!component) {
139
+ throw new Error(`Component not found: ${selector}`);
140
+ }
141
+ return component.componentType;
142
+ }
143
+ function getId(selector) {
144
+ const component = ComponentTreeApi.findComponent(currentComponentId, selector);
145
+ if (!component) {
146
+ throw new Error(`Component not found: ${selector}`);
147
+ }
148
+ return component.id;
149
+ }
150
+
151
+ /**
152
+ * Generated bundle index. Do not edit.
153
+ */
154
+
155
+ export { createView, createViewFromFile, evaluating, get, getComponentType, getId, loadYamlSchema, loadYamlSchemaFrom, run, running, select, selectAll, set, setCurrent, setupRecipeFetch };
156
+ //# sourceMappingURL=kaskad-core-testing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kaskad-core-testing.mjs","sources":["../../../../libs/core/testing/src/index.ts","../../../../libs/core/testing/src/kaskad-core-testing.ts"],"sourcesContent":["/// <reference types=\"node\" />\nimport { promises as fs, readFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport {\n activateNode,\n activateStructure,\n browser,\n common,\n ComponentId,\n ComponentRecipe,\n ComponentTreeApi,\n createRootNode,\n DefinitionStore,\n forms,\n initRuntime,\n loadTemplates,\n registerPlugins,\n sys,\n TComponent,\n templateRegistry,\n unfoldNodeSchema,\n} from '@kaskad/core';\nimport { vi } from 'vitest';\nimport { parse } from 'yaml';\n\nlet currentComponentId: ComponentId;\n\nexport async function createView(rawSchema: ComponentRecipe): Promise<void> {\n vi.useFakeTimers();\n\n const defStore = DefinitionStore.getInstance();\n\n // Register common definitions if not already registered (for YAML schema tests)\n // Core tests register these in beforeEach\n if (Object.keys(defStore.components).length === 0) {\n registerPlugins(sys, common, browser, forms);\n initRuntime();\n }\n\n const url = 'my-schema';\n const componentTypes = new Set<string>();\n const dependencies = new Set<string>();\n templateRegistry.set(url, rawSchema, componentTypes, dependencies);\n\n await loadTemplates(rawSchema);\n\n const schema = unfoldNodeSchema(rawSchema, { type: 'component' });\n const root = createRootNode(url, schema, null, null, url);\n\n activateNode(root);\n await vi.runAllTimersAsync();\n\n currentComponentId = root.extractedValue as ComponentId;\n}\n\nexport function loadYamlSchema(absolutePath: string): ComponentRecipe {\n try {\n const content = readFileSync(absolutePath, 'utf-8');\n return parse(content);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') {\n throw new Error(`YAML schema not found: ${absolutePath}`);\n }\n throw new Error(`Failed to load YAML schema ${absolutePath}: ${error}`);\n }\n}\n\nexport function loadYamlSchemaFrom(baseDir: string, relativePath: string): ComponentRecipe {\n const fullPath = join(baseDir, relativePath);\n return loadYamlSchema(fullPath);\n}\n\nexport async function createViewFromFile(baseDir: string, relativePath: string): Promise<void> {\n const schema = loadYamlSchemaFrom(baseDir, relativePath);\n await createView(schema);\n}\n\n/**\n * Sets up a fetch mock that resolves `/recipes/{path}.yml` URLs to actual files.\n * Use this when testing recipes that use `templateUrl` to load external templates.\n *\n * @param recipesBaseDir - The base directory where recipe files are located\n *\n * @example\n * ```typescript\n * // In your test file\n * import { setupRecipeFetch } from '@kaskad/core/testing';\n * import * as path from 'node:path';\n *\n * setupRecipeFetch(path.resolve(__dirname, '../..'));\n * ```\n */\nexport function setupRecipeFetch(recipesBaseDir: string): void {\n vi.stubGlobal(\n 'fetch',\n vi.fn(async (url: string) => {\n // Handle /recipes/{path}.yml URLs\n if (url.startsWith('/recipes/')) {\n const recipePath = url.replace('/recipes/', '');\n const filePath = join(recipesBaseDir, recipePath);\n\n try {\n const raw = await fs.readFile(filePath);\n return new Response(raw, {\n status: 200,\n headers: { 'Content-Type': 'text/yaml' },\n });\n } catch (err: unknown) {\n if (err && typeof err === 'object' && 'code' in err && err.code === 'ENOENT') {\n return new Response(`File not found: ${url}`, {\n status: 404,\n statusText: 'Not Found',\n });\n }\n throw err;\n }\n }\n\n return new Response('Not found', { status: 404 });\n }),\n );\n}\n\nexport function setCurrent(selector: string): void {\n const component = ComponentTreeApi.findComponent(currentComponentId, selector);\n if (!component) {\n throw new Error(`Component not found: ${selector}`);\n }\n currentComponentId = component.id;\n}\n\nexport function get<T = unknown>(selector: string): T {\n const node = ComponentTreeApi.findNode(currentComponentId, selector);\n return (node?.extractedValue ?? null) as T;\n}\n\nexport function set<T = unknown>(selector: string, value: T): void {\n ComponentTreeApi.setNodeRawSchema(currentComponentId, selector, value);\n const node = ComponentTreeApi.findNode(currentComponentId, selector);\n if (node) {\n activateStructure(node);\n }\n}\n\nexport async function run(selector: string, ...args: unknown[]): Promise<unknown> {\n const commandPromise = ComponentTreeApi.runCommandNode(currentComponentId, selector, ...args) as Promise<unknown>;\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n commandPromise.catch(() => {});\n await vi.runAllTimersAsync();\n return commandPromise;\n}\n\nexport function select(selector: string): TComponent {\n const component = ComponentTreeApi.findComponent(currentComponentId, selector);\n if (!component) {\n throw new Error(`Component not found: ${selector}`);\n }\n return component;\n}\n\nexport function selectAll(selector: string): TComponent[] {\n const components = selector.split(',').flatMap((s) => ComponentTreeApi.findComponents(currentComponentId, s.trim()));\n if (!components.length) {\n throw new Error(`Components not found: ${selector}`);\n }\n return components;\n}\n\nexport function evaluating(selector: string): boolean {\n const node = ComponentTreeApi.findNode(currentComponentId, selector);\n return node?.evaluating ?? false;\n}\n\nexport function running(selector: string): boolean {\n return ComponentTreeApi.isCommandRunning(currentComponentId, selector);\n}\n\nexport function getComponentType(selector: string): string {\n const component = ComponentTreeApi.findComponent(currentComponentId, selector);\n if (!component) {\n throw new Error(`Component not found: ${selector}`);\n }\n return component.componentType;\n}\n\nexport function getId(selector: string): ComponentId {\n const component = ComponentTreeApi.findComponent(currentComponentId, selector);\n if (!component) {\n throw new Error(`Component not found: ${selector}`);\n }\n return component.id;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["fs"],"mappings":";;;;;;AAAA;AAyBA,IAAI,kBAA+B;AAE5B,eAAe,UAAU,CAAC,SAA0B,EAAA;IACzD,EAAE,CAAC,aAAa,EAAE;AAElB,IAAA,MAAM,QAAQ,GAAG,eAAe,CAAC,WAAW,EAAE;;;AAI9C,IAAA,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;QACjD,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC;AAC5C,QAAA,WAAW,EAAE;;IAGf,MAAM,GAAG,GAAG,WAAW;AACvB,IAAA,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU;AACxC,IAAA,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU;IACtC,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,CAAC;AAElE,IAAA,MAAM,aAAa,CAAC,SAAS,CAAC;AAE9B,IAAA,MAAM,MAAM,GAAG,gBAAgB,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;AACjE,IAAA,MAAM,IAAI,GAAG,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC;IAEz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,OAAO,CAAC,QAAgB,EAAA;IACtC,OAAO,gBAAgB,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,QAAQ,CAAC;AACxE;AAEM,SAAU,gBAAgB,CAAC,QAAgB,EAAA;IAC/C,MAAM,SAAS,GAAG,gBAAgB,CAAC,aAAa,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IAC9E,IAAI,CAAC,SAAS,EAAE;AACd,QAAA,MAAM,IAAI,KAAK,CAAC,wBAAwB,QAAQ,CAAA,CAAE,CAAC;;IAErD,OAAO,SAAS,CAAC,aAAa;AAChC;AAEM,SAAU,KAAK,CAAC,QAAgB,EAAA;IACpC,MAAM,SAAS,GAAG,gBAAgB,CAAC,aAAa,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IAC9E,IAAI,CAAC,SAAS,EAAE;AACd,QAAA,MAAM,IAAI,KAAK,CAAC,wBAAwB,QAAQ,CAAA,CAAE,CAAC;;IAErD,OAAO,SAAS,CAAC,EAAE;AACrB;;AC/LA;;AAEG;;;;"}
@@ -46,13 +46,13 @@ class TemplateLoadingTracker {
46
46
  // Export a singleton instance for tracking template loading operations
47
47
  const templateLoadingTracker = new TemplateLoadingTracker();
48
48
 
49
- function execute$V(_ctx, ms) {
49
+ function execute$U(_ctx, ms) {
50
50
  return new Promise((resolve) => setTimeout(() => resolve(), ms));
51
51
  }
52
52
 
53
53
  var delay$1 = /*#__PURE__*/Object.freeze({
54
54
  __proto__: null,
55
- execute: execute$V
55
+ execute: execute$U
56
56
  });
57
57
 
58
58
  const commands$1 = {
@@ -86,7 +86,7 @@ const and = {
86
86
  signature: '(...unknown) => boolean',
87
87
  };
88
88
 
89
- function execute$U(source, path) {
89
+ function execute$T(source, path) {
90
90
  const takeDeep = (source, path) => path.reduce((current, step) => {
91
91
  return current?.[step];
92
92
  }, source);
@@ -94,93 +94,84 @@ function execute$U(source, path) {
94
94
  }
95
95
  const arrayPluck = {
96
96
  kind: 'imperative',
97
- execute: execute$U,
97
+ execute: execute$T,
98
98
  signature: '(unknown{}[], string[]) => unknown',
99
99
  };
100
100
 
101
- function execute$T(value, index) {
101
+ function execute$S(value, index) {
102
102
  return value[index];
103
103
  }
104
104
  const at = {
105
105
  kind: 'imperative',
106
- execute: execute$T,
106
+ execute: execute$S,
107
107
  signature: '(unknown[], number) => unknown',
108
108
  };
109
109
 
110
- function execute$S(value) {
110
+ function execute$R(value) {
111
111
  return Boolean(value);
112
112
  }
113
113
  const bool = {
114
114
  kind: 'imperative',
115
- execute: execute$S,
115
+ execute: execute$R,
116
116
  signature: '(unknown) => boolean',
117
117
  };
118
118
 
119
- function execute$R(value) {
119
+ function execute$Q(value) {
120
120
  return Math.ceil(value);
121
121
  }
122
122
  const ceil = {
123
123
  kind: 'imperative',
124
- execute: execute$R,
124
+ execute: execute$Q,
125
125
  signature: '(number) => number',
126
126
  };
127
127
 
128
- function execute$Q(strings, separator = '') {
128
+ function execute$P(strings, separator = '') {
129
129
  return strings.join(separator);
130
130
  }
131
131
  const concat = {
132
132
  kind: 'imperative',
133
- execute: execute$Q,
133
+ execute: execute$P,
134
134
  signature: '(unknown[], string) => string',
135
135
  };
136
136
 
137
- const execute$P = (value) => {
137
+ const execute$O = (value) => {
138
138
  return new Promise((resolve) => setTimeout(() => resolve(value), 500));
139
139
  };
140
140
  const delay = {
141
141
  kind: 'imperative',
142
- execute: execute$P,
142
+ execute: execute$O,
143
143
  signature: '(unknown) => unknown',
144
144
  };
145
145
 
146
- function execute$O(num1, num2) {
146
+ function execute$N(num1, num2) {
147
147
  return num1 / num2;
148
148
  }
149
149
  const divide = {
150
150
  kind: 'imperative',
151
- execute: execute$O,
151
+ execute: execute$N,
152
152
  signature: '(number, number) => number',
153
153
  };
154
154
 
155
- function execute$N(items) {
155
+ function execute$M(items) {
156
156
  return items.length === 0;
157
157
  }
158
158
  const empty = {
159
159
  kind: 'imperative',
160
- execute: execute$N,
160
+ execute: execute$M,
161
161
  signature: '(unknown[]) => boolean',
162
162
  };
163
163
 
164
- function execute$M(object) {
164
+ function execute$L(object) {
165
165
  return Object.keys(object).length === 0;
166
166
  }
167
167
  const emptyObject = {
168
168
  kind: 'imperative',
169
- execute: execute$M,
169
+ execute: execute$L,
170
170
  signature: '(unknown{}) => boolean',
171
171
  };
172
172
 
173
- const execute$L = (a, b) => a === b;
173
+ const execute$K = (a, b) => a === b;
174
174
  const eq = {
175
- kind: 'imperative',
176
- execute: execute$L,
177
- signature: '(unknown, unknown) => boolean',
178
- };
179
-
180
- function execute$K(value1, value2) {
181
- return value1 === value2;
182
- }
183
- const equal = {
184
175
  kind: 'imperative',
185
176
  execute: execute$K,
186
177
  signature: '(unknown, unknown) => boolean',
@@ -646,7 +637,6 @@ const formulaFunctions$2 = {
646
637
  findAllBy,
647
638
  at,
648
639
  not,
649
- equal,
650
640
  // Array element checkers (imperative)
651
641
  some,
652
642
  every,
@@ -1879,29 +1869,29 @@ var appendArrayItem = /*#__PURE__*/Object.freeze({
1879
1869
  execute: execute$f
1880
1870
  });
1881
1871
 
1882
- function execute$e(ctx, selector, path) {
1883
- return ComponentTreeApi.collectValuesArray(ctx.componentId, selector, path);
1872
+ function execute$e(ctx, selector) {
1873
+ return ComponentTreeApi.findNode(ctx.componentId, selector)?.extractedValue ?? null;
1884
1874
  }
1885
1875
 
1886
- var collectValuesArray$1 = /*#__PURE__*/Object.freeze({
1876
+ var get = /*#__PURE__*/Object.freeze({
1887
1877
  __proto__: null,
1888
1878
  execute: execute$e
1889
1879
  });
1890
1880
 
1891
- function execute$d(ctx, selector, objectKey, objectValue) {
1892
- return ComponentTreeApi.collectValuesMap(ctx.componentId, selector, objectKey, objectValue);
1881
+ function execute$d(ctx, selector, path) {
1882
+ return ComponentTreeApi.collectValuesArray(ctx.componentId, selector, path);
1893
1883
  }
1894
1884
 
1895
- var collectValuesMap$1 = /*#__PURE__*/Object.freeze({
1885
+ var propArray$1 = /*#__PURE__*/Object.freeze({
1896
1886
  __proto__: null,
1897
1887
  execute: execute$d
1898
1888
  });
1899
1889
 
1900
- function execute$c(ctx, selector) {
1901
- return ComponentTreeApi.findNode(ctx.componentId, selector)?.extractedValue ?? null;
1890
+ function execute$c(ctx, selector, objectKey, objectValue) {
1891
+ return ComponentTreeApi.collectValuesMap(ctx.componentId, selector, objectKey, objectValue);
1902
1892
  }
1903
1893
 
1904
- var get = /*#__PURE__*/Object.freeze({
1894
+ var propObject$1 = /*#__PURE__*/Object.freeze({
1905
1895
  __proto__: null,
1906
1896
  execute: execute$c
1907
1897
  });
@@ -1956,11 +1946,8 @@ var set = /*#__PURE__*/Object.freeze({
1956
1946
  });
1957
1947
 
1958
1948
  const commands = {
1959
- collectValuesMap: collectValuesMap$1,
1960
- collectValuesArray: collectValuesArray$1,
1961
- // Legacy aliases
1962
- propObject: collectValuesMap$1,
1963
- propArray: collectValuesArray$1,
1949
+ propObject: propObject$1,
1950
+ propArray: propArray$1,
1964
1951
  appendArrayItem,
1965
1952
  removeArrayItem,
1966
1953
  runComponentMethod,
@@ -1990,43 +1977,23 @@ const componentsDefinitions$2 = {
1990
1977
  },
1991
1978
  };
1992
1979
 
1993
- function execute$7(ctx, selector, path) {
1994
- return ComponentTreeApi.collectValuesArray(ctx.componentId, selector, path);
1995
- }
1996
- const collectValuesArray = {
1997
- kind: 'imperative',
1998
- contextual: true,
1999
- execute: execute$7,
2000
- signature: '(string, string) => unknown[]',
2001
- };
2002
-
2003
- function execute$6(ctx, selector, objectKey, objectValue) {
2004
- return ComponentTreeApi.collectValuesMap(ctx.componentId, selector, objectKey, objectValue);
2005
- }
2006
- const collectValuesMap = {
2007
- kind: 'imperative',
2008
- contextual: true,
2009
- execute: execute$6,
2010
- signature: '(string, string, string) => unknown{}',
2011
- };
2012
-
2013
- function execute$5(ctx, selector) {
1980
+ function execute$7(ctx, selector) {
2014
1981
  return ComponentTreeApi.getNode(ctx.componentId, selector).evaluating;
2015
1982
  }
2016
1983
  const evaluating = {
2017
1984
  kind: 'imperative',
2018
1985
  contextual: true,
2019
- execute: execute$5,
1986
+ execute: execute$7,
2020
1987
  signature: '(string) => boolean',
2021
1988
  };
2022
1989
 
2023
- function execute$4(ctx, selector) {
1990
+ function execute$6(ctx, selector) {
2024
1991
  return ComponentTreeApi.getNode(ctx.componentId, selector).failed;
2025
1992
  }
2026
1993
  const failed = {
2027
1994
  kind: 'imperative',
2028
1995
  contextual: true,
2029
- execute: execute$4,
1996
+ execute: execute$6,
2030
1997
  signature: '(string) => boolean',
2031
1998
  };
2032
1999
 
@@ -2091,16 +2058,36 @@ const getFn = {
2091
2058
  signature: '(string) => unknown',
2092
2059
  };
2093
2060
 
2094
- function execute$3(ctx, componentSelector) {
2061
+ function execute$5(ctx, componentSelector) {
2095
2062
  return ComponentTreeApi.findComponent(ctx.componentId, componentSelector)?.id ?? null;
2096
2063
  }
2097
2064
  const idFn = {
2098
2065
  kind: 'imperative',
2099
2066
  contextual: true,
2100
- execute: execute$3,
2067
+ execute: execute$5,
2101
2068
  signature: '(string) => string',
2102
2069
  };
2103
2070
 
2071
+ function execute$4(ctx, selector, path) {
2072
+ return ComponentTreeApi.collectValuesArray(ctx.componentId, selector, path);
2073
+ }
2074
+ const propArray = {
2075
+ kind: 'imperative',
2076
+ contextual: true,
2077
+ execute: execute$4,
2078
+ signature: '(string, string) => unknown[]',
2079
+ };
2080
+
2081
+ function execute$3(ctx, selector, objectKey, objectValue) {
2082
+ return ComponentTreeApi.collectValuesMap(ctx.componentId, selector, objectKey, objectValue);
2083
+ }
2084
+ const propObject = {
2085
+ kind: 'imperative',
2086
+ contextual: true,
2087
+ execute: execute$3,
2088
+ signature: '(string, string, string) => unknown{}',
2089
+ };
2090
+
2104
2091
  /**
2105
2092
  * Get a nested property value from an object using dot notation
2106
2093
  * e.g., getNestedProperty({ user: { id: 123 } }, "user.id") => 123
@@ -2216,10 +2203,8 @@ const running = {
2216
2203
  };
2217
2204
 
2218
2205
  const formulaFunctions$1 = {
2219
- collectValuesMap,
2220
- collectValuesArray,
2221
- propObject: collectValuesMap,
2222
- propArray: collectValuesArray,
2206
+ propObject,
2207
+ propArray,
2223
2208
  get: getFn,
2224
2209
  id: idFn,
2225
2210
  evaluating,