@nocobase/plugin-flow-engine 2.1.0-beta.42 → 2.1.0-beta.44
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/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.js +160 -21
- package/dist/server/flow-surfaces/catalog.js +9 -5
- package/dist/server/flow-surfaces/chart-config.js +29 -6
- package/dist/server/flow-surfaces/contract-guard.js +39 -5
- package/dist/server/flow-surfaces/default-block-actions.js +2 -0
- package/dist/server/flow-surfaces/errors.d.ts +15 -0
- package/dist/server/flow-surfaces/errors.js +49 -3
- package/dist/server/flow-surfaces/filter-group.d.ts +7 -1
- package/dist/server/flow-surfaces/filter-group.js +175 -71
- package/dist/server/flow-surfaces/public-data-surface-default-filter.js +2 -1
- package/dist/server/flow-surfaces/runjs-authoring/ast/bindings.d.ts +66 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/bindings.js +661 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/execution.d.ts +20 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/execution.js +275 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/parser.d.ts +16 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/parser.js +130 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/react-values.d.ts +20 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/react-values.js +401 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/request-config.d.ts +21 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/request-config.js +199 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/source.d.ts +70 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/source.js +895 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/static-bindings.d.ts +23 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/static-bindings.js +618 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/static-values.d.ts +196 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/static-values.js +1777 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/walk.d.ts +10 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/walk.js +55 -0
- package/dist/server/flow-surfaces/runjs-authoring/collectors.d.ts +12 -0
- package/dist/server/flow-surfaces/runjs-authoring/collectors.js +589 -0
- package/dist/server/flow-surfaces/runjs-authoring/index.d.ts +2 -25
- package/dist/server/flow-surfaces/runjs-authoring/index.js +5 -11138
- package/dist/server/flow-surfaces/runjs-authoring/inspect.d.ts +13 -0
- package/dist/server/flow-surfaces/runjs-authoring/inspect.js +149 -0
- package/dist/server/flow-surfaces/runjs-authoring/internal-types.d.ts +333 -0
- package/dist/server/flow-surfaces/runjs-authoring/internal-types.js +36 -0
- package/dist/server/flow-surfaces/runjs-authoring/rules.js +2 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.d.ts +67 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.js +757 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/errors.d.ts +22 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/errors.js +91 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/source-budget.d.ts +16 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/source-budget.js +115 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/surface.d.ts +19 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/surface.js +140 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/types.d.ts +91 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/types.js +24 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/ctx-api.d.ts +138 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/ctx-api.js +1779 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/filter.d.ts +10 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/filter.js +1583 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/index.d.ts +195 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/index.js +463 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/react-render.d.ts +48 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/react-render.js +379 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/react.d.ts +26 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/react.js +1441 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/resource.d.ts +23 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/resource.js +1427 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.d.ts +91 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.js +889 -0
- package/dist/server/flow-surfaces/runjs-authoring/types.d.ts +1 -1
- package/dist/server/flow-surfaces/runjs-authoring/unknown-global-stop/index.d.ts +10 -0
- package/dist/server/flow-surfaces/runjs-authoring/unknown-global-stop/index.js +40 -0
- package/dist/server/flow-surfaces/runjs-authoring/validators/index.d.ts +12 -0
- package/dist/server/flow-surfaces/runjs-authoring/validators/index.js +887 -0
- package/dist/server/flow-surfaces/service-helpers.d.ts +29 -0
- package/dist/server/flow-surfaces/service-helpers.js +105 -0
- package/dist/server/flow-surfaces/service-utils.d.ts +15 -3
- package/dist/server/flow-surfaces/service-utils.js +5 -4
- package/dist/server/flow-surfaces/service.d.ts +4 -0
- package/dist/server/flow-surfaces/service.js +360 -30
- package/dist/server/flow-surfaces/types.d.ts +3 -0
- package/dist/server/repository.d.ts +12 -1
- package/dist/server/repository.js +195 -23
- package/dist/swagger/flow-surfaces.d.ts +175 -0
- package/dist/swagger/flow-surfaces.js +130 -51
- package/dist/swagger/index.d.ts +175 -0
- package/package.json +2 -2
|
@@ -0,0 +1,22 @@
|
|
|
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 type { FlowSurfaceErrorItemInput } from '../../errors';
|
|
10
|
+
import type { RunJsAuthoringRepairClass } from '../types';
|
|
11
|
+
export declare function buildRunJsAuthoringError(input: {
|
|
12
|
+
path: string;
|
|
13
|
+
repairClass: RunJsAuthoringRepairClass;
|
|
14
|
+
message: string;
|
|
15
|
+
modelUse?: string;
|
|
16
|
+
surface?: string;
|
|
17
|
+
index: number;
|
|
18
|
+
source: string;
|
|
19
|
+
ruleId?: string;
|
|
20
|
+
details?: Record<string, any>;
|
|
21
|
+
}): FlowSurfaceErrorItemInput;
|
|
22
|
+
export declare function dedupeErrors(errors: FlowSurfaceErrorItemInput[]): FlowSurfaceErrorItemInput[];
|
|
@@ -0,0 +1,91 @@
|
|
|
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 errors_exports = {};
|
|
28
|
+
__export(errors_exports, {
|
|
29
|
+
buildRunJsAuthoringError: () => buildRunJsAuthoringError,
|
|
30
|
+
dedupeErrors: () => dedupeErrors
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(errors_exports);
|
|
33
|
+
var import_rules = require("../rules");
|
|
34
|
+
var import_constants = require("./constants");
|
|
35
|
+
function buildRunJsAuthoringError(input) {
|
|
36
|
+
const rule = (0, import_rules.getRunJsAuthoringRule)(input.repairClass);
|
|
37
|
+
const loc = getLineColumn(input.source, input.index);
|
|
38
|
+
const agentInstruction = getRunJsAuthoringAgentInstruction(input.repairClass);
|
|
39
|
+
return {
|
|
40
|
+
path: input.path,
|
|
41
|
+
ruleId: input.ruleId || rule.defaultRuleId,
|
|
42
|
+
message: buildRunJsAuthoringErrorMessage(input.message, agentInstruction, rule.suggestedAction),
|
|
43
|
+
details: buildDefinedDetails({
|
|
44
|
+
repairClass: input.repairClass,
|
|
45
|
+
suggestedAction: rule.suggestedAction,
|
|
46
|
+
skipForbidden: true,
|
|
47
|
+
mustRetry: true,
|
|
48
|
+
agentInstruction,
|
|
49
|
+
line: loc.line,
|
|
50
|
+
column: loc.column,
|
|
51
|
+
...input.details
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function getRunJsAuthoringAgentInstruction(repairClass) {
|
|
56
|
+
return import_constants.CONTEXT_FIRST_REPAIR_CLASSES.has(repairClass) ? import_constants.RUNJS_CONTEXT_AND_RETRY_INSTRUCTION : import_constants.RUNJS_FIX_AND_RETRY_INSTRUCTION;
|
|
57
|
+
}
|
|
58
|
+
function buildRunJsAuthoringErrorMessage(message, agentInstruction, suggestedAction) {
|
|
59
|
+
return [message, agentInstruction, suggestedAction ? `Suggested fix: ${suggestedAction}` : ""].filter(Boolean).join(" ");
|
|
60
|
+
}
|
|
61
|
+
function buildDefinedDetails(details) {
|
|
62
|
+
return Object.fromEntries(
|
|
63
|
+
Object.entries(details).filter(([, value]) => typeof value !== "undefined" && value !== "")
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
function getLineColumn(source, index) {
|
|
67
|
+
const safeIndex = Math.max(0, Math.min(index, source.length));
|
|
68
|
+
const prefix = source.slice(0, safeIndex);
|
|
69
|
+
const lines = prefix.split(/\r\n|\r|\n/);
|
|
70
|
+
return {
|
|
71
|
+
line: lines.length,
|
|
72
|
+
column: lines[lines.length - 1].length + 1
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function dedupeErrors(errors) {
|
|
76
|
+
const seen = /* @__PURE__ */ new Set();
|
|
77
|
+
return errors.filter((error) => {
|
|
78
|
+
var _a, _b;
|
|
79
|
+
const key = `${error.path}:${error.ruleId}:${(_a = error.details) == null ? void 0 : _a.line}:${(_b = error.details) == null ? void 0 : _b.column}`;
|
|
80
|
+
if (seen.has(key)) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
seen.add(key);
|
|
84
|
+
return true;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
88
|
+
0 && (module.exports = {
|
|
89
|
+
buildRunJsAuthoringError,
|
|
90
|
+
dedupeErrors
|
|
91
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
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 type { FlowSurfaceErrorItemInput } from '../../errors';
|
|
10
|
+
import type { RunJsAuthoringInspectionInput } from '../types';
|
|
11
|
+
import type { RunJsSourceBudget } from '../internal-types';
|
|
12
|
+
export declare function createRunJsSourceBudget(): RunJsSourceBudget;
|
|
13
|
+
export declare function collectRunJsSourceLimitErrors(input: RunJsAuthoringInspectionInput, budget?: RunJsSourceBudget): {
|
|
14
|
+
errors: FlowSurfaceErrorItemInput[];
|
|
15
|
+
skipInspection: boolean;
|
|
16
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
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 source_budget_exports = {};
|
|
28
|
+
__export(source_budget_exports, {
|
|
29
|
+
collectRunJsSourceLimitErrors: () => collectRunJsSourceLimitErrors,
|
|
30
|
+
createRunJsSourceBudget: () => createRunJsSourceBudget
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(source_budget_exports);
|
|
33
|
+
var import_constants = require("./constants");
|
|
34
|
+
var import_errors = require("./errors");
|
|
35
|
+
function createRunJsSourceBudget() {
|
|
36
|
+
return {
|
|
37
|
+
count: 0,
|
|
38
|
+
totalLength: 0
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function collectRunJsSourceLimitErrors(input, budget) {
|
|
42
|
+
const source = String(input.code || "");
|
|
43
|
+
const sourceLength = source.length;
|
|
44
|
+
const modelUse = normalizeText(input.modelUse);
|
|
45
|
+
const surface = normalizeText(input.surface);
|
|
46
|
+
const errors = [];
|
|
47
|
+
if (budget) {
|
|
48
|
+
budget.count += 1;
|
|
49
|
+
budget.totalLength += sourceLength;
|
|
50
|
+
}
|
|
51
|
+
const pushLimitError = (ruleId, message, details) => {
|
|
52
|
+
errors.push(
|
|
53
|
+
(0, import_errors.buildRunJsAuthoringError)({
|
|
54
|
+
path: input.path,
|
|
55
|
+
repairClass: "source-limit-stop",
|
|
56
|
+
ruleId,
|
|
57
|
+
message,
|
|
58
|
+
modelUse,
|
|
59
|
+
surface,
|
|
60
|
+
index: 0,
|
|
61
|
+
source,
|
|
62
|
+
details
|
|
63
|
+
})
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
const sourceTooLarge = sourceLength > import_constants.MAX_RUNJS_SOURCE_LENGTH;
|
|
67
|
+
if (sourceTooLarge && (!budget || budget.count <= import_constants.MAX_RUNJS_SOURCES_PER_REQUEST)) {
|
|
68
|
+
pushLimitError(
|
|
69
|
+
"runjs-source-too-large",
|
|
70
|
+
`flowSurfaces authoring ${input.path} RunJS source is too large to validate safely`,
|
|
71
|
+
{
|
|
72
|
+
maxSourceLength: import_constants.MAX_RUNJS_SOURCE_LENGTH,
|
|
73
|
+
sourceLength
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
let requestLimitExceeded = false;
|
|
78
|
+
if (budget && budget.count > import_constants.MAX_RUNJS_SOURCES_PER_REQUEST) {
|
|
79
|
+
requestLimitExceeded = true;
|
|
80
|
+
if (!budget.countLimitReported) {
|
|
81
|
+
budget.countLimitReported = true;
|
|
82
|
+
pushLimitError(
|
|
83
|
+
"runjs-too-many-sources",
|
|
84
|
+
`flowSurfaces authoring request contains too many RunJS sources to validate safely`,
|
|
85
|
+
{
|
|
86
|
+
maxSources: import_constants.MAX_RUNJS_SOURCES_PER_REQUEST,
|
|
87
|
+
sourceCount: budget.count
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (budget && budget.totalLength > import_constants.MAX_RUNJS_TOTAL_SOURCE_LENGTH) {
|
|
93
|
+
requestLimitExceeded = true;
|
|
94
|
+
if (!budget.totalLimitReported) {
|
|
95
|
+
budget.totalLimitReported = true;
|
|
96
|
+
pushLimitError(
|
|
97
|
+
"runjs-total-source-too-large",
|
|
98
|
+
`flowSurfaces authoring request contains too much RunJS source to validate safely`,
|
|
99
|
+
{
|
|
100
|
+
maxTotalSourceLength: import_constants.MAX_RUNJS_TOTAL_SOURCE_LENGTH,
|
|
101
|
+
totalSourceLength: budget.totalLength
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return { errors, skipInspection: sourceTooLarge || requestLimitExceeded };
|
|
107
|
+
}
|
|
108
|
+
function normalizeText(value) {
|
|
109
|
+
return typeof value === "string" ? value.trim() : "";
|
|
110
|
+
}
|
|
111
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
112
|
+
0 && (module.exports = {
|
|
113
|
+
collectRunJsSourceLimitErrors,
|
|
114
|
+
createRunJsSourceBudget
|
|
115
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
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 type { RunJsAuthoringContext } from '../internal-types';
|
|
10
|
+
import type { RunJsAuthoringInspectionInput, RunJsAuthoringSurfaceStyle } from '../types';
|
|
11
|
+
export declare function resolveFieldModelUse(type: string, renderer: string, blockType: string): "" | "JSFieldModel" | "JSEditableFieldModel" | "JSColumnModel" | "JSItemModel";
|
|
12
|
+
export declare function resolveActionModelUse(actionType: string, blockType: string, slot: 'actions' | 'recordActions'): "" | "JSCollectionActionModel" | "JSRecordActionModel" | "JSFormActionModel" | "JSItemActionModel" | "FilterFormJSActionModel" | "JSActionModel";
|
|
13
|
+
export declare function resolveConfigureModelUse(currentNode: any): string;
|
|
14
|
+
export declare function resolveConfigureBlockType(context: RunJsAuthoringContext): string;
|
|
15
|
+
export declare function resolvePublicBlockType(value: any): string;
|
|
16
|
+
export declare function resolveSurfaceStyle(input: RunJsAuthoringInspectionInput): RunJsAuthoringSurfaceStyle | undefined;
|
|
17
|
+
export declare function resolveModelSurfaceStyle(modelUse: any): RunJsAuthoringSurfaceStyle | undefined;
|
|
18
|
+
export declare function normalizeActionType(value: any): string;
|
|
19
|
+
export declare function normalizeText(value: any): string;
|
|
@@ -0,0 +1,140 @@
|
|
|
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 surface_exports = {};
|
|
28
|
+
__export(surface_exports, {
|
|
29
|
+
normalizeActionType: () => normalizeActionType,
|
|
30
|
+
normalizeText: () => normalizeText,
|
|
31
|
+
resolveActionModelUse: () => resolveActionModelUse,
|
|
32
|
+
resolveConfigureBlockType: () => resolveConfigureBlockType,
|
|
33
|
+
resolveConfigureModelUse: () => resolveConfigureModelUse,
|
|
34
|
+
resolveFieldModelUse: () => resolveFieldModelUse,
|
|
35
|
+
resolveModelSurfaceStyle: () => resolveModelSurfaceStyle,
|
|
36
|
+
resolvePublicBlockType: () => resolvePublicBlockType,
|
|
37
|
+
resolveSurfaceStyle: () => resolveSurfaceStyle
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(surface_exports);
|
|
40
|
+
var import_constants = require("./constants");
|
|
41
|
+
function resolveFieldModelUse(type, renderer, blockType) {
|
|
42
|
+
if (type === "jsColumn") {
|
|
43
|
+
return "JSColumnModel";
|
|
44
|
+
}
|
|
45
|
+
if (type === "jsItem") {
|
|
46
|
+
return "JSItemModel";
|
|
47
|
+
}
|
|
48
|
+
if (renderer === "js") {
|
|
49
|
+
return ["createForm", "editForm"].includes(blockType) ? "JSEditableFieldModel" : "JSFieldModel";
|
|
50
|
+
}
|
|
51
|
+
return "";
|
|
52
|
+
}
|
|
53
|
+
function resolveActionModelUse(actionType, blockType, slot) {
|
|
54
|
+
if (actionType === "jsItem") {
|
|
55
|
+
return "JSItemActionModel";
|
|
56
|
+
}
|
|
57
|
+
if (actionType !== "js") {
|
|
58
|
+
return "";
|
|
59
|
+
}
|
|
60
|
+
if (slot === "recordActions") {
|
|
61
|
+
return "JSRecordActionModel";
|
|
62
|
+
}
|
|
63
|
+
if (["createForm", "editForm"].includes(blockType)) {
|
|
64
|
+
return "JSFormActionModel";
|
|
65
|
+
}
|
|
66
|
+
if (blockType === "filterForm") {
|
|
67
|
+
return "FilterFormJSActionModel";
|
|
68
|
+
}
|
|
69
|
+
if (["table", "list", "gridCard", "calendar", "kanban"].includes(blockType)) {
|
|
70
|
+
return "JSCollectionActionModel";
|
|
71
|
+
}
|
|
72
|
+
return "JSActionModel";
|
|
73
|
+
}
|
|
74
|
+
function resolveConfigureModelUse(currentNode) {
|
|
75
|
+
var _a, _b;
|
|
76
|
+
const currentUse = normalizeText(currentNode == null ? void 0 : currentNode.use);
|
|
77
|
+
if (import_constants.KNOWN_MODEL_USES.has(currentUse)) {
|
|
78
|
+
return currentUse;
|
|
79
|
+
}
|
|
80
|
+
const fieldUse = normalizeText((_b = (_a = currentNode == null ? void 0 : currentNode.subModels) == null ? void 0 : _a.field) == null ? void 0 : _b.use);
|
|
81
|
+
if (import_constants.KNOWN_MODEL_USES.has(fieldUse)) {
|
|
82
|
+
return fieldUse;
|
|
83
|
+
}
|
|
84
|
+
return "";
|
|
85
|
+
}
|
|
86
|
+
function resolveConfigureBlockType(context) {
|
|
87
|
+
var _a;
|
|
88
|
+
const hostBlockType = normalizeText(context.hostBlockType);
|
|
89
|
+
if (hostBlockType) {
|
|
90
|
+
return resolvePublicBlockType(hostBlockType);
|
|
91
|
+
}
|
|
92
|
+
const currentUse = normalizeText((_a = context.currentNode) == null ? void 0 : _a.use);
|
|
93
|
+
return resolvePublicBlockType(currentUse);
|
|
94
|
+
}
|
|
95
|
+
function resolvePublicBlockType(value) {
|
|
96
|
+
const normalized = normalizeText(value);
|
|
97
|
+
return import_constants.PUBLIC_BLOCK_TYPE_BY_MODEL_USE[normalized] || normalized;
|
|
98
|
+
}
|
|
99
|
+
function resolveSurfaceStyle(input) {
|
|
100
|
+
if (input.surfaceStyle) {
|
|
101
|
+
return input.surfaceStyle;
|
|
102
|
+
}
|
|
103
|
+
const surface = normalizeText(input.surface);
|
|
104
|
+
if (surface && import_constants.SURFACE_STYLE_BY_ID[surface]) {
|
|
105
|
+
return import_constants.SURFACE_STYLE_BY_ID[surface];
|
|
106
|
+
}
|
|
107
|
+
return resolveModelSurfaceStyle(input.modelUse);
|
|
108
|
+
}
|
|
109
|
+
function resolveModelSurfaceStyle(modelUse) {
|
|
110
|
+
const normalized = normalizeText(modelUse);
|
|
111
|
+
if (import_constants.RENDER_MODEL_USES.has(normalized)) {
|
|
112
|
+
return "render";
|
|
113
|
+
}
|
|
114
|
+
if (import_constants.ACTION_MODEL_USES.has(normalized)) {
|
|
115
|
+
return "action";
|
|
116
|
+
}
|
|
117
|
+
if (import_constants.VALUE_MODEL_USES.has(normalized)) {
|
|
118
|
+
return "value";
|
|
119
|
+
}
|
|
120
|
+
return void 0;
|
|
121
|
+
}
|
|
122
|
+
function normalizeActionType(value) {
|
|
123
|
+
const normalized = normalizeText(value);
|
|
124
|
+
return import_constants.ACTION_TYPE_ALIASES.get(normalized.toLowerCase()) || normalized;
|
|
125
|
+
}
|
|
126
|
+
function normalizeText(value) {
|
|
127
|
+
return typeof value === "string" ? value.trim() : "";
|
|
128
|
+
}
|
|
129
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
130
|
+
0 && (module.exports = {
|
|
131
|
+
normalizeActionType,
|
|
132
|
+
normalizeText,
|
|
133
|
+
resolveActionModelUse,
|
|
134
|
+
resolveConfigureBlockType,
|
|
135
|
+
resolveConfigureModelUse,
|
|
136
|
+
resolveFieldModelUse,
|
|
137
|
+
resolveModelSurfaceStyle,
|
|
138
|
+
resolvePublicBlockType,
|
|
139
|
+
resolveSurfaceStyle
|
|
140
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
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 type { FlowSurfaceErrorItemInput } from '../../errors';
|
|
10
|
+
import type { CtxLibMemberCaseMismatch, InvalidCtxLibMemberAccess, InvalidReactRuntimeBinding, ResourceCallInReactHook, RunJsAstInspection, RunJsAuthoringContext, SourceBinding, SourceRange } from '../internal-types';
|
|
11
|
+
import type { RunJsAuthoringInspectionInput, RunJsAuthoringSurfaceStyle } from '../types';
|
|
12
|
+
type IndexedEntry = {
|
|
13
|
+
index: number;
|
|
14
|
+
};
|
|
15
|
+
type CapabilityEntry = IndexedEntry & {
|
|
16
|
+
capability: string;
|
|
17
|
+
};
|
|
18
|
+
export type RunJsScanResult = RunJsAstInspection & {
|
|
19
|
+
blockRanges: SourceRange[];
|
|
20
|
+
ctxAliases: Array<{
|
|
21
|
+
alias: string;
|
|
22
|
+
index: number;
|
|
23
|
+
}>;
|
|
24
|
+
ctxLibMemberCaseMismatches: CtxLibMemberCaseMismatch[];
|
|
25
|
+
ctxMemberAccesses: Array<{
|
|
26
|
+
index: number;
|
|
27
|
+
member: string;
|
|
28
|
+
}>;
|
|
29
|
+
ctxRenderCalls: IndexedEntry[];
|
|
30
|
+
ctxRenderComponentSignatureCalls: Array<CapabilityEntry & {
|
|
31
|
+
component: string;
|
|
32
|
+
}>;
|
|
33
|
+
ctxRequestCalls: IndexedEntry[];
|
|
34
|
+
ctxRunjsCalls: IndexedEntry[];
|
|
35
|
+
directDomAliases: Array<{
|
|
36
|
+
alias: string;
|
|
37
|
+
index: number;
|
|
38
|
+
}>;
|
|
39
|
+
directDomWrites: Array<IndexedEntry & {
|
|
40
|
+
match: string;
|
|
41
|
+
}>;
|
|
42
|
+
dynamicCtxAccesses: IndexedEntry[];
|
|
43
|
+
forbiddenBareGlobals: Array<IndexedEntry & {
|
|
44
|
+
name: string;
|
|
45
|
+
}>;
|
|
46
|
+
functionRanges: SourceRange[];
|
|
47
|
+
invalidCtxLibMemberAccesses: InvalidCtxLibMemberAccess[];
|
|
48
|
+
invalidReactRuntimeBindings: InvalidReactRuntimeBinding[];
|
|
49
|
+
isTopLevelFunctionWrapper: boolean;
|
|
50
|
+
masked: string;
|
|
51
|
+
reactComponentFunctionCalls: Array<CapabilityEntry & {
|
|
52
|
+
component: string;
|
|
53
|
+
}>;
|
|
54
|
+
reactComponentPropReferences: Array<CapabilityEntry & {
|
|
55
|
+
component: string;
|
|
56
|
+
prop: string;
|
|
57
|
+
}>;
|
|
58
|
+
resourceCallsInReactHooks: ResourceCallInReactHook[];
|
|
59
|
+
source: string;
|
|
60
|
+
sourceBindings: SourceBinding[];
|
|
61
|
+
topLevelCtxRenderCalls: IndexedEntry[];
|
|
62
|
+
topLevelReactHookCalls: Array<IndexedEntry & {
|
|
63
|
+
hook: string;
|
|
64
|
+
match: string;
|
|
65
|
+
}>;
|
|
66
|
+
topLevelReturns: IndexedEntry[];
|
|
67
|
+
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
|
+
};
|
|
78
|
+
export type RunJsInspectionRuntime = {
|
|
79
|
+
context: RunJsAuthoringContext;
|
|
80
|
+
input: RunJsAuthoringInspectionInput;
|
|
81
|
+
modelUse: string;
|
|
82
|
+
scan: RunJsScanResult;
|
|
83
|
+
source: string;
|
|
84
|
+
surface: string;
|
|
85
|
+
surfaceStyle: RunJsAuthoringSurfaceStyle;
|
|
86
|
+
};
|
|
87
|
+
export type RunJsInspectionValidator = {
|
|
88
|
+
id: string;
|
|
89
|
+
validate(runtime: RunJsInspectionRuntime): FlowSurfaceErrorItemInput[];
|
|
90
|
+
};
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
+
var types_exports = {};
|
|
24
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -0,0 +1,138 @@
|
|
|
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 type { AstIdentifierBinding, AstIdentifierWrite, CtxApiAlias, CtxApiCapability, CtxApiResourceAliases, CtxApiResourceHandleAlias, CtxApiResourceMethodAlias, CtxLibAlias, CtxLibsRootAlias, CtxMethodAlias, CtxNonFunctionRootAlias, CtxRootAlias, RunJsAstInspection, StaticFilterValueBinding, StaticStringBinding } from '../internal-types';
|
|
10
|
+
export declare function collectCtxRootAliasesFromAst(ast: any, source: string, identifierBindings: AstIdentifierBinding[]): CtxRootAlias[];
|
|
11
|
+
export declare function collectCtxDefiniteRootAliasesFromAst(ast: any, source: string, identifierBindings: AstIdentifierBinding[]): CtxRootAlias[];
|
|
12
|
+
export declare function collectCtxNonFunctionRootAliasesFromAst(ast: any, source: string, ctxRootAliases: CtxRootAlias[], identifierBindings: AstIdentifierBinding[], modelUse?: string): CtxNonFunctionRootAlias[];
|
|
13
|
+
export declare function collectAstInvalidCtxNonFunctionCall(node: any, ctxRootAliases: CtxRootAlias[], ctxNonFunctionRootAliases: CtxNonFunctionRootAlias[], identifierBindings: AstIdentifierBinding[], modelUse?: string): RunJsAstInspection['invalidCtxNonFunctionCalls'];
|
|
14
|
+
export declare function collectCtxMethodAliasesFromAst(ast: any, source: string, identifierBindings: AstIdentifierBinding[]): CtxMethodAlias[];
|
|
15
|
+
export declare function collectCtxApiAliasesFromAst(ast: any, source: string, identifierBindings: AstIdentifierBinding[]): CtxApiAlias[];
|
|
16
|
+
export declare function collectCtxApiObjectPatternAliases(pattern: any, capability: CtxApiCapability | '', addAlias: (name: string, capability: CtxApiCapability, node?: any) => void): void;
|
|
17
|
+
export declare function trimCtxApiAliasesAfterWrites(aliases: CtxApiAlias[], writes: AstIdentifierWrite[], identifierBindings: AstIdentifierBinding[]): CtxApiAlias[];
|
|
18
|
+
export declare function collectCtxLibsRootAliasesFromAst(ast: any, source: string, identifierBindings: AstIdentifierBinding[]): CtxLibsRootAlias[];
|
|
19
|
+
export declare function collectCtxLibAliasesFromAst(ast: any, source: string, rootAliases: CtxLibsRootAlias[], identifierBindings: AstIdentifierBinding[]): CtxLibAlias[];
|
|
20
|
+
export declare function collectCtxLibObjectPatternAliases(pattern: any, sourceNode: any, rootAliases: CtxLibsRootAlias[], identifierBindings: AstIdentifierBinding[], addAlias: (name: string, alias: {
|
|
21
|
+
capability: string;
|
|
22
|
+
library: string;
|
|
23
|
+
}, node?: any) => void): void;
|
|
24
|
+
export declare function collectCtxApiResourceAliasesFromAst(ast: any, source: string, ctxApiAliases: CtxApiAlias[], stringBindings: StaticStringBinding[], staticFilterValueBindings: StaticFilterValueBinding[], identifierBindings: AstIdentifierBinding[]): CtxApiResourceAliases;
|
|
25
|
+
export declare function collectAstInvalidApiResourceCall(node: any, aliases: CtxApiAlias[], resourceAliases: CtxApiResourceAliases, source: string, identifierBindings: AstIdentifierBinding[]): RunJsAstInspection['invalidApiResourceCalls'];
|
|
26
|
+
export declare function getCtxApiResourceChainedMethodFromAst(node: any, aliases: CtxApiAlias[], resourceAliases: CtxApiResourceAliases, source: string, identifierBindings: AstIdentifierBinding[]): RunJsAstInspection['invalidApiResourceCalls'][number] | undefined;
|
|
27
|
+
export declare function getWrappedCtxApiResourceChainedMethodFromAst(node: any, aliases: CtxApiAlias[], resourceAliases: CtxApiResourceAliases, source: string, identifierBindings: AstIdentifierBinding[]): RunJsAstInspection['invalidApiResourceCalls'][number] | undefined;
|
|
28
|
+
export declare function getCtxApiResourceHandleAliasFromAst(node: any, aliases: CtxApiResourceHandleAlias[], identifierBindings: AstIdentifierBinding[]): CtxApiResourceHandleAlias | undefined;
|
|
29
|
+
export declare function getCtxApiResourceMethodAliasFromAst(node: any, aliases: CtxApiResourceMethodAlias[], identifierBindings: AstIdentifierBinding[]): CtxApiResourceMethodAlias | undefined;
|
|
30
|
+
export declare function getMaybeCtxApiResourceHandleAliasFromAst(node: any, aliases: CtxApiResourceHandleAlias[], identifierBindings: AstIdentifierBinding[]): CtxApiResourceHandleAlias | undefined;
|
|
31
|
+
export declare function collectMaybeCtxApiResourceHandleAliasesFromAst(node: any, aliases: CtxApiResourceHandleAlias[], identifierBindings: AstIdentifierBinding[]): CtxApiResourceHandleAlias[];
|
|
32
|
+
export declare function getUniqueCtxApiResourceHandleAlias(aliases: CtxApiResourceHandleAlias[]): CtxApiResourceHandleAlias;
|
|
33
|
+
export declare function getCtxApiResourceHandleAliasIdentity(alias: CtxApiResourceHandleAlias): string;
|
|
34
|
+
export declare function getMaybeCtxApiResourceMethodAliasFromAst(node: any, aliases: CtxApiResourceMethodAlias[], identifierBindings: AstIdentifierBinding[]): CtxApiResourceMethodAlias | undefined;
|
|
35
|
+
export declare function getCtxApiResourceCallFromAst(node: any, aliases: CtxApiAlias[], source: string, identifierBindings: AstIdentifierBinding[]): {
|
|
36
|
+
args: any[];
|
|
37
|
+
calleeSource: string;
|
|
38
|
+
index: number;
|
|
39
|
+
} | undefined;
|
|
40
|
+
export declare function getCtxApiResourceCalleeFromAst(node: any, aliases: CtxApiAlias[], source: string, identifierBindings: AstIdentifierBinding[]): {
|
|
41
|
+
index: number;
|
|
42
|
+
source: string;
|
|
43
|
+
} | undefined;
|
|
44
|
+
export declare function getMaybeCtxApiResourceCallFromAst(node: any, aliases: CtxApiAlias[], source: string, identifierBindings: AstIdentifierBinding[]): {
|
|
45
|
+
args: any[];
|
|
46
|
+
calleeSource: string;
|
|
47
|
+
index: number;
|
|
48
|
+
} | undefined;
|
|
49
|
+
export declare function collectMaybeCtxApiResourceCallsFromAst(node: any, aliases: CtxApiAlias[], source: string, identifierBindings: AstIdentifierBinding[]): Array<{
|
|
50
|
+
args: any[];
|
|
51
|
+
calleeSource: string;
|
|
52
|
+
index: number;
|
|
53
|
+
}>;
|
|
54
|
+
export declare function getUniqueCtxApiResourceCall(calls: Array<{
|
|
55
|
+
args: any[];
|
|
56
|
+
calleeSource: string;
|
|
57
|
+
index: number;
|
|
58
|
+
}>, source: string): {
|
|
59
|
+
args: any[];
|
|
60
|
+
calleeSource: string;
|
|
61
|
+
index: number;
|
|
62
|
+
};
|
|
63
|
+
export declare function getCtxApiResourceCallIdentity(call: {
|
|
64
|
+
args: any[];
|
|
65
|
+
calleeSource: string;
|
|
66
|
+
index: number;
|
|
67
|
+
}, source: string): string;
|
|
68
|
+
export declare function filterInvalidCtxApiMemberAccessesForResourceCalls(memberAccesses: RunJsAstInspection['invalidCtxApiMemberAccesses'], resourceCalls: RunJsAstInspection['invalidApiResourceCalls']): RunJsAstInspection['invalidCtxApiMemberAccesses'];
|
|
69
|
+
export declare function isCtxApiResourcePath(path: ReturnType<typeof getCtxApiMemberPathFromAst>): path is NonNullable<ReturnType<typeof getCtxApiMemberPathFromAst>>;
|
|
70
|
+
export declare function collectAstInvalidCtxLibPatternAccesses(ast: any, aliases: CtxLibAlias[], rootAliases: CtxLibsRootAlias[], identifierBindings: AstIdentifierBinding[], source: string): RunJsAstInspection['invalidCtxLibMemberAccesses'];
|
|
71
|
+
export declare function collectInvalidCtxLibObjectPatternAccesses(pattern: any, sourcePath: NonNullable<ReturnType<typeof getCtxLibMemberPathFromAst>>): RunJsAstInspection['invalidCtxLibMemberAccesses'];
|
|
72
|
+
export declare function collectAstInvalidCtxLibMemberAccess(node: any, aliases: CtxLibAlias[], rootAliases: CtxLibsRootAlias[], identifierBindings: AstIdentifierBinding[], source: string): RunJsAstInspection['invalidCtxLibMemberAccesses'][number] | undefined;
|
|
73
|
+
export declare function buildInvalidCtxLibMemberAccess(path: {
|
|
74
|
+
library: string;
|
|
75
|
+
members: Array<{
|
|
76
|
+
accessKind: 'bracket' | 'destructure' | 'member';
|
|
77
|
+
index: number;
|
|
78
|
+
name: string;
|
|
79
|
+
}>;
|
|
80
|
+
rootCapability: string;
|
|
81
|
+
}): RunJsAstInspection['invalidCtxLibMemberAccesses'][number] | undefined;
|
|
82
|
+
export declare function getCtxLibMemberCapability(rootCapability: string, member: {
|
|
83
|
+
accessKind: 'bracket' | 'destructure' | 'member';
|
|
84
|
+
name: string;
|
|
85
|
+
}): string;
|
|
86
|
+
export declare function getSuggestedCtxLibMemberImport(library: string, member: string): string;
|
|
87
|
+
export declare function getCtxLibMemberPathFromAst(node: any, aliases: CtxLibAlias[], rootAliases: CtxLibsRootAlias[], identifierBindings: AstIdentifierBinding[], source: string): {
|
|
88
|
+
dynamicIndex: number;
|
|
89
|
+
hasDynamicMember: boolean;
|
|
90
|
+
library: string;
|
|
91
|
+
libraryIndex: number;
|
|
92
|
+
memberIndex: number;
|
|
93
|
+
members: Array<{
|
|
94
|
+
accessKind: 'bracket' | 'destructure' | 'member';
|
|
95
|
+
index: number;
|
|
96
|
+
name: string;
|
|
97
|
+
}>;
|
|
98
|
+
rootCapability: string;
|
|
99
|
+
} | undefined;
|
|
100
|
+
export declare function getDirectCtxLibPathFromAst(node: any, rootAliases: CtxLibsRootAlias[], identifierBindings: AstIdentifierBinding[], source: string): ReturnType<typeof getCtxLibMemberPathFromAst>;
|
|
101
|
+
export declare function isCtxLibsRootFromAst(node: any, rootAliases: CtxLibsRootAlias[], identifierBindings: AstIdentifierBinding[]): boolean;
|
|
102
|
+
export declare function collectAstInvalidCtxApiPatternAccesses(ast: any, aliases: CtxApiAlias[], identifierBindings: AstIdentifierBinding[]): RunJsAstInspection['invalidCtxApiMemberAccesses'];
|
|
103
|
+
export declare function getCtxApiCapabilityMemberPrefix(capability: CtxApiAlias['capability']): string[];
|
|
104
|
+
export declare function collectInvalidCtxApiObjectPatternAccesses(pattern: any, prefix: string[]): RunJsAstInspection['invalidCtxApiMemberAccesses'];
|
|
105
|
+
export declare function collectAstInvalidCtxApiMemberAccess(node: any, aliases: CtxApiAlias[], identifierBindings: AstIdentifierBinding[], source: string): RunJsAstInspection['invalidCtxApiMemberAccesses'][number] | undefined;
|
|
106
|
+
export declare function buildInvalidCtxApiMemberAccess(memberPath: string[], index: number, hasDynamicMember?: boolean): RunJsAstInspection['invalidCtxApiMemberAccesses'][number] | undefined;
|
|
107
|
+
export declare function collectAstInvalidCtxApiReadonlyWrites(node: any, aliases: CtxApiAlias[], identifierBindings: AstIdentifierBinding[]): RunJsAstInspection['invalidCtxApiMemberAccesses'];
|
|
108
|
+
export declare function collectAstWriteTargetNodes(node: any, visit: (node: any) => void): void;
|
|
109
|
+
export declare function getCtxApiMemberAccessFromAst(node: any, aliases: CtxApiAlias[], identifierBindings: AstIdentifierBinding[]): {
|
|
110
|
+
dynamicIndex: number;
|
|
111
|
+
hasDynamicMember: boolean;
|
|
112
|
+
memberIndex: number;
|
|
113
|
+
memberPath: string[];
|
|
114
|
+
} | undefined;
|
|
115
|
+
export declare function getCtxApiMemberPathFromAst(node: any, aliases: CtxApiAlias[], identifierBindings: AstIdentifierBinding[]): {
|
|
116
|
+
dynamicIndex: number;
|
|
117
|
+
hasDynamicMember: boolean;
|
|
118
|
+
isCtxApi: true;
|
|
119
|
+
memberIndex: number;
|
|
120
|
+
members: Array<{
|
|
121
|
+
index: number;
|
|
122
|
+
name: string;
|
|
123
|
+
}>;
|
|
124
|
+
} | undefined;
|
|
125
|
+
export declare function getCtxApiAliasMemberPath(alias: CtxApiAlias, index: number): Array<{
|
|
126
|
+
index: number;
|
|
127
|
+
name: string;
|
|
128
|
+
}>;
|
|
129
|
+
export declare function getCtxApiCapabilityMemberPath(capability: CtxApiAlias['capability'], index: number): Array<{
|
|
130
|
+
index: number;
|
|
131
|
+
name: string;
|
|
132
|
+
}>;
|
|
133
|
+
export declare function getCtxApiCapabilityFromAst(node: any, aliases: CtxApiAlias[], identifierBindings: AstIdentifierBinding[]): CtxApiAlias['capability'] | '';
|
|
134
|
+
export declare function getMaybeCtxApiCapabilityFromAst(node: any, aliases: CtxApiAlias[], identifierBindings: AstIdentifierBinding[]): CtxApiAlias['capability'] | '';
|
|
135
|
+
export declare function collectPossibleCtxApiCapabilitiesFromAst(node: any, aliases: CtxApiAlias[], identifierBindings: AstIdentifierBinding[]): CtxApiAlias['capability'][];
|
|
136
|
+
export declare function selectCtxApiCapability(capabilities: CtxApiAlias['capability'][]): CtxApiAlias['capability'] | '';
|
|
137
|
+
export declare function uniqueCtxApiCapabilities(capabilities: Array<CtxApiAlias['capability'] | ''>): CtxApiAlias['capability'][];
|
|
138
|
+
export declare function isCtxApiCapabilityDefinitelyTruthy(capability: CtxApiAlias['capability']): boolean;
|