@nocobase/plugin-flow-engine 2.0.0-alpha.59 → 2.0.0-alpha.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,14 +8,14 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.0.0-alpha.59",
11
+ "@nocobase/client": "2.0.0-alpha.60",
12
12
  "lodash": "4.17.21",
13
- "@nocobase/database": "2.0.0-alpha.59",
14
- "@nocobase/data-source-manager": "2.0.0-alpha.59",
15
- "@nocobase/resourcer": "2.0.0-alpha.59",
16
- "@nocobase/server": "2.0.0-alpha.59",
17
- "@nocobase/utils": "2.0.0-alpha.59",
18
- "@nocobase/cache": "2.0.0-alpha.59",
19
- "@nocobase/plugin-localization": "2.0.0-alpha.59",
20
- "@nocobase/actions": "2.0.0-alpha.59"
13
+ "@nocobase/database": "2.0.0-alpha.60",
14
+ "@nocobase/data-source-manager": "2.0.0-alpha.60",
15
+ "@nocobase/resourcer": "2.0.0-alpha.60",
16
+ "@nocobase/server": "2.0.0-alpha.60",
17
+ "@nocobase/utils": "2.0.0-alpha.60",
18
+ "@nocobase/cache": "2.0.0-alpha.60",
19
+ "@nocobase/plugin-localization": "2.0.0-alpha.60",
20
+ "@nocobase/actions": "2.0.0-alpha.60"
21
21
  };
@@ -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":"2025-12-25T01:56:46.812Z"}
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":"2025-12-31T15:58:42.095Z"}
@@ -72,6 +72,7 @@ export declare class FlowModelRepository extends Repository {
72
72
  remove(uid: string, options?: Transactionable & removeParentOptions): Promise<void>;
73
73
  insertAdjacent(position: 'beforeBegin' | 'afterBegin' | 'beforeEnd' | 'afterEnd', target: string, schema: any, options?: InsertAdjacentOptions): Promise<any>;
74
74
  duplicate(modelUid: string, options?: Transactionable): Promise<any>;
75
+ private dedupeNodesForDuplicate;
75
76
  private replaceStepParamsModelUids;
76
77
  insert(schema: any, options?: Transactionable): Promise<any>;
77
78
  insertNewSchema(schema: any, options?: Transactionable & {
@@ -430,10 +430,11 @@ const _FlowModelRepository = class _FlowModelRepository extends import_database.
430
430
  return result;
431
431
  }
432
432
  async duplicate(modelUid, options) {
433
- const nodes = await this.findNodesById(modelUid, { ...options, includeAsyncNode: true });
433
+ let nodes = await this.findNodesById(modelUid, { ...options, includeAsyncNode: true });
434
434
  if (!(nodes == null ? void 0 : nodes.length)) {
435
435
  return null;
436
436
  }
437
+ nodes = this.dedupeNodesForDuplicate(nodes, modelUid);
437
438
  const uidMap = {};
438
439
  for (const n of nodes) {
439
440
  uidMap[n["uid"]] = (0, import_utils.uid)();
@@ -479,6 +480,51 @@ const _FlowModelRepository = class _FlowModelRepository extends import_database.
479
480
  }
480
481
  return this.findModelById(uidMap[modelUid], { ...options });
481
482
  }
483
+ dedupeNodesForDuplicate(nodes, rootUid) {
484
+ if (!Array.isArray(nodes) || nodes.length <= 1) {
485
+ return nodes;
486
+ }
487
+ const rowsByUid = import_lodash.default.groupBy(nodes, "uid");
488
+ const uniqueUids = Object.keys(rowsByUid);
489
+ if (uniqueUids.length === nodes.length) {
490
+ return nodes;
491
+ }
492
+ const uidsInSubtree = new Set(uniqueUids);
493
+ const rootDepthByUid = /* @__PURE__ */ new Map();
494
+ for (const uid2 of uniqueUids) {
495
+ const rows = rowsByUid[uid2] || [];
496
+ const depths = rows.map((row) => Number((row == null ? void 0 : row.depth) ?? 0));
497
+ rootDepthByUid.set(uid2, depths.length ? Math.min(...depths) : 0);
498
+ }
499
+ const pickRowForUid = (uid2, rows) => {
500
+ if (!(rows == null ? void 0 : rows.length)) return null;
501
+ if (rows.length === 1) return rows[0];
502
+ if (uid2 === rootUid) return rows[0];
503
+ let bestRow = rows[0];
504
+ let bestParentRootDepth = -1;
505
+ for (const row of rows) {
506
+ const parentUid = row == null ? void 0 : row.parent;
507
+ if (!parentUid || !uidsInSubtree.has(parentUid)) {
508
+ continue;
509
+ }
510
+ const parentRootDepth = rootDepthByUid.get(parentUid) ?? -1;
511
+ if (parentRootDepth > bestParentRootDepth) {
512
+ bestParentRootDepth = parentRootDepth;
513
+ bestRow = row;
514
+ }
515
+ }
516
+ return bestRow;
517
+ };
518
+ const uidsInQueryOrder = [];
519
+ const seenUidsInQueryOrder = /* @__PURE__ */ new Set();
520
+ for (const row of nodes) {
521
+ const uid2 = row == null ? void 0 : row.uid;
522
+ if (!uid2 || seenUidsInQueryOrder.has(uid2)) continue;
523
+ seenUidsInQueryOrder.add(uid2);
524
+ uidsInQueryOrder.push(uid2);
525
+ }
526
+ return uidsInQueryOrder.map((uid2) => pickRowForUid(uid2, rowsByUid[uid2])).filter(Boolean);
527
+ }
482
528
  replaceStepParamsModelUids(options, uidMap) {
483
529
  const opts = options && typeof options === "object" ? options : {};
484
530
  const replaceUidString = (v) => typeof v === "string" && uidMap[v] ? uidMap[v] : v;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "前端流引擎",
5
5
  "description": "",
6
6
  "description.zh-CN": "",
7
- "version": "2.0.0-alpha.59",
7
+ "version": "2.0.0-alpha.60",
8
8
  "main": "./dist/server/index.js",
9
9
  "license": "AGPL-3.0",
10
10
  "devDependencies": {
@@ -24,5 +24,5 @@
24
24
  "@nocobase/test": "2.x",
25
25
  "@nocobase/utils": "2.x"
26
26
  },
27
- "gitHead": "ca9fca2a826b17735c6287bebf877b2da9a00e24"
27
+ "gitHead": "9113d61ce85b60b7ba3d0e5ca64182d92a15ece4"
28
28
  }