@memberjunction/core-actions 6.2.0-edge.0 → 6.2.0-edge.1
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/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +16 -4
- package/dist/config.js.map +1 -1
- package/dist/custom/ai/base-find-actions.action.js +6 -6
- package/dist/custom/ai/base-find-agents.action.js +6 -6
- package/dist/custom/ai/find-candidate-agents.action.js +2 -2
- package/dist/custom/ai/semantic-entity-search.helper.d.ts +6 -0
- package/dist/custom/ai/semantic-entity-search.helper.d.ts.map +1 -1
- package/dist/custom/ai/semantic-entity-search.helper.js +16 -4
- package/dist/custom/ai/semantic-entity-search.helper.js.map +1 -1
- package/dist/custom/data/search-query-catalog.action.js +2 -2
- package/dist/custom/integration/api-rate-limiter.action.d.ts +4 -0
- package/dist/custom/integration/api-rate-limiter.action.d.ts.map +1 -1
- package/dist/custom/integration/api-rate-limiter.action.js +10 -2
- package/dist/custom/integration/api-rate-limiter.action.js.map +1 -1
- package/dist/custom/integration/gamma-generate-presentation.action.js +2 -2
- package/dist/custom/integration/integration-action-executor.d.ts +22 -22
- package/dist/custom/integration/integration-action-executor.js +83 -83
- package/dist/custom/interactive-forms/_shared.d.ts +69 -0
- package/dist/custom/interactive-forms/_shared.d.ts.map +1 -1
- package/dist/custom/interactive-forms/_shared.js +118 -38
- package/dist/custom/interactive-forms/_shared.js.map +1 -1
- package/dist/custom/interactive-forms/activate-interactive-form-version.action.js +25 -25
- package/dist/custom/interactive-forms/create-interactive-form.action.js +22 -22
- package/dist/custom/interactive-forms/modify-interactive-form.action.js +35 -35
- package/dist/custom/interactive-forms/revert-interactive-form.action.js +32 -32
- package/dist/custom/lists/_action-helpers.d.ts +10 -0
- package/dist/custom/lists/_action-helpers.d.ts.map +1 -1
- package/dist/custom/lists/_action-helpers.js +26 -6
- package/dist/custom/lists/_action-helpers.js.map +1 -1
- package/dist/custom/lists/add-view-results-to-list.action.js +8 -8
- package/dist/custom/lists/bulk-update-list-item-status.action.js +8 -8
- package/dist/custom/lists/compose-lists.action.js +14 -14
- package/dist/custom/lists/invite-to-list.action.js +10 -10
- package/dist/custom/lists/materialize-list-from-view.action.js +13 -13
- package/dist/custom/lists/move-list-members.action.js +12 -12
- package/dist/custom/lists/refresh-list-from-source.action.js +8 -8
- package/dist/custom/lists/resolve-audience.action.js +7 -7
- package/dist/custom/lists/revoke-list-invitation.action.js +3 -3
- package/dist/custom/lists/share-list.action.js +8 -8
- package/dist/custom/lists/unshare-list.action.js +3 -3
- package/dist/custom/utilities/address-services.action.js +2 -2
- package/dist/custom/utilities/artifact-builder-service.d.ts +16 -16
- package/dist/custom/utilities/artifact-builder-service.js +39 -39
- package/dist/custom/utilities/artifact-builder-service.js.map +1 -1
- package/dist/custom/utilities/docx-renderer.d.ts +17 -11
- package/dist/custom/utilities/docx-renderer.d.ts.map +1 -1
- package/dist/custom/utilities/docx-renderer.js +60 -48
- package/dist/custom/utilities/docx-renderer.js.map +1 -1
- package/dist/custom/utilities/json-param-helper.d.ts +6 -0
- package/dist/custom/utilities/json-param-helper.d.ts.map +1 -1
- package/dist/custom/utilities/json-param-helper.js +16 -4
- package/dist/custom/utilities/json-param-helper.js.map +1 -1
- package/dist/custom/utilities/pdf-renderer.d.ts +13 -7
- package/dist/custom/utilities/pdf-renderer.d.ts.map +1 -1
- package/dist/custom/utilities/pdf-renderer.js +27 -15
- package/dist/custom/utilities/pdf-renderer.js.map +1 -1
- package/dist/custom/utilities/xlsx-renderer.d.ts +19 -11
- package/dist/custom/utilities/xlsx-renderer.d.ts.map +1 -1
- package/dist/custom/utilities/xlsx-renderer.js +55 -39
- package/dist/custom/utilities/xlsx-renderer.js.map +1 -1
- package/dist/custom/visualization/create-svg-chart.action.js +23 -23
- package/dist/custom/visualization/create-svg-diagram.action.js +10 -10
- package/dist/custom/visualization/create-svg-infographic.action.js +4 -4
- package/dist/custom/visualization/create-svg-network.action.js +12 -12
- package/dist/custom/visualization/create-svg-sketch-diagram.action.js +10 -10
- package/dist/custom/visualization/create-svg-word-cloud.action.js +11 -11
- package/dist/custom/visualization/shared/svg-theming.d.ts +17 -0
- package/dist/custom/visualization/shared/svg-theming.d.ts.map +1 -1
- package/dist/custom/visualization/shared/svg-theming.js +34 -10
- package/dist/custom/visualization/shared/svg-theming.js.map +1 -1
- package/dist/custom/visualization/shared/svg-utils.d.ts +39 -0
- package/dist/custom/visualization/shared/svg-utils.d.ts.map +1 -1
- package/dist/custom/visualization/shared/svg-utils.js +81 -17
- package/dist/custom/visualization/shared/svg-utils.js.map +1 -1
- package/dist/custom/web/duckduckgo-rate-limiter.d.ts +17 -1
- package/dist/custom/web/duckduckgo-rate-limiter.d.ts.map +1 -1
- package/dist/custom/web/duckduckgo-rate-limiter.js +26 -6
- package/dist/custom/web/duckduckgo-rate-limiter.js.map +1 -1
- package/dist/custom/web/google-custom-search.action.js +2 -2
- package/dist/custom/web/rss-feed-parsing.d.ts +19 -0
- package/dist/custom/web/rss-feed-parsing.d.ts.map +1 -1
- package/dist/custom/web/rss-feed-parsing.js +45 -13
- package/dist/custom/web/rss-feed-parsing.js.map +1 -1
- package/dist/custom/web/rss-feed-read.action.js +5 -5
- package/dist/custom/web/tavily-search.action.js +2 -2
- package/package.json +40 -40
|
@@ -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 {
|
|
10
|
+
import { AddOutput, BumpVersion, CheckOverrideOwnership, Failure, GetStringParam, InsertComponent, InsertOverride, LintFormSpec, LoadComponent, LoadOverride, MapToComponentStatus, ParseSpecParam, ParseVersionBumpKind, } from "./_shared.js";
|
|
11
11
|
/**
|
|
12
12
|
* Modify an existing interactive-form override.
|
|
13
13
|
*
|
|
@@ -56,37 +56,37 @@ import { addOutput, bumpVersion, checkOverrideOwnership, failure, getStringParam
|
|
|
56
56
|
let ModifyInteractiveFormAction = class ModifyInteractiveFormAction extends BaseAction {
|
|
57
57
|
async InternalRunAction(params) {
|
|
58
58
|
try {
|
|
59
|
-
const overrideID =
|
|
59
|
+
const overrideID = GetStringParam(params, "OverrideID");
|
|
60
60
|
if (!overrideID) {
|
|
61
|
-
return
|
|
61
|
+
return Failure("MISSING_PARAMETER", "Parameter 'OverrideID' is required.");
|
|
62
62
|
}
|
|
63
63
|
const specRaw = this.findParam(params, "Spec");
|
|
64
64
|
if (specRaw == null) {
|
|
65
|
-
return
|
|
65
|
+
return Failure("MISSING_PARAMETER", "Parameter 'Spec' is required.");
|
|
66
66
|
}
|
|
67
|
-
const parsed =
|
|
67
|
+
const parsed = ParseSpecParam(specRaw);
|
|
68
68
|
if ('error' in parsed) {
|
|
69
|
-
return
|
|
69
|
+
return Failure("LINT_FAILED", `Spec is not valid JSON: ${parsed.error}`);
|
|
70
70
|
}
|
|
71
71
|
const spec = parsed;
|
|
72
|
-
const notes =
|
|
72
|
+
const notes = GetStringParam(params, "Notes");
|
|
73
73
|
const provider = params.Provider ?? Metadata.Provider;
|
|
74
74
|
if (!provider)
|
|
75
|
-
return
|
|
75
|
+
return Failure("NO_PROVIDER", "No metadata provider available.");
|
|
76
76
|
const user = params.ContextUser;
|
|
77
77
|
if (!user)
|
|
78
|
-
return
|
|
79
|
-
const override = await
|
|
78
|
+
return Failure("NO_USER", "Action requires a ContextUser.");
|
|
79
|
+
const override = await LoadOverride(provider, user, overrideID);
|
|
80
80
|
if (!override) {
|
|
81
|
-
return
|
|
81
|
+
return Failure("OVERRIDE_NOT_FOUND", `EntityFormOverride '${overrideID}' not found.`);
|
|
82
82
|
}
|
|
83
83
|
// Defense-in-depth ownership check — see _shared.ts.
|
|
84
|
-
const ownershipFail =
|
|
84
|
+
const ownershipFail = CheckOverrideOwnership(override, user);
|
|
85
85
|
if (ownershipFail)
|
|
86
86
|
return ownershipFail;
|
|
87
|
-
const existingComponent = await
|
|
87
|
+
const existingComponent = await LoadComponent(provider, user, override.ComponentID);
|
|
88
88
|
if (!existingComponent) {
|
|
89
|
-
return
|
|
89
|
+
return Failure("COMPONENT_NOT_FOUND", `Override ${overrideID} points at Component ${override.ComponentID} which no longer exists.`);
|
|
90
90
|
}
|
|
91
91
|
// Lineage identity guard. Component lineage is collapsed by Name
|
|
92
92
|
// in the Form Builder version rail — different Name = different
|
|
@@ -101,7 +101,7 @@ let ModifyInteractiveFormAction = class ModifyInteractiveFormAction extends Base
|
|
|
101
101
|
// existing Component.Name and sanitize the function name to
|
|
102
102
|
// match, never the other way around.
|
|
103
103
|
if (spec.name && spec.name !== existingComponent.Name) {
|
|
104
|
-
return
|
|
104
|
+
return Failure("LINEAGE_NAME_MISMATCH", `Modify requires spec.name to match the existing Component name '${existingComponent.Name}', got '${spec.name}'. Modify operates on a Component lineage — its identity is the Name and cannot change between versions. Update spec.name and the function declaration in spec.code to '${existingComponent.Name}' and retry. (If the user wants a renamed form, that's a Create on the new entity or a manual rename in Form Builder, not a Modify.)`);
|
|
105
105
|
}
|
|
106
106
|
// Pin Name and Title to the existing row regardless — covers
|
|
107
107
|
// the case where the agent omitted spec.name entirely.
|
|
@@ -110,7 +110,7 @@ let ModifyInteractiveFormAction = class ModifyInteractiveFormAction extends Base
|
|
|
110
110
|
spec.title = existingComponent.Title;
|
|
111
111
|
// Lint AFTER the lineage guard so any name/title pinning is
|
|
112
112
|
// visible to the linter (function-name match, etc.).
|
|
113
|
-
const lintFail = await
|
|
113
|
+
const lintFail = await LintFormSpec(spec, user);
|
|
114
114
|
if (lintFail)
|
|
115
115
|
return lintFail;
|
|
116
116
|
// Resolve VersionBumpKind: explicit param wins; otherwise default
|
|
@@ -126,12 +126,12 @@ let ModifyInteractiveFormAction = class ModifyInteractiveFormAction extends Base
|
|
|
126
126
|
const sourceStatus = overrideStatus === 'Active' ? 'Active' :
|
|
127
127
|
overrideStatus === 'Pending' ? 'Pending' : 'Inactive';
|
|
128
128
|
const isPendingSource = sourceStatus === 'Pending';
|
|
129
|
-
const rawKind =
|
|
129
|
+
const rawKind = GetStringParam(params, "VersionBumpKind");
|
|
130
130
|
let bumpKind;
|
|
131
131
|
if (rawKind) {
|
|
132
|
-
const parsed =
|
|
132
|
+
const parsed = ParseVersionBumpKind(rawKind);
|
|
133
133
|
if (!parsed) {
|
|
134
|
-
return
|
|
134
|
+
return Failure("INVALID_BUMP_KIND", `Unknown VersionBumpKind '${rawKind}'. Expected one of: 'in-place', 'patch', 'minor', 'major'.`);
|
|
135
135
|
}
|
|
136
136
|
bumpKind = parsed;
|
|
137
137
|
}
|
|
@@ -147,7 +147,7 @@ let ModifyInteractiveFormAction = class ModifyInteractiveFormAction extends Base
|
|
|
147
147
|
// row achieves nothing — won't re-activate it; use Revert for
|
|
148
148
|
// that) we reject loudly so the caller corrects intent.
|
|
149
149
|
if (bumpKind === 'in-place' && !isPendingSource) {
|
|
150
|
-
return
|
|
150
|
+
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
151
|
}
|
|
152
152
|
if (bumpKind === 'in-place') {
|
|
153
153
|
// ── in-place modify of the Pending Component ─────────────
|
|
@@ -159,7 +159,7 @@ let ModifyInteractiveFormAction = class ModifyInteractiveFormAction extends Base
|
|
|
159
159
|
existingComponent.Description = spec.description;
|
|
160
160
|
const saved = await existingComponent.Save();
|
|
161
161
|
if (!saved) {
|
|
162
|
-
return
|
|
162
|
+
return Failure("PERSIST_FAILED", `Component in-place update failed: ${existingComponent.LatestResult?.CompleteMessage ?? 'unknown error'}`);
|
|
163
163
|
}
|
|
164
164
|
if (notes) {
|
|
165
165
|
// Append a line of human-readable notes. The Notes column
|
|
@@ -170,10 +170,10 @@ let ModifyInteractiveFormAction = class ModifyInteractiveFormAction extends Base
|
|
|
170
170
|
: notes;
|
|
171
171
|
await override.Save();
|
|
172
172
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
AddOutput(params, "ComponentID", existingComponent.ID);
|
|
174
|
+
AddOutput(params, "OverrideID", override.ID);
|
|
175
|
+
AddOutput(params, "Mode", "in-place");
|
|
176
|
+
AddOutput(params, "Version", existingComponent.Version);
|
|
177
177
|
return {
|
|
178
178
|
Success: true, ResultCode: "SUCCESS",
|
|
179
179
|
Message: JSON.stringify({
|
|
@@ -191,9 +191,9 @@ let ModifyInteractiveFormAction = class ModifyInteractiveFormAction extends Base
|
|
|
191
191
|
// two concurrent Pendings), and Inactive sources (branch-from-
|
|
192
192
|
// historical — no demote needed since source is already Inactive,
|
|
193
193
|
// and the user explicitly opened it to fork from there).
|
|
194
|
-
const newVersion =
|
|
194
|
+
const newVersion = BumpVersion(existingComponent.Version, bumpKind);
|
|
195
195
|
const newSequence = (existingComponent.VersionSequence ?? 0) + 1;
|
|
196
|
-
const componentInsert = await
|
|
196
|
+
const componentInsert = await InsertComponent({
|
|
197
197
|
provider, user, spec,
|
|
198
198
|
fallbackName: existingComponent.Name,
|
|
199
199
|
description: existingComponent.Description,
|
|
@@ -208,7 +208,7 @@ let ModifyInteractiveFormAction = class ModifyInteractiveFormAction extends Base
|
|
|
208
208
|
// do not widen scope: if existing is User-scoped, new is too. If
|
|
209
209
|
// somehow existing is Role/Global (manual promotion), we still
|
|
210
210
|
// honor that — Modify is a content change, not a scope change.
|
|
211
|
-
const overrideInsert = await
|
|
211
|
+
const overrideInsert = await InsertOverride({
|
|
212
212
|
provider, user,
|
|
213
213
|
entityID: override.EntityID,
|
|
214
214
|
componentID: newComponentID,
|
|
@@ -219,7 +219,7 @@ let ModifyInteractiveFormAction = class ModifyInteractiveFormAction extends Base
|
|
|
219
219
|
priority: override.Priority,
|
|
220
220
|
});
|
|
221
221
|
if ('error' in overrideInsert) {
|
|
222
|
-
return
|
|
222
|
+
return Failure("PERSIST_FAILED", `${overrideInsert.error.Message} (Component ${newComponentID} was persisted; its sibling override row failed to write.)`);
|
|
223
223
|
}
|
|
224
224
|
// Demote the prior Pending source — both the Component row and
|
|
225
225
|
// its Override row — to Inactive. This preserves the rollback
|
|
@@ -234,7 +234,7 @@ let ModifyInteractiveFormAction = class ModifyInteractiveFormAction extends Base
|
|
|
234
234
|
// Component table uses 'Draft'/'Published'/'Deprecated' —
|
|
235
235
|
// map our 'Inactive' lifecycle to the table's 'Deprecated'.
|
|
236
236
|
try {
|
|
237
|
-
existingComponent.Status =
|
|
237
|
+
existingComponent.Status = MapToComponentStatus('Inactive');
|
|
238
238
|
const ok = await existingComponent.Save();
|
|
239
239
|
if (ok)
|
|
240
240
|
demotedComponentID = existingComponent.ID;
|
|
@@ -256,10 +256,10 @@ let ModifyInteractiveFormAction = class ModifyInteractiveFormAction extends Base
|
|
|
256
256
|
LogError(`ModifyInteractiveFormAction: error demoting prior Pending Override ${override.ID}: ${err instanceof Error ? err.message : String(err)}`);
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
259
|
+
AddOutput(params, "ComponentID", newComponentID);
|
|
260
|
+
AddOutput(params, "OverrideID", overrideInsert.id);
|
|
261
|
+
AddOutput(params, "Mode", "new-version");
|
|
262
|
+
AddOutput(params, "Version", newVersion);
|
|
263
263
|
return {
|
|
264
264
|
Success: true, ResultCode: "SUCCESS",
|
|
265
265
|
Message: JSON.stringify({
|
|
@@ -279,7 +279,7 @@ let ModifyInteractiveFormAction = class ModifyInteractiveFormAction extends Base
|
|
|
279
279
|
catch (err) {
|
|
280
280
|
const message = err instanceof Error ? err.message : String(err);
|
|
281
281
|
LogError(`ModifyInteractiveFormAction: ${message}`);
|
|
282
|
-
return
|
|
282
|
+
return Failure("UNEXPECTED_ERROR", message);
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
findParam(params, name) {
|
|
@@ -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 {
|
|
10
|
+
import { AddOutput, CheckOverrideOwnership, 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.
|
|
@@ -42,45 +42,45 @@ import { addOutput, checkOverrideOwnership, failure, getNumberParam, getStringPa
|
|
|
42
42
|
let RevertInteractiveFormAction = class RevertInteractiveFormAction extends BaseAction {
|
|
43
43
|
async InternalRunAction(params) {
|
|
44
44
|
try {
|
|
45
|
-
const activeOverrideID =
|
|
45
|
+
const activeOverrideID = GetStringParam(params, "ActiveOverrideID");
|
|
46
46
|
if (!activeOverrideID) {
|
|
47
|
-
return
|
|
47
|
+
return Failure("MISSING_PARAMETER", "Parameter 'ActiveOverrideID' is required.");
|
|
48
48
|
}
|
|
49
|
-
const targetComponentID =
|
|
50
|
-
const targetVersionSequence =
|
|
49
|
+
const targetComponentID = GetStringParam(params, "TargetComponentID");
|
|
50
|
+
const targetVersionSequence = GetNumberParam(params, "TargetVersionSequence");
|
|
51
51
|
if (!targetComponentID && targetVersionSequence == null) {
|
|
52
|
-
return
|
|
52
|
+
return Failure("MISSING_PARAMETER", "Either 'TargetComponentID' or 'TargetVersionSequence' is required.");
|
|
53
53
|
}
|
|
54
54
|
const provider = params.Provider ?? Metadata.Provider;
|
|
55
55
|
if (!provider)
|
|
56
|
-
return
|
|
56
|
+
return Failure("NO_PROVIDER", "No metadata provider available.");
|
|
57
57
|
const user = params.ContextUser;
|
|
58
58
|
if (!user)
|
|
59
|
-
return
|
|
60
|
-
const override = await
|
|
59
|
+
return Failure("NO_USER", "Action requires a ContextUser.");
|
|
60
|
+
const override = await LoadOverride(provider, user, activeOverrideID);
|
|
61
61
|
if (!override) {
|
|
62
|
-
return
|
|
62
|
+
return Failure("OVERRIDE_NOT_FOUND", `EntityFormOverride '${activeOverrideID}' not found.`);
|
|
63
63
|
}
|
|
64
|
-
const ownershipFail =
|
|
64
|
+
const ownershipFail = CheckOverrideOwnership(override, user);
|
|
65
65
|
if (ownershipFail)
|
|
66
66
|
return ownershipFail;
|
|
67
67
|
if (override.Status !== 'Active') {
|
|
68
|
-
return
|
|
68
|
+
return Failure("NOT_ACTIVE", `Override ${activeOverrideID} is not Active (current Status=${override.Status}). Reverting only operates on the Active override row.`);
|
|
69
69
|
}
|
|
70
|
-
const currentComponent = await
|
|
70
|
+
const currentComponent = await LoadComponent(provider, user, override.ComponentID);
|
|
71
71
|
if (!currentComponent) {
|
|
72
|
-
return
|
|
72
|
+
return Failure("COMPONENT_NOT_FOUND", `Active override points at Component ${override.ComponentID} which no longer exists.`);
|
|
73
73
|
}
|
|
74
74
|
// Resolve target Component
|
|
75
75
|
let target = null;
|
|
76
76
|
if (targetComponentID) {
|
|
77
|
-
const c = await
|
|
77
|
+
const c = await LoadComponent(provider, user, targetComponentID);
|
|
78
78
|
if (!c) {
|
|
79
|
-
return
|
|
79
|
+
return Failure("COMPONENT_NOT_FOUND", `TargetComponentID '${targetComponentID}' not found.`);
|
|
80
80
|
}
|
|
81
81
|
// Confirm same lineage (same Name).
|
|
82
82
|
if ((c.Name ?? '') !== (currentComponent.Name ?? '')) {
|
|
83
|
-
return
|
|
83
|
+
return Failure("LINEAGE_MISMATCH", `Target Component name '${c.Name}' differs from current '${currentComponent.Name}'. Revert is restricted to the same Name lineage.`);
|
|
84
84
|
}
|
|
85
85
|
target = { ID: c.ID, Version: c.Version };
|
|
86
86
|
}
|
|
@@ -94,18 +94,18 @@ let RevertInteractiveFormAction = class RevertInteractiveFormAction extends Base
|
|
|
94
94
|
MaxRows: 1,
|
|
95
95
|
}, user);
|
|
96
96
|
if (!r.Success || (r.Results ?? []).length === 0) {
|
|
97
|
-
return
|
|
97
|
+
return Failure("COMPONENT_NOT_FOUND", `No Component with VersionSequence=${targetVersionSequence} in lineage '${currentComponent.Name}'.`);
|
|
98
98
|
}
|
|
99
99
|
target = { ID: r.Results[0].ID, Version: r.Results[0].Version };
|
|
100
100
|
}
|
|
101
101
|
if (!target) {
|
|
102
|
-
return
|
|
102
|
+
return Failure("COMPONENT_NOT_FOUND", "Could not resolve target Component.");
|
|
103
103
|
}
|
|
104
104
|
if (UUIDsEqual(target.ID, currentComponent.ID)) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
AddOutput(params, "OverrideID", override.ID);
|
|
106
|
+
AddOutput(params, "ComponentID", target.ID);
|
|
107
|
+
AddOutput(params, "PreviousComponentID", null);
|
|
108
|
+
AddOutput(params, "Version", target.Version);
|
|
109
109
|
return { Success: true, ResultCode: "SUCCESS",
|
|
110
110
|
Message: JSON.stringify({ noop: true, reason: 'TargetComponent is already the Active component.' }) };
|
|
111
111
|
}
|
|
@@ -113,20 +113,20 @@ let RevertInteractiveFormAction = class RevertInteractiveFormAction extends Base
|
|
|
113
113
|
override.ComponentID = target.ID;
|
|
114
114
|
const oSaved = await override.Save();
|
|
115
115
|
if (!oSaved) {
|
|
116
|
-
return
|
|
116
|
+
return Failure("PERSIST_FAILED", `Could not re-point Override: ${override.LatestResult?.CompleteMessage ?? 'unknown error'}`);
|
|
117
117
|
}
|
|
118
118
|
// Flip Component statuses to reflect the new active selection.
|
|
119
|
-
const newActive = await
|
|
119
|
+
const newActive = await LoadComponent(provider, user, target.ID);
|
|
120
120
|
if (newActive) {
|
|
121
|
-
newActive.Status =
|
|
121
|
+
newActive.Status = MapToComponentStatus('Active');
|
|
122
122
|
await newActive.Save();
|
|
123
123
|
}
|
|
124
|
-
currentComponent.Status =
|
|
124
|
+
currentComponent.Status = MapToComponentStatus('Inactive');
|
|
125
125
|
await currentComponent.Save();
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
AddOutput(params, "OverrideID", override.ID);
|
|
127
|
+
AddOutput(params, "ComponentID", target.ID);
|
|
128
|
+
AddOutput(params, "PreviousComponentID", currentComponent.ID);
|
|
129
|
+
AddOutput(params, "Version", target.Version);
|
|
130
130
|
return { Success: true, ResultCode: "SUCCESS",
|
|
131
131
|
Message: JSON.stringify({
|
|
132
132
|
OverrideID: override.ID,
|
|
@@ -138,7 +138,7 @@ let RevertInteractiveFormAction = class RevertInteractiveFormAction extends Base
|
|
|
138
138
|
catch (err) {
|
|
139
139
|
const message = err instanceof Error ? err.message : String(err);
|
|
140
140
|
LogError(`RevertInteractiveFormAction: ${message}`);
|
|
141
|
-
return
|
|
141
|
+
return Failure("UNEXPECTED_ERROR", message);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
};
|
|
@@ -4,9 +4,19 @@ import type { ActionResultSimple, RunActionParams } from '@memberjunction/action
|
|
|
4
4
|
* the patterns the older list actions inline individually — extracted here
|
|
5
5
|
* so the new actions stay small.
|
|
6
6
|
*/
|
|
7
|
+
export declare function GetStringParam(params: RunActionParams, name: string): string | undefined;
|
|
8
|
+
/** @deprecated Use {@link GetStringParam}. */
|
|
7
9
|
export declare function getStringParam(params: RunActionParams, name: string): string | undefined;
|
|
10
|
+
export declare function GetBooleanParam(params: RunActionParams, name: string, defaultValue: boolean): boolean;
|
|
11
|
+
/** @deprecated Use {@link GetBooleanParam}. */
|
|
8
12
|
export declare function getBooleanParam(params: RunActionParams, name: string, defaultValue: boolean): boolean;
|
|
13
|
+
export declare function GetJsonParam<T>(params: RunActionParams, name: string): T | undefined;
|
|
14
|
+
/** @deprecated Use {@link GetJsonParam}. */
|
|
9
15
|
export declare function getJsonParam<T>(params: RunActionParams, name: string): T | undefined;
|
|
16
|
+
export declare function AddOutputParam(params: RunActionParams, name: string, value: unknown): void;
|
|
17
|
+
/** @deprecated Use {@link AddOutputParam}. */
|
|
10
18
|
export declare function addOutputParam(params: RunActionParams, name: string, value: unknown): void;
|
|
19
|
+
export declare function MissingParam(name: string): ActionResultSimple;
|
|
20
|
+
/** @deprecated Use {@link MissingParam}. */
|
|
11
21
|
export declare function missingParam(name: string): ActionResultSimple;
|
|
12
22
|
//# sourceMappingURL=_action-helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_action-helpers.d.ts","sourceRoot":"","sources":["../../../src/custom/lists/_action-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAExF;;;;GAIG;AAEH,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGxF;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,OAAO,GACpB,OAAO,CAOT;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAQpF;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAE1F;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAM7D"}
|
|
1
|
+
{"version":3,"file":"_action-helpers.d.ts","sourceRoot":"","sources":["../../../src/custom/lists/_action-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAExF;;;;GAIG;AAEH,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGxF;AAED,8CAA8C;AAC9C,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAExF;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,OAAO,GACpB,OAAO,CAOT;AAED,+CAA+C;AAC/C,wBAAgB,eAAe,CAC7B,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,OAAO,GACpB,OAAO,CAET;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAQpF;AAED,4CAA4C;AAC5C,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAEpF;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAE1F;AAED,8CAA8C;AAC9C,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAE1F;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAM7D;AAED,4CAA4C;AAC5C,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAE7D"}
|
|
@@ -3,11 +3,15 @@
|
|
|
3
3
|
* the patterns the older list actions inline individually — extracted here
|
|
4
4
|
* so the new actions stay small.
|
|
5
5
|
*/
|
|
6
|
-
export function
|
|
6
|
+
export function GetStringParam(params, name) {
|
|
7
7
|
const param = params.Params.find((p) => p.Name.toLowerCase() === name.toLowerCase() && p.Type === 'Input');
|
|
8
8
|
return param?.Value != null ? String(param.Value) : undefined;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
/** @deprecated Use {@link GetStringParam}. */
|
|
11
|
+
export function getStringParam(params, name) {
|
|
12
|
+
return GetStringParam(params, name);
|
|
13
|
+
}
|
|
14
|
+
export function GetBooleanParam(params, name, defaultValue) {
|
|
11
15
|
const param = params.Params.find((p) => p.Name.toLowerCase() === name.toLowerCase() && p.Type === 'Input');
|
|
12
16
|
if (param?.Value == null)
|
|
13
17
|
return defaultValue;
|
|
@@ -18,8 +22,12 @@ export function getBooleanParam(params, name, defaultValue) {
|
|
|
18
22
|
return false;
|
|
19
23
|
return defaultValue;
|
|
20
24
|
}
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
/** @deprecated Use {@link GetBooleanParam}. */
|
|
26
|
+
export function getBooleanParam(params, name, defaultValue) {
|
|
27
|
+
return GetBooleanParam(params, name, defaultValue);
|
|
28
|
+
}
|
|
29
|
+
export function GetJsonParam(params, name) {
|
|
30
|
+
const raw = GetStringParam(params, name);
|
|
23
31
|
if (raw == null || raw.trim().length === 0)
|
|
24
32
|
return undefined;
|
|
25
33
|
try {
|
|
@@ -29,14 +37,26 @@ export function getJsonParam(params, name) {
|
|
|
29
37
|
return undefined;
|
|
30
38
|
}
|
|
31
39
|
}
|
|
32
|
-
|
|
40
|
+
/** @deprecated Use {@link GetJsonParam}. */
|
|
41
|
+
export function getJsonParam(params, name) {
|
|
42
|
+
return GetJsonParam(params, name);
|
|
43
|
+
}
|
|
44
|
+
export function AddOutputParam(params, name, value) {
|
|
33
45
|
params.Params.push({ Name: name, Type: 'Output', Value: value });
|
|
34
46
|
}
|
|
35
|
-
|
|
47
|
+
/** @deprecated Use {@link AddOutputParam}. */
|
|
48
|
+
export function addOutputParam(params, name, value) {
|
|
49
|
+
return AddOutputParam(params, name, value);
|
|
50
|
+
}
|
|
51
|
+
export function MissingParam(name) {
|
|
36
52
|
return {
|
|
37
53
|
Success: false,
|
|
38
54
|
ResultCode: 'MISSING_PARAMETER',
|
|
39
55
|
Message: `'${name}' is required`,
|
|
40
56
|
};
|
|
41
57
|
}
|
|
58
|
+
/** @deprecated Use {@link MissingParam}. */
|
|
59
|
+
export function missingParam(name) {
|
|
60
|
+
return MissingParam(name);
|
|
61
|
+
}
|
|
42
62
|
//# sourceMappingURL=_action-helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_action-helpers.js","sourceRoot":"","sources":["../../../src/custom/lists/_action-helpers.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,MAAM,UAAU,cAAc,CAAC,MAAuB,EAAE,IAAY;IAClE,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;IAC3G,OAAO,KAAK,EAAE,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,MAAuB,EACvB,IAAY,EACZ,YAAqB;IAErB,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;IAC3G,IAAI,KAAK,EAAE,KAAK,IAAI,IAAI;QAAE,OAAO,YAAY,CAAC;IAC9C,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5C,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IAC1D,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC3D,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,YAAY,CAAI,MAAuB,EAAE,IAAY;IACnE,MAAM,GAAG,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACzC,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC7D,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAM,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAuB,EAAE,IAAY,EAAE,KAAc;IAClF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO;QACL,OAAO,EAAE,KAAK;QACd,UAAU,EAAE,mBAAmB;QAC/B,OAAO,EAAE,IAAI,IAAI,eAAe;KACjC,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"_action-helpers.js","sourceRoot":"","sources":["../../../src/custom/lists/_action-helpers.ts"],"names":[],"mappings":"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"}
|
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { BaseAction } from '@memberjunction/actions';
|
|
8
8
|
import { RegisterClass } from '@memberjunction/global';
|
|
9
9
|
import { ListOperations } from '@memberjunction/lists';
|
|
10
|
-
import {
|
|
10
|
+
import { AddOutputParam, GetStringParam, MissingParam } from './_action-helpers.js';
|
|
11
11
|
/**
|
|
12
12
|
* Add a User View's current results to an existing List. Always additive;
|
|
13
13
|
* never removes. Cannot trigger the drop-guard.
|
|
@@ -25,17 +25,17 @@ import { addOutputParam, getStringParam, missingParam } from './_action-helpers.
|
|
|
25
25
|
*/
|
|
26
26
|
let AddViewResultsToListAction = class AddViewResultsToListAction extends BaseAction {
|
|
27
27
|
async InternalRunAction(params) {
|
|
28
|
-
const viewId =
|
|
29
|
-
const listId =
|
|
28
|
+
const viewId = GetStringParam(params, 'ViewID');
|
|
29
|
+
const listId = GetStringParam(params, 'ListID');
|
|
30
30
|
if (!viewId)
|
|
31
|
-
return
|
|
31
|
+
return MissingParam('ViewID');
|
|
32
32
|
if (!listId)
|
|
33
|
-
return
|
|
33
|
+
return MissingParam('ListID');
|
|
34
34
|
const ops = new ListOperations(params.ContextUser, params.Provider);
|
|
35
35
|
const result = await ops.AddViewResultsToList(viewId, listId);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
AddOutputParam(params, 'Added', result.Counts?.Added);
|
|
37
|
+
AddOutputParam(params, 'Removed', result.Counts?.Removed);
|
|
38
|
+
AddOutputParam(params, 'Failed', result.Counts?.Failed);
|
|
39
39
|
return {
|
|
40
40
|
Success: result.Success,
|
|
41
41
|
ResultCode: result.ResultCode,
|
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { BaseAction } from '@memberjunction/actions';
|
|
8
8
|
import { Metadata, RunView } from '@memberjunction/core';
|
|
9
9
|
import { RegisterClass } from '@memberjunction/global';
|
|
10
|
-
import {
|
|
10
|
+
import { AddOutputParam, GetJsonParam, GetStringParam, MissingParam, } from './_action-helpers.js';
|
|
11
11
|
/**
|
|
12
12
|
* Bulk-update the `Status` field on `MJ: List Detail` rows for a given
|
|
13
13
|
* list. Useful for review-style workflows where reviewers triage list
|
|
@@ -22,11 +22,11 @@ import { addOutputParam, getJsonParam, getStringParam, missingParam, } from './_
|
|
|
22
22
|
const ALLOWED_STATUSES = ['Active', 'Complete', 'Disabled', 'Error', 'Other', 'Pending', 'Rejected'];
|
|
23
23
|
let BulkUpdateListItemStatusAction = class BulkUpdateListItemStatusAction extends BaseAction {
|
|
24
24
|
async InternalRunAction(params) {
|
|
25
|
-
const listId =
|
|
26
|
-
const recordIds =
|
|
27
|
-
const newStatus =
|
|
25
|
+
const listId = GetStringParam(params, 'ListID');
|
|
26
|
+
const recordIds = GetJsonParam(params, 'RecordIDs');
|
|
27
|
+
const newStatus = GetStringParam(params, 'NewStatus');
|
|
28
28
|
if (!listId)
|
|
29
|
-
return
|
|
29
|
+
return MissingParam('ListID');
|
|
30
30
|
if (!recordIds || !Array.isArray(recordIds) || recordIds.length === 0) {
|
|
31
31
|
return {
|
|
32
32
|
Success: false,
|
|
@@ -70,9 +70,9 @@ let BulkUpdateListItemStatusAction = class BulkUpdateListItemStatusAction extend
|
|
|
70
70
|
errors.push(`Failed to update '${detail.RecordID}': ${detail.LatestResult?.CompleteMessage ?? 'unknown'}`);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
AddOutputParam(params, 'Updated', updated);
|
|
74
|
+
AddOutputParam(params, 'Failed', failed);
|
|
75
|
+
AddOutputParam(params, 'Errors', errors);
|
|
76
76
|
return {
|
|
77
77
|
Success: failed === 0,
|
|
78
78
|
ResultCode: failed === 0 ? 'SUCCESS' : 'PARTIAL_SUCCESS',
|
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { BaseAction } from '@memberjunction/actions';
|
|
8
8
|
import { RegisterClass } from '@memberjunction/global';
|
|
9
9
|
import { ListOperations } from '@memberjunction/lists';
|
|
10
|
-
import {
|
|
10
|
+
import { AddOutputParam, GetBooleanParam, GetJsonParam, GetStringParam, MissingParam, } from './_action-helpers.js';
|
|
11
11
|
/**
|
|
12
12
|
* Compose multiple List or View sources into a delta via a set-op
|
|
13
13
|
* (union / intersection / difference). Preview-only mode (no Target) is
|
|
@@ -34,9 +34,9 @@ import { addOutputParam, getBooleanParam, getJsonParam, getStringParam, missingP
|
|
|
34
34
|
*/
|
|
35
35
|
let ComposeListsAction = class ComposeListsAction extends BaseAction {
|
|
36
36
|
async InternalRunAction(params) {
|
|
37
|
-
const op =
|
|
37
|
+
const op = GetStringParam(params, 'Op');
|
|
38
38
|
if (!op)
|
|
39
|
-
return
|
|
39
|
+
return MissingParam('Op');
|
|
40
40
|
if (op !== 'union' && op !== 'intersection' && op !== 'difference') {
|
|
41
41
|
return {
|
|
42
42
|
Success: false,
|
|
@@ -44,7 +44,7 @@ let ComposeListsAction = class ComposeListsAction extends BaseAction {
|
|
|
44
44
|
Message: `Op must be one of: union | intersection | difference (got '${op}')`,
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
const inputs =
|
|
47
|
+
const inputs = GetJsonParam(params, 'Inputs');
|
|
48
48
|
if (!inputs || !Array.isArray(inputs) || inputs.length < 2) {
|
|
49
49
|
return {
|
|
50
50
|
Success: false,
|
|
@@ -52,16 +52,16 @@ let ComposeListsAction = class ComposeListsAction extends BaseAction {
|
|
|
52
52
|
Message: "'Inputs' must be a JSON-stringified array of at least 2 ListSource objects",
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
const target =
|
|
56
|
-
const confirmDrops =
|
|
55
|
+
const target = GetJsonParam(params, 'Target');
|
|
56
|
+
const confirmDrops = GetBooleanParam(params, 'ConfirmDrops', false);
|
|
57
57
|
const ops = new ListOperations(params.ContextUser, params.Provider);
|
|
58
58
|
const delta = await ops.ComputeSetOp(op, inputs, target);
|
|
59
59
|
// Preview-only path: no commit. Surface the delta details as outputs.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
AddOutputParam(params, 'DeltaToken', delta.DeltaToken);
|
|
61
|
+
AddOutputParam(params, 'Add', delta.Counts.Add);
|
|
62
|
+
AddOutputParam(params, 'Remove', delta.Counts.Remove);
|
|
63
|
+
AddOutputParam(params, 'Unchanged', delta.Counts.Unchanged);
|
|
64
|
+
AddOutputParam(params, 'Warnings', delta.Warnings.map((w) => ({ Code: w.Code, Message: w.Message })));
|
|
65
65
|
// If no target, this is a preview-only operation — we don't auto-apply.
|
|
66
66
|
if (!target) {
|
|
67
67
|
return {
|
|
@@ -73,9 +73,9 @@ let ComposeListsAction = class ComposeListsAction extends BaseAction {
|
|
|
73
73
|
// Target provided — commit via ApplyDelta. The drop-guard is enforced
|
|
74
74
|
// server-side: if Remove>0 and ConfirmDrops=false, ApplyDelta rejects.
|
|
75
75
|
const apply = await ops.ApplyDelta(delta, { ConfirmDrops: confirmDrops, DeltaToken: delta.DeltaToken });
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
AddOutputParam(params, 'Added', apply.Counts?.Added);
|
|
77
|
+
AddOutputParam(params, 'Removed', apply.Counts?.Removed);
|
|
78
|
+
AddOutputParam(params, 'Failed', apply.Counts?.Failed);
|
|
79
79
|
return {
|
|
80
80
|
Success: apply.Success,
|
|
81
81
|
ResultCode: apply.ResultCode,
|
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { BaseAction } from '@memberjunction/actions';
|
|
8
8
|
import { RegisterClass } from '@memberjunction/global';
|
|
9
9
|
import { ListSharing } from '@memberjunction/lists';
|
|
10
|
-
import {
|
|
10
|
+
import { AddOutputParam, GetStringParam, MissingParam } from './_action-helpers.js';
|
|
11
11
|
/**
|
|
12
12
|
* Issue a pending-email invitation to share a List. Returns the
|
|
13
13
|
* generated token + expiry — the caller (workflow / agent) is expected
|
|
@@ -21,13 +21,13 @@ import { addOutputParam, getStringParam, missingParam } from './_action-helpers.
|
|
|
21
21
|
*/
|
|
22
22
|
let InviteToListAction = class InviteToListAction extends BaseAction {
|
|
23
23
|
async InternalRunAction(params) {
|
|
24
|
-
const listId =
|
|
25
|
-
const email =
|
|
24
|
+
const listId = GetStringParam(params, 'ListID');
|
|
25
|
+
const email = GetStringParam(params, 'Email');
|
|
26
26
|
if (!listId)
|
|
27
|
-
return
|
|
27
|
+
return MissingParam('ListID');
|
|
28
28
|
if (!email)
|
|
29
|
-
return
|
|
30
|
-
const role = (
|
|
29
|
+
return MissingParam('Email');
|
|
30
|
+
const role = (GetStringParam(params, 'Role') ?? 'Viewer');
|
|
31
31
|
if (role !== 'Editor' && role !== 'Viewer') {
|
|
32
32
|
return {
|
|
33
33
|
Success: false,
|
|
@@ -35,13 +35,13 @@ let InviteToListAction = class InviteToListAction extends BaseAction {
|
|
|
35
35
|
Message: `Role must be Editor or Viewer (got '${role}')`,
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
const ttlHoursRaw =
|
|
38
|
+
const ttlHoursRaw = GetStringParam(params, 'TtlHours');
|
|
39
39
|
const ttlMs = ttlHoursRaw != null ? Number(ttlHoursRaw) * 60 * 60 * 1000 : undefined;
|
|
40
40
|
const sharing = new ListSharing(params.ContextUser, params.Provider);
|
|
41
41
|
const result = await sharing.Invite({ ListID: listId, Email: email, Role: role, TtlMs: ttlMs });
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
AddOutputParam(params, 'InvitationID', result.InvitationID);
|
|
43
|
+
AddOutputParam(params, 'Token', result.Token);
|
|
44
|
+
AddOutputParam(params, 'ExpiresAt', result.ExpiresAt?.toISOString());
|
|
45
45
|
return { Success: result.Success, ResultCode: result.ResultCode, Message: result.Message };
|
|
46
46
|
}
|
|
47
47
|
};
|