@nocobase/plugin-flow-engine 2.1.0-alpha.26 → 2.1.0-alpha.28
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/index.js +1 -0
- 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/blueprint/compile-blocks.js +8 -8
- package/dist/server/flow-surfaces/blueprint/normalize-document.js +5 -14
- package/dist/server/flow-surfaces/blueprint/private-utils.d.ts +0 -1
- package/dist/server/flow-surfaces/blueprint/private-utils.js +0 -3
- package/dist/server/flow-surfaces/blueprint/public-types.d.ts +0 -1
- package/dist/server/flow-surfaces/catalog.js +1 -0
- package/dist/server/flow-surfaces/compose-compiler.d.ts +0 -1
- package/dist/server/flow-surfaces/compose-compiler.js +0 -1
- package/dist/server/flow-surfaces/configure-options.js +0 -4
- package/dist/server/flow-surfaces/contract-guard.js +11 -3
- package/dist/server/flow-surfaces/field-type-resolver.d.ts +0 -1
- package/dist/server/flow-surfaces/field-type-resolver.js +3 -13
- package/dist/server/flow-surfaces/public-compatibility.d.ts +16 -0
- package/dist/server/flow-surfaces/public-compatibility.js +139 -0
- package/dist/server/flow-surfaces/service-utils.d.ts +0 -1
- package/dist/server/flow-surfaces/service-utils.js +0 -6
- package/dist/server/flow-surfaces/service.d.ts +12 -0
- package/dist/server/flow-surfaces/service.js +360 -82
- package/dist/swagger/flow-surfaces.d.ts +0 -29
- package/dist/swagger/flow-surfaces.js +8 -17
- package/dist/swagger/index.d.ts +0 -29
- 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",
|
|
@@ -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-alpha.
|
|
11
|
+
"@nocobase/client": "2.1.0-alpha.28",
|
|
12
12
|
"lodash": "4.18.1",
|
|
13
|
-
"@nocobase/database": "2.1.0-alpha.
|
|
14
|
-
"@nocobase/data-source-manager": "2.1.0-alpha.
|
|
15
|
-
"@nocobase/resourcer": "2.1.0-alpha.
|
|
16
|
-
"@nocobase/utils": "2.1.0-alpha.
|
|
17
|
-
"@nocobase/cache": "2.1.0-alpha.
|
|
18
|
-
"@nocobase/plugin-localization": "2.1.0-alpha.
|
|
19
|
-
"@nocobase/server": "2.1.0-alpha.
|
|
20
|
-
"@nocobase/actions": "2.1.0-alpha.
|
|
13
|
+
"@nocobase/database": "2.1.0-alpha.28",
|
|
14
|
+
"@nocobase/data-source-manager": "2.1.0-alpha.28",
|
|
15
|
+
"@nocobase/resourcer": "2.1.0-alpha.28",
|
|
16
|
+
"@nocobase/utils": "2.1.0-alpha.28",
|
|
17
|
+
"@nocobase/cache": "2.1.0-alpha.28",
|
|
18
|
+
"@nocobase/plugin-localization": "2.1.0-alpha.28",
|
|
19
|
+
"@nocobase/server": "2.1.0-alpha.28",
|
|
20
|
+
"@nocobase/actions": "2.1.0-alpha.28",
|
|
21
21
|
"@formily/json-schema": "2.3.7",
|
|
22
|
-
"@nocobase/ai": "2.1.0-alpha.
|
|
22
|
+
"@nocobase/ai": "2.1.0-alpha.28"
|
|
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-
|
|
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-03T23:59:02.475Z"}
|
|
@@ -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-
|
|
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-03T23:59:03.568Z"}
|
|
@@ -45,6 +45,7 @@ var import_errors = require("../errors");
|
|
|
45
45
|
var import_service_utils = require("../service-utils");
|
|
46
46
|
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
|
+
var import_public_compatibility = require("../public-compatibility");
|
|
48
49
|
var import_defaults = require("./defaults");
|
|
49
50
|
var import_private_utils = require("./private-utils");
|
|
50
51
|
var import_field_type_resolver = require("../field-type-resolver");
|
|
@@ -94,7 +95,6 @@ const APPLY_BLUEPRINT_FIELD_ALLOWED_KEYS = [
|
|
|
94
95
|
"type",
|
|
95
96
|
"fieldType",
|
|
96
97
|
"fields",
|
|
97
|
-
"selectorFields",
|
|
98
98
|
"titleField",
|
|
99
99
|
"openMode",
|
|
100
100
|
"popupSize",
|
|
@@ -874,10 +874,6 @@ function compileField(input, index, scopePrefix, assets, localBlockKeys, context
|
|
|
874
874
|
const syntheticType = (0, import_private_utils.readOptionalString)(input.type);
|
|
875
875
|
const fieldType = (0, import_field_type_resolver.normalizePublicFieldType)(input.fieldType, `${context}[${index}]`);
|
|
876
876
|
const fields = (0, import_field_type_resolver.normalizePublicFieldNameList)(input.fields, `${context}[${index}].fields`);
|
|
877
|
-
const selectorFields = (0, import_field_type_resolver.normalizePublicFieldNameList)(
|
|
878
|
-
input.selectorFields,
|
|
879
|
-
`${context}[${index}].selectorFields`
|
|
880
|
-
);
|
|
881
877
|
if (!fieldPath && !syntheticType) {
|
|
882
878
|
(0, import_errors.throwBadRequest)(`${context}[${index}] requires field or type`);
|
|
883
879
|
}
|
|
@@ -905,7 +901,6 @@ function compileField(input, index, scopePrefix, assets, localBlockKeys, context
|
|
|
905
901
|
type: syntheticType,
|
|
906
902
|
fieldType,
|
|
907
903
|
fields,
|
|
908
|
-
selectorFields,
|
|
909
904
|
titleField: (0, import_private_utils.readOptionalString)(input.titleField),
|
|
910
905
|
openMode: (0, import_private_utils.readOptionalString)(input.openMode),
|
|
911
906
|
popupSize: (0, import_private_utils.readOptionalString)(input.popupSize),
|
|
@@ -1021,11 +1016,16 @@ function compileBlocks(input, scopePrefix, assets, context, defaults, requiredEx
|
|
|
1021
1016
|
if (!key) {
|
|
1022
1017
|
(0, import_errors.throwBadRequest)(`${blockContext} key '${localKey}' is missing after block key compilation`);
|
|
1023
1018
|
}
|
|
1024
|
-
const
|
|
1019
|
+
const blockType = (0, import_private_utils.readOptionalString)(block.type);
|
|
1020
|
+
let settings = resolveAssetSettings(block.settings, block, assets, blockContext);
|
|
1025
1021
|
if ((0, import_private_utils.readOptionalString)(block.title) && import_lodash.default.isUndefined(settings.title)) {
|
|
1026
1022
|
settings.title = (0, import_private_utils.readOptionalString)(block.title);
|
|
1027
1023
|
}
|
|
1028
|
-
|
|
1024
|
+
settings = (0, import_public_compatibility.normalizeFlowSurfacePublicSortingAlias)({
|
|
1025
|
+
context: `${blockContext}.settings`,
|
|
1026
|
+
type: blockType,
|
|
1027
|
+
settings
|
|
1028
|
+
});
|
|
1029
1029
|
const template = ensureOptionalTemplate(block.template, `${blockContext}.template`);
|
|
1030
1030
|
const blockDefaultFilter = (0, import_public_data_surface_default_filter.normalizeFlowSurfacePublicBlockDefaultFilter)("applyBlueprint", block.defaultFilter, {
|
|
1031
1031
|
blockType,
|
|
@@ -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)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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 (
|
|
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,
|
|
@@ -2434,6 +2434,7 @@ const NODE_CONTRACT_ENTRIES = [
|
|
|
2434
2434
|
["TriggerBlockGridModel", GRID_NODE_CONTRACT],
|
|
2435
2435
|
["ApprovalBlockGridModel", GRID_NODE_CONTRACT],
|
|
2436
2436
|
["TableBlockModel", TABLE_BLOCK_CONTRACT],
|
|
2437
|
+
["TableSelectModel", TABLE_BLOCK_CONTRACT],
|
|
2437
2438
|
["CalendarBlockModel", CALENDAR_BLOCK_CONTRACT],
|
|
2438
2439
|
["TreeBlockModel", TREE_BLOCK_CONTRACT],
|
|
2439
2440
|
["KanbanBlockModel", KANBAN_BLOCK_CONTRACT],
|