@memberjunction/core-actions 6.2.0-edge.2 → 6.2.0-edge.4

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 (98) hide show
  1. package/README.md +3 -1
  2. package/dist/custom/ai/execute-agent.action.d.ts +10 -0
  3. package/dist/custom/ai/execute-agent.action.d.ts.map +1 -1
  4. package/dist/custom/ai/execute-agent.action.js +24 -1
  5. package/dist/custom/ai/execute-agent.action.js.map +1 -1
  6. package/dist/custom/ai/execute-ai-prompt.action.d.ts.map +1 -1
  7. package/dist/custom/ai/execute-ai-prompt.action.js +3 -0
  8. package/dist/custom/ai/execute-ai-prompt.action.js.map +1 -1
  9. package/dist/custom/ai/generate-image.action.d.ts +5 -2
  10. package/dist/custom/ai/generate-image.action.d.ts.map +1 -1
  11. package/dist/custom/ai/generate-image.action.js +18 -8
  12. package/dist/custom/ai/generate-image.action.js.map +1 -1
  13. package/dist/custom/ai/summarize-content.action.d.ts.map +1 -1
  14. package/dist/custom/ai/summarize-content.action.js +3 -0
  15. package/dist/custom/ai/summarize-content.action.js.map +1 -1
  16. package/dist/custom/data/get-entity-details.action.js +2 -2
  17. package/dist/custom/data/get-entity-details.action.js.map +1 -1
  18. package/dist/custom/data/run-adhoc-query.action.d.ts +29 -30
  19. package/dist/custom/data/run-adhoc-query.action.d.ts.map +1 -1
  20. package/dist/custom/data/run-adhoc-query.action.js +140 -102
  21. package/dist/custom/data/run-adhoc-query.action.js.map +1 -1
  22. package/dist/custom/demo/calculate-expression.action.d.ts +2 -6
  23. package/dist/custom/demo/calculate-expression.action.d.ts.map +1 -1
  24. package/dist/custom/demo/calculate-expression.action.js +5 -113
  25. package/dist/custom/demo/calculate-expression.action.js.map +1 -1
  26. package/dist/custom/interactive-forms/_shared.d.ts +113 -31
  27. package/dist/custom/interactive-forms/_shared.d.ts.map +1 -1
  28. package/dist/custom/interactive-forms/_shared.js +198 -74
  29. package/dist/custom/interactive-forms/_shared.js.map +1 -1
  30. package/dist/custom/interactive-forms/activate-form-contribution-version.action.d.ts +25 -0
  31. package/dist/custom/interactive-forms/activate-form-contribution-version.action.d.ts.map +1 -0
  32. package/dist/custom/interactive-forms/activate-form-contribution-version.action.js +153 -0
  33. package/dist/custom/interactive-forms/activate-form-contribution-version.action.js.map +1 -0
  34. package/dist/custom/interactive-forms/activate-interactive-form-version.action.d.ts +25 -7
  35. package/dist/custom/interactive-forms/activate-interactive-form-version.action.d.ts.map +1 -1
  36. package/dist/custom/interactive-forms/activate-interactive-form-version.action.js +116 -58
  37. package/dist/custom/interactive-forms/activate-interactive-form-version.action.js.map +1 -1
  38. package/dist/custom/interactive-forms/create-form-contribution.action.d.ts +37 -0
  39. package/dist/custom/interactive-forms/create-form-contribution.action.d.ts.map +1 -0
  40. package/dist/custom/interactive-forms/create-form-contribution.action.js +151 -0
  41. package/dist/custom/interactive-forms/create-form-contribution.action.js.map +1 -0
  42. package/dist/custom/interactive-forms/create-interactive-form.action.d.ts +2 -0
  43. package/dist/custom/interactive-forms/create-interactive-form.action.d.ts.map +1 -1
  44. package/dist/custom/interactive-forms/create-interactive-form.action.js +2 -0
  45. package/dist/custom/interactive-forms/create-interactive-form.action.js.map +1 -1
  46. package/dist/custom/interactive-forms/get-active-form-for-entity.action.d.ts +5 -0
  47. package/dist/custom/interactive-forms/get-active-form-for-entity.action.d.ts.map +1 -1
  48. package/dist/custom/interactive-forms/get-active-form-for-entity.action.js +7 -1
  49. package/dist/custom/interactive-forms/get-active-form-for-entity.action.js.map +1 -1
  50. package/dist/custom/interactive-forms/get-default-form-scaffold.action.d.ts +2 -0
  51. package/dist/custom/interactive-forms/get-default-form-scaffold.action.d.ts.map +1 -1
  52. package/dist/custom/interactive-forms/get-default-form-scaffold.action.js +2 -0
  53. package/dist/custom/interactive-forms/get-default-form-scaffold.action.js.map +1 -1
  54. package/dist/custom/interactive-forms/get-entity-schema-for-form.action.d.ts +2 -0
  55. package/dist/custom/interactive-forms/get-entity-schema-for-form.action.d.ts.map +1 -1
  56. package/dist/custom/interactive-forms/get-entity-schema-for-form.action.js +2 -0
  57. package/dist/custom/interactive-forms/get-entity-schema-for-form.action.js.map +1 -1
  58. package/dist/custom/interactive-forms/get-form-composition-for-entity.action.d.ts +61 -0
  59. package/dist/custom/interactive-forms/get-form-composition-for-entity.action.d.ts.map +1 -0
  60. package/dist/custom/interactive-forms/get-form-composition-for-entity.action.js +315 -0
  61. package/dist/custom/interactive-forms/get-form-composition-for-entity.action.js.map +1 -0
  62. package/dist/custom/interactive-forms/get-form-contributions-for-entity.action.d.ts +49 -0
  63. package/dist/custom/interactive-forms/get-form-contributions-for-entity.action.d.ts.map +1 -0
  64. package/dist/custom/interactive-forms/get-form-contributions-for-entity.action.js +117 -0
  65. package/dist/custom/interactive-forms/get-form-contributions-for-entity.action.js.map +1 -0
  66. package/dist/custom/interactive-forms/index.d.ts +5 -0
  67. package/dist/custom/interactive-forms/index.d.ts.map +1 -1
  68. package/dist/custom/interactive-forms/index.js +5 -0
  69. package/dist/custom/interactive-forms/index.js.map +1 -1
  70. package/dist/custom/interactive-forms/modify-form-contribution.action.d.ts +38 -0
  71. package/dist/custom/interactive-forms/modify-form-contribution.action.d.ts.map +1 -0
  72. package/dist/custom/interactive-forms/modify-form-contribution.action.js +183 -0
  73. package/dist/custom/interactive-forms/modify-form-contribution.action.js.map +1 -0
  74. package/dist/custom/interactive-forms/modify-interactive-form.action.d.ts +15 -11
  75. package/dist/custom/interactive-forms/modify-interactive-form.action.d.ts.map +1 -1
  76. package/dist/custom/interactive-forms/modify-interactive-form.action.js +67 -64
  77. package/dist/custom/interactive-forms/modify-interactive-form.action.js.map +1 -1
  78. package/dist/custom/interactive-forms/revert-interactive-form.action.d.ts +14 -0
  79. package/dist/custom/interactive-forms/revert-interactive-form.action.d.ts.map +1 -1
  80. package/dist/custom/interactive-forms/revert-interactive-form.action.js +31 -4
  81. package/dist/custom/interactive-forms/revert-interactive-form.action.js.map +1 -1
  82. package/dist/custom/utilities/safe-math-evaluator.d.ts +27 -0
  83. package/dist/custom/utilities/safe-math-evaluator.d.ts.map +1 -0
  84. package/dist/custom/utilities/safe-math-evaluator.js +104 -0
  85. package/dist/custom/utilities/safe-math-evaluator.js.map +1 -0
  86. package/dist/custom/visualization/create-mermaid-diagram.action.d.ts +18 -3
  87. package/dist/custom/visualization/create-mermaid-diagram.action.d.ts.map +1 -1
  88. package/dist/custom/visualization/create-mermaid-diagram.action.js +71 -33
  89. package/dist/custom/visualization/create-mermaid-diagram.action.js.map +1 -1
  90. package/dist/custom/visualization/shared/mermaid-renderer.d.ts +65 -0
  91. package/dist/custom/visualization/shared/mermaid-renderer.d.ts.map +1 -0
  92. package/dist/custom/visualization/shared/mermaid-renderer.js +310 -0
  93. package/dist/custom/visualization/shared/mermaid-renderer.js.map +1 -0
  94. package/dist/custom/workflow/conditional.action.d.ts +1 -18
  95. package/dist/custom/workflow/conditional.action.d.ts.map +1 -1
  96. package/dist/custom/workflow/conditional.action.js +12 -83
  97. package/dist/custom/workflow/conditional.action.js.map +1 -1
  98. package/package.json +44 -42
@@ -0,0 +1,315 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { BaseAction } from "@memberjunction/actions";
8
+ import { Metadata, LogError, RunView, ReadRelationshipInclusion } from "@memberjunction/core";
9
+ import { EscapeSQLString, RegisterClass, UUIDsEqual } from "@memberjunction/global";
10
+ import { FormContributionOutranks, FormPanelHideSettingKey, FormScopeAllowedOnEntity, IsSelectableFormOverride, ParseClaimedFieldNames, ParseHiddenFormPanelKeys, } from "@memberjunction/core-entities";
11
+ import { AddOutput, Failure, GetStringParam, ContributionScopeFilter, MetadataContributionsOn } from "./_shared.js";
12
+ import { FORM_VARIANT_EXPLICIT_DEFAULT, FormSectionCamelCase, FormVariantSettingKey, GENERATED_FORM_CONTRIBUTION_SLOTS, RelatedGridSectionKey, ResolveContributionWriteKey, StripJoinFieldBrackets, } from "@memberjunction/interactive-component-types/forms";
13
+ const SERVER_DERIVATION_NOTE = 'Derived from metadata on the server. Compiled BaseFormPanel contributions exist only in the ' +
14
+ 'browser and are not listed. SlotsPresent is what CodeGen emits plus the container terminator; ' +
15
+ 'a hand-written custom form can differ. Section keys and field names come from current field ' +
16
+ 'metadata, which a ' +
17
+ 'form generated earlier may not match. The client form context (AppContext.AdditionalContext.Form), ' +
18
+ 'when present, lists the sections the open form actually draws and is authoritative for those.';
19
+ const FULL_CUSTOM_FORM_NOTE = 'A full custom entity form is the one THIS USER sees for this entity, and it renders the whole ' +
20
+ 'body: no field sections, no related grids, no panel contribution and no slot. Propose a new ' +
21
+ 'version of the full form rather than a panel. The container still supplies the toolbar, ' +
22
+ 'Save/Delete, History and Record Changes, so the form body does not implement those. The user ' +
23
+ 'can switch to the generated form from the form picker in the toolbar, and a panel becomes ' +
24
+ 'possible again the moment they do.';
25
+ /**
26
+ * Server-side composition of an entity's form, for agents with no browser snapshot.
27
+ *
28
+ * The client context is the better source for sections — it reports what a form actually
29
+ * rendered. This reproduces the part derivable from metadata alone: field sections by CodeGen
30
+ * rule, `DisplayInForm` related grids with their L1 inclusion, the caller's Active metadata
31
+ * contributions as the caller's form draws them, and the L3 rule count.
32
+ *
33
+ * Contributions are reported for the form this user sees: one row per key (highest
34
+ * `Precedence`, then the narrower scope, the browser's collapse rule), the panels the user hid
35
+ * marked `Hidden`, and on an identity or permission entity only the user's own rows
36
+ * ({@link FormScopeAllowedOnEntity}). Any failed query returns `QUERY_FAILED` rather than an
37
+ * answer built from a partial read. With metadata contributions switched off
38
+ * ({@link MetadataContributionsOn}) no row is read or listed, and `MetadataContributionsEnabled`
39
+ * is false.
40
+ *
41
+ * Compiled `BaseFormPanel` registrations live in the browser bundle, so they are absent and
42
+ * the `Note` says so.
43
+ *
44
+ * Slots are reported from `GENERATED_FORM_CONTRIBUTION_SLOTS` rather than guessed: what CodeGen
45
+ * emits is fixed, so the set is known for every generated form without opening one. A
46
+ * hand-written custom form can emit a different set, and the `Note` says so.
47
+ */
48
+ let GetFormCompositionForEntityAction = class GetFormCompositionForEntityAction extends BaseAction {
49
+ /** Reads only with the caller's permissions. */
50
+ static { this.AuthorizesCaller = true; }
51
+ async InternalRunAction(params) {
52
+ try {
53
+ const entityName = GetStringParam(params, "EntityName");
54
+ if (!entityName)
55
+ return Failure("MISSING_PARAMETER", "Parameter 'EntityName' is required.");
56
+ const provider = params.Provider ?? Metadata.Provider;
57
+ if (!provider)
58
+ return Failure("NO_PROVIDER", "No metadata provider available.");
59
+ const user = params.ContextUser;
60
+ if (!user)
61
+ return Failure("NO_USER", "Action requires a ContextUser — contributions are user-scoped.");
62
+ const entity = provider.EntityByName(entityName);
63
+ if (!entity)
64
+ return Failure("ENTITY_NOT_FOUND", `Entity '${entityName}' is not registered.`);
65
+ const rv = RunView.FromMetadataProvider(provider);
66
+ const contributionsOn = await MetadataContributionsOn(provider, user);
67
+ const scope = ContributionScopeFilter(entity.ID, user);
68
+ const variantKey = FormVariantSettingKey(entity.Name);
69
+ const hideKey = FormPanelHideSettingKey(entity.Name);
70
+ const [rules, rows, overrides, settings] = await Promise.all([
71
+ rv.RunView({
72
+ EntityName: "MJ: Form Chrome Rules",
73
+ ExtraFilter: `EntityID='${EscapeSQLString(entity.ID)}'`,
74
+ Fields: ['ID'],
75
+ ResultType: 'simple',
76
+ }, user),
77
+ contributionsOn
78
+ ? rv.RunView({
79
+ EntityName: "MJ: Entity Form Contributions",
80
+ ExtraFilter: `${scope} AND Status='Active'`,
81
+ Fields: ['ID', 'ContributionKey', 'Scope', 'Slot', 'Title', 'Name', 'Presentation', 'Precedence', 'Inclusion', 'SortKey',
82
+ 'InSectionKey', 'SectionPosition', 'ReplacesFieldNames', 'ReplacesSectionKey', 'ReplacesSectionKeys',
83
+ 'RelatedEntityID', 'RelatedEntity', 'RelatedJoinField'],
84
+ OrderBy: 'Precedence DESC, SortKey DESC',
85
+ ResultType: 'simple',
86
+ }, user)
87
+ : Promise.resolve(noRows()),
88
+ rv.RunView({
89
+ EntityName: "MJ: Entity Form Overrides",
90
+ ExtraFilter: `${scope} AND Status<>'Pending'`,
91
+ Fields: ['ID', 'Status', 'Scope'],
92
+ ResultType: 'simple',
93
+ }, user),
94
+ rv.RunView({
95
+ EntityName: "MJ: User Settings",
96
+ ExtraFilter: `UserID='${EscapeSQLString(user.ID)}' AND Setting IN ('${EscapeSQLString(variantKey)}','${EscapeSQLString(hideKey)}')`,
97
+ Fields: ['Setting', 'Value'],
98
+ ResultType: 'simple',
99
+ }, user),
100
+ ]);
101
+ const failed = firstFailure([
102
+ ["MJ: Form Chrome Rules", rules], ["MJ: Entity Form Contributions", rows],
103
+ ["MJ: Entity Form Overrides", overrides], ["MJ: User Settings", settings],
104
+ ]);
105
+ if (failed)
106
+ return Failure("QUERY_FAILED", failed);
107
+ // Which form the CALLER sees, not merely whether a custom one exists. They can
108
+ // pick any form on offer, the generated one included, and that pick is a
109
+ // per-user setting — reading only the override rows answered for a form the
110
+ // user may have switched away from, and refused a panel on the form they were
111
+ // looking at.
112
+ const offered = (overrides.Results ?? []).filter(o => FormScopeAllowedOnEntity(entity.Name, o.Scope));
113
+ const fullCustomForm = this.rendersFullCustomForm(offered, settingValue(settings.Results ?? [], variantKey));
114
+ const hidden = new Set(ParseHiddenFormPanelKeys(settingValue(settings.Results ?? [], hideKey)));
115
+ const applicable = (rows.Results ?? []).filter(r => FormScopeAllowedOnEntity(entity.Name, r.Scope));
116
+ const payload = {
117
+ Entity: entity.Name,
118
+ Layout: this.readLayout(entity),
119
+ FullCustomForm: fullCustomForm,
120
+ MetadataContributionsEnabled: contributionsOn,
121
+ Sections: fullCustomForm ? [] : this.deriveSections(entity),
122
+ Related: fullCustomForm ? [] : this.deriveRelated(entity),
123
+ Contributions: fullCustomForm ? [] : contributionsUserSees(applicable, hidden),
124
+ SlotsPresent: fullCustomForm ? [] : [...GENERATED_FORM_CONTRIBUTION_SLOTS],
125
+ ChromeRuleCount: (rules.Results ?? []).length,
126
+ Note: fullCustomForm ? FULL_CUSTOM_FORM_NOTE : SERVER_DERIVATION_NOTE,
127
+ };
128
+ AddOutput(params, "Result", payload);
129
+ return { Success: true, ResultCode: "SUCCESS", Message: JSON.stringify(payload) };
130
+ }
131
+ catch (err) {
132
+ const message = err instanceof Error ? err.message : String(err);
133
+ LogError(`GetFormCompositionForEntityAction: ${message}`);
134
+ return Failure("UNEXPECTED_ERROR", message);
135
+ }
136
+ }
137
+ /**
138
+ * Whether a full custom form renders for this caller.
139
+ *
140
+ * Mirrors `FormResolverService.pickActive` in the browser, which is what actually
141
+ * decides. A stored pick wins when the user may pick it: an Active form, or their own
142
+ * form set aside by a later apply ({@link IsSelectableFormOverride}). The explicit-default sentinel
143
+ * means they asked for the generated form, so no custom form renders at all. With no
144
+ * pick, or a pick naming a form that has gone or cannot be picked, the auto-pick rule
145
+ * applies: the first Active override, if there is one.
146
+ */
147
+ rendersFullCustomForm(overrides, preference) {
148
+ const selected = (preference ?? '').trim();
149
+ if (selected === FORM_VARIANT_EXPLICIT_DEFAULT)
150
+ return false;
151
+ if (selected && overrides.some(o => IsSelectableFormOverride(o) && UUIDsEqual(o.ID, selected)))
152
+ return true;
153
+ return overrides.some(o => o.Status === 'Active');
154
+ }
155
+ readLayout(entity) {
156
+ const configured = entity
157
+ .ConfigurationObject?.UI?.Form?.Layout;
158
+ return configured === 'left-nav' ? 'left-nav' : 'accordion';
159
+ }
160
+ /**
161
+ * Field sections, by CodeGen's own rule: a field marked `Category` groups under its
162
+ * category title, everything else lands in Details, and primary-key / `__mj_` audit
163
+ * fields form System Metadata, which CodeGen always emits last.
164
+ */
165
+ deriveSections(entity) {
166
+ const fieldsByTitle = new Map();
167
+ const titleOrder = [];
168
+ const fileUnder = (title, field) => {
169
+ if (!fieldsByTitle.has(title)) {
170
+ fieldsByTitle.set(title, []);
171
+ titleOrder.push(title);
172
+ }
173
+ fieldsByTitle.get(title).push(field);
174
+ };
175
+ for (const f of entity.Fields) {
176
+ if (f.Name.startsWith('__mj_') || f.Name === 'ID')
177
+ continue;
178
+ const category = f.Category?.trim();
179
+ const type = f.GeneratedFormSectionType;
180
+ const field = { Name: f.Name, Label: f.DisplayNameOrName };
181
+ fileUnder(type === 'Category' && category ? category : 'Details', field);
182
+ }
183
+ const ordered = [
184
+ ...(fieldsByTitle.has('Details') ? ['Details'] : []),
185
+ ...titleOrder.filter(t => t !== 'Details'),
186
+ 'System Metadata',
187
+ ];
188
+ return ordered.map(title => ({
189
+ Key: FormSectionCamelCase(title),
190
+ Title: title,
191
+ Variant: 'default',
192
+ Group: null,
193
+ Hidden: false,
194
+ // Named so a contribution can stand in for one field rather than the whole
195
+ // section. Metadata-derived, so these are the entity's fields rather than the
196
+ // ones a form generated earlier actually draws — SERVER_DERIVATION_NOTE says so.
197
+ Fields: fieldsByTitle.get(title) ?? [],
198
+ }));
199
+ }
200
+ /**
201
+ * Related grids the form shows, in the order it shows them. IS-A children are excluded:
202
+ * they share the parent's key and render as part of the record, not as a grid beside it.
203
+ */
204
+ deriveRelated(entity) {
205
+ const isaChildIDs = (entity.ChildEntities ?? []).map(c => c.ID);
206
+ const visible = entity.RelatedEntities
207
+ .filter(r => r.DisplayInForm && !isaChildIDs.some(id => UUIDsEqual(id, r.RelatedEntityID)))
208
+ .sort((a, b) => (a.Sequence ?? 999999) - (b.Sequence ?? 999999) || a.RelatedEntity.localeCompare(b.RelatedEntity));
209
+ return visible.map(r => ({
210
+ Entity: r.RelatedEntity,
211
+ JoinField: StripJoinFieldBrackets(r.RelatedEntityJoinField),
212
+ SectionKey: this.relatedSectionKey(r, visible),
213
+ Inclusion: ReadRelationshipInclusion(r.Configuration) ?? 'Auto',
214
+ Source: 'baked',
215
+ }));
216
+ }
217
+ /**
218
+ * Two relationships to the same entity (Bill-To and Ship-To, say) would collide on a
219
+ * bare entity-name key, so those are disambiguated by join field — matching what the
220
+ * form itself does.
221
+ */
222
+ relatedSectionKey(rel, peers) {
223
+ const sharesRelatedEntity = peers.filter(p => UUIDsEqual(p.RelatedEntityID, rel.RelatedEntityID)).length > 1;
224
+ return RelatedGridSectionKey(rel.RelatedEntity, rel.RelatedEntityJoinField, sharesRelatedEntity);
225
+ }
226
+ };
227
+ GetFormCompositionForEntityAction = __decorate([
228
+ RegisterClass(BaseAction, "__GetFormCompositionForEntity")
229
+ ], GetFormCompositionForEntityAction);
230
+ export { GetFormCompositionForEntityAction };
231
+ /** An empty, successful result, which stands in for a query that is not run. */
232
+ function noRows() {
233
+ return { Success: true, Results: [], RowCount: 0, TotalRowCount: 0, ExecutionTime: 0, ErrorMessage: '' };
234
+ }
235
+ /** The message for the first failed query, or null when every query succeeded. */
236
+ function firstFailure(results) {
237
+ const failed = results.find(([, result]) => !result.Success);
238
+ if (!failed)
239
+ return null;
240
+ const [entityName, result] = failed;
241
+ return `Could not read the form's composition: the ${entityName} lookup failed (${result.ErrorMessage || 'unknown error'}).`;
242
+ }
243
+ /** The stored value of one setting. Keys are matched case-insensitively, as the database compares them. */
244
+ function settingValue(rows, key) {
245
+ return rows.find(r => (r.Setting ?? '').toLowerCase() === key.toLowerCase())?.Value ?? null;
246
+ }
247
+ /** The key a row is collapsed and hidden by, as the browser derives it; null for a row with none. */
248
+ function contributionRowKey(row) {
249
+ return ResolveContributionWriteKey({ contributionKey: row.ContributionKey ?? undefined, relatedJoinField: row.RelatedJoinField ?? undefined }, row.RelatedEntity ?? null);
250
+ }
251
+ /** One row per key, the one {@link FormContributionOutranks} picks; rows without a key never collapse. */
252
+ function collapseByKey(rows) {
253
+ const winners = new Map();
254
+ let unique = 0;
255
+ for (const row of rows) {
256
+ const key = contributionRowKey(row) ?? `__unique:${unique++}`;
257
+ const incumbent = winners.get(key);
258
+ if (!incumbent || FormContributionOutranks(row, incumbent))
259
+ winners.set(key, row);
260
+ }
261
+ return [...winners.values()];
262
+ }
263
+ /**
264
+ * The contributions on the form this user sees.
265
+ *
266
+ * A panel the user hid is out of the collapse, so a row it outranked can draw in its place, as
267
+ * in the browser. The user's own rows are never hidden. A hidden panel whose key nothing else
268
+ * draws is still listed, marked `Hidden`, because it holds that key.
269
+ */
270
+ function contributionsUserSees(rows, hiddenKeys) {
271
+ const isHidden = (row) => {
272
+ if (row.Scope === 'User')
273
+ return false;
274
+ const key = contributionRowKey(row);
275
+ return !!key && hiddenKeys.has(key);
276
+ };
277
+ const drawn = collapseByKey(rows.filter(r => !isHidden(r)));
278
+ const drawnKeys = new Set(drawn.map(contributionRowKey).filter((k) => !!k));
279
+ const hiddenOnly = collapseByKey(rows.filter(isHidden)).filter(r => !drawnKeys.has(contributionRowKey(r) ?? ''));
280
+ return [
281
+ ...drawn.map(r => contributionSummary(r, r.Inclusion === 'None')),
282
+ ...hiddenOnly.map(r => contributionSummary(r, true)),
283
+ ];
284
+ }
285
+ function contributionSummary(r, hidden) {
286
+ return {
287
+ Key: contributionRowKey(r) ?? `contribution:${r.ID}`,
288
+ Slot: r.Slot,
289
+ Source: 'metadata',
290
+ Title: r.Title ?? r.Name ?? r.ID,
291
+ Presentation: r.Presentation,
292
+ Hidden: hidden,
293
+ Precedence: r.Precedence ?? 0,
294
+ SortKey: r.SortKey ?? 0,
295
+ InSectionKey: r.InSectionKey ?? undefined,
296
+ SectionPosition: r.SectionPosition ?? undefined,
297
+ FieldNames: ParseClaimedFieldNames(r.ReplacesFieldNames),
298
+ SectionKeys: replacedSectionKeyList(r),
299
+ ReplacesPlace: !!(r.ReplacesSectionKey || r.ReplacesSectionKeys || r.RelatedEntityID),
300
+ };
301
+ }
302
+ /** The blocks a row stands in for: the list when set, else the single key. */
303
+ function replacedSectionKeyList(row) {
304
+ const listed = ParseClaimedFieldNames(row.ReplacesSectionKeys);
305
+ if (listed.length > 0)
306
+ return listed;
307
+ const single = (row.ReplacesSectionKey ?? '').trim();
308
+ return single ? [single] : [];
309
+ }
310
+ export function LoadGetFormCompositionForEntityAction() {
311
+ if (false) {
312
+ const _ = GetFormCompositionForEntityAction;
313
+ }
314
+ }
315
+ //# sourceMappingURL=get-form-composition-for-entity.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-form-composition-for-entity.action.js","sourceRoot":"","sources":["../../../src/custom/interactive-forms/get-form-composition-for-entity.action.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,yBAAyB,EAAoE,MAAM,sBAAsB,CAAC;AAChK,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EACH,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,GAE3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACjH,OAAO,EACH,6BAA6B,EAC7B,oBAAoB,EACpB,qBAAqB,EACrB,iCAAiC,EACjC,qBAAqB,EACrB,2BAA2B,EAC3B,sBAAsB,GACzB,MAAM,mDAAmD,CAAC;AAyB3D,MAAM,sBAAsB,GACxB,8FAA8F;IAC9F,gGAAgG;IAChG,8FAA8F;IAC9F,oBAAoB;IACpB,qGAAqG;IACrG,+FAA+F,CAAC;AAEpG,MAAM,qBAAqB,GACvB,gGAAgG;IAChG,8FAA8F;IAC9F,0FAA0F;IAC1F,+FAA+F;IAC/F,4FAA4F;IAC5F,oCAAoC,CAAC;AAEzC;;;;;;;;;;;;;;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rD,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAClC,CAAC;AAwBD,MAAM,UAAU,qCAAqC;IACjD,IAAI,KAAgB,EAAE,CAAC;QAAC,MAAM,CAAC,GAAY,iCAAiC,CAAC;IAAC,CAAC;AACnF,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
2
+ import { BaseAction } from "@memberjunction/actions";
3
+ /** One contribution row, flattened for an agent or an apply flow to reason about. */
4
+ export interface FormContributionSummary {
5
+ ContributionID: string;
6
+ ComponentID: string;
7
+ ComponentName: string | null;
8
+ ComponentVersion: string | null;
9
+ Name: string;
10
+ Scope: string;
11
+ Status: string;
12
+ Precedence: number;
13
+ Slot: string;
14
+ ContributionKey: string | null;
15
+ RelatedEntity: string | null;
16
+ RelatedJoinField: string | null;
17
+ ReplacesSectionKey: string | null;
18
+ /** The blocks it stands in for, when it replaces several. */
19
+ ReplacesSectionKeys: string[];
20
+ ReplacesFieldNames: string[];
21
+ /** The section it draws inside, replacing nothing. */
22
+ InSectionKey: string | null;
23
+ /** Where inside its section it draws. */
24
+ SectionPosition: 'start' | 'end' | null;
25
+ Inclusion: string | null;
26
+ Presentation: string;
27
+ Title: string | null;
28
+ }
29
+ /**
30
+ * Read-only: every `MJ: Entity Form Contributions` row that applies to (entity, caller),
31
+ * in every status, so an apply flow or agent can decide Create vs Modify and see what
32
+ * already exists. Companion of `Get Active Form For Entity`. On an identity or permission
33
+ * entity only the caller's own rows apply ({@link FormScopeAllowedOnEntity}), as on the form.
34
+ *
35
+ * Sorted Active first, then Pending, then Inactive; within a status, highest `Precedence`
36
+ * then highest `SortKey` — the order the renderer resolves them in.
37
+ *
38
+ * With metadata contributions switched off ({@link MetadataContributionsOn}) it lists none and
39
+ * reports `MetadataContributionsEnabled: false`.
40
+ */
41
+ export declare class GetFormContributionsForEntityAction extends BaseAction {
42
+ /** Reads only with the caller's permissions. */
43
+ static readonly AuthorizesCaller = true;
44
+ protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
45
+ /** Component name + version for each distinct ComponentID, in one query, or the query's error. */
46
+ private loadComponentLabels;
47
+ }
48
+ export declare function LoadGetFormContributionsForEntityAction(): void;
49
+ //# sourceMappingURL=get-form-contributions-for-entity.action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-form-contributions-for-entity.action.d.ts","sourceRoot":"","sources":["../../../src/custom/interactive-forms/get-form-contributions-for-entity.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAMrD,qFAAqF;AACrF,MAAM,WAAW,uBAAuB;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,6DAA6D;IAC7D,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,sDAAsD;IACtD,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,yCAAyC;IACzC,eAAe,EAAE,OAAO,GAAG,KAAK,GAAG,IAAI,CAAC;IACxC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED;;;;;;;;;;;GAWG;AACH,qBACa,mCAAoC,SAAQ,UAAU;IAC/D,gDAAgD;IAChD,gBAAuB,gBAAgB,QAAQ;cAE/B,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA6DvF,kGAAkG;YACpF,mBAAmB;CAmBpC;AAED,wBAAgB,uCAAuC,IAAI,IAAI,CAE9D"}
@@ -0,0 +1,117 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { BaseAction } from "@memberjunction/actions";
8
+ import { Metadata, LogError, RunView } from "@memberjunction/core";
9
+ import { EscapeSQLString, RegisterClass } from "@memberjunction/global";
10
+ import { FormScopeAllowedOnEntity, ParseClaimedFieldNames } from "@memberjunction/core-entities";
11
+ import { AddOutput, ContributionScopeFilter, Failure, GetStringParam, MetadataContributionsOn } from "./_shared.js";
12
+ /**
13
+ * Read-only: every `MJ: Entity Form Contributions` row that applies to (entity, caller),
14
+ * in every status, so an apply flow or agent can decide Create vs Modify and see what
15
+ * already exists. Companion of `Get Active Form For Entity`. On an identity or permission
16
+ * entity only the caller's own rows apply ({@link FormScopeAllowedOnEntity}), as on the form.
17
+ *
18
+ * Sorted Active first, then Pending, then Inactive; within a status, highest `Precedence`
19
+ * then highest `SortKey` — the order the renderer resolves them in.
20
+ *
21
+ * With metadata contributions switched off ({@link MetadataContributionsOn}) it lists none and
22
+ * reports `MetadataContributionsEnabled: false`.
23
+ */
24
+ let GetFormContributionsForEntityAction = class GetFormContributionsForEntityAction extends BaseAction {
25
+ /** Reads only with the caller's permissions. */
26
+ static { this.AuthorizesCaller = true; }
27
+ async InternalRunAction(params) {
28
+ try {
29
+ const entityName = GetStringParam(params, "EntityName");
30
+ if (!entityName)
31
+ return Failure("MISSING_PARAMETER", "Parameter 'EntityName' is required.");
32
+ const provider = params.Provider ?? Metadata.Provider;
33
+ if (!provider)
34
+ return Failure("NO_PROVIDER", "No metadata provider available.");
35
+ const user = params.ContextUser;
36
+ if (!user)
37
+ return Failure("NO_USER", "Action requires a ContextUser.");
38
+ const entity = provider.EntityByName(entityName);
39
+ if (!entity)
40
+ return Failure("ENTITY_NOT_FOUND", `Entity '${entityName}' is not registered.`);
41
+ if (!(await MetadataContributionsOn(provider, user))) {
42
+ const off = { EntityName: entity.Name, MetadataContributionsEnabled: false, Contributions: [] };
43
+ AddOutput(params, "Result", off);
44
+ return { Success: true, ResultCode: "SUCCESS", Message: JSON.stringify(off) };
45
+ }
46
+ const rv = RunView.FromMetadataProvider(provider);
47
+ const rows = await rv.RunView({
48
+ EntityName: "MJ: Entity Form Contributions",
49
+ ExtraFilter: ContributionScopeFilter(entity.ID, user),
50
+ OrderBy: "Precedence DESC, SortKey DESC",
51
+ ResultType: 'entity_object',
52
+ }, user);
53
+ if (!rows.Success)
54
+ return Failure("QUERY_FAILED", rows.ErrorMessage ?? 'Contribution lookup failed.');
55
+ const applicable = (rows.Results ?? []).filter(r => FormScopeAllowedOnEntity(entity.Name, r.Scope));
56
+ const labels = await this.loadComponentLabels(rv, applicable, user);
57
+ if ('error' in labels)
58
+ return Failure("QUERY_FAILED", `Component lookup failed: ${labels.error}`);
59
+ const components = labels.labels;
60
+ const statusRank = (s) => (s === 'Active' ? 0 : s === 'Pending' ? 1 : 2);
61
+ const summaries = applicable
62
+ .slice()
63
+ .sort((a, b) => statusRank(a.Status) - statusRank(b.Status) || (b.Precedence ?? 0) - (a.Precedence ?? 0))
64
+ .map(r => {
65
+ const component = components.get(r.ComponentID.toLowerCase());
66
+ return {
67
+ ContributionID: r.ID, ComponentID: r.ComponentID,
68
+ ComponentName: component?.Name ?? null,
69
+ ComponentVersion: component?.Version ?? null,
70
+ Name: r.Name, Scope: r.Scope, Status: r.Status, Precedence: r.Precedence ?? 0, Slot: r.Slot,
71
+ ContributionKey: r.ContributionKey, RelatedEntity: r.RelatedEntity,
72
+ RelatedJoinField: r.RelatedJoinField, ReplacesSectionKey: r.ReplacesSectionKey,
73
+ ReplacesSectionKeys: ParseClaimedFieldNames(r.ReplacesSectionKeys),
74
+ ReplacesFieldNames: ParseClaimedFieldNames(r.ReplacesFieldNames),
75
+ InSectionKey: r.InSectionKey ?? null, SectionPosition: r.SectionPosition ?? null,
76
+ Inclusion: r.Inclusion, Presentation: r.Presentation, Title: r.Title,
77
+ };
78
+ });
79
+ const payload = { EntityName: entity.Name, MetadataContributionsEnabled: true, Contributions: summaries };
80
+ AddOutput(params, "Result", payload);
81
+ return { Success: true, ResultCode: "SUCCESS", Message: JSON.stringify(payload) };
82
+ }
83
+ catch (err) {
84
+ const message = err instanceof Error ? err.message : String(err);
85
+ LogError(`GetFormContributionsForEntityAction: ${message}`);
86
+ return Failure("UNEXPECTED_ERROR", message);
87
+ }
88
+ }
89
+ /** Component name + version for each distinct ComponentID, in one query, or the query's error. */
90
+ async loadComponentLabels(rv, rows, user) {
91
+ const components = new Map();
92
+ const componentIDs = [...new Set(rows.map(r => r.ComponentID))];
93
+ if (componentIDs.length === 0)
94
+ return { labels: components };
95
+ const comps = await rv.RunView({
96
+ EntityName: "MJ: Components",
97
+ ExtraFilter: `ID IN (${componentIDs.map(id => `'${EscapeSQLString(id)}'`).join(',')})`,
98
+ Fields: ['ID', 'Name', 'Version'], ResultType: 'simple',
99
+ }, user);
100
+ if (!comps.Success)
101
+ return { error: comps.ErrorMessage || 'unknown error' };
102
+ for (const c of comps.Results ?? []) {
103
+ components.set(c.ID.toLowerCase(), { Name: c.Name, Version: c.Version });
104
+ }
105
+ return { labels: components };
106
+ }
107
+ };
108
+ GetFormContributionsForEntityAction = __decorate([
109
+ RegisterClass(BaseAction, "__GetFormContributionsForEntity")
110
+ ], GetFormContributionsForEntityAction);
111
+ export { GetFormContributionsForEntityAction };
112
+ export function LoadGetFormContributionsForEntityAction() {
113
+ if (false) {
114
+ const _ = GetFormContributionsForEntityAction;
115
+ }
116
+ }
117
+ //# sourceMappingURL=get-form-contributions-for-entity.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-form-contributions-for-entity.action.js","sourceRoot":"","sources":["../../../src/custom/interactive-forms/get-form-contributions-for-entity.action.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAuC,MAAM,+BAA+B,CAAC;AACtI,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AA6BjH;;;;;;;;;;;GAWG;AAEI,IAAM,mCAAmC,GAAzC,MAAM,mCAAoC,SAAQ,UAAU;IAC/D,gDAAgD;aACzB,qBAAgB,GAAG,IAAI,AAAP,CAAQ;IAErC,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACrD,IAAI,CAAC;YACD,MAAM,UAAU,GAAG,cAAc,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;YACxD,IAAI,CAAC,UAAU;gBAAE,OAAO,OAAO,CAAC,mBAAmB,EAAE,qCAAqC,CAAC,CAAC;YAC5F,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,QAAQ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E,UAAU,EAAE,CAAC;IAClC,CAAC;;AApFQ,mCAAmC;IAD/C,aAAa,CAAC,UAAU,EAAE,iCAAiC,CAAC;GAChD,mCAAmC,CAqF/C;;AAED,MAAM,UAAU,uCAAuC;IACnD,IAAI,KAAgB,EAAE,CAAC;QAAC,MAAM,CAAC,GAAY,mCAAmC,CAAC;IAAC,CAAC;AACrF,CAAC"}
@@ -5,4 +5,9 @@ export * from './create-interactive-form.action.js';
5
5
  export * from './modify-interactive-form.action.js';
6
6
  export * from './activate-interactive-form-version.action.js';
7
7
  export * from './revert-interactive-form.action.js';
8
+ export * from './create-form-contribution.action.js';
9
+ export * from './modify-form-contribution.action.js';
10
+ export * from './activate-form-contribution-version.action.js';
11
+ export * from './get-form-contributions-for-entity.action.js';
12
+ export * from './get-form-composition-for-entity.action.js';
8
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/custom/interactive-forms/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AACpD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/custom/interactive-forms/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AACpD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,0CAA0C,CAAC"}
@@ -5,4 +5,9 @@ export * from './create-interactive-form.action.js';
5
5
  export * from './modify-interactive-form.action.js';
6
6
  export * from './activate-interactive-form-version.action.js';
7
7
  export * from './revert-interactive-form.action.js';
8
+ export * from './create-form-contribution.action.js';
9
+ export * from './modify-form-contribution.action.js';
10
+ export * from './activate-form-contribution-version.action.js';
11
+ export * from './get-form-contributions-for-entity.action.js';
12
+ export * from './get-form-composition-for-entity.action.js';
8
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/custom/interactive-forms/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AACpD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/custom/interactive-forms/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AACpD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,0CAA0C,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
2
+ import { BaseAction } from "@memberjunction/actions";
3
+ /**
4
+ * Modify one of the caller's own form contributions.
5
+ *
6
+ * | Source Status | `VersionBumpKind` | Behavior |
7
+ * |---|---|---|
8
+ * | Pending | `in-place` (default) | Overwrite the source Component's spec; refresh the row's registration fields; append Notes |
9
+ * | Pending | `patch`/`minor`/`major` | Supersede source row + component; insert new Pending component + row |
10
+ * | Active | `in-place` | `INVALID_BUMP_FOR_STATUS` |
11
+ * | Active | bump (default `minor`) | New Pending component + row; the live Active row is untouched |
12
+ * | Inactive | `in-place` | `INVALID_BUMP_FOR_STATUS` |
13
+ * | Inactive | bump (default `patch`) | Branch from the historical version: new Pending component + row |
14
+ *
15
+ * Only the caller's own User-scope rows can be modified; a Role or Global row, or another user's
16
+ * row, returns `FORBIDDEN` (shared panels are managed from the form's Manage drawer or Form
17
+ * Builder). A new row is written User-scope, as `Create` writes it. The row's registration fields
18
+ * are refreshed from the spec's `formContribution` block, so a moved slot or a renamed title lands
19
+ * together with the code that assumes it. An optional `Precedence` replaces the row's precedence.
20
+ *
21
+ * The spec's claim is checked (`INVALID_CLAIM`) before anything is written, and the component and
22
+ * row writes run in one entity transaction, so a refused row save leaves the component unchanged.
23
+ */
24
+ export declare class ModifyFormContributionAction extends BaseAction {
25
+ /** Changes only the caller's own User-scope forms and panels, with the caller's permissions. */
26
+ static readonly AuthorizesCaller = true;
27
+ protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
28
+ private extractInputs;
29
+ /** Overwrite the Pending source's component and refresh its registration fields. */
30
+ private modifyInPlace;
31
+ /** Insert a new Pending component + User-scope row, superseding the source only when it was Pending. */
32
+ private createNextVersion;
33
+ /** Mark the source row and its component Inactive; a refused save fails the whole modification. */
34
+ private supersede;
35
+ private success;
36
+ }
37
+ export declare function LoadModifyFormContributionAction(): void;
38
+ //# sourceMappingURL=modify-form-contribution.action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modify-form-contribution.action.d.ts","sourceRoot":"","sources":["../../../src/custom/interactive-forms/modify-form-contribution.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AA0DrD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBACa,4BAA6B,SAAQ,UAAU;IACxD,gGAAgG;IAChG,gBAAuB,gBAAgB,QAAQ;cAE/B,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA2CvF,OAAO,CAAC,aAAa;IAmBrB,oFAAoF;YACtE,aAAa;IAuB3B,wGAAwG;YAC1F,iBAAiB;IA8B/B,mGAAmG;YACrF,SAAS;IAiBvB,OAAO,CAAC,OAAO;CAOlB;AAED,wBAAgB,gCAAgC,IAAI,IAAI,CAEvD"}