@nocobase/plugin-flow-engine 2.0.0-alpha.23 → 2.0.0-alpha.24

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.23",
11
+ "@nocobase/client": "2.0.0-alpha.24",
12
12
  "lodash": "4.17.21",
13
- "@nocobase/database": "2.0.0-alpha.23",
14
- "@nocobase/data-source-manager": "2.0.0-alpha.23",
15
- "@nocobase/resourcer": "2.0.0-alpha.23",
16
- "@nocobase/server": "2.0.0-alpha.23",
17
- "@nocobase/cache": "2.0.0-alpha.23",
18
- "@nocobase/utils": "2.0.0-alpha.23",
19
- "@nocobase/plugin-localization": "2.0.0-alpha.23",
20
- "@nocobase/actions": "2.0.0-alpha.23"
13
+ "@nocobase/database": "2.0.0-alpha.24",
14
+ "@nocobase/data-source-manager": "2.0.0-alpha.24",
15
+ "@nocobase/resourcer": "2.0.0-alpha.24",
16
+ "@nocobase/server": "2.0.0-alpha.24",
17
+ "@nocobase/utils": "2.0.0-alpha.24",
18
+ "@nocobase/cache": "2.0.0-alpha.24",
19
+ "@nocobase/plugin-localization": "2.0.0-alpha.24",
20
+ "@nocobase/actions": "2.0.0-alpha.24"
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-10-25T15:29:57.807Z"}
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-10-26T10:30:14.651Z"}
@@ -12,10 +12,6 @@ export declare class PluginFlowEngineServer extends PluginUISchemaStorageServer
12
12
  afterAdd(): Promise<void>;
13
13
  beforeLoad(): Promise<void>;
14
14
  getDatabaseByDataSourceKey(dataSourceKey?: string): import("@nocobase/database").default;
15
- transformSQL(template: string): {
16
- sql: string;
17
- bind: {};
18
- };
19
15
  load(): Promise<void>;
20
16
  install(): Promise<void>;
21
17
  afterEnable(): Promise<void>;
@@ -45,6 +45,7 @@ var import_contexts = require("./template/contexts");
45
45
  var import_resolver = require("./template/resolver");
46
46
  var import_registry = require("./variables/registry");
47
47
  var import_utils = require("./variables/utils");
48
+ var import_utils2 = require("@nocobase/utils");
48
49
  class PluginFlowEngineServer extends import_server2.default {
49
50
  globalContext;
50
51
  async afterAdd() {
@@ -60,17 +61,6 @@ class PluginFlowEngineServer extends import_server2.default {
60
61
  }
61
62
  return cm.db;
62
63
  }
63
- transformSQL(template) {
64
- let index = 1;
65
- const bind = {};
66
- const sql = template.replace(/{{\s*([^}]+)\s*}}/g, (_, expr) => {
67
- const key = `__var${index}`;
68
- bind[key] = `{{${expr.trim()}}}`;
69
- index++;
70
- return `$${key}`;
71
- });
72
- return { sql, bind };
73
- }
74
64
  async load() {
75
65
  var _a, _b;
76
66
  await super.load();
@@ -133,14 +123,15 @@ class PluginFlowEngineServer extends import_server2.default {
133
123
  });
134
124
  this.app.resourceManager.registerActionHandlers({
135
125
  "flowSql:runById": async (ctx, next) => {
136
- const { uid, type, filter, bind, dataSourceKey = "main" } = ctx.action.params.values;
126
+ const { uid, type, filter, bind, liquidContext, dataSourceKey = "main" } = ctx.action.params.values;
137
127
  const r = this.db.getRepository("flowSql");
138
128
  const record = await r.findOne({
139
129
  filter: { uid }
140
130
  });
141
131
  const db = this.getDatabaseByDataSourceKey(record.dataSourceKey || dataSourceKey);
142
- const result = this.transformSQL(record.sql);
143
- ctx.body = await db.runSQL(result.sql, {
132
+ const result = await (0, import_utils2.transformSQL)(record.sql);
133
+ const sql = await (0, import_utils2.parseLiquidContext)(result.sql, liquidContext);
134
+ ctx.body = await db.runSQL(sql, {
144
135
  type,
145
136
  filter,
146
137
  bind
@@ -153,8 +144,11 @@ class PluginFlowEngineServer extends import_server2.default {
153
144
  const record = await r.findOne({
154
145
  filter: { uid }
155
146
  });
156
- const { bind } = this.transformSQL(record.sql);
157
- ctx.body = bind;
147
+ const { bind, liquidContext } = await (0, import_utils2.transformSQL)(record.sql);
148
+ ctx.body = {
149
+ bind,
150
+ liquidContext
151
+ };
158
152
  await next();
159
153
  },
160
154
  "flowSql:save": async (ctx, next) => {
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.23",
7
+ "version": "2.0.0-alpha.24",
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": "ea67a7ad1c12fce26e0fff992f33de10901eff6a"
27
+ "gitHead": "4e6d1ae61143f01aba213355b4c416aab4d64077"
28
28
  }