@nocobase/plugin-flow-engine 2.1.0-beta.24 → 2.1.0-beta.25

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 (30) hide show
  1. package/dist/ai/ai-employees/nathan/index.js +1 -0
  2. package/dist/externalVersion.js +10 -10
  3. package/dist/node_modules/ses/package.json +1 -1
  4. package/dist/node_modules/zod/package.json +1 -1
  5. package/dist/server/flow-surfaces/blueprint/compile-blocks.d.ts +2 -1
  6. package/dist/server/flow-surfaces/blueprint/compile-blocks.js +134 -14
  7. package/dist/server/flow-surfaces/blueprint/compile-plan.d.ts +2 -1
  8. package/dist/server/flow-surfaces/blueprint/compile-plan.js +8 -8
  9. package/dist/server/flow-surfaces/blueprint/normalize-document.js +5 -14
  10. package/dist/server/flow-surfaces/blueprint/private-utils.d.ts +0 -1
  11. package/dist/server/flow-surfaces/blueprint/private-utils.js +0 -3
  12. package/dist/server/flow-surfaces/blueprint/public-types.d.ts +1 -0
  13. package/dist/server/flow-surfaces/builder.d.ts +1 -0
  14. package/dist/server/flow-surfaces/builder.js +167 -53
  15. package/dist/server/flow-surfaces/catalog.js +58 -3
  16. package/dist/server/flow-surfaces/configure-options.js +4 -0
  17. package/dist/server/flow-surfaces/default-block-actions.js +11 -10
  18. package/dist/server/flow-surfaces/hidden-popup-calendar.d.ts +86 -0
  19. package/dist/server/flow-surfaces/hidden-popup-calendar.js +554 -0
  20. package/dist/server/flow-surfaces/hidden-popup-contract.d.ts +116 -0
  21. package/dist/server/flow-surfaces/hidden-popup-contract.js +611 -0
  22. package/dist/server/flow-surfaces/hidden-popup-kanban.d.ts +62 -0
  23. package/dist/server/flow-surfaces/hidden-popup-kanban.js +651 -0
  24. package/dist/server/flow-surfaces/placement.js +1 -0
  25. package/dist/server/flow-surfaces/public-compatibility.d.ts +12 -0
  26. package/dist/server/flow-surfaces/public-compatibility.js +24 -2
  27. package/dist/server/flow-surfaces/service.d.ts +54 -10
  28. package/dist/server/flow-surfaces/service.js +1355 -765
  29. package/dist/swagger/flow-surfaces.js +6 -6
  30. package/package.json +2 -2
@@ -32,6 +32,7 @@ module.exports = __toCommonJS(nathan_exports);
32
32
  var import_ai = require("@nocobase/ai");
33
33
  var nathan_default = (0, import_ai.defineAIEmployee)({
34
34
  username: "nathan",
35
+ category: "developer",
35
36
  description: "AI employee for coding",
36
37
  avatar: "nocobase-002-male",
37
38
  nickname: "Nathan",
@@ -8,16 +8,16 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.1.0-beta.24",
11
+ "@nocobase/client": "2.1.0-beta.25",
12
12
  "lodash": "4.18.1",
13
- "@nocobase/database": "2.1.0-beta.24",
14
- "@nocobase/data-source-manager": "2.1.0-beta.24",
15
- "@nocobase/resourcer": "2.1.0-beta.24",
16
- "@nocobase/utils": "2.1.0-beta.24",
17
- "@nocobase/cache": "2.1.0-beta.24",
18
- "@nocobase/plugin-localization": "2.1.0-beta.24",
19
- "@nocobase/server": "2.1.0-beta.24",
20
- "@nocobase/actions": "2.1.0-beta.24",
13
+ "@nocobase/database": "2.1.0-beta.25",
14
+ "@nocobase/data-source-manager": "2.1.0-beta.25",
15
+ "@nocobase/resourcer": "2.1.0-beta.25",
16
+ "@nocobase/utils": "2.1.0-beta.25",
17
+ "@nocobase/cache": "2.1.0-beta.25",
18
+ "@nocobase/plugin-localization": "2.1.0-beta.25",
19
+ "@nocobase/server": "2.1.0-beta.25",
20
+ "@nocobase/actions": "2.1.0-beta.25",
21
21
  "@formily/json-schema": "2.3.7",
22
- "@nocobase/ai": "2.1.0-beta.24"
22
+ "@nocobase/ai": "2.1.0-beta.25"
23
23
  };
@@ -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-29T08:16:19.164Z"}
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-05-06T11:08:08.197Z"}
@@ -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-29T08:16:20.198Z"}
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-05-06T11:08:09.236Z"}
@@ -7,8 +7,9 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import _ from 'lodash';
10
- import type { FlowSurfaceApplyBlueprintDocument, FlowSurfaceApplyBlueprintLayout, FlowSurfaceApplyBlueprintTabDocument } from './public-types';
10
+ import type { FlowSurfaceApplyBlueprintCollectionResolver, FlowSurfaceApplyBlueprintDocument, FlowSurfaceApplyBlueprintLayout, FlowSurfaceApplyBlueprintTabDocument } from './public-types';
11
11
  export declare function collectReferencedBlockKeys(layout: FlowSurfaceApplyBlueprintLayout | undefined, context: string): Set<string>;
12
12
  export declare function compileTabComposeValues(tab: FlowSurfaceApplyBlueprintTabDocument, document: FlowSurfaceApplyBlueprintDocument, tabIndex: number, options: {
13
13
  mode: 'append' | 'replace';
14
+ getCollection?: FlowSurfaceApplyBlueprintCollectionResolver;
14
15
  }): _.Dictionary<any>;
@@ -47,6 +47,8 @@ var import_default_block_actions = require("../default-block-actions");
47
47
  var import_public_data_surface_default_filter = require("../public-data-surface-default-filter");
48
48
  var import_public_compatibility = require("../public-compatibility");
49
49
  var import_defaults = require("./defaults");
50
+ var import_hidden_popup_contract = require("../hidden-popup-contract");
51
+ var import_service_helpers = require("../service-helpers");
50
52
  var import_private_utils = require("./private-utils");
51
53
  var import_field_type_resolver = require("../field-type-resolver");
52
54
  const APPLY_BLUEPRINT_BLOCK_TYPE_ENUM = [
@@ -155,7 +157,7 @@ const APPLY_BLUEPRINT_AUTO_PROMOTED_RECORD_ACTION_TYPES = /* @__PURE__ */ new Se
155
157
  "updateRecord",
156
158
  "duplicate"
157
159
  ]);
158
- const APPLY_BLUEPRINT_DEFAULT_POPUP_ACTION_TYPES = /* @__PURE__ */ new Set(["addNew", "view", "edit"]);
160
+ const APPLY_BLUEPRINT_DEFAULT_POPUP_ACTION_TYPES = /* @__PURE__ */ new Set(["addNew", "addChild", "view", "edit"]);
159
161
  const APPLY_BLUEPRINT_BLOCK_TYPES = new Set(APPLY_BLUEPRINT_BLOCK_TYPE_ENUM);
160
162
  const APPLY_BLUEPRINT_ADD_CHILD_RECORD_ACTION_ERROR = "type 'addChild' must be authored under recordActions and is only valid when the live target catalog.recordActions exposes it for a tree collection table with treeTable enabled";
161
163
  function assertNoBlockLevelLayout(input, context) {
@@ -163,6 +165,24 @@ function assertNoBlockLevelLayout(input, context) {
163
165
  (0, import_errors.throwBadRequest)(`${context}.layout is not supported; layout is only allowed on tabs[] and popup`);
164
166
  }
165
167
  }
168
+ function normalizeApplyBlueprintCalendarPopupSettings(settings, blockContext, defaultsMetadata) {
169
+ return (0, import_hidden_popup_contract.normalizeBlockHiddenPopupSettings)(
170
+ settings,
171
+ blockContext,
172
+ ["quickCreatePopup", "eventPopup"],
173
+ defaultsMetadata,
174
+ import_errors.throwBadRequest
175
+ );
176
+ }
177
+ function normalizeApplyBlueprintKanbanPopupSettings(settings, blockContext, defaultsMetadata) {
178
+ return (0, import_hidden_popup_contract.normalizeBlockHiddenPopupSettings)(
179
+ settings,
180
+ blockContext,
181
+ ["quickCreatePopup", "cardPopup"],
182
+ defaultsMetadata,
183
+ import_errors.throwBadRequest
184
+ );
185
+ }
166
186
  function assertApplyBlueprintFieldsLayoutHost(block, context) {
167
187
  if (!Object.prototype.hasOwnProperty.call(block, "fieldsLayout")) {
168
188
  return;
@@ -722,6 +742,10 @@ function shouldAttachDefaultPopupMetadata(popup, itemType, options = {}) {
722
742
  function attachCompiledPopupDefaults(popup, metadata) {
723
743
  return (0, import_defaults.attachFlowSurfaceApplyBlueprintPopupDefaults)(popup, metadata);
724
744
  }
745
+ function attachDefaultActionPopupMetadata(popup, actionType, metadata) {
746
+ const defaultPopup = actionType === "addChild" && import_lodash.default.isUndefined(popup) ? {} : popup;
747
+ return attachCompiledPopupDefaults(defaultPopup, metadata);
748
+ }
725
749
  function compilePopup(popup, scopePrefix, assets, context, defaults, options = {}) {
726
750
  if (import_lodash.default.isUndefined(popup)) {
727
751
  return {};
@@ -765,7 +789,8 @@ function compilePopup(popup, scopePrefix, assets, context, defaults, options = {
765
789
  assets,
766
790
  `${context}.blocks`,
767
791
  defaults,
768
- collectReferencedBlockKeys(popup.layout, `${context}.layout`)
792
+ collectReferencedBlockKeys(popup.layout, `${context}.layout`),
793
+ options.getCollection
769
794
  ) : { blocks: [], blockKeysByLocalKey: /* @__PURE__ */ new Map() };
770
795
  const layout = popupBlocks.length || popup.layout ? compileLayout(
771
796
  popup.layout || autoLayoutFromBlockKeys(compiledBlocks.blocks.map((block) => block.key)),
@@ -854,7 +879,7 @@ function compileTreeConnectSettingsTargets(settings, localBlockKeys, context) {
854
879
  });
855
880
  return nextSettings;
856
881
  }
857
- function compileField(input, index, scopePrefix, assets, localBlockKeys, context, popupDefaultsMetadata, defaults) {
882
+ function compileField(input, index, scopePrefix, assets, localBlockKeys, context, popupDefaultsMetadata, defaults, getCollection) {
858
883
  if (typeof input === "string") {
859
884
  const fieldPath2 = (0, import_private_utils.assertNonEmptyString)(input, `${context}[${index}]`);
860
885
  return {
@@ -890,7 +915,9 @@ function compileField(input, index, scopePrefix, assets, localBlockKeys, context
890
915
  if ((0, import_private_utils.readOptionalString)(input.label) && import_lodash.default.isUndefined(settings.label)) {
891
916
  settings.label = (0, import_private_utils.readOptionalString)(input.label);
892
917
  }
893
- const popupResult = compilePopup(input.popup, `${key}.popup`, assets, `${context}[${index}].popup`, defaults);
918
+ const popupResult = compilePopup(input.popup, `${key}.popup`, assets, `${context}[${index}].popup`, defaults, {
919
+ getCollection
920
+ });
894
921
  settings = resolvePopupTitleSettings(settings, popupResult.popupTitle);
895
922
  const popup = shouldAttachDefaultPopupMetadata(input.popup, void 0) ? attachCompiledPopupDefaults(popupResult.popup, popupDefaultsMetadata) : popupResult.popup;
896
923
  return (0, import_service_utils.buildDefinedPayload)({
@@ -911,13 +938,13 @@ function compileField(input, index, scopePrefix, assets, localBlockKeys, context
911
938
  popup
912
939
  });
913
940
  }
914
- function compileAction(input, index, scopePrefix, assets, context, popupDefaultsMetadata, defaults) {
941
+ function compileAction(input, index, scopePrefix, assets, context, popupDefaultsMetadata, defaults, getCollection) {
915
942
  if (typeof input === "string") {
916
943
  const type2 = (0, import_private_utils.assertNonEmptyString)(input, `${context}[${index}]`);
917
944
  return {
918
945
  key: (0, import_service_utils.normalizeFlowSurfaceComposeKey)((0, import_private_utils.buildScopedKey)(scopePrefix, `${type2}_${index + 1}`), `${context}[${index}]`),
919
946
  type: type2,
920
- ...APPLY_BLUEPRINT_DEFAULT_POPUP_ACTION_TYPES.has(type2) ? { popup: attachCompiledPopupDefaults(void 0, popupDefaultsMetadata) } : {}
947
+ ...APPLY_BLUEPRINT_DEFAULT_POPUP_ACTION_TYPES.has(type2) ? { popup: attachDefaultActionPopupMetadata(void 0, type2, popupDefaultsMetadata) } : {}
921
948
  };
922
949
  }
923
950
  if (!import_lodash.default.isPlainObject(input)) {
@@ -932,10 +959,11 @@ function compileAction(input, index, scopePrefix, assets, context, popupDefaults
932
959
  settings.title = (0, import_private_utils.readOptionalString)(input.title);
933
960
  }
934
961
  const popupResult = compilePopup(input.popup, `${key}.popup`, assets, `${context}[${index}].popup`, defaults, {
935
- ownerActionType: type
962
+ ownerActionType: type,
963
+ getCollection
936
964
  });
937
965
  settings = resolvePopupTitleSettings(settings, popupResult.popupTitle);
938
- const popup = shouldAttachDefaultPopupMetadata(input.popup, type) ? attachCompiledPopupDefaults(popupResult.popup, popupDefaultsMetadata) : popupResult.popup;
966
+ const popup = shouldAttachDefaultPopupMetadata(input.popup, type) ? attachDefaultActionPopupMetadata(popupResult.popup, type, popupDefaultsMetadata) : popupResult.popup;
939
967
  return (0, import_service_utils.buildDefinedPayload)({
940
968
  key,
941
969
  type,
@@ -955,7 +983,64 @@ function compileInjectedDefaultAction(descriptor, scopePrefix, context, index, p
955
983
  popup
956
984
  });
957
985
  }
958
- function compileBlocks(input, scopePrefix, assets, context, defaults, requiredExplicitBlockKeys = /* @__PURE__ */ new Set()) {
986
+ function isTreeCollection(collection) {
987
+ var _a;
988
+ return (collection == null ? void 0 : collection.template) === "tree" || ((_a = collection == null ? void 0 : collection.options) == null ? void 0 : _a.template) === "tree" || (collection == null ? void 0 : collection.tree) === true;
989
+ }
990
+ function resolveTreeChildrenFieldName(collection) {
991
+ const field = (0, import_service_helpers.getCollectionFields)(collection).find(
992
+ (candidate) => {
993
+ var _a;
994
+ return (candidate == null ? void 0 : candidate.treeChildren) === true || ((_a = candidate == null ? void 0 : candidate.options) == null ? void 0 : _a.treeChildren) === true;
995
+ }
996
+ );
997
+ return (0, import_service_helpers.getFieldName)(field);
998
+ }
999
+ function canInjectTreeTableAddChildDefault(block, getCollection) {
1000
+ if (!getCollection) {
1001
+ return false;
1002
+ }
1003
+ const resource = import_lodash.default.isPlainObject(block.resource) ? block.resource : void 0;
1004
+ const dataSourceKey = (0, import_private_utils.readOptionalString)(block.dataSourceKey) || (0, import_private_utils.readOptionalString)(resource == null ? void 0 : resource.dataSourceKey) || "main";
1005
+ const collectionName = (0, import_private_utils.readOptionalString)(block.collection) || (0, import_private_utils.readOptionalString)(resource == null ? void 0 : resource.collectionName);
1006
+ if (!collectionName) {
1007
+ return false;
1008
+ }
1009
+ const collection = getCollection(dataSourceKey, collectionName);
1010
+ if (!collection) {
1011
+ return false;
1012
+ }
1013
+ if (!isTreeCollection(collection)) {
1014
+ return false;
1015
+ }
1016
+ return !!resolveTreeChildrenFieldName(collection);
1017
+ }
1018
+ function hasExplicitAddChildRecordAction(recordActions) {
1019
+ return recordActions.some((action) => {
1020
+ if (typeof action === "string") {
1021
+ return action.trim() === "addChild";
1022
+ }
1023
+ return (0, import_private_utils.readOptionalString)(action == null ? void 0 : action.type) === "addChild";
1024
+ });
1025
+ }
1026
+ function buildTreeTableAddChildDefaultAction(scopePrefix, context, index, popupDefaultsMetadata) {
1027
+ const descriptorPopup = {
1028
+ tryTemplate: true,
1029
+ [import_default_block_actions.FLOW_SURFACE_INTERNAL_AUTO_SAVE_DEFAULT_POPUP_TEMPLATE_KEY]: true
1030
+ };
1031
+ return compileInjectedDefaultAction(
1032
+ {
1033
+ type: "addChild",
1034
+ scope: "recordActions",
1035
+ popup: descriptorPopup
1036
+ },
1037
+ scopePrefix,
1038
+ context,
1039
+ index,
1040
+ popupDefaultsMetadata
1041
+ );
1042
+ }
1043
+ function compileBlocks(input, scopePrefix, assets, context, defaults, requiredExplicitBlockKeys = /* @__PURE__ */ new Set(), getCollection) {
959
1044
  const blockKeysByLocalKey = /* @__PURE__ */ new Map();
960
1045
  const referencedBlockKeys = new Set(requiredExplicitBlockKeys);
961
1046
  const rawBlocks = import_lodash.default.castArray(input || []);
@@ -1026,6 +1111,11 @@ function compileBlocks(input, scopePrefix, assets, context, defaults, requiredEx
1026
1111
  type: blockType,
1027
1112
  settings
1028
1113
  });
1114
+ if (blockType === "calendar") {
1115
+ settings = normalizeApplyBlueprintCalendarPopupSettings(settings, blockContext, popupDefaultsMetadata);
1116
+ } else if (blockType === "kanban") {
1117
+ settings = normalizeApplyBlueprintKanbanPopupSettings(settings, blockContext, popupDefaultsMetadata);
1118
+ }
1029
1119
  const template = ensureOptionalTemplate(block.template, `${blockContext}.template`);
1030
1120
  const blockDefaultFilter = (0, import_public_data_surface_default_filter.normalizeFlowSurfacePublicBlockDefaultFilter)("applyBlueprint", block.defaultFilter, {
1031
1121
  blockType,
@@ -1047,7 +1137,8 @@ function compileBlocks(input, scopePrefix, assets, context, defaults, requiredEx
1047
1137
  blockKeysByLocalKey,
1048
1138
  `${blockContext}.fields`,
1049
1139
  popupDefaultsMetadata,
1050
- defaults
1140
+ defaults,
1141
+ getCollection
1051
1142
  )
1052
1143
  );
1053
1144
  const fieldsLayout = Object.prototype.hasOwnProperty.call(block, "fieldsLayout") ? compileScopedLayout(
@@ -1058,11 +1149,30 @@ function compileBlocks(input, scopePrefix, assets, context, defaults, requiredEx
1058
1149
  ) : buildAutoCompiledFieldsLayout(fields, (0, import_private_utils.readOptionalString)(block.type));
1059
1150
  const { actions, recordActions } = splitApplyBlueprintBlockActionsByScope(block, blockContext);
1060
1151
  const explicitActions = actions.map(
1061
- (action, actionIndex) => compileAction(action, actionIndex, key, assets, `${blockContext}.actions`, popupDefaultsMetadata, defaults)
1152
+ (action, actionIndex) => compileAction(
1153
+ action,
1154
+ actionIndex,
1155
+ key,
1156
+ assets,
1157
+ `${blockContext}.actions`,
1158
+ popupDefaultsMetadata,
1159
+ defaults,
1160
+ getCollection
1161
+ )
1062
1162
  );
1063
1163
  const explicitRecordActions = recordActions.map(
1064
- (action, actionIndex) => compileAction(action, actionIndex, key, assets, `${blockContext}.recordActions`, popupDefaultsMetadata, defaults)
1164
+ (action, actionIndex) => compileAction(
1165
+ action,
1166
+ actionIndex,
1167
+ key,
1168
+ assets,
1169
+ `${blockContext}.recordActions`,
1170
+ popupDefaultsMetadata,
1171
+ defaults,
1172
+ getCollection
1173
+ )
1065
1174
  );
1175
+ const shouldInjectAddChild = blockType === "table" && import_lodash.default.isUndefined(template) && (settings == null ? void 0 : settings.treeTable) === true && canInjectTreeTableAddChildDefault(block, getCollection);
1066
1176
  const injectedActionIndexes = {
1067
1177
  actions: explicitActions.length,
1068
1178
  recordActions: explicitRecordActions.length
@@ -1080,6 +1190,15 @@ function compileBlocks(input, scopePrefix, assets, context, defaults, requiredEx
1080
1190
  popupDefaultsMetadata
1081
1191
  )
1082
1192
  });
1193
+ const finalRecordActions = blockType === "table" && shouldInjectAddChild && !hasExplicitAddChildRecordAction(mergedActions.recordActions) ? [
1194
+ ...mergedActions.recordActions,
1195
+ buildTreeTableAddChildDefaultAction(
1196
+ key,
1197
+ `${blockContext}.recordActions`,
1198
+ injectedActionIndexes.recordActions++,
1199
+ popupDefaultsMetadata
1200
+ )
1201
+ ] : mergedActions.recordActions;
1083
1202
  const actionsWithDefaultFilter = (0, import_public_data_surface_default_filter.backfillFlowSurfaceFilterActionDefaultFilter)(
1084
1203
  mergedActions.actions,
1085
1204
  blockDefaultFilter
@@ -1093,7 +1212,7 @@ function compileBlocks(input, scopePrefix, assets, context, defaults, requiredEx
1093
1212
  fields: blockType === "calendar" || blockType === "tree" ? void 0 : fields,
1094
1213
  fieldsLayout: blockType === "calendar" || blockType === "kanban" || blockType === "tree" ? void 0 : fieldsLayout,
1095
1214
  actions: blockType === "tree" ? void 0 : actionsWithDefaultFilter,
1096
- recordActions: blockType === "calendar" || blockType === "kanban" || blockType === "tree" ? void 0 : mergedActions.recordActions
1215
+ recordActions: blockType === "calendar" || blockType === "kanban" || blockType === "tree" ? void 0 : finalRecordActions
1097
1216
  });
1098
1217
  });
1099
1218
  return {
@@ -1111,7 +1230,8 @@ function compileTabComposeValues(tab, document, tabIndex, options) {
1111
1230
  document.assets,
1112
1231
  blocksPath,
1113
1232
  document.defaults,
1114
- collectReferencedBlockKeys(tab.layout, layoutPath)
1233
+ collectReferencedBlockKeys(tab.layout, layoutPath),
1234
+ options.getCollection
1115
1235
  );
1116
1236
  const layout = compileLayout(
1117
1237
  tab.layout || autoLayoutFromBlockKeys(compiledBlocks.blocks.map((block) => block.key)),
@@ -6,8 +6,9 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import type { FlowSurfaceApplyBlueprintDocument, FlowSurfaceApplyBlueprintProgram, FlowSurfaceApplyBlueprintReplaceTargetInfo } from './public-types';
9
+ import type { FlowSurfaceApplyBlueprintCollectionResolver, FlowSurfaceApplyBlueprintDocument, FlowSurfaceApplyBlueprintProgram, FlowSurfaceApplyBlueprintReplaceTargetInfo } from './public-types';
10
10
  export declare function compileFlowSurfaceApplyBlueprintRequest(document: FlowSurfaceApplyBlueprintDocument, options?: {
11
11
  replaceTarget?: FlowSurfaceApplyBlueprintReplaceTargetInfo;
12
+ getCollection?: FlowSurfaceApplyBlueprintCollectionResolver;
12
13
  }): FlowSurfaceApplyBlueprintProgram;
13
14
  export declare function resolveApplyBlueprintPageLocator(program: FlowSurfaceApplyBlueprintProgram, executeResult: Record<string, any> | undefined): import("../types").FlowSurfaceReadLocator;
@@ -82,7 +82,7 @@ function buildTabSelectorFromUid(uid) {
82
82
  locator: { uid }
83
83
  };
84
84
  }
85
- function compileCreatePlan(document) {
85
+ function compileCreatePlan(document, getCollection) {
86
86
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
87
87
  const steps = [];
88
88
  const chrome = buildPageChrome(document);
@@ -134,7 +134,7 @@ function compileCreatePlan(document) {
134
134
  selectors: {
135
135
  target: buildTabSelectorFromStep(CREATE_PAGE_STEP_ID)
136
136
  },
137
- values: (0, import_compile_blocks.compileTabComposeValues)(document.tabs[0], document, 0, { mode: "append" })
137
+ values: (0, import_compile_blocks.compileTabComposeValues)(document.tabs[0], document, 0, { mode: "append", getCollection })
138
138
  });
139
139
  document.tabs.slice(1).forEach((tab, offset) => {
140
140
  const tabIndex = offset + 1;
@@ -161,7 +161,7 @@ function compileCreatePlan(document) {
161
161
  selectors: {
162
162
  target: buildTabSelectorFromStep(addTabStepId)
163
163
  },
164
- values: (0, import_compile_blocks.compileTabComposeValues)(tab, document, tabIndex, { mode: "append" })
164
+ values: (0, import_compile_blocks.compileTabComposeValues)(tab, document, tabIndex, { mode: "append", getCollection })
165
165
  });
166
166
  });
167
167
  steps.push(...(0, import_compile_reaction.compileReactionPlanSteps)(document.reaction));
@@ -182,7 +182,7 @@ function buildPageConfigureChanges(document) {
182
182
  displayTitle: (_f = document.page) == null ? void 0 : _f.displayTitle
183
183
  });
184
184
  }
185
- function compileReplacePlan(document, targetInfo) {
185
+ function compileReplacePlan(document, targetInfo, getCollection) {
186
186
  const steps = [];
187
187
  const pageChanges = buildPageConfigureChanges(document);
188
188
  if (Object.keys(pageChanges).length) {
@@ -225,7 +225,7 @@ function compileReplacePlan(document, targetInfo) {
225
225
  selectors: {
226
226
  target: buildTabSelectorFromUid(existingTab.uid)
227
227
  },
228
- values: (0, import_compile_blocks.compileTabComposeValues)(tab, document, index, { mode: "replace" })
228
+ values: (0, import_compile_blocks.compileTabComposeValues)(tab, document, index, { mode: "replace", getCollection })
229
229
  });
230
230
  return;
231
231
  }
@@ -253,7 +253,7 @@ function compileReplacePlan(document, targetInfo) {
253
253
  selectors: {
254
254
  target: buildTabSelectorFromStep(addTabStepId)
255
255
  },
256
- values: (0, import_compile_blocks.compileTabComposeValues)(tab, document, index, { mode: "append" })
256
+ values: (0, import_compile_blocks.compileTabComposeValues)(tab, document, index, { mode: "append", getCollection })
257
257
  });
258
258
  });
259
259
  targetInfo.tabs.slice(document.tabs.length).reverse().forEach((tab, index) => {
@@ -278,12 +278,12 @@ function compileReplacePlan(document, targetInfo) {
278
278
  }
279
279
  function compileFlowSurfaceApplyBlueprintRequest(document, options = {}) {
280
280
  if (document.mode === "create") {
281
- return compileCreatePlan(document);
281
+ return compileCreatePlan(document, options.getCollection);
282
282
  }
283
283
  if (!options.replaceTarget) {
284
284
  (0, import_errors.throwBadRequest)(`flowSurfaces applyBlueprint replace target resolution is missing`);
285
285
  }
286
- return compileReplacePlan(document, options.replaceTarget);
286
+ return compileReplacePlan(document, options.replaceTarget, options.getCollection);
287
287
  }
288
288
  function resolveApplyBlueprintPageLocator(program, executeResult) {
289
289
  var _a, _b, _c;
@@ -123,27 +123,18 @@ function normalizeNavigation(input) {
123
123
  if (!import_lodash.default.isUndefined(routeId) && !import_lodash.default.isString(routeId) && !import_lodash.default.isNumber(routeId)) {
124
124
  (0, import_errors.throwBadRequest)(`flowSurfaces applyBlueprint navigation.group.routeId must be a string or integer`);
125
125
  }
126
- if (!import_lodash.default.isUndefined(routeId) && (0, import_private_utils.readString)(input.group.title)) {
127
- (0, import_errors.throwBadRequest)(`flowSurfaces applyBlueprint navigation.group cannot mix routeId with title`);
128
- }
129
- const routeMetadataKeys = import_private_utils.APPLY_BLUEPRINT_CREATE_MENU_GROUP_METADATA_KEYS.filter(
130
- (key) => !import_lodash.default.isUndefined(input.group[key])
131
- );
132
- if (!import_lodash.default.isUndefined(routeId) && routeMetadataKeys.length) {
133
- (0, import_errors.throwBadRequest)(
134
- `flowSurfaces applyBlueprint navigation.group.routeId cannot mix with ${routeMetadataKeys.map((key) => `navigation.group.${key}`).join(
135
- ", "
136
- )}; applyBlueprint create mode does not update existing menu-group metadata. Use flowSurfaces:updateMenu separately if needed`
137
- );
126
+ if (!import_lodash.default.isUndefined(routeId)) {
127
+ return {
128
+ routeId
129
+ };
138
130
  }
139
131
  const normalized2 = (0, import_service_utils.buildDefinedPayload)({
140
- routeId: import_lodash.default.isUndefined(routeId) ? void 0 : routeId,
141
132
  title: (0, import_private_utils.readOptionalString)(input.group.title),
142
133
  icon: (0, import_private_utils.readOptionalString)(input.group.icon),
143
134
  tooltip: (0, import_private_utils.readOptionalString)(input.group.tooltip),
144
135
  hideInMenu: (0, import_private_utils.readBoolean)(input.group.hideInMenu, "flowSurfaces applyBlueprint navigation.group.hideInMenu")
145
136
  });
146
- if (import_lodash.default.isUndefined(normalized2.routeId) && !normalized2.title) {
137
+ if (!normalized2.title) {
147
138
  (0, import_errors.throwBadRequest)(`flowSurfaces applyBlueprint navigation.group requires routeId or title`);
148
139
  }
149
140
  return normalized2;
@@ -7,7 +7,6 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import type { FlowSurfaceApplyBlueprintAssetMap } from './public-types';
10
- export declare const APPLY_BLUEPRINT_CREATE_MENU_GROUP_METADATA_KEYS: readonly ["icon", "tooltip", "hideInMenu"];
11
10
  export declare function assertPlainObject(value: any, context: string): void;
12
11
  export declare function assertOnlyAllowedKeys(input: Record<string, any>, context: string, allowedKeys: string[]): void;
13
12
  export declare function normalizeApplyBlueprintToken(value: any, fallback?: string): string;
@@ -36,7 +36,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
36
36
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
37
  var private_utils_exports = {};
38
38
  __export(private_utils_exports, {
39
- APPLY_BLUEPRINT_CREATE_MENU_GROUP_METADATA_KEYS: () => APPLY_BLUEPRINT_CREATE_MENU_GROUP_METADATA_KEYS,
40
39
  assertNonEmptyString: () => assertNonEmptyString,
41
40
  assertOnlyAllowedKeys: () => assertOnlyAllowedKeys,
42
41
  assertPlainObject: () => assertPlainObject,
@@ -56,7 +55,6 @@ module.exports = __toCommonJS(private_utils_exports);
56
55
  var import_lodash = __toESM(require("lodash"));
57
56
  var import_errors = require("../errors");
58
57
  var import_service_utils = require("../service-utils");
59
- const APPLY_BLUEPRINT_CREATE_MENU_GROUP_METADATA_KEYS = ["icon", "tooltip", "hideInMenu"];
60
58
  function assertPlainObject(value, context) {
61
59
  if (!import_lodash.default.isPlainObject(value)) {
62
60
  (0, import_errors.throwBadRequest)(`${context} must be an object`);
@@ -164,7 +162,6 @@ function normalizeAssetRegistry(input, context) {
164
162
  }
165
163
  // Annotate the CommonJS export names for ESM import in node:
166
164
  0 && (module.exports = {
167
- APPLY_BLUEPRINT_CREATE_MENU_GROUP_METADATA_KEYS,
168
165
  assertNonEmptyString,
169
166
  assertOnlyAllowedKeys,
170
167
  assertPlainObject,
@@ -183,6 +183,7 @@ export type FlowSurfaceApplyBlueprintDocument = {
183
183
  assets: FlowSurfaceApplyBlueprintAssets;
184
184
  reaction?: FlowSurfaceApplyBlueprintReaction;
185
185
  };
186
+ export type FlowSurfaceApplyBlueprintCollectionResolver = (dataSourceKey: string | undefined, collectionName: string | undefined) => any;
186
187
  export type FlowSurfaceApplyBlueprintReplaceTargetInfo = {
187
188
  locator: FlowSurfaceReadLocator;
188
189
  pageUid: string;
@@ -82,6 +82,7 @@ export declare function buildBlockTree(options: {
82
82
  use?: string;
83
83
  containerUse?: string;
84
84
  resourceInit?: Record<string, any>;
85
+ enableDefaultSorting?: boolean;
85
86
  props?: Record<string, any>;
86
87
  decoratorProps?: Record<string, any>;
87
88
  stepParams?: Record<string, any>;