@memberjunction/core-actions 5.37.0 → 5.38.0

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 (42) hide show
  1. package/README.md +19 -1
  2. package/dist/custom/interactive-forms/_shared.d.ts +144 -0
  3. package/dist/custom/interactive-forms/_shared.d.ts.map +1 -0
  4. package/dist/custom/interactive-forms/_shared.js +300 -0
  5. package/dist/custom/interactive-forms/_shared.js.map +1 -0
  6. package/dist/custom/interactive-forms/activate-interactive-form-version.action.d.ts +31 -0
  7. package/dist/custom/interactive-forms/activate-interactive-form-version.action.d.ts.map +1 -0
  8. package/dist/custom/interactive-forms/activate-interactive-form-version.action.js +139 -0
  9. package/dist/custom/interactive-forms/activate-interactive-form-version.action.js.map +1 -0
  10. package/dist/custom/interactive-forms/create-interactive-form.action.d.ts +32 -0
  11. package/dist/custom/interactive-forms/create-interactive-form.action.d.ts.map +1 -0
  12. package/dist/custom/interactive-forms/create-interactive-form.action.js +162 -0
  13. package/dist/custom/interactive-forms/create-interactive-form.action.js.map +1 -0
  14. package/dist/custom/interactive-forms/get-active-form-for-entity.action.d.ts +46 -0
  15. package/dist/custom/interactive-forms/get-active-form-for-entity.action.d.ts.map +1 -0
  16. package/dist/custom/interactive-forms/get-active-form-for-entity.action.js +179 -0
  17. package/dist/custom/interactive-forms/get-active-form-for-entity.action.js.map +1 -0
  18. package/dist/custom/interactive-forms/get-default-form-scaffold.action.d.ts +32 -0
  19. package/dist/custom/interactive-forms/get-default-form-scaffold.action.d.ts.map +1 -0
  20. package/dist/custom/interactive-forms/get-default-form-scaffold.action.js +87 -0
  21. package/dist/custom/interactive-forms/get-default-form-scaffold.action.js.map +1 -0
  22. package/dist/custom/interactive-forms/get-entity-schema-for-form.action.d.ts +34 -0
  23. package/dist/custom/interactive-forms/get-entity-schema-for-form.action.d.ts.map +1 -0
  24. package/dist/custom/interactive-forms/get-entity-schema-for-form.action.js +103 -0
  25. package/dist/custom/interactive-forms/get-entity-schema-for-form.action.js.map +1 -0
  26. package/dist/custom/interactive-forms/index.d.ts +8 -0
  27. package/dist/custom/interactive-forms/index.d.ts.map +1 -0
  28. package/dist/custom/interactive-forms/index.js +8 -0
  29. package/dist/custom/interactive-forms/index.js.map +1 -0
  30. package/dist/custom/interactive-forms/modify-interactive-form.action.d.ts +54 -0
  31. package/dist/custom/interactive-forms/modify-interactive-form.action.d.ts.map +1 -0
  32. package/dist/custom/interactive-forms/modify-interactive-form.action.js +300 -0
  33. package/dist/custom/interactive-forms/modify-interactive-form.action.js.map +1 -0
  34. package/dist/custom/interactive-forms/revert-interactive-form.action.d.ts +39 -0
  35. package/dist/custom/interactive-forms/revert-interactive-form.action.d.ts.map +1 -0
  36. package/dist/custom/interactive-forms/revert-interactive-form.action.js +155 -0
  37. package/dist/custom/interactive-forms/revert-interactive-form.action.js.map +1 -0
  38. package/dist/index.d.ts +1 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +2 -0
  41. package/dist/index.js.map +1 -1
  42. package/package.json +34 -32
package/README.md CHANGED
@@ -312,6 +312,24 @@ Orchestrate action execution with branching, iteration, parallelism, and retry l
312
312
  |---|---|---|
313
313
  | `__ExecuteCode` | `ExecuteCodeAction` | Execute sandboxed code snippets |
314
314
 
315
+ ### Interactive Forms (6 actions)
316
+
317
+ The lifecycle for runtime-author entity forms (form-role
318
+ `ComponentSpec` + `EntityFormOverride`). See
319
+ [/plans/interactive-forms/phase-2-runtime-loop.md](../../../plans/interactive-forms/phase-2-runtime-loop.md)
320
+ for the full architecture and security model. Mutation actions enforce
321
+ ownership checks (User → caller, Role → membership, Global → admin).
322
+
323
+ | Registration Name | Class | Description |
324
+ |---|---|---|
325
+ | `__GetEntitySchemaForForm` | `GetEntitySchemaForFormAction` | Read-only: returns the curated form-relevant schema for an entity (FKs resolved, value lists annotated, audit fields stripped). |
326
+ | `__GetDefaultFormScaffoldForEntity` | `GetDefaultFormScaffoldForEntityAction` | Read-only: produces a working form-role `ComponentSpec` mirroring the CodeGen Angular default layout. The agent's baseline. |
327
+ | `__GetActiveFormForEntity` | `GetActiveFormForEntityAction` | Read-only: returns the resolved Active override + full applicable-variants list for the (entity, calling-user) pair. |
328
+ | `__CreateInteractiveForm` | `CreateInteractiveFormAction` | Net-new only. Inserts Component v1.0.0 + Active User-scope Override. Fails `ALREADY_EXISTS` if the user already has an Active override for the entity. |
329
+ | `__ModifyInteractiveForm` | `ModifyInteractiveFormAction` | Branches on the pointed-to Component status: Pending → modify in place; Active → new Pending Component v(N+1) + sibling Pending Override. Always User-scope-clamped. |
330
+ | `__ActivateInteractiveFormVersion` | `ActivateInteractiveFormVersionAction` | Promotes a Pending override to Active; atomically demotes the prior sibling Active. |
331
+ | `__RevertInteractiveForm` | `RevertInteractiveFormAction` | Re-points an Active override at an older Component row in the same Name lineage. Pure UPDATE; no new rows. |
332
+
315
333
  ### Demo (6 actions)
316
334
 
317
335
  Reference implementations useful for testing and learning.
@@ -522,6 +540,6 @@ sequenceDiagram
522
540
  ## Related Packages
523
541
 
524
542
  - **[@memberjunction/actions-base](../Base/README.md)** -- Base classes, interfaces, and metadata engines
525
- - **[@memberjunction/actions](../Engine/readme.md)** -- Server-side action execution engine
543
+ - **[@memberjunction/actions](../Engine/README.md)** -- Server-side action execution engine
526
544
  - **[Parent Actions README](../README.md)** -- Framework overview, generated actions guide, and best practices
527
545
  - **[Parent Actions CLAUDE.md](../CLAUDE.md)** -- Design philosophy and development guidelines
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Shared helpers for the Interactive Forms action family. These all touch
3
+ * the same two entities (`MJ: Components`, `MJ: Entity Form Overrides`),
4
+ * lint the same spec shape, and need the same parameter conventions —
5
+ * extracting here keeps each action thin.
6
+ */
7
+ import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
8
+ import { IMetadataProvider, UserInfo } from "@memberjunction/core";
9
+ import { MJComponentEntity, MJEntityFormOverrideEntity } from "@memberjunction/core-entities";
10
+ import type { ComponentSpec } from "@memberjunction/interactive-component-types";
11
+ export declare function getParam(params: RunActionParams, name: string): unknown;
12
+ export declare function getStringParam(params: RunActionParams, name: string): string | null;
13
+ export declare function getNumberParam(params: RunActionParams, name: string): number | null;
14
+ export declare function addOutput(params: RunActionParams, name: string, value: unknown): void;
15
+ export declare function failure(resultCode: string, message: string): ActionResultSimple;
16
+ export declare function success(message: string): ActionResultSimple;
17
+ /** Parse a Spec param that may arrive as object or stringified JSON. */
18
+ export declare function parseSpecParam(raw: unknown): ComponentSpec | {
19
+ error: string;
20
+ };
21
+ /**
22
+ * Lint a form-role ComponentSpec. Returns null on success, a fail-fast
23
+ * ActionResultSimple on failure. Two rules are suppressed for form-role
24
+ * specs (component-props-validation, callback-event-validation) — see
25
+ * lint comments in the original create-interactive-form action for the
26
+ * rationale.
27
+ */
28
+ export declare function lintFormSpec(spec: ComponentSpec, contextUser: UserInfo): Promise<ActionResultSimple | null>;
29
+ /** Load a Component entity object by primary key. */
30
+ export declare function loadComponent(provider: IMetadataProvider, user: UserInfo, componentID: string): Promise<MJComponentEntity | null>;
31
+ /** Load an Override entity object by primary key. */
32
+ export declare function loadOverride(provider: IMetadataProvider, user: UserInfo, overrideID: string): Promise<MJEntityFormOverrideEntity | null>;
33
+ /**
34
+ * Defense-in-depth ownership check for the override-mutation actions
35
+ * (Modify / Activate / Revert).
36
+ *
37
+ * `Create` is naturally self-scoped — it always emits a fresh User-scope
38
+ * row owned by the caller. The mutation actions, however, take an
39
+ * `OverrideID` from the caller and operate on it; without this guard a
40
+ * user could mutate another user's User-scope override by guessing the ID.
41
+ * Row-level security may catch some of this, but we don't rely on it.
42
+ *
43
+ * Rules:
44
+ * - `Scope='User'` → caller must be the owning user.
45
+ * - `Scope='Role'` → caller must be a member of the override's role.
46
+ * - `Scope='Global'` → caller must be a system admin (`UserInfo.Type==='Owner'`).
47
+ *
48
+ * Returns `null` on success; a `FORBIDDEN` failure result on rejection.
49
+ */
50
+ export declare function checkOverrideOwnership(override: Pick<MJEntityFormOverrideEntity, 'ID' | 'Scope' | 'UserID' | 'RoleID'>, user: UserInfo): ActionResultSimple | null;
51
+ /**
52
+ * Lifecycle mapping. EntityFormOverride.Status uses
53
+ * 'Active' / 'Pending' / 'Inactive' (it's the resolver-facing union). The
54
+ * underlying Component table's Status column is the existing MJ Component
55
+ * lifecycle: 'Draft' / 'Published' / 'Deprecated'. We mirror Override.Status
56
+ * onto Component.Status using this map so a Component read in isolation still
57
+ * tells you whether it's the active form (Published), a pending refinement
58
+ * (Draft), or an archived version (Deprecated).
59
+ */
60
+ export type FormLifecycle = 'Active' | 'Pending' | 'Inactive';
61
+ export declare function mapToComponentStatus(lifecycle: FormLifecycle): 'Published' | 'Draft' | 'Deprecated';
62
+ export declare function mapFromComponentStatus(status: string | null | undefined): FormLifecycle;
63
+ /**
64
+ * Insert a new Component row carrying the supplied spec. Used by both
65
+ * Create (v1.0.0) and Modify (v(N+1).0) paths.
66
+ *
67
+ * - `version` / `versionSequence` are supplied by the caller — different
68
+ * actions have different bumping logic (Create starts at 1.0.0, Modify
69
+ * increments minor).
70
+ * - `componentStatus` mirrors the override status the caller is targeting
71
+ * ('Active' or 'Pending') — translated to the Component table's union via
72
+ * {@link mapToComponentStatus}.
73
+ */
74
+ export declare function insertComponent(opts: {
75
+ provider: IMetadataProvider;
76
+ user: UserInfo;
77
+ spec: ComponentSpec;
78
+ fallbackName: string;
79
+ description: string | null;
80
+ version: string;
81
+ versionSequence: number;
82
+ componentStatus: FormLifecycle;
83
+ }): Promise<{
84
+ id: string;
85
+ } | {
86
+ error: ActionResultSimple;
87
+ }>;
88
+ /**
89
+ * Insert a new EntityFormOverride row. Always User-scoped (security clamp)
90
+ * unless `allowGlobalOrRole` is explicitly true — which is reserved for the
91
+ * future "promote variant" UI path, not the agent.
92
+ */
93
+ export declare function insertOverride(opts: {
94
+ provider: IMetadataProvider;
95
+ user: UserInfo;
96
+ entityID: string;
97
+ componentID: string;
98
+ name: string;
99
+ description: string | null;
100
+ notes?: string | null;
101
+ status: 'Active' | 'Pending';
102
+ priority?: number;
103
+ }): Promise<{
104
+ id: string;
105
+ } | {
106
+ error: ActionResultSimple;
107
+ }>;
108
+ /**
109
+ * Discrete intent for how the next version should be derived. Callers
110
+ * (Modify Interactive Form) accept this as an explicit input parameter so
111
+ * the agent can express defect-vs-feature-vs-rewrite intent rather than
112
+ * inferring it from the source row's status.
113
+ */
114
+ export type VersionBumpKind = 'in-place' | 'patch' | 'minor' | 'major';
115
+ /**
116
+ * "1.0.0" → "1.0.1", "1.7.3" → "1.7.4". Used for small/defect-style edits
117
+ * that deserve a rollback checkpoint but aren't a meaningful UX change.
118
+ */
119
+ export declare function bumpPatchVersion(current: string | null | undefined): string;
120
+ /**
121
+ * Compute the next semver-minor bump for an existing version string.
122
+ * "1.0.0" → "1.1.0", "1.7.3" → "1.8.0". Used for feature additions —
123
+ * new fields, sections, charts, tabs.
124
+ */
125
+ export declare function bumpMinorVersion(current: string | null | undefined): string;
126
+ /**
127
+ * "1.7.3" → "2.0.0", "3.4.5" → "4.0.0". Used for radical redesigns or
128
+ * when the user explicitly asks for a new major version.
129
+ */
130
+ export declare function bumpMajorVersion(current: string | null | undefined): string;
131
+ /**
132
+ * Dispatch a version bump based on the caller's stated intent.
133
+ * `'in-place'` returns the same version unchanged — caller should branch
134
+ * separately (no new Component row is written).
135
+ */
136
+ export declare function bumpVersion(current: string | null | undefined, kind: VersionBumpKind): string;
137
+ /**
138
+ * Parse and normalize a VersionBumpKind value from a string. Accepts the
139
+ * canonical lowercase forms plus a few common phrasings. Returns null if
140
+ * the input doesn't map to a known kind, so callers can decide whether
141
+ * to default or reject.
142
+ */
143
+ export declare function parseVersionBumpKind(raw: unknown): VersionBumpKind | null;
144
+ //# sourceMappingURL=_shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_shared.d.ts","sourceRoot":"","sources":["../../../src/custom/interactive-forms/_shared.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,k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,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,kBAAkB,CAAA;CAAE,CAAC,CA2B1D;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAavE;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAG3E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAG3E;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAG3E;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,eAAe,GAAG,MAAM,CAO7F;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CASzE"}
@@ -0,0 +1,300 @@
1
+ import { UUIDsEqual } from "@memberjunction/global";
2
+ import { isFormRole } from "@memberjunction/interactive-component-types/forms";
3
+ import { ComponentLinter } from "@memberjunction/react-linter";
4
+ // ── parameter helpers ────────────────────────────────────────────────────
5
+ export function getParam(params, name) {
6
+ const p = params.Params.find(x => x.Name?.trim().toLowerCase() === name.toLowerCase());
7
+ return p?.Value;
8
+ }
9
+ export function getStringParam(params, name) {
10
+ const v = getParam(params, name);
11
+ if (v == null)
12
+ return null;
13
+ const s = String(v).trim();
14
+ return s.length > 0 ? s : null;
15
+ }
16
+ export function getNumberParam(params, name) {
17
+ const v = getParam(params, name);
18
+ if (v == null)
19
+ return null;
20
+ const n = typeof v === 'number' ? v : Number(String(v));
21
+ return Number.isFinite(n) ? n : null;
22
+ }
23
+ export function addOutput(params, name, value) {
24
+ params.Params.push({ Name: name, Type: "Output", Value: value });
25
+ }
26
+ // ── result helpers ───────────────────────────────────────────────────────
27
+ export function failure(resultCode, message) {
28
+ return { Success: false, ResultCode: resultCode, Message: message };
29
+ }
30
+ export function success(message) {
31
+ return { Success: true, ResultCode: "SUCCESS", Message: message };
32
+ }
33
+ // ── spec parsing + linting ───────────────────────────────────────────────
34
+ /** Parse a Spec param that may arrive as object or stringified JSON. */
35
+ export function parseSpecParam(raw) {
36
+ try {
37
+ if (typeof raw === "string") {
38
+ return JSON.parse(raw);
39
+ }
40
+ return raw;
41
+ }
42
+ catch (err) {
43
+ return { error: err instanceof Error ? err.message : String(err) };
44
+ }
45
+ }
46
+ /**
47
+ * Lint a form-role ComponentSpec. Returns null on success, a fail-fast
48
+ * ActionResultSimple on failure. Two rules are suppressed for form-role
49
+ * specs (component-props-validation, callback-event-validation) — see
50
+ * lint comments in the original create-interactive-form action for the
51
+ * rationale.
52
+ */
53
+ export async function lintFormSpec(spec, contextUser) {
54
+ if (!isFormRole(spec)) {
55
+ return failure("LINT_FAILED", `Spec must declare componentRole='form'. Got '${spec.componentRole ?? "(unset)"}'. The InteractiveForm runtime refuses to mount any other role.`);
56
+ }
57
+ if (!spec.name || spec.name.trim().length === 0) {
58
+ return failure("LINT_FAILED", "Spec.name is required.");
59
+ }
60
+ if (typeof spec.code !== "string" || spec.code.trim().length === 0) {
61
+ return failure("LINT_FAILED", "Spec.code must be a non-empty JSX string.");
62
+ }
63
+ if (!spec.location) {
64
+ return failure("LINT_FAILED", "Spec.location is required (use 'embedded' for inline JSX or 'registry' to reference a published component).");
65
+ }
66
+ const FORM_ROLE_SUPPRESSED_RULES = new Set([
67
+ "component-props-validation",
68
+ "callback-event-validation",
69
+ ]);
70
+ try {
71
+ const result = await ComponentLinter.lintComponent(spec.code, spec.name, spec, true, contextUser);
72
+ const blocking = (result.violations ?? []).filter(v => {
73
+ const isBlocking = v.severity === "critical" || v.severity === "high";
74
+ if (!isBlocking)
75
+ return false;
76
+ if (v.rule && FORM_ROLE_SUPPRESSED_RULES.has(v.rule))
77
+ return false;
78
+ return true;
79
+ });
80
+ if (blocking.length > 0) {
81
+ const messages = blocking
82
+ .slice(0, 5)
83
+ .map(v => ` [${v.severity}] ${v.rule ?? "lint"}: ${v.message}${v.line ? ` (line ${v.line})` : ""}`)
84
+ .join("\n");
85
+ return failure("LINT_FAILED", `Spec code failed linting:\n${messages}${blocking.length > 5 ? `\n (+${blocking.length - 5} more)` : ""}`);
86
+ }
87
+ }
88
+ catch (err) {
89
+ return failure("LINT_FAILED", `Linter could not parse spec code: ${err instanceof Error ? err.message : String(err)}`);
90
+ }
91
+ return null;
92
+ }
93
+ // ── component / override fetch + write helpers ───────────────────────────
94
+ /** Load a Component entity object by primary key. */
95
+ export async function loadComponent(provider, user, componentID) {
96
+ const c = await provider.GetEntityObject("MJ: Components", user);
97
+ const loaded = await c.Load(componentID);
98
+ return loaded ? c : null;
99
+ }
100
+ /** Load an Override entity object by primary key. */
101
+ export async function loadOverride(provider, user, overrideID) {
102
+ const o = await provider.GetEntityObject("MJ: Entity Form Overrides", user);
103
+ const loaded = await o.Load(overrideID);
104
+ return loaded ? o : null;
105
+ }
106
+ /**
107
+ * Defense-in-depth ownership check for the override-mutation actions
108
+ * (Modify / Activate / Revert).
109
+ *
110
+ * `Create` is naturally self-scoped — it always emits a fresh User-scope
111
+ * row owned by the caller. The mutation actions, however, take an
112
+ * `OverrideID` from the caller and operate on it; without this guard a
113
+ * user could mutate another user's User-scope override by guessing the ID.
114
+ * Row-level security may catch some of this, but we don't rely on it.
115
+ *
116
+ * Rules:
117
+ * - `Scope='User'` → caller must be the owning user.
118
+ * - `Scope='Role'` → caller must be a member of the override's role.
119
+ * - `Scope='Global'` → caller must be a system admin (`UserInfo.Type==='Owner'`).
120
+ *
121
+ * Returns `null` on success; a `FORBIDDEN` failure result on rejection.
122
+ */
123
+ export function checkOverrideOwnership(override, user) {
124
+ const ID = override.ID;
125
+ switch (override.Scope) {
126
+ case 'User': {
127
+ if (!UUIDsEqual(override.UserID, user.ID)) {
128
+ return failure("FORBIDDEN", `Override ${ID} is User-scoped to a different user. Only the owning user can mutate it.`);
129
+ }
130
+ return null;
131
+ }
132
+ case 'Role': {
133
+ const userRoleIds = (user.UserRoles ?? [])
134
+ .map(r => r.RoleID).filter((x) => !!x);
135
+ if (!override.RoleID || !userRoleIds.includes(override.RoleID)) {
136
+ return failure("FORBIDDEN", `Override ${ID} is Role-scoped (${override.RoleID}). Only members of that role can mutate it.`);
137
+ }
138
+ return null;
139
+ }
140
+ case 'Global': {
141
+ // `UserInfo.Type === 'Owner'` is MJ's canonical admin marker —
142
+ // see packages/MJCore/src/userInfo.ts (Type is a Pick from the
143
+ // generated entity field). Owners can manage Global overrides;
144
+ // everyone else is rejected.
145
+ const isOwner = (user.Type ?? '').toLowerCase() === 'owner';
146
+ if (!isOwner) {
147
+ return failure("FORBIDDEN", `Override ${ID} is Global. Only Owner-type users can mutate Global overrides; promote / demote them via Component Studio with appropriate privileges.`);
148
+ }
149
+ return null;
150
+ }
151
+ default:
152
+ return failure("FORBIDDEN", `Override ${ID} has an unrecognized Scope ('${override.Scope}').`);
153
+ }
154
+ }
155
+ export function mapToComponentStatus(lifecycle) {
156
+ switch (lifecycle) {
157
+ case 'Active': return 'Published';
158
+ case 'Pending': return 'Draft';
159
+ case 'Inactive': return 'Deprecated';
160
+ }
161
+ }
162
+ export function mapFromComponentStatus(status) {
163
+ switch ((status ?? '').toLowerCase()) {
164
+ case 'published': return 'Active';
165
+ case 'draft': return 'Pending';
166
+ case 'deprecated': return 'Inactive';
167
+ default: return 'Inactive'; // unknown values treated as terminal
168
+ }
169
+ }
170
+ /**
171
+ * Insert a new Component row carrying the supplied spec. Used by both
172
+ * Create (v1.0.0) and Modify (v(N+1).0) paths.
173
+ *
174
+ * - `version` / `versionSequence` are supplied by the caller — different
175
+ * actions have different bumping logic (Create starts at 1.0.0, Modify
176
+ * increments minor).
177
+ * - `componentStatus` mirrors the override status the caller is targeting
178
+ * ('Active' or 'Pending') — translated to the Component table's union via
179
+ * {@link mapToComponentStatus}.
180
+ */
181
+ export async function insertComponent(opts) {
182
+ const { provider, user, spec, fallbackName, description, version, versionSequence, componentStatus } = opts;
183
+ const component = await provider.GetEntityObject("MJ: Components", user);
184
+ component.NewRecord();
185
+ component.Name = spec.name ?? fallbackName;
186
+ component.Title = spec.title ?? fallbackName;
187
+ component.Description = description ?? spec.description ?? null;
188
+ component.Type = "Form";
189
+ component.Status = mapToComponentStatus(componentStatus);
190
+ component.Version = version;
191
+ component.VersionSequence = versionSequence;
192
+ component.Specification = JSON.stringify(spec);
193
+ component.DeveloperName = user.Name ?? null;
194
+ const saved = await component.Save();
195
+ if (!saved) {
196
+ return { error: failure("PERSIST_FAILED", `Component insert failed: ${component.LatestResult?.CompleteMessage ?? "unknown error"}`) };
197
+ }
198
+ return { id: component.ID };
199
+ }
200
+ /**
201
+ * Insert a new EntityFormOverride row. Always User-scoped (security clamp)
202
+ * unless `allowGlobalOrRole` is explicitly true — which is reserved for the
203
+ * future "promote variant" UI path, not the agent.
204
+ */
205
+ export async function insertOverride(opts) {
206
+ const { provider, user, entityID, componentID, name, description, notes, status, priority } = opts;
207
+ const override = await provider.GetEntityObject("MJ: Entity Form Overrides", user);
208
+ override.NewRecord();
209
+ override.EntityID = entityID;
210
+ override.ComponentID = componentID;
211
+ override.Name = name;
212
+ override.Description = description;
213
+ // Notes is the column added in V202605221100 (Notes-column fold-in).
214
+ // Cast — the generated type may or may not yet expose it depending on
215
+ // codegen freshness; the field exists in the DB regardless.
216
+ override.Notes = notes ?? null;
217
+ override.Scope = "User";
218
+ override.UserID = user.ID;
219
+ override.RoleID = null;
220
+ override.Priority = priority ?? 0;
221
+ override.Status = status;
222
+ const saved = await override.Save();
223
+ if (!saved) {
224
+ return { error: failure("PERSIST_FAILED", `Override insert failed: ${override.LatestResult?.CompleteMessage ?? "unknown error"}`) };
225
+ }
226
+ return { id: override.ID };
227
+ }
228
+ function parseSemver(current) {
229
+ if (!current)
230
+ return { major: 1, minor: 0, patch: 0 };
231
+ const m = /^(\d+)\.(\d+)(?:\.(\d+))?/.exec(current.trim());
232
+ if (!m)
233
+ return { major: 1, minor: 0, patch: 0 };
234
+ return {
235
+ major: Number(m[1]),
236
+ minor: Number(m[2]),
237
+ patch: m[3] ? Number(m[3]) : 0,
238
+ };
239
+ }
240
+ /**
241
+ * "1.0.0" → "1.0.1", "1.7.3" → "1.7.4". Used for small/defect-style edits
242
+ * that deserve a rollback checkpoint but aren't a meaningful UX change.
243
+ */
244
+ export function bumpPatchVersion(current) {
245
+ const v = parseSemver(current);
246
+ return `${v.major}.${v.minor}.${v.patch + 1}`;
247
+ }
248
+ /**
249
+ * Compute the next semver-minor bump for an existing version string.
250
+ * "1.0.0" → "1.1.0", "1.7.3" → "1.8.0". Used for feature additions —
251
+ * new fields, sections, charts, tabs.
252
+ */
253
+ export function bumpMinorVersion(current) {
254
+ const v = parseSemver(current);
255
+ return `${v.major}.${v.minor + 1}.0`;
256
+ }
257
+ /**
258
+ * "1.7.3" → "2.0.0", "3.4.5" → "4.0.0". Used for radical redesigns or
259
+ * when the user explicitly asks for a new major version.
260
+ */
261
+ export function bumpMajorVersion(current) {
262
+ const v = parseSemver(current);
263
+ return `${v.major + 1}.0.0`;
264
+ }
265
+ /**
266
+ * Dispatch a version bump based on the caller's stated intent.
267
+ * `'in-place'` returns the same version unchanged — caller should branch
268
+ * separately (no new Component row is written).
269
+ */
270
+ export function bumpVersion(current, kind) {
271
+ switch (kind) {
272
+ case 'patch': return bumpPatchVersion(current);
273
+ case 'minor': return bumpMinorVersion(current);
274
+ case 'major': return bumpMajorVersion(current);
275
+ case 'in-place': return current ?? '1.0.0';
276
+ }
277
+ }
278
+ /**
279
+ * Parse and normalize a VersionBumpKind value from a string. Accepts the
280
+ * canonical lowercase forms plus a few common phrasings. Returns null if
281
+ * the input doesn't map to a known kind, so callers can decide whether
282
+ * to default or reject.
283
+ */
284
+ export function parseVersionBumpKind(raw) {
285
+ if (raw == null)
286
+ return null;
287
+ const s = String(raw).trim().toLowerCase();
288
+ if (!s)
289
+ return null;
290
+ if (s === 'in-place' || s === 'inplace' || s === 'in_place')
291
+ return 'in-place';
292
+ if (s === 'patch')
293
+ return 'patch';
294
+ if (s === 'minor')
295
+ return 'minor';
296
+ if (s === 'major')
297
+ return 'major';
298
+ return null;
299
+ }
300
+ //# sourceMappingURL=_shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_shared.js","sourceRoot":"","sources":["../../../src/custom/interactive-forms/_shared.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAMpD,OAAO,EAAE,UAAU,EAAE,MAAM,mDAAmD,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,4EAA4E;AAE5E,MAAM,UAAU,QAAQ,CAAC,MAAuB,EAAE,IAAY;IAC1D,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAC7B,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IACzD,OAAO,CAAC,EAAE,KAAK,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAuB,EAAE,IAAY;IAChE,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACjC,IAAI,CAAC,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IAC3B,MAA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/**
4
+ * Promote a Pending override to Active. Flips:
5
+ * - target Override: Status='Active'
6
+ * - target Override's Component: Status='Active'
7
+ * - prior Active sibling Override: Status='Inactive'
8
+ * - prior Active sibling Component: Status='Inactive'
9
+ *
10
+ * "Sibling" = same EntityID + (Scope, UserID, RoleID) tuple as the target
11
+ * Override. The target is the row identified by the input `OverrideID`; the
12
+ * priors are any rows currently Status='Active' at the same scope target.
13
+ *
14
+ * Idempotency. If the target Override is already Active, returns SUCCESS
15
+ * with a no-op message. If it's Inactive, that's a misuse — we surface
16
+ * NOT_PENDING so the agent / UI can ask the user what they really want.
17
+ *
18
+ * Inputs:
19
+ * - `OverrideID` (required, string) — the Pending override to activate
20
+ *
21
+ * Outputs:
22
+ * - `ComponentID` — the Component now Active
23
+ * - `OverrideID` — echoed for convenience
24
+ * - `PreviousActiveOverrideID` — the override that was demoted (or null)
25
+ */
26
+ export declare class ActivateInteractiveFormVersionAction extends BaseAction {
27
+ protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
28
+ }
29
+ /** Tree-shaking guard. */
30
+ export declare function LoadActivateInteractiveFormVersionAction(): void;
31
+ //# sourceMappingURL=activate-interactive-form-version.action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activate-interactive-form-version.action.d.ts","sourceRoot":"","sources":["../../../src/custom/interactive-forms/activate-interactive-form-version.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAOrD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBACa,oCAAqC,SAAQ,UAAU;cAEhD,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAkG1F;AAED,0BAA0B;AAC1B,wBAAgB,wCAAwC,IAAI,IAAI,CAI/D"}