@nocobase/plugin-flow-engine 3.0.0-alpha.7 → 3.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/externalVersion.js +9 -9
- package/dist/node_modules/@ant-design/icons-svg/package.json +1 -1
- package/dist/node_modules/acorn/package.json +1 -1
- package/dist/node_modules/acorn-jsx/package.json +1 -1
- package/dist/node_modules/acorn-walk/package.json +1 -1
- package/dist/node_modules/ses/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/plugin.d.ts +2 -0
- package/dist/server/plugin.js +5 -0
- package/dist/server/repository.d.ts +4 -0
- package/dist/server/repository.js +10 -2
- package/dist/server/variables/allow-list.d.ts +1 -0
- package/dist/server/variables/allow-list.js +129 -11
- package/dist/server/variables/records.d.ts +3 -2
- package/dist/server/variables/records.js +40 -23
- package/dist/server/variables/resolve.d.ts +2 -0
- package/dist/server/variables/resolve.js +7 -1
- package/dist/server/variables/runjs-variable-dependencies.d.ts +3 -1
- package/dist/server/variables/runjs-variable-dependencies.js +108 -14
- package/dist/server/variables/selects.js +6 -3
- package/dist/server/variables/utils.js +1 -1
- package/package.json +2 -2
package/dist/externalVersion.js
CHANGED
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "3.0.0-alpha.
|
|
11
|
+
"@nocobase/client": "3.0.0-alpha.8",
|
|
12
12
|
"lodash": "4.18.1",
|
|
13
|
-
"@nocobase/database": "3.0.0-alpha.
|
|
14
|
-
"@nocobase/data-source-manager": "3.0.0-alpha.
|
|
15
|
-
"@nocobase/resourcer": "3.0.0-alpha.
|
|
16
|
-
"@nocobase/server": "3.0.0-alpha.
|
|
17
|
-
"@nocobase/utils": "3.0.0-alpha.
|
|
18
|
-
"@nocobase/cache": "3.0.0-alpha.
|
|
19
|
-
"@nocobase/actions": "3.0.0-alpha.
|
|
13
|
+
"@nocobase/database": "3.0.0-alpha.8",
|
|
14
|
+
"@nocobase/data-source-manager": "3.0.0-alpha.8",
|
|
15
|
+
"@nocobase/resourcer": "3.0.0-alpha.8",
|
|
16
|
+
"@nocobase/server": "3.0.0-alpha.8",
|
|
17
|
+
"@nocobase/utils": "3.0.0-alpha.8",
|
|
18
|
+
"@nocobase/cache": "3.0.0-alpha.8",
|
|
19
|
+
"@nocobase/actions": "3.0.0-alpha.8",
|
|
20
20
|
"sequelize": "6.35.2",
|
|
21
21
|
"@formily/json-schema": "2.3.7",
|
|
22
|
-
"@nocobase/ai": "3.0.0-alpha.
|
|
22
|
+
"@nocobase/ai": "3.0.0-alpha.8"
|
|
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-08-
|
|
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-08-10T06:31:30.087Z"}
|
|
@@ -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-08-
|
|
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-08-10T06:31:31.082Z"}
|
|
@@ -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-08-
|
|
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-08-10T06:31:31.550Z"}
|
|
@@ -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-08-
|
|
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-08-10T06:31:31.683Z"}
|
|
@@ -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-08-
|
|
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-08-10T06:31:30.633Z"}
|
|
@@ -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-08-
|
|
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-08-10T06:31:33.007Z"}
|
package/dist/server/plugin.d.ts
CHANGED
|
@@ -16,10 +16,12 @@ export declare class PluginFlowEngineServer extends PluginUISchemaStorageServer
|
|
|
16
16
|
getDatabaseByDataSourceKey(dataSourceKey?: string): import("@nocobase/database").default;
|
|
17
17
|
runSQLByDataSourceKey(dataSourceKey: string | undefined, sql: string, options?: Record<string, unknown>): Promise<any>;
|
|
18
18
|
resolveFlowModelVariablesTemplate(ctx: ResourcerContext, options: {
|
|
19
|
+
contractRd?: string | number;
|
|
19
20
|
contextParams?: Record<string, unknown>;
|
|
20
21
|
rd?: string | number;
|
|
21
22
|
template: JSONValue;
|
|
22
23
|
}): Promise<any>;
|
|
24
|
+
isLegacyVariableTemplateSafe(template: JSONValue): boolean;
|
|
23
25
|
load(): Promise<void>;
|
|
24
26
|
install(): Promise<void>;
|
|
25
27
|
afterEnable(): Promise<void>;
|
package/dist/server/plugin.js
CHANGED
|
@@ -80,6 +80,9 @@ class PluginFlowEngineServer extends import_server.default {
|
|
|
80
80
|
this.ensureRecordSlotResolvers(ctx.app);
|
|
81
81
|
return await (0, import_resolve.resolveFlowModelVariablesTemplate)(ctx, options);
|
|
82
82
|
}
|
|
83
|
+
isLegacyVariableTemplateSafe(template) {
|
|
84
|
+
return (0, import_resolve.isLegacyVariableTemplateSafe)(template);
|
|
85
|
+
}
|
|
83
86
|
async load() {
|
|
84
87
|
await super.load();
|
|
85
88
|
this.registerRecordSlotResolvers();
|
|
@@ -107,6 +110,7 @@ class PluginFlowEngineServer extends import_server.default {
|
|
|
107
110
|
for (const [index, item] of batchItems.entries()) {
|
|
108
111
|
const template2 = (item == null ? void 0 : item.template) ?? {};
|
|
109
112
|
const authorization2 = await (0, import_allow_list.authorizeVariablesResolve)(ctx, {
|
|
113
|
+
contractRd: item == null ? void 0 : item.contractRd,
|
|
110
114
|
contextParams: (item == null ? void 0 : item.contextParams) || {},
|
|
111
115
|
rd: item == null ? void 0 : item.rd,
|
|
112
116
|
template: template2
|
|
@@ -158,6 +162,7 @@ class PluginFlowEngineServer extends import_server.default {
|
|
|
158
162
|
const template = values.template;
|
|
159
163
|
const contextParams = (values == null ? void 0 : values.contextParams) || {};
|
|
160
164
|
const authorization = await (0, import_allow_list.authorizeVariablesResolve)(ctx, {
|
|
165
|
+
contractRd: values == null ? void 0 : values.contractRd,
|
|
161
166
|
contextParams,
|
|
162
167
|
rd: values == null ? void 0 : values.rd,
|
|
163
168
|
template
|
|
@@ -140,6 +140,10 @@ export declare class FlowModelRepository extends Repository {
|
|
|
140
140
|
upsertModel(model: any, options?: Transactionable): Promise<string>;
|
|
141
141
|
findModelById(uid: string, options?: GetJsonSchemaOptions): Promise<any>;
|
|
142
142
|
findModelNodeSnapshotById(uid: string, options?: Transactionable): Promise<FlowModelNodeSnapshot | null>;
|
|
143
|
+
private findModelUidByParentId;
|
|
144
|
+
findModelNodeSnapshotByParentId(parentUid: string, options?: Transactionable & {
|
|
145
|
+
subKey?: string;
|
|
146
|
+
}): Promise<FlowModelNodeSnapshot | null>;
|
|
143
147
|
findModelByParentId(parentUid: string, options?: GetJsonSchemaOptions & {
|
|
144
148
|
subKey?: string;
|
|
145
149
|
}): Promise<any>;
|
|
@@ -1440,7 +1440,7 @@ WHERE TreeTable.depth = 1 AND TreeTable.ancestor = :ancestor and TreeTable.sort
|
|
|
1440
1440
|
async: !!nodePath.get("async")
|
|
1441
1441
|
};
|
|
1442
1442
|
}
|
|
1443
|
-
async
|
|
1443
|
+
async findModelUidByParentId(parentUid, options) {
|
|
1444
1444
|
const r = this.database.getRepository("flowModelTreePath");
|
|
1445
1445
|
const treePaths = await r.model.findAll({
|
|
1446
1446
|
where: {
|
|
@@ -1462,10 +1462,18 @@ WHERE TreeTable.depth = 1 AND TreeTable.ancestor = :ancestor and TreeTable.sort
|
|
|
1462
1462
|
transaction: options == null ? void 0 : options.transaction
|
|
1463
1463
|
});
|
|
1464
1464
|
if (treePath == null ? void 0 : treePath["descendant"]) {
|
|
1465
|
-
return
|
|
1465
|
+
return treePath["descendant"];
|
|
1466
1466
|
}
|
|
1467
1467
|
return null;
|
|
1468
1468
|
}
|
|
1469
|
+
async findModelNodeSnapshotByParentId(parentUid, options) {
|
|
1470
|
+
const uid2 = await this.findModelUidByParentId(parentUid, options);
|
|
1471
|
+
return uid2 ? this.findModelNodeSnapshotById(uid2, options) : null;
|
|
1472
|
+
}
|
|
1473
|
+
async findModelByParentId(parentUid, options) {
|
|
1474
|
+
const uid2 = await this.findModelUidByParentId(parentUid, options);
|
|
1475
|
+
return uid2 ? this.findModelById(uid2, options) : null;
|
|
1476
|
+
}
|
|
1469
1477
|
async attach(uid2, attachOptions, options) {
|
|
1470
1478
|
const { transaction: transaction2 } = options || {};
|
|
1471
1479
|
const modelUid = String(uid2 || "").trim();
|
|
@@ -41,6 +41,7 @@ export declare function hasRecordContextParams(value: unknown): boolean;
|
|
|
41
41
|
export declare function sanitizeContextParams(value?: Record<string, unknown>): Record<string, unknown>;
|
|
42
42
|
export declare function resolveFlowModelNodeFromRequestRd(ctx: ResourcerContext, rd?: string | number): Promise<FlowModelNodeSnapshot>;
|
|
43
43
|
export declare function authorizeVariablesResolve(ctx: ResourcerContext, options: {
|
|
44
|
+
contractRd?: string | number;
|
|
44
45
|
contextParams?: Record<string, unknown>;
|
|
45
46
|
rd?: string | number;
|
|
46
47
|
template: JSONValue;
|
|
@@ -56,6 +56,53 @@ function clearVariableAllowListCache(app) {
|
|
|
56
56
|
function isObject(value) {
|
|
57
57
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
58
58
|
}
|
|
59
|
+
function readFormAssignRulesVariableSource(node) {
|
|
60
|
+
const stepParams = isObject(node.options.stepParams) ? node.options.stepParams : null;
|
|
61
|
+
const formModelSettings = stepParams && isObject(stepParams.formModelSettings) ? stepParams.formModelSettings : null;
|
|
62
|
+
return formModelSettings && Object.prototype.hasOwnProperty.call(formModelSettings, "assignRules") ? formModelSettings.assignRules : void 0;
|
|
63
|
+
}
|
|
64
|
+
function hasFlowModelUse(node) {
|
|
65
|
+
const use = node.options.use;
|
|
66
|
+
return typeof use === "string" && !!use.trim();
|
|
67
|
+
}
|
|
68
|
+
function matchesVariableContractType(node, type) {
|
|
69
|
+
const marker = node.options.variableContractType;
|
|
70
|
+
if (typeof marker === "undefined") return void 0;
|
|
71
|
+
return isObject(marker) && marker.type === type && marker.use === node.options.use;
|
|
72
|
+
}
|
|
73
|
+
function isFormGridNode(node) {
|
|
74
|
+
const use = node.options.use;
|
|
75
|
+
const markerMatches = matchesVariableContractType(node, "formGrid");
|
|
76
|
+
return node.subKey === "grid" && hasFlowModelUse(node) && (markerMatches === true || typeof markerMatches === "undefined" && typeof use === "string" && use.endsWith("GridModel"));
|
|
77
|
+
}
|
|
78
|
+
function getReferenceFormUseTemplate(node) {
|
|
79
|
+
const stepParams = isObject(node.options.stepParams) ? node.options.stepParams : null;
|
|
80
|
+
const referenceSettings = stepParams && isObject(stepParams.referenceSettings) ? stepParams.referenceSettings : null;
|
|
81
|
+
return referenceSettings && isObject(referenceSettings.useTemplate) ? referenceSettings.useTemplate : null;
|
|
82
|
+
}
|
|
83
|
+
function isReferenceFormGridNode(node) {
|
|
84
|
+
const use = node.options.use;
|
|
85
|
+
return isFormGridNode(node) && typeof use === "string" && use.endsWith("ReferenceFormGridModel");
|
|
86
|
+
}
|
|
87
|
+
function getReferenceFormGridTargetUid(node) {
|
|
88
|
+
const useTemplate = getReferenceFormUseTemplate(node);
|
|
89
|
+
const templateUid = useTemplate && typeof useTemplate.templateUid === "string" ? useTemplate.templateUid.trim() : "";
|
|
90
|
+
if (!useTemplate || !templateUid) return "";
|
|
91
|
+
const targetPath = typeof useTemplate.targetPath === "string" ? useTemplate.targetPath.trim() : "";
|
|
92
|
+
if (targetPath && targetPath !== "subModels.grid") return "";
|
|
93
|
+
return typeof useTemplate.targetUid === "string" ? useTemplate.targetUid.trim() : "";
|
|
94
|
+
}
|
|
95
|
+
function isFormAssignRulesOwnerNode(node) {
|
|
96
|
+
const use = node.options.use;
|
|
97
|
+
const markerMatches = matchesVariableContractType(node, "form");
|
|
98
|
+
return hasFlowModelUse(node) && (markerMatches === true || typeof markerMatches === "undefined" && typeof use === "string" && (use.endsWith("FormModel") || use.endsWith("FormBlockModel")));
|
|
99
|
+
}
|
|
100
|
+
function isFormAssignRulesContractPair(formNode, gridNode) {
|
|
101
|
+
return isFormAssignRulesOwnerNode(formNode) && isFormGridNode(gridNode) && gridNode.parentId === formNode.uid;
|
|
102
|
+
}
|
|
103
|
+
function isFormAssignRulesRunJsValuePath(pathTail) {
|
|
104
|
+
return pathTail.length === 3 && pathTail[0] === "value" && /^\d+$/.test(pathTail[1]) && pathTail[2] === "value";
|
|
105
|
+
}
|
|
59
106
|
function isRecordParams(value) {
|
|
60
107
|
return isObject(value) && typeof value.collection === "string" && Object.prototype.hasOwnProperty.call(value, "filterByTk") && (typeof value.dataSourceKey === "undefined" || typeof value.dataSourceKey === "string") && (typeof value.associationName === "undefined" || typeof value.associationName === "string") && (typeof value.fields === "undefined" || Array.isArray(value.fields) && value.fields.every((field) => typeof field === "string")) && (typeof value.appends === "undefined" || Array.isArray(value.appends) && value.appends.every((append) => typeof append === "string"));
|
|
61
108
|
}
|
|
@@ -110,6 +157,19 @@ async function getFlowModelNode(ctx, flowModelUid) {
|
|
|
110
157
|
cache.set(flowModelUid, model);
|
|
111
158
|
return model;
|
|
112
159
|
}
|
|
160
|
+
async function getFlowModelChildNode(ctx, parentUid, subKey) {
|
|
161
|
+
const state = getRequestState(ctx);
|
|
162
|
+
const cacheKey = "__variableResolveFlowModelChildCache";
|
|
163
|
+
const cache = state[cacheKey] || /* @__PURE__ */ new Map();
|
|
164
|
+
state[cacheKey] = cache;
|
|
165
|
+
const childCacheKey = JSON.stringify([parentUid, subKey]);
|
|
166
|
+
if (cache.has(childCacheKey)) return await cache.get(childCacheKey) || null;
|
|
167
|
+
const load = getFlowModelRepository(ctx).findModelNodeSnapshotByParentId(parentUid, { subKey });
|
|
168
|
+
cache.set(childCacheKey, load);
|
|
169
|
+
const child = await load;
|
|
170
|
+
cache.set(childCacheKey, child);
|
|
171
|
+
return child;
|
|
172
|
+
}
|
|
113
173
|
async function loadFlowModelAncestors(ctx, currentNode) {
|
|
114
174
|
const ancestors = [];
|
|
115
175
|
const seen = /* @__PURE__ */ new Set([currentNode.uid]);
|
|
@@ -126,6 +186,20 @@ async function loadFlowModelAncestors(ctx, currentNode) {
|
|
|
126
186
|
}
|
|
127
187
|
return Object.freeze(ancestors);
|
|
128
188
|
}
|
|
189
|
+
async function loadFlowModelAncestorUids(ctx, currentNode) {
|
|
190
|
+
try {
|
|
191
|
+
return new Set((await loadFlowModelAncestors(ctx, currentNode)).map((ancestor) => ancestor.uid));
|
|
192
|
+
} catch {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
async function resolveFormAssignRulesVariableSource(ctx, contractNode) {
|
|
197
|
+
const fromGrid = readFormAssignRulesVariableSource(contractNode);
|
|
198
|
+
if (typeof fromGrid !== "undefined") return fromGrid;
|
|
199
|
+
if (!contractNode.parentId) return void 0;
|
|
200
|
+
const formNode = await getFlowModelNode(ctx, contractNode.parentId);
|
|
201
|
+
return formNode && isFormAssignRulesContractPair(formNode, contractNode) ? readFormAssignRulesVariableSource(formNode) : void 0;
|
|
202
|
+
}
|
|
129
203
|
function createRecordSlotCompilerOptions(ctx, currentNode) {
|
|
130
204
|
let ancestors;
|
|
131
205
|
return {
|
|
@@ -142,26 +216,29 @@ function createRecordSlotCompilerOptions(ctx, currentNode) {
|
|
|
142
216
|
} : void 0
|
|
143
217
|
};
|
|
144
218
|
}
|
|
145
|
-
async function getFlowModelVariableContract(ctx,
|
|
219
|
+
async function getFlowModelVariableContract(ctx, contractNode, runtimeNode, source) {
|
|
146
220
|
const state = getRequestState(ctx);
|
|
147
221
|
const cacheKey = "__variableResolveContractCache";
|
|
148
222
|
const cache = state[cacheKey] || /* @__PURE__ */ new Map();
|
|
149
223
|
state[cacheKey] = cache;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
224
|
+
const contractCacheKey = JSON.stringify([source, contractNode.uid, runtimeNode.uid]);
|
|
225
|
+
if (cache.has(contractCacheKey)) return await cache.get(contractCacheKey) || null;
|
|
226
|
+
const load = createFlowModelVariableContractFromNode(ctx, contractNode, runtimeNode, source);
|
|
227
|
+
cache.set(contractCacheKey, load);
|
|
153
228
|
const contract = await load;
|
|
154
|
-
cache.set(
|
|
229
|
+
cache.set(contractCacheKey, contract);
|
|
155
230
|
return contract;
|
|
156
231
|
}
|
|
157
|
-
async function createFlowModelVariableContractFromNode(ctx,
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
232
|
+
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
|
+
);
|
|
161
238
|
const contractSource = prepared.ok ? prepared.runJsTemplates.length ? [prepared.templateSource, ...prepared.runJsTemplates] : prepared.templateSource : {};
|
|
162
239
|
const result = analyzeVariableTemplateSafely(contractSource, { mode: "flow-model" });
|
|
163
240
|
const analysis = result.ok ? result.analysis : (0, import_variable_expression.analyzeVariableTemplate)({}, { mode: "flow-model" });
|
|
164
|
-
return await (0, import_record_slot_policy.createFlowModelVariableContract)(analysis, createRecordSlotCompilerOptions(ctx,
|
|
241
|
+
return await (0, import_record_slot_policy.createFlowModelVariableContract)(analysis, createRecordSlotCompilerOptions(ctx, runtimeNode));
|
|
165
242
|
}
|
|
166
243
|
function getCurrentRoleNames(ctx) {
|
|
167
244
|
const state = ctx.state;
|
|
@@ -237,6 +314,36 @@ async function resolveFlowModelNodeFromRequestRd(ctx, rd) {
|
|
|
237
314
|
const flowModelUid = resolveFlowModelUidFromRequestRd(ctx, rd);
|
|
238
315
|
return flowModelUid ? getFlowModelNode(ctx, flowModelUid) : null;
|
|
239
316
|
}
|
|
317
|
+
async function resolveFormAssignRulesContractNode(ctx, runtimeNode, contractModelUid) {
|
|
318
|
+
const contractNode = await getFlowModelNode(ctx, contractModelUid);
|
|
319
|
+
if (!contractNode || !contractNode.parentId || !isFormGridNode(contractNode)) return null;
|
|
320
|
+
const formNode = await getFlowModelNode(ctx, contractNode.parentId);
|
|
321
|
+
if (!formNode || !isFormAssignRulesContractPair(formNode, contractNode)) return null;
|
|
322
|
+
if (isReferenceFormGridNode(contractNode)) {
|
|
323
|
+
const targetUid = getReferenceFormGridTargetUid(contractNode);
|
|
324
|
+
if (!targetUid) return null;
|
|
325
|
+
const targetFormNode = await getFlowModelNode(ctx, targetUid);
|
|
326
|
+
if (!targetFormNode) return null;
|
|
327
|
+
const targetGridNode = await getFlowModelChildNode(ctx, targetFormNode.uid, "grid");
|
|
328
|
+
if (!targetGridNode || !isFormAssignRulesContractPair(targetFormNode, targetGridNode) || isReferenceFormGridNode(targetGridNode)) {
|
|
329
|
+
return null;
|
|
330
|
+
}
|
|
331
|
+
const targetVariableSource = await resolveFormAssignRulesVariableSource(ctx, targetGridNode);
|
|
332
|
+
let contractSourceNode = targetGridNode;
|
|
333
|
+
if (typeof targetVariableSource === "undefined") {
|
|
334
|
+
if (typeof readFormAssignRulesVariableSource(formNode) === "undefined") return null;
|
|
335
|
+
contractSourceNode = formNode;
|
|
336
|
+
}
|
|
337
|
+
const directlyRelated = runtimeNode.uid === contractNode.uid || runtimeNode.uid === formNode.uid || runtimeNode.uid === targetGridNode.uid || runtimeNode.uid === targetFormNode.uid;
|
|
338
|
+
if (directlyRelated) return contractSourceNode;
|
|
339
|
+
const ancestorUids2 = await loadFlowModelAncestorUids(ctx, runtimeNode);
|
|
340
|
+
return (ancestorUids2 == null ? void 0 : ancestorUids2.has(contractNode.uid)) === true || (ancestorUids2 == null ? void 0 : ancestorUids2.has(targetGridNode.uid)) === true ? contractSourceNode : null;
|
|
341
|
+
}
|
|
342
|
+
if (typeof await resolveFormAssignRulesVariableSource(ctx, contractNode) === "undefined") return null;
|
|
343
|
+
if (runtimeNode.uid === contractNode.uid || runtimeNode.uid === formNode.uid) return contractNode;
|
|
344
|
+
const ancestorUids = await loadFlowModelAncestorUids(ctx, runtimeNode);
|
|
345
|
+
return (ancestorUids == null ? void 0 : ancestorUids.has(contractNode.uid)) === true ? contractNode : null;
|
|
346
|
+
}
|
|
240
347
|
function createPolicy(allowAll = false, allowedPaths = /* @__PURE__ */ new Set(), unrestrictedVariables = /* @__PURE__ */ new Set()) {
|
|
241
348
|
return { allowAll, allowedPaths, unrestrictedVariables };
|
|
242
349
|
}
|
|
@@ -253,6 +360,8 @@ async function authorizeVariablesResolve(ctx, options) {
|
|
|
253
360
|
var _a;
|
|
254
361
|
let contextParams = sanitizeContextParams(options.contextParams || {});
|
|
255
362
|
const flowModelUid = resolveFlowModelUidFromRequestRd(ctx, options.rd);
|
|
363
|
+
const hasContractRd = typeof options.contractRd !== "undefined";
|
|
364
|
+
const contractModelUid = hasContractRd ? resolveFlowModelUidFromRequestRd(ctx, options.contractRd) : flowModelUid;
|
|
256
365
|
const unrestrictedVariables = /* @__PURE__ */ new Set();
|
|
257
366
|
let policy = createPolicy(false, /* @__PURE__ */ new Set(), unrestrictedVariables);
|
|
258
367
|
let recordSlotPolicies = /* @__PURE__ */ new Map();
|
|
@@ -326,7 +435,16 @@ async function authorizeVariablesResolve(ctx, options) {
|
|
|
326
435
|
if (flowModelRequiredVars.size > 0 && !flowModelUid) {
|
|
327
436
|
return denied(analysis, bindingPlan.contextParams, policy, recordSlotPolicies);
|
|
328
437
|
}
|
|
329
|
-
|
|
438
|
+
let contractNode = currentNode;
|
|
439
|
+
let contractSource = "node";
|
|
440
|
+
if (hasContractRd) {
|
|
441
|
+
contractNode = currentNode && contractModelUid ? await resolveFormAssignRulesContractNode(ctx, currentNode, contractModelUid) : null;
|
|
442
|
+
contractSource = "formAssignRules";
|
|
443
|
+
if (!contractNode) {
|
|
444
|
+
return denied(analysis, bindingPlan.contextParams, policy, recordSlotPolicies, flowModelUid || void 0);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
const contract = contractNode && currentNode ? await getFlowModelVariableContract(ctx, contractNode, currentNode, contractSource) : null;
|
|
330
448
|
const allowedPaths = (contract == null ? void 0 : contract.allowedPaths) || null;
|
|
331
449
|
recordSlotPolicies = (contract == null ? void 0 : contract.recordSlots) || /* @__PURE__ */ new Map();
|
|
332
450
|
policy = createPolicy(false, allowedPaths || /* @__PURE__ */ new Set(), unrestrictedVariables);
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import type { Collection, RelationRepository, Repository } from '@nocobase/database';
|
|
10
|
+
import type { IRepository } from '@nocobase/data-source-manager';
|
|
10
11
|
import type { ResourcerContext } from '@nocobase/resourcer';
|
|
11
12
|
type FilterTargetKey = string | string[] | undefined;
|
|
12
|
-
type RecordRepository = Repository | RelationRepository;
|
|
13
|
+
type RecordRepository = IRepository | Repository | RelationRepository;
|
|
13
14
|
export type RecordParams = {
|
|
14
15
|
associationName?: string;
|
|
15
16
|
collection: string;
|
|
@@ -80,5 +81,5 @@ export declare function fetchRecordOrRecordsJson(repo: RecordRepository, params:
|
|
|
80
81
|
filterTargetKey?: FilterTargetKey;
|
|
81
82
|
pkAttr?: string;
|
|
82
83
|
pkIsValid?: boolean;
|
|
83
|
-
}): Promise<unknown>;
|
|
84
|
+
}, context: ResourcerContext): Promise<unknown>;
|
|
84
85
|
export {};
|
|
@@ -149,9 +149,10 @@ function isRecordParams(value) {
|
|
|
149
149
|
return !!value && typeof value === "object" && typeof value.collection === "string" && Object.prototype.hasOwnProperty.call(value, "filterByTk");
|
|
150
150
|
}
|
|
151
151
|
function resolveRecordTarget(koaCtx, params) {
|
|
152
|
-
var _a, _b;
|
|
152
|
+
var _a, _b, _c, _d, _e, _f;
|
|
153
153
|
const dataSourceKey = params.dataSourceKey || "main";
|
|
154
154
|
const usesAssociation = !!(params.associationName && typeof params.sourceId !== "undefined");
|
|
155
|
+
const associationSourceCollection = usesAssociation ? (_a = params.associationName) == null ? void 0 : _a.split(".")[0] : void 0;
|
|
155
156
|
const context = koaCtx;
|
|
156
157
|
if (!context.state) context.state = {};
|
|
157
158
|
const targets = context.state.__varResolveRecordTargets ??= /* @__PURE__ */ new Map();
|
|
@@ -164,26 +165,31 @@ function resolveRecordTarget(koaCtx, params) {
|
|
|
164
165
|
if (targets.has(requestKey)) return targets.get(requestKey);
|
|
165
166
|
const ds = koaCtx.app.dataSourceManager.get(dataSourceKey);
|
|
166
167
|
const cm = ds.collectionManager;
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
let repository;
|
|
169
|
+
if (typeof cm.getRepository === "function") {
|
|
170
|
+
repository = usesAssociation ? cm.getRepository(params.associationName, params.sourceId) : cm.getRepository(params.collection);
|
|
171
|
+
} else if (typeof ((_b = cm.db) == null ? void 0 : _b.getRepository) === "function") {
|
|
172
|
+
repository = usesAssociation ? cm.db.getRepository(params.associationName, params.sourceId) : cm.db.getRepository(params.collection);
|
|
170
173
|
}
|
|
171
|
-
const repository = usesAssociation ? cm.db.getRepository(params.associationName, params.sourceId) : cm.db.getRepository(params.collection);
|
|
172
174
|
if (!repository) {
|
|
173
175
|
targets.set(requestKey, void 0);
|
|
174
176
|
return void 0;
|
|
175
177
|
}
|
|
176
|
-
const
|
|
178
|
+
const repositoryMetadata = repository;
|
|
179
|
+
let collection = repositoryMetadata.targetCollection || repositoryMetadata.collection;
|
|
180
|
+
if (!usesAssociation && !collection) {
|
|
181
|
+
collection = (typeof cm.getCollection === "function" ? cm.getCollection(params.collection) : (_d = (_c = cm.db) == null ? void 0 : _c.getCollection) == null ? void 0 : _d.call(_c, params.collection)) || { name: params.collection };
|
|
182
|
+
}
|
|
177
183
|
if (!collection) {
|
|
178
184
|
targets.set(requestKey, void 0);
|
|
179
185
|
return void 0;
|
|
180
186
|
}
|
|
181
|
-
if (usesAssociation && collection.name !== params.collection) {
|
|
187
|
+
if (usesAssociation && (!collection.name || collection.name !== params.collection && associationSourceCollection !== params.collection)) {
|
|
182
188
|
targets.set(requestKey, void 0);
|
|
183
189
|
return void 0;
|
|
184
190
|
}
|
|
185
|
-
const rawAttributes = (
|
|
186
|
-
const pkAttr = (
|
|
191
|
+
const rawAttributes = (_e = collection.model) == null ? void 0 : _e.rawAttributes;
|
|
192
|
+
const pkAttr = (_f = collection.model) == null ? void 0 : _f.primaryKeyAttribute;
|
|
187
193
|
const pkIsValid = !!(pkAttr && rawAttributes && Object.prototype.hasOwnProperty.call(rawAttributes, pkAttr));
|
|
188
194
|
const collectionName = collection.name || params.associationName || params.collection;
|
|
189
195
|
const target = {
|
|
@@ -283,7 +289,7 @@ async function fetchRecordWithRequestCache(koaCtx, params, fields, appends, stri
|
|
|
283
289
|
const cache = getRecordRequestCache(koaCtx);
|
|
284
290
|
const cached = findRecordRequestCacheValue(cache, query);
|
|
285
291
|
if (cached.hit) return cached.value;
|
|
286
|
-
const value = await fetchRecordOrRecordsJson(query.repository, query);
|
|
292
|
+
const value = await fetchRecordOrRecordsJson(query.repository, query, koaCtx);
|
|
287
293
|
setRecordRequestCache(cache, query, value);
|
|
288
294
|
return value;
|
|
289
295
|
} catch (error) {
|
|
@@ -316,11 +322,9 @@ function getExtraKeyFieldsForSelect(filterByTk, options) {
|
|
|
316
322
|
}
|
|
317
323
|
if (Array.isArray(filterByTk) && filterByTk.length > 0) {
|
|
318
324
|
const tkKeys = typeof options.filterTargetKey === "string" ? [options.filterTargetKey] : Array.isArray(options.filterTargetKey) ? options.filterTargetKey : [];
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
extra.push(k);
|
|
323
|
-
}
|
|
325
|
+
for (const k of tkKeys) {
|
|
326
|
+
if (k && (!options.rawAttributes || Object.prototype.hasOwnProperty.call(options.rawAttributes, k))) {
|
|
327
|
+
extra.push(k);
|
|
324
328
|
}
|
|
325
329
|
}
|
|
326
330
|
}
|
|
@@ -339,6 +343,20 @@ function toJsonArray(rows) {
|
|
|
339
343
|
if (!Array.isArray(rows)) return [];
|
|
340
344
|
return rows.map(toJsonRecord);
|
|
341
345
|
}
|
|
346
|
+
function createRecordRepositoryContext(context, params) {
|
|
347
|
+
var _a;
|
|
348
|
+
if (!((_a = context.action) == null ? void 0 : _a.params)) return context;
|
|
349
|
+
const repositoryContext = Object.create(context);
|
|
350
|
+
const repositoryAction = Object.create(context.action);
|
|
351
|
+
repositoryAction.params = {
|
|
352
|
+
...context.action.params,
|
|
353
|
+
filterByTk: params.filterByTk,
|
|
354
|
+
fields: params.fields,
|
|
355
|
+
appends: params.appends
|
|
356
|
+
};
|
|
357
|
+
repositoryContext.action = repositoryAction;
|
|
358
|
+
return repositoryContext;
|
|
359
|
+
}
|
|
342
360
|
function reorderRecordsByFilterByTk(records, filterByTk, options) {
|
|
343
361
|
if (!Array.isArray(filterByTk) || filterByTk.length === 0) return records;
|
|
344
362
|
if (!isPrimitiveTkArray(filterByTk)) return records;
|
|
@@ -369,19 +387,18 @@ function reorderRecordsByFilterByTk(records, filterByTk, options) {
|
|
|
369
387
|
}
|
|
370
388
|
return ordered;
|
|
371
389
|
}
|
|
372
|
-
async function fetchRecordOrRecordsJson(repo, params) {
|
|
390
|
+
async function fetchRecordOrRecordsJson(repo, params, context) {
|
|
373
391
|
const { filterByTk, preferFullRecord, fields, appends } = params;
|
|
392
|
+
if (Array.isArray(filterByTk) && filterByTk.length === 0) return [];
|
|
393
|
+
const query = preferFullRecord ? { filterByTk } : { filterByTk, fields, appends };
|
|
394
|
+
const repositoryContext = createRecordRepositoryContext(context, query);
|
|
395
|
+
const repositoryOptions = { ...query, context: repositoryContext };
|
|
374
396
|
if (Array.isArray(filterByTk)) {
|
|
375
|
-
|
|
376
|
-
const rows = await repo.find(
|
|
377
|
-
preferFullRecord ? { filterByTk } : { filterByTk, fields, appends }
|
|
378
|
-
);
|
|
397
|
+
const rows = await repo.find(repositoryOptions);
|
|
379
398
|
const jsonArr = toJsonArray(rows);
|
|
380
399
|
return reorderRecordsByFilterByTk(jsonArr, filterByTk, params);
|
|
381
400
|
}
|
|
382
|
-
const rec = await repo.findOne(
|
|
383
|
-
preferFullRecord ? { filterByTk } : { filterByTk, fields, appends }
|
|
384
|
-
);
|
|
401
|
+
const rec = await repo.findOne(repositoryOptions);
|
|
385
402
|
return rec ? toJsonRecord(rec) : void 0;
|
|
386
403
|
}
|
|
387
404
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -21,7 +21,9 @@ export type AnalyzedResolveBatchItem = ResolveBatchItem & {
|
|
|
21
21
|
policy: ResolvePathPolicy;
|
|
22
22
|
};
|
|
23
23
|
export declare function resolveVariablesTemplate(ctx: ResourcerContext, template: JSONValue, contextParams?: Record<string, unknown>): Promise<any>;
|
|
24
|
+
export declare function isLegacyVariableTemplateSafe(template: JSONValue): boolean;
|
|
24
25
|
export declare function resolveFlowModelVariablesTemplate(ctx: ResourcerContext, options: {
|
|
26
|
+
contractRd?: string | number;
|
|
25
27
|
contextParams?: Record<string, unknown>;
|
|
26
28
|
rd?: string | number;
|
|
27
29
|
template: JSONValue;
|
|
@@ -26,6 +26,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
26
26
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
27
|
var resolve_exports = {};
|
|
28
28
|
__export(resolve_exports, {
|
|
29
|
+
isLegacyVariableTemplateSafe: () => isLegacyVariableTemplateSafe,
|
|
29
30
|
resolveAnalyzedVariablesBatch: () => resolveAnalyzedVariablesBatch,
|
|
30
31
|
resolveAnalyzedVariablesTemplate: () => resolveAnalyzedVariablesTemplate,
|
|
31
32
|
resolveFlowModelVariablesTemplate: () => resolveFlowModelVariablesTemplate,
|
|
@@ -60,6 +61,10 @@ async function resolveVariablesTemplate(ctx, template, contextParams = {}) {
|
|
|
60
61
|
const bindingPlan = await createRequestBoundRecordBindingPlan(ctx, result.analysis, contextParams);
|
|
61
62
|
return resolveAnalyzedVariablesTemplate(ctx, result.analysis, REQUEST_BOUND_RESOLVE_POLICY, bindingPlan);
|
|
62
63
|
}
|
|
64
|
+
function isLegacyVariableTemplateSafe(template) {
|
|
65
|
+
const result = (0, import_allow_list.analyzeVariableTemplateSafely)(template, { mode: "untrusted-request" });
|
|
66
|
+
return result.ok && result.analysis.supported && result.analysis.paths.length === 0;
|
|
67
|
+
}
|
|
63
68
|
async function resolveFlowModelVariablesTemplate(ctx, options) {
|
|
64
69
|
if (!await (0, import_allow_list.resolveFlowModelNodeFromRequestRd)(ctx, options.rd)) return;
|
|
65
70
|
const authorization = await (0, import_allow_list.authorizeVariablesResolve)(ctx, options);
|
|
@@ -71,7 +76,7 @@ async function resolveFlowModelVariablesTemplate(ctx, options) {
|
|
|
71
76
|
authorization.bindingPlan
|
|
72
77
|
);
|
|
73
78
|
const remaining = (0, import_allow_list.analyzeVariableTemplateSafely)(resolved, { mode: "untrusted-request" });
|
|
74
|
-
if (!remaining.ok || remaining.analysis.paths.length) return;
|
|
79
|
+
if (!remaining.ok || !remaining.analysis.supported || remaining.analysis.paths.length) return;
|
|
75
80
|
return resolved;
|
|
76
81
|
}
|
|
77
82
|
async function createRequestBoundRecordBindingPlan(ctx, analysis, contextParams) {
|
|
@@ -137,6 +142,7 @@ async function resolveAnalyzedVariablesBatch(ctx, items) {
|
|
|
137
142
|
}
|
|
138
143
|
// Annotate the CommonJS export names for ESM import in node:
|
|
139
144
|
0 && (module.exports = {
|
|
145
|
+
isLegacyVariableTemplateSafe,
|
|
140
146
|
resolveAnalyzedVariablesBatch,
|
|
141
147
|
resolveAnalyzedVariablesTemplate,
|
|
142
148
|
resolveFlowModelVariablesTemplate,
|
|
@@ -17,5 +17,7 @@ export declare const MAX_FLOW_MODEL_VARIABLE_SOURCE_DEPTH = 128;
|
|
|
17
17
|
export declare const MAX_FLOW_MODEL_VARIABLE_SOURCE_NODES = 10000;
|
|
18
18
|
export declare const MAX_FLOW_MODEL_VARIABLE_STRING_LENGTH: number;
|
|
19
19
|
export declare const MAX_FLOW_MODEL_VARIABLE_TOTAL_STRING_LENGTH: number;
|
|
20
|
-
export declare function prepareFlowModelVariableSource(value: unknown
|
|
20
|
+
export declare function prepareFlowModelVariableSource(value: unknown, options?: Readonly<{
|
|
21
|
+
isRunJsValuePath?: (pathTail: readonly string[]) => boolean;
|
|
22
|
+
}>): PreparedFlowModelVariableSource;
|
|
21
23
|
export declare function collectPersistedRunJsVariableTemplates(value: unknown): string[];
|
|
@@ -45,6 +45,8 @@ var import_variable_expression = require("../template/variable-expression");
|
|
|
45
45
|
const RUNJS_VALUE_KEYS = /* @__PURE__ */ new Set(["code", "version"]);
|
|
46
46
|
const RUNJS_PATH_SUFFIXES = /* @__PURE__ */ new Set(["stepParams.jsSettings.runJs", "stepParams.clickSettings.runJs"]);
|
|
47
47
|
const MUTATING_CTX_METHODS = /* @__PURE__ */ new Set(["__defineGetter__", "__defineSetter__"]);
|
|
48
|
+
const GLOBAL_OBJECT_NAMES = /* @__PURE__ */ new Set(["globalThis"]);
|
|
49
|
+
const DYNAMIC_CODE_EXECUTION_NAMES = /* @__PURE__ */ new Set(["eval", "Function"]);
|
|
48
50
|
const MAX_FLOW_MODEL_VARIABLE_SOURCE_DEPTH = 128;
|
|
49
51
|
const MAX_FLOW_MODEL_VARIABLE_SOURCE_NODES = 1e4;
|
|
50
52
|
const MAX_FLOW_MODEL_VARIABLE_STRING_LENGTH = 256 * 1024;
|
|
@@ -71,7 +73,7 @@ function readPersistedRunJsValue(entries) {
|
|
|
71
73
|
return { code, version };
|
|
72
74
|
}
|
|
73
75
|
function isPersistedRunJsPath(pathTail) {
|
|
74
|
-
return RUNJS_PATH_SUFFIXES.has(pathTail.join("."));
|
|
76
|
+
return RUNJS_PATH_SUFFIXES.has(pathTail.slice(-3).join("."));
|
|
75
77
|
}
|
|
76
78
|
function createTraversalContainer(input, descriptors) {
|
|
77
79
|
var _a;
|
|
@@ -107,9 +109,10 @@ function functionBindsCtxParameter(node, cache) {
|
|
|
107
109
|
function hasCtxParameterInFunctionAncestors(ancestors, cache) {
|
|
108
110
|
return ancestors.some((ancestor) => functionBindsCtxParameter(ancestor, cache));
|
|
109
111
|
}
|
|
110
|
-
function
|
|
112
|
+
function getDirectCtxMethodName(node, identifierBindings) {
|
|
111
113
|
const member = (0, import_bindings.unwrapAstChainExpression)(node);
|
|
112
|
-
|
|
114
|
+
if ((member == null ? void 0 : member.type) !== "MemberExpression" || !(0, import_static_values.isUnshadowedCtxIdentifier)(member.object, identifierBindings)) return;
|
|
115
|
+
return (0, import_static_values.getAstStaticPropertyName)(member);
|
|
113
116
|
}
|
|
114
117
|
function isCtxRootedMember(node, identifierBindings) {
|
|
115
118
|
const member = (0, import_bindings.unwrapAstChainExpression)(node);
|
|
@@ -145,16 +148,34 @@ function isNonReferenceIdentifier(node, parent) {
|
|
|
145
148
|
}
|
|
146
149
|
return (parent.type === "LabeledStatement" || parent.type === "BreakStatement" || parent.type === "ContinueStatement") && parent.value === node;
|
|
147
150
|
}
|
|
151
|
+
function thisUsesTopLevelBinding(ancestors) {
|
|
152
|
+
for (let index = 0; index < ancestors.length; index += 1) {
|
|
153
|
+
const ancestor = ancestors[index];
|
|
154
|
+
if ((0, import_bindings.isAstFunctionLike)(ancestor) && ancestor.type !== "ArrowFunctionExpression") return false;
|
|
155
|
+
if (ancestor.type === "StaticBlock") return false;
|
|
156
|
+
if (ancestor.type === "PropertyDefinition" && (0, import_bindings.unwrapAstChainExpression)(ancestor.value) === ancestors[index + 1]) {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
148
162
|
function hasUnsafeCtxUsage(ast, identifierBindings) {
|
|
149
163
|
let unsafe = false;
|
|
150
164
|
(0, import_walk.walkAstAncestor)(ast, {
|
|
151
165
|
Identifier(node, ancestors) {
|
|
152
|
-
if (!(0, import_static_values.isUnshadowedCtxIdentifier)(node, identifierBindings)) return;
|
|
153
166
|
const parent = ancestors[ancestors.length - 2];
|
|
154
167
|
if (isNonReferenceIdentifier(node, parent)) return;
|
|
168
|
+
if (node.name && (GLOBAL_OBJECT_NAMES.has(node.name) || DYNAMIC_CODE_EXECUTION_NAMES.has(node.name)) && !(0, import_static_values.hasAstActiveBinding)(node.name, node.start || 0, identifierBindings)) {
|
|
169
|
+
unsafe = true;
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (!(0, import_static_values.isUnshadowedCtxIdentifier)(node, identifierBindings)) return;
|
|
155
173
|
if ((parent == null ? void 0 : parent.type) === "MemberExpression" && (0, import_bindings.unwrapAstChainExpression)(parent.object) === node) return;
|
|
156
174
|
unsafe = true;
|
|
157
175
|
},
|
|
176
|
+
ThisExpression(_node, ancestors) {
|
|
177
|
+
if (thisUsesTopLevelBinding(ancestors)) unsafe = true;
|
|
178
|
+
},
|
|
158
179
|
WithStatement() {
|
|
159
180
|
unsafe = true;
|
|
160
181
|
}
|
|
@@ -205,7 +226,73 @@ function createValidatedGetVarTemplate(value, code) {
|
|
|
205
226
|
}
|
|
206
227
|
return `{{ ${path} }}`;
|
|
207
228
|
}
|
|
208
|
-
function
|
|
229
|
+
function resolveStaticJsonValue(node, code) {
|
|
230
|
+
var _a;
|
|
231
|
+
const valueNode = (0, import_bindings.unwrapAstChainExpression)(node);
|
|
232
|
+
if (!valueNode) return { ok: false };
|
|
233
|
+
if (valueNode.type === "Literal") {
|
|
234
|
+
const literalValue = valueNode.value;
|
|
235
|
+
if (literalValue === null) return { ok: true, value: null };
|
|
236
|
+
if (typeof literalValue === "string") return { ok: true, value: literalValue };
|
|
237
|
+
if (typeof literalValue === "boolean") return { ok: true, value: literalValue };
|
|
238
|
+
if (typeof literalValue === "number" && Number.isFinite(literalValue)) return { ok: true, value: literalValue };
|
|
239
|
+
return { ok: false };
|
|
240
|
+
}
|
|
241
|
+
if (valueNode.type === "TemplateLiteral" && !((_a = valueNode.expressions) == null ? void 0 : _a.length)) {
|
|
242
|
+
const value2 = (0, import_static_values.resolveAstStaticStringValue)(valueNode, code);
|
|
243
|
+
return typeof value2 === "string" ? { ok: true, value: value2 } : { ok: false };
|
|
244
|
+
}
|
|
245
|
+
if (valueNode.type === "UnaryExpression" && valueNode.operator === "-") {
|
|
246
|
+
const argument = (0, import_bindings.unwrapAstChainExpression)(valueNode.argument);
|
|
247
|
+
return (argument == null ? void 0 : argument.type) === "Literal" && typeof argument.value === "number" && Number.isFinite(argument.value) ? { ok: true, value: -argument.value } : { ok: false };
|
|
248
|
+
}
|
|
249
|
+
if (valueNode.type === "ArrayExpression") {
|
|
250
|
+
const value2 = [];
|
|
251
|
+
for (const element of valueNode.elements || []) {
|
|
252
|
+
if (!element || element.type === "SpreadElement") return { ok: false };
|
|
253
|
+
const resolved = resolveStaticJsonValue(element, code);
|
|
254
|
+
if (!resolved.ok) return resolved;
|
|
255
|
+
value2.push(resolved.value);
|
|
256
|
+
}
|
|
257
|
+
return { ok: true, value: value2 };
|
|
258
|
+
}
|
|
259
|
+
if (valueNode.type !== "ObjectExpression") return { ok: false };
|
|
260
|
+
const value = /* @__PURE__ */ Object.create(null);
|
|
261
|
+
for (const propertyValue of valueNode.properties || []) {
|
|
262
|
+
const property = propertyValue;
|
|
263
|
+
if ((property == null ? void 0 : property.type) !== "Property" || property.computed || property.kind !== "init" || property.method || property.shorthand) {
|
|
264
|
+
return { ok: false };
|
|
265
|
+
}
|
|
266
|
+
const keyNode = (0, import_bindings.unwrapAstChainExpression)(property.key);
|
|
267
|
+
const key = (keyNode == null ? void 0 : keyNode.type) === "Identifier" ? keyNode.name : (keyNode == null ? void 0 : keyNode.type) === "Literal" && (typeof keyNode.value === "string" || typeof keyNode.value === "number") ? String(keyNode.value) : void 0;
|
|
268
|
+
if (typeof key !== "string" || key === "__proto__" || Object.prototype.hasOwnProperty.call(value, key)) {
|
|
269
|
+
return { ok: false };
|
|
270
|
+
}
|
|
271
|
+
const resolved = resolveStaticJsonValue(property.value, code);
|
|
272
|
+
if (!resolved.ok) return resolved;
|
|
273
|
+
value[key] = resolved.value;
|
|
274
|
+
}
|
|
275
|
+
return { ok: true, value };
|
|
276
|
+
}
|
|
277
|
+
function collectValidatedResolveJsonTemplates(value) {
|
|
278
|
+
const analysis = (0, import_variable_expression.analyzeVariableTemplate)(value, { mode: "untrusted-request" });
|
|
279
|
+
if (!analysis.supported || analysis.errors.length) return [];
|
|
280
|
+
const templates = /* @__PURE__ */ new Set();
|
|
281
|
+
const visit = (current) => {
|
|
282
|
+
if (typeof current === "string") {
|
|
283
|
+
if ((0, import_variable_expression.analyzeVariableTemplate)(current, { mode: "untrusted-request" }).paths.length) templates.add(current);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if (Array.isArray(current)) {
|
|
287
|
+
current.forEach(visit);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (current && typeof current === "object") Object.values(current).forEach(visit);
|
|
291
|
+
};
|
|
292
|
+
visit(value);
|
|
293
|
+
return Array.from(templates);
|
|
294
|
+
}
|
|
295
|
+
function extractStaticVariableTemplates(code) {
|
|
209
296
|
const parsed = (0, import_parser.parseRunJsAuthoringAst)(code);
|
|
210
297
|
if (!parsed.ast) return [];
|
|
211
298
|
const identifierBindings = (0, import_static_bindings.collectAstIdentifierBindingsFromAst)(parsed.ast, code);
|
|
@@ -216,18 +303,23 @@ function extractStaticGetVarTemplates(code) {
|
|
|
216
303
|
const templates = /* @__PURE__ */ new Set();
|
|
217
304
|
(0, import_walk.walkAstAncestor)(parsed.ast, {
|
|
218
305
|
CallExpression(node, ancestors) {
|
|
219
|
-
var _a;
|
|
220
|
-
const
|
|
221
|
-
if (
|
|
306
|
+
var _a, _b;
|
|
307
|
+
const methodName = getDirectCtxMethodName(node.callee, identifierBindings);
|
|
308
|
+
if (hasCtxParameterInFunctionAncestors(ancestors, functionCtxParameterCache)) return;
|
|
309
|
+
if (methodName === "getVar") {
|
|
310
|
+
const template = createValidatedGetVarTemplate((_a = node.arguments) == null ? void 0 : _a[0], code);
|
|
311
|
+
if (template) templates.add(template);
|
|
222
312
|
return;
|
|
223
313
|
}
|
|
224
|
-
|
|
225
|
-
|
|
314
|
+
if (methodName !== "resolveJsonTemplate" || ((_b = node.arguments) == null ? void 0 : _b.length) !== 1) return;
|
|
315
|
+
const resolved = resolveStaticJsonValue(node.arguments[0], code);
|
|
316
|
+
if (!resolved.ok) return;
|
|
317
|
+
collectValidatedResolveJsonTemplates(resolved.value).forEach((template) => templates.add(template));
|
|
226
318
|
}
|
|
227
319
|
});
|
|
228
320
|
return Array.from(templates);
|
|
229
321
|
}
|
|
230
|
-
function prepareFlowModelVariableSource(value) {
|
|
322
|
+
function prepareFlowModelVariableSource(value, options = {}) {
|
|
231
323
|
var _a;
|
|
232
324
|
try {
|
|
233
325
|
const templates = /* @__PURE__ */ new Set();
|
|
@@ -261,7 +353,8 @@ function prepareFlowModelVariableSource(value) {
|
|
|
261
353
|
return { ok: false };
|
|
262
354
|
}
|
|
263
355
|
}
|
|
264
|
-
const
|
|
356
|
+
const runJsPath = options.isRunJsValuePath ? options.isRunJsValuePath(pathTail) : isPersistedRunJsPath(pathTail);
|
|
357
|
+
const runJs = !Array.isArray(input) && runJsPath ? readPersistedRunJsValue(entries) : void 0;
|
|
265
358
|
const output = createTraversalContainer(input, descriptors);
|
|
266
359
|
defineTraversalValue(parent, key, output);
|
|
267
360
|
if (runJs) {
|
|
@@ -276,7 +369,7 @@ function prepareFlowModelVariableSource(value) {
|
|
|
276
369
|
const preparedEntryValue = entryKey === "code" ? runJs.version === "v2" ? "" : (0, import_source.maskJavaScriptComments)(runJs.code) : entryValue;
|
|
277
370
|
defineTraversalValue(output, entryKey, preparedEntryValue);
|
|
278
371
|
}
|
|
279
|
-
|
|
372
|
+
extractStaticVariableTemplates(runJs.code).forEach((template) => templates.add(template));
|
|
280
373
|
continue;
|
|
281
374
|
}
|
|
282
375
|
if (entries.length && depth >= MAX_FLOW_MODEL_VARIABLE_SOURCE_DEPTH) return { ok: false };
|
|
@@ -284,12 +377,13 @@ function prepareFlowModelVariableSource(value) {
|
|
|
284
377
|
if (scheduledNodes > MAX_FLOW_MODEL_VARIABLE_SOURCE_NODES) return { ok: false };
|
|
285
378
|
for (let index = entries.length - 1; index >= 0; index -= 1) {
|
|
286
379
|
const [entryKey, entryValue] = entries[index];
|
|
380
|
+
const nextPath = [...pathTail, entryKey];
|
|
287
381
|
stack.push({
|
|
288
382
|
depth: depth + 1,
|
|
289
383
|
input: entryValue,
|
|
290
384
|
key: entryKey,
|
|
291
385
|
parent: output,
|
|
292
|
-
pathTail:
|
|
386
|
+
pathTail: options.isRunJsValuePath ? nextPath : nextPath.slice(-3)
|
|
293
387
|
});
|
|
294
388
|
}
|
|
295
389
|
}
|
|
@@ -30,12 +30,15 @@ __export(selects_exports, {
|
|
|
30
30
|
});
|
|
31
31
|
module.exports = __toCommonJS(selects_exports);
|
|
32
32
|
function adjustSelectsForCollection(koaCtx, dataSourceKey, collection, fields, appends) {
|
|
33
|
-
var _a, _b, _c, _d;
|
|
33
|
+
var _a, _b, _c, _d, _e;
|
|
34
34
|
const ds = koaCtx.app.dataSourceManager.get(dataSourceKey || "main");
|
|
35
35
|
const cm = ds.collectionManager;
|
|
36
36
|
const coll = (_b = (_a = cm == null ? void 0 : cm.db) == null ? void 0 : _a.getCollection) == null ? void 0 : _b.call(_a, collection);
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
if (!((_c = coll == null ? void 0 : coll.model) == null ? void 0 : _c.rawAttributes)) {
|
|
38
|
+
return { fields, appends };
|
|
39
|
+
}
|
|
40
|
+
const assocKeys = Object.keys(((_d = coll == null ? void 0 : coll.model) == null ? void 0 : _d.associations) || {});
|
|
41
|
+
const rawAttrs = ((_e = coll == null ? void 0 : coll.model) == null ? void 0 : _e.rawAttributes) || {};
|
|
39
42
|
const toCamel = (s) => s.replace(/_([a-zA-Z0-9])/g, (_m, c) => String(c).toUpperCase());
|
|
40
43
|
const toSnake = (s) => s.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
|
|
41
44
|
const assocMap = /* @__PURE__ */ new Map();
|
|
@@ -81,7 +81,7 @@ async function prefetchRecordsForResolve(koaCtx, bindings) {
|
|
|
81
81
|
group.preferFullRecord
|
|
82
82
|
);
|
|
83
83
|
if ((0, import_records.findRecordRequestCacheValue)(cache, query).hit) continue;
|
|
84
|
-
(0, import_records.setRecordRequestCache)(cache, query, await (0, import_records.fetchRecordOrRecordsJson)(query.repository, query));
|
|
84
|
+
(0, import_records.setRecordRequestCache)(cache, query, await (0, import_records.fetchRecordOrRecordsJson)(query.repository, query, koaCtx));
|
|
85
85
|
} catch (error) {
|
|
86
86
|
log == null ? void 0 : log.debug("[variables.resolve] prefetch query error", {
|
|
87
87
|
...group.target.cacheIdentity,
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "前端流引擎",
|
|
5
5
|
"description": "",
|
|
6
6
|
"description.zh-CN": "",
|
|
7
|
-
"version": "3.0.0-alpha.
|
|
7
|
+
"version": "3.0.0-alpha.8",
|
|
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": "
|
|
29
|
+
"gitHead": "ce017f3deb8b2414c6b13818042c4187270d1d8a"
|
|
30
30
|
}
|