@nocobase/plugin-flow-engine 2.2.0-beta.1 → 2.2.0-beta.11
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/client/index.js +1 -1
- package/dist/externalVersion.js +9 -9
- package/dist/locale/en-US.json +1 -0
- package/dist/locale/index.d.ts +2 -0
- package/dist/locale/zh-CN.json +1 -0
- 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/{runjs-authoring/blocked-global-stop/index.d.ts → approval/authoring-validation.d.ts} +1 -2
- package/dist/server/flow-surfaces/approval/authoring-validation.js +1151 -0
- package/dist/server/flow-surfaces/approval/blueprint-service.js +2 -0
- package/dist/server/flow-surfaces/authoring-validation.d.ts +2 -1
- package/dist/server/flow-surfaces/authoring-validation.js +639 -59
- package/dist/server/flow-surfaces/blueprint/compile-blocks.js +7 -3
- package/dist/server/flow-surfaces/blueprint/compile-plan.js +19 -15
- package/dist/server/flow-surfaces/blueprint/export-document.d.ts +50 -0
- package/dist/server/flow-surfaces/blueprint/export-document.js +2510 -0
- package/dist/server/flow-surfaces/blueprint/normalize-document.js +2 -1
- package/dist/server/flow-surfaces/blueprint/public-types.d.ts +1 -0
- package/dist/server/flow-surfaces/builder.js +43 -5
- package/dist/server/flow-surfaces/catalog.js +13 -2
- package/dist/server/flow-surfaces/configure-options.js +5 -3
- package/dist/server/flow-surfaces/constants.d.ts +9 -2
- package/dist/server/flow-surfaces/constants.js +1 -0
- package/dist/server/flow-surfaces/contract-guard.js +37 -5
- package/dist/server/flow-surfaces/default-action-popup.d.ts +2 -0
- package/dist/server/flow-surfaces/default-action-popup.js +27 -13
- package/dist/server/flow-surfaces/filter-group.d.ts +19 -2
- package/dist/server/flow-surfaces/filter-group.js +232 -3
- package/dist/server/flow-surfaces/planning/compiler.d.ts +1 -0
- package/dist/server/flow-surfaces/planning/compiler.js +205 -82
- package/dist/server/flow-surfaces/planning/key-registry.d.ts +1 -1
- package/dist/server/flow-surfaces/planning/runtime.js +1 -0
- package/dist/server/flow-surfaces/planning/step-link.d.ts +1 -1
- package/dist/server/flow-surfaces/planning/step-link.js +22 -3
- package/dist/server/flow-surfaces/public-data-surface-default-filter.js +0 -9
- package/dist/server/flow-surfaces/reaction/field-value.d.ts +9 -0
- package/dist/server/flow-surfaces/reaction/field-value.js +51 -2
- package/dist/server/flow-surfaces/reaction/linkage.d.ts +6 -1
- package/dist/server/flow-surfaces/reaction/linkage.js +18 -3
- package/dist/server/flow-surfaces/reaction/meta.js +19 -1
- package/dist/server/flow-surfaces/reaction/types.d.ts +19 -0
- package/dist/server/flow-surfaces/relation-backing-foreign-key.d.ts +10 -0
- package/dist/server/flow-surfaces/relation-backing-foreign-key.js +79 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/source.d.ts +1 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/source.js +20 -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 +11 -19
- package/dist/server/flow-surfaces/runjs-authoring/runtime/types.d.ts +0 -12
- package/dist/server/flow-surfaces/runjs-authoring/scan/filter.js +12 -2
- package/dist/server/flow-surfaces/runjs-authoring/scan/index.d.ts +0 -14
- package/dist/server/flow-surfaces/runjs-authoring/scan/index.js +10 -8
- 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 +53 -0
- package/dist/server/flow-surfaces/service.js +997 -127
- package/dist/server/flow-surfaces/types.d.ts +2 -1
- package/dist/server/variables/records.js +7 -2
- package/dist/server/variables/registry.js +3 -0
- package/dist/swagger/flow-surfaces.d.ts +193 -0
- package/dist/swagger/flow-surfaces.examples.d.ts +11 -0
- package/dist/swagger/flow-surfaces.examples.js +11 -0
- package/dist/swagger/flow-surfaces.js +179 -10
- package/dist/swagger/index.d.ts +193 -0
- package/package.json +2 -2
- package/dist/server/flow-surfaces/runjs-authoring/blocked-global-stop/index.js +0 -40
|
@@ -11,4 +11,4 @@ import type { FlowSurfacePlanStepLink } from '../types';
|
|
|
11
11
|
export declare const isFlowSurfacePlanStepLink: typeof isFlowSurfacePlanStepValue;
|
|
12
12
|
export declare function normalizeFlowSurfacePlanStepLink(actionName: string, input: any, fieldName: string): FlowSurfacePlanStepLink;
|
|
13
13
|
export declare function assertFlowSurfaceKnownPlanStepLink(actionName: string, stepLink: FlowSurfacePlanStepLink, fieldName: string, knownStepIds?: Set<string>): void;
|
|
14
|
-
export declare function replaceFlowSurfacePlanStepLinks(actionName: string, input: any, path: string, knownStepIds?: Set<string>, knownRuntimeKeys?: Set<string>): any;
|
|
14
|
+
export declare function replaceFlowSurfacePlanStepLinks(actionName: string, input: any, path: string, knownStepIds?: Set<string>, knownRuntimeKeys?: Set<string>, blockedRuntimeKeys?: Set<string>): any;
|
|
@@ -56,10 +56,17 @@ function assertFlowSurfaceKnownPlanStepLink(actionName, stepLink, fieldName, kno
|
|
|
56
56
|
}
|
|
57
57
|
(0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} ${fieldName}.step '${stepLink.step}' is not a previous step id`);
|
|
58
58
|
}
|
|
59
|
-
function replaceFlowSurfacePlanStepLinks(actionName, input, path, knownStepIds, knownRuntimeKeys) {
|
|
59
|
+
function replaceFlowSurfacePlanStepLinks(actionName, input, path, knownStepIds, knownRuntimeKeys, blockedRuntimeKeys) {
|
|
60
60
|
if (Array.isArray(input)) {
|
|
61
61
|
return input.map(
|
|
62
|
-
(item, index) => replaceFlowSurfacePlanStepLinks(
|
|
62
|
+
(item, index) => replaceFlowSurfacePlanStepLinks(
|
|
63
|
+
actionName,
|
|
64
|
+
item,
|
|
65
|
+
`${path}[${index}]`,
|
|
66
|
+
knownStepIds,
|
|
67
|
+
knownRuntimeKeys,
|
|
68
|
+
blockedRuntimeKeys
|
|
69
|
+
)
|
|
63
70
|
);
|
|
64
71
|
}
|
|
65
72
|
if (!import_lodash.default.isPlainObject(input)) {
|
|
@@ -81,6 +88,11 @@ function replaceFlowSurfacePlanStepLinks(actionName, input, path, knownStepIds,
|
|
|
81
88
|
if (!runtimeKey) {
|
|
82
89
|
(0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} ${path}.key cannot be empty`);
|
|
83
90
|
}
|
|
91
|
+
if (blockedRuntimeKeys == null ? void 0 : blockedRuntimeKeys.has(runtimeKey)) {
|
|
92
|
+
(0, import_errors.throwBadRequest)(
|
|
93
|
+
`flowSurfaces ${actionName} ${path}.key '${runtimeKey}' belongs to the current replace scope; replace-step key links cannot resolve to old replace subtree nodes`
|
|
94
|
+
);
|
|
95
|
+
}
|
|
84
96
|
if (!(knownRuntimeKeys == null ? void 0 : knownRuntimeKeys.has(runtimeKey))) {
|
|
85
97
|
(0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} ${path}.key '${runtimeKey}' is not defined`);
|
|
86
98
|
}
|
|
@@ -91,7 +103,14 @@ function replaceFlowSurfacePlanStepLinks(actionName, input, path, knownStepIds,
|
|
|
91
103
|
return Object.fromEntries(
|
|
92
104
|
Object.entries(input).map(([key, value]) => [
|
|
93
105
|
key,
|
|
94
|
-
replaceFlowSurfacePlanStepLinks(
|
|
106
|
+
replaceFlowSurfacePlanStepLinks(
|
|
107
|
+
actionName,
|
|
108
|
+
value,
|
|
109
|
+
`${path}.${key}`,
|
|
110
|
+
knownStepIds,
|
|
111
|
+
knownRuntimeKeys,
|
|
112
|
+
blockedRuntimeKeys
|
|
113
|
+
)
|
|
95
114
|
])
|
|
96
115
|
);
|
|
97
116
|
}
|
|
@@ -299,9 +299,7 @@ function backfillFlowSurfaceDefaultFilterSetting(settings, defaultFilter) {
|
|
|
299
299
|
if (import_lodash.default.isUndefined(defaultFilter)) {
|
|
300
300
|
return settings;
|
|
301
301
|
}
|
|
302
|
-
const filterableFieldNames = resolveFlowSurfaceDefaultFilterFieldNames(defaultFilter);
|
|
303
302
|
const defaults = {
|
|
304
|
-
...filterableFieldNames.length ? { filterableFieldNames } : {},
|
|
305
303
|
defaultFilter: import_lodash.default.cloneDeep(defaultFilter)
|
|
306
304
|
};
|
|
307
305
|
if (import_lodash.default.isUndefined(settings)) {
|
|
@@ -311,13 +309,6 @@ function backfillFlowSurfaceDefaultFilterSetting(settings, defaultFilter) {
|
|
|
311
309
|
return settings;
|
|
312
310
|
}
|
|
313
311
|
if (Object.prototype.hasOwnProperty.call(settings, "defaultFilter")) {
|
|
314
|
-
const explicitFilterableFieldNames = resolveFlowSurfaceDefaultFilterFieldNames(settings.defaultFilter);
|
|
315
|
-
if (!Object.prototype.hasOwnProperty.call(settings, "filterableFieldNames") && explicitFilterableFieldNames.length) {
|
|
316
|
-
return {
|
|
317
|
-
...import_lodash.default.cloneDeep(settings),
|
|
318
|
-
filterableFieldNames: explicitFilterableFieldNames
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
312
|
return settings;
|
|
322
313
|
}
|
|
323
314
|
return {
|
|
@@ -17,6 +17,15 @@ export type FlowSurfaceFieldValueCompileResult = FlowSurfaceReactionWriteResult<
|
|
|
17
17
|
export declare function isFieldValueTargetUseSupported(use?: string | null): boolean;
|
|
18
18
|
export declare function assertFieldValueTargetSupported(target: FlowSurfaceFieldValueTarget): void;
|
|
19
19
|
export declare function normalizeFieldValueRules(rules: FlowSurfaceFieldValueRule[] | undefined): FlowSurfaceFieldValueRule[];
|
|
20
|
+
export declare function validateFieldValueRulesAgainstCapability(rules: FlowSurfaceFieldValueRule[], capability: {
|
|
21
|
+
conditionMeta: {
|
|
22
|
+
operatorsByPath: Record<string, string[]>;
|
|
23
|
+
fieldMetaByPath?: Record<string, {
|
|
24
|
+
type?: string;
|
|
25
|
+
interface?: string;
|
|
26
|
+
}>;
|
|
27
|
+
};
|
|
28
|
+
}): void;
|
|
20
29
|
export declare function compileFieldValueRulesToCanonical(rules: FlowSurfaceFieldValueRule[] | undefined): {
|
|
21
30
|
key: string;
|
|
22
31
|
enable: boolean;
|
|
@@ -41,11 +41,13 @@ __export(field_value_exports, {
|
|
|
41
41
|
collectUpdateAssociationValuesFromFieldValueRules: () => collectUpdateAssociationValuesFromFieldValueRules,
|
|
42
42
|
compileFieldValueRulesToCanonical: () => compileFieldValueRulesToCanonical,
|
|
43
43
|
isFieldValueTargetUseSupported: () => isFieldValueTargetUseSupported,
|
|
44
|
-
normalizeFieldValueRules: () => normalizeFieldValueRules
|
|
44
|
+
normalizeFieldValueRules: () => normalizeFieldValueRules,
|
|
45
|
+
validateFieldValueRulesAgainstCapability: () => validateFieldValueRulesAgainstCapability
|
|
45
46
|
});
|
|
46
47
|
module.exports = __toCommonJS(field_value_exports);
|
|
47
48
|
var import_lodash = __toESM(require("lodash"));
|
|
48
49
|
var import_errors = require("../errors");
|
|
50
|
+
var import_filter_group = require("../filter-group");
|
|
49
51
|
var import_errors2 = require("./errors");
|
|
50
52
|
var import_fingerprint = require("./fingerprint");
|
|
51
53
|
var import_registry = require("./registry");
|
|
@@ -85,6 +87,52 @@ function normalizeFieldValueRules(rules) {
|
|
|
85
87
|
const list = Array.isArray(rules) ? rules : [];
|
|
86
88
|
return list.map((rule, index) => normalizeFieldValueRule(rule, index));
|
|
87
89
|
}
|
|
90
|
+
function validateFieldValueRulesAgainstCapability(rules, capability) {
|
|
91
|
+
for (const [ruleIndex, rule] of (rules || []).entries()) {
|
|
92
|
+
validateFieldValueDateConditionFilter(rule.when, capability, `rules[${ruleIndex}].when`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function validateFieldValueDateConditionFilter(filter, capability, prefix) {
|
|
96
|
+
const visit = (node, currentPrefix) => {
|
|
97
|
+
var _a;
|
|
98
|
+
if (!import_lodash.default.isPlainObject(node)) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (Array.isArray(node.items)) {
|
|
102
|
+
node.items.forEach((item, index) => visit(item, `${currentPrefix}.items[${index}]`));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const operator = typeof node.operator === "string" ? node.operator.trim() : "";
|
|
106
|
+
const path = typeof node.path === "string" ? node.path.trim() : "";
|
|
107
|
+
if (!operator || !path || !Object.prototype.hasOwnProperty.call(node, "value")) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const fieldMeta = resolveFieldValueConditionFieldMeta(path, (_a = capability.conditionMeta) == null ? void 0 : _a.fieldMetaByPath);
|
|
111
|
+
if (!import_filter_group.FLOW_SURFACE_DATE_FILTER_OPERATORS.has(operator) && !(0, import_filter_group.isFlowSurfaceDateLikeFieldMeta)(fieldMeta)) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
(0, import_filter_group.normalizeFlowSurfaceDateConditionValue)(operator, node.value, `${currentPrefix}.value`, {
|
|
115
|
+
fieldPath: path,
|
|
116
|
+
fieldType: fieldMeta == null ? void 0 : fieldMeta.type,
|
|
117
|
+
fieldInterface: fieldMeta == null ? void 0 : fieldMeta.interface,
|
|
118
|
+
allowContextPathValue: true
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
visit(filter, prefix);
|
|
122
|
+
}
|
|
123
|
+
function resolveFieldValueConditionFieldMeta(path, fieldMetaByPath) {
|
|
124
|
+
if (!fieldMetaByPath) {
|
|
125
|
+
return void 0;
|
|
126
|
+
}
|
|
127
|
+
if (fieldMetaByPath[path]) {
|
|
128
|
+
return fieldMetaByPath[path];
|
|
129
|
+
}
|
|
130
|
+
const wildcardPath = Object.keys(fieldMetaByPath).filter((candidate) => candidate.endsWith(".*")).sort((a, b) => b.length - a.length).find((candidate) => {
|
|
131
|
+
const prefix = candidate.slice(0, -2);
|
|
132
|
+
return path.startsWith(`${prefix}.`) && path.length > prefix.length + 1;
|
|
133
|
+
});
|
|
134
|
+
return wildcardPath ? fieldMetaByPath[wildcardPath] : void 0;
|
|
135
|
+
}
|
|
88
136
|
function compileFieldValueRulesToCanonical(rules) {
|
|
89
137
|
return normalizeFieldValueRules(rules).map((rule) => ({
|
|
90
138
|
key: rule.key,
|
|
@@ -177,5 +225,6 @@ function buildFieldValueWriteResult(params) {
|
|
|
177
225
|
collectUpdateAssociationValuesFromFieldValueRules,
|
|
178
226
|
compileFieldValueRulesToCanonical,
|
|
179
227
|
isFieldValueTargetUseSupported,
|
|
180
|
-
normalizeFieldValueRules
|
|
228
|
+
normalizeFieldValueRules,
|
|
229
|
+
validateFieldValueRulesAgainstCapability
|
|
181
230
|
});
|
|
@@ -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
|
-
import type { FlowSurfaceActionLinkageRule, FlowSurfaceFieldLinkageRule, FlowSurfaceFieldLinkageScene, FlowSurfaceFieldOption, FlowSurfaceFieldPathToUidResolver, FlowSurfaceFieldUidToPathResolver, FlowSurfaceBlockLinkageRule } from './types';
|
|
9
|
+
import type { FlowSurfaceActionLinkageRule, FlowSurfaceFieldLinkageRule, FlowSurfaceFieldLinkageScene, FlowSurfaceFieldOption, FlowSurfaceFieldPathToUidResolver, FlowSurfaceFieldUidToPathResolver, FlowSurfaceReactionFilter, FlowSurfaceBlockLinkageRule } from './types';
|
|
10
10
|
type NormalizeFieldRuleOptions = {
|
|
11
11
|
scene: FlowSurfaceFieldLinkageScene;
|
|
12
12
|
resolveFieldPath?: FlowSurfaceFieldUidToPathResolver;
|
|
@@ -18,6 +18,10 @@ type CompileFieldRuleOptions = {
|
|
|
18
18
|
type FlowSurfaceLinkageValidationCapability = {
|
|
19
19
|
conditionMeta: {
|
|
20
20
|
operatorsByPath: Record<string, string[]>;
|
|
21
|
+
fieldMetaByPath?: Record<string, {
|
|
22
|
+
type?: string;
|
|
23
|
+
interface?: string;
|
|
24
|
+
}>;
|
|
21
25
|
};
|
|
22
26
|
};
|
|
23
27
|
type FlowSurfaceFieldLinkageValidationCapability = FlowSurfaceLinkageValidationCapability & {
|
|
@@ -26,6 +30,7 @@ type FlowSurfaceFieldLinkageValidationCapability = FlowSurfaceLinkageValidationC
|
|
|
26
30
|
supportedSources: Array<'literal' | 'path' | 'runjs'>;
|
|
27
31
|
};
|
|
28
32
|
};
|
|
33
|
+
export declare function validateReactionFilterAgainstCapability(filter: FlowSurfaceReactionFilter | undefined, capability: FlowSurfaceLinkageValidationCapability, prefix: string): void;
|
|
29
34
|
export declare function buildReactionFingerprint(value: any): string;
|
|
30
35
|
export declare function normalizeBlockLinkageRules(rawRules: unknown): FlowSurfaceBlockLinkageRule[];
|
|
31
36
|
export declare function normalizeActionLinkageRules(rawRules: unknown): FlowSurfaceActionLinkageRule[];
|
|
@@ -48,7 +48,8 @@ __export(linkage_exports, {
|
|
|
48
48
|
validateBlockLinkageRulesAgainstCapability: () => validateBlockLinkageRulesAgainstCapability,
|
|
49
49
|
validateBlockLinkageSceneSupport: () => validateBlockLinkageSceneSupport,
|
|
50
50
|
validateFieldLinkageRulesAgainstCapability: () => validateFieldLinkageRulesAgainstCapability,
|
|
51
|
-
validateFieldLinkageSceneSupport: () => validateFieldLinkageSceneSupport
|
|
51
|
+
validateFieldLinkageSceneSupport: () => validateFieldLinkageSceneSupport,
|
|
52
|
+
validateReactionFilterAgainstCapability: () => validateReactionFilterAgainstCapability
|
|
52
53
|
});
|
|
53
54
|
module.exports = __toCommonJS(linkage_exports);
|
|
54
55
|
var import_node_crypto = require("node:crypto");
|
|
@@ -148,7 +149,10 @@ function normalizeReactionFilter(rawFilter) {
|
|
|
148
149
|
}
|
|
149
150
|
const normalizedFilter = (0, import_filter_group.normalizeFlowSurfaceCompatibleFilterGroupValue)(
|
|
150
151
|
rawFilter,
|
|
151
|
-
"flowSurfaces linkage rule condition"
|
|
152
|
+
"flowSurfaces linkage rule condition",
|
|
153
|
+
{
|
|
154
|
+
allowContextPathValue: true
|
|
155
|
+
}
|
|
152
156
|
);
|
|
153
157
|
const visit = (node) => {
|
|
154
158
|
if (!import_lodash.default.isPlainObject(node)) {
|
|
@@ -639,6 +643,7 @@ function validateReactionFilterAgainstCapability(filter, capability, prefix) {
|
|
|
639
643
|
var _a;
|
|
640
644
|
const operatorsByPath = ((_a = capability.conditionMeta) == null ? void 0 : _a.operatorsByPath) || {};
|
|
641
645
|
const visit = (node, currentPrefix) => {
|
|
646
|
+
var _a2, _b;
|
|
642
647
|
if (!import_lodash.default.isPlainObject(node)) {
|
|
643
648
|
return;
|
|
644
649
|
}
|
|
@@ -683,6 +688,15 @@ function validateReactionFilterAgainstCapability(filter, capability, prefix) {
|
|
|
683
688
|
);
|
|
684
689
|
}
|
|
685
690
|
if (hasValue) {
|
|
691
|
+
const fieldMeta = (_b = (_a2 = capability.conditionMeta) == null ? void 0 : _a2.fieldMetaByPath) == null ? void 0 : _b[operatorPath];
|
|
692
|
+
if (import_filter_group.FLOW_SURFACE_DATE_FILTER_OPERATORS.has(operator) || (0, import_filter_group.isFlowSurfaceDateLikeFieldMeta)(fieldMeta)) {
|
|
693
|
+
(0, import_filter_group.normalizeFlowSurfaceDateConditionValue)(operator, node.value, `${currentPrefix}.value`, {
|
|
694
|
+
fieldPath: path,
|
|
695
|
+
fieldType: fieldMeta == null ? void 0 : fieldMeta.type,
|
|
696
|
+
fieldInterface: fieldMeta == null ? void 0 : fieldMeta.interface,
|
|
697
|
+
allowContextPathValue: true
|
|
698
|
+
});
|
|
699
|
+
}
|
|
686
700
|
validateContextBoundValue(node.value, capability, `${currentPrefix}.value`);
|
|
687
701
|
}
|
|
688
702
|
};
|
|
@@ -895,5 +909,6 @@ function compileFieldLinkageCanonicalRules(rules, options) {
|
|
|
895
909
|
validateBlockLinkageRulesAgainstCapability,
|
|
896
910
|
validateBlockLinkageSceneSupport,
|
|
897
911
|
validateFieldLinkageRulesAgainstCapability,
|
|
898
|
-
validateFieldLinkageSceneSupport
|
|
912
|
+
validateFieldLinkageSceneSupport,
|
|
913
|
+
validateReactionFilterAgainstCapability
|
|
899
914
|
});
|
|
@@ -114,6 +114,19 @@ function buildConditionOperatorsByPath(context) {
|
|
|
114
114
|
}
|
|
115
115
|
return operatorsByPath;
|
|
116
116
|
}
|
|
117
|
+
function buildConditionFieldMetaByPath(context) {
|
|
118
|
+
const fieldMetaByPath = {};
|
|
119
|
+
for (const [path, info] of collectContextPathEntries(context)) {
|
|
120
|
+
if (!isAuthorableLinkageContextPath(path)) {
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
fieldMetaByPath[path] = {
|
|
124
|
+
...(info == null ? void 0 : info.type) ? { type: info.type } : {},
|
|
125
|
+
...(info == null ? void 0 : info.interface) ? { interface: info.interface } : {}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
return fieldMetaByPath;
|
|
129
|
+
}
|
|
117
130
|
function isAuthorableLinkageContextPath(path) {
|
|
118
131
|
const segments = String(path || "").split(".").filter(Boolean);
|
|
119
132
|
const root = segments[0];
|
|
@@ -395,6 +408,10 @@ function buildFieldValueCapability(input, capability) {
|
|
|
395
408
|
canonicalRules,
|
|
396
409
|
context: input.context,
|
|
397
410
|
targetFields: collectFieldOptions(input.resolvedTarget.node, input.context, capability.resolvedScene),
|
|
411
|
+
conditionMeta: {
|
|
412
|
+
operatorsByPath: buildConditionOperatorsByPath(input.context),
|
|
413
|
+
fieldMetaByPath: buildConditionFieldMetaByPath(input.context)
|
|
414
|
+
},
|
|
398
415
|
valueExprMeta: {
|
|
399
416
|
supportedSources: ["literal", "path", "runjs"],
|
|
400
417
|
runjsScene: "fieldValue"
|
|
@@ -412,7 +429,8 @@ function buildLinkageCapability(input, capability) {
|
|
|
412
429
|
context: input.context,
|
|
413
430
|
supportedActions: buildSupportedActions(capability),
|
|
414
431
|
conditionMeta: {
|
|
415
|
-
operatorsByPath: buildConditionOperatorsByPath(input.context)
|
|
432
|
+
operatorsByPath: buildConditionOperatorsByPath(input.context),
|
|
433
|
+
fieldMetaByPath: buildConditionFieldMetaByPath(input.context)
|
|
416
434
|
}
|
|
417
435
|
};
|
|
418
436
|
if (capability.kind === "fieldLinkage") {
|
|
@@ -163,6 +163,13 @@ export type FlowSurfaceReactionCapabilityBase<TKind extends FlowSurfaceReactionK
|
|
|
163
163
|
};
|
|
164
164
|
export type FlowSurfaceFieldValueCapability = FlowSurfaceReactionCapabilityBase<'fieldValue', FlowSurfaceFieldValueRule> & {
|
|
165
165
|
targetFields: FlowSurfaceFieldOption[];
|
|
166
|
+
conditionMeta: {
|
|
167
|
+
operatorsByPath: Record<string, string[]>;
|
|
168
|
+
fieldMetaByPath?: Record<string, {
|
|
169
|
+
type?: string;
|
|
170
|
+
interface?: string;
|
|
171
|
+
}>;
|
|
172
|
+
};
|
|
166
173
|
valueExprMeta: {
|
|
167
174
|
supportedSources: Array<'literal' | 'path' | 'runjs'>;
|
|
168
175
|
runjsScene: 'fieldValue';
|
|
@@ -172,17 +179,29 @@ export type FlowSurfaceLinkageCapability = (FlowSurfaceReactionCapabilityBase<'b
|
|
|
172
179
|
supportedActions: Array<Record<string, any>>;
|
|
173
180
|
conditionMeta: {
|
|
174
181
|
operatorsByPath: Record<string, string[]>;
|
|
182
|
+
fieldMetaByPath?: Record<string, {
|
|
183
|
+
type?: string;
|
|
184
|
+
interface?: string;
|
|
185
|
+
}>;
|
|
175
186
|
};
|
|
176
187
|
}) | (FlowSurfaceReactionCapabilityBase<'actionLinkage', FlowSurfaceActionLinkageRule> & {
|
|
177
188
|
supportedActions: Array<Record<string, any>>;
|
|
178
189
|
conditionMeta: {
|
|
179
190
|
operatorsByPath: Record<string, string[]>;
|
|
191
|
+
fieldMetaByPath?: Record<string, {
|
|
192
|
+
type?: string;
|
|
193
|
+
interface?: string;
|
|
194
|
+
}>;
|
|
180
195
|
};
|
|
181
196
|
}) | (FlowSurfaceReactionCapabilityBase<'fieldLinkage', FlowSurfaceFieldLinkageRule> & {
|
|
182
197
|
supportedActions: Array<Record<string, any>>;
|
|
183
198
|
targetFields: FlowSurfaceFieldOption[];
|
|
184
199
|
conditionMeta: {
|
|
185
200
|
operatorsByPath: Record<string, string[]>;
|
|
201
|
+
fieldMetaByPath?: Record<string, {
|
|
202
|
+
type?: string;
|
|
203
|
+
interface?: string;
|
|
204
|
+
}>;
|
|
186
205
|
};
|
|
187
206
|
valueExprMeta?: {
|
|
188
207
|
supportedSources: Array<'literal' | 'path' | 'runjs'>;
|
|
@@ -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
|
+
export declare function collectRelationBackingForeignKeyNames(collection: any): Set<string>;
|
|
10
|
+
export declare function isRelationBackingForeignKeyField(collection: any, fieldOrFieldName: any): boolean;
|
|
@@ -0,0 +1,79 @@
|
|
|
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 relation_backing_foreign_key_exports = {};
|
|
28
|
+
__export(relation_backing_foreign_key_exports, {
|
|
29
|
+
collectRelationBackingForeignKeyNames: () => collectRelationBackingForeignKeyNames,
|
|
30
|
+
isRelationBackingForeignKeyField: () => isRelationBackingForeignKeyField
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(relation_backing_foreign_key_exports);
|
|
33
|
+
var import_service_helpers = require("./service-helpers");
|
|
34
|
+
const CURRENT_COLLECTION_FOREIGN_KEY_RELATION_TYPES = /* @__PURE__ */ new Set(["belongsto"]);
|
|
35
|
+
const CURRENT_COLLECTION_FOREIGN_KEY_RELATION_INTERFACES = /* @__PURE__ */ new Set(["m2o"]);
|
|
36
|
+
const CONDITIONAL_CURRENT_COLLECTION_FOREIGN_KEY_RELATION_INTERFACES = /* @__PURE__ */ new Set(["o2o"]);
|
|
37
|
+
const RELATION_INTERFACES_WITH_FOREIGN_KEYS_OUTSIDE_CURRENT_COLLECTION = /* @__PURE__ */ new Set(["o2m", "m2m", "mbm"]);
|
|
38
|
+
const RELATION_TYPES_WITH_FOREIGN_KEYS_OUTSIDE_CURRENT_COLLECTION = /* @__PURE__ */ new Set(["hasone", "hasmany", "belongstomany"]);
|
|
39
|
+
function collectRelationBackingForeignKeyNames(collection) {
|
|
40
|
+
const fields = (0, import_service_helpers.getCollectionFields)(collection);
|
|
41
|
+
const scalarFieldNames = new Set(
|
|
42
|
+
fields.filter((field) => !(0, import_service_helpers.isAssociationField)(field)).map((field) => String((0, import_service_helpers.getFieldName)(field) || "").trim()).filter(Boolean)
|
|
43
|
+
);
|
|
44
|
+
const names = /* @__PURE__ */ new Set();
|
|
45
|
+
fields.forEach((field) => {
|
|
46
|
+
const foreignKey = getCurrentCollectionRelationForeignKey(field);
|
|
47
|
+
if (foreignKey && scalarFieldNames.has(foreignKey)) {
|
|
48
|
+
names.add(foreignKey);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return names;
|
|
52
|
+
}
|
|
53
|
+
function isRelationBackingForeignKeyField(collection, fieldOrFieldName) {
|
|
54
|
+
const fieldName = typeof fieldOrFieldName === "string" ? fieldOrFieldName.trim() : String((0, import_service_helpers.getFieldName)(fieldOrFieldName) || "").trim();
|
|
55
|
+
return !!fieldName && collectRelationBackingForeignKeyNames(collection).has(fieldName);
|
|
56
|
+
}
|
|
57
|
+
function getCurrentCollectionRelationForeignKey(field) {
|
|
58
|
+
var _a;
|
|
59
|
+
if (!(0, import_service_helpers.isAssociationField)(field)) {
|
|
60
|
+
return "";
|
|
61
|
+
}
|
|
62
|
+
if (!relationCanStoreForeignKeyInCurrentCollection(field)) {
|
|
63
|
+
return "";
|
|
64
|
+
}
|
|
65
|
+
return String((field == null ? void 0 : field.foreignKey) || ((_a = field == null ? void 0 : field.options) == null ? void 0 : _a.foreignKey) || "").trim();
|
|
66
|
+
}
|
|
67
|
+
function relationCanStoreForeignKeyInCurrentCollection(field) {
|
|
68
|
+
const type = String((0, import_service_helpers.getFieldType)(field) || "").trim().toLowerCase();
|
|
69
|
+
const fieldInterface = String((0, import_service_helpers.getFieldInterface)(field) || "").trim().toLowerCase();
|
|
70
|
+
if (RELATION_TYPES_WITH_FOREIGN_KEYS_OUTSIDE_CURRENT_COLLECTION.has(type) || RELATION_INTERFACES_WITH_FOREIGN_KEYS_OUTSIDE_CURRENT_COLLECTION.has(fieldInterface)) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
return CURRENT_COLLECTION_FOREIGN_KEY_RELATION_TYPES.has(type) || CURRENT_COLLECTION_FOREIGN_KEY_RELATION_INTERFACES.has(fieldInterface) || CONDITIONAL_CURRENT_COLLECTION_FOREIGN_KEY_RELATION_INTERFACES.has(fieldInterface);
|
|
74
|
+
}
|
|
75
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
76
|
+
0 && (module.exports = {
|
|
77
|
+
collectRelationBackingForeignKeyNames,
|
|
78
|
+
isRelationBackingForeignKeyField
|
|
79
|
+
});
|
|
@@ -23,6 +23,7 @@ export declare function getPreviousSignificantTokenInfo(sourceLike: string | str
|
|
|
23
23
|
export declare function skipQuotedLiteral(source: string, start: number, quote: string): number;
|
|
24
24
|
export declare function skipTemplateLiteral(source: string, start: number): number;
|
|
25
25
|
export declare function findFunctionRanges(masked: string): SourceRange[];
|
|
26
|
+
export declare function collectAstFunctionBodyRanges(ast: unknown): SourceRange[];
|
|
26
27
|
export declare function collectFunctionRanges(masked: string, pattern: RegExp, ranges: SourceRange[]): void;
|
|
27
28
|
export declare function collectArrowExpressionRanges(masked: string, ranges: SourceRange[]): void;
|
|
28
29
|
export declare function collectMethodFunctionRanges(masked: string, ranges: SourceRange[]): void;
|
|
@@ -27,6 +27,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
27
27
|
var source_exports = {};
|
|
28
28
|
__export(source_exports, {
|
|
29
29
|
collectArrowExpressionRanges: () => collectArrowExpressionRanges,
|
|
30
|
+
collectAstFunctionBodyRanges: () => collectAstFunctionBodyRanges,
|
|
30
31
|
collectBraceRanges: () => collectBraceRanges,
|
|
31
32
|
collectComputedMethodCandidates: () => collectComputedMethodCandidates,
|
|
32
33
|
collectFunctionRanges: () => collectFunctionRanges,
|
|
@@ -69,6 +70,7 @@ __export(source_exports, {
|
|
|
69
70
|
});
|
|
70
71
|
module.exports = __toCommonJS(source_exports);
|
|
71
72
|
var import_constants = require("../runtime/constants");
|
|
73
|
+
var import_walk = require("./walk");
|
|
72
74
|
function maskJavaScriptSource(source) {
|
|
73
75
|
const chars = source.split("");
|
|
74
76
|
const maskRange = (start, end) => {
|
|
@@ -406,6 +408,23 @@ function findFunctionRanges(masked) {
|
|
|
406
408
|
collectMethodFunctionRanges(masked, ranges);
|
|
407
409
|
return mergeRanges(ranges);
|
|
408
410
|
}
|
|
411
|
+
function collectAstFunctionBodyRanges(ast) {
|
|
412
|
+
const ranges = [];
|
|
413
|
+
const addBodyRange = (node) => {
|
|
414
|
+
var _a, _b;
|
|
415
|
+
const start = (_a = node.body) == null ? void 0 : _a.start;
|
|
416
|
+
const end = (_b = node.body) == null ? void 0 : _b.end;
|
|
417
|
+
if (typeof start === "number" && typeof end === "number" && end > start) {
|
|
418
|
+
ranges.push({ start, end });
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
(0, import_walk.walkAstSimple)(ast, {
|
|
422
|
+
FunctionDeclaration: addBodyRange,
|
|
423
|
+
FunctionExpression: addBodyRange,
|
|
424
|
+
ArrowFunctionExpression: addBodyRange
|
|
425
|
+
});
|
|
426
|
+
return mergeRanges(ranges);
|
|
427
|
+
}
|
|
409
428
|
function collectFunctionRanges(masked, pattern, ranges) {
|
|
410
429
|
for (const match of masked.matchAll(pattern)) {
|
|
411
430
|
const openBrace = masked.indexOf("{", match.index || 0);
|
|
@@ -853,6 +872,7 @@ function getAstSource(node, source) {
|
|
|
853
872
|
// Annotate the CommonJS export names for ESM import in node:
|
|
854
873
|
0 && (module.exports = {
|
|
855
874
|
collectArrowExpressionRanges,
|
|
875
|
+
collectAstFunctionBodyRanges,
|
|
856
876
|
collectBraceRanges,
|
|
857
877
|
collectComputedMethodCandidates,
|
|
858
878
|
collectFunctionRanges,
|
|
@@ -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,
|
|
@@ -224,7 +223,12 @@ const ALLOWED_CTX_ROOTS = /* @__PURE__ */ new Set([
|
|
|
224
223
|
]);
|
|
225
224
|
const CHART_CTX_ROOTS = /* @__PURE__ */ new Set(["data"]);
|
|
226
225
|
const BLOCKED_CTX_CAPABILITIES = {};
|
|
227
|
-
const
|
|
226
|
+
const RUNJS_ALLOWED_BARE_GLOBALS = /* @__PURE__ */ new Set([
|
|
227
|
+
"ctx",
|
|
228
|
+
"console",
|
|
229
|
+
"window",
|
|
230
|
+
"document",
|
|
231
|
+
"navigator",
|
|
228
232
|
"fetch",
|
|
229
233
|
"localStorage",
|
|
230
234
|
"sessionStorage",
|
|
@@ -237,22 +241,6 @@ const FORBIDDEN_BARE_GLOBALS = /* @__PURE__ */ new Set([
|
|
|
237
241
|
"EventSource",
|
|
238
242
|
"indexedDB",
|
|
239
243
|
"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
244
|
"setTimeout",
|
|
257
245
|
"clearTimeout",
|
|
258
246
|
"setInterval",
|
|
@@ -296,9 +284,14 @@ const RUNJS_ALLOWED_BARE_GLOBALS = /* @__PURE__ */ new Set([
|
|
|
296
284
|
"WeakMap",
|
|
297
285
|
"WeakRef",
|
|
298
286
|
"WeakSet",
|
|
287
|
+
"Function",
|
|
288
|
+
"eval",
|
|
289
|
+
"globalThis",
|
|
290
|
+
"Intl",
|
|
299
291
|
"JSON",
|
|
300
292
|
"Blob",
|
|
301
293
|
"URL",
|
|
294
|
+
"location",
|
|
302
295
|
"decodeURI",
|
|
303
296
|
"decodeURIComponent",
|
|
304
297
|
"encodeURI",
|
|
@@ -714,7 +707,6 @@ function escapeRegExp(value) {
|
|
|
714
707
|
FLOW_RESOURCE_CLASS_NAMES,
|
|
715
708
|
FLOW_RESOURCE_METHODS_BY_TYPE,
|
|
716
709
|
FLOW_RESOURCE_METHOD_SUGGESTIONS,
|
|
717
|
-
FORBIDDEN_BARE_GLOBALS,
|
|
718
710
|
INIT_RESOURCE_CLASS_NAMES,
|
|
719
711
|
KNOWN_MODEL_USES,
|
|
720
712
|
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;
|
|
@@ -900,7 +900,13 @@ function buildRunJsResourceFilterOperatorError(operator, index, input) {
|
|
|
900
900
|
};
|
|
901
901
|
}
|
|
902
902
|
function buildRunJsResourceDateFilterValueError(operator, index, valueNode, input) {
|
|
903
|
-
|
|
903
|
+
const fieldType = String((0, import_service_helpers.getFieldType)(input.field) || "").trim();
|
|
904
|
+
const fieldInterface = String((0, import_service_helpers.getFieldInterface)(input.field) || "").trim();
|
|
905
|
+
const shouldValidateDateValue = isRunJsDateFilterOperator(operator) || (0, import_filter_group.isFlowSurfaceDateLikeFieldMeta)({
|
|
906
|
+
type: fieldType,
|
|
907
|
+
interface: fieldInterface
|
|
908
|
+
});
|
|
909
|
+
if (!shouldValidateDateValue) {
|
|
904
910
|
return null;
|
|
905
911
|
}
|
|
906
912
|
const valueObject = resolveRunJsStaticFilterObjectNode(
|
|
@@ -924,7 +930,11 @@ function buildRunJsResourceDateFilterValueError(operator, index, valueNode, inpu
|
|
|
924
930
|
return null;
|
|
925
931
|
}
|
|
926
932
|
try {
|
|
927
|
-
(0, import_filter_group.
|
|
933
|
+
(0, import_filter_group.normalizeFlowSurfaceDateConditionValue)(operator, resolvedValue.value, `${input.fieldPath}.${operator}`, {
|
|
934
|
+
fieldPath: input.fieldPath,
|
|
935
|
+
fieldType,
|
|
936
|
+
fieldInterface
|
|
937
|
+
});
|
|
928
938
|
return null;
|
|
929
939
|
} catch (error) {
|
|
930
940
|
return buildRunJsStrictDateFilterValueError(operator, index, resolvedValue.value, input, error);
|
|
@@ -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;
|