@memberjunction/core-actions 6.2.0-edge.1 → 6.2.0-edge.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom/ai/base-find-agents.action.d.ts.map +1 -1
- package/dist/custom/ai/base-find-agents.action.js +2 -7
- package/dist/custom/ai/base-find-agents.action.js.map +1 -1
- package/dist/custom/ai/execute-agent.action.d.ts +10 -0
- package/dist/custom/ai/execute-agent.action.d.ts.map +1 -1
- package/dist/custom/ai/execute-agent.action.js +24 -1
- package/dist/custom/ai/execute-agent.action.js.map +1 -1
- package/dist/custom/ai/execute-ai-prompt.action.d.ts.map +1 -1
- package/dist/custom/ai/execute-ai-prompt.action.js +3 -0
- package/dist/custom/ai/execute-ai-prompt.action.js.map +1 -1
- package/dist/custom/ai/find-candidate-agents.action.d.ts.map +1 -1
- package/dist/custom/ai/find-candidate-agents.action.js +2 -1
- package/dist/custom/ai/find-candidate-agents.action.js.map +1 -1
- package/dist/custom/ai/generate-image.action.d.ts +67 -6
- package/dist/custom/ai/generate-image.action.d.ts.map +1 -1
- package/dist/custom/ai/generate-image.action.js +208 -141
- package/dist/custom/ai/generate-image.action.js.map +1 -1
- package/dist/custom/ai/run-decision.action.d.ts +45 -0
- package/dist/custom/ai/run-decision.action.d.ts.map +1 -0
- package/dist/custom/ai/run-decision.action.js +169 -0
- package/dist/custom/ai/run-decision.action.js.map +1 -0
- package/dist/custom/ai/summarize-content.action.d.ts.map +1 -1
- package/dist/custom/ai/summarize-content.action.js +3 -0
- package/dist/custom/ai/summarize-content.action.js.map +1 -1
- package/dist/custom/data/run-adhoc-query.action.d.ts.map +1 -1
- package/dist/custom/data/run-adhoc-query.action.js +3 -0
- package/dist/custom/data/run-adhoc-query.action.js.map +1 -1
- package/dist/custom/interactive-forms/_shared.d.ts +113 -31
- package/dist/custom/interactive-forms/_shared.d.ts.map +1 -1
- package/dist/custom/interactive-forms/_shared.js +198 -74
- package/dist/custom/interactive-forms/_shared.js.map +1 -1
- package/dist/custom/interactive-forms/activate-form-contribution-version.action.d.ts +23 -0
- package/dist/custom/interactive-forms/activate-form-contribution-version.action.d.ts.map +1 -0
- package/dist/custom/interactive-forms/activate-form-contribution-version.action.js +151 -0
- package/dist/custom/interactive-forms/activate-form-contribution-version.action.js.map +1 -0
- package/dist/custom/interactive-forms/activate-interactive-form-version.action.d.ts +23 -7
- package/dist/custom/interactive-forms/activate-interactive-form-version.action.d.ts.map +1 -1
- package/dist/custom/interactive-forms/activate-interactive-form-version.action.js +114 -58
- package/dist/custom/interactive-forms/activate-interactive-form-version.action.js.map +1 -1
- package/dist/custom/interactive-forms/create-form-contribution.action.d.ts +35 -0
- package/dist/custom/interactive-forms/create-form-contribution.action.d.ts.map +1 -0
- package/dist/custom/interactive-forms/create-form-contribution.action.js +149 -0
- package/dist/custom/interactive-forms/create-form-contribution.action.js.map +1 -0
- package/dist/custom/interactive-forms/get-active-form-for-entity.action.d.ts +3 -0
- package/dist/custom/interactive-forms/get-active-form-for-entity.action.d.ts.map +1 -1
- package/dist/custom/interactive-forms/get-active-form-for-entity.action.js +5 -1
- package/dist/custom/interactive-forms/get-active-form-for-entity.action.js.map +1 -1
- package/dist/custom/interactive-forms/get-form-composition-for-entity.action.d.ts +59 -0
- package/dist/custom/interactive-forms/get-form-composition-for-entity.action.d.ts.map +1 -0
- package/dist/custom/interactive-forms/get-form-composition-for-entity.action.js +313 -0
- package/dist/custom/interactive-forms/get-form-composition-for-entity.action.js.map +1 -0
- package/dist/custom/interactive-forms/get-form-contributions-for-entity.action.d.ts +47 -0
- package/dist/custom/interactive-forms/get-form-contributions-for-entity.action.d.ts.map +1 -0
- package/dist/custom/interactive-forms/get-form-contributions-for-entity.action.js +115 -0
- package/dist/custom/interactive-forms/get-form-contributions-for-entity.action.js.map +1 -0
- package/dist/custom/interactive-forms/index.d.ts +5 -0
- package/dist/custom/interactive-forms/index.d.ts.map +1 -1
- package/dist/custom/interactive-forms/index.js +5 -0
- package/dist/custom/interactive-forms/index.js.map +1 -1
- package/dist/custom/interactive-forms/modify-form-contribution.action.d.ts +36 -0
- package/dist/custom/interactive-forms/modify-form-contribution.action.d.ts.map +1 -0
- package/dist/custom/interactive-forms/modify-form-contribution.action.js +181 -0
- package/dist/custom/interactive-forms/modify-form-contribution.action.js.map +1 -0
- package/dist/custom/interactive-forms/modify-interactive-form.action.d.ts +13 -11
- package/dist/custom/interactive-forms/modify-interactive-form.action.d.ts.map +1 -1
- package/dist/custom/interactive-forms/modify-interactive-form.action.js +65 -64
- package/dist/custom/interactive-forms/modify-interactive-form.action.js.map +1 -1
- package/dist/custom/interactive-forms/revert-interactive-form.action.d.ts +12 -0
- package/dist/custom/interactive-forms/revert-interactive-form.action.d.ts.map +1 -1
- package/dist/custom/interactive-forms/revert-interactive-form.action.js +29 -4
- package/dist/custom/interactive-forms/revert-interactive-form.action.js.map +1 -1
- package/dist/custom/record-cloning/clone-record.action.d.ts +15 -0
- package/dist/custom/record-cloning/clone-record.action.d.ts.map +1 -0
- package/dist/custom/record-cloning/clone-record.action.js +125 -0
- package/dist/custom/record-cloning/clone-record.action.js.map +1 -0
- package/dist/custom/record-cloning/clone-records.action.d.ts +15 -0
- package/dist/custom/record-cloning/clone-records.action.d.ts.map +1 -0
- package/dist/custom/record-cloning/clone-records.action.js +175 -0
- package/dist/custom/record-cloning/clone-records.action.js.map +1 -0
- package/dist/custom/utilities/vectorize-entity.action.js +1 -1
- package/dist/custom/utilities/vectorize-entity.action.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +42 -40
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
26
|
+
private extractInputs;
|
|
27
|
+
/** Overwrite the Pending source's component and refresh its registration fields. */
|
|
28
|
+
private modifyInPlace;
|
|
29
|
+
/** Insert a new Pending component + User-scope row, superseding the source only when it was Pending. */
|
|
30
|
+
private createNextVersion;
|
|
31
|
+
/** Mark the source row and its component Inactive; a refused save fails the whole modification. */
|
|
32
|
+
private supersede;
|
|
33
|
+
private success;
|
|
34
|
+
}
|
|
35
|
+
export declare function LoadModifyFormContributionAction(): void;
|
|
36
|
+
//# 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;cAExC,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"}
|
|
@@ -0,0 +1,181 @@
|
|
|
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 } from "@memberjunction/core";
|
|
9
|
+
import { RegisterClass } from "@memberjunction/global";
|
|
10
|
+
import { ApplyContributionSpecToRow } from "@memberjunction/core-entities";
|
|
11
|
+
import { AddOutput, BumpVersion, CheckPersonalWrite, Failure, GetPrecedenceParam, GetStringParam, InsertComponent, InsertContribution, LintFormPanelSpec, LoadComponent, LoadContribution, MapToComponentStatus, ParseSpecParam, ParseVersionBumpKind, ResolveContributionRegistration, WriteAtomically, } from "./_shared.js";
|
|
12
|
+
/**
|
|
13
|
+
* Modify one of the caller's own form contributions.
|
|
14
|
+
*
|
|
15
|
+
* | Source Status | `VersionBumpKind` | Behavior |
|
|
16
|
+
* |---|---|---|
|
|
17
|
+
* | Pending | `in-place` (default) | Overwrite the source Component's spec; refresh the row's registration fields; append Notes |
|
|
18
|
+
* | Pending | `patch`/`minor`/`major` | Supersede source row + component; insert new Pending component + row |
|
|
19
|
+
* | Active | `in-place` | `INVALID_BUMP_FOR_STATUS` |
|
|
20
|
+
* | Active | bump (default `minor`) | New Pending component + row; the live Active row is untouched |
|
|
21
|
+
* | Inactive | `in-place` | `INVALID_BUMP_FOR_STATUS` |
|
|
22
|
+
* | Inactive | bump (default `patch`) | Branch from the historical version: new Pending component + row |
|
|
23
|
+
*
|
|
24
|
+
* Only the caller's own User-scope rows can be modified; a Role or Global row, or another user's
|
|
25
|
+
* row, returns `FORBIDDEN` (shared panels are managed from the form's Manage drawer or Form
|
|
26
|
+
* Builder). A new row is written User-scope, as `Create` writes it. The row's registration fields
|
|
27
|
+
* are refreshed from the spec's `formContribution` block, so a moved slot or a renamed title lands
|
|
28
|
+
* together with the code that assumes it. An optional `Precedence` replaces the row's precedence.
|
|
29
|
+
*
|
|
30
|
+
* The spec's claim is checked (`INVALID_CLAIM`) before anything is written, and the component and
|
|
31
|
+
* row writes run in one entity transaction, so a refused row save leaves the component unchanged.
|
|
32
|
+
*/
|
|
33
|
+
let ModifyFormContributionAction = class ModifyFormContributionAction extends BaseAction {
|
|
34
|
+
async InternalRunAction(params) {
|
|
35
|
+
try {
|
|
36
|
+
const inputs = this.extractInputs(params);
|
|
37
|
+
if ('error' in inputs)
|
|
38
|
+
return inputs.error;
|
|
39
|
+
const provider = params.Provider ?? Metadata.Provider;
|
|
40
|
+
if (!provider)
|
|
41
|
+
return Failure("NO_PROVIDER", "No metadata provider available.");
|
|
42
|
+
const user = params.ContextUser;
|
|
43
|
+
if (!user)
|
|
44
|
+
return Failure("NO_USER", "Action requires a ContextUser.");
|
|
45
|
+
const source = await LoadContribution(provider, user, inputs.ContributionID);
|
|
46
|
+
if (!source)
|
|
47
|
+
return Failure("CONTRIBUTION_NOT_FOUND", `Contribution '${inputs.ContributionID}' not found.`);
|
|
48
|
+
const forbidden = CheckPersonalWrite(source, user);
|
|
49
|
+
if (forbidden)
|
|
50
|
+
return forbidden;
|
|
51
|
+
const lintFail = await LintFormPanelSpec(inputs.Spec, user);
|
|
52
|
+
if (lintFail)
|
|
53
|
+
return lintFail;
|
|
54
|
+
const registration = ResolveContributionRegistration(provider, inputs.Spec, source.ContributionKey);
|
|
55
|
+
if ('error' in registration)
|
|
56
|
+
return registration.error;
|
|
57
|
+
const sourceComponent = await LoadComponent(provider, user, source.ComponentID);
|
|
58
|
+
if (!sourceComponent) {
|
|
59
|
+
return Failure("COMPONENT_NOT_FOUND", `Contribution ${source.ID} points at Component ${source.ComponentID} which no longer exists.`);
|
|
60
|
+
}
|
|
61
|
+
const bump = inputs.Bump
|
|
62
|
+
?? (source.Status === 'Pending' ? 'in-place' : source.Status === 'Active' ? 'minor' : 'patch');
|
|
63
|
+
if (bump === 'in-place' && source.Status !== 'Pending') {
|
|
64
|
+
return Failure("INVALID_BUMP_FOR_STATUS", `In-place modification is only valid for a Pending contribution; ${source.ID} is ${source.Status}. Supply VersionBumpKind patch | minor | major.`);
|
|
65
|
+
}
|
|
66
|
+
const ctx = { source, sourceComponent, registration, inputs, provider, user };
|
|
67
|
+
const written = await WriteAtomically(provider, () => bump === 'in-place' ? this.modifyInPlace(ctx) : this.createNextVersion(ctx, bump));
|
|
68
|
+
if ('error' in written)
|
|
69
|
+
return written.error;
|
|
70
|
+
return this.success(params, written);
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
74
|
+
LogError(`ModifyFormContributionAction: ${message}`);
|
|
75
|
+
return Failure("UNEXPECTED_ERROR", message);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
extractInputs(params) {
|
|
79
|
+
const contributionID = GetStringParam(params, "ContributionID");
|
|
80
|
+
if (!contributionID)
|
|
81
|
+
return { error: Failure("MISSING_PARAMETER", "Parameter 'ContributionID' is required.") };
|
|
82
|
+
const specRaw = params.Params.find(x => x.Name?.trim().toLowerCase() === "spec")?.Value;
|
|
83
|
+
if (specRaw == null)
|
|
84
|
+
return { error: Failure("MISSING_PARAMETER", "Parameter 'Spec' is required.") };
|
|
85
|
+
const parsed = ParseSpecParam(specRaw);
|
|
86
|
+
if ('error' in parsed)
|
|
87
|
+
return { error: Failure("LINT_FAILED", `Spec is not valid JSON: ${parsed.error}`) };
|
|
88
|
+
const bumpRaw = GetStringParam(params, "VersionBumpKind");
|
|
89
|
+
const bump = bumpRaw ? ParseVersionBumpKind(bumpRaw) : null;
|
|
90
|
+
if (bumpRaw && !bump) {
|
|
91
|
+
return { error: Failure("INVALID_PARAMETER", `VersionBumpKind '${bumpRaw}' is not one of in-place | patch | minor | major.`) };
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
ContributionID: contributionID, Spec: parsed, Notes: GetStringParam(params, "Notes"),
|
|
95
|
+
Bump: bump, Precedence: GetPrecedenceParam(params),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/** Overwrite the Pending source's component and refresh its registration fields. */
|
|
99
|
+
async modifyInPlace(ctx) {
|
|
100
|
+
const { source, sourceComponent, registration, inputs } = ctx;
|
|
101
|
+
const spec = inputs.Spec;
|
|
102
|
+
sourceComponent.Specification = JSON.stringify(spec);
|
|
103
|
+
sourceComponent.Title = spec.title ?? sourceComponent.Title;
|
|
104
|
+
sourceComponent.Description = spec.description ?? sourceComponent.Description;
|
|
105
|
+
if (!(await sourceComponent.Save())) {
|
|
106
|
+
return { error: Failure("PERSIST_FAILED", `Component update failed: ${sourceComponent.LatestResult?.CompleteMessage ?? 'unknown error'}`) };
|
|
107
|
+
}
|
|
108
|
+
ApplyContributionSpecToRow(source, registration.Contribution, registration.RowOptions);
|
|
109
|
+
if (inputs.Precedence != null)
|
|
110
|
+
source.Precedence = inputs.Precedence;
|
|
111
|
+
if (inputs.Notes)
|
|
112
|
+
source.Notes = `${source.Notes ? source.Notes + "\n" : ""}${inputs.Notes}`;
|
|
113
|
+
if (!(await source.Save())) {
|
|
114
|
+
return { error: Failure("PERSIST_FAILED", `Contribution update failed: ${source.LatestResult?.CompleteMessage ?? 'unknown error'}`) };
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
ContributionID: source.ID, ComponentID: source.ComponentID,
|
|
118
|
+
Version: sourceComponent.Version ?? '1.0.0', Mode: 'in-place', BumpKind: 'in-place',
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/** Insert a new Pending component + User-scope row, superseding the source only when it was Pending. */
|
|
122
|
+
async createNextVersion(ctx, bump) {
|
|
123
|
+
const { source, sourceComponent, registration, inputs, provider, user } = ctx;
|
|
124
|
+
const spec = inputs.Spec;
|
|
125
|
+
const nextVersion = BumpVersion(sourceComponent.Version, bump);
|
|
126
|
+
const componentInsert = await InsertComponent({
|
|
127
|
+
provider, user, spec, fallbackName: sourceComponent.Name,
|
|
128
|
+
description: spec.description ?? sourceComponent.Description,
|
|
129
|
+
version: nextVersion, versionSequence: (sourceComponent.VersionSequence ?? 0) + 1,
|
|
130
|
+
componentStatus: 'Pending', componentType: 'Widget',
|
|
131
|
+
});
|
|
132
|
+
if ('error' in componentInsert)
|
|
133
|
+
return componentInsert;
|
|
134
|
+
const rowInsert = await InsertContribution({
|
|
135
|
+
provider, user, entityID: source.EntityID, componentID: componentInsert.id,
|
|
136
|
+
name: source.Name, description: spec.description ?? source.Description, notes: inputs.Notes,
|
|
137
|
+
registration, status: 'Pending', precedence: inputs.Precedence ?? source.Precedence ?? 0,
|
|
138
|
+
});
|
|
139
|
+
if ('error' in rowInsert)
|
|
140
|
+
return rowInsert;
|
|
141
|
+
if (source.Status === 'Pending') {
|
|
142
|
+
// Bumping from a Pending draft supersedes it — there is nothing live to preserve.
|
|
143
|
+
const superseded = await this.supersede(source, sourceComponent);
|
|
144
|
+
if (superseded)
|
|
145
|
+
return superseded;
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
ContributionID: rowInsert.id, ComponentID: componentInsert.id,
|
|
149
|
+
Version: nextVersion, Mode: 'new-version', BumpKind: bump,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/** Mark the source row and its component Inactive; a refused save fails the whole modification. */
|
|
153
|
+
async supersede(source, sourceComponent) {
|
|
154
|
+
source.Status = 'Inactive';
|
|
155
|
+
if (!(await source.Save())) {
|
|
156
|
+
return { error: Failure("PERSIST_FAILED", `Could not supersede contribution ${source.ID}: ${source.LatestResult?.CompleteMessage ?? 'unknown error'}`) };
|
|
157
|
+
}
|
|
158
|
+
sourceComponent.Status = MapToComponentStatus('Inactive');
|
|
159
|
+
if (!(await sourceComponent.Save())) {
|
|
160
|
+
return { error: Failure("PERSIST_FAILED", `Could not supersede component ${sourceComponent.ID}: ${sourceComponent.LatestResult?.CompleteMessage ?? 'unknown error'}`) };
|
|
161
|
+
}
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
success(params, payload) {
|
|
165
|
+
AddOutput(params, "ContributionID", payload.ContributionID);
|
|
166
|
+
AddOutput(params, "ComponentID", payload.ComponentID);
|
|
167
|
+
AddOutput(params, "Version", payload.Version);
|
|
168
|
+
AddOutput(params, "Mode", payload.Mode);
|
|
169
|
+
return { Success: true, ResultCode: "SUCCESS", Message: JSON.stringify(payload) };
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
ModifyFormContributionAction = __decorate([
|
|
173
|
+
RegisterClass(BaseAction, "__ModifyFormContribution")
|
|
174
|
+
], ModifyFormContributionAction);
|
|
175
|
+
export { ModifyFormContributionAction };
|
|
176
|
+
export function LoadModifyFormContributionAction() {
|
|
177
|
+
if (false) {
|
|
178
|
+
const _ = ModifyFormContributionAction;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=modify-form-contribution.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modify-form-contribution.action.js","sourceRoot":"","sources":["../../../src/custom/interactive-forms/modify-form-contribution.action.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAA+D,MAAM,+BAA+B,CAAC;AAExI,OAAO,EACH,SAAS,EACT,WAAW,EACX,kBAAkB,EAClB,OAAO,EACP,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,oBAAoB,EACpB,+BAA+B,EAC/B,eAAe,GAGlB,MAAM,WAAW,CAAC;AAkCnB;;;;;;;;;;;;;;;;;;;;GAoBG;AAEI,IAAM,4BAA4B,GAAlC,MAAM,4BAA6B,SAAQ,UAAU;IAE9C,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACrD,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAC1C,IAAI,OAAO,IAAI,MAAM;gBAAE,OAAO,MAAM,CAAC,KAAK,CAAC;YAC3C,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC;YACtD,IAAI,CAAC,QAAQ;gBAAE,OAAO,OAAO,CAAC,aAAa,EAAE,iCAAiC,CAAC,CAAC;YAChF,MAAM,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC;YACh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AE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;IACtF,CAAC;CACJ,CAAA;AAhJY,4BAA4B;IADxC,aAAa,CAAC,UAAU,EAAE,0BAA0B,CAAC;GACzC,4BAA4B,CAgJxC;;AAED,MAAM,UAAU,gCAAgC;IAC5C,IAAI,KAAgB,EAAE,CAAC;QAAC,MAAM,CAAC,GAAY,4BAA4B,CAAC;IAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -20,18 +20,15 @@ import { BaseAction } from "@memberjunction/actions";
|
|
|
20
20
|
* Pending sources stay in-place, Active sources bump minor, Inactive
|
|
21
21
|
* sources bump patch (the conservative branch-from-historical case).
|
|
22
22
|
*
|
|
23
|
-
* **
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* → Global) is a separate, deliberate human action with its own permission
|
|
29
|
-
* gate in Component Studio / Form Builder. The agent cannot widen scope
|
|
30
|
-
* through Modify any more than through Create.
|
|
23
|
+
* **Ownership.** Only the caller's own User-scope overrides can be modified.
|
|
24
|
+
* A Role or Global override, or another user's, returns FORBIDDEN for every
|
|
25
|
+
* caller (see `CheckPersonalWrite` in `_shared.ts`): shared forms are managed
|
|
26
|
+
* from Form Builder or the form's Manage drawer. A new Pending Override is
|
|
27
|
+
* written User-scope, as Create writes it.
|
|
31
28
|
*
|
|
32
|
-
* **
|
|
33
|
-
*
|
|
34
|
-
*
|
|
29
|
+
* **Atomicity.** The in-place Component and Override writes run in one entity
|
|
30
|
+
* transaction, and so do the new-version Component and Override inserts, so a
|
|
31
|
+
* refused Override save leaves no Component change behind.
|
|
35
32
|
*
|
|
36
33
|
* Inputs:
|
|
37
34
|
* - `OverrideID` (required, string) — the override to modify
|
|
@@ -47,6 +44,11 @@ import { BaseAction } from "@memberjunction/actions";
|
|
|
47
44
|
*/
|
|
48
45
|
export declare class ModifyInteractiveFormAction extends BaseAction {
|
|
49
46
|
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
47
|
+
/**
|
|
48
|
+
* Overwrite the Pending Component's spec and append any notes to the Override. Returns an
|
|
49
|
+
* `{ error }` result on a refused save, so the caller's transaction rolls both back.
|
|
50
|
+
*/
|
|
51
|
+
private modifyInPlace;
|
|
50
52
|
private findParam;
|
|
51
53
|
}
|
|
52
54
|
/** Tree-shaking guard. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modify-interactive-form.action.d.ts","sourceRoot":"","sources":["../../../src/custom/interactive-forms/modify-interactive-form.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"modify-interactive-form.action.d.ts","sourceRoot":"","sources":["../../../src/custom/interactive-forms/modify-interactive-form.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAYrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,qBACa,2BAA4B,SAAQ,UAAU;cAEvC,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAkNvF;;;OAGG;YACW,aAAa;IAuB3B,OAAO,CAAC,SAAS;CAKpB;AAED,0BAA0B;AAC1B,wBAAgB,+BAA+B,IAAI,IAAI,CAItD"}
|
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { BaseAction } from "@memberjunction/actions";
|
|
8
8
|
import { Metadata, LogError } from "@memberjunction/core";
|
|
9
9
|
import { RegisterClass } from "@memberjunction/global";
|
|
10
|
-
import { AddOutput, BumpVersion,
|
|
10
|
+
import { AddOutput, BumpVersion, CheckPersonalWrite, Failure, GetStringParam, InsertComponent, InsertOverride, LintFormSpec, LoadComponent, LoadOverride, MapToComponentStatus, ParseSpecParam, ParseVersionBumpKind, WriteAtomically, } from "./_shared.js";
|
|
11
11
|
/**
|
|
12
12
|
* Modify an existing interactive-form override.
|
|
13
13
|
*
|
|
@@ -28,18 +28,15 @@ import { AddOutput, BumpVersion, CheckOverrideOwnership, Failure, GetStringParam
|
|
|
28
28
|
* Pending sources stay in-place, Active sources bump minor, Inactive
|
|
29
29
|
* sources bump patch (the conservative branch-from-historical case).
|
|
30
30
|
*
|
|
31
|
-
* **
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* → Global) is a separate, deliberate human action with its own permission
|
|
37
|
-
* gate in Component Studio / Form Builder. The agent cannot widen scope
|
|
38
|
-
* through Modify any more than through Create.
|
|
31
|
+
* **Ownership.** Only the caller's own User-scope overrides can be modified.
|
|
32
|
+
* A Role or Global override, or another user's, returns FORBIDDEN for every
|
|
33
|
+
* caller (see `CheckPersonalWrite` in `_shared.ts`): shared forms are managed
|
|
34
|
+
* from Form Builder or the form's Manage drawer. A new Pending Override is
|
|
35
|
+
* written User-scope, as Create writes it.
|
|
39
36
|
*
|
|
40
|
-
* **
|
|
41
|
-
*
|
|
42
|
-
*
|
|
37
|
+
* **Atomicity.** The in-place Component and Override writes run in one entity
|
|
38
|
+
* transaction, and so do the new-version Component and Override inserts, so a
|
|
39
|
+
* refused Override save leaves no Component change behind.
|
|
43
40
|
*
|
|
44
41
|
* Inputs:
|
|
45
42
|
* - `OverrideID` (required, string) — the override to modify
|
|
@@ -80,8 +77,7 @@ let ModifyInteractiveFormAction = class ModifyInteractiveFormAction extends Base
|
|
|
80
77
|
if (!override) {
|
|
81
78
|
return Failure("OVERRIDE_NOT_FOUND", `EntityFormOverride '${overrideID}' not found.`);
|
|
82
79
|
}
|
|
83
|
-
|
|
84
|
-
const ownershipFail = CheckOverrideOwnership(override, user);
|
|
80
|
+
const ownershipFail = CheckPersonalWrite(override, user);
|
|
85
81
|
if (ownershipFail)
|
|
86
82
|
return ownershipFail;
|
|
87
83
|
const existingComponent = await LoadComponent(provider, user, override.ComponentID);
|
|
@@ -150,26 +146,9 @@ let ModifyInteractiveFormAction = class ModifyInteractiveFormAction extends Base
|
|
|
150
146
|
return Failure("INVALID_BUMP_FOR_STATUS", `'in-place' is only valid against a Pending Override (got Status='${overrideStatus}'). Use 'patch', 'minor', or 'major' to snapshot a new Pending version from this source; use 'Revert Interactive Form' to re-activate an Inactive historical version.`);
|
|
151
147
|
}
|
|
152
148
|
if (bumpKind === 'in-place') {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if (spec.title)
|
|
157
|
-
existingComponent.Title = spec.title;
|
|
158
|
-
if (spec.description)
|
|
159
|
-
existingComponent.Description = spec.description;
|
|
160
|
-
const saved = await existingComponent.Save();
|
|
161
|
-
if (!saved) {
|
|
162
|
-
return Failure("PERSIST_FAILED", `Component in-place update failed: ${existingComponent.LatestResult?.CompleteMessage ?? 'unknown error'}`);
|
|
163
|
-
}
|
|
164
|
-
if (notes) {
|
|
165
|
-
// Append a line of human-readable notes. The Notes column
|
|
166
|
-
// accepts NVARCHAR(MAX), so this scales.
|
|
167
|
-
const existingNotes = override.Notes ?? '';
|
|
168
|
-
override.Notes = existingNotes
|
|
169
|
-
? `${existingNotes}\n${notes}`
|
|
170
|
-
: notes;
|
|
171
|
-
await override.Save();
|
|
172
|
-
}
|
|
149
|
+
const written = await WriteAtomically(provider, () => this.modifyInPlace(existingComponent, override, spec, notes));
|
|
150
|
+
if ('error' in written)
|
|
151
|
+
return written.error;
|
|
173
152
|
AddOutput(params, "ComponentID", existingComponent.ID);
|
|
174
153
|
AddOutput(params, "OverrideID", override.ID);
|
|
175
154
|
AddOutput(params, "Mode", "in-place");
|
|
@@ -192,35 +171,35 @@ let ModifyInteractiveFormAction = class ModifyInteractiveFormAction extends Base
|
|
|
192
171
|
// historical — no demote needed since source is already Inactive,
|
|
193
172
|
// and the user explicitly opened it to fork from there).
|
|
194
173
|
const newVersion = BumpVersion(existingComponent.Version, bumpKind);
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
174
|
+
const inserted = await WriteAtomically(provider, async () => {
|
|
175
|
+
const componentInsert = await InsertComponent({
|
|
176
|
+
provider, user, spec,
|
|
177
|
+
fallbackName: existingComponent.Name,
|
|
178
|
+
description: existingComponent.Description,
|
|
179
|
+
version: newVersion,
|
|
180
|
+
versionSequence: (existingComponent.VersionSequence ?? 0) + 1,
|
|
181
|
+
componentStatus: 'Pending',
|
|
182
|
+
});
|
|
183
|
+
if ('error' in componentInsert)
|
|
184
|
+
return componentInsert;
|
|
185
|
+
// InsertOverride writes the new Pending Override User-scoped to the caller.
|
|
186
|
+
const overrideInsert = await InsertOverride({
|
|
187
|
+
provider, user,
|
|
188
|
+
entityID: override.EntityID,
|
|
189
|
+
componentID: componentInsert.id,
|
|
190
|
+
name: override.Name,
|
|
191
|
+
description: override.Description,
|
|
192
|
+
notes,
|
|
193
|
+
status: 'Pending',
|
|
194
|
+
priority: override.Priority,
|
|
195
|
+
});
|
|
196
|
+
if ('error' in overrideInsert)
|
|
197
|
+
return overrideInsert;
|
|
198
|
+
return { componentID: componentInsert.id, overrideID: overrideInsert.id };
|
|
203
199
|
});
|
|
204
|
-
if ('error' in
|
|
205
|
-
return
|
|
206
|
-
const newComponentID =
|
|
207
|
-
// New Pending Override at the same scope as the existing one. We
|
|
208
|
-
// do not widen scope: if existing is User-scoped, new is too. If
|
|
209
|
-
// somehow existing is Role/Global (manual promotion), we still
|
|
210
|
-
// honor that — Modify is a content change, not a scope change.
|
|
211
|
-
const overrideInsert = await InsertOverride({
|
|
212
|
-
provider, user,
|
|
213
|
-
entityID: override.EntityID,
|
|
214
|
-
componentID: newComponentID,
|
|
215
|
-
name: override.Name,
|
|
216
|
-
description: override.Description,
|
|
217
|
-
notes,
|
|
218
|
-
status: 'Pending',
|
|
219
|
-
priority: override.Priority,
|
|
220
|
-
});
|
|
221
|
-
if ('error' in overrideInsert) {
|
|
222
|
-
return Failure("PERSIST_FAILED", `${overrideInsert.error.Message} (Component ${newComponentID} was persisted; its sibling override row failed to write.)`);
|
|
223
|
-
}
|
|
200
|
+
if ('error' in inserted)
|
|
201
|
+
return inserted.error;
|
|
202
|
+
const newComponentID = inserted.componentID;
|
|
224
203
|
// Demote the prior Pending source — both the Component row and
|
|
225
204
|
// its Override row — to Inactive. This preserves the rollback
|
|
226
205
|
// history (the row stays in the version rail and can be
|
|
@@ -257,7 +236,7 @@ let ModifyInteractiveFormAction = class ModifyInteractiveFormAction extends Base
|
|
|
257
236
|
}
|
|
258
237
|
}
|
|
259
238
|
AddOutput(params, "ComponentID", newComponentID);
|
|
260
|
-
AddOutput(params, "OverrideID",
|
|
239
|
+
AddOutput(params, "OverrideID", inserted.overrideID);
|
|
261
240
|
AddOutput(params, "Mode", "new-version");
|
|
262
241
|
AddOutput(params, "Version", newVersion);
|
|
263
242
|
return {
|
|
@@ -265,7 +244,7 @@ let ModifyInteractiveFormAction = class ModifyInteractiveFormAction extends Base
|
|
|
265
244
|
Message: JSON.stringify({
|
|
266
245
|
Mode: 'new-version',
|
|
267
246
|
ComponentID: newComponentID,
|
|
268
|
-
OverrideID:
|
|
247
|
+
OverrideID: inserted.overrideID,
|
|
269
248
|
Version: newVersion,
|
|
270
249
|
BumpKind: bumpKind,
|
|
271
250
|
PreviousComponentID: existingComponent.ID,
|
|
@@ -282,6 +261,28 @@ let ModifyInteractiveFormAction = class ModifyInteractiveFormAction extends Base
|
|
|
282
261
|
return Failure("UNEXPECTED_ERROR", message);
|
|
283
262
|
}
|
|
284
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* Overwrite the Pending Component's spec and append any notes to the Override. Returns an
|
|
266
|
+
* `{ error }` result on a refused save, so the caller's transaction rolls both back.
|
|
267
|
+
*/
|
|
268
|
+
async modifyInPlace(component, override, spec, notes) {
|
|
269
|
+
component.Specification = JSON.stringify(spec);
|
|
270
|
+
// Refresh Title/Description if the new spec moves them.
|
|
271
|
+
if (spec.title)
|
|
272
|
+
component.Title = spec.title;
|
|
273
|
+
if (spec.description)
|
|
274
|
+
component.Description = spec.description;
|
|
275
|
+
if (!(await component.Save())) {
|
|
276
|
+
return { error: Failure("PERSIST_FAILED", `Component in-place update failed: ${component.LatestResult?.CompleteMessage ?? 'unknown error'}`) };
|
|
277
|
+
}
|
|
278
|
+
if (!notes)
|
|
279
|
+
return { ok: true };
|
|
280
|
+
override.Notes = override.Notes ? `${override.Notes}\n${notes}` : notes;
|
|
281
|
+
if (!(await override.Save())) {
|
|
282
|
+
return { error: Failure("PERSIST_FAILED", `Override notes update failed: ${override.LatestResult?.CompleteMessage ?? 'unknown error'}`) };
|
|
283
|
+
}
|
|
284
|
+
return { ok: true };
|
|
285
|
+
}
|
|
285
286
|
findParam(params, name) {
|
|
286
287
|
const p = params.Params.find(x => x.Name?.trim().toLowerCase() === name.toLowerCase());
|
|
287
288
|
return p?.Value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modify-interactive-form.action.js","sourceRoot":"","sources":["../../../src/custom/interactive-forms/modify-interactive-form.action.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"modify-interactive-form.action.js","sourceRoot":"","sources":["../../../src/custom/interactive-forms/modify-interactive-form.action.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAA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AE,yBAAyB,CAAC;GACxC,2BAA2B,CAoPvC;;AAED,0BAA0B;AAC1B,MAAM,UAAU,+BAA+B;IAC3C,IAAI,KAAgB,EAAE,CAAC;QACnB,MAAM,CAAC,GAAY,2BAA2B,CAAC;IACnD,CAAC;AACL,CAAC"}
|
|
@@ -15,9 +15,21 @@ import { BaseAction } from "@memberjunction/actions";
|
|
|
15
15
|
* - Flip the previously-pointed Component to Status='Inactive', target
|
|
16
16
|
* Component to Status='Active'.
|
|
17
17
|
*
|
|
18
|
+
* The override is saved first. Both Component status saves are then tried, even
|
|
19
|
+
* when the first fails. If either fails, or the target Component cannot be loaded
|
|
20
|
+
* for its status save, the action returns `PERSIST_FAILED` that names every
|
|
21
|
+
* Component whose status was not updated; the override stays re-pointed. The
|
|
22
|
+
* override then already points at the target, so a retry with the same target
|
|
23
|
+
* returns SUCCESS from the no-op path and the Component statuses stay as they are.
|
|
24
|
+
*
|
|
18
25
|
* Old Component rows are never deleted — they remain as immutable history.
|
|
19
26
|
* A subsequent revert can move forward again to any version.
|
|
20
27
|
*
|
|
28
|
+
* Only the caller's own User-scope overrides can be reverted. A Role or Global
|
|
29
|
+
* override, or another user's, returns FORBIDDEN for every caller (see
|
|
30
|
+
* `CheckPersonalWrite` in `_shared.ts`): shared forms are managed from Form
|
|
31
|
+
* Builder or the form's Manage drawer.
|
|
32
|
+
*
|
|
21
33
|
* Inputs:
|
|
22
34
|
* - `ActiveOverrideID` (required, string) — the Active override to re-point
|
|
23
35
|
* - One of:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revert-interactive-form.action.d.ts","sourceRoot":"","sources":["../../../src/custom/interactive-forms/revert-interactive-form.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAOrD
|
|
1
|
+
{"version":3,"file":"revert-interactive-form.action.d.ts","sourceRoot":"","sources":["../../../src/custom/interactive-forms/revert-interactive-form.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAOrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,qBACa,2BAA4B,SAAQ,UAAU;cAEvC,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA2H1F;AAED,0BAA0B;AAC1B,wBAAgB,+BAA+B,IAAI,IAAI,CAItD"}
|
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { BaseAction } from "@memberjunction/actions";
|
|
8
8
|
import { Metadata, LogError, RunView } from "@memberjunction/core";
|
|
9
9
|
import { RegisterClass, UUIDsEqual } from "@memberjunction/global";
|
|
10
|
-
import { AddOutput,
|
|
10
|
+
import { AddOutput, CheckPersonalWrite, Failure, GetNumberParam, GetStringParam, LoadComponent, LoadOverride, MapToComponentStatus, } from "./_shared.js";
|
|
11
11
|
/**
|
|
12
12
|
* Revert the user's Active override to an older Component version. Pure
|
|
13
13
|
* re-point: no new Component is created, no new Override row is created.
|
|
@@ -23,9 +23,21 @@ import { AddOutput, CheckOverrideOwnership, Failure, GetNumberParam, GetStringPa
|
|
|
23
23
|
* - Flip the previously-pointed Component to Status='Inactive', target
|
|
24
24
|
* Component to Status='Active'.
|
|
25
25
|
*
|
|
26
|
+
* The override is saved first. Both Component status saves are then tried, even
|
|
27
|
+
* when the first fails. If either fails, or the target Component cannot be loaded
|
|
28
|
+
* for its status save, the action returns `PERSIST_FAILED` that names every
|
|
29
|
+
* Component whose status was not updated; the override stays re-pointed. The
|
|
30
|
+
* override then already points at the target, so a retry with the same target
|
|
31
|
+
* returns SUCCESS from the no-op path and the Component statuses stay as they are.
|
|
32
|
+
*
|
|
26
33
|
* Old Component rows are never deleted — they remain as immutable history.
|
|
27
34
|
* A subsequent revert can move forward again to any version.
|
|
28
35
|
*
|
|
36
|
+
* Only the caller's own User-scope overrides can be reverted. A Role or Global
|
|
37
|
+
* override, or another user's, returns FORBIDDEN for every caller (see
|
|
38
|
+
* `CheckPersonalWrite` in `_shared.ts`): shared forms are managed from Form
|
|
39
|
+
* Builder or the form's Manage drawer.
|
|
40
|
+
*
|
|
29
41
|
* Inputs:
|
|
30
42
|
* - `ActiveOverrideID` (required, string) — the Active override to re-point
|
|
31
43
|
* - One of:
|
|
@@ -61,7 +73,7 @@ let RevertInteractiveFormAction = class RevertInteractiveFormAction extends Base
|
|
|
61
73
|
if (!override) {
|
|
62
74
|
return Failure("OVERRIDE_NOT_FOUND", `EntityFormOverride '${activeOverrideID}' not found.`);
|
|
63
75
|
}
|
|
64
|
-
const ownershipFail =
|
|
76
|
+
const ownershipFail = CheckPersonalWrite(override, user);
|
|
65
77
|
if (ownershipFail)
|
|
66
78
|
return ownershipFail;
|
|
67
79
|
if (override.Status !== 'Active') {
|
|
@@ -116,13 +128,26 @@ let RevertInteractiveFormAction = class RevertInteractiveFormAction extends Base
|
|
|
116
128
|
return Failure("PERSIST_FAILED", `Could not re-point Override: ${override.LatestResult?.CompleteMessage ?? 'unknown error'}`);
|
|
117
129
|
}
|
|
118
130
|
// Flip Component statuses to reflect the new active selection.
|
|
131
|
+
const notUpdated = [];
|
|
119
132
|
const newActive = await LoadComponent(provider, user, target.ID);
|
|
120
133
|
if (newActive) {
|
|
121
134
|
newActive.Status = MapToComponentStatus('Active');
|
|
122
|
-
await newActive.Save()
|
|
135
|
+
if (!(await newActive.Save())) {
|
|
136
|
+
notUpdated.push(`the status of Component ${target.ID} was not updated ` +
|
|
137
|
+
`(${newActive.LatestResult?.CompleteMessage ?? 'unknown error'})`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
notUpdated.push(`Component ${target.ID} could not be loaded, so its status was not updated`);
|
|
123
142
|
}
|
|
124
143
|
currentComponent.Status = MapToComponentStatus('Inactive');
|
|
125
|
-
await currentComponent.Save()
|
|
144
|
+
if (!(await currentComponent.Save())) {
|
|
145
|
+
notUpdated.push(`the status of Component ${currentComponent.ID} was not updated ` +
|
|
146
|
+
`(${currentComponent.LatestResult?.CompleteMessage ?? 'unknown error'})`);
|
|
147
|
+
}
|
|
148
|
+
if (notUpdated.length > 0) {
|
|
149
|
+
return Failure("PERSIST_FAILED", `Override ${override.ID} was re-pointed to Component ${target.ID}, but ${notUpdated.join('; ')}.`);
|
|
150
|
+
}
|
|
126
151
|
AddOutput(params, "OverrideID", override.ID);
|
|
127
152
|
AddOutput(params, "ComponentID", target.ID);
|
|
128
153
|
AddOutput(params, "PreviousComponentID", currentComponent.ID);
|