@nocobase/plugin-flow-engine 2.1.0-alpha.15 → 2.1.0-alpha.16

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 (116) hide show
  1. package/dist/externalVersion.js +10 -10
  2. package/dist/node_modules/ses/package.json +1 -1
  3. package/dist/node_modules/zod/package.json +1 -1
  4. package/dist/server/flow-surfaces/{compiler.d.ts → apply/compiler.d.ts} +1 -10
  5. package/dist/server/flow-surfaces/{compiler.js → apply/compiler.js} +41 -280
  6. package/dist/server/flow-surfaces/apply/layout.d.ts +34 -0
  7. package/dist/server/flow-surfaces/apply/layout.js +175 -0
  8. package/dist/server/flow-surfaces/apply/matching.d.ts +16 -0
  9. package/dist/server/flow-surfaces/apply/matching.js +181 -0
  10. package/dist/server/flow-surfaces/association-title-field.d.ts +20 -0
  11. package/dist/server/flow-surfaces/association-title-field.js +158 -0
  12. package/dist/server/flow-surfaces/blueprint/compile-blocks.d.ts +14 -0
  13. package/dist/server/flow-surfaces/blueprint/compile-blocks.js +706 -0
  14. package/dist/server/flow-surfaces/blueprint/compile-plan.d.ts +13 -0
  15. package/dist/server/flow-surfaces/blueprint/compile-plan.js +308 -0
  16. package/dist/server/flow-surfaces/blueprint/compile-reaction.d.ts +11 -0
  17. package/dist/server/flow-surfaces/blueprint/compile-reaction.js +72 -0
  18. package/dist/server/flow-surfaces/blueprint/index.d.ts +12 -0
  19. package/dist/server/flow-surfaces/blueprint/index.js +44 -0
  20. package/dist/server/flow-surfaces/blueprint/normalize-document.d.ts +10 -0
  21. package/dist/server/flow-surfaces/blueprint/normalize-document.js +296 -0
  22. package/dist/server/flow-surfaces/blueprint/private-utils.d.ts +26 -0
  23. package/dist/server/flow-surfaces/blueprint/private-utils.js +182 -0
  24. package/dist/server/flow-surfaces/blueprint/public-types.d.ts +153 -0
  25. package/dist/server/flow-surfaces/blueprint/public-types.js +24 -0
  26. package/dist/server/flow-surfaces/catalog-smart.d.ts +18 -0
  27. package/dist/server/flow-surfaces/catalog-smart.js +239 -0
  28. package/dist/server/flow-surfaces/catalog-smart.projector.d.ts +15 -0
  29. package/dist/server/flow-surfaces/catalog-smart.projector.js +157 -0
  30. package/dist/server/flow-surfaces/catalog-smart.types.d.ts +99 -0
  31. package/dist/server/flow-surfaces/catalog-smart.types.js +24 -0
  32. package/dist/server/flow-surfaces/catalog.d.ts +3 -0
  33. package/dist/server/flow-surfaces/catalog.js +163 -34
  34. package/dist/server/flow-surfaces/compose-compiler.d.ts +104 -0
  35. package/dist/server/flow-surfaces/compose-compiler.js +162 -0
  36. package/dist/server/flow-surfaces/compose-runtime.d.ts +89 -0
  37. package/dist/server/flow-surfaces/compose-runtime.js +338 -0
  38. package/dist/server/flow-surfaces/configure-options.js +12 -3
  39. package/dist/server/flow-surfaces/constants.d.ts +3 -2
  40. package/dist/server/flow-surfaces/constants.js +36 -3
  41. package/dist/server/flow-surfaces/default-action-popup.d.ts +52 -0
  42. package/dist/server/flow-surfaces/default-action-popup.js +258 -0
  43. package/dist/server/flow-surfaces/executor.d.ts +10 -0
  44. package/dist/server/flow-surfaces/executor.js +59 -24
  45. package/dist/server/flow-surfaces/field-binding-registry.d.ts +23 -0
  46. package/dist/server/flow-surfaces/field-binding-registry.js +391 -0
  47. package/dist/server/flow-surfaces/field-semantics.d.ts +1 -1
  48. package/dist/server/flow-surfaces/index.js +75 -0
  49. package/dist/server/flow-surfaces/node-use-sets.d.ts +15 -0
  50. package/dist/server/flow-surfaces/node-use-sets.js +114 -0
  51. package/dist/server/flow-surfaces/payload-shape.d.ts +9 -0
  52. package/dist/server/flow-surfaces/payload-shape.js +64 -0
  53. package/dist/server/flow-surfaces/placement.js +2 -6
  54. package/dist/server/flow-surfaces/planning/action-specs.d.ts +179 -0
  55. package/dist/server/flow-surfaces/planning/action-specs.js +190 -0
  56. package/dist/server/flow-surfaces/planning/compiler.d.ts +37 -0
  57. package/dist/server/flow-surfaces/planning/compiler.js +376 -0
  58. package/dist/server/flow-surfaces/planning/context.d.ts +30 -0
  59. package/dist/server/flow-surfaces/planning/context.js +139 -0
  60. package/dist/server/flow-surfaces/planning/created-keys.d.ts +34 -0
  61. package/dist/server/flow-surfaces/planning/created-keys.js +375 -0
  62. package/dist/server/flow-surfaces/planning/key-kind.d.ts +11 -0
  63. package/dist/server/flow-surfaces/planning/key-kind.js +86 -0
  64. package/dist/server/flow-surfaces/planning/key-persistence.d.ts +34 -0
  65. package/dist/server/flow-surfaces/planning/key-persistence.js +148 -0
  66. package/dist/server/flow-surfaces/planning/key-registry.d.ts +40 -0
  67. package/dist/server/flow-surfaces/planning/key-registry.js +206 -0
  68. package/dist/server/flow-surfaces/planning/runtime.d.ts +37 -0
  69. package/dist/server/flow-surfaces/planning/runtime.js +259 -0
  70. package/dist/server/flow-surfaces/planning/step-link.d.ts +14 -0
  71. package/dist/server/flow-surfaces/planning/step-link.js +104 -0
  72. package/dist/server/flow-surfaces/planning/types.d.ts +55 -0
  73. package/dist/server/flow-surfaces/planning/types.js +24 -0
  74. package/dist/server/flow-surfaces/reaction/errors.d.ts +20 -0
  75. package/dist/server/flow-surfaces/reaction/errors.js +69 -0
  76. package/dist/server/flow-surfaces/reaction/field-value.d.ts +34 -0
  77. package/dist/server/flow-surfaces/reaction/field-value.js +181 -0
  78. package/dist/server/flow-surfaces/reaction/fingerprint.d.ts +16 -0
  79. package/dist/server/flow-surfaces/reaction/fingerprint.js +71 -0
  80. package/dist/server/flow-surfaces/reaction/linkage.d.ts +136 -0
  81. package/dist/server/flow-surfaces/reaction/linkage.js +882 -0
  82. package/dist/server/flow-surfaces/reaction/meta.d.ts +11 -0
  83. package/dist/server/flow-surfaces/reaction/meta.js +451 -0
  84. package/dist/server/flow-surfaces/reaction/registry.d.ts +136 -0
  85. package/dist/server/flow-surfaces/reaction/registry.js +186 -0
  86. package/dist/server/flow-surfaces/reaction/resolver.d.ts +22 -0
  87. package/dist/server/flow-surfaces/reaction/resolver.js +202 -0
  88. package/dist/server/flow-surfaces/reaction/types.d.ts +241 -0
  89. package/dist/server/flow-surfaces/reaction/types.js +24 -0
  90. package/dist/server/flow-surfaces/reaction/utils.d.ts +17 -0
  91. package/dist/server/flow-surfaces/reaction/utils.js +67 -0
  92. package/dist/server/flow-surfaces/reaction/value-expr.d.ts +15 -0
  93. package/dist/server/flow-surfaces/reaction/value-expr.js +209 -0
  94. package/dist/server/flow-surfaces/reference-guards.d.ts +19 -0
  95. package/dist/server/flow-surfaces/reference-guards.js +103 -0
  96. package/dist/server/flow-surfaces/service-helpers.d.ts +42 -0
  97. package/dist/server/flow-surfaces/service-helpers.js +377 -0
  98. package/dist/server/flow-surfaces/service-utils.d.ts +105 -0
  99. package/dist/server/flow-surfaces/service-utils.js +760 -0
  100. package/dist/server/flow-surfaces/service.d.ts +189 -103
  101. package/dist/server/flow-surfaces/service.js +3975 -1770
  102. package/dist/server/flow-surfaces/template-compatibility.d.ts +42 -0
  103. package/dist/server/flow-surfaces/template-compatibility.js +189 -0
  104. package/dist/server/flow-surfaces/template-service-utils.d.ts +62 -0
  105. package/dist/server/flow-surfaces/template-service-utils.js +281 -0
  106. package/dist/server/flow-surfaces/types.d.ts +129 -37
  107. package/dist/swagger/flow-surfaces.d.ts +3773 -1581
  108. package/dist/swagger/flow-surfaces.examples.d.ts +1215 -0
  109. package/dist/swagger/flow-surfaces.examples.js +1363 -0
  110. package/dist/swagger/flow-surfaces.js +2209 -1684
  111. package/dist/swagger/flow-surfaces.template-action-docs.d.ts +62 -0
  112. package/dist/swagger/flow-surfaces.template-action-docs.js +121 -0
  113. package/dist/swagger/flow-surfaces.template-schemas.d.ts +239 -0
  114. package/dist/swagger/flow-surfaces.template-schemas.js +255 -0
  115. package/dist/swagger/index.d.ts +3773 -1581
  116. package/package.json +2 -2
@@ -0,0 +1,18 @@
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 { FlowSurfaceCatalogExpand, FlowSurfaceCatalogScenario, FlowSurfaceCatalogSection } from './types';
10
+ import type { FlowSurfaceCatalogAnalyzeTargetInput, FlowSurfaceCatalogAnalyzeTargetResult, FlowSurfaceCatalogExpandFlags, FlowSurfaceCatalogScenarioInput, FlowSurfaceCatalogSelectedSectionsInput } from './catalog-smart.types';
11
+ export * from './catalog-smart.types';
12
+ export { buildCatalogItemOptionalFields, buildFieldCatalogLightCandidate, expandFieldCatalogCandidate, projectCatalogItem, projectCatalogNode, } from './catalog-smart.projector';
13
+ export declare function normalizeCatalogSections(actionName: string, input: any): FlowSurfaceCatalogSection[];
14
+ export declare function normalizeCatalogExpand(actionName: string, input: any): FlowSurfaceCatalogExpand[];
15
+ export declare function buildCatalogExpandFlags(expands: Iterable<FlowSurfaceCatalogExpand>): FlowSurfaceCatalogExpandFlags;
16
+ export declare function scenario(input: FlowSurfaceCatalogScenarioInput): FlowSurfaceCatalogScenario;
17
+ export declare function selectedSections(input: FlowSurfaceCatalogSelectedSectionsInput): FlowSurfaceCatalogSection[];
18
+ export declare function analyzeCatalogTarget(input: FlowSurfaceCatalogAnalyzeTargetInput): FlowSurfaceCatalogAnalyzeTargetResult;
@@ -0,0 +1,239 @@
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 __create = Object.create;
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __export = (target, all) => {
17
+ for (var name in all)
18
+ __defProp(target, name, { get: all[name], enumerable: true });
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
27
+ };
28
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
29
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
+ // If the importer is in node compatibility mode or this is not an ESM
31
+ // file that has been converted to a CommonJS file using a Babel-
32
+ // compatible transform (i.e. "__esModule" has not been set), then set
33
+ // "default" to the CommonJS "module.exports" for node compatibility.
34
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
+ mod
36
+ ));
37
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
+ var catalog_smart_exports = {};
39
+ __export(catalog_smart_exports, {
40
+ analyzeCatalogTarget: () => analyzeCatalogTarget,
41
+ buildCatalogExpandFlags: () => buildCatalogExpandFlags,
42
+ buildCatalogItemOptionalFields: () => import_catalog_smart.buildCatalogItemOptionalFields,
43
+ buildFieldCatalogLightCandidate: () => import_catalog_smart.buildFieldCatalogLightCandidate,
44
+ expandFieldCatalogCandidate: () => import_catalog_smart.expandFieldCatalogCandidate,
45
+ normalizeCatalogExpand: () => normalizeCatalogExpand,
46
+ normalizeCatalogSections: () => normalizeCatalogSections,
47
+ projectCatalogItem: () => import_catalog_smart.projectCatalogItem,
48
+ projectCatalogNode: () => import_catalog_smart.projectCatalogNode,
49
+ scenario: () => scenario,
50
+ selectedSections: () => selectedSections
51
+ });
52
+ module.exports = __toCommonJS(catalog_smart_exports);
53
+ var import_lodash = __toESM(require("lodash"));
54
+ var import_action_scope = require("./action-scope");
55
+ var import_errors = require("./errors");
56
+ var import_field_semantics = require("./field-semantics");
57
+ __reExport(catalog_smart_exports, require("./catalog-smart.types"), module.exports);
58
+ var import_catalog_smart = require("./catalog-smart.projector");
59
+ const FLOW_SURFACE_CATALOG_SECTION_SET = /* @__PURE__ */ new Set([
60
+ "blocks",
61
+ "fields",
62
+ "actions",
63
+ "recordActions",
64
+ "node"
65
+ ]);
66
+ const FLOW_SURFACE_CATALOG_EXPAND_SET = /* @__PURE__ */ new Set([
67
+ "item.configureOptions",
68
+ "item.contracts",
69
+ "item.allowedContainerUses",
70
+ "node.contracts"
71
+ ]);
72
+ function resolveCatalogPopupScenario(input) {
73
+ if (!(input == null ? void 0 : input.isPopupSurface)) {
74
+ return void 0;
75
+ }
76
+ return {
77
+ kind: input.popupKind || "plainPopup",
78
+ scene: input.scene || "generic",
79
+ hasCurrentRecord: !!input.hasCurrentRecord,
80
+ hasAssociationContext: !!input.hasAssociationContext
81
+ };
82
+ }
83
+ function resolveCatalogFieldContainerScenario(input) {
84
+ const kind = (0, import_field_semantics.normalizeFieldContainerKind)(input.ownerUse || void 0);
85
+ if (!kind) {
86
+ return void 0;
87
+ }
88
+ if (kind === "filter-form") {
89
+ return {
90
+ kind,
91
+ targetMode: (input.filterFormTargetCount || 0) > 1 ? "multiple" : "single"
92
+ };
93
+ }
94
+ return { kind };
95
+ }
96
+ function resolveCatalogActionContainerScenario(input) {
97
+ const ownerUse = input.ownerUse || void 0;
98
+ const scope = (0, import_action_scope.getActionContainerScope)(ownerUse);
99
+ if (!scope) {
100
+ return void 0;
101
+ }
102
+ return import_lodash.default.pickBy(
103
+ {
104
+ scope,
105
+ ownerUse,
106
+ recordActionContainerUse: input.recordActionContainerUse || void 0
107
+ },
108
+ (value) => !import_lodash.default.isUndefined(value)
109
+ );
110
+ }
111
+ function normalizeCatalogSections(actionName, input) {
112
+ if (import_lodash.default.isUndefined(input)) {
113
+ return [];
114
+ }
115
+ if (!Array.isArray(input)) {
116
+ (0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} sections must be an array`);
117
+ }
118
+ const seen = /* @__PURE__ */ new Set();
119
+ return input.map((value, index) => {
120
+ const normalized = String(value || "").trim();
121
+ if (!FLOW_SURFACE_CATALOG_SECTION_SET.has(normalized)) {
122
+ (0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} sections[${index}] '${String(value || "")}' is not supported`);
123
+ }
124
+ if (seen.has(normalized)) {
125
+ return null;
126
+ }
127
+ seen.add(normalized);
128
+ return normalized;
129
+ }).filter(Boolean);
130
+ }
131
+ function normalizeCatalogExpand(actionName, input) {
132
+ if (import_lodash.default.isUndefined(input)) {
133
+ return [];
134
+ }
135
+ if (!Array.isArray(input)) {
136
+ (0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} expand must be an array`);
137
+ }
138
+ const seen = /* @__PURE__ */ new Set();
139
+ return input.map((value, index) => {
140
+ const normalized = String(value || "").trim();
141
+ if (!FLOW_SURFACE_CATALOG_EXPAND_SET.has(normalized)) {
142
+ (0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} expand[${index}] '${String(value || "")}' is not supported`);
143
+ }
144
+ if (seen.has(normalized)) {
145
+ return null;
146
+ }
147
+ seen.add(normalized);
148
+ return normalized;
149
+ }).filter(Boolean);
150
+ }
151
+ function buildCatalogExpandFlags(expands) {
152
+ const expandSet = new Set(expands);
153
+ return {
154
+ includeItemConfigureOptions: expandSet.has("item.configureOptions"),
155
+ includeItemContracts: expandSet.has("item.contracts"),
156
+ includeItemAllowedContainerUses: expandSet.has("item.allowedContainerUses"),
157
+ includeNodeContracts: expandSet.has("node.contracts")
158
+ };
159
+ }
160
+ function scenario(input) {
161
+ return import_lodash.default.pickBy(
162
+ {
163
+ surfaceKind: input.surfaceKind,
164
+ popup: input.popup,
165
+ fieldContainer: input.fieldContainer,
166
+ actionContainer: input.actionContainer
167
+ },
168
+ (value) => !import_lodash.default.isUndefined(value)
169
+ );
170
+ }
171
+ function selectedSections(input) {
172
+ if (!import_lodash.default.isUndefined(input.requestedSections)) {
173
+ return input.requestedSections;
174
+ }
175
+ if (!input.hasTarget) {
176
+ return ["blocks", "actions", "recordActions"];
177
+ }
178
+ const sections = [];
179
+ if (input.hasBlockSurface) {
180
+ sections.push("blocks");
181
+ }
182
+ if (input.hasFieldContainer) {
183
+ sections.push("fields");
184
+ }
185
+ if (input.hasActionContainer) {
186
+ sections.push("actions");
187
+ }
188
+ if (input.hasRecordActions) {
189
+ sections.push("recordActions");
190
+ }
191
+ sections.push("node");
192
+ return sections;
193
+ }
194
+ function analyzeCatalogTarget(input) {
195
+ var _a, _b, _c;
196
+ const recordActionContainerUse = input.recordActionContainerUse || null;
197
+ const popup = resolveCatalogPopupScenario(input.popupProfile);
198
+ const fieldContainer = resolveCatalogFieldContainerScenario({
199
+ ownerUse: (_a = input.fieldContainer) == null ? void 0 : _a.ownerUse,
200
+ filterFormTargetCount: input.filterFormTargetCount
201
+ });
202
+ const actionContainer = resolveCatalogActionContainerScenario({
203
+ ownerUse: (_b = input.actionContainer) == null ? void 0 : _b.ownerUse,
204
+ recordActionContainerUse
205
+ });
206
+ const hasRecordActions = import_lodash.default.isBoolean(input.hasRecordActions) ? input.hasRecordActions : !!recordActionContainerUse || !input.hasTarget;
207
+ return {
208
+ scenario: scenario({
209
+ surfaceKind: input.surfaceKind || ((_c = input.resolved) == null ? void 0 : _c.kind) || "global",
210
+ popup,
211
+ fieldContainer,
212
+ actionContainer
213
+ }),
214
+ selectedSections: selectedSections({
215
+ requestedSections: input.requestedSections,
216
+ hasTarget: input.hasTarget,
217
+ hasBlockSurface: input.hasBlockSurface,
218
+ hasFieldContainer: !!fieldContainer,
219
+ hasActionContainer: !!actionContainer,
220
+ hasRecordActions
221
+ }),
222
+ recordActionContainerUse
223
+ };
224
+ }
225
+ // Annotate the CommonJS export names for ESM import in node:
226
+ 0 && (module.exports = {
227
+ analyzeCatalogTarget,
228
+ buildCatalogExpandFlags,
229
+ buildCatalogItemOptionalFields,
230
+ buildFieldCatalogLightCandidate,
231
+ expandFieldCatalogCandidate,
232
+ normalizeCatalogExpand,
233
+ normalizeCatalogSections,
234
+ projectCatalogItem,
235
+ projectCatalogNode,
236
+ scenario,
237
+ selectedSections,
238
+ ...require("./catalog-smart.types")
239
+ });
@@ -0,0 +1,15 @@
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 _ from 'lodash';
10
+ import type { FlowSurfaceCatalogExpandFlags, FlowSurfaceCatalogItemOptionalFieldsOptions, FlowSurfaceCatalogItemOptionalFieldsProviders, FlowSurfaceCatalogNodeProjectInput, FlowSurfaceCatalogNodeProjectResult, FlowSurfaceCatalogProjectItemOptions, FlowSurfaceCatalogProjectableItem, FlowSurfaceCatalogProjectedItem, FlowSurfaceFieldCatalogProjectableItem, FlowSurfaceFieldCatalogLightCandidate } from './catalog-smart.types';
11
+ export declare function buildCatalogItemOptionalFields(use: string | undefined, options: FlowSurfaceCatalogItemOptionalFieldsOptions, providers: FlowSurfaceCatalogItemOptionalFieldsProviders): _.Dictionary<any>;
12
+ export declare function buildFieldCatalogLightCandidate(item: FlowSurfaceFieldCatalogProjectableItem): FlowSurfaceFieldCatalogLightCandidate;
13
+ export declare function projectCatalogItem(item: FlowSurfaceCatalogProjectableItem, expand: FlowSurfaceCatalogExpandFlags, options: FlowSurfaceCatalogProjectItemOptions): FlowSurfaceCatalogProjectedItem;
14
+ export declare function expandFieldCatalogCandidate(item: FlowSurfaceFieldCatalogProjectableItem, expand: FlowSurfaceCatalogExpandFlags, options: FlowSurfaceCatalogProjectItemOptions): FlowSurfaceCatalogProjectedItem;
15
+ export declare function projectCatalogNode(node: any, resolved: FlowSurfaceCatalogNodeProjectInput['resolved'], expand: FlowSurfaceCatalogExpandFlags, options: FlowSurfaceCatalogNodeProjectInput['options']): FlowSurfaceCatalogNodeProjectResult;
@@ -0,0 +1,157 @@
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 __create = Object.create;
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __export = (target, all) => {
17
+ for (var name in all)
18
+ __defProp(target, name, { get: all[name], enumerable: true });
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
36
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
+ var catalog_smart_projector_exports = {};
38
+ __export(catalog_smart_projector_exports, {
39
+ buildCatalogItemOptionalFields: () => buildCatalogItemOptionalFields,
40
+ buildFieldCatalogLightCandidate: () => buildFieldCatalogLightCandidate,
41
+ expandFieldCatalogCandidate: () => expandFieldCatalogCandidate,
42
+ projectCatalogItem: () => projectCatalogItem,
43
+ projectCatalogNode: () => projectCatalogNode
44
+ });
45
+ module.exports = __toCommonJS(catalog_smart_projector_exports);
46
+ var import_lodash = __toESM(require("lodash"));
47
+ const LIGHT_CATALOG_ITEM_KEYS = [
48
+ "key",
49
+ "label",
50
+ "use",
51
+ "kind",
52
+ "scope",
53
+ "scene",
54
+ "fieldUse",
55
+ "wrapperUse",
56
+ "associationPathName",
57
+ "defaultTargetUid",
58
+ "targetBlockUid",
59
+ "requiredInitParams",
60
+ "createSupported",
61
+ "renderer",
62
+ "type"
63
+ ];
64
+ function pickLightCatalogItem(item) {
65
+ var _a;
66
+ const projected = import_lodash.default.pick(item, LIGHT_CATALOG_ITEM_KEYS);
67
+ if ((_a = item.resourceBindings) == null ? void 0 : _a.length) {
68
+ projected.resourceBindings = item.resourceBindings;
69
+ }
70
+ return import_lodash.default.pickBy(projected, (value) => !import_lodash.default.isUndefined(value));
71
+ }
72
+ function createNodeContractResolver(item, options) {
73
+ let loaded = false;
74
+ let cached;
75
+ return () => {
76
+ if (!loaded) {
77
+ cached = options.getNodeContract(item.use);
78
+ loaded = true;
79
+ }
80
+ return cached;
81
+ };
82
+ }
83
+ function buildCatalogItemOptionalFields(use, options = {}, providers) {
84
+ const projected = {};
85
+ if (options.includeContracts) {
86
+ const contract = providers.getNodeContract(use);
87
+ projected.editableDomains = providers.getEditableDomains(use);
88
+ projected.settingsSchema = providers.getSettingsSchema(use);
89
+ projected.settingsContract = contract == null ? void 0 : contract.domains;
90
+ projected.eventCapabilities = contract == null ? void 0 : contract.eventCapabilities;
91
+ projected.layoutCapabilities = contract == null ? void 0 : contract.layoutCapabilities;
92
+ }
93
+ if (options.includeConfigureOptions) {
94
+ projected.configureOptions = providers.getConfigureOptions(use);
95
+ }
96
+ return import_lodash.default.pickBy(projected, (value) => !import_lodash.default.isUndefined(value));
97
+ }
98
+ function buildFieldCatalogLightCandidate(item) {
99
+ return pickLightCatalogItem({
100
+ ...item,
101
+ kind: "field"
102
+ });
103
+ }
104
+ function projectCatalogItem(item, expand, options) {
105
+ var _a, _b, _c, _d;
106
+ const projected = pickLightCatalogItem(item);
107
+ if (expand.includeItemAllowedContainerUses && ((_a = item.allowedContainerUses) == null ? void 0 : _a.length)) {
108
+ projected.allowedContainerUses = item.allowedContainerUses;
109
+ }
110
+ if (expand.includeItemConfigureOptions) {
111
+ projected.configureOptions = !import_lodash.default.isUndefined(item.configureOptions) ? item.configureOptions : options.getConfigureOptions(item);
112
+ }
113
+ if (expand.includeItemContracts) {
114
+ const resolveContract = createNodeContractResolver(item, options);
115
+ projected.editableDomains = !import_lodash.default.isUndefined(item.editableDomains) ? item.editableDomains : options.getEditableDomains(item.use);
116
+ projected.settingsSchema = !import_lodash.default.isUndefined(item.settingsSchema) ? item.settingsSchema : options.getSettingsSchema(item.use);
117
+ projected.settingsContract = !import_lodash.default.isUndefined(item.settingsContract) ? item.settingsContract : (_b = resolveContract()) == null ? void 0 : _b.domains;
118
+ projected.eventCapabilities = !import_lodash.default.isUndefined(item.eventCapabilities) ? item.eventCapabilities : (_c = resolveContract()) == null ? void 0 : _c.eventCapabilities;
119
+ projected.layoutCapabilities = !import_lodash.default.isUndefined(item.layoutCapabilities) ? item.layoutCapabilities : (_d = resolveContract()) == null ? void 0 : _d.layoutCapabilities;
120
+ }
121
+ return import_lodash.default.pickBy(projected, (value) => !import_lodash.default.isUndefined(value));
122
+ }
123
+ function expandFieldCatalogCandidate(item, expand, options) {
124
+ return projectCatalogItem(buildFieldCatalogLightCandidate(item), expand, options);
125
+ }
126
+ function projectCatalogNode(node, resolved, expand, options) {
127
+ var _a, _b, _c, _d, _e;
128
+ const input = {
129
+ node,
130
+ resolved: resolved || null,
131
+ expand,
132
+ options
133
+ };
134
+ const projected = {
135
+ editableDomains: input.options.getEditableDomains((_a = input.node) == null ? void 0 : _a.use),
136
+ configureOptions: input.options.getConfigureOptionsForResolvedNode({
137
+ kind: (_b = input.resolved) == null ? void 0 : _b.kind,
138
+ use: (_c = input.node) == null ? void 0 : _c.use
139
+ })
140
+ };
141
+ if (input.expand.includeNodeContracts) {
142
+ const contract = input.options.getNodeContract((_d = input.node) == null ? void 0 : _d.use);
143
+ projected.settingsSchema = input.options.getSettingsSchema((_e = input.node) == null ? void 0 : _e.use);
144
+ projected.settingsContract = contract == null ? void 0 : contract.domains;
145
+ projected.eventCapabilities = contract == null ? void 0 : contract.eventCapabilities;
146
+ projected.layoutCapabilities = contract == null ? void 0 : contract.layoutCapabilities;
147
+ }
148
+ return projected;
149
+ }
150
+ // Annotate the CommonJS export names for ESM import in node:
151
+ 0 && (module.exports = {
152
+ buildCatalogItemOptionalFields,
153
+ buildFieldCatalogLightCandidate,
154
+ expandFieldCatalogCandidate,
155
+ projectCatalogItem,
156
+ projectCatalogNode
157
+ });
@@ -0,0 +1,99 @@
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 { FlowSurfaceCatalogActionContainerScenario, FlowSurfaceCatalogFieldContainerScenario, FlowSurfaceCatalogItem, FlowSurfaceCatalogNodeInfo, FlowSurfaceCatalogPopupScenario, FlowSurfaceCatalogScenario, FlowSurfaceCatalogSection, FlowSurfaceNodeContract, FlowSurfaceNodeDomain, FlowSurfaceResolvedTarget } from './types';
10
+ export type FlowSurfaceCatalogExpandFlags = {
11
+ includeItemConfigureOptions: boolean;
12
+ includeItemContracts: boolean;
13
+ includeItemAllowedContainerUses: boolean;
14
+ includeNodeContracts: boolean;
15
+ };
16
+ export type FlowSurfaceCatalogPopupLike = {
17
+ isPopupSurface?: boolean;
18
+ popupKind?: FlowSurfaceCatalogPopupScenario['kind'] | null;
19
+ scene?: FlowSurfaceCatalogPopupScenario['scene'];
20
+ hasCurrentRecord?: boolean;
21
+ hasAssociationContext?: boolean;
22
+ };
23
+ export type FlowSurfaceCatalogFieldContainerLike = {
24
+ ownerUse?: string | null;
25
+ };
26
+ export type FlowSurfaceCatalogActionContainerLike = {
27
+ ownerUse?: string | null;
28
+ };
29
+ export type FlowSurfaceCatalogAnalyzeTargetInput = {
30
+ hasTarget: boolean;
31
+ hasBlockSurface: boolean;
32
+ resolved?: Pick<FlowSurfaceResolvedTarget, 'kind'> | null;
33
+ surfaceKind?: FlowSurfaceCatalogScenario['surfaceKind'];
34
+ requestedSections?: FlowSurfaceCatalogSection[];
35
+ popupProfile?: FlowSurfaceCatalogPopupLike | null;
36
+ fieldContainer?: FlowSurfaceCatalogFieldContainerLike | null;
37
+ filterFormTargetCount?: number;
38
+ actionContainer?: FlowSurfaceCatalogActionContainerLike | null;
39
+ recordActionContainerUse?: string | null;
40
+ hasRecordActions?: boolean;
41
+ };
42
+ export type FlowSurfaceCatalogAnalyzeTargetResult = {
43
+ scenario: FlowSurfaceCatalogScenario;
44
+ selectedSections: FlowSurfaceCatalogSection[];
45
+ recordActionContainerUse: string | null;
46
+ };
47
+ export type FlowSurfaceCatalogScenarioInput = {
48
+ surfaceKind: FlowSurfaceCatalogScenario['surfaceKind'];
49
+ popup?: FlowSurfaceCatalogPopupScenario;
50
+ fieldContainer?: FlowSurfaceCatalogFieldContainerScenario;
51
+ actionContainer?: FlowSurfaceCatalogActionContainerScenario;
52
+ };
53
+ export type FlowSurfaceCatalogSelectedSectionsInput = {
54
+ requestedSections?: FlowSurfaceCatalogSection[];
55
+ hasTarget: boolean;
56
+ hasBlockSurface: boolean;
57
+ hasFieldContainer: boolean;
58
+ hasActionContainer: boolean;
59
+ hasRecordActions: boolean;
60
+ };
61
+ export type FlowSurfaceCatalogProjectedItem = FlowSurfaceCatalogItem & {
62
+ renderer?: string;
63
+ type?: string;
64
+ };
65
+ export type FlowSurfaceCatalogProjectableItem = Pick<FlowSurfaceCatalogItem, 'key' | 'label' | 'use' | 'kind'> & Partial<FlowSurfaceCatalogItem> & Record<string, any>;
66
+ export type FlowSurfaceFieldCatalogProjectableItem = Pick<FlowSurfaceCatalogItem, 'key' | 'label' | 'use'> & Partial<Omit<FlowSurfaceCatalogItem, 'kind'>> & Record<string, any>;
67
+ export type FlowSurfaceFieldCatalogLightCandidate = FlowSurfaceCatalogProjectedItem;
68
+ export type FlowSurfaceCatalogProjectItemOptions = {
69
+ getEditableDomains: (use?: string) => FlowSurfaceNodeDomain[];
70
+ getConfigureOptions: (item?: Pick<FlowSurfaceCatalogItem, 'kind' | 'use'> | null) => Record<string, any>;
71
+ getSettingsSchema: (use?: string) => Record<string, any>;
72
+ getNodeContract: (use?: string) => FlowSurfaceNodeContract;
73
+ };
74
+ export type FlowSurfaceCatalogItemOptionalFieldsOptions = {
75
+ includeConfigureOptions?: boolean;
76
+ includeContracts?: boolean;
77
+ };
78
+ export type FlowSurfaceCatalogItemOptionalFieldsProviders = {
79
+ getEditableDomains: (use?: string) => FlowSurfaceNodeDomain[];
80
+ getConfigureOptions: (use?: string) => Record<string, any>;
81
+ getSettingsSchema: (use?: string) => Record<string, any>;
82
+ getNodeContract: (use?: string) => FlowSurfaceNodeContract;
83
+ };
84
+ export type FlowSurfaceCatalogNodeProjectOptions = {
85
+ getEditableDomains: (use?: string) => FlowSurfaceNodeDomain[];
86
+ getConfigureOptionsForResolvedNode: (input: {
87
+ kind?: string;
88
+ use?: string;
89
+ }) => Record<string, any>;
90
+ getSettingsSchema: (use?: string) => Record<string, any>;
91
+ getNodeContract: (use?: string) => FlowSurfaceNodeContract;
92
+ };
93
+ export type FlowSurfaceCatalogNodeProjectInput = {
94
+ node: any;
95
+ resolved: Pick<FlowSurfaceResolvedTarget, 'kind'> | null;
96
+ expand: FlowSurfaceCatalogExpandFlags;
97
+ options: FlowSurfaceCatalogNodeProjectOptions;
98
+ };
99
+ export type FlowSurfaceCatalogNodeProjectResult = FlowSurfaceCatalogNodeInfo;
@@ -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 catalog_smart_types_exports = {};
24
+ module.exports = __toCommonJS(catalog_smart_types_exports);
@@ -16,6 +16,9 @@ export declare function resolveSupportedFieldCapability(input: {
16
16
  allowUnresolvedFieldUse?: boolean;
17
17
  requestedRenderer?: string;
18
18
  requestedType?: string;
19
+ enabledPackages?: ReadonlySet<string>;
20
+ dataSourceKey?: string;
21
+ getCollection?: (dataSourceKey: string, collectionName: string) => any;
19
22
  }): {
20
23
  wrapperUse: any;
21
24
  fieldUse: any;