@memberjunction/core-actions 5.37.0 → 5.39.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.
- package/README.md +19 -1
- package/dist/custom/data/search-entity.action.d.ts +48 -0
- package/dist/custom/data/search-entity.action.d.ts.map +1 -0
- package/dist/custom/data/search-entity.action.js +138 -0
- package/dist/custom/data/search-entity.action.js.map +1 -0
- package/dist/custom/geo/scheduled-geocoding.action.d.ts +27 -0
- package/dist/custom/geo/scheduled-geocoding.action.d.ts.map +1 -1
- package/dist/custom/geo/scheduled-geocoding.action.js +96 -13
- package/dist/custom/geo/scheduled-geocoding.action.js.map +1 -1
- package/dist/custom/integration/generate-integration-action.action.d.ts +60 -0
- package/dist/custom/integration/generate-integration-action.action.d.ts.map +1 -0
- package/dist/custom/integration/generate-integration-action.action.js +182 -0
- package/dist/custom/integration/generate-integration-action.action.js.map +1 -0
- package/dist/custom/integration/integration-action-executor.d.ts +28 -5
- package/dist/custom/integration/integration-action-executor.d.ts.map +1 -1
- package/dist/custom/integration/integration-action-executor.js +65 -11
- package/dist/custom/integration/integration-action-executor.js.map +1 -1
- package/dist/custom/interactive-forms/_shared.d.ts +144 -0
- package/dist/custom/interactive-forms/_shared.d.ts.map +1 -0
- package/dist/custom/interactive-forms/_shared.js +300 -0
- package/dist/custom/interactive-forms/_shared.js.map +1 -0
- package/dist/custom/interactive-forms/activate-interactive-form-version.action.d.ts +31 -0
- package/dist/custom/interactive-forms/activate-interactive-form-version.action.d.ts.map +1 -0
- package/dist/custom/interactive-forms/activate-interactive-form-version.action.js +139 -0
- package/dist/custom/interactive-forms/activate-interactive-form-version.action.js.map +1 -0
- package/dist/custom/interactive-forms/create-interactive-form.action.d.ts +32 -0
- package/dist/custom/interactive-forms/create-interactive-form.action.d.ts.map +1 -0
- package/dist/custom/interactive-forms/create-interactive-form.action.js +162 -0
- package/dist/custom/interactive-forms/create-interactive-form.action.js.map +1 -0
- package/dist/custom/interactive-forms/get-active-form-for-entity.action.d.ts +46 -0
- package/dist/custom/interactive-forms/get-active-form-for-entity.action.d.ts.map +1 -0
- package/dist/custom/interactive-forms/get-active-form-for-entity.action.js +179 -0
- package/dist/custom/interactive-forms/get-active-form-for-entity.action.js.map +1 -0
- package/dist/custom/interactive-forms/get-default-form-scaffold.action.d.ts +32 -0
- package/dist/custom/interactive-forms/get-default-form-scaffold.action.d.ts.map +1 -0
- package/dist/custom/interactive-forms/get-default-form-scaffold.action.js +87 -0
- package/dist/custom/interactive-forms/get-default-form-scaffold.action.js.map +1 -0
- package/dist/custom/interactive-forms/get-entity-schema-for-form.action.d.ts +34 -0
- package/dist/custom/interactive-forms/get-entity-schema-for-form.action.d.ts.map +1 -0
- package/dist/custom/interactive-forms/get-entity-schema-for-form.action.js +103 -0
- package/dist/custom/interactive-forms/get-entity-schema-for-form.action.js.map +1 -0
- package/dist/custom/interactive-forms/index.d.ts +8 -0
- package/dist/custom/interactive-forms/index.d.ts.map +1 -0
- package/dist/custom/interactive-forms/index.js +8 -0
- package/dist/custom/interactive-forms/index.js.map +1 -0
- package/dist/custom/interactive-forms/modify-interactive-form.action.d.ts +54 -0
- package/dist/custom/interactive-forms/modify-interactive-form.action.d.ts.map +1 -0
- package/dist/custom/interactive-forms/modify-interactive-form.action.js +300 -0
- package/dist/custom/interactive-forms/modify-interactive-form.action.js.map +1 -0
- package/dist/custom/interactive-forms/revert-interactive-form.action.d.ts +39 -0
- package/dist/custom/interactive-forms/revert-interactive-form.action.d.ts.map +1 -0
- package/dist/custom/interactive-forms/revert-interactive-form.action.js +155 -0
- package/dist/custom/interactive-forms/revert-interactive-form.action.js.map +1 -0
- package/dist/custom/utilities/vectorize-entity.action.d.ts.map +1 -1
- package/dist/custom/utilities/vectorize-entity.action.js +7 -2
- 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 +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +34 -32
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
|
|
2
|
+
import { BaseAction } from "@memberjunction/actions";
|
|
3
|
+
/**
|
|
4
|
+
* Create a net-new interactive-form override for the requesting user.
|
|
5
|
+
*
|
|
6
|
+
* **Net-new path only.** Returns ALREADY_EXISTS if the user already has an
|
|
7
|
+
* Active override for the target entity — agents should call
|
|
8
|
+
* `Get Active Form For Entity` first and route to `Modify Interactive Form`
|
|
9
|
+
* in that case. (Pending sibling overrides do NOT block creation — those
|
|
10
|
+
* are an in-flight refinement and Modify will resolve them in-place.)
|
|
11
|
+
*
|
|
12
|
+
* **Security clamp — Scope.** This action *always* writes
|
|
13
|
+
* `Scope='User', UserID=ctx.user.ID, Status='Active', Priority=0`,
|
|
14
|
+
* regardless of any scope-related parameter the caller might supply.
|
|
15
|
+
* This is the load-bearing safety property of the AI authoring path:
|
|
16
|
+
* an agent cannot write Global or Role overrides that would affect
|
|
17
|
+
* other users. Scope promotion (User → Role → Global) is a separate,
|
|
18
|
+
* deliberate human action in Component Studio / Form Builder dashboard.
|
|
19
|
+
*
|
|
20
|
+
* **Atomicity.** If the override insert fails after the Component insert
|
|
21
|
+
* succeeds, we surface PERSIST_FAILED with the Component already in the
|
|
22
|
+
* table. Orphan Components are harmless — they don't render anywhere
|
|
23
|
+
* until something points an override at them. The caller can retry; a
|
|
24
|
+
* second run will create a fresh Component and a successful override.
|
|
25
|
+
*/
|
|
26
|
+
export declare class CreateInteractiveFormAction extends BaseAction {
|
|
27
|
+
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
28
|
+
private extractInputs;
|
|
29
|
+
}
|
|
30
|
+
/** Tree-shaking guard. */
|
|
31
|
+
export declare function LoadCreateInteractiveFormAction(): void;
|
|
32
|
+
//# sourceMappingURL=create-interactive-form.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-interactive-form.action.d.ts","sourceRoot":"","sources":["../../../src/custom/interactive-forms/create-interactive-form.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AASrD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBACa,2BAA4B,SAAQ,UAAU;cAEvC,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAoGvF,OAAO,CAAC,aAAa;CAyBxB;AAED,0BAA0B;AAC1B,wBAAgB,+BAA+B,IAAI,IAAI,CAItD"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { BaseAction } from "@memberjunction/actions";
|
|
8
|
+
import { Metadata, LogError, RunView } from "@memberjunction/core";
|
|
9
|
+
import { RegisterClass } from "@memberjunction/global";
|
|
10
|
+
import { addOutput, failure, getStringParam, insertComponent, insertOverride, lintFormSpec, parseSpecParam, } from "./_shared.js";
|
|
11
|
+
/**
|
|
12
|
+
* Create a net-new interactive-form override for the requesting user.
|
|
13
|
+
*
|
|
14
|
+
* **Net-new path only.** Returns ALREADY_EXISTS if the user already has an
|
|
15
|
+
* Active override for the target entity — agents should call
|
|
16
|
+
* `Get Active Form For Entity` first and route to `Modify Interactive Form`
|
|
17
|
+
* in that case. (Pending sibling overrides do NOT block creation — those
|
|
18
|
+
* are an in-flight refinement and Modify will resolve them in-place.)
|
|
19
|
+
*
|
|
20
|
+
* **Security clamp — Scope.** This action *always* writes
|
|
21
|
+
* `Scope='User', UserID=ctx.user.ID, Status='Active', Priority=0`,
|
|
22
|
+
* regardless of any scope-related parameter the caller might supply.
|
|
23
|
+
* This is the load-bearing safety property of the AI authoring path:
|
|
24
|
+
* an agent cannot write Global or Role overrides that would affect
|
|
25
|
+
* other users. Scope promotion (User → Role → Global) is a separate,
|
|
26
|
+
* deliberate human action in Component Studio / Form Builder dashboard.
|
|
27
|
+
*
|
|
28
|
+
* **Atomicity.** If the override insert fails after the Component insert
|
|
29
|
+
* succeeds, we surface PERSIST_FAILED with the Component already in the
|
|
30
|
+
* table. Orphan Components are harmless — they don't render anywhere
|
|
31
|
+
* until something points an override at them. The caller can retry; a
|
|
32
|
+
* second run will create a fresh Component and a successful override.
|
|
33
|
+
*/
|
|
34
|
+
let CreateInteractiveFormAction = class CreateInteractiveFormAction extends BaseAction {
|
|
35
|
+
async InternalRunAction(params) {
|
|
36
|
+
try {
|
|
37
|
+
const inputs = this.extractInputs(params);
|
|
38
|
+
if ('error' in inputs)
|
|
39
|
+
return inputs.error;
|
|
40
|
+
const provider = params.Provider ?? Metadata.Provider;
|
|
41
|
+
if (!provider)
|
|
42
|
+
return failure("NO_PROVIDER", "No metadata provider available.");
|
|
43
|
+
const user = params.ContextUser;
|
|
44
|
+
if (!user)
|
|
45
|
+
return failure("NO_USER", "Action requires a ContextUser to clamp override scope.");
|
|
46
|
+
const entityInfo = provider.EntityByName(inputs.EntityName);
|
|
47
|
+
if (!entityInfo) {
|
|
48
|
+
return failure("ENTITY_NOT_FOUND", `Entity '${inputs.EntityName}' is not registered with the active metadata provider.`);
|
|
49
|
+
}
|
|
50
|
+
// Guard: don't silently create a duplicate override. We match
|
|
51
|
+
// BOTH Active and Pending sibling overrides — either is grounds
|
|
52
|
+
// to switch to Modify on that row instead of creating a second
|
|
53
|
+
// override. (Two overrides for the same entity/user would race
|
|
54
|
+
// each other at form-resolution time.)
|
|
55
|
+
const rv = RunView.FromMetadataProvider(provider);
|
|
56
|
+
const dupResult = await rv.RunView({
|
|
57
|
+
EntityName: "MJ: Entity Form Overrides",
|
|
58
|
+
ExtraFilter: `EntityID='${entityInfo.ID}' AND Scope='User' AND UserID='${user.ID}' AND Status IN ('Active', 'Pending')`,
|
|
59
|
+
Fields: ['ID', 'Status'],
|
|
60
|
+
ResultType: 'simple',
|
|
61
|
+
MaxRows: 1,
|
|
62
|
+
}, user);
|
|
63
|
+
if (dupResult.Success && (dupResult.Results ?? []).length > 0) {
|
|
64
|
+
const existing = dupResult.Results[0];
|
|
65
|
+
return failure("ALREADY_EXISTS", `A ${existing.Status} User-scope override already exists for entity '${inputs.EntityName}' (OverrideID=${existing.ID}). Use 'Modify Interactive Form' on this OverrideID to refine it (with a VersionBumpKind of 'patch' / 'minor' / 'major' to snapshot a new version, or 'in-place' against a Pending row to keep iterating on the same version). Use 'Revert Interactive Form' to switch to a different historical version.`);
|
|
66
|
+
}
|
|
67
|
+
// Lint before any persistence — fail-hard.
|
|
68
|
+
const lintFail = await lintFormSpec(inputs.Spec, user);
|
|
69
|
+
if (lintFail)
|
|
70
|
+
return lintFail;
|
|
71
|
+
// Create v1.0.0 as Pending (NOT Active). The cockpit / agent
|
|
72
|
+
// workflow is iterative — the user will refine via the chat
|
|
73
|
+
// before they're ready to flip the form live. Creating Active
|
|
74
|
+
// here would either (a) push an empty scaffold into production
|
|
75
|
+
// as the user's actual form, or (b) force the agent's first
|
|
76
|
+
// Modify to bump a new version, leaving behind a useless
|
|
77
|
+
// v1.0.0 placeholder. Pending means the agent's first Modify
|
|
78
|
+
// hits the in-place branch and overwrites this row — no
|
|
79
|
+
// wasted version, no premature publication. The user
|
|
80
|
+
// explicitly Activates from the Form Builder dashboard when
|
|
81
|
+
// they're happy with the result.
|
|
82
|
+
const componentInsert = await insertComponent({
|
|
83
|
+
provider, user,
|
|
84
|
+
spec: inputs.Spec,
|
|
85
|
+
fallbackName: inputs.Name,
|
|
86
|
+
description: inputs.Description,
|
|
87
|
+
version: "1.0.0",
|
|
88
|
+
versionSequence: 1,
|
|
89
|
+
componentStatus: 'Pending',
|
|
90
|
+
});
|
|
91
|
+
if ('error' in componentInsert)
|
|
92
|
+
return componentInsert.error;
|
|
93
|
+
const componentID = componentInsert.id;
|
|
94
|
+
const overrideInsert = await insertOverride({
|
|
95
|
+
provider, user,
|
|
96
|
+
entityID: entityInfo.ID,
|
|
97
|
+
componentID,
|
|
98
|
+
name: inputs.Name,
|
|
99
|
+
description: inputs.Description,
|
|
100
|
+
notes: inputs.Notes,
|
|
101
|
+
status: 'Pending',
|
|
102
|
+
priority: 0,
|
|
103
|
+
});
|
|
104
|
+
if ('error' in overrideInsert) {
|
|
105
|
+
return failure("PERSIST_FAILED", `${overrideInsert.error.Message} (Component ${componentID} was persisted but has no override yet.)`);
|
|
106
|
+
}
|
|
107
|
+
addOutput(params, "ComponentID", componentID);
|
|
108
|
+
addOutput(params, "OverrideID", overrideInsert.id);
|
|
109
|
+
addOutput(params, "Version", "1.0.0");
|
|
110
|
+
return {
|
|
111
|
+
Success: true,
|
|
112
|
+
ResultCode: "SUCCESS",
|
|
113
|
+
Message: JSON.stringify({
|
|
114
|
+
ComponentID: componentID,
|
|
115
|
+
OverrideID: overrideInsert.id,
|
|
116
|
+
EntityName: inputs.EntityName,
|
|
117
|
+
Scope: "User",
|
|
118
|
+
Status: "Pending",
|
|
119
|
+
Version: "1.0.0",
|
|
120
|
+
}),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
125
|
+
LogError(`CreateInteractiveFormAction: ${message}`);
|
|
126
|
+
return failure("UNEXPECTED_ERROR", message);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
extractInputs(params) {
|
|
130
|
+
const entityName = getStringParam(params, "EntityName");
|
|
131
|
+
if (!entityName)
|
|
132
|
+
return { error: failure("MISSING_PARAMETER", "Parameter 'EntityName' is required.") };
|
|
133
|
+
const name = getStringParam(params, "Name");
|
|
134
|
+
if (!name)
|
|
135
|
+
return { error: failure("MISSING_PARAMETER", "Parameter 'Name' is required.") };
|
|
136
|
+
const specRaw = params.Params.find(x => x.Name?.trim().toLowerCase() === "spec")?.Value;
|
|
137
|
+
if (specRaw == null)
|
|
138
|
+
return { error: failure("MISSING_PARAMETER", "Parameter 'Spec' is required.") };
|
|
139
|
+
const parsed = parseSpecParam(specRaw);
|
|
140
|
+
if ('error' in parsed) {
|
|
141
|
+
return { error: failure("LINT_FAILED", `Spec is not valid JSON: ${parsed.error}`) };
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
EntityName: entityName,
|
|
145
|
+
Spec: parsed,
|
|
146
|
+
Name: name,
|
|
147
|
+
Description: getStringParam(params, "Description"),
|
|
148
|
+
Notes: getStringParam(params, "Notes"),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
CreateInteractiveFormAction = __decorate([
|
|
153
|
+
RegisterClass(BaseAction, "__CreateInteractiveForm")
|
|
154
|
+
], CreateInteractiveFormAction);
|
|
155
|
+
export { CreateInteractiveFormAction };
|
|
156
|
+
/** Tree-shaking guard. */
|
|
157
|
+
export function LoadCreateInteractiveFormAction() {
|
|
158
|
+
if (false) {
|
|
159
|
+
const _ = CreateInteractiveFormAction;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=create-interactive-form.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-interactive-form.action.js","sourceRoot":"","sources":["../../../src/custom/interactive-forms/create-interactive-form.action.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,sBAAsB,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,+BAA+B;IAC3C,IAAI,KAAgB,EAAE,CAAC;QACnB,MAAM,CAAC,GAAY,2BAA2B,CAAC;IACnD,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
|
|
2
|
+
import { BaseAction } from "@memberjunction/actions";
|
|
3
|
+
/**
|
|
4
|
+
* Read-only action that returns the currently-resolved interactive-form
|
|
5
|
+
* override (if any) for the (entity, user) pair plus the full list of
|
|
6
|
+
* applicable variants. Used by the Form Builder agent to decide between
|
|
7
|
+
* Create (no override exists) and Modify (an override already exists).
|
|
8
|
+
*
|
|
9
|
+
* Resolution mirrors {@link FormResolverService} on the client:
|
|
10
|
+
* - Scope precedence: User > Role > Global.
|
|
11
|
+
* - Within a tier: Priority DESC, then __mj_CreatedAt DESC.
|
|
12
|
+
* - Only Status='Active' rows are considered for the "active" pick. The
|
|
13
|
+
* full variants list includes 'Pending' rows so the agent can recognize
|
|
14
|
+
* an in-flight refinement loop and reuse the Pending row instead of
|
|
15
|
+
* spawning a new one.
|
|
16
|
+
*
|
|
17
|
+
* Output shape (JSON in `Message`, also surfaced as a `Result` output param):
|
|
18
|
+
* ```
|
|
19
|
+
* {
|
|
20
|
+
* "EntityName": "MJ: Applications",
|
|
21
|
+
* "Active": {
|
|
22
|
+
* "OverrideID": "...",
|
|
23
|
+
* "ComponentID": "...",
|
|
24
|
+
* "Scope": "User" | "Role" | "Global",
|
|
25
|
+
* "Priority": 0,
|
|
26
|
+
* "Status": "Active",
|
|
27
|
+
* "Spec": <ComponentSpec>,
|
|
28
|
+
* "ComponentName": "...",
|
|
29
|
+
* "ComponentVersion": "1.0.0",
|
|
30
|
+
* "VersionSequence": 1
|
|
31
|
+
* } | null,
|
|
32
|
+
* "Variants": [{ ...same shape... }, ...] // all applicable, all statuses
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* If no overrides exist, `Active` is null and `Variants` is empty —
|
|
37
|
+
* the calling agent should then call `Get Default Form Scaffold For Entity`
|
|
38
|
+
* and `Create Interactive Form`.
|
|
39
|
+
*/
|
|
40
|
+
export declare class GetActiveFormForEntityAction extends BaseAction {
|
|
41
|
+
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
42
|
+
private getStringParam;
|
|
43
|
+
}
|
|
44
|
+
/** Tree-shaking guard — called from src/index.ts. */
|
|
45
|
+
export declare function LoadGetActiveFormForEntityAction(): void;
|
|
46
|
+
//# sourceMappingURL=get-active-form-for-entity.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-active-form-for-entity.action.d.ts","sourceRoot":"","sources":["../../../src/custom/interactive-forms/get-active-form-for-entity.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,qBACa,4BAA6B,SAAQ,UAAU;cAExC,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAkKvF,OAAO,CAAC,cAAc;CAOzB;AAMD,qDAAqD;AACrD,wBAAgB,gCAAgC,IAAI,IAAI,CAIvD"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { BaseAction } from "@memberjunction/actions";
|
|
8
|
+
import { Metadata, LogError, RunView } from "@memberjunction/core";
|
|
9
|
+
import { RegisterClass } from "@memberjunction/global";
|
|
10
|
+
/**
|
|
11
|
+
* Read-only action that returns the currently-resolved interactive-form
|
|
12
|
+
* override (if any) for the (entity, user) pair plus the full list of
|
|
13
|
+
* applicable variants. Used by the Form Builder agent to decide between
|
|
14
|
+
* Create (no override exists) and Modify (an override already exists).
|
|
15
|
+
*
|
|
16
|
+
* Resolution mirrors {@link FormResolverService} on the client:
|
|
17
|
+
* - Scope precedence: User > Role > Global.
|
|
18
|
+
* - Within a tier: Priority DESC, then __mj_CreatedAt DESC.
|
|
19
|
+
* - Only Status='Active' rows are considered for the "active" pick. The
|
|
20
|
+
* full variants list includes 'Pending' rows so the agent can recognize
|
|
21
|
+
* an in-flight refinement loop and reuse the Pending row instead of
|
|
22
|
+
* spawning a new one.
|
|
23
|
+
*
|
|
24
|
+
* Output shape (JSON in `Message`, also surfaced as a `Result` output param):
|
|
25
|
+
* ```
|
|
26
|
+
* {
|
|
27
|
+
* "EntityName": "MJ: Applications",
|
|
28
|
+
* "Active": {
|
|
29
|
+
* "OverrideID": "...",
|
|
30
|
+
* "ComponentID": "...",
|
|
31
|
+
* "Scope": "User" | "Role" | "Global",
|
|
32
|
+
* "Priority": 0,
|
|
33
|
+
* "Status": "Active",
|
|
34
|
+
* "Spec": <ComponentSpec>,
|
|
35
|
+
* "ComponentName": "...",
|
|
36
|
+
* "ComponentVersion": "1.0.0",
|
|
37
|
+
* "VersionSequence": 1
|
|
38
|
+
* } | null,
|
|
39
|
+
* "Variants": [{ ...same shape... }, ...] // all applicable, all statuses
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* If no overrides exist, `Active` is null and `Variants` is empty —
|
|
44
|
+
* the calling agent should then call `Get Default Form Scaffold For Entity`
|
|
45
|
+
* and `Create Interactive Form`.
|
|
46
|
+
*/
|
|
47
|
+
let GetActiveFormForEntityAction = class GetActiveFormForEntityAction extends BaseAction {
|
|
48
|
+
async InternalRunAction(params) {
|
|
49
|
+
try {
|
|
50
|
+
const entityName = this.getStringParam(params, "EntityName");
|
|
51
|
+
if (!entityName) {
|
|
52
|
+
return failure("MISSING_PARAMETER", "Parameter 'EntityName' is required.");
|
|
53
|
+
}
|
|
54
|
+
const provider = params.Provider ?? Metadata.Provider;
|
|
55
|
+
if (!provider) {
|
|
56
|
+
return failure("NO_PROVIDER", "No metadata provider available.");
|
|
57
|
+
}
|
|
58
|
+
const user = params.ContextUser;
|
|
59
|
+
if (!user) {
|
|
60
|
+
return failure("NO_USER", "Action requires a ContextUser for scope resolution.");
|
|
61
|
+
}
|
|
62
|
+
const entity = provider.EntityByName(entityName);
|
|
63
|
+
if (!entity) {
|
|
64
|
+
return failure("ENTITY_NOT_FOUND", `Entity '${entityName}' is not registered with the active metadata provider.`);
|
|
65
|
+
}
|
|
66
|
+
// Pull all overrides applicable to this user — User-scoped to this user,
|
|
67
|
+
// Role-scoped if user has any of the listed roles, or Global. We let the
|
|
68
|
+
// database filter and we sort + select winner in code below.
|
|
69
|
+
const rv = RunView.FromMetadataProvider(provider);
|
|
70
|
+
const userRoles = Array.isArray(user.UserRoles)
|
|
71
|
+
? (user.UserRoles ?? []).map(r => r.RoleID).filter((x) => !!x)
|
|
72
|
+
: [];
|
|
73
|
+
const filterClauses = [
|
|
74
|
+
`EntityID='${entity.ID}'`,
|
|
75
|
+
`(Scope='Global' OR (Scope='User' AND UserID='${user.ID}')${userRoles.length ? ` OR (Scope='Role' AND RoleID IN (${userRoles.map(r => `'${r}'`).join(",")}))` : ''})`,
|
|
76
|
+
];
|
|
77
|
+
const overrideResult = await rv.RunView({
|
|
78
|
+
EntityName: "MJ: Entity Form Overrides",
|
|
79
|
+
ExtraFilter: filterClauses.join(' AND '),
|
|
80
|
+
Fields: ['ID', 'EntityID', 'ComponentID', 'Name', 'Description', 'Scope', 'UserID', 'RoleID', 'Priority', 'Status'],
|
|
81
|
+
ResultType: 'simple',
|
|
82
|
+
}, user);
|
|
83
|
+
if (!overrideResult.Success) {
|
|
84
|
+
return failure("QUERY_FAILED", `Override lookup failed: ${overrideResult.ErrorMessage ?? 'unknown error'}`);
|
|
85
|
+
}
|
|
86
|
+
const overrides = overrideResult.Results ?? [];
|
|
87
|
+
if (overrides.length === 0) {
|
|
88
|
+
const payload = { EntityName: entityName, Active: null, Variants: [] };
|
|
89
|
+
params.Params.push({ Name: "Result", Type: "Output", Value: payload });
|
|
90
|
+
return {
|
|
91
|
+
Success: true,
|
|
92
|
+
ResultCode: "SUCCESS",
|
|
93
|
+
Message: JSON.stringify(payload),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
// Hydrate the referenced Components in one batch.
|
|
97
|
+
const componentIDs = Array.from(new Set(overrides.map(o => o.ComponentID))).filter(Boolean);
|
|
98
|
+
const componentsResult = await rv.RunView({
|
|
99
|
+
EntityName: "MJ: Components",
|
|
100
|
+
ExtraFilter: `ID IN (${componentIDs.map(id => `'${id}'`).join(",")})`,
|
|
101
|
+
Fields: ['ID', 'Name', 'Version', 'VersionSequence', 'Status', 'Specification'],
|
|
102
|
+
ResultType: 'simple',
|
|
103
|
+
}, user);
|
|
104
|
+
const componentByID = new Map((componentsResult.Results ?? []).map(c => [c.ID, c]));
|
|
105
|
+
const variants = overrides.map(o => {
|
|
106
|
+
const component = componentByID.get(o.ComponentID);
|
|
107
|
+
let spec = null;
|
|
108
|
+
if (component?.Specification) {
|
|
109
|
+
try {
|
|
110
|
+
spec = JSON.parse(component.Specification);
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
// Bad spec JSON — we don't fail the whole action; we surface
|
|
114
|
+
// the variant without a parsed spec and let the caller decide.
|
|
115
|
+
spec = null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
OverrideID: o.ID,
|
|
120
|
+
ComponentID: o.ComponentID,
|
|
121
|
+
Scope: o.Scope,
|
|
122
|
+
Priority: o.Priority ?? 0,
|
|
123
|
+
Status: o.Status,
|
|
124
|
+
Name: o.Name,
|
|
125
|
+
Description: o.Description,
|
|
126
|
+
Spec: spec,
|
|
127
|
+
ComponentName: component?.Name ?? null,
|
|
128
|
+
ComponentVersion: component?.Version ?? null,
|
|
129
|
+
VersionSequence: component?.VersionSequence ?? null,
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
// Sort by scope tier (User=1, Role=2, Global=3), then Priority DESC.
|
|
133
|
+
// We don't have CreatedAt in the lightweight query — ties at this
|
|
134
|
+
// point default to the order the DB returned, which is usually
|
|
135
|
+
// creation order. The resolver service does the same.
|
|
136
|
+
variants.sort((a, b) => {
|
|
137
|
+
const tierA = a.Scope === 'User' ? 1 : a.Scope === 'Role' ? 2 : 3;
|
|
138
|
+
const tierB = b.Scope === 'User' ? 1 : b.Scope === 'Role' ? 2 : 3;
|
|
139
|
+
if (tierA !== tierB)
|
|
140
|
+
return tierA - tierB;
|
|
141
|
+
return (b.Priority ?? 0) - (a.Priority ?? 0);
|
|
142
|
+
});
|
|
143
|
+
const active = variants.find(v => v.Status === 'Active') ?? null;
|
|
144
|
+
const payload = { EntityName: entityName, Active: active, Variants: variants };
|
|
145
|
+
params.Params.push({ Name: "Result", Type: "Output", Value: payload });
|
|
146
|
+
return {
|
|
147
|
+
Success: true,
|
|
148
|
+
ResultCode: "SUCCESS",
|
|
149
|
+
Message: JSON.stringify(payload),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
catch (err) {
|
|
153
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
154
|
+
LogError(`GetActiveFormForEntityAction: ${message}`);
|
|
155
|
+
return failure("UNEXPECTED_ERROR", message);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
getStringParam(params, name) {
|
|
159
|
+
const p = params.Params.find(x => x.Name?.trim().toLowerCase() === name.toLowerCase());
|
|
160
|
+
if (!p || p.Value == null)
|
|
161
|
+
return null;
|
|
162
|
+
const v = String(p.Value).trim();
|
|
163
|
+
return v.length > 0 ? v : null;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
GetActiveFormForEntityAction = __decorate([
|
|
167
|
+
RegisterClass(BaseAction, "__GetActiveFormForEntity")
|
|
168
|
+
], GetActiveFormForEntityAction);
|
|
169
|
+
export { GetActiveFormForEntityAction };
|
|
170
|
+
function failure(resultCode, message) {
|
|
171
|
+
return { Success: false, ResultCode: resultCode, Message: message };
|
|
172
|
+
}
|
|
173
|
+
/** Tree-shaking guard — called from src/index.ts. */
|
|
174
|
+
export function LoadGetActiveFormForEntityAction() {
|
|
175
|
+
if (false) {
|
|
176
|
+
const _ = GetActiveFormForEntityAction;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=get-active-form-for-entity.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-active-form-for-entity.action.js","sourceRoot":"","sources":["../../../src/custom/interactive-forms/get-active-form-for-entity.action.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEI,IAAM,4BAA4B,GAAlC,MAAM,4BAA6B,SAAQ,UAAU;IAE9C,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACrD,IAAI,CAAC;YACD,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;YAC7D,IAAI,CAAC,UAAU,EAAE,CAAC;gBACd,OAAO,OAAO,CAAC,mBAAmB,EAAE,qCAAqC,CAAC,CAAC;YAC/E,CA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AAE,CAAC;AACxE,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,gCAAgC;IAC5C,IAAI,KAAgB,EAAE,CAAC;QACnB,MAAM,CAAC,GAAY,4BAA4B,CAAC;IACpD,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
|
|
2
|
+
import { BaseAction } from "@memberjunction/actions";
|
|
3
|
+
/**
|
|
4
|
+
* Read-only action that produces a working form-role `ComponentSpec`
|
|
5
|
+
* scaffolded from the entity's CodeGen metadata (Category /
|
|
6
|
+
* GeneratedFormSectionType / Sequence / FK relationships / value lists).
|
|
7
|
+
*
|
|
8
|
+
* **Why this exists.** Today the Form Builder agent writes JSX from
|
|
9
|
+
* scratch every time, producing inconsistent quality. Calling this action
|
|
10
|
+
* first gives the agent a known-good baseline (mirrors the default Angular
|
|
11
|
+
* form) that it can modify per user requirements instead of inventing a
|
|
12
|
+
* layout. Far fewer lint failures, dramatically better starting point.
|
|
13
|
+
*
|
|
14
|
+
* **Pure read.** No persistence. The returned spec is intended to be
|
|
15
|
+
* modified and then passed to {@link CreateInteractiveFormAction} or
|
|
16
|
+
* {@link ModifyInteractiveFormAction}.
|
|
17
|
+
*/
|
|
18
|
+
export declare class GetDefaultFormScaffoldForEntityAction extends BaseAction {
|
|
19
|
+
/**
|
|
20
|
+
* Required input:
|
|
21
|
+
* - `EntityName` (string) — fully-qualified entity name, e.g. "MJ: Applications".
|
|
22
|
+
*
|
|
23
|
+
* Output:
|
|
24
|
+
* - `Spec` parameter — the scaffolded `ComponentSpec` object (componentRole='form', location='embedded').
|
|
25
|
+
* - `Message` — the same object, stringified.
|
|
26
|
+
*/
|
|
27
|
+
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
28
|
+
private getStringParam;
|
|
29
|
+
}
|
|
30
|
+
/** Tree-shaking guard — called from src/index.ts. */
|
|
31
|
+
export declare function LoadGetDefaultFormScaffoldForEntityAction(): void;
|
|
32
|
+
//# sourceMappingURL=get-default-form-scaffold.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-default-form-scaffold.action.d.ts","sourceRoot":"","sources":["../../../src/custom/interactive-forms/get-default-form-scaffold.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD;;;;;;;;;;;;;;GAcG;AACH,qBACa,qCAAsC,SAAQ,UAAU;IAEjE;;;;;;;OAOG;cACa,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAsCvF,OAAO,CAAC,cAAc;CAOzB;AAMD,qDAAqD;AACrD,wBAAgB,yCAAyC,IAAI,IAAI,CAIhE"}
|
|
@@ -0,0 +1,87 @@
|
|
|
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 { buildDefaultFormScaffold } from "@memberjunction/interactive-component-types/forms";
|
|
11
|
+
/**
|
|
12
|
+
* Read-only action that produces a working form-role `ComponentSpec`
|
|
13
|
+
* scaffolded from the entity's CodeGen metadata (Category /
|
|
14
|
+
* GeneratedFormSectionType / Sequence / FK relationships / value lists).
|
|
15
|
+
*
|
|
16
|
+
* **Why this exists.** Today the Form Builder agent writes JSX from
|
|
17
|
+
* scratch every time, producing inconsistent quality. Calling this action
|
|
18
|
+
* first gives the agent a known-good baseline (mirrors the default Angular
|
|
19
|
+
* form) that it can modify per user requirements instead of inventing a
|
|
20
|
+
* layout. Far fewer lint failures, dramatically better starting point.
|
|
21
|
+
*
|
|
22
|
+
* **Pure read.** No persistence. The returned spec is intended to be
|
|
23
|
+
* modified and then passed to {@link CreateInteractiveFormAction} or
|
|
24
|
+
* {@link ModifyInteractiveFormAction}.
|
|
25
|
+
*/
|
|
26
|
+
let GetDefaultFormScaffoldForEntityAction = class GetDefaultFormScaffoldForEntityAction extends BaseAction {
|
|
27
|
+
/**
|
|
28
|
+
* Required input:
|
|
29
|
+
* - `EntityName` (string) — fully-qualified entity name, e.g. "MJ: Applications".
|
|
30
|
+
*
|
|
31
|
+
* Output:
|
|
32
|
+
* - `Spec` parameter — the scaffolded `ComponentSpec` object (componentRole='form', location='embedded').
|
|
33
|
+
* - `Message` — the same object, stringified.
|
|
34
|
+
*/
|
|
35
|
+
async InternalRunAction(params) {
|
|
36
|
+
try {
|
|
37
|
+
const entityName = this.getStringParam(params, "EntityName");
|
|
38
|
+
if (!entityName) {
|
|
39
|
+
return failure("MISSING_PARAMETER", "Parameter 'EntityName' is required.");
|
|
40
|
+
}
|
|
41
|
+
const provider = params.Provider ?? Metadata.Provider;
|
|
42
|
+
if (!provider) {
|
|
43
|
+
return failure("NO_PROVIDER", "No metadata provider available.");
|
|
44
|
+
}
|
|
45
|
+
const spec = buildDefaultFormScaffold(entityName, provider);
|
|
46
|
+
if (!spec) {
|
|
47
|
+
return failure("ENTITY_NOT_FOUND", `Entity '${entityName}' is not registered with the active metadata provider.`);
|
|
48
|
+
}
|
|
49
|
+
params.Params.push({
|
|
50
|
+
Name: "Spec",
|
|
51
|
+
Type: "Output",
|
|
52
|
+
Value: spec,
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
Success: true,
|
|
56
|
+
ResultCode: "SUCCESS",
|
|
57
|
+
Message: JSON.stringify(spec),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
62
|
+
LogError(`GetDefaultFormScaffoldForEntityAction: ${message}`);
|
|
63
|
+
return failure("UNEXPECTED_ERROR", message);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
getStringParam(params, name) {
|
|
67
|
+
const p = params.Params.find(x => x.Name?.trim().toLowerCase() === name.toLowerCase());
|
|
68
|
+
if (!p || p.Value == null)
|
|
69
|
+
return null;
|
|
70
|
+
const v = String(p.Value).trim();
|
|
71
|
+
return v.length > 0 ? v : null;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
GetDefaultFormScaffoldForEntityAction = __decorate([
|
|
75
|
+
RegisterClass(BaseAction, "__GetDefaultFormScaffoldForEntity")
|
|
76
|
+
], GetDefaultFormScaffoldForEntityAction);
|
|
77
|
+
export { GetDefaultFormScaffoldForEntityAction };
|
|
78
|
+
function failure(resultCode, message) {
|
|
79
|
+
return { Success: false, ResultCode: resultCode, Message: message };
|
|
80
|
+
}
|
|
81
|
+
/** Tree-shaking guard — called from src/index.ts. */
|
|
82
|
+
export function LoadGetDefaultFormScaffoldForEntityAction() {
|
|
83
|
+
if (false) {
|
|
84
|
+
const _ = GetDefaultFormScaffoldForEntityAction;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=get-default-form-scaffold.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-default-form-scaffold.action.js","sourceRoot":"","sources":["../../../src/custom/interactive-forms/get-default-form-scaffold.action.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,QAA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AC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,QAAQ,CAAC,0CAA0C,OAAO,EAAE,CAAC,CAAC;YAC9D,OAAO,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;QAChD,CAAC;IACL,CAAC;IAEO,cAAc,CAAC,MAAuB,EAAE,IAAY;QACxD,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;QACzD,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC;QACvC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;QACjC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACnC,CAAC;CACJ,CAAA;AAvDY,qCAAqC;IADjD,aAAa,CAAC,UAAU,EAAE,mCAAmC,CAAC;GAClD,qCAAqC,CAuDjD;;AAED,SAAS,OAAO,CAAC,UAAkB,EAAE,OAAe;IAChD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AACxE,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,yCAAyC;IACrD,IAAI,KAAgB,EAAE,CAAC;QACnB,MAAM,CAAC,GAAY,qCAAqC,CAAC;IAC7D,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
|
|
2
|
+
import { BaseAction } from "@memberjunction/actions";
|
|
3
|
+
/**
|
|
4
|
+
* Read-only action consumed by the Form Builder agent to inspect an entity's
|
|
5
|
+
* curated form-relevant schema before generating a form Component.
|
|
6
|
+
*
|
|
7
|
+
* Returns the `CuratedFormSchema` shape: FK references resolved to
|
|
8
|
+
* `{entity, displayField}`, value-list fields annotated with `allowedValues`,
|
|
9
|
+
* and audit / virtual / computed fields stripped. See
|
|
10
|
+
* `@memberjunction/interactive-component-types/forms` for the type.
|
|
11
|
+
*
|
|
12
|
+
* Output is stringified JSON in `Message` (Action framework convention) and
|
|
13
|
+
* also surfaced as a `Schema` output parameter for callers that prefer
|
|
14
|
+
* structured access.
|
|
15
|
+
*/
|
|
16
|
+
export declare class GetEntitySchemaForFormAction extends BaseAction {
|
|
17
|
+
/**
|
|
18
|
+
* Required input:
|
|
19
|
+
* - `EntityName` (string) — fully-qualified entity name, e.g. "MJ: Applications".
|
|
20
|
+
*
|
|
21
|
+
* Output:
|
|
22
|
+
* - `Schema` parameter — the `CuratedFormSchema` object.
|
|
23
|
+
* - `Message` — the same object, stringified.
|
|
24
|
+
*/
|
|
25
|
+
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
26
|
+
/** Case-insensitive trim-tolerant fetch for the EntityName param. */
|
|
27
|
+
private getEntityNameParam;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Tree-shaking guard. Imported and called from src/index.ts so bundlers
|
|
31
|
+
* don't drop the action when no consumer references it by name.
|
|
32
|
+
*/
|
|
33
|
+
export declare function LoadGetEntitySchemaForFormAction(): void;
|
|
34
|
+
//# sourceMappingURL=get-entity-schema-for-form.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-entity-schema-for-form.action.d.ts","sourceRoot":"","sources":["../../../src/custom/interactive-forms/get-entity-schema-for-form.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD;;;;;;;;;;;;GAYG;AACH,qBACa,4BAA6B,SAAQ,UAAU;IAExD;;;;;;;OAOG;cACa,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAmDvF,qEAAqE;IACrE,OAAO,CAAC,kBAAkB;CAS7B;AAED;;;GAGG;AACH,wBAAgB,gCAAgC,IAAI,IAAI,CAIvD"}
|