@nocobase/plugin-flow-engine 2.1.31 → 2.2.0-alpha.10
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/skills/frontend-developer/tools/getContextApis.js +2 -2
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/getContextEnvs.js +2 -2
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/getContextVars.js +2 -2
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/lintAndTestJS.js +2 -2
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/patchJSCode.js +2 -2
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/readJSCode.js +2 -2
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/writeJSCode.js +2 -2
- package/dist/ai/docs/runjs/context/ai.md +206 -0
- package/dist/externalVersion.js +9 -9
- package/dist/node_modules/@ant-design/icons-svg/package.json +1 -1
- package/dist/node_modules/acorn/package.json +1 -1
- package/dist/node_modules/acorn-jsx/package.json +1 -1
- package/dist/node_modules/acorn-walk/package.json +1 -1
- package/dist/node_modules/ses/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/flow-surfaces/authoring-validation.d.ts +3 -1
- package/dist/server/flow-surfaces/authoring-validation.js +30 -10
- package/dist/server/flow-surfaces/blueprint/compile-plan.js +23 -15
- package/dist/server/flow-surfaces/blueprint/normalize-document.js +18 -1
- package/dist/server/flow-surfaces/blueprint/public-types.d.ts +2 -0
- package/dist/server/flow-surfaces/builder.js +24 -4
- package/dist/server/flow-surfaces/constants.d.ts +9 -2
- package/dist/server/flow-surfaces/constants.js +1 -0
- package/dist/server/flow-surfaces/errors.d.ts +2 -2
- package/dist/server/flow-surfaces/errors.js +4 -4
- package/dist/server/flow-surfaces/navigation-targets.d.ts +73 -0
- package/dist/server/flow-surfaces/navigation-targets.js +439 -0
- package/dist/server/flow-surfaces/runjs-authoring/rules.js +0 -2
- package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.d.ts +0 -1
- package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.js +12 -19
- package/dist/server/flow-surfaces/runjs-authoring/runtime/types.d.ts +0 -12
- package/dist/server/flow-surfaces/runjs-authoring/scan/index.d.ts +0 -14
- package/dist/server/flow-surfaces/runjs-authoring/scan/index.js +1 -7
- package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.d.ts +0 -14
- package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.js +18 -73
- package/dist/server/flow-surfaces/runjs-authoring/types.d.ts +1 -1
- package/dist/server/flow-surfaces/runjs-authoring/validators/index.js +9 -53
- package/dist/server/flow-surfaces/service.d.ts +31 -0
- package/dist/server/flow-surfaces/service.js +749 -53
- package/dist/swagger/flow-surfaces.d.ts +108 -0
- package/dist/swagger/flow-surfaces.js +101 -8
- package/dist/swagger/index.d.ts +108 -0
- package/package.json +2 -2
- package/dist/server/flow-surfaces/runjs-authoring/blocked-global-stop/index.d.ts +0 -10
- package/dist/server/flow-surfaces/runjs-authoring/blocked-global-stop/index.js +0 -40
|
@@ -32,7 +32,6 @@ __export(rules_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(rules_exports);
|
|
34
34
|
var import_blocked_capability_reroute = require("./blocked-capability-reroute");
|
|
35
|
-
var import_blocked_global_stop = require("./blocked-global-stop");
|
|
36
35
|
var import_ctx_libs_member_mismatch_stop = require("./ctx-libs-member-mismatch-stop");
|
|
37
36
|
var import_ctx_root_mismatch_stop = require("./ctx-root-mismatch-stop");
|
|
38
37
|
var import_missing_top_level_return = require("./missing-top-level-return");
|
|
@@ -61,7 +60,6 @@ const RUNJS_AUTHORING_RULES = [
|
|
|
61
60
|
import_replace_innerhtml_with_render.replaceInnerHtmlWithRenderRule,
|
|
62
61
|
import_render_top_level_function_wrapper.renderTopLevelFunctionWrapperRule,
|
|
63
62
|
import_render_unreachable_render_call.renderUnreachableRenderCallRule,
|
|
64
|
-
import_blocked_global_stop.blockedGlobalStopRule,
|
|
65
63
|
import_unknown_global_stop.unknownGlobalStopRule,
|
|
66
64
|
import_blocked_capability_reroute.blockedCapabilityRerouteRule,
|
|
67
65
|
import_react_runtime_contract_stop.reactRuntimeContractStopRule,
|
|
@@ -21,7 +21,6 @@ export declare const BLOCKED_CTX_CAPABILITIES: Record<string, {
|
|
|
21
21
|
capability: string;
|
|
22
22
|
reroute: string;
|
|
23
23
|
}>;
|
|
24
|
-
export declare const FORBIDDEN_BARE_GLOBALS: Set<string>;
|
|
25
24
|
export declare const RUNJS_ALLOWED_BARE_GLOBALS: Set<string>;
|
|
26
25
|
export declare const RUNJS_ALLOWED_BARE_GLOBALS_BY_MODEL_USE: Record<string, Set<string>>;
|
|
27
26
|
export declare const NON_METHOD_CALL_KEYWORDS: Set<string>;
|
|
@@ -50,7 +50,6 @@ __export(constants_exports, {
|
|
|
50
50
|
FLOW_RESOURCE_CLASS_NAMES: () => FLOW_RESOURCE_CLASS_NAMES,
|
|
51
51
|
FLOW_RESOURCE_METHODS_BY_TYPE: () => FLOW_RESOURCE_METHODS_BY_TYPE,
|
|
52
52
|
FLOW_RESOURCE_METHOD_SUGGESTIONS: () => FLOW_RESOURCE_METHOD_SUGGESTIONS,
|
|
53
|
-
FORBIDDEN_BARE_GLOBALS: () => FORBIDDEN_BARE_GLOBALS,
|
|
54
53
|
INIT_RESOURCE_CLASS_NAMES: () => INIT_RESOURCE_CLASS_NAMES,
|
|
55
54
|
KNOWN_MODEL_USES: () => KNOWN_MODEL_USES,
|
|
56
55
|
MAX_RUNJS_ERRORS_PER_SOURCE: () => MAX_RUNJS_ERRORS_PER_SOURCE,
|
|
@@ -160,6 +159,7 @@ const SURFACE_ALLOWED_MODEL_USES = {
|
|
|
160
159
|
};
|
|
161
160
|
const ALLOWED_CTX_ROOTS = /* @__PURE__ */ new Set([
|
|
162
161
|
"acl",
|
|
162
|
+
"ai",
|
|
163
163
|
"antd",
|
|
164
164
|
"antdIcons",
|
|
165
165
|
"api",
|
|
@@ -224,7 +224,12 @@ const ALLOWED_CTX_ROOTS = /* @__PURE__ */ new Set([
|
|
|
224
224
|
]);
|
|
225
225
|
const CHART_CTX_ROOTS = /* @__PURE__ */ new Set(["data"]);
|
|
226
226
|
const BLOCKED_CTX_CAPABILITIES = {};
|
|
227
|
-
const
|
|
227
|
+
const RUNJS_ALLOWED_BARE_GLOBALS = /* @__PURE__ */ new Set([
|
|
228
|
+
"ctx",
|
|
229
|
+
"console",
|
|
230
|
+
"window",
|
|
231
|
+
"document",
|
|
232
|
+
"navigator",
|
|
228
233
|
"fetch",
|
|
229
234
|
"localStorage",
|
|
230
235
|
"sessionStorage",
|
|
@@ -237,22 +242,6 @@ const FORBIDDEN_BARE_GLOBALS = /* @__PURE__ */ new Set([
|
|
|
237
242
|
"EventSource",
|
|
238
243
|
"indexedDB",
|
|
239
244
|
"caches",
|
|
240
|
-
"Function",
|
|
241
|
-
"eval",
|
|
242
|
-
"globalThis",
|
|
243
|
-
"Intl",
|
|
244
|
-
"process",
|
|
245
|
-
"require",
|
|
246
|
-
"module",
|
|
247
|
-
"exports",
|
|
248
|
-
"location"
|
|
249
|
-
]);
|
|
250
|
-
const RUNJS_ALLOWED_BARE_GLOBALS = /* @__PURE__ */ new Set([
|
|
251
|
-
"ctx",
|
|
252
|
-
"console",
|
|
253
|
-
"window",
|
|
254
|
-
"document",
|
|
255
|
-
"navigator",
|
|
256
245
|
"setTimeout",
|
|
257
246
|
"clearTimeout",
|
|
258
247
|
"setInterval",
|
|
@@ -296,9 +285,14 @@ const RUNJS_ALLOWED_BARE_GLOBALS = /* @__PURE__ */ new Set([
|
|
|
296
285
|
"WeakMap",
|
|
297
286
|
"WeakRef",
|
|
298
287
|
"WeakSet",
|
|
288
|
+
"Function",
|
|
289
|
+
"eval",
|
|
290
|
+
"globalThis",
|
|
291
|
+
"Intl",
|
|
299
292
|
"JSON",
|
|
300
293
|
"Blob",
|
|
301
294
|
"URL",
|
|
295
|
+
"location",
|
|
302
296
|
"decodeURI",
|
|
303
297
|
"decodeURIComponent",
|
|
304
298
|
"encodeURI",
|
|
@@ -714,7 +708,6 @@ function escapeRegExp(value) {
|
|
|
714
708
|
FLOW_RESOURCE_CLASS_NAMES,
|
|
715
709
|
FLOW_RESOURCE_METHODS_BY_TYPE,
|
|
716
710
|
FLOW_RESOURCE_METHOD_SUGGESTIONS,
|
|
717
|
-
FORBIDDEN_BARE_GLOBALS,
|
|
718
711
|
INIT_RESOURCE_CLASS_NAMES,
|
|
719
712
|
KNOWN_MODEL_USES,
|
|
720
713
|
MAX_RUNJS_ERRORS_PER_SOURCE,
|
|
@@ -40,9 +40,6 @@ export type RunJsScanResult = RunJsAstInspection & {
|
|
|
40
40
|
match: string;
|
|
41
41
|
}>;
|
|
42
42
|
dynamicCtxAccesses: IndexedEntry[];
|
|
43
|
-
forbiddenBareGlobals: Array<IndexedEntry & {
|
|
44
|
-
name: string;
|
|
45
|
-
}>;
|
|
46
43
|
functionRanges: SourceRange[];
|
|
47
44
|
invalidCtxLibMemberAccesses: InvalidCtxLibMemberAccess[];
|
|
48
45
|
invalidReactRuntimeBindings: InvalidReactRuntimeBinding[];
|
|
@@ -65,15 +62,6 @@ export type RunJsScanResult = RunJsAstInspection & {
|
|
|
65
62
|
}>;
|
|
66
63
|
topLevelReturns: IndexedEntry[];
|
|
67
64
|
unboundReactCreateElementCalls: IndexedEntry[];
|
|
68
|
-
windowDocumentNavigatorAliases: Array<{
|
|
69
|
-
alias: string;
|
|
70
|
-
index: number;
|
|
71
|
-
root: string;
|
|
72
|
-
}>;
|
|
73
|
-
windowDocumentNavigatorUses: Array<IndexedEntry & {
|
|
74
|
-
member: string;
|
|
75
|
-
root: string;
|
|
76
|
-
}>;
|
|
77
65
|
};
|
|
78
66
|
export type RunJsInspectionRuntime = {
|
|
79
67
|
context: RunJsAuthoringContext;
|
|
@@ -149,16 +149,6 @@ export declare function scanJavaScriptSource(source: string, ast?: any, context?
|
|
|
149
149
|
alias: string;
|
|
150
150
|
index: number;
|
|
151
151
|
}[];
|
|
152
|
-
windowDocumentNavigatorUses: {
|
|
153
|
-
root: string;
|
|
154
|
-
member: string;
|
|
155
|
-
index: number;
|
|
156
|
-
}[];
|
|
157
|
-
windowDocumentNavigatorAliases: {
|
|
158
|
-
alias: string;
|
|
159
|
-
root: string;
|
|
160
|
-
index: number;
|
|
161
|
-
}[];
|
|
162
152
|
ctxAliases: {
|
|
163
153
|
alias: string;
|
|
164
154
|
index: number;
|
|
@@ -179,10 +169,6 @@ export declare function scanJavaScriptSource(source: string, ast?: any, context?
|
|
|
179
169
|
ruleId: "runjs-ctx-member-not-callable";
|
|
180
170
|
}[];
|
|
181
171
|
invalidCtxLibMemberAccesses: import("../internal-types").InvalidCtxLibMemberAccess[];
|
|
182
|
-
forbiddenBareGlobals: {
|
|
183
|
-
name: string;
|
|
184
|
-
index: number;
|
|
185
|
-
}[];
|
|
186
172
|
ctxMemberAccesses: {
|
|
187
173
|
member: string;
|
|
188
174
|
index: number;
|
|
@@ -71,10 +71,7 @@ function scanJavaScriptSource(source, ast, context = {}, modelUse = "") {
|
|
|
71
71
|
const flowResourceAliases = (0, import_source_patterns.collectFlowResourceAliases)(masked, sourceBindings);
|
|
72
72
|
const directDomWrites = (0, import_source_patterns.collectDirectDomWrites)(source, masked, sourceBindings);
|
|
73
73
|
const directDomAliases = (0, import_source_patterns.collectDirectDomAliases)(masked, sourceBindings);
|
|
74
|
-
const windowDocumentNavigatorUses = (0, import_source_patterns.collectWindowDocumentNavigatorUses)(source, masked, sourceBindings);
|
|
75
|
-
const windowDocumentNavigatorAliases = (0, import_source_patterns.collectWindowDocumentNavigatorAliases)(masked, sourceBindings);
|
|
76
74
|
const ctxAliases = (0, import_source_patterns.collectCtxAliases)(masked, sourceBindings);
|
|
77
|
-
const forbiddenBareGlobals = (0, import_source_patterns.collectForbiddenBareGlobals)(masked, sourceBindings);
|
|
78
75
|
return {
|
|
79
76
|
source,
|
|
80
77
|
masked,
|
|
@@ -126,14 +123,11 @@ function scanJavaScriptSource(source, ast, context = {}, modelUse = "") {
|
|
|
126
123
|
),
|
|
127
124
|
directDomWrites,
|
|
128
125
|
directDomAliases,
|
|
129
|
-
windowDocumentNavigatorUses,
|
|
130
|
-
windowDocumentNavigatorAliases,
|
|
131
126
|
ctxAliases,
|
|
132
127
|
ctxLibMemberCaseMismatches: (0, import_source_patterns.collectCtxLibMemberCaseMismatches)(source, masked, sourceBindings),
|
|
133
128
|
invalidCtxApiMemberAccesses: (astInspection == null ? void 0 : astInspection.invalidCtxApiMemberAccesses) || [],
|
|
134
129
|
invalidCtxNonFunctionCalls: (astInspection == null ? void 0 : astInspection.invalidCtxNonFunctionCalls) || [],
|
|
135
130
|
invalidCtxLibMemberAccesses: (astInspection == null ? void 0 : astInspection.invalidCtxLibMemberAccesses) || [],
|
|
136
|
-
forbiddenBareGlobals,
|
|
137
131
|
ctxMemberAccesses: (0, import_source_patterns.collectCtxMemberAccesses)(masked, sourceBindings),
|
|
138
132
|
dynamicCtxAccesses: (0, import_static_values.findUnboundCtxMatches)(masked, /\bctx\s*(?:\?\.\s*)?\[/g, sourceBindings),
|
|
139
133
|
isTopLevelFunctionWrapper: (0, import_source_patterns.isTopLevelFunctionWrapper)(masked, functionRanges, topLevelReachableCtxRenderCalls)
|
|
@@ -159,7 +153,7 @@ function collectAstUnknownBareGlobalsFromAst(ast, identifierBindings, modelUse)
|
|
|
159
153
|
if (!name) {
|
|
160
154
|
return;
|
|
161
155
|
}
|
|
162
|
-
if (allowedGlobals.has(name)
|
|
156
|
+
if (allowedGlobals.has(name)) {
|
|
163
157
|
return;
|
|
164
158
|
}
|
|
165
159
|
const index = typeof node.start === "number" ? node.start : 0;
|
|
@@ -7,10 +7,6 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import type { CtxLibMemberCaseMismatch, FlowResourceAlias, ReactComponentAlias, ResourceCallInReactHook, SourceBinding, SourceRange, StringLiteralBinding } from '../internal-types';
|
|
10
|
-
export declare function collectForbiddenBareGlobals(masked: string, bindings: SourceBinding[]): {
|
|
11
|
-
name: string;
|
|
12
|
-
index: number;
|
|
13
|
-
}[];
|
|
14
10
|
export declare function collectInvalidApiResourceCalls(source: string, masked: string, bindings: SourceBinding[]): {
|
|
15
11
|
index: number;
|
|
16
12
|
match: string;
|
|
@@ -64,16 +60,6 @@ export declare function collectDirectDomWrites(source: string, masked: string, b
|
|
|
64
60
|
index: number;
|
|
65
61
|
match: string;
|
|
66
62
|
}[];
|
|
67
|
-
export declare function collectWindowDocumentNavigatorUses(source: string, masked: string, bindings: SourceBinding[]): {
|
|
68
|
-
root: string;
|
|
69
|
-
member: string;
|
|
70
|
-
index: number;
|
|
71
|
-
}[];
|
|
72
|
-
export declare function collectWindowDocumentNavigatorAliases(masked: string, bindings: SourceBinding[]): {
|
|
73
|
-
alias: string;
|
|
74
|
-
root: string;
|
|
75
|
-
index: number;
|
|
76
|
-
}[];
|
|
77
63
|
export declare function collectDirectDomAliases(masked: string, bindings: SourceBinding[]): {
|
|
78
64
|
alias: string;
|
|
79
65
|
index: number;
|
|
@@ -33,7 +33,6 @@ __export(source_patterns_exports, {
|
|
|
33
33
|
collectDirectDomAliases: () => collectDirectDomAliases,
|
|
34
34
|
collectDirectDomWrites: () => collectDirectDomWrites,
|
|
35
35
|
collectFlowResourceAliases: () => collectFlowResourceAliases,
|
|
36
|
-
collectForbiddenBareGlobals: () => collectForbiddenBareGlobals,
|
|
37
36
|
collectInvalidApiResourceCalls: () => collectInvalidApiResourceCalls,
|
|
38
37
|
collectInvalidFlowResourceListCalls: () => collectInvalidFlowResourceListCalls,
|
|
39
38
|
collectInvalidResourceTypeCalls: () => collectInvalidResourceTypeCalls,
|
|
@@ -43,8 +42,6 @@ __export(source_patterns_exports, {
|
|
|
43
42
|
collectReactHookCalls: () => collectReactHookCalls,
|
|
44
43
|
collectResourceCallsInReactHooks: () => collectResourceCallsInReactHooks,
|
|
45
44
|
collectUnboundReactCreateElementCalls: () => collectUnboundReactCreateElementCalls,
|
|
46
|
-
collectWindowDocumentNavigatorAliases: () => collectWindowDocumentNavigatorAliases,
|
|
47
|
-
collectWindowDocumentNavigatorUses: () => collectWindowDocumentNavigatorUses,
|
|
48
45
|
getResourceLikeCtxRunjsEntrypoint: () => getResourceLikeCtxRunjsEntrypoint,
|
|
49
46
|
isResourceLikeCtxRequest: () => isResourceLikeCtxRequest,
|
|
50
47
|
isTopLevelFunctionWrapper: () => isTopLevelFunctionWrapper
|
|
@@ -53,18 +50,6 @@ module.exports = __toCommonJS(source_patterns_exports);
|
|
|
53
50
|
var import_constants = require("../runtime/constants");
|
|
54
51
|
var import_bindings = require("../ast/bindings");
|
|
55
52
|
var import_source = require("../ast/source");
|
|
56
|
-
function collectForbiddenBareGlobals(masked, bindings) {
|
|
57
|
-
const entries = [];
|
|
58
|
-
for (const name of import_constants.FORBIDDEN_BARE_GLOBALS) {
|
|
59
|
-
const pattern = new RegExp(`(?<![.$\\w])${(0, import_source.escapeRegExp)(name)}\\b`, "g");
|
|
60
|
-
for (const match of masked.matchAll(pattern)) {
|
|
61
|
-
if (!(0, import_bindings.isNameBoundAtIndex)(bindings, name, match.index || 0) && !isObjectPropertyKey(masked, match.index || 0, name)) {
|
|
62
|
-
entries.push({ name, index: match.index || 0 });
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return entries.sort((left, right) => left.index - right.index);
|
|
67
|
-
}
|
|
68
53
|
function collectInvalidApiResourceCalls(source, masked, bindings) {
|
|
69
54
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
70
55
|
const resourceMethods = /* @__PURE__ */ new Set(["list", "get", "create", "update", "destroy"]);
|
|
@@ -618,6 +603,16 @@ function collectDirectDomWrites(source, masked, bindings) {
|
|
|
618
603
|
}
|
|
619
604
|
entries.push({ index, match: match[0].replace(/\s*(?:\?\.)?\($/, "") });
|
|
620
605
|
}
|
|
606
|
+
for (const match of masked.matchAll(
|
|
607
|
+
/\b(document)\s*(?:\?\.|\.)\s*body\s*(?:\?\.|\.)\s*(innerHTML|insertAdjacentHTML)\b|(?<![.$\w])((window|globalThis)\s*(?:\?\.|\.)\s*document)\s*(?:\?\.|\.)\s*body\s*(?:\?\.|\.)\s*(innerHTML|insertAdjacentHTML)\b/g
|
|
608
|
+
)) {
|
|
609
|
+
const index = match.index || 0;
|
|
610
|
+
const root = match[1] || match[4];
|
|
611
|
+
if (root && (0, import_bindings.isNameBoundAtIndex)(bindings, root, index)) {
|
|
612
|
+
continue;
|
|
613
|
+
}
|
|
614
|
+
entries.push({ index, match: match[0] });
|
|
615
|
+
}
|
|
621
616
|
for (const match of commentMasked.matchAll(
|
|
622
617
|
/\b(ctx)\s*(?:\?\.|\.)\s*element\s*(?:\?\.\s*)?\[\s*(?:(['"])([A-Za-z_$][\w$]*)\2|([^\]]+))\s*\]/g
|
|
623
618
|
)) {
|
|
@@ -639,71 +634,24 @@ function collectDirectDomWrites(source, masked, bindings) {
|
|
|
639
634
|
}
|
|
640
635
|
}
|
|
641
636
|
for (const match of commentMasked.matchAll(
|
|
642
|
-
|
|
637
|
+
/(?<![.$\w])(window|globalThis)\s*(?:\?\.\s*)?\[\s*(['"])document\2\s*\]\s*(?:(?:\?\.|\.)\s*createElement|(?:\?\.\s*)?\[\s*(['"])createElement\3\s*\])/g
|
|
643
638
|
)) {
|
|
644
639
|
const index = match.index || 0;
|
|
645
|
-
|
|
646
|
-
const dynamicMember = Boolean(match[4]);
|
|
647
|
-
if (isCodeTokenAt(masked, index, match[1]) && !(0, import_bindings.isNameBoundAtIndex)(bindings, match[1], index) && (dynamicMember || isDirectDomMember(member))) {
|
|
640
|
+
if (isCodeTokenAt(masked, index, match[1]) && !(0, import_bindings.isNameBoundAtIndex)(bindings, match[1], index)) {
|
|
648
641
|
entries.push({ index, match: match[0] });
|
|
649
642
|
}
|
|
650
643
|
}
|
|
651
|
-
return entries;
|
|
652
|
-
}
|
|
653
|
-
function collectWindowDocumentNavigatorUses(source, masked, bindings) {
|
|
654
|
-
const commentMasked = (0, import_source.maskJavaScriptComments)(source);
|
|
655
|
-
const entries = [...masked.matchAll(/\b(window|document|navigator)\s*(?:\?\.|\.)\s*([A-Za-z_$][\w$]*)/g)].filter((match) => !(0, import_bindings.isNameBoundAtIndex)(bindings, match[1], match.index || 0)).map((match) => ({
|
|
656
|
-
root: match[1],
|
|
657
|
-
member: match[2],
|
|
658
|
-
index: match.index || 0
|
|
659
|
-
}));
|
|
660
644
|
for (const match of commentMasked.matchAll(
|
|
661
|
-
/\b(
|
|
645
|
+
/\b(element)\s*(?:\?\.\s*)?\[\s*(?:(['"])([A-Za-z_$][\w$]*)\2|([^\]]+))\s*\]/g
|
|
662
646
|
)) {
|
|
663
647
|
const index = match.index || 0;
|
|
664
|
-
const
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
entries.push({
|
|
669
|
-
root,
|
|
670
|
-
member: match[3] || "[dynamic]",
|
|
671
|
-
index
|
|
672
|
-
});
|
|
673
|
-
}
|
|
674
|
-
return entries.sort((left, right) => left.index - right.index);
|
|
675
|
-
}
|
|
676
|
-
function collectWindowDocumentNavigatorAliases(masked, bindings) {
|
|
677
|
-
const entries = [];
|
|
678
|
-
collectAliasMatches(
|
|
679
|
-
masked,
|
|
680
|
-
[
|
|
681
|
-
/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(window|document|navigator)\b/g,
|
|
682
|
-
/(?<![.$\w])([A-Za-z_$][\w$]*)\s*=\s*(window|document|navigator)\b/g
|
|
683
|
-
],
|
|
684
|
-
(match) => {
|
|
685
|
-
const alias = match[1];
|
|
686
|
-
const root = match[2];
|
|
687
|
-
const rootIndex = (match.index || 0) + match[0].lastIndexOf(root);
|
|
688
|
-
if (alias === root || (0, import_bindings.isNameBoundAtIndex)(bindings, root, rootIndex)) {
|
|
689
|
-
return;
|
|
690
|
-
}
|
|
691
|
-
entries.push({ alias, root, index: rootIndex });
|
|
692
|
-
}
|
|
693
|
-
);
|
|
694
|
-
for (const match of masked.matchAll(
|
|
695
|
-
/\b(?:const|let|var)\s*\{([^}]*)\}\s*=\s*(window|document|navigator)\b(?!\s*(?:\.|\?\.))/g
|
|
696
|
-
)) {
|
|
697
|
-
const root = match[2];
|
|
698
|
-
const rootIndex = (match.index || 0) + match[0].lastIndexOf(root);
|
|
699
|
-
if ((0, import_bindings.isNameBoundAtIndex)(bindings, root, rootIndex)) {
|
|
700
|
-
continue;
|
|
648
|
+
const member = match[3] || "";
|
|
649
|
+
const dynamicMember = Boolean(match[4]);
|
|
650
|
+
if (isCodeTokenAt(masked, index, match[1]) && !(0, import_bindings.isNameBoundAtIndex)(bindings, match[1], index) && (dynamicMember || isDirectDomMember(member))) {
|
|
651
|
+
entries.push({ index, match: match[0] });
|
|
701
652
|
}
|
|
702
|
-
collectObjectBindingAliases(match[1]).forEach((alias) => {
|
|
703
|
-
entries.push({ alias, root, index: rootIndex });
|
|
704
|
-
});
|
|
705
653
|
}
|
|
706
|
-
return
|
|
654
|
+
return entries;
|
|
707
655
|
}
|
|
708
656
|
function collectDirectDomAliases(masked, bindings) {
|
|
709
657
|
const entries = [];
|
|
@@ -871,7 +819,6 @@ function isResourceLikeRunjsEntrypointExpression(value) {
|
|
|
871
819
|
collectDirectDomAliases,
|
|
872
820
|
collectDirectDomWrites,
|
|
873
821
|
collectFlowResourceAliases,
|
|
874
|
-
collectForbiddenBareGlobals,
|
|
875
822
|
collectInvalidApiResourceCalls,
|
|
876
823
|
collectInvalidFlowResourceListCalls,
|
|
877
824
|
collectInvalidResourceTypeCalls,
|
|
@@ -881,8 +828,6 @@ function isResourceLikeRunjsEntrypointExpression(value) {
|
|
|
881
828
|
collectReactHookCalls,
|
|
882
829
|
collectResourceCallsInReactHooks,
|
|
883
830
|
collectUnboundReactCreateElementCalls,
|
|
884
|
-
collectWindowDocumentNavigatorAliases,
|
|
885
|
-
collectWindowDocumentNavigatorUses,
|
|
886
831
|
getResourceLikeCtxRunjsEntrypoint,
|
|
887
832
|
isResourceLikeCtxRequest,
|
|
888
833
|
isTopLevelFunctionWrapper
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
export type RunJsAuthoringRepairClass = 'syntax-stop' | 'nested-runjs-stop' | 'source-limit-stop' | 'switch-to-resource-api' | 'missing-top-level-return' | 'value-surface-forbids-render' | 'unknown-surface-stop' | 'unknown-model-stop' | 'replace-innerhtml-with-render' | 'render-top-level-function-wrapper' | 'render-unreachable-render-call' | '
|
|
9
|
+
export type RunJsAuthoringRepairClass = 'syntax-stop' | 'nested-runjs-stop' | 'source-limit-stop' | 'switch-to-resource-api' | 'missing-top-level-return' | 'value-surface-forbids-render' | 'unknown-surface-stop' | 'unknown-model-stop' | 'replace-innerhtml-with-render' | 'render-top-level-function-wrapper' | 'render-unreachable-render-call' | 'unknown-global-stop' | 'blocked-capability-reroute' | 'react-runtime-contract-stop' | 'resource-runtime-contract-stop' | 'ctx-libs-member-mismatch-stop' | 'ctx-root-mismatch-stop';
|
|
10
10
|
export type RunJsAuthoringSurfaceStyle = 'render' | 'value' | 'action';
|
|
11
11
|
export interface RunJsAuthoringRuleDefinition {
|
|
12
12
|
repairClass: RunJsAuthoringRepairClass;
|
|
@@ -310,58 +310,7 @@ function collectDirectDomErrors(path, source, scan, modelUse, surface, errors) {
|
|
|
310
310
|
);
|
|
311
311
|
});
|
|
312
312
|
}
|
|
313
|
-
function
|
|
314
|
-
scan.windowDocumentNavigatorAliases.forEach((entry) => {
|
|
315
|
-
errors.push(
|
|
316
|
-
(0, import_errors.buildRunJsAuthoringError)({
|
|
317
|
-
path,
|
|
318
|
-
repairClass: "blocked-global-stop",
|
|
319
|
-
message: `flowSurfaces authoring ${path} cannot alias forbidden global ${entry.root}`,
|
|
320
|
-
modelUse,
|
|
321
|
-
surface,
|
|
322
|
-
index: entry.index,
|
|
323
|
-
source,
|
|
324
|
-
details: {
|
|
325
|
-
global: entry.root,
|
|
326
|
-
alias: entry.alias
|
|
327
|
-
}
|
|
328
|
-
})
|
|
329
|
-
);
|
|
330
|
-
});
|
|
331
|
-
scan.windowDocumentNavigatorUses.forEach((entry) => {
|
|
332
|
-
errors.push(
|
|
333
|
-
(0, import_errors.buildRunJsAuthoringError)({
|
|
334
|
-
path,
|
|
335
|
-
repairClass: "blocked-global-stop",
|
|
336
|
-
ruleId: `runjs-${entry.root}-property-blocked`,
|
|
337
|
-
message: `flowSurfaces authoring ${path} cannot access ${entry.root}.${entry.member} in RunJS`,
|
|
338
|
-
modelUse,
|
|
339
|
-
surface,
|
|
340
|
-
index: entry.index,
|
|
341
|
-
source,
|
|
342
|
-
details: {
|
|
343
|
-
global: entry.root,
|
|
344
|
-
member: entry.member
|
|
345
|
-
}
|
|
346
|
-
})
|
|
347
|
-
);
|
|
348
|
-
});
|
|
349
|
-
scan.forbiddenBareGlobals.forEach((entry) => {
|
|
350
|
-
errors.push(
|
|
351
|
-
(0, import_errors.buildRunJsAuthoringError)({
|
|
352
|
-
path,
|
|
353
|
-
repairClass: "blocked-global-stop",
|
|
354
|
-
message: `flowSurfaces authoring ${path} cannot access forbidden global ${entry.name}`,
|
|
355
|
-
modelUse,
|
|
356
|
-
surface,
|
|
357
|
-
index: entry.index,
|
|
358
|
-
source,
|
|
359
|
-
details: {
|
|
360
|
-
global: entry.name
|
|
361
|
-
}
|
|
362
|
-
})
|
|
363
|
-
);
|
|
364
|
-
});
|
|
313
|
+
function collectUnknownGlobalErrors(path, source, scan, modelUse, surface, errors) {
|
|
365
314
|
scan.unknownBareGlobals.forEach((entry) => {
|
|
366
315
|
const suggestion = entry.suggestedCapability ? `; use ${entry.suggestedCapability} or assign it to a local variable first` : "; declare or import it before using it";
|
|
367
316
|
errors.push(
|
|
@@ -840,7 +789,14 @@ const RUNJS_INSPECTION_VALIDATORS = [
|
|
|
840
789
|
),
|
|
841
790
|
createLegacyValidator("dom-global", (runtime, errors) => {
|
|
842
791
|
collectDirectDomErrors(runtime.input.path, runtime.source, runtime.scan, runtime.modelUse, runtime.surface, errors);
|
|
843
|
-
|
|
792
|
+
collectUnknownGlobalErrors(
|
|
793
|
+
runtime.input.path,
|
|
794
|
+
runtime.source,
|
|
795
|
+
runtime.scan,
|
|
796
|
+
runtime.modelUse,
|
|
797
|
+
runtime.surface,
|
|
798
|
+
errors
|
|
799
|
+
);
|
|
844
800
|
}),
|
|
845
801
|
createLegacyValidator(
|
|
846
802
|
"react-runtime",
|
|
@@ -54,6 +54,7 @@ export declare class FlowSurfacesService {
|
|
|
54
54
|
get repository(): FlowModelRepository;
|
|
55
55
|
get locator(): SurfaceLocator;
|
|
56
56
|
private get routeSync();
|
|
57
|
+
private get navigationTargets();
|
|
57
58
|
private getFlowTemplateRepository;
|
|
58
59
|
private getFlowTemplateRepositorySafe;
|
|
59
60
|
private getFlowTemplateUsageRepository;
|
|
@@ -82,6 +83,27 @@ export declare class FlowSurfacesService {
|
|
|
82
83
|
private assertMenuRouteUpdatable;
|
|
83
84
|
private assertMenuParentNotSelfOrDescendant;
|
|
84
85
|
private buildMenuResult;
|
|
86
|
+
private hasDesktopRouteUiLayoutsRelation;
|
|
87
|
+
private normalizeDesktopRouteRelationId;
|
|
88
|
+
private readDesktopRouteUiLayoutUids;
|
|
89
|
+
private resolveDefaultDesktopRouteUiLayoutUids;
|
|
90
|
+
private findDesktopRouteUiLayoutByUid;
|
|
91
|
+
private getDesktopRouteUiLayoutTypeByUid;
|
|
92
|
+
private isMobileDesktopRouteUiLayoutUid;
|
|
93
|
+
private resolveInheritedDesktopRouteUiLayoutUids;
|
|
94
|
+
private normalizeExplicitDesktopRouteLayoutUid;
|
|
95
|
+
private normalizeDesktopRouteLayoutUidFilter;
|
|
96
|
+
private resolveDesktopRouteLayoutUidFilter;
|
|
97
|
+
private assertNavigationTargetIsExclusive;
|
|
98
|
+
private readDesktopRouteScope;
|
|
99
|
+
private resolveRequestedDesktopRouteScope;
|
|
100
|
+
private resolveExistingDesktopRouteScope;
|
|
101
|
+
private attachDesktopRouteScopeToRouteAndChildren;
|
|
102
|
+
private assertEnabledDesktopRouteUiLayoutUid;
|
|
103
|
+
private assertDesktopRouteBelongsToUiLayout;
|
|
104
|
+
private setDesktopRouteUiLayouts;
|
|
105
|
+
private attachDesktopRouteUiLayoutsToRouteAndChildren;
|
|
106
|
+
private ensureDesktopRouteUiLayouts;
|
|
85
107
|
private isValidMenuIconName;
|
|
86
108
|
private assertVisibleNavigationIcon;
|
|
87
109
|
private assertVisibleNavigationRouteIconUpdate;
|
|
@@ -205,6 +227,8 @@ export declare class FlowSurfacesService {
|
|
|
205
227
|
private dispatchPlanOnlyAction;
|
|
206
228
|
private resolveApplyBlueprintReplaceTargetInfo;
|
|
207
229
|
private resolveApplyBlueprintCreateNavigationGroup;
|
|
230
|
+
private normalizeApplyBlueprintCreateMobileNavigation;
|
|
231
|
+
private assertApplyBlueprintCreateNavigationTarget;
|
|
208
232
|
private resolveApplyBlueprintCreatePageIdentity;
|
|
209
233
|
private prepareApplyBlueprintRequest;
|
|
210
234
|
private prevalidateApplyBlueprintChartAssets;
|
|
@@ -372,8 +396,13 @@ export declare class FlowSurfacesService {
|
|
|
372
396
|
uid: any;
|
|
373
397
|
updated: string[];
|
|
374
398
|
}>;
|
|
399
|
+
listNavigationTargets(_values?: Record<string, any>, options?: {
|
|
400
|
+
transaction?: any;
|
|
401
|
+
currentRoles?: FlowSurfaceRequestRoles;
|
|
402
|
+
}): Promise<import("./navigation-targets").FlowSurfaceNavigationTargetsResult>;
|
|
375
403
|
createMenu(values: Record<string, any>, options?: {
|
|
376
404
|
transaction?: any;
|
|
405
|
+
currentRoles?: FlowSurfaceRequestRoles;
|
|
377
406
|
}): Promise<{
|
|
378
407
|
routeId: any;
|
|
379
408
|
type: any;
|
|
@@ -381,6 +410,7 @@ export declare class FlowSurfacesService {
|
|
|
381
410
|
}>;
|
|
382
411
|
updateMenu(values: Record<string, any>, options?: {
|
|
383
412
|
transaction?: any;
|
|
413
|
+
currentRoles?: FlowSurfaceRequestRoles;
|
|
384
414
|
}): Promise<{
|
|
385
415
|
routeId: any;
|
|
386
416
|
type: any;
|
|
@@ -389,6 +419,7 @@ export declare class FlowSurfacesService {
|
|
|
389
419
|
private initializeFlowPageForRoute;
|
|
390
420
|
createPage(values: Record<string, any>, options?: {
|
|
391
421
|
transaction?: any;
|
|
422
|
+
currentRoles?: FlowSurfaceRequestRoles;
|
|
392
423
|
}): Promise<any>;
|
|
393
424
|
destroyPage(values: Record<string, any>, options?: {
|
|
394
425
|
transaction?: any;
|