@nocobase/plugin-flow-engine 2.1.0-beta.26 → 2.1.0-beta.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/ai-employees/nathan/prompt.md +46 -10
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/SKILLS.md +20 -3
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/lintAndTestJS.js +4 -2
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/patchJSCode.d.ts +10 -0
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/patchJSCode.js +65 -0
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/readJSCode.d.ts +10 -0
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/readJSCode.js +61 -0
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/writeJSCode.d.ts +10 -0
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/writeJSCode.js +65 -0
- package/dist/externalVersion.js +10 -10
- package/dist/node_modules/ses/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/flow-surfaces/route-sync.d.ts +4 -1
- package/dist/server/flow-surfaces/route-sync.js +4 -3
- package/dist/server/flow-surfaces/service.d.ts +2 -0
- package/dist/server/flow-surfaces/service.js +79 -31
- package/dist/server/migrations/20260508000000-remove-flow-model-options-runtime-uid.d.ts +13 -0
- package/dist/server/migrations/20260508000000-remove-flow-model-options-runtime-uid.js +67 -0
- package/package.json +2 -2
|
@@ -50,18 +50,32 @@ Follow this exact order. Do NOT skip ahead to coding.
|
|
|
50
50
|
|
|
51
51
|
2. Documentation lookup before writing any code
|
|
52
52
|
- Use `document-search` skill guidance.
|
|
53
|
-
- You MUST call
|
|
54
|
-
- `searchDocs`
|
|
55
|
-
- `readDocEntry`
|
|
53
|
+
- You MUST call `searchDocs`.
|
|
56
54
|
- Always search docs before coding when the task involves any of the following:
|
|
57
55
|
- RunJS / workflow / JS Block / JS Field / JS Item / JS Action / Event Flow / Linkage Rules
|
|
58
56
|
- `ctx` APIs, runtime constraints, rendering, routing, requests, imports, React, Antd
|
|
59
57
|
- any NocoBase-specific feature, component, schema, collection behavior, or API usage
|
|
60
58
|
- Do not rely on memory, prior experience, or "common NocoBase patterns" as a substitute for this step.
|
|
61
59
|
- Minimum requirement:
|
|
62
|
-
-
|
|
63
|
-
-
|
|
60
|
+
- use a compact Bash script that first searches file paths / filenames, then reads focused snippets from the best matches
|
|
61
|
+
- run broader content search only when path search is insufficient or ambiguous
|
|
64
62
|
- extract the concrete constraints or APIs you will rely on
|
|
63
|
+
- start narrow; prefer returning an initial answer once focused snippets confirm the needed constraints
|
|
64
|
+
- Prefer one combined `searchDocs` call over multiple small calls. Good pattern:
|
|
65
|
+
```bash
|
|
66
|
+
printf '## Candidate files\n'
|
|
67
|
+
rg --files interface-builder | grep -Ei 'runjs|js-|event|linkage' | head -50
|
|
68
|
+
|
|
69
|
+
printf '\n## JS Block\n'
|
|
70
|
+
sed -n '1,180p' interface-builder/blocks/other-blocks/js-block.md
|
|
71
|
+
|
|
72
|
+
printf '\n## RunJS\n'
|
|
73
|
+
sed -n '1,180p' interface-builder/runjs.md
|
|
74
|
+
```
|
|
75
|
+
- Avoid broad full-tree scans such as `find .` or `rg ... .`. Pick likely top-level directories first, then search inside them.
|
|
76
|
+
- Do not pipe output into `rg`; use `grep` for pipeline filtering, and call `rg --files <dir>` or `rg -n <pattern> <dir>` with explicit path arguments.
|
|
77
|
+
- Use `rg -g '*.md' -g '*.mdx'`; do not use unsupported `rg --include` options.
|
|
78
|
+
- Stop searching once the snippets directly confirm the API or constraint needed for the code. Do not read adjacent overview, quickstart, definition, lifecycle, or development pages just for extra background unless the user asks for more depth.
|
|
65
79
|
- Only after this step may you decide how to implement the solution.
|
|
66
80
|
|
|
67
81
|
3. Data inspection when data model is involved
|
|
@@ -81,10 +95,32 @@ Follow this exact order. Do NOT skip ahead to coding.
|
|
|
81
95
|
- `frontend-developer` is the implementation skill, not the starting shortcut.
|
|
82
96
|
- Never use `frontend-developer` alone as justification to begin coding.
|
|
83
97
|
- The code must be based on verified runtime context, verified documentation, and verified metadata when applicable.
|
|
98
|
+
- If you need to inspect the current editor code, call `readJSCode`. Never use `searchDocs` for current editor code, and never say the current code cannot be read.
|
|
99
|
+
- Call `readJSCode` before complex edits, after any failed patch, or whenever the current editor structure is uncertain.
|
|
100
|
+
- If the current work context already contains code and the user asks to add, modify, remove, fix, or extend behavior, call `patchJSCode` with a minimal patch instead of rewriting the whole editor.
|
|
101
|
+
- Call `writeJSCode` only when the editor is empty, the user asks for a complete replacement, or the change is truly a broad rewrite.
|
|
102
|
+
- For multiple independent localized edits, prefer sequential focused `patchJSCode` calls over one large patch.
|
|
103
|
+
- If a patch would change more than roughly 30 lines, replace a large function/component, or include large unchanged blocks, do not send a huge patch. Either split it into focused patches or use `writeJSCode` as a deliberate broad rewrite when the replacement is clearer than the diff.
|
|
104
|
+
- Do NOT put the complete code in a normal assistant message for validation.
|
|
84
105
|
|
|
85
106
|
6. Validate before output (REQUIRED)
|
|
86
|
-
- `lintAndTestJS` must pass before output.
|
|
87
|
-
- If validation fails,
|
|
107
|
+
- `lintAndTestJS` must pass before output. Omit the `code` argument so it validates the current editor code.
|
|
108
|
+
- If validation fails, do not guess or repeatedly patch from memory.
|
|
109
|
+
- Track the failing rule, line, and symbol. Do not make multiple cosmetic rewrites for the same diagnostic.
|
|
110
|
+
- Treat every validation failure as new evidence and classify it before changing code:
|
|
111
|
+
- Unknown or missing `ctx` member / runtime API / library exposure → call `getContextApis`, `getContextVars`, or `getContextEnvs` again, then search docs for that exact API or error.
|
|
112
|
+
- Unsupported syntax, sandbox restriction, import/render/request error, React/Antd usage error → call `searchDocs` again with the exact diagnostic text and the related feature keywords.
|
|
113
|
+
- Collection, field, relation, filter, or record-shape error → call the data metadata tools again for the exact collection or field involved.
|
|
114
|
+
- Plain JavaScript syntax or type error that is fully explained by the diagnostic → call `patchJSCode` with a minimal unified diff patch, then validate again.
|
|
115
|
+
- If one direct fix for the same lint rule still fails, stop changing that same expression. Re-read the exact code shape and consider whether the diagnostic is a static-check false positive or unsupported pattern before patching again.
|
|
116
|
+
- If `patchJSCode` fails to apply, call `readJSCode` before any retry, then decide whether a smaller patch or a full `writeJSCode` replacement is the clearer edit.
|
|
117
|
+
- After one failed direct fix, you MUST go back to runtime inspection, documentation lookup, metadata lookup, or ask the user before another code change.
|
|
118
|
+
- When calling `searchDocs` after validation failure, use a compact Bash script that searches the exact error text and nearby concepts, then reads focused snippets from likely matches.
|
|
119
|
+
- If the tools and docs still do not confirm the fix, stop and ask the user instead of trying another unverified implementation.
|
|
120
|
+
- When calling `patchJSCode`, provide only the unified diff patch. The tool reads the current editor code directly.
|
|
121
|
+
- Keep `patchJSCode` patches surgical: include only the changed lines plus the smallest necessary surrounding context.
|
|
122
|
+
- Do NOT rewrite the entire file, replace a whole component/function, or include unchanged large blocks in a patch unless the whole block genuinely changed.
|
|
123
|
+
- If more than roughly 30 lines would need to change, prefer `writeJSCode` only when this is a deliberate broad rewrite. For incremental requests, split into focused `patchJSCode` patches.
|
|
88
124
|
|
|
89
125
|
# Coding Rules
|
|
90
126
|
|
|
@@ -118,9 +154,9 @@ Never inject unsanitized user input into DOM.
|
|
|
118
154
|
# Output Rules
|
|
119
155
|
|
|
120
156
|
- Markdown
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
157
|
+
- Do NOT output a complete code block after using `writeJSCode` / `patchJSCode`.
|
|
158
|
+
- Final response should be brief: say that the code has been written to the editor and validation passed.
|
|
159
|
+
- If validation cannot pass, summarize the blocking diagnostics and ask for the missing verified information.
|
|
124
160
|
|
|
125
161
|
# Standard
|
|
126
162
|
|
|
@@ -23,23 +23,40 @@ When helping users with JavaScript code, follow this process:
|
|
|
23
23
|
|
|
24
24
|
2. **Write the Code**
|
|
25
25
|
- Write clean, correct JavaScript/JSX code based on the user's requirements
|
|
26
|
+
- Use `readJSCode` before complex edits, after any patch failure, or whenever the current editor structure is uncertain. Never use documentation search to read current editor code.
|
|
27
|
+
- If the current work context already contains code and the user asks to add, modify, remove, fix, or extend behavior, use `patchJSCode` with a minimal patch instead of rewriting the whole editor
|
|
28
|
+
- Use `writeJSCode` only when the editor is empty, the user asks for a complete replacement, or the change is truly a broad rewrite
|
|
29
|
+
- If an edit would require a large patch, split it into focused patches. If the change replaces a large function/component or the patch would be larger than the full replacement, use `writeJSCode` as a deliberate broad rewrite.
|
|
26
30
|
- Ensure the code follows best practices for NocoBase workflows
|
|
27
31
|
|
|
28
32
|
3. **Validate the Code**
|
|
29
|
-
- Use `lintAndTestJS` to lint and test the code before final output
|
|
30
|
-
- Fix
|
|
33
|
+
- Use `lintAndTestJS` with no `code` argument to lint and test the current editor code before final output
|
|
34
|
+
- Fix plain JavaScript syntax errors directly when the diagnostic fully explains the problem
|
|
35
|
+
- Use `patchJSCode` with a minimal unified diff patch for follow-up fixes instead of rewriting the full code
|
|
36
|
+
- Track the failing rule, line, and symbol. If one direct fix for the same lint rule still fails, stop changing the same expression and gather new evidence instead of trying cosmetic rewrites.
|
|
37
|
+
- Keep patches surgical: include only changed lines plus the smallest necessary context. Do not include unchanged large blocks or rewrite entire components/functions unless they genuinely changed.
|
|
38
|
+
- If `patchJSCode` fails to apply, call `readJSCode` before retrying. Do not say the current code cannot be read.
|
|
39
|
+
- If the error involves NocoBase runtime APIs, `ctx`, sandbox restrictions, imports, rendering, React, Antd, requests, collections, fields, or record structure, do not guess. Go back to the relevant inspection or documentation tools before changing code:
|
|
40
|
+
- Runtime exposure errors: call `getContextEnvs`, `getContextVars`, or `getContextApis` again
|
|
41
|
+
- NocoBase API / runtime / sandbox / UI errors: use the documentation search skill again with the exact error and relevant feature keywords
|
|
42
|
+
- Data model errors: use data metadata tools again for the exact collection, field, or relation
|
|
43
|
+
- After one failed direct fix, you must gather new evidence from tools or docs before another code change
|
|
31
44
|
- Do not output final code unless it passes validation
|
|
32
45
|
|
|
33
46
|
4. **Submit the Code**
|
|
34
47
|
- Once validated, provide the final code to the user
|
|
35
48
|
- Explain how the code works and what it does
|
|
49
|
+
- If `lintAndTestJS` validated and ran the current editor code successfully, remind the user that the code has not been saved permanently yet and they should click the save button manually.
|
|
36
50
|
|
|
37
51
|
# Available Tools
|
|
38
52
|
|
|
39
53
|
- `getContextVars`: Retrieves available variables from the current context. Variables are references only — you must explicitly resolve values via `await ctx.getVar(path)`. Supports dot-notation for progressive drilling (e.g., `ctx.popup.record.id`).
|
|
40
54
|
- `getContextApis`: Returns available API methods from the context that can be used in the code.
|
|
41
55
|
- `getContextEnvs`: Returns metadata about the current page, block, or flow model.
|
|
42
|
-
- `
|
|
56
|
+
- `readJSCode`: Reads the complete JavaScript/JSX code currently in the active editor. Use before complex patches, after patch failure, or whenever the current editor structure is uncertain.
|
|
57
|
+
- `writeJSCode`: Writes complete JavaScript/JSX code directly into the current editor and returns write metadata. Use only for an empty editor, explicit complete replacement, or deliberate broad rewrite.
|
|
58
|
+
- `patchJSCode`: Applies a minimal unified diff patch to the current editor code and writes it back. Provide only the patch; the tool reads the current editor code directly.
|
|
59
|
+
- `lintAndTestJS`: Lints, performs sandbox checks, and trial-runs the current editor JavaScript/JSX code. Returns success/failure with diagnostics. **Always call this tool before final response to verify it works.**
|
|
43
60
|
|
|
44
61
|
# Code Writing Guidelines
|
|
45
62
|
|
|
@@ -41,9 +41,11 @@ var lintAndTestJS_default = (0, import_ai.defineTools)({
|
|
|
41
41
|
},
|
|
42
42
|
definition: {
|
|
43
43
|
name: "lintAndTestJS",
|
|
44
|
-
description: "Lint, sandbox-check and trial-run
|
|
44
|
+
description: "Lint, sandbox-check and trial-run the current editor JavaScript/JSX code. Returns success/failure with diagnostics. Call this tool after writeJSCode or patchJSCode before final response.",
|
|
45
45
|
schema: import_zod.z.object({
|
|
46
|
-
code: import_zod.z.string().describe(
|
|
46
|
+
code: import_zod.z.string().optional().describe(
|
|
47
|
+
"Optional JavaScript/JSX code to preview and validate. Omit this to validate the current editor code."
|
|
48
|
+
)
|
|
47
49
|
})
|
|
48
50
|
},
|
|
49
51
|
invoke: async (ctx, _args, runtime) => {
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
declare const _default: import("@nocobase/ai").ToolsOptions;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var patchJSCode_exports = {};
|
|
28
|
+
__export(patchJSCode_exports, {
|
|
29
|
+
default: () => patchJSCode_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(patchJSCode_exports);
|
|
32
|
+
var import_ai = require("@nocobase/ai");
|
|
33
|
+
var import_zod = require("zod");
|
|
34
|
+
var patchJSCode_default = (0, import_ai.defineTools)({
|
|
35
|
+
scope: "SPECIFIED",
|
|
36
|
+
execution: "frontend",
|
|
37
|
+
defaultPermission: "ALLOW",
|
|
38
|
+
introduction: {
|
|
39
|
+
title: `{{t("ai.tools.patchJSCode.title")}}`,
|
|
40
|
+
about: `{{t("ai.tools.patchJSCode.about")}}`
|
|
41
|
+
},
|
|
42
|
+
definition: {
|
|
43
|
+
name: "patchJSCode",
|
|
44
|
+
description: "Apply a minimal unified diff patch to the code currently in the editor, then write the patched code back to the editor. Use this for adding, modifying, removing, fixing, or extending existing code. The tool reads the current editor code directly; only provide the patch. Keep patches surgical: include only changed lines plus the smallest necessary context, and do not include unchanged large blocks.",
|
|
45
|
+
schema: import_zod.z.object({
|
|
46
|
+
patch: import_zod.z.string().describe(
|
|
47
|
+
"Minimal unified diff patch to apply to the current editor code. Include only changed lines plus the smallest necessary context."
|
|
48
|
+
)
|
|
49
|
+
})
|
|
50
|
+
},
|
|
51
|
+
invoke: async (ctx, _args, runtime) => {
|
|
52
|
+
const { toolCallResults } = ctx.action.params.values || {};
|
|
53
|
+
const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id === runtime.toolCallId)) ?? {};
|
|
54
|
+
if (toolCallResults && result) {
|
|
55
|
+
return {
|
|
56
|
+
status: result.status ?? "error",
|
|
57
|
+
content: JSON.stringify(result.content ?? {})
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
status: "error",
|
|
62
|
+
content: JSON.stringify({ success: false, message: "Patch code failed: no result returned" })
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
declare const _default: import("@nocobase/ai").ToolsOptions;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var readJSCode_exports = {};
|
|
28
|
+
__export(readJSCode_exports, {
|
|
29
|
+
default: () => readJSCode_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(readJSCode_exports);
|
|
32
|
+
var import_ai = require("@nocobase/ai");
|
|
33
|
+
var import_zod = require("zod");
|
|
34
|
+
var readJSCode_default = (0, import_ai.defineTools)({
|
|
35
|
+
scope: "SPECIFIED",
|
|
36
|
+
execution: "frontend",
|
|
37
|
+
defaultPermission: "ALLOW",
|
|
38
|
+
introduction: {
|
|
39
|
+
title: `{{t("ai.tools.readJSCode.title")}}`,
|
|
40
|
+
about: `{{t("ai.tools.readJSCode.about")}}`
|
|
41
|
+
},
|
|
42
|
+
definition: {
|
|
43
|
+
name: "readJSCode",
|
|
44
|
+
description: "Read the complete JavaScript/JSX code currently in the active editor. Use before complex patches, after patchJSCode fails, or whenever the current editor structure is uncertain. Do not use searchDocs to read editor code.",
|
|
45
|
+
schema: import_zod.z.object({})
|
|
46
|
+
},
|
|
47
|
+
invoke: async (ctx, _args, runtime) => {
|
|
48
|
+
const { toolCallResults } = ctx.action.params.values || {};
|
|
49
|
+
const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id === runtime.toolCallId)) ?? {};
|
|
50
|
+
if (toolCallResults && result) {
|
|
51
|
+
return {
|
|
52
|
+
status: result.status ?? "error",
|
|
53
|
+
content: JSON.stringify(result.content ?? {})
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
status: "error",
|
|
58
|
+
content: JSON.stringify({ success: false, message: "Read code failed: no result returned" })
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
declare const _default: import("@nocobase/ai").ToolsOptions;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var writeJSCode_exports = {};
|
|
28
|
+
__export(writeJSCode_exports, {
|
|
29
|
+
default: () => writeJSCode_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(writeJSCode_exports);
|
|
32
|
+
var import_ai = require("@nocobase/ai");
|
|
33
|
+
var import_zod = require("zod");
|
|
34
|
+
var writeJSCode_default = (0, import_ai.defineTools)({
|
|
35
|
+
scope: "SPECIFIED",
|
|
36
|
+
execution: "frontend",
|
|
37
|
+
defaultPermission: "ALLOW",
|
|
38
|
+
introduction: {
|
|
39
|
+
title: `{{t("ai.tools.writeJSCode.title")}}`,
|
|
40
|
+
about: `{{t("ai.tools.writeJSCode.about")}}`
|
|
41
|
+
},
|
|
42
|
+
definition: {
|
|
43
|
+
name: "writeJSCode",
|
|
44
|
+
description: "Write complete JavaScript/JSX code into the current code editor. Use only when the editor is empty, the user asks for a complete replacement, or the change is a deliberate broad rewrite. For adding, modifying, fixing, or extending existing code, use patchJSCode instead.",
|
|
45
|
+
schema: import_zod.z.object({
|
|
46
|
+
code: import_zod.z.string().describe(
|
|
47
|
+
"The complete JavaScript/JSX code to write into the current editor. Do not use for small incremental changes to existing code."
|
|
48
|
+
)
|
|
49
|
+
})
|
|
50
|
+
},
|
|
51
|
+
invoke: async (ctx, _args, runtime) => {
|
|
52
|
+
const { toolCallResults } = ctx.action.params.values || {};
|
|
53
|
+
const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id === runtime.toolCallId)) ?? {};
|
|
54
|
+
if (toolCallResults && result) {
|
|
55
|
+
return {
|
|
56
|
+
status: result.status ?? "error",
|
|
57
|
+
content: JSON.stringify(result.content ?? {})
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
status: "error",
|
|
62
|
+
content: JSON.stringify({ success: false, message: "Write code failed: no result returned" })
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
});
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.1.0-beta.
|
|
11
|
+
"@nocobase/client": "2.1.0-beta.29",
|
|
12
12
|
"lodash": "4.18.1",
|
|
13
|
-
"@nocobase/database": "2.1.0-beta.
|
|
14
|
-
"@nocobase/data-source-manager": "2.1.0-beta.
|
|
15
|
-
"@nocobase/resourcer": "2.1.0-beta.
|
|
16
|
-
"@nocobase/utils": "2.1.0-beta.
|
|
17
|
-
"@nocobase/cache": "2.1.0-beta.
|
|
18
|
-
"@nocobase/plugin-localization": "2.1.0-beta.
|
|
19
|
-
"@nocobase/server": "2.1.0-beta.
|
|
20
|
-
"@nocobase/actions": "2.1.0-beta.
|
|
13
|
+
"@nocobase/database": "2.1.0-beta.29",
|
|
14
|
+
"@nocobase/data-source-manager": "2.1.0-beta.29",
|
|
15
|
+
"@nocobase/resourcer": "2.1.0-beta.29",
|
|
16
|
+
"@nocobase/utils": "2.1.0-beta.29",
|
|
17
|
+
"@nocobase/cache": "2.1.0-beta.29",
|
|
18
|
+
"@nocobase/plugin-localization": "2.1.0-beta.29",
|
|
19
|
+
"@nocobase/server": "2.1.0-beta.29",
|
|
20
|
+
"@nocobase/actions": "2.1.0-beta.29",
|
|
21
21
|
"@formily/json-schema": "2.3.7",
|
|
22
|
-
"@nocobase/ai": "2.1.0-beta.
|
|
22
|
+
"@nocobase/ai": "2.1.0-beta.29"
|
|
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-05-
|
|
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-10T15:05:41.221Z"}
|
|
@@ -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-05-
|
|
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-10T15:05:42.311Z"}
|
|
@@ -10,7 +10,10 @@ import FlowModelRepository from '../repository';
|
|
|
10
10
|
export declare class FlowSurfaceRouteSync {
|
|
11
11
|
private readonly db;
|
|
12
12
|
private readonly repository;
|
|
13
|
-
|
|
13
|
+
private readonly patchModel;
|
|
14
|
+
constructor(db: any, repository: FlowModelRepository, patchModel?: (values: Record<string, any>, options?: {
|
|
15
|
+
transaction?: any;
|
|
16
|
+
}) => Promise<any>);
|
|
14
17
|
buildPageTree(pageRouteLike: any, transaction?: any): Promise<any>;
|
|
15
18
|
buildTabAnchor(tabRouteLike: any, transaction?: any): Promise<{
|
|
16
19
|
subModels?: {
|
|
@@ -42,9 +42,10 @@ module.exports = __toCommonJS(route_sync_exports);
|
|
|
42
42
|
var import_lodash = __toESM(require("lodash"));
|
|
43
43
|
var import_builder = require("./builder");
|
|
44
44
|
class FlowSurfaceRouteSync {
|
|
45
|
-
constructor(db, repository) {
|
|
45
|
+
constructor(db, repository, patchModel = (values, options) => repository.patch(values, options)) {
|
|
46
46
|
this.db = db;
|
|
47
47
|
this.repository = repository;
|
|
48
|
+
this.patchModel = patchModel;
|
|
48
49
|
}
|
|
49
50
|
async buildPageTree(pageRouteLike, transaction) {
|
|
50
51
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -182,7 +183,7 @@ class FlowSurfaceRouteSync {
|
|
|
182
183
|
includeAsyncNode: true
|
|
183
184
|
}) : null);
|
|
184
185
|
if (pageModel == null ? void 0 : pageModel.uid) {
|
|
185
|
-
await this.
|
|
186
|
+
await this.patchModel(
|
|
186
187
|
{
|
|
187
188
|
...this.normalizePagePayload(current, nextPayload, routeValues),
|
|
188
189
|
uid: pageModel.uid
|
|
@@ -206,7 +207,7 @@ class FlowSurfaceRouteSync {
|
|
|
206
207
|
return;
|
|
207
208
|
}
|
|
208
209
|
const latestRoute = await this.hydrateRoute(target.tabRoute, transaction);
|
|
209
|
-
await this.
|
|
210
|
+
await this.patchModel(
|
|
210
211
|
this.normalizeTabPayload(await this.buildTabAnchor(latestRoute, transaction), nextPayload, routeValues),
|
|
211
212
|
{ transaction }
|
|
212
213
|
);
|
|
@@ -49,6 +49,8 @@ export declare class FlowSurfacesService {
|
|
|
49
49
|
private get approvalRuntimeConfigService();
|
|
50
50
|
private get approvalBlueprintService();
|
|
51
51
|
private get hiddenPopupRuntime();
|
|
52
|
+
private normalizeFlowSurfaceModelOptionsPatch;
|
|
53
|
+
private patchFlowSurfaceModelOptions;
|
|
52
54
|
private setFlowModelNodeAsyncFlag;
|
|
53
55
|
private loadEnabledPluginPackages;
|
|
54
56
|
private resolveEnabledPluginPackages;
|
|
@@ -296,6 +296,7 @@ const POPUP_ASSOCIATED_RECORDS_BLOCK_USES = /* @__PURE__ */ new Set([
|
|
|
296
296
|
"MapBlockModel",
|
|
297
297
|
"CommentsBlockModel"
|
|
298
298
|
]);
|
|
299
|
+
const FLOW_SURFACE_MODEL_OPTION_PATCH_OMIT_KEYS = ["uid", "name", "options"];
|
|
299
300
|
const POPUP_COLLECTION_BLOCK_SCENES = {
|
|
300
301
|
CreateFormModel: ["new"],
|
|
301
302
|
EditFormModel: ["one", "many"],
|
|
@@ -448,7 +449,11 @@ class FlowSurfacesService {
|
|
|
448
449
|
return new import_locator.SurfaceLocator(this.db, this.repository);
|
|
449
450
|
}
|
|
450
451
|
get routeSync() {
|
|
451
|
-
return new import_route_sync.FlowSurfaceRouteSync(
|
|
452
|
+
return new import_route_sync.FlowSurfaceRouteSync(
|
|
453
|
+
this.db,
|
|
454
|
+
this.repository,
|
|
455
|
+
(values, options) => this.patchFlowSurfaceModelOptions(values, options)
|
|
456
|
+
);
|
|
452
457
|
}
|
|
453
458
|
getFlowTemplateRepository(actionName) {
|
|
454
459
|
try {
|
|
@@ -524,7 +529,13 @@ class FlowSurfacesService {
|
|
|
524
529
|
var _a, _b;
|
|
525
530
|
return !!((_b = (_a = this.plugin.app.dataSourceManager) == null ? void 0 : _a.get) == null ? void 0 : _b.call(_a, dataSourceKey));
|
|
526
531
|
},
|
|
527
|
-
repository:
|
|
532
|
+
repository: {
|
|
533
|
+
findModelById: (uid2, options) => this.repository.findModelById(uid2, options),
|
|
534
|
+
findModelByParentId: (parentUid, options) => this.repository.findModelByParentId(parentUid, options),
|
|
535
|
+
insertModel: (model, options) => this.repository.insertModel(model, options),
|
|
536
|
+
upsertModel: (model, options) => this.repository.upsertModel(model, options),
|
|
537
|
+
patch: (values, options) => this.patchFlowSurfaceModelOptions(values, options)
|
|
538
|
+
},
|
|
528
539
|
setNodeAsyncFlag: (uid2, asyncFlag, transaction) => this.setFlowModelNodeAsyncFlag(uid2, asyncFlag, transaction),
|
|
529
540
|
removeNodeTreeWithBindings: (uid2, transaction) => this.removeNodeTreeWithBindings(uid2, transaction),
|
|
530
541
|
surfaceContext: this.surfaceContext,
|
|
@@ -538,7 +549,11 @@ class FlowSurfacesService {
|
|
|
538
549
|
}
|
|
539
550
|
get hiddenPopupRuntime() {
|
|
540
551
|
return {
|
|
541
|
-
repository:
|
|
552
|
+
repository: {
|
|
553
|
+
findModelById: (uid2, options) => this.repository.findModelById(uid2, options),
|
|
554
|
+
patch: (values, options) => this.patchFlowSurfaceModelOptions(values, options),
|
|
555
|
+
upsertModel: (model, options) => this.repository.upsertModel(model, options)
|
|
556
|
+
},
|
|
542
557
|
buildPopupOpenViewWithTemplate: (input) => this.buildPopupOpenViewWithTemplate(input),
|
|
543
558
|
clearFlowTemplateUsagesForNodeTree: (uid2, transaction) => this.clearFlowTemplateUsagesForNodeTree(uid2, transaction),
|
|
544
559
|
ensurePopupHostDefaultContent: (input) => this.ensurePopupHostDefaultContent(input),
|
|
@@ -547,6 +562,39 @@ class FlowSurfacesService {
|
|
|
547
562
|
syncFlowTemplateUsagesForNodeTree: (uid2, transaction) => this.syncFlowTemplateUsagesForNodeTree(uid2, transaction)
|
|
548
563
|
};
|
|
549
564
|
}
|
|
565
|
+
normalizeFlowSurfaceModelOptionsPatch(values) {
|
|
566
|
+
return import_lodash.default.omit(import_lodash.default.cloneDeep(values || {}), FLOW_SURFACE_MODEL_OPTION_PATCH_OMIT_KEYS);
|
|
567
|
+
}
|
|
568
|
+
async patchFlowSurfaceModelOptions(values, options = {}) {
|
|
569
|
+
const normalizedUid = String((values == null ? void 0 : values.uid) || "").trim();
|
|
570
|
+
if (!normalizedUid) {
|
|
571
|
+
(0, import_errors.throwBadRequest)("flowSurfaces model patch requires uid");
|
|
572
|
+
}
|
|
573
|
+
const model = await this.repository.model.findByPk(normalizedUid, {
|
|
574
|
+
transaction: options.transaction
|
|
575
|
+
});
|
|
576
|
+
if (!model) {
|
|
577
|
+
(0, import_errors.throwBadRequest)(`flowSurfaces model '${normalizedUid}' does not exist`);
|
|
578
|
+
}
|
|
579
|
+
const currentOptions = import_repository.default.optionsToJson(model.get("options") || {});
|
|
580
|
+
const nextOptions = {
|
|
581
|
+
...currentOptions,
|
|
582
|
+
...this.normalizeFlowSurfaceModelOptionsPatch(values)
|
|
583
|
+
};
|
|
584
|
+
delete nextOptions.uid;
|
|
585
|
+
delete nextOptions.name;
|
|
586
|
+
delete nextOptions.options;
|
|
587
|
+
model.set("options", nextOptions);
|
|
588
|
+
await model.save({
|
|
589
|
+
transaction: options.transaction,
|
|
590
|
+
hooks: false
|
|
591
|
+
});
|
|
592
|
+
await this.repository.clearXUidPathCache(normalizedUid, options.transaction);
|
|
593
|
+
await this.repository.emitAfterSaveEvent(model, options);
|
|
594
|
+
if (values == null ? void 0 : values["x-server-hooks"]) {
|
|
595
|
+
await this.db.emitAsync(`${this.repository.collection.name}.afterSave`, model, options);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
550
598
|
async setFlowModelNodeAsyncFlag(uid2, asyncFlag, transaction) {
|
|
551
599
|
var _a, _b;
|
|
552
600
|
const sequelize = (_a = this.db) == null ? void 0 : _a.sequelize;
|
|
@@ -2048,7 +2096,7 @@ class FlowSurfacesService {
|
|
|
2048
2096
|
} else {
|
|
2049
2097
|
import_lodash.default.set(nextStepParams, [slot.flowKey, slot.stepKey, slot.valuePath], import_lodash.default.cloneDeep(canonicalRules));
|
|
2050
2098
|
}
|
|
2051
|
-
await this.
|
|
2099
|
+
await this.patchFlowSurfaceModelOptions(
|
|
2052
2100
|
{
|
|
2053
2101
|
uid: targetUid,
|
|
2054
2102
|
stepParams: nextStepParams
|
|
@@ -2351,13 +2399,13 @@ class FlowSurfacesService {
|
|
|
2351
2399
|
async patchDeclaredKeyModel(values, options) {
|
|
2352
2400
|
const normalizedUid = String((values == null ? void 0 : values.uid) || "").trim();
|
|
2353
2401
|
if (!normalizedUid) {
|
|
2354
|
-
return this.
|
|
2402
|
+
return this.patchFlowSurfaceModelOptions(values, options);
|
|
2355
2403
|
}
|
|
2356
2404
|
const persisted = await this.repository.model.findByPk(normalizedUid, {
|
|
2357
2405
|
transaction: options == null ? void 0 : options.transaction
|
|
2358
2406
|
});
|
|
2359
2407
|
if (persisted) {
|
|
2360
|
-
return this.
|
|
2408
|
+
return this.patchFlowSurfaceModelOptions(values, options);
|
|
2361
2409
|
}
|
|
2362
2410
|
const currentNode = await this.repository.findModelById(normalizedUid, {
|
|
2363
2411
|
transaction: options == null ? void 0 : options.transaction,
|
|
@@ -2379,7 +2427,7 @@ class FlowSurfacesService {
|
|
|
2379
2427
|
);
|
|
2380
2428
|
return;
|
|
2381
2429
|
}
|
|
2382
|
-
return this.
|
|
2430
|
+
return this.patchFlowSurfaceModelOptions(values, options);
|
|
2383
2431
|
}
|
|
2384
2432
|
async persistCreatedKeysForAction(actionName, values, result, transaction) {
|
|
2385
2433
|
const keyPersistenceDeps = this.getDeclaredKeyPersistenceDeps();
|
|
@@ -3199,7 +3247,7 @@ class FlowSurfacesService {
|
|
|
3199
3247
|
async hydrateDetachedPopupTemplateBlockResourceContext(detachedTarget, context, transaction) {
|
|
3200
3248
|
const patches = this.collectDetachedPopupTemplateBlockResourceContextPatches(detachedTarget, context);
|
|
3201
3249
|
for (const patch of patches) {
|
|
3202
|
-
await this.
|
|
3250
|
+
await this.patchFlowSurfaceModelOptions(
|
|
3203
3251
|
{
|
|
3204
3252
|
uid: patch.uid,
|
|
3205
3253
|
stepParams: patch.stepParams
|
|
@@ -3239,7 +3287,7 @@ class FlowSurfacesService {
|
|
|
3239
3287
|
if (!import_lodash.default.isEqual(nextOpenView, currentOpenView)) {
|
|
3240
3288
|
currentGroup[resolvedOpenViewStep.stepKey] = nextOpenView;
|
|
3241
3289
|
nextStepParams[resolvedOpenViewStep.flowKey] = currentGroup;
|
|
3242
|
-
await this.
|
|
3290
|
+
await this.patchFlowSurfaceModelOptions(
|
|
3243
3291
|
{
|
|
3244
3292
|
uid: detachedTarget.uid,
|
|
3245
3293
|
stepParams: nextStepParams
|
|
@@ -3482,7 +3530,7 @@ class FlowSurfacesService {
|
|
|
3482
3530
|
currentGroup[openViewStep.stepKey] = nextOpenView;
|
|
3483
3531
|
nextStepParams[openViewStep.flowKey] = currentGroup;
|
|
3484
3532
|
await this.cleanupLocalPopupSurfaceForHost(sourceNode.uid, transaction, sourceNode);
|
|
3485
|
-
await this.
|
|
3533
|
+
await this.patchFlowSurfaceModelOptions(
|
|
3486
3534
|
{
|
|
3487
3535
|
uid: sourceNode.uid,
|
|
3488
3536
|
stepParams: nextStepParams
|
|
@@ -3780,7 +3828,7 @@ class FlowSurfacesService {
|
|
|
3780
3828
|
}
|
|
3781
3829
|
nextStepParams[resolved.openViewStep.flowKey] = currentGroup;
|
|
3782
3830
|
await this.cleanupLocalPopupSurfaceForHost(node.uid, options.transaction, node);
|
|
3783
|
-
await this.
|
|
3831
|
+
await this.patchFlowSurfaceModelOptions(
|
|
3784
3832
|
{
|
|
3785
3833
|
uid: node.uid,
|
|
3786
3834
|
stepParams: nextStepParams
|
|
@@ -4648,7 +4696,7 @@ class FlowSurfacesService {
|
|
|
4648
4696
|
if (Object.keys(nextPayload).length === 1) {
|
|
4649
4697
|
return { uid: popupTab.uid };
|
|
4650
4698
|
}
|
|
4651
|
-
await this.
|
|
4699
|
+
await this.patchFlowSurfaceModelOptions(nextPayload, { transaction: options.transaction });
|
|
4652
4700
|
return (0, import_service_utils.buildDefinedPayload)({
|
|
4653
4701
|
uid: popupTab.uid,
|
|
4654
4702
|
title: values.title,
|
|
@@ -8067,7 +8115,7 @@ class FlowSurfacesService {
|
|
|
8067
8115
|
const currentGroup = import_lodash.default.isPlainObject(nextStepParams[openViewStep.flowKey]) ? import_lodash.default.cloneDeep(nextStepParams[openViewStep.flowKey]) : {};
|
|
8068
8116
|
currentGroup[openViewStep.stepKey] = nextOpenView;
|
|
8069
8117
|
nextStepParams[openViewStep.flowKey] = currentGroup;
|
|
8070
|
-
await this.
|
|
8118
|
+
await this.patchFlowSurfaceModelOptions(
|
|
8071
8119
|
{
|
|
8072
8120
|
uid: actionNode.uid,
|
|
8073
8121
|
stepParams: nextStepParams
|
|
@@ -8117,7 +8165,7 @@ class FlowSurfacesService {
|
|
|
8117
8165
|
}
|
|
8118
8166
|
currentGroup[stepKey] = nextOpenView;
|
|
8119
8167
|
nextStepParams[flowKey] = currentGroup;
|
|
8120
|
-
await this.
|
|
8168
|
+
await this.patchFlowSurfaceModelOptions(
|
|
8121
8169
|
{
|
|
8122
8170
|
uid: actionNode.uid,
|
|
8123
8171
|
stepParams: nextStepParams
|
|
@@ -8380,7 +8428,7 @@ class FlowSurfacesService {
|
|
|
8380
8428
|
updated: Object.keys(import_lodash.default.omit(nextPayload, ["uid"]))
|
|
8381
8429
|
};
|
|
8382
8430
|
}
|
|
8383
|
-
await this.
|
|
8431
|
+
await this.patchFlowSurfaceModelOptions(nextPayload, { transaction: options.transaction });
|
|
8384
8432
|
if (!import_lodash.default.isUndefined(updateActionAssignedValues)) {
|
|
8385
8433
|
await this.syncUpdateActionAssignFormItems(current.uid, updateActionAssignedValues, options.transaction);
|
|
8386
8434
|
}
|
|
@@ -9286,7 +9334,7 @@ class FlowSurfacesService {
|
|
|
9286
9334
|
flowRegistry: flows
|
|
9287
9335
|
};
|
|
9288
9336
|
}
|
|
9289
|
-
await this.
|
|
9337
|
+
await this.patchFlowSurfaceModelOptions(
|
|
9290
9338
|
{
|
|
9291
9339
|
uid: target.uid,
|
|
9292
9340
|
flowRegistry: flows
|
|
@@ -9311,7 +9359,7 @@ class FlowSurfacesService {
|
|
|
9311
9359
|
const sizes = values.sizes || {};
|
|
9312
9360
|
const rowOrder = values.rowOrder || Object.keys(rows);
|
|
9313
9361
|
this.contractGuard.validateLayout(grid, { rows, sizes, rowOrder });
|
|
9314
|
-
await this.
|
|
9362
|
+
await this.patchFlowSurfaceModelOptions(
|
|
9315
9363
|
{
|
|
9316
9364
|
uid: grid.uid,
|
|
9317
9365
|
props: {
|
|
@@ -13539,7 +13587,7 @@ class FlowSurfacesService {
|
|
|
13539
13587
|
if (import_lodash.default.isEqual(nextConfigs, currentConfigs)) {
|
|
13540
13588
|
return;
|
|
13541
13589
|
}
|
|
13542
|
-
await this.
|
|
13590
|
+
await this.patchFlowSurfaceModelOptions(
|
|
13543
13591
|
{
|
|
13544
13592
|
uid: blockGrid.uid,
|
|
13545
13593
|
filterManager: nextConfigs
|
|
@@ -13569,7 +13617,7 @@ class FlowSurfacesService {
|
|
|
13569
13617
|
targetId: input.targetBlockUid,
|
|
13570
13618
|
filterPaths: this.buildFilterFormTargetPaths(input.resourceInit, input.fieldPath, input.associationPathName)
|
|
13571
13619
|
});
|
|
13572
|
-
await this.
|
|
13620
|
+
await this.patchFlowSurfaceModelOptions(
|
|
13573
13621
|
{
|
|
13574
13622
|
uid: blockGrid.uid,
|
|
13575
13623
|
filterManager: nextConfigs
|
|
@@ -13587,7 +13635,7 @@ class FlowSurfacesService {
|
|
|
13587
13635
|
if (import_lodash.default.isEqual(nextConfigs, currentConfigs)) {
|
|
13588
13636
|
return;
|
|
13589
13637
|
}
|
|
13590
|
-
await this.
|
|
13638
|
+
await this.patchFlowSurfaceModelOptions(
|
|
13591
13639
|
{
|
|
13592
13640
|
uid: blockGrid.uid,
|
|
13593
13641
|
filterManager: nextConfigs
|
|
@@ -13605,7 +13653,7 @@ class FlowSurfacesService {
|
|
|
13605
13653
|
if (import_lodash.default.isEqual(nextConfigs, currentConfigs)) {
|
|
13606
13654
|
return;
|
|
13607
13655
|
}
|
|
13608
|
-
await this.
|
|
13656
|
+
await this.patchFlowSurfaceModelOptions(
|
|
13609
13657
|
{
|
|
13610
13658
|
uid: blockGrid.uid,
|
|
13611
13659
|
filterManager: nextConfigs
|
|
@@ -13748,7 +13796,7 @@ class FlowSurfacesService {
|
|
|
13748
13796
|
if (innerFieldUid) {
|
|
13749
13797
|
const innerField = ((_f = current == null ? void 0 : current.subModels) == null ? void 0 : _f.field) || await this.repository.findModelById(innerFieldUid, { transaction, includeAsyncNode: true });
|
|
13750
13798
|
if (innerField == null ? void 0 : innerField.uid) {
|
|
13751
|
-
await this.
|
|
13799
|
+
await this.patchFlowSurfaceModelOptions(
|
|
13752
13800
|
{
|
|
13753
13801
|
uid: innerField.uid,
|
|
13754
13802
|
stepParams: {
|
|
@@ -13783,7 +13831,7 @@ class FlowSurfacesService {
|
|
|
13783
13831
|
fieldSettings: nextFieldSettings
|
|
13784
13832
|
}
|
|
13785
13833
|
};
|
|
13786
|
-
await this.
|
|
13834
|
+
await this.patchFlowSurfaceModelOptions(
|
|
13787
13835
|
{
|
|
13788
13836
|
uid: parentUid,
|
|
13789
13837
|
stepParams: nextWrapper.stepParams
|
|
@@ -13995,7 +14043,7 @@ class FlowSurfacesService {
|
|
|
13995
14043
|
if (import_lodash.default.isEqual(currentOpenView, openView)) {
|
|
13996
14044
|
return false;
|
|
13997
14045
|
}
|
|
13998
|
-
await this.
|
|
14046
|
+
await this.patchFlowSurfaceModelOptions(
|
|
13999
14047
|
{
|
|
14000
14048
|
uid: actionUid,
|
|
14001
14049
|
stepParams: (0, import_hidden_popup_contract.buildHiddenPopupActionStepParams)(actionNode.stepParams, openView)
|
|
@@ -15636,7 +15684,7 @@ class FlowSurfacesService {
|
|
|
15636
15684
|
showIndex: input.showIndex
|
|
15637
15685
|
});
|
|
15638
15686
|
if (Object.keys(props).length) {
|
|
15639
|
-
await this.
|
|
15687
|
+
await this.patchFlowSurfaceModelOptions(
|
|
15640
15688
|
{
|
|
15641
15689
|
uid: input.fieldUid,
|
|
15642
15690
|
props: {
|
|
@@ -15731,7 +15779,7 @@ class FlowSurfacesService {
|
|
|
15731
15779
|
collectionName: (0, import_service_helpers.getCollectionName)(input.targetCollection)
|
|
15732
15780
|
});
|
|
15733
15781
|
if (Object.keys(openView).length > 2) {
|
|
15734
|
-
await this.
|
|
15782
|
+
await this.patchFlowSurfaceModelOptions(
|
|
15735
15783
|
{
|
|
15736
15784
|
uid: input.fieldUid,
|
|
15737
15785
|
stepParams: import_lodash.default.merge({}, (fieldNode == null ? void 0 : fieldNode.stepParams) || {}, {
|
|
@@ -15820,7 +15868,7 @@ class FlowSurfacesService {
|
|
|
15820
15868
|
},
|
|
15821
15869
|
rowOrder: ["row1"]
|
|
15822
15870
|
};
|
|
15823
|
-
await this.
|
|
15871
|
+
await this.patchFlowSurfaceModelOptions(
|
|
15824
15872
|
{
|
|
15825
15873
|
uid: grid.uid,
|
|
15826
15874
|
props: {
|
|
@@ -15870,7 +15918,7 @@ class FlowSurfacesService {
|
|
|
15870
15918
|
init: this.buildExactFieldSettingsInitPayload(input)
|
|
15871
15919
|
}
|
|
15872
15920
|
};
|
|
15873
|
-
await this.
|
|
15921
|
+
await this.patchFlowSurfaceModelOptions(
|
|
15874
15922
|
{
|
|
15875
15923
|
uid: node.uid,
|
|
15876
15924
|
stepParams: nextStepParams
|
|
@@ -16032,7 +16080,7 @@ class FlowSurfacesService {
|
|
|
16032
16080
|
}
|
|
16033
16081
|
}
|
|
16034
16082
|
});
|
|
16035
|
-
await this.
|
|
16083
|
+
await this.patchFlowSurfaceModelOptions(
|
|
16036
16084
|
{
|
|
16037
16085
|
uid: wrapperNode.uid,
|
|
16038
16086
|
stepParams: nextStepParams
|
|
@@ -16058,7 +16106,7 @@ class FlowSurfacesService {
|
|
|
16058
16106
|
enabledPackages: input.enabledPackages
|
|
16059
16107
|
});
|
|
16060
16108
|
if (innerField.use === normalizedTargetUse) {
|
|
16061
|
-
await this.
|
|
16109
|
+
await this.patchFlowSurfaceModelOptions(
|
|
16062
16110
|
{
|
|
16063
16111
|
uid: innerField.uid,
|
|
16064
16112
|
stepParams: import_lodash.default.merge({}, innerField.stepParams || {}, {
|
|
@@ -16103,7 +16151,7 @@ class FlowSurfacesService {
|
|
|
16103
16151
|
}),
|
|
16104
16152
|
subModels: nextSubModels
|
|
16105
16153
|
};
|
|
16106
|
-
await this.
|
|
16154
|
+
await this.patchFlowSurfaceModelOptions(nextFieldNode, { transaction: input.transaction });
|
|
16107
16155
|
return normalizedTargetUse;
|
|
16108
16156
|
}
|
|
16109
16157
|
parseFieldPath(collection, fieldPath, associationPathName, dataSourceKey, collectionName) {
|
|
@@ -0,0 +1,13 @@
|
|
|
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 { Migration } from '@nocobase/server';
|
|
10
|
+
export default class extends Migration {
|
|
11
|
+
on: string;
|
|
12
|
+
up(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var remove_flow_model_options_runtime_uid_exports = {};
|
|
38
|
+
__export(remove_flow_model_options_runtime_uid_exports, {
|
|
39
|
+
default: () => remove_flow_model_options_runtime_uid_default
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(remove_flow_model_options_runtime_uid_exports);
|
|
42
|
+
var import_server = require("@nocobase/server");
|
|
43
|
+
var import_lodash = __toESM(require("lodash"));
|
|
44
|
+
/* istanbul ignore file -- @preserve */
|
|
45
|
+
class remove_flow_model_options_runtime_uid_default extends import_server.Migration {
|
|
46
|
+
on = "afterLoad";
|
|
47
|
+
async up() {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
const repository = this.context.db.getRepository("flowModels");
|
|
50
|
+
const rows = await repository.find();
|
|
51
|
+
for (const row of rows) {
|
|
52
|
+
const rowUid = String(((_a = row.get) == null ? void 0 : _a.call(row, "uid")) || row.uid || "").trim();
|
|
53
|
+
const options = ((_b = row.get) == null ? void 0 : _b.call(row, "options")) || row.options;
|
|
54
|
+
if (!rowUid || !import_lodash.default.isPlainObject(options) || options.uid !== rowUid) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
await row.update(
|
|
58
|
+
{
|
|
59
|
+
options: import_lodash.default.omit(options, ["uid"])
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
hooks: false
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "前端流引擎",
|
|
5
5
|
"description": "",
|
|
6
6
|
"description.zh-CN": "",
|
|
7
|
-
"version": "2.1.0-beta.
|
|
7
|
+
"version": "2.1.0-beta.29",
|
|
8
8
|
"main": "./dist/server/index.js",
|
|
9
9
|
"license": "Apache-2.0",
|
|
10
10
|
"devDependencies": {
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"@nocobase/test": "2.x",
|
|
25
25
|
"@nocobase/utils": "2.x"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "86c41be29dcbcac6fd6aa46b4a137ef07a27c1d0"
|
|
28
28
|
}
|