@nocobase/plugin-flow-engine 2.1.0-beta.43 → 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.
Files changed (86) hide show
  1. package/dist/externalVersion.js +9 -9
  2. package/dist/node_modules/@ant-design/icons-svg/package.json +1 -1
  3. package/dist/node_modules/acorn/package.json +1 -1
  4. package/dist/node_modules/acorn-jsx/package.json +1 -1
  5. package/dist/node_modules/acorn-walk/package.json +1 -1
  6. package/dist/node_modules/ses/package.json +1 -1
  7. package/dist/node_modules/zod/package.json +1 -1
  8. package/dist/server/flow-surfaces/authoring-validation.js +160 -21
  9. package/dist/server/flow-surfaces/catalog.js +9 -5
  10. package/dist/server/flow-surfaces/chart-config.js +29 -6
  11. package/dist/server/flow-surfaces/contract-guard.js +39 -5
  12. package/dist/server/flow-surfaces/default-block-actions.js +2 -0
  13. package/dist/server/flow-surfaces/errors.d.ts +15 -0
  14. package/dist/server/flow-surfaces/errors.js +49 -3
  15. package/dist/server/flow-surfaces/filter-group.d.ts +7 -1
  16. package/dist/server/flow-surfaces/filter-group.js +175 -71
  17. package/dist/server/flow-surfaces/public-data-surface-default-filter.js +2 -1
  18. package/dist/server/flow-surfaces/runjs-authoring/ast/bindings.d.ts +66 -0
  19. package/dist/server/flow-surfaces/runjs-authoring/ast/bindings.js +661 -0
  20. package/dist/server/flow-surfaces/runjs-authoring/ast/execution.d.ts +20 -0
  21. package/dist/server/flow-surfaces/runjs-authoring/ast/execution.js +275 -0
  22. package/dist/server/flow-surfaces/runjs-authoring/ast/parser.d.ts +16 -0
  23. package/dist/server/flow-surfaces/runjs-authoring/ast/parser.js +130 -0
  24. package/dist/server/flow-surfaces/runjs-authoring/ast/react-values.d.ts +20 -0
  25. package/dist/server/flow-surfaces/runjs-authoring/ast/react-values.js +401 -0
  26. package/dist/server/flow-surfaces/runjs-authoring/ast/request-config.d.ts +21 -0
  27. package/dist/server/flow-surfaces/runjs-authoring/ast/request-config.js +199 -0
  28. package/dist/server/flow-surfaces/runjs-authoring/ast/source.d.ts +70 -0
  29. package/dist/server/flow-surfaces/runjs-authoring/ast/source.js +895 -0
  30. package/dist/server/flow-surfaces/runjs-authoring/ast/static-bindings.d.ts +23 -0
  31. package/dist/server/flow-surfaces/runjs-authoring/ast/static-bindings.js +618 -0
  32. package/dist/server/flow-surfaces/runjs-authoring/ast/static-values.d.ts +196 -0
  33. package/dist/server/flow-surfaces/runjs-authoring/ast/static-values.js +1777 -0
  34. package/dist/server/flow-surfaces/runjs-authoring/ast/walk.d.ts +10 -0
  35. package/dist/server/flow-surfaces/runjs-authoring/ast/walk.js +55 -0
  36. package/dist/server/flow-surfaces/runjs-authoring/collectors.d.ts +12 -0
  37. package/dist/server/flow-surfaces/runjs-authoring/collectors.js +589 -0
  38. package/dist/server/flow-surfaces/runjs-authoring/index.d.ts +2 -25
  39. package/dist/server/flow-surfaces/runjs-authoring/index.js +5 -11138
  40. package/dist/server/flow-surfaces/runjs-authoring/inspect.d.ts +13 -0
  41. package/dist/server/flow-surfaces/runjs-authoring/inspect.js +149 -0
  42. package/dist/server/flow-surfaces/runjs-authoring/internal-types.d.ts +333 -0
  43. package/dist/server/flow-surfaces/runjs-authoring/internal-types.js +36 -0
  44. package/dist/server/flow-surfaces/runjs-authoring/rules.js +2 -0
  45. package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.d.ts +67 -0
  46. package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.js +757 -0
  47. package/dist/server/flow-surfaces/runjs-authoring/runtime/errors.d.ts +22 -0
  48. package/dist/server/flow-surfaces/runjs-authoring/runtime/errors.js +91 -0
  49. package/dist/server/flow-surfaces/runjs-authoring/runtime/source-budget.d.ts +16 -0
  50. package/dist/server/flow-surfaces/runjs-authoring/runtime/source-budget.js +115 -0
  51. package/dist/server/flow-surfaces/runjs-authoring/runtime/surface.d.ts +19 -0
  52. package/dist/server/flow-surfaces/runjs-authoring/runtime/surface.js +140 -0
  53. package/dist/server/flow-surfaces/runjs-authoring/runtime/types.d.ts +91 -0
  54. package/dist/server/flow-surfaces/runjs-authoring/runtime/types.js +24 -0
  55. package/dist/server/flow-surfaces/runjs-authoring/scan/ctx-api.d.ts +138 -0
  56. package/dist/server/flow-surfaces/runjs-authoring/scan/ctx-api.js +1779 -0
  57. package/dist/server/flow-surfaces/runjs-authoring/scan/filter.d.ts +10 -0
  58. package/dist/server/flow-surfaces/runjs-authoring/scan/filter.js +1583 -0
  59. package/dist/server/flow-surfaces/runjs-authoring/scan/index.d.ts +195 -0
  60. package/dist/server/flow-surfaces/runjs-authoring/scan/index.js +463 -0
  61. package/dist/server/flow-surfaces/runjs-authoring/scan/react-render.d.ts +48 -0
  62. package/dist/server/flow-surfaces/runjs-authoring/scan/react-render.js +379 -0
  63. package/dist/server/flow-surfaces/runjs-authoring/scan/react.d.ts +26 -0
  64. package/dist/server/flow-surfaces/runjs-authoring/scan/react.js +1441 -0
  65. package/dist/server/flow-surfaces/runjs-authoring/scan/resource.d.ts +23 -0
  66. package/dist/server/flow-surfaces/runjs-authoring/scan/resource.js +1427 -0
  67. package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.d.ts +91 -0
  68. package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.js +889 -0
  69. package/dist/server/flow-surfaces/runjs-authoring/types.d.ts +1 -1
  70. package/dist/server/flow-surfaces/runjs-authoring/unknown-global-stop/index.d.ts +10 -0
  71. package/dist/server/flow-surfaces/runjs-authoring/unknown-global-stop/index.js +40 -0
  72. package/dist/server/flow-surfaces/runjs-authoring/validators/index.d.ts +12 -0
  73. package/dist/server/flow-surfaces/runjs-authoring/validators/index.js +887 -0
  74. package/dist/server/flow-surfaces/service-helpers.d.ts +29 -0
  75. package/dist/server/flow-surfaces/service-helpers.js +105 -0
  76. package/dist/server/flow-surfaces/service-utils.d.ts +15 -3
  77. package/dist/server/flow-surfaces/service-utils.js +5 -4
  78. package/dist/server/flow-surfaces/service.d.ts +4 -0
  79. package/dist/server/flow-surfaces/service.js +360 -30
  80. package/dist/server/flow-surfaces/types.d.ts +3 -0
  81. package/dist/server/repository.d.ts +12 -1
  82. package/dist/server/repository.js +195 -23
  83. package/dist/swagger/flow-surfaces.d.ts +175 -0
  84. package/dist/swagger/flow-surfaces.js +130 -51
  85. package/dist/swagger/index.d.ts +175 -0
  86. package/package.json +2 -2
@@ -0,0 +1,401 @@
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 react_values_exports = {};
28
+ __export(react_values_exports, {
29
+ getAstDefaultMemberAliasBase: () => getAstDefaultMemberAliasBase,
30
+ getDirectReactDefaultCapabilityFromAstAliasName: () => getDirectReactDefaultCapabilityFromAstAliasName,
31
+ getDirectReactNamespaceCapabilityFromAst: () => getDirectReactNamespaceCapabilityFromAst,
32
+ getDirectReactNamespaceCapabilityFromAstAliasName: () => getDirectReactNamespaceCapabilityFromAstAliasName,
33
+ getReactDefaultCapabilityFromAstPatternFallbackSources: () => getReactDefaultCapabilityFromAstPatternFallbackSources,
34
+ getReactDefaultNamespaceCapabilityFromAst: () => getReactDefaultNamespaceCapabilityFromAst,
35
+ getReactDefaultNamespaceCapabilityFromAstPatternSource: () => getReactDefaultNamespaceCapabilityFromAstPatternSource,
36
+ getReactNamespaceCapabilityFromAst: () => getReactNamespaceCapabilityFromAst,
37
+ getReactNamespaceCapabilityFromAstPatternFallbackSources: () => getReactNamespaceCapabilityFromAstPatternFallbackSources,
38
+ getReactNamespaceCapabilityFromAstPatternSource: () => getReactNamespaceCapabilityFromAstPatternSource,
39
+ isAstPatternDefaultValueSuppressedByReactNamespace: () => isAstPatternDefaultValueSuppressedByReactNamespace
40
+ });
41
+ module.exports = __toCommonJS(react_values_exports);
42
+ var import_bindings = require("./bindings");
43
+ var import_static_values = require("./static-values");
44
+ function getReactNamespaceCapabilityFromAstPatternSource(sourceTarget, identifierBindings, aliases, ctxRootAliases) {
45
+ if (sourceTarget == null ? void 0 : sourceTarget.ambiguous) {
46
+ return "";
47
+ }
48
+ if (sourceTarget == null ? void 0 : sourceTarget.node) {
49
+ const capability = getReactNamespaceCapabilityFromAst(
50
+ sourceTarget.node,
51
+ identifierBindings,
52
+ aliases,
53
+ ctxRootAliases
54
+ );
55
+ if (capability) {
56
+ return capability;
57
+ }
58
+ }
59
+ const fallbackCapability = getReactNamespaceCapabilityFromAstPatternFallbackSources(
60
+ sourceTarget,
61
+ identifierBindings,
62
+ aliases,
63
+ ctxRootAliases
64
+ );
65
+ if (fallbackCapability) {
66
+ return fallbackCapability;
67
+ }
68
+ if (!(sourceTarget == null ? void 0 : sourceTarget.aliasName)) {
69
+ return "";
70
+ }
71
+ const directCapability = getDirectReactNamespaceCapabilityFromAstAliasName(sourceTarget, identifierBindings);
72
+ if (directCapability) {
73
+ return directCapability;
74
+ }
75
+ const alias = (0, import_static_values.resolveAstNamedAliasBinding)(
76
+ sourceTarget.aliasName,
77
+ sourceTarget.index || 0,
78
+ sourceTarget.rootName,
79
+ aliases,
80
+ identifierBindings
81
+ );
82
+ return (alias == null ? void 0 : alias.capability) || "";
83
+ }
84
+ function getReactDefaultNamespaceCapabilityFromAstPatternSource(sourceTarget, identifierBindings, aliases, ctxRootAliases = [], defaultAliases = []) {
85
+ if (sourceTarget == null ? void 0 : sourceTarget.node) {
86
+ const capability = getReactDefaultNamespaceCapabilityFromAst(
87
+ sourceTarget.node,
88
+ identifierBindings,
89
+ aliases,
90
+ ctxRootAliases,
91
+ defaultAliases
92
+ );
93
+ if (capability) {
94
+ return capability;
95
+ }
96
+ }
97
+ const fallbackCapability = getReactDefaultCapabilityFromAstPatternFallbackSources(
98
+ sourceTarget,
99
+ identifierBindings,
100
+ aliases,
101
+ ctxRootAliases,
102
+ defaultAliases
103
+ );
104
+ if (fallbackCapability) {
105
+ return fallbackCapability;
106
+ }
107
+ if (!(sourceTarget == null ? void 0 : sourceTarget.aliasName)) {
108
+ return "";
109
+ }
110
+ const directCapability = getDirectReactDefaultCapabilityFromAstAliasName(sourceTarget, identifierBindings);
111
+ if (directCapability) {
112
+ return directCapability;
113
+ }
114
+ const exactAlias = (0, import_static_values.resolveAstNamedAliasBinding)(
115
+ sourceTarget.aliasName,
116
+ sourceTarget.index || 0,
117
+ sourceTarget.rootName,
118
+ defaultAliases,
119
+ identifierBindings
120
+ );
121
+ if (exactAlias) {
122
+ return exactAlias.capability;
123
+ }
124
+ const dynamicAlias = (0, import_static_values.resolveAstDynamicAliasBinding)(
125
+ sourceTarget.aliasName,
126
+ sourceTarget.index || 0,
127
+ sourceTarget.rootName,
128
+ defaultAliases,
129
+ identifierBindings
130
+ );
131
+ const exactNamespaceAlias = (0, import_static_values.resolveAstNamedAliasBinding)(
132
+ sourceTarget.aliasName,
133
+ sourceTarget.index || 0,
134
+ sourceTarget.rootName,
135
+ aliases,
136
+ identifierBindings
137
+ );
138
+ if (dynamicAlias && (!exactNamespaceAlias || (0, import_static_values.compareAstAliasPrecedence)(dynamicAlias, exactNamespaceAlias) >= 0)) {
139
+ return dynamicAlias.capability;
140
+ }
141
+ const exactNamespaceCapability = getReactNamespaceCapabilityFromAstPatternSource(
142
+ sourceTarget,
143
+ identifierBindings,
144
+ aliases,
145
+ ctxRootAliases
146
+ );
147
+ if (exactNamespaceCapability) {
148
+ return "";
149
+ }
150
+ if (dynamicAlias) {
151
+ return dynamicAlias.capability;
152
+ }
153
+ const namespaceAliasName = getAstDefaultMemberAliasBase(sourceTarget.aliasName);
154
+ if (!namespaceAliasName) {
155
+ return "";
156
+ }
157
+ const directNamespaceCapability = getDirectReactNamespaceCapabilityFromAstAliasName(
158
+ {
159
+ ...sourceTarget,
160
+ aliasName: namespaceAliasName
161
+ },
162
+ identifierBindings
163
+ );
164
+ if (directNamespaceCapability) {
165
+ return `${directNamespaceCapability}.default`;
166
+ }
167
+ const namespaceAlias = (0, import_static_values.resolveAstNamedAliasBinding)(
168
+ namespaceAliasName,
169
+ sourceTarget.index || 0,
170
+ sourceTarget.rootName,
171
+ aliases,
172
+ identifierBindings
173
+ );
174
+ return namespaceAlias ? `${namespaceAlias.capability}.default` : "";
175
+ }
176
+ function getReactNamespaceCapabilityFromAstPatternFallbackSources(sourceTarget, identifierBindings, aliases, ctxRootAliases) {
177
+ for (const fallbackTarget of (sourceTarget == null ? void 0 : sourceTarget.fallbackSourceTargets) || []) {
178
+ const capability = getReactNamespaceCapabilityFromAstPatternSource(
179
+ fallbackTarget,
180
+ identifierBindings,
181
+ aliases,
182
+ ctxRootAliases
183
+ );
184
+ if (capability) {
185
+ return capability;
186
+ }
187
+ }
188
+ return "";
189
+ }
190
+ function getReactDefaultCapabilityFromAstPatternFallbackSources(sourceTarget, identifierBindings, aliases, ctxRootAliases, defaultAliases) {
191
+ for (const fallbackTarget of (sourceTarget == null ? void 0 : sourceTarget.fallbackSourceTargets) || []) {
192
+ const capability = getReactDefaultNamespaceCapabilityFromAstPatternSource(
193
+ fallbackTarget,
194
+ identifierBindings,
195
+ aliases,
196
+ ctxRootAliases,
197
+ defaultAliases
198
+ );
199
+ if (capability) {
200
+ return capability;
201
+ }
202
+ const namespaceCapability = getReactNamespaceCapabilityFromAstPatternSource(
203
+ fallbackTarget,
204
+ identifierBindings,
205
+ aliases,
206
+ ctxRootAliases
207
+ );
208
+ if (namespaceCapability) {
209
+ return "";
210
+ }
211
+ }
212
+ return "";
213
+ }
214
+ function getAstDefaultMemberAliasBase(aliasName) {
215
+ const suffix = ".default";
216
+ return aliasName.endsWith(suffix) ? aliasName.slice(0, -suffix.length) : "";
217
+ }
218
+ function getDirectReactNamespaceCapabilityFromAstAliasName(sourceTarget, identifierBindings) {
219
+ const aliasName = String((sourceTarget == null ? void 0 : sourceTarget.aliasName) || "");
220
+ const index = (sourceTarget == null ? void 0 : sourceTarget.index) || 0;
221
+ if (aliasName === "React" && !(0, import_static_values.hasAstActiveBinding)("React", index, identifierBindings)) {
222
+ return "React";
223
+ }
224
+ if (aliasName === "ctx.React" && sourceTarget.rootName === "ctx" && !(0, import_static_values.hasAstActiveBinding)("ctx", index, identifierBindings)) {
225
+ return "ctx.React";
226
+ }
227
+ if (aliasName === "ctx.libs.React" && sourceTarget.rootName === "ctx" && !(0, import_static_values.hasAstActiveBinding)("ctx", index, identifierBindings)) {
228
+ return "ctx.libs.React";
229
+ }
230
+ return "";
231
+ }
232
+ function getDirectReactDefaultCapabilityFromAstAliasName(sourceTarget, identifierBindings) {
233
+ const namespaceAliasName = getAstDefaultMemberAliasBase(String((sourceTarget == null ? void 0 : sourceTarget.aliasName) || ""));
234
+ if (!namespaceAliasName) {
235
+ return "";
236
+ }
237
+ const namespaceCapability = getDirectReactNamespaceCapabilityFromAstAliasName(
238
+ {
239
+ ...sourceTarget,
240
+ aliasName: namespaceAliasName
241
+ },
242
+ identifierBindings
243
+ );
244
+ return namespaceCapability ? `${namespaceCapability}.default` : "";
245
+ }
246
+ function isAstPatternDefaultValueSuppressedByReactNamespace(sourceTarget, identifierBindings, namespaceAliases, ctxRootAliases) {
247
+ if (!sourceTarget) {
248
+ return false;
249
+ }
250
+ return Boolean(
251
+ getReactNamespaceCapabilityFromAstPatternSource(sourceTarget, identifierBindings, namespaceAliases, ctxRootAliases)
252
+ );
253
+ }
254
+ function getReactNamespaceCapabilityFromAst(node, identifierBindings, aliases, ctxRootAliases = []) {
255
+ const unwrapped = (0, import_bindings.unwrapAstChainExpression)(node);
256
+ if (!unwrapped) {
257
+ return "";
258
+ }
259
+ if (unwrapped.type === "ConditionalExpression") {
260
+ return getReactNamespaceCapabilityFromAst(unwrapped.consequent, identifierBindings, aliases, ctxRootAliases) || getReactNamespaceCapabilityFromAst(unwrapped.alternate, identifierBindings, aliases, ctxRootAliases);
261
+ }
262
+ if (unwrapped.type === "LogicalExpression") {
263
+ return getReactNamespaceCapabilityFromAst(unwrapped.left, identifierBindings, aliases, ctxRootAliases) || getReactNamespaceCapabilityFromAst(unwrapped.right, identifierBindings, aliases, ctxRootAliases);
264
+ }
265
+ if (unwrapped.type === "SequenceExpression") {
266
+ const expressions = unwrapped.expressions || [];
267
+ return getReactNamespaceCapabilityFromAst(
268
+ expressions[expressions.length - 1],
269
+ identifierBindings,
270
+ aliases,
271
+ ctxRootAliases
272
+ );
273
+ }
274
+ if (unwrapped.type === "AssignmentExpression" && (0, import_static_values.isAstCtxApiAliasAssignmentOperator)(unwrapped.operator)) {
275
+ return getReactNamespaceCapabilityFromAst(unwrapped.right, identifierBindings, aliases, ctxRootAliases);
276
+ }
277
+ if (unwrapped.type === "Identifier") {
278
+ const index = typeof unwrapped.start === "number" ? unwrapped.start : 0;
279
+ const alias = (0, import_static_values.resolveAstAliasBinding)(unwrapped.name, index, aliases, identifierBindings);
280
+ if (alias) {
281
+ return alias.capability;
282
+ }
283
+ }
284
+ if (unwrapped.type === "MemberExpression") {
285
+ const alias = (0, import_static_values.resolveAstMemberAliasBinding)(unwrapped, aliases, identifierBindings);
286
+ if (alias) {
287
+ return alias.capability;
288
+ }
289
+ }
290
+ return getDirectReactNamespaceCapabilityFromAst(unwrapped, identifierBindings, ctxRootAliases);
291
+ }
292
+ function getReactDefaultNamespaceCapabilityFromAst(node, identifierBindings, aliases, ctxRootAliases = [], defaultAliases = []) {
293
+ const unwrapped = (0, import_bindings.unwrapAstChainExpression)(node);
294
+ if (!unwrapped) {
295
+ return "";
296
+ }
297
+ if (unwrapped.type === "ConditionalExpression") {
298
+ return getReactDefaultNamespaceCapabilityFromAst(
299
+ unwrapped.consequent,
300
+ identifierBindings,
301
+ aliases,
302
+ ctxRootAliases,
303
+ defaultAliases
304
+ ) || getReactDefaultNamespaceCapabilityFromAst(
305
+ unwrapped.alternate,
306
+ identifierBindings,
307
+ aliases,
308
+ ctxRootAliases,
309
+ defaultAliases
310
+ );
311
+ }
312
+ if (unwrapped.type === "LogicalExpression") {
313
+ return getReactDefaultNamespaceCapabilityFromAst(
314
+ unwrapped.left,
315
+ identifierBindings,
316
+ aliases,
317
+ ctxRootAliases,
318
+ defaultAliases
319
+ ) || getReactDefaultNamespaceCapabilityFromAst(
320
+ unwrapped.right,
321
+ identifierBindings,
322
+ aliases,
323
+ ctxRootAliases,
324
+ defaultAliases
325
+ );
326
+ }
327
+ if (unwrapped.type === "SequenceExpression") {
328
+ const expressions = unwrapped.expressions || [];
329
+ return getReactDefaultNamespaceCapabilityFromAst(
330
+ expressions[expressions.length - 1],
331
+ identifierBindings,
332
+ aliases,
333
+ ctxRootAliases,
334
+ defaultAliases
335
+ );
336
+ }
337
+ if (unwrapped.type === "AssignmentExpression" && (0, import_static_values.isAstCtxApiAliasAssignmentOperator)(unwrapped.operator)) {
338
+ return getReactDefaultNamespaceCapabilityFromAst(
339
+ unwrapped.right,
340
+ identifierBindings,
341
+ aliases,
342
+ ctxRootAliases,
343
+ defaultAliases
344
+ );
345
+ }
346
+ if (unwrapped.type === "Identifier") {
347
+ const index = typeof unwrapped.start === "number" ? unwrapped.start : 0;
348
+ const alias = (0, import_static_values.resolveAstAliasBinding)(unwrapped.name, index, defaultAliases, identifierBindings);
349
+ return (alias == null ? void 0 : alias.capability) || "";
350
+ }
351
+ if (unwrapped.type === "MemberExpression") {
352
+ const alias = (0, import_static_values.resolveAstMemberAliasBinding)(unwrapped, defaultAliases, identifierBindings);
353
+ if (alias) {
354
+ return alias.capability;
355
+ }
356
+ }
357
+ if (unwrapped.type !== "MemberExpression" || (0, import_static_values.getAstStaticPropertyName)(unwrapped) !== "default") {
358
+ return "";
359
+ }
360
+ const namespace = getReactNamespaceCapabilityFromAst(unwrapped.object, identifierBindings, aliases, ctxRootAliases);
361
+ return namespace ? `${namespace}.default` : "";
362
+ }
363
+ function getDirectReactNamespaceCapabilityFromAst(node, identifierBindings, ctxRootAliases = []) {
364
+ const unwrapped = (0, import_bindings.unwrapAstChainExpression)(node);
365
+ if (!unwrapped) {
366
+ return "";
367
+ }
368
+ if (unwrapped.type === "Identifier" && unwrapped.name === "React") {
369
+ const index = typeof unwrapped.start === "number" ? unwrapped.start : 0;
370
+ return (0, import_static_values.hasAstActiveBinding)("React", index, identifierBindings) ? "" : "React";
371
+ }
372
+ if (unwrapped.type !== "MemberExpression") {
373
+ return "";
374
+ }
375
+ const propertyName = (0, import_static_values.getAstStaticPropertyName)(unwrapped);
376
+ if (propertyName !== "React") {
377
+ return "";
378
+ }
379
+ if ((0, import_static_values.isCtxRootFromAst)(unwrapped.object, ctxRootAliases, identifierBindings)) {
380
+ return "ctx.React";
381
+ }
382
+ const object = (0, import_bindings.unwrapAstChainExpression)(unwrapped.object);
383
+ if ((object == null ? void 0 : object.type) === "MemberExpression" && (0, import_static_values.getAstStaticPropertyName)(object) === "libs" && (0, import_static_values.isCtxRootFromAst)(object.object, ctxRootAliases, identifierBindings)) {
384
+ return "ctx.libs.React";
385
+ }
386
+ return "";
387
+ }
388
+ // Annotate the CommonJS export names for ESM import in node:
389
+ 0 && (module.exports = {
390
+ getAstDefaultMemberAliasBase,
391
+ getDirectReactDefaultCapabilityFromAstAliasName,
392
+ getDirectReactNamespaceCapabilityFromAst,
393
+ getDirectReactNamespaceCapabilityFromAstAliasName,
394
+ getReactDefaultCapabilityFromAstPatternFallbackSources,
395
+ getReactDefaultNamespaceCapabilityFromAst,
396
+ getReactDefaultNamespaceCapabilityFromAstPatternSource,
397
+ getReactNamespaceCapabilityFromAst,
398
+ getReactNamespaceCapabilityFromAstPatternFallbackSources,
399
+ getReactNamespaceCapabilityFromAstPatternSource,
400
+ isAstPatternDefaultValueSuppressedByReactNamespace
401
+ });
@@ -0,0 +1,21 @@
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, StaticFilterValueBinding, StaticStringBinding } from '../internal-types';
10
+ export declare function getRunJsStaticRequestConfigObjectFromAst(node: any, identifierBindings: AstIdentifierBinding[], staticFilterValueBindings: StaticFilterValueBinding[]): any;
11
+ export declare function getRunJsStaticDataSourceKeyFromHeaders(headersNode: any, source: string, stringBindings: StaticStringBinding[], staticFilterValueBindings: StaticFilterValueBinding[], identifierBindings: AstIdentifierBinding[], unresolvedAsUnknown?: boolean, propertyUnknownAsUnknown?: boolean): string | undefined;
12
+ export declare function getRunJsStaticRequestDataSourceKeyFromAst(node: any, source: string, stringBindings: StaticStringBinding[], staticFilterValueBindings: StaticFilterValueBinding[], identifierBindings: AstIdentifierBinding[]): string | undefined;
13
+ export declare function getRunJsApiResourceCallDataSourceKey(args: any[], source: string, stringBindings: StaticStringBinding[], staticFilterValueBindings: StaticFilterValueBinding[], identifierBindings: AstIdentifierBinding[]): string | undefined;
14
+ export declare function getRunJsStaticDataSourceKeyFromActionParams(paramsNode: any, source: string, stringBindings: StaticStringBinding[], staticFilterValueBindings: StaticFilterValueBinding[], identifierBindings: AstIdentifierBinding[]): string | undefined;
15
+ export declare function getRunJsActionParamsDataSourcePropertyLookup(node: any, identifierBindings: AstIdentifierBinding[], staticFilterValueBindings: StaticFilterValueBinding[]): {
16
+ property: any;
17
+ status: 'found';
18
+ } | {
19
+ status: 'missing' | 'unknown';
20
+ };
21
+ export declare function hasRunJsInactiveStaticDataSourceParamBinding(node: any, staticFilterValueBindings: StaticFilterValueBinding[], identifierBindings: AstIdentifierBinding[]): boolean;
@@ -0,0 +1,199 @@
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 request_config_exports = {};
28
+ __export(request_config_exports, {
29
+ getRunJsActionParamsDataSourcePropertyLookup: () => getRunJsActionParamsDataSourcePropertyLookup,
30
+ getRunJsApiResourceCallDataSourceKey: () => getRunJsApiResourceCallDataSourceKey,
31
+ getRunJsStaticDataSourceKeyFromActionParams: () => getRunJsStaticDataSourceKeyFromActionParams,
32
+ getRunJsStaticDataSourceKeyFromHeaders: () => getRunJsStaticDataSourceKeyFromHeaders,
33
+ getRunJsStaticRequestConfigObjectFromAst: () => getRunJsStaticRequestConfigObjectFromAst,
34
+ getRunJsStaticRequestDataSourceKeyFromAst: () => getRunJsStaticRequestDataSourceKeyFromAst,
35
+ hasRunJsInactiveStaticDataSourceParamBinding: () => hasRunJsInactiveStaticDataSourceParamBinding
36
+ });
37
+ module.exports = __toCommonJS(request_config_exports);
38
+ var import_surface = require("../runtime/surface");
39
+ var import_bindings = require("./bindings");
40
+ var import_static_values = require("./static-values");
41
+ function getRunJsStaticRequestConfigObjectFromAst(node, identifierBindings, staticFilterValueBindings) {
42
+ var _a, _b;
43
+ return (0, import_static_values.resolveRunJsStaticObjectExpression)((_a = node.arguments) == null ? void 0 : _a[0], identifierBindings, staticFilterValueBindings) || (0, import_static_values.resolveRunJsStaticObjectExpression)((_b = node.arguments) == null ? void 0 : _b[1], identifierBindings, staticFilterValueBindings);
44
+ }
45
+ function getRunJsStaticDataSourceKeyFromHeaders(headersNode, source, stringBindings, staticFilterValueBindings, identifierBindings, unresolvedAsUnknown = true, propertyUnknownAsUnknown = unresolvedAsUnknown) {
46
+ const unwrapped = (0, import_bindings.unwrapAstChainExpression)(headersNode);
47
+ if (!unwrapped) {
48
+ return void 0;
49
+ }
50
+ const headers = (0, import_static_values.resolveRunJsStaticObjectExpression)(headersNode, identifierBindings, staticFilterValueBindings);
51
+ if (!headers) {
52
+ return unresolvedAsUnknown ? "" : void 0;
53
+ }
54
+ const dataSourceProperty = (0, import_static_values.getRunJsObjectPropertyLookup)(
55
+ headers,
56
+ ["x-data-source"],
57
+ identifierBindings,
58
+ staticFilterValueBindings
59
+ );
60
+ if (dataSourceProperty.status === "unknown") {
61
+ return propertyUnknownAsUnknown ? "" : void 0;
62
+ }
63
+ if (dataSourceProperty.status === "missing") {
64
+ return void 0;
65
+ }
66
+ if (dataSourceProperty.status !== "found") {
67
+ return void 0;
68
+ }
69
+ return (0, import_static_values.resolveRunJsStaticString)(dataSourceProperty.property.value, source, stringBindings, identifierBindings) ?? "";
70
+ }
71
+ function getRunJsStaticRequestDataSourceKeyFromAst(node, source, stringBindings, staticFilterValueBindings, identifierBindings) {
72
+ const configArg = getRunJsStaticRequestConfigObjectFromAst(node, identifierBindings, staticFilterValueBindings);
73
+ const headersProperty = (0, import_static_values.getRunJsObjectProperty)(configArg, ["headers"], identifierBindings, staticFilterValueBindings);
74
+ return getRunJsStaticDataSourceKeyFromHeaders(
75
+ headersProperty == null ? void 0 : headersProperty.value,
76
+ source,
77
+ stringBindings,
78
+ staticFilterValueBindings,
79
+ identifierBindings
80
+ );
81
+ }
82
+ function getRunJsApiResourceCallDataSourceKey(args, source, stringBindings, staticFilterValueBindings, identifierBindings) {
83
+ const actionName = (0, import_static_values.resolveRunJsStaticString)(args == null ? void 0 : args[1], source, stringBindings, identifierBindings);
84
+ if (actionName) {
85
+ return getRunJsStaticDataSourceKeyFromActionParams(
86
+ args == null ? void 0 : args[2],
87
+ source,
88
+ stringBindings,
89
+ staticFilterValueBindings,
90
+ identifierBindings
91
+ );
92
+ }
93
+ const thirdArgDataSourceKey = getRunJsStaticDataSourceKeyFromHeaders(
94
+ args == null ? void 0 : args[2],
95
+ source,
96
+ stringBindings,
97
+ staticFilterValueBindings,
98
+ identifierBindings
99
+ );
100
+ if (typeof thirdArgDataSourceKey === "string") {
101
+ return thirdArgDataSourceKey;
102
+ }
103
+ return getRunJsStaticDataSourceKeyFromHeaders(
104
+ args == null ? void 0 : args[1],
105
+ source,
106
+ stringBindings,
107
+ staticFilterValueBindings,
108
+ identifierBindings,
109
+ false
110
+ );
111
+ }
112
+ function getRunJsStaticDataSourceKeyFromActionParams(paramsNode, source, stringBindings, staticFilterValueBindings, identifierBindings) {
113
+ const params = (0, import_static_values.resolveRunJsStaticObjectExpression)(paramsNode, identifierBindings, staticFilterValueBindings);
114
+ if (params) {
115
+ const dataSourceProperty = getRunJsActionParamsDataSourcePropertyLookup(
116
+ params,
117
+ identifierBindings,
118
+ staticFilterValueBindings
119
+ );
120
+ if (dataSourceProperty.status === "unknown") {
121
+ return "";
122
+ }
123
+ if (dataSourceProperty.status === "found") {
124
+ return (0, import_static_values.resolveRunJsStaticString)(dataSourceProperty.property.value, source, stringBindings, identifierBindings) ?? "";
125
+ }
126
+ return void 0;
127
+ }
128
+ return hasRunJsInactiveStaticDataSourceParamBinding(paramsNode, staticFilterValueBindings, identifierBindings) ? "" : void 0;
129
+ }
130
+ function getRunJsActionParamsDataSourcePropertyLookup(node, identifierBindings, staticFilterValueBindings) {
131
+ const object = (0, import_bindings.unwrapAstChainExpression)(node);
132
+ if ((object == null ? void 0 : object.type) !== "ObjectExpression") {
133
+ return { status: "missing" };
134
+ }
135
+ let hasUnknownLaterOverride = false;
136
+ const properties = object.properties || [];
137
+ for (let index = properties.length - 1; index >= 0; index -= 1) {
138
+ const property = properties[index];
139
+ if (!property) {
140
+ continue;
141
+ }
142
+ if (property.type === "SpreadElement") {
143
+ const spreadObject = (0, import_static_values.resolveRunJsStaticObjectExpression)(
144
+ property.argument,
145
+ identifierBindings,
146
+ staticFilterValueBindings
147
+ );
148
+ if (spreadObject) {
149
+ const spreadLookup = getRunJsActionParamsDataSourcePropertyLookup(
150
+ spreadObject,
151
+ identifierBindings,
152
+ staticFilterValueBindings
153
+ );
154
+ if (spreadLookup.status === "found") {
155
+ return hasUnknownLaterOverride ? { status: "unknown" } : spreadLookup;
156
+ }
157
+ if (spreadLookup.status === "unknown") {
158
+ hasUnknownLaterOverride = true;
159
+ }
160
+ continue;
161
+ }
162
+ hasUnknownLaterOverride = true;
163
+ continue;
164
+ }
165
+ if (property.type !== "Property") {
166
+ hasUnknownLaterOverride = true;
167
+ continue;
168
+ }
169
+ const propertyName = (0, import_surface.normalizeText)((0, import_static_values.getAstStaticPropertyName)(property));
170
+ if (!propertyName) {
171
+ hasUnknownLaterOverride = true;
172
+ continue;
173
+ }
174
+ if (propertyName.toLowerCase() === "x-data-source") {
175
+ return hasUnknownLaterOverride ? { status: "unknown" } : { status: "found", property };
176
+ }
177
+ }
178
+ return { status: "missing" };
179
+ }
180
+ function hasRunJsInactiveStaticDataSourceParamBinding(node, staticFilterValueBindings, identifierBindings) {
181
+ const unwrapped = (0, import_bindings.unwrapAstChainExpression)(node);
182
+ if ((unwrapped == null ? void 0 : unwrapped.type) !== "Identifier") {
183
+ return false;
184
+ }
185
+ const index = typeof unwrapped.start === "number" ? unwrapped.start : 0;
186
+ return staticFilterValueBindings.some(
187
+ (binding) => binding.name === unwrapped.name && index >= binding.end && !(0, import_static_values.hasAstShadowBinding)(binding.name, index, binding, identifierBindings) && getRunJsActionParamsDataSourcePropertyLookup(binding.valueNode, identifierBindings, staticFilterValueBindings).status !== "missing"
188
+ );
189
+ }
190
+ // Annotate the CommonJS export names for ESM import in node:
191
+ 0 && (module.exports = {
192
+ getRunJsActionParamsDataSourcePropertyLookup,
193
+ getRunJsApiResourceCallDataSourceKey,
194
+ getRunJsStaticDataSourceKeyFromActionParams,
195
+ getRunJsStaticDataSourceKeyFromHeaders,
196
+ getRunJsStaticRequestConfigObjectFromAst,
197
+ getRunJsStaticRequestDataSourceKeyFromAst,
198
+ hasRunJsInactiveStaticDataSourceParamBinding
199
+ });