@nocobase/plugin-flow-engine 2.4.0-alpha.4 → 2.4.0-alpha.6

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.
@@ -8,16 +8,16 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.4.0-alpha.4",
11
+ "@nocobase/client": "2.4.0-alpha.6",
12
12
  "lodash": "4.18.1",
13
- "@nocobase/database": "2.4.0-alpha.4",
14
- "@nocobase/data-source-manager": "2.4.0-alpha.4",
15
- "@nocobase/resourcer": "2.4.0-alpha.4",
16
- "@nocobase/server": "2.4.0-alpha.4",
17
- "@nocobase/utils": "2.4.0-alpha.4",
18
- "@nocobase/cache": "2.4.0-alpha.4",
19
- "@nocobase/actions": "2.4.0-alpha.4",
13
+ "@nocobase/database": "2.4.0-alpha.6",
14
+ "@nocobase/data-source-manager": "2.4.0-alpha.6",
15
+ "@nocobase/resourcer": "2.4.0-alpha.6",
16
+ "@nocobase/server": "2.4.0-alpha.6",
17
+ "@nocobase/utils": "2.4.0-alpha.6",
18
+ "@nocobase/cache": "2.4.0-alpha.6",
19
+ "@nocobase/actions": "2.4.0-alpha.6",
20
20
  "sequelize": "6.35.2",
21
21
  "@formily/json-schema": "2.3.7",
22
- "@nocobase/ai": "2.4.0-alpha.4"
22
+ "@nocobase/ai": "2.4.0-alpha.6"
23
23
  };
@@ -1 +1 @@
1
- {"name":"@ant-design/icons-svg","version":"4.3.1","sideEffects":false,"description":"Abstract nodes for ant design icons.","contributors":["HeskeyBaozi <hezhiyu233@foxmail.com>"],"homepage":"https://github.com/ant-design/ant-design-icons/","license":"MIT","main":"lib/index.js","module":"es/index.js","files":["lib","es","inline-svg","inline-namespaced-svg"],"repository":{"type":"git","url":"git+https://github.com/ant-design/ant-design-icons.git"},"scripts":{"g":"npm run generate","generate":"cross-env NODE_ENV=production gulp --require ts-node/register/transpile-only","type-check":"tsc --noEmit","build:es":"tsc --project tsconfig.build.json --module esnext --outDir es","build:lib":"tsc --project tsconfig.build.json --module commonjs --outDir lib","build":"cross-env NODE_ENV=production && npm run build:es && npm run build:lib","test":"cross-env NODE_ENV=test && npm run test:unit","test:unit":"jest","prepublishOnly":"npm run test && npm run g && npm run build && npm run type-check && npm run digest","digest":"node scripts/digest.js"},"bugs":{"url":"https://github.com/ant-design/ant-design-icons/issues"},"devDependencies":{"@babel/core":"^7.8.6","@babel/preset-env":"^7.8.6","@babel/preset-typescript":"^7.8.3","@rgrove/parse-xml":"^2.0.2","@types/gulp":"^4.0.6","@types/gulp-concat":"^0.0.32","@types/gulp-rename":"^0.0.33","@types/jest":"^25.1.3","@types/lodash.camelcase":"^4.3.6","@types/lodash.template":"^4.4.6","@types/lodash.upperfirst":"^4.3.6","@types/node":"^13.9.3","@types/ramda":"^0.26.43","@types/rgrove__parse-xml":"^1.1.0","@types/svgo":"^1.3.1","@types/through2":"^2.0.34","@typescript-eslint/eslint-plugin":"^2.21.0","@typescript-eslint/parser":"^2.21.0","babel-jest":"^25.1.0","cross-env":"^7.0.0","del":"^5.1.0","eslint":"^7.16.0","globby":"^11.0.0","gulp":"^4.0.2","gulp-clone":"^2.0.1","gulp-concat":"^2.6.1","gulp-header":"^2.0.9","gulp-rename":"^2.0.0","jest":"^25.1.0","lodash.camelcase":"^4.3.0","lodash.template":"^4.5.0","lodash.upperfirst":"^4.3.1","ramda":"^0.27.0","svgo":"^1.3.2","through2":"^3.0.1","ts-node":"^8.6.2","typescript":"^4.0.0","vinyl":"^2.2.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_lastModified":"2026-09-06T13:12:45.053Z"}
1
+ {"name":"@ant-design/icons-svg","version":"4.3.1","sideEffects":false,"description":"Abstract nodes for ant design icons.","contributors":["HeskeyBaozi <hezhiyu233@foxmail.com>"],"homepage":"https://github.com/ant-design/ant-design-icons/","license":"MIT","main":"lib/index.js","module":"es/index.js","files":["lib","es","inline-svg","inline-namespaced-svg"],"repository":{"type":"git","url":"git+https://github.com/ant-design/ant-design-icons.git"},"scripts":{"g":"npm run generate","generate":"cross-env NODE_ENV=production gulp --require ts-node/register/transpile-only","type-check":"tsc --noEmit","build:es":"tsc --project tsconfig.build.json --module esnext --outDir es","build:lib":"tsc --project tsconfig.build.json --module commonjs --outDir lib","build":"cross-env NODE_ENV=production && npm run build:es && npm run build:lib","test":"cross-env NODE_ENV=test && npm run test:unit","test:unit":"jest","prepublishOnly":"npm run test && npm run g && npm run build && npm run type-check && npm run digest","digest":"node scripts/digest.js"},"bugs":{"url":"https://github.com/ant-design/ant-design-icons/issues"},"devDependencies":{"@babel/core":"^7.8.6","@babel/preset-env":"^7.8.6","@babel/preset-typescript":"^7.8.3","@rgrove/parse-xml":"^2.0.2","@types/gulp":"^4.0.6","@types/gulp-concat":"^0.0.32","@types/gulp-rename":"^0.0.33","@types/jest":"^25.1.3","@types/lodash.camelcase":"^4.3.6","@types/lodash.template":"^4.4.6","@types/lodash.upperfirst":"^4.3.6","@types/node":"^13.9.3","@types/ramda":"^0.26.43","@types/rgrove__parse-xml":"^1.1.0","@types/svgo":"^1.3.1","@types/through2":"^2.0.34","@typescript-eslint/eslint-plugin":"^2.21.0","@typescript-eslint/parser":"^2.21.0","babel-jest":"^25.1.0","cross-env":"^7.0.0","del":"^5.1.0","eslint":"^7.16.0","globby":"^11.0.0","gulp":"^4.0.2","gulp-clone":"^2.0.1","gulp-concat":"^2.6.1","gulp-header":"^2.0.9","gulp-rename":"^2.0.0","jest":"^25.1.0","lodash.camelcase":"^4.3.0","lodash.template":"^4.5.0","lodash.upperfirst":"^4.3.1","ramda":"^0.27.0","svgo":"^1.3.2","through2":"^3.0.1","ts-node":"^8.6.2","typescript":"^4.0.0","vinyl":"^2.2.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_lastModified":"2026-09-15T13:17:50.495Z"}
@@ -1 +1 @@
1
- {"name":"acorn","description":"ECMAScript parser","homepage":"https://github.com/acornjs/acorn","main":"dist/acorn.js","types":"dist/acorn.d.ts","module":"dist/acorn.mjs","exports":{".":[{"import":"./dist/acorn.mjs","require":"./dist/acorn.js","default":"./dist/acorn.js"},"./dist/acorn.js"],"./package.json":"./package.json"},"version":"8.11.2","engines":{"node":">=0.4.0"},"maintainers":[{"name":"Marijn Haverbeke","email":"marijnh@gmail.com","web":"https://marijnhaverbeke.nl"},{"name":"Ingvar Stepanyan","email":"me@rreverser.com","web":"https://rreverser.com/"},{"name":"Adrian Heine","web":"http://adrianheine.de"}],"repository":{"type":"git","url":"https://github.com/acornjs/acorn.git"},"license":"MIT","scripts":{"prepare":"cd ..; npm run build:main"},"bin":{"acorn":"./bin/acorn"},"_lastModified":"2026-09-06T13:12:46.232Z"}
1
+ {"name":"acorn","description":"ECMAScript parser","homepage":"https://github.com/acornjs/acorn","main":"dist/acorn.js","types":"dist/acorn.d.ts","module":"dist/acorn.mjs","exports":{".":[{"import":"./dist/acorn.mjs","require":"./dist/acorn.js","default":"./dist/acorn.js"},"./dist/acorn.js"],"./package.json":"./package.json"},"version":"8.11.2","engines":{"node":">=0.4.0"},"maintainers":[{"name":"Marijn Haverbeke","email":"marijnh@gmail.com","web":"https://marijnhaverbeke.nl"},{"name":"Ingvar Stepanyan","email":"me@rreverser.com","web":"https://rreverser.com/"},{"name":"Adrian Heine","web":"http://adrianheine.de"}],"repository":{"type":"git","url":"https://github.com/acornjs/acorn.git"},"license":"MIT","scripts":{"prepare":"cd ..; npm run build:main"},"bin":{"acorn":"./bin/acorn"},"_lastModified":"2026-09-15T13:17:51.227Z"}
@@ -1 +1 @@
1
- {"name":"acorn-jsx","description":"Modern, fast React.js JSX parser","homepage":"https://github.com/acornjs/acorn-jsx","version":"5.3.2","maintainers":[{"name":"Ingvar Stepanyan","email":"me@rreverser.com","web":"http://rreverser.com/"}],"repository":{"type":"git","url":"https://github.com/acornjs/acorn-jsx"},"license":"MIT","scripts":{"test":"node test/run.js"},"peerDependencies":{"acorn":"^6.0.0 || ^7.0.0 || ^8.0.0"},"devDependencies":{"acorn":"^8.0.1"},"_lastModified":"2026-09-06T13:12:46.700Z"}
1
+ {"name":"acorn-jsx","description":"Modern, fast React.js JSX parser","homepage":"https://github.com/acornjs/acorn-jsx","version":"5.3.2","maintainers":[{"name":"Ingvar Stepanyan","email":"me@rreverser.com","web":"http://rreverser.com/"}],"repository":{"type":"git","url":"https://github.com/acornjs/acorn-jsx"},"license":"MIT","scripts":{"test":"node test/run.js"},"peerDependencies":{"acorn":"^6.0.0 || ^7.0.0 || ^8.0.0"},"devDependencies":{"acorn":"^8.0.1"},"_lastModified":"2026-09-15T13:17:51.566Z"}
@@ -1 +1 @@
1
- {"name":"acorn-walk","description":"ECMAScript (ESTree) AST walker","homepage":"https://github.com/acornjs/acorn","main":"dist/walk.js","types":"dist/walk.d.ts","module":"dist/walk.mjs","exports":{".":[{"import":"./dist/walk.mjs","require":"./dist/walk.js","default":"./dist/walk.js"},"./dist/walk.js"],"./package.json":"./package.json"},"version":"8.3.4","engines":{"node":">=0.4.0"},"dependencies":{"acorn":"^8.11.0"},"maintainers":[{"name":"Marijn Haverbeke","email":"marijnh@gmail.com","web":"https://marijnhaverbeke.nl"},{"name":"Ingvar Stepanyan","email":"me@rreverser.com","web":"https://rreverser.com/"},{"name":"Adrian Heine","web":"http://adrianheine.de"}],"repository":{"type":"git","url":"https://github.com/acornjs/acorn.git"},"scripts":{"prepare":"cd ..; npm run build:walk"},"license":"MIT","_lastModified":"2026-09-06T13:12:46.818Z"}
1
+ {"name":"acorn-walk","description":"ECMAScript (ESTree) AST walker","homepage":"https://github.com/acornjs/acorn","main":"dist/walk.js","types":"dist/walk.d.ts","module":"dist/walk.mjs","exports":{".":[{"import":"./dist/walk.mjs","require":"./dist/walk.js","default":"./dist/walk.js"},"./dist/walk.js"],"./package.json":"./package.json"},"version":"8.3.4","engines":{"node":">=0.4.0"},"dependencies":{"acorn":"^8.11.0"},"maintainers":[{"name":"Marijn Haverbeke","email":"marijnh@gmail.com","web":"https://marijnhaverbeke.nl"},{"name":"Ingvar Stepanyan","email":"me@rreverser.com","web":"https://rreverser.com/"},{"name":"Adrian Heine","web":"http://adrianheine.de"}],"repository":{"type":"git","url":"https://github.com/acornjs/acorn.git"},"scripts":{"prepare":"cd ..; npm run build:walk"},"license":"MIT","_lastModified":"2026-09-15T13:17:51.659Z"}
@@ -1 +1 @@
1
- {"name":"ses","version":"1.14.0","description":"Hardened JavaScript for Fearless Cooperation","keywords":["lockdown","harden","Compartment","assert","security","confinement","isolation","object capabilities","ocaps","secure execution","third-party code","prototype pollution","supply-chain attack","plugin"],"author":"Agoric","license":"Apache-2.0","homepage":"https://github.com/Agoric/SES-shim/tree/master/packages/ses#readme","repository":{"type":"git","url":"git+https://github.com/endojs/endo.git","directory":"packages/ses"},"bugs":{"url":"https://github.com/endojs/endo/issues"},"type":"module","main":"./dist/ses.cjs","module":"./index.js","unpkg":"./dist/ses.umd.js","types":"./types.d.ts","exports":{".":{"import":{"types":"./types.d.ts","xs":"./src-xs/index.js","default":"./index.js"},"require":{"types":"./dist/types.d.cts","default":"./dist/ses.cjs"}},"./lockdown":{"import":{"types":"./types.d.ts","default":"./index.js"},"require":{"types":"./dist/types.d.cts","default":"./dist/ses.cjs"}},"./hermes":{"require":{"types":"./dist/types.d.cts","default":"./dist/ses-hermes.cjs"}},"./tools.js":"./tools.js","./assert-shim.js":"./assert-shim.js","./lockdown-shim.js":{"xs":"./src-xs/lockdown-shim.js","default":"./lockdown-shim.js"},"./compartment-shim.js":{"xs":"./src-xs/compartment-shim.js","default":"./compartment-shim.js"},"./console-shim.js":"./console-shim.js","./package.json":"./package.json"},"scripts":{"build:vanilla":"node scripts/bundle.js","build:hermes":"node scripts/bundle.js hermes","build":"yarn build:vanilla && yarn build:hermes","clean":"rm -rf dist","cover":"c8 ava","demo":"python3 -m http.server","lint":"yarn lint:types && yarn lint:eslint","lint-fix":"eslint --fix .","lint:eslint":"eslint .","lint:types":"tsc","prepare":"npm run clean && npm run build","qt":"ava","test":"tsd && ava","test:hermes":"./scripts/hermes-test.sh","test:xs":"xst dist/ses.umd.js test/_lockdown-safe.js && node scripts/generate-test-xs.js && xst tmp/test-xs.js && rm -rf tmp","postpack":"git clean -fX \"*.d.ts*\" \"*.d.cts*\" \"*.d.mts*\" \"*.tsbuildinfo\""},"dependencies":{"@endo/cache-map":"^1.1.0","@endo/env-options":"^1.1.11","@endo/immutable-arraybuffer":"^1.1.2"},"devDependencies":{"@babel/generator":"^7.26.3","@babel/parser":"~7.26.2","@babel/traverse":"~7.25.9","@babel/types":"~7.26.0","@endo/compartment-mapper":"^1.6.3","@endo/module-source":"^1.3.3","@endo/test262-runner":"^0.1.48","@types/babel__traverse":"^7.20.5","ava":"^6.1.3","babel-eslint":"^10.1.0","c8":"^7.14.0","core-js":"^3.31.0","eslint":"^8.57.1","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^9.1.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.31.0","hermes-engine-cli":"^0.12.0","prettier":"^3.5.3","terser":"^5.16.6","tsd":"^0.31.2","typescript":"~5.8.3"},"files":["./*.d.ts","./*.js","./*.map","LICENSE*","SECURITY*","dist","lib","src","tools"],"publishConfig":{"access":"public"},"eslintConfig":{"extends":["plugin:@endo/ses"]},"ava":{"files":["test/**/*.test.*"],"timeout":"2m"},"typeCoverage":{"atLeast":81.17},"gitHead":"9815aea9541f241389d2135c6097a7442bdffa17","_lastModified":"2026-09-06T13:12:45.767Z"}
1
+ {"name":"ses","version":"1.14.0","description":"Hardened JavaScript for Fearless Cooperation","keywords":["lockdown","harden","Compartment","assert","security","confinement","isolation","object capabilities","ocaps","secure execution","third-party code","prototype pollution","supply-chain attack","plugin"],"author":"Agoric","license":"Apache-2.0","homepage":"https://github.com/Agoric/SES-shim/tree/master/packages/ses#readme","repository":{"type":"git","url":"git+https://github.com/endojs/endo.git","directory":"packages/ses"},"bugs":{"url":"https://github.com/endojs/endo/issues"},"type":"module","main":"./dist/ses.cjs","module":"./index.js","unpkg":"./dist/ses.umd.js","types":"./types.d.ts","exports":{".":{"import":{"types":"./types.d.ts","xs":"./src-xs/index.js","default":"./index.js"},"require":{"types":"./dist/types.d.cts","default":"./dist/ses.cjs"}},"./lockdown":{"import":{"types":"./types.d.ts","default":"./index.js"},"require":{"types":"./dist/types.d.cts","default":"./dist/ses.cjs"}},"./hermes":{"require":{"types":"./dist/types.d.cts","default":"./dist/ses-hermes.cjs"}},"./tools.js":"./tools.js","./assert-shim.js":"./assert-shim.js","./lockdown-shim.js":{"xs":"./src-xs/lockdown-shim.js","default":"./lockdown-shim.js"},"./compartment-shim.js":{"xs":"./src-xs/compartment-shim.js","default":"./compartment-shim.js"},"./console-shim.js":"./console-shim.js","./package.json":"./package.json"},"scripts":{"build:vanilla":"node scripts/bundle.js","build:hermes":"node scripts/bundle.js hermes","build":"yarn build:vanilla && yarn build:hermes","clean":"rm -rf dist","cover":"c8 ava","demo":"python3 -m http.server","lint":"yarn lint:types && yarn lint:eslint","lint-fix":"eslint --fix .","lint:eslint":"eslint .","lint:types":"tsc","prepare":"npm run clean && npm run build","qt":"ava","test":"tsd && ava","test:hermes":"./scripts/hermes-test.sh","test:xs":"xst dist/ses.umd.js test/_lockdown-safe.js && node scripts/generate-test-xs.js && xst tmp/test-xs.js && rm -rf tmp","postpack":"git clean -fX \"*.d.ts*\" \"*.d.cts*\" \"*.d.mts*\" \"*.tsbuildinfo\""},"dependencies":{"@endo/cache-map":"^1.1.0","@endo/env-options":"^1.1.11","@endo/immutable-arraybuffer":"^1.1.2"},"devDependencies":{"@babel/generator":"^7.26.3","@babel/parser":"~7.26.2","@babel/traverse":"~7.25.9","@babel/types":"~7.26.0","@endo/compartment-mapper":"^1.6.3","@endo/module-source":"^1.3.3","@endo/test262-runner":"^0.1.48","@types/babel__traverse":"^7.20.5","ava":"^6.1.3","babel-eslint":"^10.1.0","c8":"^7.14.0","core-js":"^3.31.0","eslint":"^8.57.1","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^9.1.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.31.0","hermes-engine-cli":"^0.12.0","prettier":"^3.5.3","terser":"^5.16.6","tsd":"^0.31.2","typescript":"~5.8.3"},"files":["./*.d.ts","./*.js","./*.map","LICENSE*","SECURITY*","dist","lib","src","tools"],"publishConfig":{"access":"public"},"eslintConfig":{"extends":["plugin:@endo/ses"]},"ava":{"files":["test/**/*.test.*"],"timeout":"2m"},"typeCoverage":{"atLeast":81.17},"gitHead":"9815aea9541f241389d2135c6097a7442bdffa17","_lastModified":"2026-09-15T13:17:50.914Z"}
@@ -1 +1 @@
1
- {"name":"zod","version":"4.3.5","type":"module","license":"MIT","author":"Colin McDonnell <zod@colinhacks.com>","description":"TypeScript-first schema declaration and validation library with static type inference","homepage":"https://zod.dev","llms":"https://zod.dev/llms.txt","llmsFull":"https://zod.dev/llms-full.txt","mcpServer":"https://mcp.inkeep.com/zod/mcp","funding":"https://github.com/sponsors/colinhacks","sideEffects":false,"files":["src","**/*.js","**/*.mjs","**/*.cjs","**/*.d.ts","**/*.d.mts","**/*.d.cts","**/package.json"],"keywords":["typescript","schema","validation","type","inference"],"main":"./index.cjs","types":"./index.d.cts","module":"./index.js","zshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts","./mini":"./src/mini/index.ts","./locales":"./src/locales/index.ts","./v3":"./src/v3/index.ts","./v4":"./src/v4/index.ts","./v4-mini":"./src/v4-mini/index.ts","./v4/mini":"./src/v4/mini/index.ts","./v4/core":"./src/v4/core/index.ts","./v4/locales":"./src/v4/locales/index.ts","./v4/locales/*":"./src/v4/locales/*"},"conditions":{"@zod/source":"src"}},"exports":{"./package.json":"./package.json",".":{"@zod/source":"./src/index.ts","types":"./index.d.cts","import":"./index.js","require":"./index.cjs"},"./mini":{"@zod/source":"./src/mini/index.ts","types":"./mini/index.d.cts","import":"./mini/index.js","require":"./mini/index.cjs"},"./locales":{"@zod/source":"./src/locales/index.ts","types":"./locales/index.d.cts","import":"./locales/index.js","require":"./locales/index.cjs"},"./v3":{"@zod/source":"./src/v3/index.ts","types":"./v3/index.d.cts","import":"./v3/index.js","require":"./v3/index.cjs"},"./v4":{"@zod/source":"./src/v4/index.ts","types":"./v4/index.d.cts","import":"./v4/index.js","require":"./v4/index.cjs"},"./v4-mini":{"@zod/source":"./src/v4-mini/index.ts","types":"./v4-mini/index.d.cts","import":"./v4-mini/index.js","require":"./v4-mini/index.cjs"},"./v4/mini":{"@zod/source":"./src/v4/mini/index.ts","types":"./v4/mini/index.d.cts","import":"./v4/mini/index.js","require":"./v4/mini/index.cjs"},"./v4/core":{"@zod/source":"./src/v4/core/index.ts","types":"./v4/core/index.d.cts","import":"./v4/core/index.js","require":"./v4/core/index.cjs"},"./v4/locales":{"@zod/source":"./src/v4/locales/index.ts","types":"./v4/locales/index.d.cts","import":"./v4/locales/index.js","require":"./v4/locales/index.cjs"},"./v4/locales/*":{"@zod/source":"./src/v4/locales/*","types":"./v4/locales/*","import":"./v4/locales/*","require":"./v4/locales/*"}},"repository":{"type":"git","url":"git+https://github.com/colinhacks/zod.git"},"bugs":{"url":"https://github.com/colinhacks/zod/issues"},"support":{"backing":{"npm-funding":true}},"scripts":{"clean":"git clean -xdf . -e node_modules","build":"zshy --project tsconfig.build.json","postbuild":"tsx ../../scripts/write-stub-package-jsons.ts && pnpm biome check --write .","test:watch":"pnpm vitest","test":"pnpm vitest run","prepublishOnly":"tsx ../../scripts/check-versions.ts"},"_lastModified":"2026-09-06T13:12:48.000Z"}
1
+ {"name":"zod","version":"4.3.5","type":"module","license":"MIT","author":"Colin McDonnell <zod@colinhacks.com>","description":"TypeScript-first schema declaration and validation library with static type inference","homepage":"https://zod.dev","llms":"https://zod.dev/llms.txt","llmsFull":"https://zod.dev/llms-full.txt","mcpServer":"https://mcp.inkeep.com/zod/mcp","funding":"https://github.com/sponsors/colinhacks","sideEffects":false,"files":["src","**/*.js","**/*.mjs","**/*.cjs","**/*.d.ts","**/*.d.mts","**/*.d.cts","**/package.json"],"keywords":["typescript","schema","validation","type","inference"],"main":"./index.cjs","types":"./index.d.cts","module":"./index.js","zshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts","./mini":"./src/mini/index.ts","./locales":"./src/locales/index.ts","./v3":"./src/v3/index.ts","./v4":"./src/v4/index.ts","./v4-mini":"./src/v4-mini/index.ts","./v4/mini":"./src/v4/mini/index.ts","./v4/core":"./src/v4/core/index.ts","./v4/locales":"./src/v4/locales/index.ts","./v4/locales/*":"./src/v4/locales/*"},"conditions":{"@zod/source":"src"}},"exports":{"./package.json":"./package.json",".":{"@zod/source":"./src/index.ts","types":"./index.d.cts","import":"./index.js","require":"./index.cjs"},"./mini":{"@zod/source":"./src/mini/index.ts","types":"./mini/index.d.cts","import":"./mini/index.js","require":"./mini/index.cjs"},"./locales":{"@zod/source":"./src/locales/index.ts","types":"./locales/index.d.cts","import":"./locales/index.js","require":"./locales/index.cjs"},"./v3":{"@zod/source":"./src/v3/index.ts","types":"./v3/index.d.cts","import":"./v3/index.js","require":"./v3/index.cjs"},"./v4":{"@zod/source":"./src/v4/index.ts","types":"./v4/index.d.cts","import":"./v4/index.js","require":"./v4/index.cjs"},"./v4-mini":{"@zod/source":"./src/v4-mini/index.ts","types":"./v4-mini/index.d.cts","import":"./v4-mini/index.js","require":"./v4-mini/index.cjs"},"./v4/mini":{"@zod/source":"./src/v4/mini/index.ts","types":"./v4/mini/index.d.cts","import":"./v4/mini/index.js","require":"./v4/mini/index.cjs"},"./v4/core":{"@zod/source":"./src/v4/core/index.ts","types":"./v4/core/index.d.cts","import":"./v4/core/index.js","require":"./v4/core/index.cjs"},"./v4/locales":{"@zod/source":"./src/v4/locales/index.ts","types":"./v4/locales/index.d.cts","import":"./v4/locales/index.js","require":"./v4/locales/index.cjs"},"./v4/locales/*":{"@zod/source":"./src/v4/locales/*","types":"./v4/locales/*","import":"./v4/locales/*","require":"./v4/locales/*"}},"repository":{"type":"git","url":"git+https://github.com/colinhacks/zod.git"},"bugs":{"url":"https://github.com/colinhacks/zod/issues"},"support":{"backing":{"npm-funding":true}},"scripts":{"clean":"git clean -xdf . -e node_modules","build":"zshy --project tsconfig.build.json","postbuild":"tsx ../../scripts/write-stub-package-jsons.ts && pnpm biome check --write .","test:watch":"pnpm vitest","test":"pnpm vitest run","prepublishOnly":"tsx ../../scripts/check-versions.ts"},"_lastModified":"2026-09-15T13:17:52.488Z"}
@@ -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;
@@ -200,6 +200,24 @@ async function resolveFormAssignRulesVariableSource(ctx, contractNode) {
200
200
  const formNode = await getFlowModelNode(ctx, contractNode.parentId);
201
201
  return formNode && isFormAssignRulesContractPair(formNode, contractNode) ? readFormAssignRulesVariableSource(formNode) : void 0;
202
202
  }
203
+ function readFormLinkageRulesSource(node) {
204
+ const steps = isObject(node.options.stepParams) ? node.options.stepParams : null;
205
+ const events = steps && isObject(steps.eventSettings) ? steps.eventSettings : null;
206
+ return { stepParams: { eventSettings: { linkageRules: events == null ? void 0 : events.linkageRules } } };
207
+ }
208
+ async function collectFormLinkageRuleSources(ctx, form) {
209
+ const grid = await getFlowModelChildNode(ctx, form.uid, "grid");
210
+ if (!grid || !isFormAssignRulesContractPair(form, grid)) return [];
211
+ if (!isReferenceFormGridNode(grid)) return [readFormLinkageRulesSource(grid)];
212
+ const targetUid = getReferenceFormGridTargetUid(grid);
213
+ const target = targetUid ? await getFlowModelNode(ctx, targetUid) : null;
214
+ if (!target || !isFormAssignRulesOwnerNode(target)) return [];
215
+ const targetGrid = await getFlowModelChildNode(ctx, target.uid, "grid");
216
+ if (!targetGrid || !isFormAssignRulesContractPair(target, targetGrid) || isReferenceFormGridNode(targetGrid)) {
217
+ return [];
218
+ }
219
+ return [readFormLinkageRulesSource(target), readFormLinkageRulesSource(targetGrid)];
220
+ }
203
221
  function createRecordSlotCompilerOptions(ctx, currentNode) {
204
222
  let ancestors;
205
223
  return {
@@ -230,14 +248,30 @@ async function getFlowModelVariableContract(ctx, contractNode, runtimeNode, sour
230
248
  return contract;
231
249
  }
232
250
  async function createFlowModelVariableContractFromNode(ctx, contractNode, runtimeNode, source) {
233
- const variableSource = source === "formAssignRules" ? await resolveFormAssignRulesVariableSource(ctx, contractNode) ?? {} : contractNode.options;
234
- const prepared = (0, import_runjs_variable_dependencies.prepareFlowModelVariableSource)(
235
- variableSource,
236
- source === "formAssignRules" ? { isRunJsValuePath: isFormAssignRulesRunJsValuePath } : void 0
237
- );
238
- const contractSource = prepared.ok ? prepared.runJsTemplates.length ? [prepared.templateSource, ...prepared.runJsTemplates] : prepared.templateSource : {};
239
- const result = analyzeVariableTemplateSafely(contractSource, { mode: "flow-model" });
240
- const analysis = result.ok ? result.analysis : (0, import_variable_expression.analyzeVariableTemplate)({}, { mode: "flow-model" });
251
+ const sources = [];
252
+ if (source === "formAssignRules") {
253
+ sources.push(await resolveFormAssignRulesVariableSource(ctx, contractNode) ?? {});
254
+ } else {
255
+ const nodes = contractNode.uid === runtimeNode.uid ? [contractNode] : [contractNode, runtimeNode];
256
+ for (const node of nodes) {
257
+ sources.push(node.options);
258
+ if (isFormAssignRulesOwnerNode(node)) {
259
+ sources.push(...await collectFormLinkageRuleSources(ctx, node));
260
+ }
261
+ }
262
+ }
263
+ const paths = [];
264
+ for (const variableSource of sources) {
265
+ const item = (0, import_runjs_variable_dependencies.prepareFlowModelVariableSource)(
266
+ variableSource,
267
+ source === "formAssignRules" ? { isRunJsValuePath: isFormAssignRulesRunJsValuePath } : void 0
268
+ );
269
+ if (!item.ok) continue;
270
+ const contractSource = item.runJsTemplates.length ? [item.templateSource, ...item.runJsTemplates] : item.templateSource;
271
+ const result = analyzeVariableTemplateSafely(contractSource, { mode: "flow-model" });
272
+ if (result.ok) paths.push(...result.analysis.paths);
273
+ }
274
+ const analysis = { ...(0, import_variable_expression.analyzeVariableTemplate)({}, { mode: "flow-model" }), paths };
241
275
  return await (0, import_record_slot_policy.createFlowModelVariableContract)(analysis, createRecordSlotCompilerOptions(ctx, runtimeNode));
242
276
  }
243
277
  function getCurrentRoleNames(ctx) {
@@ -344,6 +378,25 @@ async function resolveFormAssignRulesContractNode(ctx, runtimeNode, contractMode
344
378
  const ancestorUids = await loadFlowModelAncestorUids(ctx, runtimeNode);
345
379
  return (ancestorUids == null ? void 0 : ancestorUids.has(contractNode.uid)) === true ? contractNode : null;
346
380
  }
381
+ async function resolveReferenceBlockContractNode(ctx, runtimeNode, contractModelUid) {
382
+ const reference = await getFlowModelNode(ctx, contractModelUid);
383
+ if ((reference == null ? void 0 : reference.options.use) !== "ReferenceBlockModel") return null;
384
+ let current = reference;
385
+ const seen = /* @__PURE__ */ new Set([reference.uid]);
386
+ for (let depth = 0; depth < 20; depth++) {
387
+ const steps = isObject(current.options.stepParams) ? current.options.stepParams : null;
388
+ const settings = steps && isObject(steps.referenceSettings) ? steps.referenceSettings : null;
389
+ const target = settings && isObject(settings.target) ? settings.target : null;
390
+ const targetUid = typeof (target == null ? void 0 : target.targetUid) === "string" ? target.targetUid.trim() : "";
391
+ if (!targetUid || seen.has(targetUid)) return null;
392
+ seen.add(targetUid);
393
+ const node = await getFlowModelNode(ctx, targetUid);
394
+ if (!node) return null;
395
+ if (node.options.use !== "ReferenceBlockModel") return node.uid === runtimeNode.uid ? reference : null;
396
+ current = node;
397
+ }
398
+ return null;
399
+ }
347
400
  function createPolicy(allowAll = false, allowedPaths = /* @__PURE__ */ new Set(), unrestrictedVariables = /* @__PURE__ */ new Set()) {
348
401
  return { allowAll, allowedPaths, unrestrictedVariables };
349
402
  }
@@ -438,8 +491,9 @@ async function authorizeVariablesResolve(ctx, options) {
438
491
  let contractNode = currentNode;
439
492
  let contractSource = "node";
440
493
  if (hasContractRd) {
441
- contractNode = currentNode && contractModelUid ? await resolveFormAssignRulesContractNode(ctx, currentNode, contractModelUid) : null;
442
- contractSource = "formAssignRules";
494
+ const reference = currentNode && contractModelUid ? await resolveReferenceBlockContractNode(ctx, currentNode, contractModelUid) : null;
495
+ contractNode = reference || (currentNode && contractModelUid ? await resolveFormAssignRulesContractNode(ctx, currentNode, contractModelUid) : null);
496
+ contractSource = reference ? "node" : "formAssignRules";
443
497
  if (!contractNode) {
444
498
  return denied(analysis, bindingPlan.contextParams, policy, recordSlotPolicies, flowModelUid || void 0);
445
499
  }
@@ -29,6 +29,7 @@ __export(form_item_record_slot_resolvers_exports, {
29
29
  createFormItemRecordSlotResolvers: () => createFormItemRecordSlotResolvers
30
30
  });
31
31
  module.exports = __toCommonJS(form_item_record_slot_resolvers_exports);
32
+ const requestModelTrees = /* @__PURE__ */ new WeakMap();
32
33
  function isObject(value) {
33
34
  return !!value && typeof value === "object" && !Array.isArray(value);
34
35
  }
@@ -153,8 +154,17 @@ async function loadModelTree(input, node) {
153
154
  if (options && getFormItems(options)) return options;
154
155
  const uid = isObject(node) && typeof node.uid === "string" ? node.uid : void 0;
155
156
  if (!uid || !input.ctx) return void 0;
157
+ let cache = requestModelTrees.get(input.ctx);
158
+ if (!cache) {
159
+ cache = /* @__PURE__ */ new Map();
160
+ requestModelTrees.set(input.ctx, cache);
161
+ }
162
+ const cached = cache.get(uid);
163
+ if (cached) return cached;
156
164
  const repository = input.ctx.db.getCollection("flowModels").repository;
157
- return getModelOptions(await repository.findModelById(uid, { includeAsyncNode: true }));
165
+ const load = repository.findModelById(uid, { includeAsyncNode: true }).then(getModelOptions);
166
+ cache.set(uid, load);
167
+ return load;
158
168
  }
159
169
  async function findFormProvider(input, lineage) {
160
170
  for (const node of lineage) {
@@ -170,6 +180,7 @@ async function findFormProvider(input, lineage) {
170
180
  }
171
181
  function getConfiguredAssociationSlots(input, source, items) {
172
182
  var _a;
183
+ const exactAnchors = /* @__PURE__ */ new Map();
173
184
  const slots = /* @__PURE__ */ new Map();
174
185
  const fieldPaths = [];
175
186
  for (const item of items) {
@@ -184,8 +195,11 @@ function getConfiguredAssociationSlots(input, source, items) {
184
195
  slots.set(prefix.join("."), [...prefix]);
185
196
  current = edge.target;
186
197
  }
198
+ if (item.use === "FormAssociationItemModel" && prefix.length > 1 && prefix.length === fieldPath.length) {
199
+ exactAnchors.set(prefix.join("."), prefix.slice(0, -1));
200
+ }
187
201
  }
188
- return { fieldPaths, slots: [...slots.values()] };
202
+ return { exactAnchors, fieldPaths, slots: [...slots.values()] };
189
203
  }
190
204
  async function resolveFormValues(input) {
191
205
  const lineage = await getLineage(input);
@@ -198,7 +212,10 @@ async function resolveFormValues(input) {
198
212
  for (const slot of configuredSlots.slots) {
199
213
  if (pathStartsWith(runtimePath, slot) && (!configured || slot.length > configured.length)) configured = slot;
200
214
  }
201
- if (configured) return resolved(configured);
215
+ if (configured) {
216
+ const exactAnchor = configuredSlots.exactAnchors.get(runtimePath.join("."));
217
+ return resolved(exactAnchor || configured);
218
+ }
202
219
  const top = runtimePath[0];
203
220
  if (typeof top !== "string") return runtimePath.length ? { status: "deny" } : resolved([]);
204
221
  const field = callMethod(provider.collection.collection, "getField", top);
@@ -51,6 +51,8 @@ const MAX_FLOW_MODEL_VARIABLE_SOURCE_DEPTH = 128;
51
51
  const MAX_FLOW_MODEL_VARIABLE_SOURCE_NODES = 1e4;
52
52
  const MAX_FLOW_MODEL_VARIABLE_STRING_LENGTH = 256 * 1024;
53
53
  const MAX_FLOW_MODEL_VARIABLE_TOTAL_STRING_LENGTH = 1024 * 1024;
54
+ const MAX_RUNJS_STATIC_BINDING_WORK = 1e5;
55
+ const STATIC_BINDING_BUDGET_EXHAUSTED = Symbol("static binding budget exhausted");
54
56
  function getEnumerableDataEntries(value) {
55
57
  const descriptors = Object.getOwnPropertyDescriptors(value);
56
58
  const entries = [];
@@ -72,8 +74,23 @@ function readPersistedRunJsValue(entries) {
72
74
  if (typeof code !== "string" || version != null && typeof version !== "string") return;
73
75
  return { code, version };
74
76
  }
75
- function isPersistedRunJsPath(pathTail) {
76
- return RUNJS_PATH_SUFFIXES.has(pathTail.slice(-3).join("."));
77
+ function readDataProperty(value, key) {
78
+ var _a;
79
+ return value && typeof value === "object" ? (_a = Object.getOwnPropertyDescriptor(value, key)) == null ? void 0 : _a.value : void 0;
80
+ }
81
+ function isPersistedRunJsPath(pathTail, flowRegistry) {
82
+ const tail = pathTail.slice(-3);
83
+ if (RUNJS_PATH_SUFFIXES.has(tail.join("."))) return true;
84
+ if (tail[0] === "stepParams") {
85
+ const steps = readDataProperty(readDataProperty(flowRegistry, tail[1]), "steps");
86
+ if (readDataProperty(readDataProperty(steps, tail[2]), "use") === "runjs") return true;
87
+ }
88
+ const path = pathTail.join(".");
89
+ return /(?:^|\.)linkageRules\.value\.\d+\.actions\.\d+\.params\.value\.\d+\.value$/.test(path) || /(?:^|\.)formFilterBlockModelSettings\.defaultValues\.value\.\d+\.value$/.test(path);
90
+ }
91
+ function isPersistedRunJsStringPath(pathTail) {
92
+ const path = pathTail.join(".");
93
+ return /(?:^|\.)linkageRules\.value\.\d+\.actions\.\d+\.params\.value\.script$/.test(path) || /(?:^|\.)chartSettings\.configure\.chart\.(?:option|events)\.raw$/.test(path);
77
94
  }
78
95
  function createTraversalContainer(input, descriptors) {
79
96
  var _a;
@@ -292,18 +309,48 @@ function collectValidatedResolveJsonTemplates(value) {
292
309
  visit(value);
293
310
  return Array.from(templates);
294
311
  }
295
- function extractStaticVariableTemplates(code) {
296
- const parsed = (0, import_parser.parseRunJsAuthoringAst)(code);
312
+ function collectBindingDependencies(ast, consumeWork) {
313
+ const dependencies = /* @__PURE__ */ new Map();
314
+ (0, import_walk.walkAstSimple)(ast, {
315
+ VariableDeclarator(node) {
316
+ if (!node.init) return;
317
+ const names = [];
318
+ (0, import_static_values.collectAstPatternBindingIdentifiers)(node.id, (name) => names.push(name));
319
+ (0, import_walk.walkAstSimple)(node.init, {
320
+ Identifier(reference) {
321
+ const dependency = reference.name;
322
+ if (!dependency) return;
323
+ for (const name of names) {
324
+ consumeWork(1);
325
+ for (const [from, to] of [
326
+ [name, dependency],
327
+ [dependency, name]
328
+ ]) {
329
+ const related = dependencies.get(from) || /* @__PURE__ */ new Set();
330
+ related.add(to);
331
+ dependencies.set(from, related);
332
+ }
333
+ }
334
+ }
335
+ });
336
+ }
337
+ });
338
+ return dependencies;
339
+ }
340
+ function extractStaticVariableTemplates(code, parsed, consumeBindingWork) {
297
341
  if (!parsed.ast) return [];
298
342
  const identifierBindings = (0, import_static_bindings.collectAstIdentifierBindingsFromAst)(parsed.ast, code);
299
343
  if (hasUnsafeCtxUsage(parsed.ast, identifierBindings) || hasCtxMutation(parsed.ast, identifierBindings)) {
300
344
  return [];
301
345
  }
346
+ let bindingDependencies;
347
+ const bindingResults = /* @__PURE__ */ new Map();
348
+ let bindingBudgetExhausted = false;
302
349
  const functionCtxParameterCache = /* @__PURE__ */ new WeakMap();
303
350
  const templates = /* @__PURE__ */ new Set();
304
351
  (0, import_walk.walkAstAncestor)(parsed.ast, {
305
352
  CallExpression(node, ancestors) {
306
- var _a, _b;
353
+ var _a, _b, _c, _d;
307
354
  const methodName = getDirectCtxMethodName(node.callee, identifierBindings);
308
355
  if (hasCtxParameterInFunctionAncestors(ancestors, functionCtxParameterCache)) return;
309
356
  if (methodName === "getVar") {
@@ -311,8 +358,61 @@ function extractStaticVariableTemplates(code) {
311
358
  if (template) templates.add(template);
312
359
  return;
313
360
  }
314
- if (methodName !== "resolveJsonTemplate" || ((_b = node.arguments) == null ? void 0 : _b.length) !== 1) return;
315
- const resolved = resolveStaticJsonValue(node.arguments[0], code);
361
+ if (methodName !== "resolveJsonTemplate" || !((_b = node.arguments) == null ? void 0 : _b.length) || node.arguments.length > 2) return;
362
+ if (node.arguments.length === 2) {
363
+ const options = (0, import_bindings.unwrapAstChainExpression)(node.arguments[1]);
364
+ if ((options == null ? void 0 : options.type) !== "ObjectExpression" || ((_c = options.properties) == null ? void 0 : _c.length) !== 0) return;
365
+ }
366
+ const argument = (0, import_bindings.unwrapAstChainExpression)(node.arguments[0]);
367
+ let resolved = resolveStaticJsonValue(argument, code);
368
+ if ((argument == null ? void 0 : argument.type) === "Identifier" && !bindingBudgetExhausted) {
369
+ try {
370
+ const name = argument.name || "";
371
+ let bindings = bindingResults.get(name);
372
+ if (!bindings) {
373
+ bindingDependencies ??= collectBindingDependencies(parsed.ast, consumeBindingWork);
374
+ const names = /* @__PURE__ */ new Set([name]);
375
+ for (const current of names) {
376
+ for (const dependency of bindingDependencies.get(current) || []) {
377
+ consumeBindingWork(1);
378
+ names.add(dependency);
379
+ }
380
+ }
381
+ bindings = {
382
+ names,
383
+ values: (0, import_static_bindings.collectStaticFilterValueBindingsFromAst)(
384
+ parsed.ast,
385
+ code,
386
+ identifierBindings,
387
+ consumeBindingWork,
388
+ names
389
+ )
390
+ };
391
+ bindingResults.set(name, bindings);
392
+ }
393
+ consumeBindingWork(bindings.values.length * (identifierBindings.length + 1));
394
+ resolved = resolveStaticJsonValue(
395
+ (_d = (0, import_static_values.resolveAstAliasBinding)(name, argument.start || 0, bindings.values, identifierBindings)) == null ? void 0 : _d.valueNode,
396
+ code
397
+ );
398
+ if (!resolved.ok) {
399
+ bindings.strings ??= (0, import_static_bindings.collectStaticStringBindingsFromAst)(
400
+ parsed.ast,
401
+ code,
402
+ [],
403
+ identifierBindings,
404
+ consumeBindingWork,
405
+ bindings.names
406
+ );
407
+ consumeBindingWork(bindings.strings.length * (identifierBindings.length + 1));
408
+ const staticString = (0, import_static_values.resolveRunJsStaticString)(argument, code, bindings.strings, identifierBindings);
409
+ if (typeof staticString === "string") resolved = { ok: true, value: staticString };
410
+ }
411
+ } catch (error) {
412
+ if (error !== STATIC_BINDING_BUDGET_EXHAUSTED) throw error;
413
+ bindingBudgetExhausted = true;
414
+ }
415
+ }
316
416
  if (!resolved.ok) return;
317
417
  collectValidatedResolveJsonTemplates(resolved.value).forEach((template) => templates.add(template));
318
418
  }
@@ -320,7 +420,7 @@ function extractStaticVariableTemplates(code) {
320
420
  return Array.from(templates);
321
421
  }
322
422
  function prepareFlowModelVariableSource(value, options = {}) {
323
- var _a;
423
+ var _a, _b, _c;
324
424
  try {
325
425
  const templates = /* @__PURE__ */ new Set();
326
426
  const seen = /* @__PURE__ */ new WeakSet();
@@ -330,6 +430,36 @@ function prepareFlowModelVariableSource(value, options = {}) {
330
430
  let sourceCount = 0;
331
431
  let totalStringLength = 0;
332
432
  let totalSourceLength = 0;
433
+ let remainingBindingWork = MAX_RUNJS_STATIC_BINDING_WORK;
434
+ const consumeBindingWork = (work) => {
435
+ remainingBindingWork -= work;
436
+ if (remainingBindingWork < 0) throw STATIC_BINDING_BUDGET_EXHAUSTED;
437
+ };
438
+ const supplementalScripts = [];
439
+ const parsedSources = /* @__PURE__ */ new Map();
440
+ const getParsedSource = (code) => {
441
+ let parsed = parsedSources.get(code);
442
+ if (!parsed) {
443
+ parsed = (0, import_parser.parseRunJsAuthoringAst)(code, { allowLegacyTemplates: true });
444
+ parsedSources.set(code, parsed);
445
+ }
446
+ return parsed;
447
+ };
448
+ const extractRunJsDependencies = (code) => {
449
+ if (sourceCount < import_constants.MAX_RUNJS_SOURCES_PER_REQUEST && code.length <= import_constants.MAX_RUNJS_SOURCE_LENGTH && totalSourceLength + code.length <= import_constants.MAX_RUNJS_TOTAL_SOURCE_LENGTH) {
450
+ sourceCount += 1;
451
+ totalSourceLength += code.length;
452
+ extractStaticVariableTemplates(code, getParsedSource(code), consumeBindingWork).forEach(
453
+ (template) => templates.add(template)
454
+ );
455
+ }
456
+ };
457
+ const prepareRunJsCode = (code, version, preserveLegacyTemplates = false) => {
458
+ if (preserveLegacyTemplates) supplementalScripts.push(code);
459
+ else extractRunJsDependencies(code);
460
+ if (version === "v2" && !preserveLegacyTemplates || !code.includes("{{")) return "";
461
+ return (0, import_source.maskJavaScriptComments)(code, getParsedSource(code));
462
+ };
333
463
  while (stack.length) {
334
464
  const frame = stack.pop();
335
465
  if (!frame) break;
@@ -341,7 +471,8 @@ function prepareFlowModelVariableSource(value, options = {}) {
341
471
  return { ok: false };
342
472
  }
343
473
  }
344
- defineTraversalValue(parent, key, input);
474
+ const prepared = typeof input === "string" && !options.isRunJsValuePath && isPersistedRunJsStringPath(pathTail) ? prepareRunJsCode(input, void 0, true) : input;
475
+ defineTraversalValue(parent, key, prepared);
345
476
  continue;
346
477
  }
347
478
  if (seen.has(input)) return { ok: false };
@@ -353,23 +484,24 @@ function prepareFlowModelVariableSource(value, options = {}) {
353
484
  return { ok: false };
354
485
  }
355
486
  }
356
- const runJsPath = options.isRunJsValuePath ? options.isRunJsValuePath(pathTail) : isPersistedRunJsPath(pathTail);
487
+ const runJsPath = options.isRunJsValuePath ? options.isRunJsValuePath(pathTail) : frame.runJsValue || isPersistedRunJsPath(pathTail, frame.flowRegistry);
357
488
  const runJs = !Array.isArray(input) && runJsPath ? readPersistedRunJsValue(entries) : void 0;
358
489
  const output = createTraversalContainer(input, descriptors);
359
490
  defineTraversalValue(parent, key, output);
360
491
  if (runJs) {
361
492
  scheduledNodes += entries.length;
362
- sourceCount += 1;
363
493
  totalStringLength += runJs.code.length + (((_a = runJs.version) == null ? void 0 : _a.length) || 0);
364
- totalSourceLength += runJs.code.length;
365
- if (scheduledNodes > MAX_FLOW_MODEL_VARIABLE_SOURCE_NODES || runJs.code.length > MAX_FLOW_MODEL_VARIABLE_STRING_LENGTH || runJs.version != null && runJs.version.length > MAX_FLOW_MODEL_VARIABLE_STRING_LENGTH || totalStringLength > MAX_FLOW_MODEL_VARIABLE_TOTAL_STRING_LENGTH || sourceCount > import_constants.MAX_RUNJS_SOURCES_PER_REQUEST || runJs.code.length > import_constants.MAX_RUNJS_SOURCE_LENGTH || totalSourceLength > import_constants.MAX_RUNJS_TOTAL_SOURCE_LENGTH) {
494
+ if (scheduledNodes > MAX_FLOW_MODEL_VARIABLE_SOURCE_NODES || runJs.code.length > MAX_FLOW_MODEL_VARIABLE_STRING_LENGTH || runJs.version != null && runJs.version.length > MAX_FLOW_MODEL_VARIABLE_STRING_LENGTH || totalStringLength > MAX_FLOW_MODEL_VARIABLE_TOTAL_STRING_LENGTH) {
366
495
  return { ok: false };
367
496
  }
497
+ const code = prepareRunJsCode(
498
+ runJs.code,
499
+ runJs.version,
500
+ !options.isRunJsValuePath && !RUNJS_PATH_SUFFIXES.has(pathTail.slice(-3).join("."))
501
+ );
368
502
  for (const [entryKey, entryValue] of entries) {
369
- const preparedEntryValue = entryKey === "code" ? runJs.version === "v2" ? "" : (0, import_source.maskJavaScriptComments)(runJs.code) : entryValue;
370
- defineTraversalValue(output, entryKey, preparedEntryValue);
503
+ defineTraversalValue(output, entryKey, entryKey === "code" ? code : entryValue);
371
504
  }
372
- extractStaticVariableTemplates(runJs.code).forEach((template) => templates.add(template));
373
505
  continue;
374
506
  }
375
507
  if (entries.length && depth >= MAX_FLOW_MODEL_VARIABLE_SOURCE_DEPTH) return { ok: false };
@@ -383,10 +515,13 @@ function prepareFlowModelVariableSource(value, options = {}) {
383
515
  input: entryValue,
384
516
  key: entryKey,
385
517
  parent: output,
386
- pathTail: options.isRunJsValuePath ? nextPath : nextPath.slice(-3)
518
+ pathTail: options.isRunJsValuePath ? nextPath : nextPath.slice(-12),
519
+ flowRegistry: entryKey === "stepParams" ? (_b = descriptors.flowRegistry) == null ? void 0 : _b.value : frame.flowRegistry,
520
+ runJsValue: entryKey === "defaultParams" && ((_c = descriptors.use) == null ? void 0 : _c.value) === "runjs"
387
521
  });
388
522
  }
389
523
  }
524
+ supplementalScripts.forEach(extractRunJsDependencies);
390
525
  return { ok: true, runJsTemplates: Array.from(templates), templateSource: root.value };
391
526
  } catch {
392
527
  return { ok: false };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "前端流引擎",
5
5
  "description": "",
6
6
  "description.zh-CN": "",
7
- "version": "2.4.0-alpha.4",
7
+ "version": "2.4.0-alpha.6",
8
8
  "main": "./dist/server/index.js",
9
9
  "license": "Apache-2.0",
10
10
  "devDependencies": {
@@ -26,5 +26,5 @@
26
26
  "@nocobase/test": "2.x",
27
27
  "@nocobase/utils": "2.x"
28
28
  },
29
- "gitHead": "527910882037ce1558ee6b0ef748208b8d6996bb"
29
+ "gitHead": "1fc4fcd17a0cd79912a642600bdc2103e2104bdb"
30
30
  }