@nocobase/plugin-flow-engine 2.3.0-alpha.1 → 2.3.0-beta.10

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.
Files changed (67) hide show
  1. package/dist/ai/ai-employees/nathan/prompt.md +2 -0
  2. package/dist/ai/ai-employees/nathan/skills/frontend-developer/SKILLS.md +1 -0
  3. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/patchJSCode.js +2 -2
  4. package/dist/ai/docs/runjs/context/ai.md +194 -4
  5. package/dist/externalVersion.js +9 -9
  6. package/dist/locale/en-US.json +2 -0
  7. package/dist/locale/index.d.ts +4 -0
  8. package/dist/locale/zh-CN.json +2 -0
  9. package/dist/node_modules/@ant-design/icons-svg/package.json +1 -1
  10. package/dist/node_modules/acorn/package.json +1 -1
  11. package/dist/node_modules/acorn-jsx/package.json +1 -1
  12. package/dist/node_modules/acorn-walk/package.json +1 -1
  13. package/dist/node_modules/ses/package.json +1 -1
  14. package/dist/node_modules/zod/package.json +1 -1
  15. package/dist/server/flow-surfaces/builder.js +5 -0
  16. package/dist/server/flow-surfaces/catalog.js +27 -8
  17. package/dist/server/flow-surfaces/configure-options.js +17 -1
  18. package/dist/server/flow-surfaces/field-binding-registry.js +9 -8
  19. package/dist/server/flow-surfaces/runjs-authoring/ast/parser.d.ts +10 -3
  20. package/dist/server/flow-surfaces/runjs-authoring/ast/parser.js +90 -8
  21. package/dist/server/flow-surfaces/runjs-authoring/ast/source.d.ts +2 -2
  22. package/dist/server/flow-surfaces/runjs-authoring/ast/source.js +7 -69
  23. package/dist/server/flow-surfaces/runjs-authoring/ast/static-bindings.d.ts +5 -5
  24. package/dist/server/flow-surfaces/runjs-authoring/ast/static-bindings.js +56 -23
  25. package/dist/server/flow-surfaces/runjs-authoring/ast/static-values.d.ts +1 -1
  26. package/dist/server/flow-surfaces/runjs-authoring/ast/static-values.js +4 -2
  27. package/dist/server/flow-surfaces/service-utils.d.ts +1 -0
  28. package/dist/server/flow-surfaces/service-utils.js +17 -0
  29. package/dist/server/flow-surfaces/service.js +9 -0
  30. package/dist/server/index.d.ts +2 -0
  31. package/dist/server/index.js +7 -0
  32. package/dist/server/plugin.d.ts +13 -0
  33. package/dist/server/plugin.js +90 -3
  34. package/dist/server/repository.d.ts +12 -0
  35. package/dist/server/repository.js +39 -2
  36. package/dist/server/template/context-keys.d.ts +14 -0
  37. package/dist/server/template/context-keys.js +86 -0
  38. package/dist/server/template/contexts.d.ts +5 -8
  39. package/dist/server/template/contexts.js +43 -51
  40. package/dist/server/template/resolver.d.ts +5 -13
  41. package/dist/server/template/resolver.js +188 -257
  42. package/dist/server/template/variable-expression.d.ts +72 -0
  43. package/dist/server/template/variable-expression.js +597 -0
  44. package/dist/server/variables/allow-list.d.ts +49 -0
  45. package/dist/server/variables/allow-list.js +546 -0
  46. package/dist/server/variables/form-item-record-slot-resolvers.d.ts +10 -0
  47. package/dist/server/variables/form-item-record-slot-resolvers.js +297 -0
  48. package/dist/server/variables/record-bindings.d.ts +42 -0
  49. package/dist/server/variables/record-bindings.js +196 -0
  50. package/dist/server/variables/record-projection.d.ts +10 -0
  51. package/dist/server/variables/record-projection.js +140 -0
  52. package/dist/server/variables/record-slot-policy.d.ts +23 -0
  53. package/dist/server/variables/record-slot-policy.js +100 -0
  54. package/dist/server/variables/record-slot-resolvers.d.ts +46 -0
  55. package/dist/server/variables/record-slot-resolvers.js +115 -0
  56. package/dist/server/variables/records.d.ts +49 -2
  57. package/dist/server/variables/records.js +309 -18
  58. package/dist/server/variables/registry.d.ts +33 -10
  59. package/dist/server/variables/registry.js +197 -362
  60. package/dist/server/variables/resolve.d.ts +20 -2
  61. package/dist/server/variables/resolve.js +85 -13
  62. package/dist/server/variables/runjs-variable-dependencies.d.ts +23 -0
  63. package/dist/server/variables/runjs-variable-dependencies.js +542 -0
  64. package/dist/server/variables/selects.js +6 -3
  65. package/dist/server/variables/utils.d.ts +3 -6
  66. package/dist/server/variables/utils.js +50 -111
  67. package/package.json +2 -2
@@ -58,14 +58,7 @@ function isNumericFormulaDataType(dataType) {
58
58
  return ["integer", "bigInt", "double", "decimal", "number"].includes(String(dataType || "").trim());
59
59
  }
60
60
  function resolveTargetCollection(input) {
61
- var _a;
62
- if ((_a = input.field) == null ? void 0 : _a.targetCollection) {
63
- return input.field.targetCollection;
64
- }
65
- if (!input.getCollection || !input.dataSourceKey) {
66
- return null;
67
- }
68
- return (0, import_service_helpers.resolveFieldTargetCollection)(input.field, input.dataSourceKey, input.getCollection);
61
+ return (0, import_service_helpers.resolveFieldTargetCollection)(input.field, input.dataSourceKey || "main", input.getCollection || (() => null));
69
62
  }
70
63
  function normalizeBindingContainerUse(containerUse) {
71
64
  const normalized = String(containerUse || "").trim();
@@ -100,6 +93,14 @@ function selectPreferredDefaultRule(rules) {
100
93
  return rules.find((rule) => typeof rule.when === "function") || rules[0];
101
94
  }
102
95
  const FIELD_BINDING_RULE_DEFINITIONS = [
96
+ {
97
+ scope: "filter",
98
+ modelClassName: "CascadeSelectFieldModel",
99
+ interfaces: ["m2o", "o2o", "oho", "obo"],
100
+ isDefault: true,
101
+ order: 60,
102
+ when: ({ targetCollection }) => getCollectionTemplate(targetCollection) === "tree"
103
+ },
103
104
  {
104
105
  scope: "display",
105
106
  modelClassName: "DisplayPreviewFieldModel",
@@ -6,11 +6,18 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- export declare const ACORN_WALK_BASE: any;
10
- export declare function parseRunJsAuthoringAst(source: string): {
11
- ast?: any;
9
+ import * as acorn from 'acorn';
10
+ import type { SourceRange } from '../internal-types';
11
+ export declare const AcornParserWithJsx: typeof acorn.Parser;
12
+ export type RunJsParseResult = {
13
+ ast?: acorn.Node;
14
+ comments?: readonly SourceRange[];
12
15
  error?: {
13
16
  index: number;
14
17
  message: string;
15
18
  };
16
19
  };
20
+ export declare const ACORN_WALK_BASE: any;
21
+ export declare function parseRunJsAuthoringAst(source: string, options?: {
22
+ allowLegacyTemplates?: boolean;
23
+ }): RunJsParseResult;
@@ -37,6 +37,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
37
37
  var parser_exports = {};
38
38
  __export(parser_exports, {
39
39
  ACORN_WALK_BASE: () => ACORN_WALK_BASE,
40
+ AcornParserWithJsx: () => AcornParserWithJsx,
40
41
  parseRunJsAuthoringAst: () => parseRunJsAuthoringAst
41
42
  });
42
43
  module.exports = __toCommonJS(parser_exports);
@@ -44,6 +45,74 @@ var acorn = __toESM(require("acorn"));
44
45
  var import_acorn_jsx = __toESM(require("acorn-jsx"));
45
46
  var acornWalk = __toESM(require("acorn-walk"));
46
47
  const AcornParserWithJsx = acorn.Parser.extend((0, import_acorn_jsx.default)());
48
+ const AcornParserWithLegacyTemplates = AcornParserWithJsx.extend((Parser) => {
49
+ const Base = Parser;
50
+ const { jsxText } = Parser.acornJsx.tokTypes;
51
+ return class extends Base {
52
+ get allowNewDotTarget() {
53
+ return true;
54
+ }
55
+ readLegacyTemplate() {
56
+ var _a;
57
+ if (this.input.startsWith("{{", this.pos)) {
58
+ const start = this.pos;
59
+ if (/^\s*ctx(?:\.|\?\.|\[)/.test(this.input.slice(start + 2))) {
60
+ let end;
61
+ const comments = [];
62
+ try {
63
+ const expression = acorn.parseExpressionAt(this.input, start + 2, {
64
+ ecmaVersion: "latest",
65
+ onComment: comments
66
+ });
67
+ const expressionEnd = Math.max(expression.end, ((_a = comments.at(-1)) == null ? void 0 : _a.end) || 0);
68
+ const closing = /^\s*}}/.exec(this.input.slice(expressionEnd));
69
+ if (closing) end = expressionEnd + closing[0].length;
70
+ } catch {
71
+ }
72
+ if (end !== void 0) {
73
+ const onComment = this.options.onComment;
74
+ if (typeof onComment === "function") {
75
+ for (const comment of comments) {
76
+ onComment(comment.type === "Block", comment.value, comment.start, comment.end);
77
+ }
78
+ }
79
+ for (const newline of this.input.slice(start, end).matchAll(/\r\n?|\n|\u2028|\u2029/g)) {
80
+ this.curLine += 1;
81
+ this.lineStart = start + newline.index + newline[0].length;
82
+ }
83
+ this.pos = end;
84
+ return true;
85
+ }
86
+ }
87
+ }
88
+ return false;
89
+ }
90
+ readToken(code) {
91
+ if (code === 123 && !this.curContext().token.startsWith("<") && this.readLegacyTemplate()) {
92
+ return this.finishToken(acorn.tokTypes._null);
93
+ }
94
+ return super.readToken(code);
95
+ }
96
+ jsx_readToken() {
97
+ const start = this.pos;
98
+ if (!this.readLegacyTemplate()) {
99
+ while (this.pos < this.input.length && !/[<{]/.test(this.input[this.pos])) {
100
+ if (/[\r\n\u2028\u2029]/.test(this.input[this.pos])) this.jsx_readNewLine(true);
101
+ else this.pos += 1;
102
+ }
103
+ }
104
+ if (this.pos > start) return this.finishToken(jsxText, this.input.slice(start, this.pos));
105
+ return super.jsx_readToken();
106
+ }
107
+ parseExpression(...args) {
108
+ var _a;
109
+ if (this.type === acorn.tokTypes.ellipsis && ((_a = this.context.at(-2)) == null ? void 0 : _a.token) === "<tag>...</tag>") {
110
+ this.next();
111
+ }
112
+ return super.parseExpression(...args);
113
+ }
114
+ };
115
+ });
47
116
  const ACORN_WALK_BASE = {
48
117
  ...acornWalk.base,
49
118
  JSXElement(node, state, callback) {
@@ -102,18 +171,30 @@ const ACORN_WALK_BASE = {
102
171
  JSXClosingFragment() {
103
172
  }
104
173
  };
105
- function parseRunJsAuthoringAst(source) {
174
+ function parseRunJsAuthoringAst(source, options = {}) {
175
+ const comments = [];
176
+ const parserOptions = {
177
+ allowAwaitOutsideFunction: true,
178
+ allowReturnOutsideFunction: true,
179
+ ecmaVersion: "latest",
180
+ locations: true,
181
+ sourceType: "script",
182
+ onComment: (_block, _text, start, end) => comments.push({ start, end })
183
+ };
106
184
  try {
107
185
  return {
108
- ast: AcornParserWithJsx.parse(source, {
109
- allowAwaitOutsideFunction: true,
110
- allowReturnOutsideFunction: true,
111
- ecmaVersion: "latest",
112
- locations: true,
113
- sourceType: "script"
114
- })
186
+ ast: AcornParserWithJsx.parse(source, parserOptions),
187
+ comments
115
188
  };
116
189
  } catch (error) {
190
+ if (options.allowLegacyTemplates && source.includes("{{")) {
191
+ try {
192
+ comments.length = 0;
193
+ AcornParserWithLegacyTemplates.parse(source, parserOptions);
194
+ return { comments };
195
+ } catch {
196
+ }
197
+ }
117
198
  const acornError = error;
118
199
  return {
119
200
  error: {
@@ -126,5 +207,6 @@ function parseRunJsAuthoringAst(source) {
126
207
  // Annotate the CommonJS export names for ESM import in node:
127
208
  0 && (module.exports = {
128
209
  ACORN_WALK_BASE,
210
+ AcornParserWithJsx,
129
211
  parseRunJsAuthoringAst
130
212
  });
@@ -7,9 +7,9 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import type { CallArgumentSource, SourceRange } from '../internal-types';
10
+ import type { RunJsParseResult } from './parser';
10
11
  export declare function maskJavaScriptSource(source: string): string;
11
- export declare function maskJavaScriptComments(source: string): string;
12
- export declare function maskTemplateLiteralComments(source: string, chars: string[], start: number): number;
12
+ export declare function maskJavaScriptComments(source: string, parsed?: RunJsParseResult): string;
13
13
  export declare function maskTemplateLiteral(source: string, chars: string[], start: number): number;
14
14
  export declare function findTemplateExpressionEnd(source: string, start: number): number;
15
15
  export declare function skipRegexLiteral(source: string, start: number): number;
@@ -55,7 +55,6 @@ __export(source_exports, {
55
55
  maskJavaScriptComments: () => maskJavaScriptComments,
56
56
  maskJavaScriptSource: () => maskJavaScriptSource,
57
57
  maskTemplateLiteral: () => maskTemplateLiteral,
58
- maskTemplateLiteralComments: () => maskTemplateLiteralComments,
59
58
  mergeRanges: () => mergeRanges,
60
59
  readCompleteStringLiteral: () => readCompleteStringLiteral,
61
60
  readLeadingStringLiteral: () => readLeadingStringLiteral,
@@ -70,6 +69,7 @@ __export(source_exports, {
70
69
  });
71
70
  module.exports = __toCommonJS(source_exports);
72
71
  var import_constants = require("../runtime/constants");
72
+ var import_parser = require("./parser");
73
73
  var import_walk = require("./walk");
74
74
  function maskJavaScriptSource(source) {
75
75
  const chars = source.split("");
@@ -135,78 +135,17 @@ function maskJavaScriptSource(source) {
135
135
  }
136
136
  return chars.join("");
137
137
  }
138
- function maskJavaScriptComments(source) {
138
+ function maskJavaScriptComments(source, parsed = (0, import_parser.parseRunJsAuthoringAst)(source, { allowLegacyTemplates: true })) {
139
+ if (!parsed.comments) return "";
140
+ if (!parsed.comments.length) return source;
139
141
  const chars = source.split("");
140
- const maskRange = (start, end) => {
141
- for (let index2 = start; index2 < end; index2 += 1) {
142
- if (chars[index2] !== "\n" && chars[index2] !== "\r") {
143
- chars[index2] = " ";
144
- }
145
- }
146
- };
147
- let index = 0;
148
- while (index < source.length) {
149
- const char = source[index];
150
- const next = source[index + 1];
151
- if (char === "/" && next === "/") {
152
- const start = index;
153
- index += 2;
154
- while (index < source.length && source[index] !== "\n") {
155
- index += 1;
156
- }
157
- maskRange(start, index);
158
- continue;
159
- }
160
- if (char === "/" && next === "*") {
161
- const start = index;
162
- index += 2;
163
- while (index < source.length && !(source[index] === "*" && source[index + 1] === "/")) {
164
- index += 1;
165
- }
166
- index = Math.min(source.length, index + 2);
167
- maskRange(start, index);
168
- continue;
169
- }
170
- if (char === "`") {
171
- index = maskTemplateLiteralComments(source, chars, index);
172
- continue;
142
+ for (const { start, end } of parsed.comments) {
143
+ for (let index = start; index < end; index += 1) {
144
+ if (!/[\r\n\u2028\u2029]/.test(chars[index])) chars[index] = " ";
173
145
  }
174
- if (char === "/" && isRegexLiteralStart(chars, index)) {
175
- index = skipRegexLiteral(source, index);
176
- continue;
177
- }
178
- if (char === '"' || char === "'") {
179
- index = skipQuotedLiteral(source, index, char);
180
- continue;
181
- }
182
- index += 1;
183
146
  }
184
147
  return chars.join("");
185
148
  }
186
- function maskTemplateLiteralComments(source, chars, start) {
187
- let index = start + 1;
188
- while (index < source.length) {
189
- if (source[index] === "\\") {
190
- index += 2;
191
- continue;
192
- }
193
- if (source[index] === "`") {
194
- return index + 1;
195
- }
196
- if (source[index] === "$" && source[index + 1] === "{") {
197
- const expressionStart = index + 2;
198
- const expressionEnd = findTemplateExpressionEnd(source, expressionStart);
199
- const expressionMasked = maskJavaScriptComments(source.slice(expressionStart, expressionEnd));
200
- for (let offset = 0; offset < expressionMasked.length; offset += 1) {
201
- chars[expressionStart + offset] = expressionMasked[offset];
202
- }
203
- index = Math.min(source.length, expressionEnd + 1);
204
- continue;
205
- }
206
- index += 1;
207
- }
208
- return source.length;
209
- }
210
149
  function maskTemplateLiteral(source, chars, start) {
211
150
  const maskRange = (from, to) => {
212
151
  for (let index2 = from; index2 < to; index2 += 1) {
@@ -900,7 +839,6 @@ function getAstSource(node, source) {
900
839
  maskJavaScriptComments,
901
840
  maskJavaScriptSource,
902
841
  maskTemplateLiteral,
903
- maskTemplateLiteralComments,
904
842
  mergeRanges,
905
843
  readCompleteStringLiteral,
906
844
  readLeadingStringLiteral,
@@ -9,15 +9,15 @@
9
9
  import type { AstFunctionBinding, AstIdentifierBinding, AstIdentifierWrite, AstStaticObjectAliasCopy, StaticFilterValueBinding, StaticStringBinding } from '../internal-types';
10
10
  export declare function collectAstIdentifierBindingsFromAst(ast: any, source: string): AstIdentifierBinding[];
11
11
  export declare function collectAstFunctionBindingsFromAst(ast: any, source: string): AstFunctionBinding[];
12
- export declare function collectStaticStringBindingsFromAst(ast: any, source: string, seedStringBindings?: StaticStringBinding[], identifierBindings?: AstIdentifierBinding[]): StaticStringBinding[];
12
+ export declare function collectStaticStringBindingsFromAst(ast: any, source: string, seedStringBindings?: StaticStringBinding[], identifierBindings?: AstIdentifierBinding[], consumeWork?: (work: number) => void, bindingNames?: ReadonlySet<string>): StaticStringBinding[];
13
13
  export declare function isStaticStringBindingActiveAtIndex(binding: StaticStringBinding, index: number, writes: AstIdentifierWrite[], identifierBindings: AstIdentifierBinding[]): boolean;
14
14
  export declare function trimStaticStringBindingsAfterWrites(bindings: StaticStringBinding[], writes: AstIdentifierWrite[], identifierBindings: AstIdentifierBinding[]): StaticStringBinding[];
15
- export declare function collectStaticFilterValueBindingsFromAst(ast: any, source: string, identifierBindings: AstIdentifierBinding[]): StaticFilterValueBinding[];
15
+ export declare function collectStaticFilterValueBindingsFromAst(ast: any, source: string, identifierBindings: AstIdentifierBinding[], consumeWork?: (work: number) => void, bindingNames?: ReadonlySet<string>): StaticFilterValueBinding[];
16
16
  export declare function trimStaticFilterValueBindingsAfterWrites(bindings: StaticFilterValueBinding[], writes: AstIdentifierWrite[], identifierBindings: AstIdentifierBinding[]): StaticFilterValueBinding[];
17
- export declare function collectAstStaticBindingWritesFromAst(ast: any, source: string, identifierBindings: AstIdentifierBinding[]): AstIdentifierWrite[];
18
- export declare function collectAstStaticObjectAliasCopiesFromAst(ast: any, source: string, identifierBindings: AstIdentifierBinding[]): AstStaticObjectAliasCopy[];
17
+ export declare function collectAstStaticBindingWritesFromAst(ast: any, source: string, identifierBindings: AstIdentifierBinding[], consumeWork?: (work: number) => void, bindingNames?: ReadonlySet<string>): AstIdentifierWrite[];
18
+ export declare function collectAstStaticObjectAliasCopiesFromAst(ast: any, source: string, identifierBindings: AstIdentifierBinding[], consumeWork?: (work: number) => void, bindingNames?: ReadonlySet<string>): AstStaticObjectAliasCopy[];
19
19
  export declare function resolveAstStaticAliasCopySourceName(node: any, aliases: AstStaticObjectAliasCopy[], identifierBindings: AstIdentifierBinding[]): string | undefined;
20
- export declare function collectAstStaticAliasCopyWrites(writes: AstIdentifierWrite[], aliases: AstStaticObjectAliasCopy[], identifierBindings: AstIdentifierBinding[]): AstIdentifierWrite[];
20
+ export declare function collectAstStaticAliasCopyWrites(writes: AstIdentifierWrite[], aliases: AstStaticObjectAliasCopy[], identifierBindings: AstIdentifierBinding[], consumeWork?: (work: number) => void): AstIdentifierWrite[];
21
21
  export declare function getAstIdentifierWriteKey(write: AstIdentifierWrite): string;
22
22
  export declare function isAstStaticObjectAliasCopyActiveAtIndex(alias: AstStaticObjectAliasCopy, index: number, identifierBindings: AstIdentifierBinding[]): boolean;
23
23
  export declare function isAstStaticObjectAliasCopySourceActiveAtIndex(alias: AstStaticObjectAliasCopy, index: number, identifierBindings: AstIdentifierBinding[]): boolean;
@@ -258,12 +258,19 @@ function collectAstFunctionBindingsFromAst(ast, source) {
258
258
  });
259
259
  return bindings;
260
260
  }
261
- function collectStaticStringBindingsFromAst(ast, source, seedStringBindings = [], identifierBindings = []) {
261
+ function collectStaticStringBindingsFromAst(ast, source, seedStringBindings = [], identifierBindings = [], consumeWork, bindingNames) {
262
262
  const bindings = [];
263
263
  const availableBindings = [...seedStringBindings];
264
- const writes = collectAstStaticBindingWritesFromAst(ast, source, identifierBindings);
265
- const aliasCopies = collectAstStaticObjectAliasCopiesFromAst(ast, source, identifierBindings);
264
+ const writes = collectAstStaticBindingWritesFromAst(ast, source, identifierBindings, consumeWork, bindingNames);
265
+ const aliasCopies = collectAstStaticObjectAliasCopiesFromAst(
266
+ ast,
267
+ source,
268
+ identifierBindings,
269
+ consumeWork,
270
+ bindingNames
271
+ );
266
272
  const addBinding = (name, value, node, scope, declarationStart, executionScope) => {
273
+ consumeWork == null ? void 0 : consumeWork(1);
267
274
  const binding = {
268
275
  declarationStart,
269
276
  executionScope,
@@ -276,6 +283,7 @@ function collectStaticStringBindingsFromAst(ast, source, seedStringBindings = []
276
283
  availableBindings.push(binding);
277
284
  };
278
285
  const copyMemberBindings = (sourceName, targetName, node, scope, declarationStart, executionScope) => {
286
+ consumeWork == null ? void 0 : consumeWork(availableBindings.length * (writes.length + 1) * (identifierBindings.length + 1));
279
287
  const exactBinding = availableBindings.find(
280
288
  (binding) => binding.name === sourceName && isStaticStringBindingActiveAtIndex(binding, declarationStart, writes, identifierBindings)
281
289
  );
@@ -287,6 +295,7 @@ function collectStaticStringBindingsFromAst(ast, source, seedStringBindings = []
287
295
  (binding) => binding.name.startsWith(prefix) && isStaticStringBindingActiveAtIndex(binding, declarationStart, writes, identifierBindings)
288
296
  );
289
297
  for (const sourceBinding of sourceBindings) {
298
+ consumeWork == null ? void 0 : consumeWork(availableBindings.length + 1);
290
299
  const name = `${targetName}${sourceBinding.name.slice(sourceName.length)}`;
291
300
  if (availableBindings.some((binding) => binding.name === name && binding.start >= declarationStart)) {
292
301
  continue;
@@ -301,6 +310,7 @@ function collectStaticStringBindingsFromAst(ast, source, seedStringBindings = []
301
310
  }
302
311
  const seenMembers = /* @__PURE__ */ new Set();
303
312
  for (let index = (unwrapped.properties || []).length - 1; index >= 0; index -= 1) {
313
+ consumeWork == null ? void 0 : consumeWork((availableBindings.length + 1) * (identifierBindings.length + 1));
304
314
  const property = unwrapped.properties[index];
305
315
  if (!property) {
306
316
  continue;
@@ -330,7 +340,9 @@ function collectStaticStringBindingsFromAst(ast, source, seedStringBindings = []
330
340
  };
331
341
  (0, import_walk.walkAstAncestor)(ast, {
332
342
  VariableDeclarator(node, ancestors) {
333
- var _a, _b;
343
+ var _a, _b, _c;
344
+ if (bindingNames && ((_a = node.id) == null ? void 0 : _a.type) === "Identifier" && !bindingNames.has(node.id.name)) return;
345
+ consumeWork == null ? void 0 : consumeWork((availableBindings.length + aliasCopies.length + 1) * (identifierBindings.length + 1));
334
346
  const declaration = (0, import_bindings.findAstAncestor)(ancestors, "VariableDeclaration");
335
347
  if ((declaration == null ? void 0 : declaration.kind) !== "const") {
336
348
  return;
@@ -338,12 +350,13 @@ function collectStaticStringBindingsFromAst(ast, source, seedStringBindings = []
338
350
  const scope = (0, import_bindings.getAstBindingScopeRange)(ancestors, source.length, (declaration == null ? void 0 : declaration.kind) === "var");
339
351
  const executionScope = (0, import_bindings.getAstExecutionScopeRange)(ancestors, source.length);
340
352
  const declarationStart = typeof node.start === "number" ? node.start : scope.start;
341
- if (((_a = node.id) == null ? void 0 : _a.type) === "ObjectPattern") {
353
+ if (((_b = node.id) == null ? void 0 : _b.type) === "ObjectPattern") {
342
354
  const sourceName2 = resolveAstStaticAliasCopySourceName(node.init, aliasCopies, identifierBindings);
343
355
  if (!sourceName2) {
344
356
  return;
345
357
  }
346
358
  (0, import_static_values.collectAstObjectPatternPathAliases)(node.id, (name, members, aliasNode) => {
359
+ if (bindingNames && !bindingNames.has(name)) return;
347
360
  const aliasDeclarationStart = typeof (aliasNode == null ? void 0 : aliasNode.start) === "number" ? aliasNode.start : declarationStart;
348
361
  copyMemberBindings(
349
362
  `${sourceName2}.${members.join(".")}`,
@@ -356,7 +369,7 @@ function collectStaticStringBindingsFromAst(ast, source, seedStringBindings = []
356
369
  });
357
370
  return;
358
371
  }
359
- if (((_b = node.id) == null ? void 0 : _b.type) !== "Identifier") {
372
+ if (((_c = node.id) == null ? void 0 : _c.type) !== "Identifier") {
360
373
  return;
361
374
  }
362
375
  const resolved = (0, import_static_values.resolveRunJsStaticString)(node.init, source, availableBindings, identifierBindings);
@@ -370,6 +383,7 @@ function collectStaticStringBindingsFromAst(ast, source, seedStringBindings = []
370
383
  }
371
384
  }
372
385
  });
386
+ consumeWork == null ? void 0 : consumeWork(bindings.length * (writes.length + 1) * (identifierBindings.length + 1));
373
387
  return trimStaticStringBindingsAfterWrites(bindings, writes, identifierBindings);
374
388
  }
375
389
  function isStaticStringBindingActiveAtIndex(binding, index, writes, identifierBindings) {
@@ -400,13 +414,16 @@ function trimStaticStringBindingsAfterWrites(bindings, writes, identifierBinding
400
414
  return nextWrite ? { ...binding, end: nextWrite.index } : binding;
401
415
  });
402
416
  }
403
- function collectStaticFilterValueBindingsFromAst(ast, source, identifierBindings) {
417
+ function collectStaticFilterValueBindingsFromAst(ast, source, identifierBindings, consumeWork, bindingNames) {
404
418
  const bindings = [];
405
419
  const availableBindings = [];
406
- const writes = collectAstStaticBindingWritesFromAst(ast, source, identifierBindings);
407
- const getActiveBindings = (index) => trimStaticFilterValueBindingsAfterWrites(availableBindings, writes, identifierBindings).filter(
408
- (binding) => index >= binding.start && index < binding.end
409
- );
420
+ const writes = collectAstStaticBindingWritesFromAst(ast, source, identifierBindings, consumeWork, bindingNames);
421
+ const getActiveBindings = (index) => {
422
+ consumeWork == null ? void 0 : consumeWork(availableBindings.length * (writes.length + 1) * (identifierBindings.length + 1));
423
+ return trimStaticFilterValueBindingsAfterWrites(availableBindings, writes, identifierBindings).filter(
424
+ (binding) => index >= binding.start && index < binding.end
425
+ );
426
+ };
410
427
  const addBinding = (name, valueNode, node, scope, declarationStart, executionScope) => {
411
428
  const binding = {
412
429
  declarationStart,
@@ -421,7 +438,9 @@ function collectStaticFilterValueBindingsFromAst(ast, source, identifierBindings
421
438
  };
422
439
  (0, import_walk.walkAstAncestor)(ast, {
423
440
  VariableDeclarator(node, ancestors) {
424
- var _a, _b;
441
+ var _a, _b, _c;
442
+ if (bindingNames && ((_a = node.id) == null ? void 0 : _a.type) === "Identifier" && !bindingNames.has(node.id.name)) return;
443
+ consumeWork == null ? void 0 : consumeWork(1);
425
444
  if (!node.init) {
426
445
  return;
427
446
  }
@@ -432,7 +451,7 @@ function collectStaticFilterValueBindingsFromAst(ast, source, identifierBindings
432
451
  const scope = (0, import_bindings.getAstBindingScopeRange)(ancestors, source.length);
433
452
  const executionScope = (0, import_bindings.getAstExecutionScopeRange)(ancestors, source.length);
434
453
  const declarationStart = typeof node.start === "number" ? node.start : scope.start;
435
- if (((_a = node.id) == null ? void 0 : _a.type) === "ObjectPattern") {
454
+ if (((_b = node.id) == null ? void 0 : _b.type) === "ObjectPattern") {
436
455
  const sourceObject = (0, import_static_values.resolveRunJsStaticObjectExpression)(
437
456
  node.init,
438
457
  identifierBindings,
@@ -442,6 +461,7 @@ function collectStaticFilterValueBindingsFromAst(ast, source, identifierBindings
442
461
  return;
443
462
  }
444
463
  (0, import_static_values.collectAstObjectPatternPathAliases)(node.id, (name, members, aliasNode) => {
464
+ if (bindingNames && !bindingNames.has(name)) return;
445
465
  const property = (0, import_static_values.getRunJsObjectPropertyByPath)(
446
466
  sourceObject,
447
467
  members,
@@ -461,12 +481,13 @@ function collectStaticFilterValueBindingsFromAst(ast, source, identifierBindings
461
481
  });
462
482
  return;
463
483
  }
464
- if (((_b = node.id) == null ? void 0 : _b.type) !== "Identifier") {
484
+ if (((_c = node.id) == null ? void 0 : _c.type) !== "Identifier") {
465
485
  return;
466
486
  }
467
487
  addBinding(node.id.name, node.init, node, scope, declarationStart, executionScope);
468
488
  }
469
489
  });
490
+ consumeWork == null ? void 0 : consumeWork(bindings.length * (writes.length + 1) * (identifierBindings.length + 1));
470
491
  return trimStaticFilterValueBindingsAfterWrites(bindings, writes, identifierBindings);
471
492
  }
472
493
  function trimStaticFilterValueBindingsAfterWrites(bindings, writes, identifierBindings) {
@@ -477,17 +498,27 @@ function trimStaticFilterValueBindingsAfterWrites(bindings, writes, identifierBi
477
498
  return nextWrite ? { ...binding, end: nextWrite.index } : binding;
478
499
  });
479
500
  }
480
- function collectAstStaticBindingWritesFromAst(ast, source, identifierBindings) {
481
- const writes = (0, import_execution.collectAstIdentifierWritesFromAst)(ast, source);
482
- const aliasCopies = collectAstStaticObjectAliasCopiesFromAst(ast, source, identifierBindings);
483
- return [...writes, ...collectAstStaticAliasCopyWrites(writes, aliasCopies, identifierBindings)];
501
+ function collectAstStaticBindingWritesFromAst(ast, source, identifierBindings, consumeWork, bindingNames) {
502
+ const writes = (0, import_execution.collectAstIdentifierWritesFromAst)(ast, source).filter(
503
+ (write) => !bindingNames || bindingNames.has((0, import_static_values.getAstAliasRootName)(write.name))
504
+ );
505
+ const aliasCopies = collectAstStaticObjectAliasCopiesFromAst(
506
+ ast,
507
+ source,
508
+ identifierBindings,
509
+ consumeWork,
510
+ bindingNames
511
+ );
512
+ return [...writes, ...collectAstStaticAliasCopyWrites(writes, aliasCopies, identifierBindings, consumeWork)];
484
513
  }
485
- function collectAstStaticObjectAliasCopiesFromAst(ast, source, identifierBindings) {
514
+ function collectAstStaticObjectAliasCopiesFromAst(ast, source, identifierBindings, consumeWork, bindingNames) {
486
515
  const aliases = [];
487
516
  const resolveSourceName = (node) => resolveAstStaticAliasCopySourceName(node, aliases, identifierBindings);
488
517
  (0, import_walk.walkAstAncestor)(ast, {
489
518
  VariableDeclarator(node, ancestors) {
490
- var _a, _b;
519
+ var _a, _b, _c;
520
+ if (bindingNames && ((_a = node.id) == null ? void 0 : _a.type) === "Identifier" && !bindingNames.has(node.id.name)) return;
521
+ consumeWork == null ? void 0 : consumeWork((aliases.length + 1) * (identifierBindings.length + 1));
491
522
  if (!node.init) {
492
523
  return;
493
524
  }
@@ -498,6 +529,7 @@ function collectAstStaticObjectAliasCopiesFromAst(ast, source, identifierBinding
498
529
  const scope = (0, import_bindings.getAstBindingScopeRange)(ancestors, source.length);
499
530
  const executionScope = (0, import_bindings.getAstExecutionScopeRange)(ancestors, source.length);
500
531
  const addAlias = (name, sourceName2, aliasNode) => {
532
+ if (bindingNames && !bindingNames.has(name)) return;
501
533
  if (!sourceName2 || sourceName2 === name || sourceName2.startsWith(`${name}.`)) {
502
534
  return;
503
535
  }
@@ -510,11 +542,11 @@ function collectAstStaticObjectAliasCopiesFromAst(ast, source, identifierBinding
510
542
  end: scope.end
511
543
  });
512
544
  };
513
- if (((_a = node.id) == null ? void 0 : _a.type) === "Identifier") {
545
+ if (((_b = node.id) == null ? void 0 : _b.type) === "Identifier") {
514
546
  addAlias(node.id.name, resolveSourceName(node.init), node);
515
547
  return;
516
548
  }
517
- if (((_b = node.id) == null ? void 0 : _b.type) !== "ObjectPattern") {
549
+ if (((_c = node.id) == null ? void 0 : _c.type) !== "ObjectPattern") {
518
550
  return;
519
551
  }
520
552
  const sourceName = resolveSourceName(node.init);
@@ -551,7 +583,7 @@ function resolveAstStaticAliasCopySourceName(node, aliases, identifierBindings)
551
583
  const suffix = lookup.aliasName.slice(lookup.rootName.length);
552
584
  return `${rootAlias.sourceName}${suffix}`;
553
585
  }
554
- function collectAstStaticAliasCopyWrites(writes, aliases, identifierBindings) {
586
+ function collectAstStaticAliasCopyWrites(writes, aliases, identifierBindings, consumeWork) {
555
587
  const mirroredWrites = [];
556
588
  const seen = new Set(writes.map((write) => getAstIdentifierWriteKey(write)));
557
589
  const queue = [...writes];
@@ -571,6 +603,7 @@ function collectAstStaticAliasCopyWrites(writes, aliases, identifierBindings) {
571
603
  for (let index = 0; index < queue.length; index += 1) {
572
604
  const write = queue[index];
573
605
  for (const alias of aliases) {
606
+ consumeWork == null ? void 0 : consumeWork(2 * (identifierBindings.length + 1));
574
607
  if (!isAstStaticObjectAliasCopyActiveAtIndex(alias, write.index, identifierBindings)) {
575
608
  continue;
576
609
  }
@@ -41,7 +41,7 @@ export declare function resolveAstResourceTypeExpression(node: any, source: stri
41
41
  expression: string;
42
42
  };
43
43
  export declare function resolveAstStaticStringValue(node: any, source: string): string | undefined;
44
- export declare function resolveAstStaticTemplateLiteralValue(node: any, source: string, stringBindings: StaticStringBinding[], identifierBindings: AstIdentifierBinding[]): string | undefined;
44
+ export declare function resolveAstStaticTemplateLiteralValue(node: unknown, source: string, stringBindings: StaticStringBinding[], identifierBindings: AstIdentifierBinding[]): string | undefined;
45
45
  export declare function resolveAstAliasBinding<T extends SourceRange & {
46
46
  name: string;
47
47
  }>(name: string, index: number, aliases: T[], identifierBindings: AstIdentifierBinding[]): T | undefined;
@@ -321,12 +321,14 @@ function resolveAstStaticTemplateLiteralValue(node, source, stringBindings, iden
321
321
  let value = "";
322
322
  for (let index = 0; index < quasis.length; index += 1) {
323
323
  const quasi = quasis[index];
324
- value += ((_a = quasi == null ? void 0 : quasi.value) == null ? void 0 : _a.cooked) ?? ((_b = quasi == null ? void 0 : quasi.value) == null ? void 0 : _b.raw) ?? "";
324
+ const text = ((_a = quasi == null ? void 0 : quasi.value) == null ? void 0 : _a.cooked) ?? ((_b = quasi == null ? void 0 : quasi.value) == null ? void 0 : _b.raw) ?? "";
325
+ if (value.length + text.length > import_constants.MAX_RUNJS_SOURCE_LENGTH) return void 0;
326
+ value += text;
325
327
  if (index >= expressions.length) {
326
328
  continue;
327
329
  }
328
330
  const expression = resolveAstResourceTypeExpression(expressions[index], source, stringBindings, identifierBindings);
329
- if (expression.status !== "resolved") {
331
+ if (expression.status !== "resolved" || value.length + expression.value.length > import_constants.MAX_RUNJS_SOURCE_LENGTH) {
330
332
  return void 0;
331
333
  }
332
334
  value += expression.value;
@@ -98,6 +98,7 @@ export declare function joinRequiredFieldPaths(paths: string[]): string;
98
98
  export declare function normalizeSimpleLayoutValue(layout: any): any;
99
99
  export declare function normalizeGridCardColumns(columns: any): _.Dictionary<any>;
100
100
  export declare function normalizeSimpleConfirm(confirm: any): _.Dictionary<any>;
101
+ export declare function normalizeAfterSuccess(afterSuccess: unknown): _.Dictionary<any>;
101
102
  export declare function assertSupportedSimpleChanges(context: string, changes: Record<string, any>, allowedKeys: string[]): void;
102
103
  export declare function hasLegacyLocatorFields(input: any, options?: {
103
104
  allowRootUid?: boolean;
@@ -59,6 +59,7 @@ __export(service_utils_exports, {
59
59
  isFieldNodeUse: () => isFieldNodeUse,
60
60
  isMissingRequiredResourceInitValue: () => isMissingRequiredResourceInitValue,
61
61
  joinRequiredFieldPaths: () => joinRequiredFieldPaths,
62
+ normalizeAfterSuccess: () => normalizeAfterSuccess,
62
63
  normalizeBlockTitleDescription: () => normalizeBlockTitleDescription,
63
64
  normalizeBlockTitleDescriptionValue: () => normalizeBlockTitleDescriptionValue,
64
65
  normalizeChartCardHeightModeForWrite: () => normalizeChartCardHeightModeForWrite,
@@ -598,6 +599,21 @@ function normalizeSimpleConfirm(confirm) {
598
599
  }
599
600
  (0, import_errors.throwBadRequest)("flowSurfaces configure confirm must be a boolean or object");
600
601
  }
602
+ function normalizeAfterSuccess(afterSuccess) {
603
+ if (!import_lodash.default.isPlainObject(afterSuccess)) {
604
+ (0, import_errors.throwBadRequest)("flowSurfaces configure afterSuccess must be an object");
605
+ }
606
+ const input = afterSuccess;
607
+ if (input.actionAfterSuccess !== void 0 && !["stay", "previous", "redirect"].includes(String(input.actionAfterSuccess))) {
608
+ (0, import_errors.throwBadRequest)("flowSurfaces configure afterSuccess.actionAfterSuccess must be stay, previous, or redirect");
609
+ }
610
+ return buildDefinedPayload({
611
+ successMessage: input.successMessage,
612
+ manualClose: input.manualClose,
613
+ actionAfterSuccess: input.actionAfterSuccess,
614
+ redirectTo: input.redirectTo
615
+ });
616
+ }
601
617
  function assertSupportedSimpleChanges(context, changes, allowedKeys) {
602
618
  const unknownKeys = Object.keys(changes).filter((key) => !allowedKeys.includes(key));
603
619
  if (!unknownKeys.length) {
@@ -881,6 +897,7 @@ function getFieldBindingDefaultProps(containerUse, fieldUse, field) {
881
897
  isFieldNodeUse,
882
898
  isMissingRequiredResourceInitValue,
883
899
  joinRequiredFieldPaths,
900
+ normalizeAfterSuccess,
884
901
  normalizeBlockTitleDescription,
885
902
  normalizeBlockTitleDescriptionValue,
886
903
  normalizeChartCardHeightModeForWrite,
@@ -19739,6 +19739,15 @@ ${AI_EMPLOYEE_CURRENT_RECORD_PROMPT_VARIABLE}` : AI_EMPLOYEE_CURRENT_RECORD_PROM
19739
19739
  (0, import_errors.throwBadRequest)(`flowSurfaces configure action '${use}' does not support confirm`);
19740
19740
  }
19741
19741
  }
19742
+ if ((0, import_service_utils.hasOwnDefined)(changes, "afterSuccess")) {
19743
+ if (!UPDATE_ASSIGN_ACTION_USES.has(use)) {
19744
+ (0, import_errors.throwBadRequest)(`flowSurfaces configure action '${use}' does not support afterSuccess`);
19745
+ }
19746
+ stepParams.assignSettings = {
19747
+ ...stepParams.assignSettings || {},
19748
+ afterSuccess: (0, import_service_utils.normalizeAfterSuccess)(changes.afterSuccess)
19749
+ };
19750
+ }
19742
19751
  if ((0, import_service_utils.hasOwnDefined)(changes, "assignValues")) {
19743
19752
  const assignValues = this.normalizeActionAssignValues("configure", changes.assignValues);
19744
19753
  if (APPROVAL_ASSIGN_ACTION_USES.has(use)) {
@@ -9,3 +9,5 @@
9
9
  export { default } from './plugin';
10
10
  export { FlowModelRepository } from './repository';
11
11
  export { resolveVariablesBatch, resolveVariablesTemplate } from './variables/resolve';
12
+ export { createNestedRecordSlotResolver, getRecordSlotResolverRegistry, RecordSlotResolverRegistry, } from './variables/record-slot-resolvers';
13
+ export type { RecordSlotResolved, RecordSlotResolverInput, RecordSlotResolverRegistration, RecordSlotResolverResult, } from './variables/record-slot-resolvers';