@memberjunction/core-entities-server 6.1.0-edge.1 → 6.1.0-edge.2

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.
@@ -6,7 +6,11 @@
6
6
  * definition is the single source of truth — editing it keeps its schedule in sync, no separate
7
7
  * Scheduled Job management.
8
8
  *
9
- * (On-change reconciliation — owning an Entity Action — is a separate follow-up; see the plan §18.)
9
+ * It also owns the **on-change** trigger the same way: `OnChangeEnabled` reconciles an Entity Action
10
+ * binding on the process's target entity, and `OnChangeFilter` compiles into that binding's Action
11
+ * Filter — which is what those two columns have always claimed to do. The substrate work lives in
12
+ * `RecordProcessOnChangeReconciler` so this class stays a dispatcher rather than growing a second
13
+ * hundred-line reconciler inside `Save()`.
10
14
  * @module @memberjunction/core-entities-server
11
15
  */
12
16
  import { EntitySaveOptions } from '@memberjunction/core';
@@ -45,8 +49,19 @@ export declare class MJRecordProcessEntityServer extends MJRecordProcessEntity {
45
49
  * save — the record itself is valid; a reconciliation error is logged for the operator.
46
50
  */
47
51
  Save(options?: EntitySaveOptions): Promise<boolean>;
48
- /** True when any field affecting the owned Scheduled Job is dirty (fast-path before save). */
49
- private scheduleFieldsDirty;
52
+ /**
53
+ * Runs one reconciliation without letting it fail the save.
54
+ *
55
+ * The record itself is valid and already persisted; a substrate error is an operator problem,
56
+ * not a reason to reject the user's edit. Each trigger is wrapped separately so a failure in one
57
+ * cannot skip the other — a process whose schedule reconciliation broke should still get its
58
+ * on-change binding.
59
+ */
60
+ private reconcileSafely;
61
+ /** True when any of the named fields is dirty (fast-path, read before the save clears them). */
62
+ private anyFieldDirty;
63
+ /** Ensures the owned Entity Action binding matches the process's on-change settings. */
64
+ private reconcileOnChangeBinding;
50
65
  /** Ensures the owned Scheduled Job matches the process's current schedule state. */
51
66
  private reconcileScheduledJob;
52
67
  /** Resolves the "Run Record Process" Scheduled Job Type ID, or throws if the seed is absent. */
@@ -1 +1 @@
1
- {"version":3,"file":"MJRec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AY;IAgB1B,yFAAyF;YAC3E,eAAe;IA4B7B,iFAAiF;YACnE,mBAAmB;CAUpC"}
@@ -6,7 +6,11 @@
6
6
  * definition is the single source of truth — editing it keeps its schedule in sync, no separate
7
7
  * Scheduled Job management.
8
8
  *
9
- * (On-change reconciliation — owning an Entity Action — is a separate follow-up; see the plan §18.)
9
+ * It also owns the **on-change** trigger the same way: `OnChangeEnabled` reconciles an Entity Action
10
+ * binding on the process's target entity, and `OnChangeFilter` compiles into that binding's Action
11
+ * Filter — which is what those two columns have always claimed to do. The substrate work lives in
12
+ * `RecordProcessOnChangeReconciler` so this class stays a dispatcher rather than growing a second
13
+ * hundred-line reconciler inside `Save()`.
10
14
  * @module @memberjunction/core-entities-server
11
15
  */
12
16
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -18,10 +22,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
18
22
  import { RegisterClass, SafeJSONParse, UUIDsEqual } from '@memberjunction/global';
19
23
  import { BaseEntity, LogError, RunView, } from '@memberjunction/core';
20
24
  import { MJRecordProcessEntity } from '@memberjunction/core-entities';
25
+ import { ReconcileRecordProcessOnChange } from './RecordProcessOnChangeReconciler.js';
21
26
  /** The `MJ: Scheduled Job Types.Name` seeded for record-process recurrence (metadata-driven). */
22
27
  const RUN_RECORD_PROCESS_JOB_TYPE = 'Run Record Process';
23
28
  /** Fields whose change can affect the owned Scheduled Job — reconcile only when one is dirty. */
24
29
  const SCHEDULE_RELEVANT_FIELDS = ['ScheduleEnabled', 'CronExpression', 'Timezone', 'Status', 'Name'];
30
+ /**
31
+ * Fields whose change can affect the owned Entity Action binding.
32
+ *
33
+ * `EntityID` is in the list because the binding is anchored to it: repointing a process at a
34
+ * different entity while its old binding still fires would leave the process running against
35
+ * records it no longer describes.
36
+ */
37
+ const ON_CHANGE_RELEVANT_FIELDS = ['OnChangeEnabled', 'OnChangeInvocationType', 'OnChangeFilter', 'Status', 'EntityID'];
25
38
  /**
26
39
  * PURE decision (exported for tests): a process owns an *active* recurrence job only when it is
27
40
  * `Active`, has `ScheduleEnabled`, and carries a non-empty `CronExpression`; otherwise the owned
@@ -48,21 +61,49 @@ let MJRecordProcessEntityServer = class MJRecordProcessEntityServer extends MJRe
48
61
  * save — the record itself is valid; a reconciliation error is logged for the operator.
49
62
  */
50
63
  async Save(options) {
51
- const shouldReconcile = !this.IsSaved || this.scheduleFieldsDirty();
64
+ // Both reads happen BEFORE the save, because saving resets every dirty flag — asking
65
+ // afterwards would report that nothing changed and reconcile nothing, forever.
66
+ const isNew = !this.IsSaved;
67
+ const reconcileSchedule = isNew || this.anyFieldDirty(SCHEDULE_RELEVANT_FIELDS);
68
+ const reconcileOnChange = isNew || this.anyFieldDirty(ON_CHANGE_RELEVANT_FIELDS);
52
69
  const saved = await super.Save(options);
53
- if (saved && shouldReconcile) {
54
- try {
55
- await this.reconcileScheduledJob();
56
- }
57
- catch (e) {
58
- LogError(`MJRecordProcessEntityServer: schedule reconciliation failed for '${this.Name}' (${this.ID}): ${e instanceof Error ? e.message : String(e)}`);
59
- }
70
+ if (!saved)
71
+ return saved;
72
+ if (reconcileSchedule) {
73
+ await this.reconcileSafely('schedule', () => this.reconcileScheduledJob());
74
+ }
75
+ if (reconcileOnChange) {
76
+ await this.reconcileSafely('on-change', () => this.reconcileOnChangeBinding());
60
77
  }
61
78
  return saved;
62
79
  }
63
- /** True when any field affecting the owned Scheduled Job is dirty (fast-path before save). */
64
- scheduleFieldsDirty() {
65
- return SCHEDULE_RELEVANT_FIELDS.some((f) => this.GetFieldByName(f)?.Dirty ?? false);
80
+ /**
81
+ * Runs one reconciliation without letting it fail the save.
82
+ *
83
+ * The record itself is valid and already persisted; a substrate error is an operator problem,
84
+ * not a reason to reject the user's edit. Each trigger is wrapped separately so a failure in one
85
+ * cannot skip the other — a process whose schedule reconciliation broke should still get its
86
+ * on-change binding.
87
+ */
88
+ async reconcileSafely(label, work) {
89
+ try {
90
+ await work();
91
+ }
92
+ catch (e) {
93
+ LogError(`MJRecordProcessEntityServer: ${label} reconciliation failed for '${this.Name}' (${this.ID}): ` +
94
+ `${e instanceof Error ? e.message : String(e)}`);
95
+ }
96
+ }
97
+ /** True when any of the named fields is dirty (fast-path, read before the save clears them). */
98
+ anyFieldDirty(fields) {
99
+ return fields.some((f) => this.GetFieldByName(f)?.Dirty ?? false);
100
+ }
101
+ /** Ensures the owned Entity Action binding matches the process's on-change settings. */
102
+ async reconcileOnChangeBinding() {
103
+ await ReconcileRecordProcessOnChange(this, {
104
+ Provider: this.ProviderToUse,
105
+ ContextUser: this.ContextCurrentUser,
106
+ });
66
107
  }
67
108
  /** Ensures the owned Scheduled Job matches the process's current schedule state. */
68
109
  async reconcileScheduledJob() {
@@ -1 +1 @@
1
- {"version":3,"file":"MJRecordProcessEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJRecordProcessEntityServer.server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;;;;;;AAEH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EACH,UAAU,EAGV,QAAQ,EACR,OAAO,GAEV,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAkD,MAAM,+BAA+B,CAAC;AAEtH,iGAAiG;AACjG,MAAM,2BAA2B,GAAG,oBAAoB,CAAC;AAEzD,iGAAiG;AACjG,MAAM,wBAAwB,GAAG,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;AAK9G;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,CAA8E;IAC/G,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,CAAC,eAAe,IAAI,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AACnG,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,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AQ,CAAC,IAAI,EAAE,CAAC;QACpC,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,sDAAsD,IAAI,CAAC,IAAI,MAAM,QAAQ,CAAC,YAAY,EAAE,eAAe,IAAI,eAAe,EAAE,CAAC,CAAC;QACtJ,CAAC;IACL,CAAC;CACJ,CAAA;AA/IY,2BAA2B;IADvC,aAAa,CAAC,UAAU,EAAE,sBAAsB,CAAC;GACrC,2BAA2B,CA+IvC"}
@@ -0,0 +1,42 @@
1
+ import { IMetadataProvider, UserInfo } from '@memberjunction/core';
2
+ import { MJRecordProcessEntity } from '@memberjunction/core-entities';
3
+ /** The Action an on-change binding dispatches to. Exists already; this only binds to it. */
4
+ export declare const RUN_RECORD_PROCESS_ACTION = "Run Record Process";
5
+ /**
6
+ * Turns the record that changed into the action's `Scope` parameter.
7
+ *
8
+ * Evaluated per-invocation as an `EntityActionParam` of ValueType `Script`, because the whole point
9
+ * of an on-change trigger is that the record differs every time — a Static value would pin the
10
+ * binding to whichever record happened to be open when it was configured.
11
+ *
12
+ * `ToConcatenatedString()` and not `ToString()`: `RecordRef.RecordID` is documented as the primary
13
+ * key "serialized to a composite-key-safe string", which is that format. `ToString()` is a display
14
+ * format and would silently fail to resolve a composite key.
15
+ */
16
+ export declare const ON_CHANGE_SCOPE_SCRIPT: string;
17
+ /**
18
+ * Whether a process should own an *active* on-change binding.
19
+ *
20
+ * Pure and exported so the decision is testable without a database. An invocation type is required
21
+ * rather than defaulted: guessing `AfterUpdate` would produce a trigger firing on an event the
22
+ * author never chose, and on the wrong one there is no error — only runs nobody expected.
23
+ */
24
+ export declare function decideOnChangeAction(p: {
25
+ status: string;
26
+ onChangeEnabled: boolean;
27
+ onChangeInvocationType: string | null;
28
+ }): 'upsert' | 'disable';
29
+ /** Everything the reconciler needs from its caller. */
30
+ export type OnChangeReconcileContext = {
31
+ Provider: IMetadataProvider;
32
+ ContextUser: UserInfo;
33
+ };
34
+ /**
35
+ * Brings a Record Process's owned Entity Action binding in line with its on-change settings.
36
+ *
37
+ * Turning the trigger off **disables** the binding rather than deleting it, matching how the
38
+ * schedule reconciler treats its owned job: the row carries the history of what this process used to
39
+ * fire on, and a trigger someone switched off by mistake should be recoverable.
40
+ */
41
+ export declare function ReconcileRecordProcessOnChange(process: MJRecordProcessEntity, context: OnChangeReconcileContext): Promise<void>;
42
+ //# sourceMappingURL=RecordProcessOnChangeReconciler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecordProcessOnChangeReconciler.d.ts","sourceRoot":"","sources":["../../src/custom/RecordProcessOnChangeReconciler.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,iBAAiB,EAAqB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EASH,qBAAqB,EACxB,MAAM,+BAA+B,CAAC;AAGvC,4FAA4F;AAC5F,eAAO,MAAM,yBAAyB,uBAAuB,CAAC;AAE9D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,QAEsD,CAAC;AAE1F;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,OAAO,CAAC;IACzB,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC,GAAG,QAAQ,GAAG,SAAS,CAEvB;AAED,uDAAuD;AACvD,MAAM,MAAM,wBAAwB,GAAG;IACnC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,WAAW,EAAE,QAAQ,CAAC;CACzB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,8BAA8B,CAChD,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,wBAAwB,GAClC,OAAO,CAAC,IAAI,CAAC,CA6Cf"}
@@ -0,0 +1,247 @@
1
+ /**
2
+ * @fileoverview Reconciles a Record Process's **on-change** trigger onto the Entity Action rows the
3
+ * save pipeline already reads.
4
+ *
5
+ * `RecordProcess.OnChangeEnabled` has described this since the column shipped — *"the process runs
6
+ * per-record on save via an owned Entity Action"* — and `OnChangeFilter` promised to *"compile into
7
+ * the owned Entity Action Filter"*. Neither owned anything: the schedule trigger reconciled and the
8
+ * change trigger was a flag that read as configured and did nothing. That is the worst shape for a
9
+ * trigger to be in, because the UI shows it enabled and no run ever appears.
10
+ *
11
+ * Split out of the entity subclass rather than added to it because the schedule reconciliation is
12
+ * already a hundred lines of the same shape and a single `Save()` override owning both would be the
13
+ * kind of method nobody can safely change. Both call sites stay in the subclass; the substrate work
14
+ * lives here.
15
+ *
16
+ * **Nothing here is new machinery.** `HandleEntityActions` has fired entity actions from the save
17
+ * pipeline all along, `Run Record Process` is an existing action, and `ActionFilter` evaluation with
18
+ * the change context landed with transition filters. What was missing was rows.
19
+ *
20
+ * @module @memberjunction/core-entities-server
21
+ */
22
+ import { BuildChangeFilterCode } from '@memberjunction/actions-base';
23
+ import { LogError, RunView } from '@memberjunction/core';
24
+ import { UUIDsEqual } from '@memberjunction/global';
25
+ /** The Action an on-change binding dispatches to. Exists already; this only binds to it. */
26
+ export const RUN_RECORD_PROCESS_ACTION = 'Run Record Process';
27
+ /**
28
+ * Turns the record that changed into the action's `Scope` parameter.
29
+ *
30
+ * Evaluated per-invocation as an `EntityActionParam` of ValueType `Script`, because the whole point
31
+ * of an on-change trigger is that the record differs every time — a Static value would pin the
32
+ * binding to whichever record happened to be open when it was configured.
33
+ *
34
+ * `ToConcatenatedString()` and not `ToString()`: `RecordRef.RecordID` is documented as the primary
35
+ * key "serialized to a composite-key-safe string", which is that format. `ToString()` is a display
36
+ * format and would silently fail to resolve a composite key.
37
+ */
38
+ export const ON_CHANGE_SCOPE_SCRIPT = "EntityActionContext.result = JSON.stringify({ Kind: 'records', " +
39
+ 'RecordIDs: [EntityActionContext.entityObject.PrimaryKey.ToConcatenatedString()] });';
40
+ /**
41
+ * Whether a process should own an *active* on-change binding.
42
+ *
43
+ * Pure and exported so the decision is testable without a database. An invocation type is required
44
+ * rather than defaulted: guessing `AfterUpdate` would produce a trigger firing on an event the
45
+ * author never chose, and on the wrong one there is no error — only runs nobody expected.
46
+ */
47
+ export function decideOnChangeAction(p) {
48
+ return p.status === 'Active' && p.onChangeEnabled && !!p.onChangeInvocationType ? 'upsert' : 'disable';
49
+ }
50
+ /**
51
+ * Brings a Record Process's owned Entity Action binding in line with its on-change settings.
52
+ *
53
+ * Turning the trigger off **disables** the binding rather than deleting it, matching how the
54
+ * schedule reconciler treats its owned job: the row carries the history of what this process used to
55
+ * fire on, and a trigger someone switched off by mistake should be recoverable.
56
+ */
57
+ export async function ReconcileRecordProcessOnChange(process, context) {
58
+ const action = decideOnChangeAction({
59
+ status: process.Status,
60
+ onChangeEnabled: process.OnChangeEnabled,
61
+ onChangeInvocationType: process.OnChangeInvocationType,
62
+ });
63
+ const existing = await findOwnedEntityAction(process, context);
64
+ if (action === 'disable') {
65
+ if (existing && existing.Status !== 'Disabled') {
66
+ existing.Status = 'Disabled';
67
+ if (!(await existing.Save())) {
68
+ throw new Error(`failed disabling the on-change binding: ${existing.LatestResult?.CompleteMessage ?? 'unknown error'}`);
69
+ }
70
+ }
71
+ return;
72
+ }
73
+ const actionRow = await resolveAction(context);
74
+ const invocationTypeID = await resolveInvocationTypeID(process.OnChangeInvocationType, context);
75
+ const binding = existing ?? await context.Provider.GetEntityObject('MJ: Entity Actions', context.ContextUser);
76
+ if (!existing) {
77
+ binding.NewRecord();
78
+ binding.EntityID = process.EntityID;
79
+ binding.ActionID = actionRow.ID;
80
+ }
81
+ binding.Status = 'Active';
82
+ if (!(await binding.Save())) {
83
+ throw new Error(`failed saving the on-change binding: ${binding.LatestResult?.CompleteMessage ?? 'unknown error'}`);
84
+ }
85
+ // The invocation type is reconciled as a set, not edited in place: switching from AfterUpdate to
86
+ // AfterCreate must leave the process firing on exactly one event. Editing the existing row would
87
+ // work; leaving the old one Active alongside a new one would double-fire, which is the failure
88
+ // this replaces rather than risks.
89
+ await reconcileInvocation(binding.ID, invocationTypeID, context);
90
+ await upsertActionParam(binding.ID, actionRow.ID, 'RecordProcessID', 'Static', process.ID, context);
91
+ await upsertActionParam(binding.ID, actionRow.ID, 'Scope', 'Script', ON_CHANGE_SCOPE_SCRIPT, context);
92
+ await reconcileFilter(binding.ID, process.OnChangeFilter, context);
93
+ }
94
+ /**
95
+ * The binding this process owns, if it has one.
96
+ *
97
+ * Matched on the `RecordProcessID` param rather than on entity + action, because `Run Record Process`
98
+ * is one shared action: every process watching a given entity would otherwise collide on the same
99
+ * pair, and reusing that row means rewriting its `RecordProcessID` — silently repointing the first
100
+ * process's trigger at the second process's definition, with the first still looking configured.
101
+ */
102
+ async function findOwnedEntityAction(process, context) {
103
+ const rv = RunView.FromMetadataProvider(context.Provider);
104
+ const candidates = await rv.RunView({
105
+ EntityName: 'MJ: Entity Actions',
106
+ ExtraFilter: `EntityID='${process.EntityID}'`,
107
+ ResultType: 'entity_object',
108
+ }, context.ContextUser);
109
+ const rows = candidates.Results ?? [];
110
+ if (rows.length === 0)
111
+ return null;
112
+ const params = await rv.RunView({
113
+ EntityName: 'MJ: Entity Action Params',
114
+ ExtraFilter: `ActionParam='RecordProcessID' AND EntityActionID IN (${rows.map((r) => `'${r.ID}'`).join(',')})`,
115
+ ResultType: 'entity_object',
116
+ }, context.ContextUser);
117
+ const mine = (params.Results ?? []).find((p) => p.Value != null && UUIDsEqual(p.Value, process.ID));
118
+ return mine ? rows.find((r) => UUIDsEqual(r.ID, mine.EntityActionID)) ?? null : null;
119
+ }
120
+ /** Resolves the `Run Record Process` action, or says plainly that the seed is missing. */
121
+ async function resolveAction(context) {
122
+ const result = await RunView.FromMetadataProvider(context.Provider).RunView({ EntityName: 'MJ: Actions', ExtraFilter: `Name='${RUN_RECORD_PROCESS_ACTION}'`, ResultType: 'entity_object' }, context.ContextUser);
123
+ const action = result.Results?.[0];
124
+ if (!action) {
125
+ throw new Error(`the '${RUN_RECORD_PROCESS_ACTION}' action is not present — has the metadata seed been pushed?`);
126
+ }
127
+ return action;
128
+ }
129
+ /** Resolves the invocation type the process named. */
130
+ async function resolveInvocationTypeID(name, context) {
131
+ const result = await RunView.FromMetadataProvider(context.Provider).RunView({ EntityName: 'MJ: Entity Action Invocation Types', ExtraFilter: `Name='${name}'`, ResultType: 'simple' }, context.ContextUser);
132
+ const row = result.Results?.[0];
133
+ if (!row)
134
+ throw new Error(`entity action invocation type '${name}' is not seeded`);
135
+ return row.ID;
136
+ }
137
+ /** Makes the named invocation the only active one on this binding. */
138
+ async function reconcileInvocation(entityActionID, invocationTypeID, context) {
139
+ const result = await RunView.FromMetadataProvider(context.Provider).RunView({
140
+ EntityName: 'MJ: Entity Action Invocations',
141
+ ExtraFilter: `EntityActionID='${entityActionID}'`,
142
+ ResultType: 'entity_object',
143
+ }, context.ContextUser);
144
+ let found = false;
145
+ for (const row of result.Results ?? []) {
146
+ const wanted = UUIDsEqual(row.InvocationTypeID, invocationTypeID);
147
+ found ||= wanted;
148
+ const status = wanted ? 'Active' : 'Disabled';
149
+ if (row.Status !== status) {
150
+ row.Status = status;
151
+ if (!(await row.Save())) {
152
+ LogError(`RecordProcess on-change: could not set invocation ${row.ID} to ${status}: ` +
153
+ `${row.LatestResult?.CompleteMessage ?? 'unknown error'}`);
154
+ }
155
+ }
156
+ }
157
+ if (found)
158
+ return;
159
+ const row = await context.Provider.GetEntityObject('MJ: Entity Action Invocations', context.ContextUser);
160
+ row.NewRecord();
161
+ row.EntityActionID = entityActionID;
162
+ row.InvocationTypeID = invocationTypeID;
163
+ row.Status = 'Active';
164
+ if (!(await row.Save())) {
165
+ throw new Error(`failed creating the on-change invocation: ${row.LatestResult?.CompleteMessage ?? 'unknown error'}`);
166
+ }
167
+ }
168
+ /** Finds or creates one Entity Action Param binding for the on-change trigger. */
169
+ async function upsertActionParam(entityActionID, actionID, paramName, valueType, value, context) {
170
+ const rv = RunView.FromMetadataProvider(context.Provider);
171
+ const paramResult = await rv.RunView({
172
+ EntityName: 'MJ: Action Params',
173
+ ExtraFilter: `ActionID='${actionID}' AND Name='${paramName}'`,
174
+ ResultType: 'entity_object',
175
+ }, context.ContextUser);
176
+ const actionParam = paramResult.Results?.[0];
177
+ if (!actionParam) {
178
+ throw new Error(`the '${RUN_RECORD_PROCESS_ACTION}' action has no ${paramName} parameter to bind`);
179
+ }
180
+ const existingResult = await rv.RunView({
181
+ EntityName: 'MJ: Entity Action Params',
182
+ ExtraFilter: `EntityActionID='${entityActionID}' AND ActionParamID='${actionParam.ID}'`,
183
+ ResultType: 'entity_object',
184
+ }, context.ContextUser);
185
+ const existing = existingResult.Results?.[0];
186
+ const row = existing ?? await context.Provider.GetEntityObject('MJ: Entity Action Params', context.ContextUser);
187
+ if (!existing)
188
+ row.NewRecord();
189
+ row.EntityActionID = entityActionID;
190
+ row.ActionParamID = actionParam.ID;
191
+ row.ValueType = valueType;
192
+ row.Value = value;
193
+ if (!(await row.Save())) {
194
+ throw new Error(`failed binding ${paramName} to the on-change trigger: ${row.LatestResult?.CompleteMessage ?? 'unknown error'}`);
195
+ }
196
+ }
197
+ /**
198
+ * Compiles `OnChangeFilter` into the owned Action Filter, exactly as the column documents.
199
+ *
200
+ * Shares `BuildChangeFilterCode` with the workflow trigger, so `DidFieldChangeToValue('Status',
201
+ * 'Approved')` means the same thing in both places — a user who learned one surface has learned the
202
+ * other. Clearing the filter disables the binding rather than deleting the row, so the expression
203
+ * survives a mis-click.
204
+ */
205
+ async function reconcileFilter(entityActionID, filter, context) {
206
+ const rv = RunView.FromMetadataProvider(context.Provider);
207
+ const bindingResult = await rv.RunView({
208
+ EntityName: 'MJ: Entity Action Filters',
209
+ ExtraFilter: `EntityActionID='${entityActionID}'`,
210
+ OrderBy: 'Sequence ASC',
211
+ ResultType: 'entity_object',
212
+ }, context.ContextUser);
213
+ const binding = bindingResult.Results?.[0] ?? null;
214
+ const expression = filter?.trim() ?? '';
215
+ if (!expression) {
216
+ if (binding && binding.Status !== 'Disabled') {
217
+ binding.Status = 'Disabled';
218
+ if (!(await binding.Save())) {
219
+ throw new Error(`failed clearing the on-change filter: ${binding.LatestResult?.CompleteMessage ?? 'unknown error'}`);
220
+ }
221
+ }
222
+ return;
223
+ }
224
+ const filterRow = await context.Provider.GetEntityObject('MJ: Action Filters', context.ContextUser);
225
+ if (!binding?.ActionFilterID || !(await filterRow.Load(binding.ActionFilterID))) {
226
+ filterRow.NewRecord();
227
+ }
228
+ filterRow.Code = BuildChangeFilterCode(expression);
229
+ filterRow.UserDescription = expression;
230
+ filterRow.CodeExplanation =
231
+ "Generated from a Record Process's OnChangeFilter. Evaluated against the record change that fired the " +
232
+ 'trigger; the process runs for that record only when it is true.';
233
+ if (!(await filterRow.Save())) {
234
+ throw new Error(`failed saving the on-change filter: ${filterRow.LatestResult?.CompleteMessage ?? 'unknown error'}`);
235
+ }
236
+ const row = binding ?? await context.Provider.GetEntityObject('MJ: Entity Action Filters', context.ContextUser);
237
+ if (!binding)
238
+ row.NewRecord();
239
+ row.EntityActionID = entityActionID;
240
+ row.ActionFilterID = filterRow.ID;
241
+ row.Sequence = 1;
242
+ row.Status = 'Active';
243
+ if (!(await row.Save())) {
244
+ throw new Error(`failed binding the on-change filter: ${row.LatestResult?.CompleteMessage ?? 'unknown error'}`);
245
+ }
246
+ }
247
+ //# sourceMappingURL=RecordProcessOnChangeReconciler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecordProcessOnChangeReconciler.js","sourceRoot":"","sources":["../../src/custom/RecordProcessOnChangeReconciler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAqB,QAAQ,EAAE,OAAO,EAAY,MAAM,sBAAsB,CAAC;AAYtF,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,4FAA4F;AAC5F,MAAM,CAAC,MAAM,yBAAyB,GAAG,oBAAoB,CAAC;AAE9D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MA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UAAU,CAAC;IACvC,SAAS,CAAC,eAAe;QACrB,uGAAuG;YACvG,iEAAiE,CAAC;IACtE,IAAI,CAAC,CAAC,MAAM,SAAS,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,uCAAuC,SAAS,CAAC,YAAY,EAAE,eAAe,IAAI,eAAe,EAAE,CAAC,CAAC;IACzH,CAAC;IAED,MAAM,GAAG,GAAG,OAAO,IAAI,MAAM,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA6B,2BAA2B,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC5I,IAAI,CAAC,OAAO;QAAE,GAAG,CAAC,SAAS,EAAE,CAAC;IAC9B,GAAG,CAAC,cAAc,GAAG,cAAc,CAAC;IACpC,GAAG,CAAC,cAAc,GAAG,SAAS,CAAC,EAAE,CAAC;IAClC,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC;IACjB,GAAG,CAAC,MAAM,GAAG,QAAQ,CAAC;IACtB,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,wCAAwC,GAAG,CAAC,YAAY,EAAE,eAAe,IAAI,eAAe,EAAE,CAAC,CAAC;IACpH,CAAC;AACL,CAAC"}
package/dist/index.d.ts CHANGED
@@ -21,6 +21,7 @@ export * from './custom/MJTagEntityServer.server.js';
21
21
  export * from './custom/MJSearchScopeEntityServer.server.js';
22
22
  export * from './custom/MJTagScopeEntityServer.server.js';
23
23
  export * from './custom/MJRecordProcessEntityServer.server.js';
24
+ export * from './custom/RecordProcessOnChangeReconciler.js';
24
25
  export * from './custom/MJCompanyIntegrationEntityServer.server.js';
25
26
  export * from './custom/MJAIAgentEntityServer.server.js';
26
27
  export * from './custom/MJAIAgentCoAgentEntityServer.server.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"A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C;AACrE,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,eAAe,CAAC;AAE9B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yCAAyC,CAAC;AAAA,cAAc,+CAA+C,CAAC"}
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ export * from './custom/MJTagEntityServer.server.js';
21
21
  export * from './custom/MJSearchScopeEntityServer.server.js';
22
22
  export * from './custom/MJTagScopeEntityServer.server.js';
23
23
  export * from './custom/MJRecordProcessEntityServer.server.js';
24
+ export * from './custom/RecordProcessOnChangeReconciler.js';
24
25
  export * from './custom/MJCompanyIntegrationEntityServer.server.js';
25
26
  export * from './custom/MJAIAgentEntityServer.server.js';
26
27
  export * from './custom/MJAIAgentCoAgentEntityServer.server.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC;AACvD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,kDAAkD,CAAC;AACjE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qCAAqC,CAAC;AACpD,cAAc,wCAAwC,CAAC;AACvD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,wCAAwC,CAAC;AACvD,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,yCAAyC,CAAC;AACxD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mCAAmC,CAAC;AAClD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wCAAwC,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D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mCAAmC,CAAC;AAClD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wCAAwC,CAAC;AACvD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,0CAA0C,CAAC;AACzD,cAAc,kDAAkD,CAAC;AACjE,cAAc,uCAAuC,CAAC;AACtD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,qDAAqD,CAAC;AACpE,cAAc,uDAAuD,CAAC;AACtE,cAAc,oDAAoD,CAAC;AACnE,cAAc,+DAA+D,CAAC;AAC9E,cAAc,uDAAuD,CAAC;AACtE,cAAc,iDAAiD,CAAC;AAChE,cAAc,uCAAuC,CAAC;AACtD,cAAc,kDAAkD,CAAC;AACjE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,oDAAoD,CAAC;AACnE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mDAAmD,CAAC;AAClE,cAAc,sDAAsD,CAAC;AACrE,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,eAAe,CAAC;AAE9B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yCAAyC,CAAC;AAAA,cAAc,+CAA+C,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@memberjunction/core-entities-server",
3
3
  "type": "module",
4
- "version": "6.1.0-edge.1",
4
+ "version": "6.1.0-edge.2",
5
5
  "description": "Entity subclasses for the metadata layer of MemberJunction that are only used on server side applications like MJAPI, distributed as part of each release of MemberJunction",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -15,30 +15,30 @@
15
15
  "typescript": "^5.9.3"
16
16
  },
17
17
  "dependencies": {
18
- "@memberjunction/actions-base": "6.1.0-edge.1",
19
- "@memberjunction/ai": "6.1.0-edge.1",
20
- "@memberjunction/ai-core-plus": "6.1.0-edge.1",
21
- "@memberjunction/ai-engine-base": "6.1.0-edge.1",
22
- "@memberjunction/ai-prompts": "6.1.0-edge.1",
23
- "@memberjunction/ai-provider-bundle": "6.1.0-edge.1",
24
- "@memberjunction/ai-vector-dupe": "6.1.0-edge.1",
25
- "@memberjunction/ai-vectordb": "6.1.0-edge.1",
26
- "@memberjunction/ai-vectors-memory": "6.1.0-edge.1",
27
- "@memberjunction/aiengine": "6.1.0-edge.1",
28
- "@memberjunction/core": "6.1.0-edge.1",
29
- "@memberjunction/core-entities": "6.1.0-edge.1",
30
- "@memberjunction/predictive-studio-core": "6.1.0-edge.1",
31
- "@memberjunction/doc-utils": "6.1.0-edge.1",
32
- "@memberjunction/generic-database-provider": "6.1.0-edge.1",
33
- "@memberjunction/global": "6.1.0-edge.1",
34
- "@memberjunction/integration-engine": "6.1.0-edge.1",
35
- "@memberjunction/integration-pk-classifier": "6.1.0-edge.1",
36
- "@memberjunction/scheduling-engine": "6.1.0-edge.1",
37
- "@memberjunction/sql-converter": "6.1.0-edge.1",
38
- "@memberjunction/sql-dialect": "6.1.0-edge.1",
39
- "@memberjunction/sql-parser": "6.1.0-edge.1",
40
- "@memberjunction/sqlserver-dataprovider": "6.1.0-edge.1",
41
- "@memberjunction/tag-engine": "6.1.0-edge.1",
18
+ "@memberjunction/actions-base": "6.1.0-edge.2",
19
+ "@memberjunction/ai": "6.1.0-edge.2",
20
+ "@memberjunction/ai-core-plus": "6.1.0-edge.2",
21
+ "@memberjunction/ai-engine-base": "6.1.0-edge.2",
22
+ "@memberjunction/ai-prompts": "6.1.0-edge.2",
23
+ "@memberjunction/ai-provider-bundle": "6.1.0-edge.2",
24
+ "@memberjunction/ai-vector-dupe": "6.1.0-edge.2",
25
+ "@memberjunction/ai-vectordb": "6.1.0-edge.2",
26
+ "@memberjunction/ai-vectors-memory": "6.1.0-edge.2",
27
+ "@memberjunction/aiengine": "6.1.0-edge.2",
28
+ "@memberjunction/core": "6.1.0-edge.2",
29
+ "@memberjunction/core-entities": "6.1.0-edge.2",
30
+ "@memberjunction/predictive-studio-core": "6.1.0-edge.2",
31
+ "@memberjunction/doc-utils": "6.1.0-edge.2",
32
+ "@memberjunction/generic-database-provider": "6.1.0-edge.2",
33
+ "@memberjunction/global": "6.1.0-edge.2",
34
+ "@memberjunction/integration-engine": "6.1.0-edge.2",
35
+ "@memberjunction/integration-pk-classifier": "6.1.0-edge.2",
36
+ "@memberjunction/scheduling-engine": "6.1.0-edge.2",
37
+ "@memberjunction/sql-converter": "6.1.0-edge.2",
38
+ "@memberjunction/sql-dialect": "6.1.0-edge.2",
39
+ "@memberjunction/sql-parser": "6.1.0-edge.2",
40
+ "@memberjunction/sqlserver-dataprovider": "6.1.0-edge.2",
41
+ "@memberjunction/tag-engine": "6.1.0-edge.2",
42
42
  "nunjucks": "3.2.4",
43
43
  "rxjs": "~7.8.1",
44
44
  "zod": "^3.25.0"