@nocobase/plugin-flow-engine 2.1.0-alpha.17 → 2.1.0-alpha.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/externalVersion.js +11 -11
  2. package/dist/node_modules/ses/package.json +1 -1
  3. package/dist/node_modules/zod/package.json +1 -1
  4. package/dist/server/flow-surfaces/action-scope.js +3 -1
  5. package/dist/server/flow-surfaces/apply/compiler.js +84 -5
  6. package/dist/server/flow-surfaces/approval/blueprint-service.d.ts +84 -0
  7. package/dist/server/flow-surfaces/approval/blueprint-service.js +589 -0
  8. package/dist/server/flow-surfaces/approval/blueprint.d.ts +21 -0
  9. package/dist/server/flow-surfaces/approval/blueprint.js +190 -0
  10. package/dist/server/flow-surfaces/approval/builder.d.ts +225 -0
  11. package/dist/server/flow-surfaces/approval/builder.js +384 -0
  12. package/dist/server/flow-surfaces/approval/catalog-specs.d.ts +33 -0
  13. package/dist/server/flow-surfaces/approval/catalog-specs.js +156 -0
  14. package/dist/server/flow-surfaces/approval/index.d.ts +14 -0
  15. package/dist/server/flow-surfaces/approval/index.js +40 -0
  16. package/dist/server/flow-surfaces/approval/runtime-config.d.ts +44 -0
  17. package/dist/server/flow-surfaces/approval/runtime-config.js +299 -0
  18. package/dist/server/flow-surfaces/approval/semantic-use.d.ts +23 -0
  19. package/dist/server/flow-surfaces/approval/semantic-use.js +155 -0
  20. package/dist/server/flow-surfaces/blueprint/compile-blocks.js +36 -2
  21. package/dist/server/flow-surfaces/blueprint/public-types.d.ts +7 -0
  22. package/dist/server/flow-surfaces/builder.d.ts +2 -0
  23. package/dist/server/flow-surfaces/builder.js +83 -10
  24. package/dist/server/flow-surfaces/catalog.d.ts +10 -0
  25. package/dist/server/flow-surfaces/catalog.js +368 -9
  26. package/dist/server/flow-surfaces/chart-config.d.ts +1 -1
  27. package/dist/server/flow-surfaces/compose-compiler.d.ts +1 -0
  28. package/dist/server/flow-surfaces/compose-compiler.js +2 -1
  29. package/dist/server/flow-surfaces/configure-options.js +61 -3
  30. package/dist/server/flow-surfaces/constants.d.ts +342 -5
  31. package/dist/server/flow-surfaces/constants.js +59 -125
  32. package/dist/server/flow-surfaces/default-action-popup.d.ts +1 -0
  33. package/dist/server/flow-surfaces/default-action-popup.js +6 -2
  34. package/dist/server/flow-surfaces/field-semantics.js +2 -1
  35. package/dist/server/flow-surfaces/index.js +21 -273
  36. package/dist/server/flow-surfaces/locator.js +8 -6
  37. package/dist/server/flow-surfaces/node-use-sets.js +15 -3
  38. package/dist/server/flow-surfaces/placement.js +11 -7
  39. package/dist/server/flow-surfaces/planning/action-specs.d.ts +1 -1
  40. package/dist/server/flow-surfaces/planning/compiler.d.ts +1 -1
  41. package/dist/server/flow-surfaces/planning/key-kind.js +7 -5
  42. package/dist/server/flow-surfaces/reaction/registry.d.ts +13 -0
  43. package/dist/server/flow-surfaces/reaction/registry.js +13 -0
  44. package/dist/server/flow-surfaces/service-utils.d.ts +10 -14
  45. package/dist/server/flow-surfaces/service-utils.js +4 -2
  46. package/dist/server/flow-surfaces/service.d.ts +63 -1
  47. package/dist/server/flow-surfaces/service.js +1058 -109
  48. package/dist/server/flow-surfaces/surface-context.d.ts +1 -0
  49. package/dist/server/flow-surfaces/surface-context.js +99 -19
  50. package/dist/server/flow-surfaces/types.d.ts +4 -1
  51. package/dist/swagger/flow-surfaces.d.ts +406 -2
  52. package/dist/swagger/flow-surfaces.examples.d.ts +164 -0
  53. package/dist/swagger/flow-surfaces.examples.js +184 -0
  54. package/dist/swagger/flow-surfaces.js +390 -76
  55. package/dist/swagger/index.d.ts +406 -2
  56. package/package.json +2 -2
@@ -8,15 +8,15 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.1.0-alpha.17",
12
- "lodash": "4.17.21",
13
- "@nocobase/database": "2.1.0-alpha.17",
14
- "@nocobase/data-source-manager": "2.1.0-alpha.17",
15
- "@nocobase/resourcer": "2.1.0-alpha.17",
16
- "@nocobase/utils": "2.1.0-alpha.17",
17
- "@nocobase/cache": "2.1.0-alpha.17",
18
- "@nocobase/plugin-localization": "2.1.0-alpha.17",
19
- "@nocobase/server": "2.1.0-alpha.17",
20
- "@nocobase/actions": "2.1.0-alpha.17",
21
- "@nocobase/ai": "2.1.0-alpha.17"
11
+ "@nocobase/client": "2.1.0-alpha.19",
12
+ "lodash": "4.18.1",
13
+ "@nocobase/database": "2.1.0-alpha.19",
14
+ "@nocobase/data-source-manager": "2.1.0-alpha.19",
15
+ "@nocobase/resourcer": "2.1.0-alpha.19",
16
+ "@nocobase/utils": "2.1.0-alpha.19",
17
+ "@nocobase/cache": "2.1.0-alpha.19",
18
+ "@nocobase/plugin-localization": "2.1.0-alpha.19",
19
+ "@nocobase/server": "2.1.0-alpha.19",
20
+ "@nocobase/actions": "2.1.0-alpha.19",
21
+ "@nocobase/ai": "2.1.0-alpha.19"
22
22
  };
@@ -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-04-17T02:45:43.122Z"}
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-04-19T04:12:22.128Z"}
@@ -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-04-17T02:45:44.190Z"}
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-04-19T04:12:23.144Z"}
@@ -44,6 +44,7 @@ __export(action_scope_exports, {
44
44
  normalizeActionScope: () => normalizeActionScope
45
45
  });
46
46
  module.exports = __toCommonJS(action_scope_exports);
47
+ var import_approval = require("./approval");
47
48
  var import_errors = require("./errors");
48
49
  const ACTION_SCOPE_SET = /* @__PURE__ */ new Set(["block", "record", "form", "filterForm", "actionPanel"]);
49
50
  const TABLE_BLOCK_ACTION_CONTAINER_USES = ["TableBlockModel"];
@@ -68,7 +69,8 @@ const ACTION_CONTAINER_SCOPE_BY_USE = Object.fromEntries([
68
69
  ...RECORD_ACTION_CONTAINER_USES.map((use) => [use, "record"]),
69
70
  ...FORM_ACTION_CONTAINER_USES.map((use) => [use, "form"]),
70
71
  ...FILTER_FORM_ACTION_CONTAINER_USES.map((use) => [use, "filterForm"]),
71
- ...ACTION_PANEL_ACTION_CONTAINER_USES.map((use) => [use, "actionPanel"])
72
+ ...ACTION_PANEL_ACTION_CONTAINER_USES.map((use) => [use, "actionPanel"]),
73
+ ...import_approval.APPROVAL_ACTION_CONTAINER_USES.map((use) => [use, "form"])
72
74
  ]);
73
75
  function getActionContainerScope(containerUse) {
74
76
  return ACTION_CONTAINER_SCOPE_BY_USE[String(containerUse || "").trim()] || null;
@@ -66,6 +66,7 @@ const RECORD_ACTION_INTERNAL_CONTAINER_USES = /* @__PURE__ */ new Set([
66
66
  "ListItemModel",
67
67
  "GridCardItemModel"
68
68
  ]);
69
+ const APPLY_POPUP_ALLOWED_KEYS = /* @__PURE__ */ new Set(["template", "tryTemplate", "defaultType"]);
69
70
  function compileApplySpec(target, currentTree, spec) {
70
71
  if (!(currentTree == null ? void 0 : currentTree.uid) || !(currentTree == null ? void 0 : currentTree.use)) {
71
72
  throw new import_errors.FlowSurfaceBadRequestError("flowSurfaces apply requires an existing target subtree");
@@ -124,6 +125,7 @@ function compileApplySpec(target, currentTree, spec) {
124
125
  const rootSpec = {
125
126
  uid: currentTree.uid,
126
127
  use: currentTree.use,
128
+ popup: spec.popup,
127
129
  props: spec.props,
128
130
  decoratorProps: spec.decoratorProps,
129
131
  stepParams: spec.stepParams,
@@ -147,9 +149,13 @@ function compileApplySpec(target, currentTree, spec) {
147
149
  };
148
150
  }
149
151
  function syncExistingNode(ops, state, nodeRef, currentNode, desiredNode, explicitTarget) {
150
- emitDomainSettingOps(ops, nodeRef, currentNode, desiredNode, explicitTarget);
151
- const childSync = syncChildren(ops, state, nodeRef, currentNode, desiredNode);
152
- (0, import_layout.emitLayoutOp)(ops, explicitTarget || { uid: nodeRef.uidRef }, currentNode, desiredNode, childSync);
152
+ const popupAwareDesiredNode = withApplyPopupOpenViewForExistingNode(
153
+ desiredNode,
154
+ `flowSurfaces apply node '${desiredNode.use}'`
155
+ );
156
+ emitDomainSettingOps(ops, nodeRef, currentNode, popupAwareDesiredNode, explicitTarget);
157
+ const childSync = syncChildren(ops, state, nodeRef, currentNode, popupAwareDesiredNode);
158
+ (0, import_layout.emitLayoutOp)(ops, explicitTarget || { uid: nodeRef.uidRef }, currentNode, popupAwareDesiredNode, childSync);
153
159
  }
154
160
  function syncCreatedNode(ops, state, nodeRef, desiredNode) {
155
161
  emitDomainSettingOps(ops, nodeRef, null, desiredNode);
@@ -474,7 +480,72 @@ function createBlockNode(ops, state, parentRef, desiredNode) {
474
480
  syncCreatedNode(ops, state, ref, desiredNode);
475
481
  return ref;
476
482
  }
483
+ function normalizeApplyPopup(desiredNode, context) {
484
+ var _a;
485
+ if (import_lodash.default.isUndefined(desiredNode.popup)) {
486
+ return void 0;
487
+ }
488
+ if (!import_lodash.default.isPlainObject(desiredNode.popup)) {
489
+ throw new import_errors.FlowSurfaceBadRequestError(`${context} popup must be an object`);
490
+ }
491
+ const invalidKeys = Object.keys(desiredNode.popup).filter((key) => !APPLY_POPUP_ALLOWED_KEYS.has(key));
492
+ if (invalidKeys.length) {
493
+ throw new import_errors.FlowSurfaceBadRequestError(
494
+ `${context} popup only supports ${Array.from(APPLY_POPUP_ALLOWED_KEYS).join(", ")} in flowSurfaces apply`
495
+ );
496
+ }
497
+ const hasPopupPageSpec = !!(0, import_matching.normalizeChildren)((_a = desiredNode.subModels) == null ? void 0 : _a.page)[0];
498
+ if (hasPopupPageSpec) {
499
+ throw new import_errors.FlowSurfaceBadRequestError(
500
+ `${context} cannot mix popup template semantics with explicit popup subtree content in flowSurfaces apply`
501
+ );
502
+ }
503
+ const nextPopup = import_lodash.default.cloneDeep(desiredNode.popup);
504
+ if (!import_lodash.default.isUndefined(nextPopup.tryTemplate) && typeof nextPopup.tryTemplate !== "boolean") {
505
+ throw new import_errors.FlowSurfaceBadRequestError(`${context} popup.tryTemplate must be a boolean`);
506
+ }
507
+ if (!import_lodash.default.isUndefined(nextPopup.defaultType) && nextPopup.defaultType !== "view" && nextPopup.defaultType !== "edit") {
508
+ throw new import_errors.FlowSurfaceBadRequestError(`${context} popup.defaultType must be 'view' or 'edit'`);
509
+ }
510
+ if (import_lodash.default.isUndefined(nextPopup.template) && nextPopup.tryTemplate !== true && import_lodash.default.isUndefined(nextPopup.defaultType)) {
511
+ return void 0;
512
+ }
513
+ if (!(0, import_placement.isPopupHostUse)(desiredNode.use)) {
514
+ throw new import_errors.FlowSurfaceBadRequestError(
515
+ `${context} popup is only supported on popup-capable action or field nodes in flowSurfaces apply`
516
+ );
517
+ }
518
+ return nextPopup;
519
+ }
520
+ function buildApplyPopupStepParams(use, popup) {
521
+ if (!popup) {
522
+ return void 0;
523
+ }
524
+ if (use === "UploadActionModel") {
525
+ return {
526
+ selectExitRecordSettings: {
527
+ openView: popup
528
+ }
529
+ };
530
+ }
531
+ return {
532
+ popupSettings: {
533
+ openView: popup
534
+ }
535
+ };
536
+ }
537
+ function withApplyPopupOpenViewForExistingNode(desiredNode, context) {
538
+ const popup = normalizeApplyPopup(desiredNode, context);
539
+ if (!popup) {
540
+ return desiredNode;
541
+ }
542
+ return {
543
+ ...desiredNode,
544
+ stepParams: import_lodash.default.merge({}, desiredNode.stepParams || {}, buildApplyPopupStepParams(desiredNode.use, popup))
545
+ };
546
+ }
477
547
  function createActionNode(ops, state, parentRef, desiredNode, currentParent) {
548
+ const popup = normalizeApplyPopup(desiredNode, `flowSurfaces apply action '${desiredNode.use}'`);
478
549
  const actionCatalogItem = (0, import_catalog.resolveSupportedActionCatalogItem)(
479
550
  {
480
551
  use: desiredNode.use,
@@ -496,7 +567,8 @@ function createActionNode(ops, state, parentRef, desiredNode, currentParent) {
496
567
  },
497
568
  ...desiredNode.clientKey ? { clientKey: desiredNode.clientKey } : {},
498
569
  type: actionCatalogItem.key,
499
- resourceInit: extractResourceInit(desiredNode)
570
+ resourceInit: extractResourceInit(desiredNode),
571
+ ...popup ? { popup } : {}
500
572
  }
501
573
  });
502
574
  const ref = {
@@ -509,8 +581,14 @@ function createActionNode(ops, state, parentRef, desiredNode, currentParent) {
509
581
  }
510
582
  function createFieldNode(ops, state, parentRef, desiredNode) {
511
583
  var _a;
584
+ const popup = normalizeApplyPopup(desiredNode, `flowSurfaces apply field '${desiredNode.use}'`);
512
585
  const standaloneType = desiredNode.use === "JSColumnModel" ? "jsColumn" : desiredNode.use === "JSItemModel" ? "jsItem" : void 0;
513
586
  if (standaloneType) {
587
+ if (popup) {
588
+ throw new import_errors.FlowSurfaceBadRequestError(
589
+ `flowSurfaces apply field '${desiredNode.use}' popup is not supported for standalone field types`
590
+ );
591
+ }
514
592
  const opId2 = nextOpId(state, "addField");
515
593
  ops.push({
516
594
  opId: opId2,
@@ -562,7 +640,8 @@ function createFieldNode(ops, state, parentRef, desiredNode) {
562
640
  collectionName: fieldInit.collectionName,
563
641
  ...requestedRenderer ? { renderer: requestedRenderer } : {},
564
642
  ...fieldCapability.fieldUse ? { fieldUse: fieldCapability.fieldUse } : {},
565
- ...defaultTargetUid ? { defaultTargetUid } : {}
643
+ ...defaultTargetUid ? { defaultTargetUid } : {},
644
+ ...popup ? { popup } : {}
566
645
  }
567
646
  });
568
647
  const ref = {
@@ -0,0 +1,84 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import _ from 'lodash';
10
+ import type FlowModelRepository from '../../repository';
11
+ type FlowSurfaceApprovalBlueprintBindingResource = 'workflows' | 'flow_nodes';
12
+ type ApprovalBlueprintServiceDeps = {
13
+ contractGuard: {
14
+ validateNodeTreeAgainstContract: (node: Record<string, any>) => void;
15
+ };
16
+ db: {
17
+ getRepository: (resourceName: string) => {
18
+ findOne: (options: Record<string, any>) => Promise<any>;
19
+ update: (options: Record<string, any>) => Promise<any>;
20
+ };
21
+ };
22
+ hasDataSource: (dataSourceKey: string) => boolean;
23
+ repository: Pick<FlowModelRepository, 'findModelById' | 'findModelByParentId' | 'insertModel' | 'upsertModel' | 'patch'>;
24
+ setNodeAsyncFlag: (uid: string, asyncFlag: boolean, transaction?: any) => Promise<void>;
25
+ removeNodeTreeWithBindings: (uid: string, transaction?: any) => Promise<void>;
26
+ surfaceContext: {
27
+ resolveGridNode: (uid: string, transaction?: any) => Promise<any>;
28
+ };
29
+ compose: (values: Record<string, any>, options: {
30
+ transaction?: any;
31
+ }) => Promise<any>;
32
+ addField: (values: Record<string, any>, options: {
33
+ transaction?: any;
34
+ }) => Promise<any>;
35
+ setLayout: (values: Record<string, any>, options: {
36
+ transaction?: any;
37
+ }) => Promise<any>;
38
+ get: (values: Record<string, any>, options: {
39
+ transaction?: any;
40
+ }) => Promise<any>;
41
+ buildComposeLayoutPayload: (input: {
42
+ layout: any;
43
+ createdByKey: Record<string, {
44
+ uid: string;
45
+ }>;
46
+ finalItems: any[];
47
+ }) => Record<string, any>;
48
+ syncApprovalRuntimeConfigForSurfaceRoot: (root: any, transaction?: any) => Promise<void>;
49
+ };
50
+ export declare class FlowSurfaceApprovalBlueprintService {
51
+ private readonly deps;
52
+ constructor(deps: ApprovalBlueprintServiceDeps);
53
+ private parseApprovalBlueprintCollection;
54
+ private resolveApprovalBlueprintBindingContext;
55
+ private buildApprovalBlueprintSurfaceRootTree;
56
+ private buildApprovalBlueprintPageSurfaceRootTree;
57
+ private getApprovalBlueprintExpectedTabUse;
58
+ private getApprovalBlueprintExpectedGridUse;
59
+ private findApprovalBlueprintSurfaceRoot;
60
+ private createApprovalBlueprintSurfaceRoot;
61
+ private ensureApprovalBlueprintPageSurfaceStructure;
62
+ private ensureApprovalBlueprintTaskCardSurfaceStructure;
63
+ private syncApprovalBlueprintSurfaceAsyncShape;
64
+ private syncApprovalBlueprintSurfaceRoot;
65
+ private ensureApprovalBlueprintSurfaceRoot;
66
+ private persistApprovalBlueprintBinding;
67
+ private applyApprovalBlueprintPageSurface;
68
+ private applyApprovalBlueprintTaskCardSurface;
69
+ applyApprovalBlueprint(values: Record<string, any>, options?: {
70
+ transaction?: any;
71
+ }): Promise<{
72
+ version: string;
73
+ mode: "replace";
74
+ surfaceType: "initiator" | "approver" | "taskCard";
75
+ target: _.Dictionary<any>;
76
+ binding: {
77
+ resourceName: FlowSurfaceApprovalBlueprintBindingResource;
78
+ filterByTk: string | number;
79
+ configPath: string;
80
+ };
81
+ surface: any;
82
+ }>;
83
+ }
84
+ export {};