@memberjunction/actions-base 6.1.0-edge.1 → 6.1.0-edge.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +180 -4
- package/dist/ActionEngine-Base.d.ts +23 -0
- package/dist/ActionEngine-Base.d.ts.map +1 -1
- package/dist/ActionEngine-Base.js.map +1 -1
- package/dist/DurableEntityActionSubmitter.d.ts +107 -0
- package/dist/DurableEntityActionSubmitter.d.ts.map +1 -0
- package/dist/DurableEntityActionSubmitter.js +36 -0
- package/dist/DurableEntityActionSubmitter.js.map +1 -0
- package/dist/EntityActionEngine-Base.d.ts +12 -0
- package/dist/EntityActionEngine-Base.d.ts.map +1 -1
- package/dist/EntityActionEngine-Base.js.map +1 -1
- package/dist/EntityChangeContext.d.ts +107 -0
- package/dist/EntityChangeContext.d.ts.map +1 -0
- package/dist/EntityChangeContext.js +153 -0
- package/dist/EntityChangeContext.js.map +1 -0
- package/dist/__tests__/EntityChangeContext.test.d.ts +2 -0
- package/dist/__tests__/EntityChangeContext.test.d.ts.map +1 -0
- package/dist/__tests__/EntityChangeContext.test.js +132 -0
- package/dist/__tests__/EntityChangeContext.test.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/LICENSE
CHANGED
|
@@ -1,7 +1,183 @@
|
|
|
1
|
-
|
|
1
|
+
Business Source License 1.1
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
License text copyright (c) 2024 MariaDB plc, All Rights Reserved.
|
|
4
|
+
"Business Source License" is a trademark of MariaDB plc.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
-----------------------------------------------------------------------------
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
Parameters
|
|
9
|
+
|
|
10
|
+
Licensor: Blue Cypress, Inc.
|
|
11
|
+
|
|
12
|
+
Licensed Work: MemberJunction.
|
|
13
|
+
The Licensed Work is (c) 2023-2026 Blue Cypress, Inc.
|
|
14
|
+
|
|
15
|
+
Additional Use Grant: Subject to the terms of this License, Licensor grants
|
|
16
|
+
you the following additional rights to make Production
|
|
17
|
+
Use of the Licensed Work.
|
|
18
|
+
|
|
19
|
+
1. Internal Use
|
|
20
|
+
|
|
21
|
+
You may make production use of the Licensed Work for
|
|
22
|
+
your own internal business or organizational operations.
|
|
23
|
+
|
|
24
|
+
2. Nonprofit Use
|
|
25
|
+
|
|
26
|
+
If you are a Nonprofit, you may make production use of
|
|
27
|
+
the Licensed Work for the operations and activities of
|
|
28
|
+
your Organizational Family.
|
|
29
|
+
|
|
30
|
+
3. MemberJunction Certified Program Use
|
|
31
|
+
|
|
32
|
+
If you are authorized by Licensor under the
|
|
33
|
+
MemberJunction Certified Program to provide professional
|
|
34
|
+
services using the Licensed Work, you may make
|
|
35
|
+
production use of the Licensed Work in providing such
|
|
36
|
+
professional services to a client, provided that:
|
|
37
|
+
|
|
38
|
+
(a) the Licensed Work is deployed in, and the applicable
|
|
39
|
+
production use occurs within, an environment owned,
|
|
40
|
+
leased, licensed, subscribed to, or otherwise controlled
|
|
41
|
+
by that client; and
|
|
42
|
+
|
|
43
|
+
(b) the production use is for that client's own internal
|
|
44
|
+
business or organizational operations or is otherwise
|
|
45
|
+
independently permitted to that client under this
|
|
46
|
+
Additional Use Grant.
|
|
47
|
+
|
|
48
|
+
4. Definitions Applicable to the Additional Use Grant
|
|
49
|
+
|
|
50
|
+
"Affiliate" means, with respect to a specified Person,
|
|
51
|
+
any other Person that directly or indirectly Controls,
|
|
52
|
+
is Controlled by, or is under common Control with such
|
|
53
|
+
specified Person.
|
|
54
|
+
|
|
55
|
+
"Control" (including the terms "Controls," "Controlled
|
|
56
|
+
by," and "under common Control with") means the direct
|
|
57
|
+
or indirect possession of the power to direct or cause
|
|
58
|
+
the direction of the management and policies of a
|
|
59
|
+
Person, whether through ownership of voting interests,
|
|
60
|
+
by contract, or otherwise.
|
|
61
|
+
|
|
62
|
+
"Organizational Family" means, with respect to a Person,
|
|
63
|
+
(a) such Person and its Affiliates, and (b) any
|
|
64
|
+
nonprofit organization, governmental entity, chapter,
|
|
65
|
+
division, local affiliate, regional affiliate, state
|
|
66
|
+
affiliate, national affiliate, or other entity that is
|
|
67
|
+
formally affiliated with such Person through governing
|
|
68
|
+
documents, a charter, bylaws, a membership agreement, or
|
|
69
|
+
another written organizational instrument, and is
|
|
70
|
+
recognized under such documents as part of the same
|
|
71
|
+
organizational structure.
|
|
72
|
+
|
|
73
|
+
"Nonprofit" means a Person recognized by the Internal
|
|
74
|
+
Revenue Service as exempt from federal income taxation
|
|
75
|
+
under Section 501(c)(3), 501(c)(4), 501(c)(5), or
|
|
76
|
+
501(c)(6) of the Internal Revenue Code, or a foreign
|
|
77
|
+
organization recognized under substantially equivalent
|
|
78
|
+
laws.
|
|
79
|
+
|
|
80
|
+
A Person claiming eligibility as a Nonprofit shall, upon
|
|
81
|
+
Licensor's reasonable request, provide documentation
|
|
82
|
+
reasonably sufficient to demonstrate that it qualifies
|
|
83
|
+
as a Nonprofit. If such Person materially misrepresents,
|
|
84
|
+
or is unable to demonstrate, its qualification as a
|
|
85
|
+
Nonprofit, the rights granted to such Person under
|
|
86
|
+
Section 2 of this Additional Use Grant shall terminate.
|
|
87
|
+
|
|
88
|
+
"MemberJunction Certified Program" means Licensor's
|
|
89
|
+
then-current program for certifying and authorizing a
|
|
90
|
+
Person to provide professional services using the
|
|
91
|
+
Licensed Work.
|
|
92
|
+
|
|
93
|
+
"Person" means any individual, corporation, limited
|
|
94
|
+
liability company, partnership, association, nonprofit
|
|
95
|
+
organization, governmental entity, or other legal or
|
|
96
|
+
organizational entity.
|
|
97
|
+
|
|
98
|
+
Change Date: Four (4) years from the date the Licensed Work is first
|
|
99
|
+
made available.
|
|
100
|
+
|
|
101
|
+
Change License: MIT License.
|
|
102
|
+
|
|
103
|
+
For information about alternative licensing arrangements for the Licensed
|
|
104
|
+
Work, please contact Blue Cypress, Inc.
|
|
105
|
+
|
|
106
|
+
-----------------------------------------------------------------------------
|
|
107
|
+
|
|
108
|
+
Terms
|
|
109
|
+
|
|
110
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
111
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
112
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
113
|
+
production use.
|
|
114
|
+
|
|
115
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
116
|
+
available distribution of a specific version of the Licensed Work under this
|
|
117
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
118
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
119
|
+
above terminate.
|
|
120
|
+
|
|
121
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
122
|
+
currently in effect as described in this License, you must purchase a
|
|
123
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
124
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
125
|
+
|
|
126
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
127
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
128
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
129
|
+
for each version of the Licensed Work released by Licensor.
|
|
130
|
+
|
|
131
|
+
You must conspicuously display this License on each original or modified copy
|
|
132
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
133
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
134
|
+
License apply to your use of that work.
|
|
135
|
+
|
|
136
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
137
|
+
terminate your rights under this License for the current and all other
|
|
138
|
+
versions of the Licensed Work.
|
|
139
|
+
|
|
140
|
+
This License does not grant you any right in any trademark or logo of
|
|
141
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
142
|
+
Licensor as expressly required by this License).
|
|
143
|
+
|
|
144
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
145
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
146
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
147
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
148
|
+
TITLE.
|
|
149
|
+
|
|
150
|
+
MariaDB hereby grants you permission to use this License's text to license
|
|
151
|
+
your works, and to refer to it using the trademark "Business Source License",
|
|
152
|
+
as long as you comply with the Covenants of Licensor below.
|
|
153
|
+
|
|
154
|
+
-----------------------------------------------------------------------------
|
|
155
|
+
|
|
156
|
+
Covenants of Licensor
|
|
157
|
+
|
|
158
|
+
In consideration of the right to use this License's text and the "Business
|
|
159
|
+
Source License" name and trademark, Licensor covenants to MariaDB, and to all
|
|
160
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
161
|
+
|
|
162
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
163
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
164
|
+
where "compatible" means that software provided under the Change License
|
|
165
|
+
can be included in a program with software provided under GPL Version 2.0
|
|
166
|
+
or a later version. Licensor may specify additional Change Licenses without
|
|
167
|
+
limitation.
|
|
168
|
+
|
|
169
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
170
|
+
impose any additional restriction on the right granted in this License, as
|
|
171
|
+
the Additional Use Grant; or (b) insert the text "None".
|
|
172
|
+
|
|
173
|
+
3. To specify a Change Date.
|
|
174
|
+
|
|
175
|
+
4. Not to modify this License in any other way.
|
|
176
|
+
|
|
177
|
+
-----------------------------------------------------------------------------
|
|
178
|
+
|
|
179
|
+
Notice
|
|
180
|
+
|
|
181
|
+
The Business Source License (this document, or the "License") is not an Open
|
|
182
|
+
Source license. However, the Licensed Work will eventually be made available
|
|
183
|
+
under an Open Source License, as stated in this License.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseEngine, IMetadataProvider, UserInfo } from "@memberjunction/core";
|
|
2
|
+
import { EntityChangeContext } from './EntityChangeContext.js';
|
|
2
3
|
import { MJActionCategoryEntity, MJActionEntity, MJActionExecutionLogEntity, MJActionFilterEntity, MJActionLibraryEntity, MJActionParamEntity, MJActionResultCodeEntity, MJEntityActionEntity, MJEntityActionParamEntity } from "@memberjunction/core-entities";
|
|
3
4
|
import { MJActionEntityExtended } from "./MJActionEntityExtended.js";
|
|
4
5
|
export declare class ActionLibrary {
|
|
@@ -243,6 +244,28 @@ export declare class RunActionParams<TContext = any> {
|
|
|
243
244
|
* Optional, the input and output parameters as defined in the metadata for the action.
|
|
244
245
|
*/
|
|
245
246
|
Params: ActionParam[];
|
|
247
|
+
/**
|
|
248
|
+
* What changed about the record, when this run was dispatched by an entity action.
|
|
249
|
+
*
|
|
250
|
+
* Present only on the entity-action path — a directly invoked action has no record transition to
|
|
251
|
+
* describe. This is what makes a *transition* filter possible ("when Status becomes Approved"),
|
|
252
|
+
* as opposed to a state filter over current values, which was all a filter could see before.
|
|
253
|
+
*/
|
|
254
|
+
EntityChange?: EntityChangeContext;
|
|
255
|
+
/**
|
|
256
|
+
* When set, replaces *executing* the action — after validation and filters have passed.
|
|
257
|
+
*
|
|
258
|
+
* The seam durable dispatch hangs on. Submitting the work before this point would hand it over
|
|
259
|
+
* without the scope check and without the binding's filters ever running, so a scoped durable
|
|
260
|
+
* trigger would fire for every record and a filtered one on every save. Deferring *here* means
|
|
261
|
+
* the two paths share one gate: whatever decides an inline run should happen decides a durable
|
|
262
|
+
* one should be submitted.
|
|
263
|
+
*
|
|
264
|
+
* **Returning `null` declines the deferral** and the action executes normally. That is what makes
|
|
265
|
+
* the fallback free: a handoff that could not be completed becomes an ordinary run rather than
|
|
266
|
+
* requiring the deferral to reimplement execution.
|
|
267
|
+
*/
|
|
268
|
+
DeferExecution?: (params: RunActionParams) => Promise<ActionResultSimple | null>;
|
|
246
269
|
/**
|
|
247
270
|
* Optional context object that provides runtime-specific information to the action.
|
|
248
271
|
* This context is separate from the action parameters and is not stored in the database.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionEngine-Base.d.ts","sourceRoot":"","sources":["../src/ActionEngine-Base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,QAAQ,EAAqC,MAAM,sBAAsB,CAAC;AAClH,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAChQ,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,qBAAa,aAAa;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,aAAa;IACtB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,aAAa,EAAE,aAAa,EAAE,CAAC;IAC/B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,WAAW;IACxB,4DAA4D;IAC5D,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,IAAI,EAAE,aAAa,GAAG,YAAY,GAAG,SAAS,GAAG,YAAY,CAAC;IAC9D;;;;;;OAMG;IACH,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;CACpD;AAED;;GAEG;AAEH,qBAAa,kBAAkB;IAC5B;;OAEG;IACI,OAAO,EAAE,OAAO,CAAC;IAExB;;OAEG;IACI,UAAU,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACI,MAAM,CAAC,EAAE,WAAW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,EAAE,gBAAgB,EAAE,MAAM,GAAG,OAAO;IAmB/E;;;;OAIG;IACI,YAAY,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO;IAO5D;;;;OAIG;IACI,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAOxD;;;;OAIG;IACI,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,sBAAsB,GAAG,SAAS;IAO9E;;;;OAIG;cACa,cAAc,CAAC,QAAQ,GAAG,GAAG,EAAE,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;CAGrG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionEngine-Base.js","sourceRoot":"","sources":["../src/ActionEngine-Base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA+B,OAAO,EAA4B,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ActionEngine-Base.js","sourceRoot":"","sources":["../src/ActionEngine-Base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA+B,OAAO,EAA4B,MAAM,sBAAsB,CAAC;AAMlH,MAAM,OAAO,aAAa;CAGzB;AAED;;GAEG;AACH,MAAM,OAAO,aAAa;CAqBzB;AA8CD;;GAEG;AAEH,MAAM,OAAO,kBAAkB;CA4B9B;AAED;;GAEG;AACH,MAAM,OAAO,YAAY;CAoCxB;AAED;;GAEG;AACH,MAAM,OAAO,WAAW;CAavB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,0BAA0B;CAkCtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,OAAO,eAAe;CA6G3B;AAAA,CAAC;AAGF;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,UAA4B;IAAlE;;QACW,yBAAoB,GAAG,sCAAsC,CAAC,CAAC,iEAAiE;QAc/H,qBAAgB,GAA4B,EAAE,CAAC;IAiL3D,CAAC;IA7L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QAC3C,IAAI,CAAC,UAAU,EAAE,CAAC;YACf,OAAO,KAAK,CAAC;QAChB,CAAC;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAC7E,CAAC;IAED;;;;OAIG;IACI,eAAe,CAAC,UAAkB;QACtC,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACjD,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;IAClG,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,cAAc,CAAiB,MAAiC;QAC7E,OAAO,IAAI,CAAC;IACf,CAAC;CACH"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The seam that lets an `After*` entity action run durably.
|
|
3
|
+
*
|
|
4
|
+
* **Why a seam and not a call.** After-hooks are dispatched by `GenericDatabaseProvider`, which sits
|
|
5
|
+
* near the bottom of the dependency graph — every consumer of the entity layer loads it. The durable
|
|
6
|
+
* substrate (`@memberjunction/task-graph`) sits well above it, holding the dispatcher, the claim
|
|
7
|
+
* protocol and the entity layer itself. Importing one from the other would invert the graph and drag
|
|
8
|
+
* durable execution into every context that merely saves a record, including DB-less unit tests. So
|
|
9
|
+
* the provider depends on this interface, the host registers an implementation at boot, and a host
|
|
10
|
+
* that registers nothing simply keeps today's inline behaviour.
|
|
11
|
+
*
|
|
12
|
+
* **Why durability is opt-in.** It costs a Task row per dispatch, a dispatcher hop of latency, and
|
|
13
|
+
* it persists the action's parameters at rest. Charging every After* binding on every installation
|
|
14
|
+
* for that would be a large, silent change to systems that never asked for it — so
|
|
15
|
+
* `EntityAction.RunMode` defaults to `Inline` and an operator opts a binding in.
|
|
16
|
+
*
|
|
17
|
+
* @module @memberjunction/actions-base
|
|
18
|
+
*/
|
|
19
|
+
import { UserInfo } from '@memberjunction/core';
|
|
20
|
+
import { BaseSingleton } from '@memberjunction/global';
|
|
21
|
+
/** One durable dispatch: which binding, on which record, with what already-redacted inputs. */
|
|
22
|
+
export type DurableEntityActionRequest = {
|
|
23
|
+
/** The `MJ: Entity Actions` binding that fired. */
|
|
24
|
+
EntityActionID: string;
|
|
25
|
+
/** The action it dispatches to — resolved here so the submitter needs no metadata lookup. */
|
|
26
|
+
ActionID: string;
|
|
27
|
+
/** Human-readable name of that action, used for the task's name. */
|
|
28
|
+
ActionName: string;
|
|
29
|
+
/** The entity whose save fired this. */
|
|
30
|
+
EntityID: string;
|
|
31
|
+
/** Name of that entity, for a task description a person can read. */
|
|
32
|
+
EntityName: string;
|
|
33
|
+
/** The record, in MJ's canonical serialized form (`ToConcatenatedString()`). */
|
|
34
|
+
RecordID: string;
|
|
35
|
+
/** Which lifecycle event fired — `AfterCreate` / `AfterUpdate` / `AfterDelete`. */
|
|
36
|
+
InvocationType: string;
|
|
37
|
+
/**
|
|
38
|
+
* The action's input parameters, **already redacted**.
|
|
39
|
+
*
|
|
40
|
+
* Typed as JSON-safe rather than as `ActionParam[]` deliberately: `Task.InputPayload` is
|
|
41
|
+
* persistent, user-visible storage, and the #3408 §5.7 invariant is that no path writes a raw
|
|
42
|
+
* `ActionParam[]` there. Taking the redacted shape at the boundary is what makes violating it
|
|
43
|
+
* require changing this type rather than forgetting a call.
|
|
44
|
+
*/
|
|
45
|
+
RedactedParams: Record<string, unknown>;
|
|
46
|
+
ContextUser: UserInfo;
|
|
47
|
+
};
|
|
48
|
+
/** What came of a durable submission. */
|
|
49
|
+
export type DurableEntityActionSubmission = {
|
|
50
|
+
Success: boolean;
|
|
51
|
+
/** The parent task row representing the graph, when one was created. */
|
|
52
|
+
ParentTaskID?: string;
|
|
53
|
+
ErrorMessage?: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Submits one entity-action dispatch as durable work.
|
|
57
|
+
*
|
|
58
|
+
* Implemented by the host over `TaskGraphService.Submit` — per D14, "run this action durably with
|
|
59
|
+
* retry" is a single-node durable graph, not a new queue.
|
|
60
|
+
*/
|
|
61
|
+
export type DurableEntityActionSubmitter = {
|
|
62
|
+
Submit(request: DurableEntityActionRequest): Promise<DurableEntityActionSubmission>;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Where the host registers its submitter, and where the dispatch path looks for one.
|
|
66
|
+
*
|
|
67
|
+
* A `BaseSingleton` rather than a module-level variable because bundlers duplicate modules across
|
|
68
|
+
* execution paths: a plain `let` would give the registering host and the reading provider two
|
|
69
|
+
* different slots, and durability would appear configured while every dispatch silently ran inline.
|
|
70
|
+
*/
|
|
71
|
+
export declare class DurableEntityActionRegistry extends BaseSingleton<DurableEntityActionRegistry> {
|
|
72
|
+
private _submitter;
|
|
73
|
+
protected constructor();
|
|
74
|
+
static get Instance(): DurableEntityActionRegistry;
|
|
75
|
+
/** Registers the host's durable submitter. Called once at boot. */
|
|
76
|
+
Register(submitter: DurableEntityActionSubmitter): void;
|
|
77
|
+
/**
|
|
78
|
+
* The registered submitter, or null on a host that has none.
|
|
79
|
+
*
|
|
80
|
+
* Null is an ordinary answer, not an error: a CLI, a test, or a client-side provider has no
|
|
81
|
+
* dispatcher to hand work to. What the caller must NOT do with a null is skip the work — see
|
|
82
|
+
* {@link DurableDispatchOutcome}.
|
|
83
|
+
*/
|
|
84
|
+
get Submitter(): DurableEntityActionSubmitter | null;
|
|
85
|
+
/** Clears the registration. Exists for tests, which must not leak a submitter across cases. */
|
|
86
|
+
Clear(): void;
|
|
87
|
+
}
|
|
88
|
+
/** What a dispatch path did with a binding that asked for durability. */
|
|
89
|
+
export type DurableDispatchOutcome =
|
|
90
|
+
/** Handed to the durable substrate; the caller must not also run it. */
|
|
91
|
+
{
|
|
92
|
+
Kind: 'Submitted';
|
|
93
|
+
ParentTaskID?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Not submitted — no submitter registered, or submission failed. The caller **runs it inline**.
|
|
97
|
+
*
|
|
98
|
+
* Falling back rather than dropping is the whole posture: `RunMode='Durable'` asks for the work
|
|
99
|
+
* to be harder to lose, so refusing to run it when the durable path is unavailable would make
|
|
100
|
+
* the opt-in *less* reliable than leaving it off. The reason travels so the fallback is visible
|
|
101
|
+
* in logs rather than looking like a binding that was never durable.
|
|
102
|
+
*/
|
|
103
|
+
| {
|
|
104
|
+
Kind: 'RunInline';
|
|
105
|
+
Reason: string;
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=DurableEntityActionSubmitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DurableEntityActionSubmitter.d.ts","sourceRoot":"","sources":["../src/DurableEntityActionSubmitter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,+FAA+F;AAC/F,MAAM,MAAM,0BAA0B,GAAG;IACrC,mDAAmD;IACnD,cAAc,EAAE,MAAM,CAAC;IACvB,6FAA6F;IAC7F,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,UAAU,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,QAAQ,EAAE,MAAM,CAAC;IACjB,mFAAmF;IACnF,cAAc,EAAE,MAAM,CAAC;IACvB;;;;;;;OAOG;IACH,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,WAAW,EAAE,QAAQ,CAAC;CACzB,CAAC;AAEF,yCAAyC;AACzC,MAAM,MAAM,6BAA6B,GAAG;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,wEAAwE;IACxE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACvC,MAAM,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;CACvF,CAAC;AAEF;;;;;;GAMG;AACH,qBAAa,2BAA4B,SAAQ,aAAa,CAAC,2BAA2B,CAAC;IACvF,OAAO,CAAC,UAAU,CAA6C;IAE/D,SAAS;IAET,WAAkB,QAAQ,IAAI,2BAA2B,CAExD;IAED,mEAAmE;IAC5D,QAAQ,CAAC,SAAS,EAAE,4BAA4B,GAAG,IAAI;IAI9D;;;;;;OAMG;IACH,IAAW,SAAS,IAAI,4BAA4B,GAAG,IAAI,CAE1D;IAED,+FAA+F;IACxF,KAAK,IAAI,IAAI;CAGvB;AAED,yEAAyE;AACzE,MAAM,MAAM,sBAAsB;AAC9B,wEAAwE;AACtE;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE;AAC9C;;;;;;;GAOG;GACD;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BaseSingleton } from '@memberjunction/global';
|
|
2
|
+
/**
|
|
3
|
+
* Where the host registers its submitter, and where the dispatch path looks for one.
|
|
4
|
+
*
|
|
5
|
+
* A `BaseSingleton` rather than a module-level variable because bundlers duplicate modules across
|
|
6
|
+
* execution paths: a plain `let` would give the registering host and the reading provider two
|
|
7
|
+
* different slots, and durability would appear configured while every dispatch silently ran inline.
|
|
8
|
+
*/
|
|
9
|
+
export class DurableEntityActionRegistry extends BaseSingleton {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
this._submitter = null;
|
|
13
|
+
}
|
|
14
|
+
static get Instance() {
|
|
15
|
+
return super.getInstance('DurableEntityActionRegistry');
|
|
16
|
+
}
|
|
17
|
+
/** Registers the host's durable submitter. Called once at boot. */
|
|
18
|
+
Register(submitter) {
|
|
19
|
+
this._submitter = submitter;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The registered submitter, or null on a host that has none.
|
|
23
|
+
*
|
|
24
|
+
* Null is an ordinary answer, not an error: a CLI, a test, or a client-side provider has no
|
|
25
|
+
* dispatcher to hand work to. What the caller must NOT do with a null is skip the work — see
|
|
26
|
+
* {@link DurableDispatchOutcome}.
|
|
27
|
+
*/
|
|
28
|
+
get Submitter() {
|
|
29
|
+
return this._submitter;
|
|
30
|
+
}
|
|
31
|
+
/** Clears the registration. Exists for tests, which must not leak a submitter across cases. */
|
|
32
|
+
Clear() {
|
|
33
|
+
this._submitter = null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=DurableEntityActionSubmitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DurableEntityActionSubmitter.js","sourceRoot":"","sources":["../src/DurableEntityActionSubmitter.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAgDvD;;;;;;GAMG;AACH,MAAM,OAAO,2BAA4B,SAAQ,aAA0C;IAGvF;QAA0B,KAAK,EAAE,CAAC;QAF1B,eAAU,GAAwC,IAAI,CAAC;IAE5B,CAAC;IAE7B,MAAM,KAAK,QAAQ;QACtB,OAAO,KAAK,CAAC,WAAW,CAA8B,6BAA6B,CAAC,CAAC;IACzF,CAAC;IAED,mEAAmE;IAC5D,QAAQ,CAAC,SAAuC;QACnD,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAChC,CAAC;IAED;;;;;;OAMG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,+FAA+F;IACxF,KAAK;QACR,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IAC3B,CAAC;CACJ"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BaseEngine, BaseEntity, IMetadataProvider, UserInfo } from "@memberjunction/core";
|
|
2
2
|
import { MJActionExecutionLogEntity, MJActionResultCodeEntity, MJEntityActionFilterEntity, MJEntityActionInvocationEntity, MJEntityActionInvocationTypeEntity, MJEntityActionParamEntity } from "@memberjunction/core-entities";
|
|
3
3
|
import { ActionParam, AIDirective, RunActionParams } from "./ActionEngine-Base.js";
|
|
4
|
+
import { EntityChangeContext } from "./EntityChangeContext.js";
|
|
4
5
|
import { MJEntityActionEntityExtended } from "./MJEntityActionEntityExtended.js";
|
|
5
6
|
/**
|
|
6
7
|
* Parameters type for invoking an entity action
|
|
@@ -30,6 +31,17 @@ export declare class EntityActionInvocationParams {
|
|
|
30
31
|
* If the invocation type is list-oriented, this parameter will be needed
|
|
31
32
|
*/
|
|
32
33
|
ListID?: string;
|
|
34
|
+
/**
|
|
35
|
+
* What changed about the record, for filters that need both sides of the save.
|
|
36
|
+
*
|
|
37
|
+
* Captured by the dispatcher at the moment the lifecycle event fires, **not** read from the entity
|
|
38
|
+
* later: `After*` dispatch is fire-and-forget, and by the time an action's filter runs the entity
|
|
39
|
+
* has been reloaded from the save's returned row and its `OldValue`s reset. A filter reading the
|
|
40
|
+
* live entity would see before-values identical to after-values and conclude nothing changed.
|
|
41
|
+
*
|
|
42
|
+
* Absent on invocations with no save behind them (a View or List fan-out, a direct call).
|
|
43
|
+
*/
|
|
44
|
+
EntityChange?: EntityChangeContext;
|
|
33
45
|
}
|
|
34
46
|
/**
|
|
35
47
|
* Class that has the result of a complete action execution, returned by the Run method of the ActionEngine.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityActionEngine-Base.d.ts","sourceRoot":"","sources":["../src/EntityActionEngine-Base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA4B,UAAU,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErH,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,8BAA8B,EAAE,kCAAkC,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAChO,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAG9E;;GAEG;AACH,qBAAa,4BAA4B;IACrC;;OAEG;IACI,YAAY,EAAE,4BAA4B,CAAC;IAElD;;OAEG;IACI,cAAc,EAAE,kCAAkC,CAAC;IAE1D;;OAEG;IACI,WAAW,CAAC,EAAE,QAAQ,CAAC;IAE9B;;OAEG;IACI,YAAY,CAAC,EAAE,UAAU,CAAC;IACjC;;OAEG;IACI,MAAM,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACI,MAAM,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"EntityActionEngine-Base.d.ts","sourceRoot":"","sources":["../src/EntityActionEngine-Base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA4B,UAAU,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErH,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,8BAA8B,EAAE,kCAAkC,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAChO,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAG9E;;GAEG;AACH,qBAAa,4BAA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ED;;OAEG;IACH,IAAW,OAAO,IAAI,0BAA0B,EAAE,CAEjD;IAED;;OAEG;IACH,IAAW,WAAW,IAAI,8BAA8B,EAAE,CAEzD;IAED;;OAEG;IACH,IAAW,aAAa,IAAI,4BAA4B,EAAE,CAEzD;IAED;;OAEG;IACH,IAAW,MAAM,IAAI,yBAAyB,EAAE,CAE/C;IAED;;;;;OAKG;IACI,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,4BAA4B,EAAE;IAM7H;;;;;;;;OAQG;IACH,SAAS,CAAC,cAAc,CAAC,aAAa,EAAE,4BAA4B,EAAE,GAAG,4BAA4B,EAAE;IAOvG;;;;;;;;OAQG;IACU,aAAa,CACtB,aAAa,EAAE,4BAA4B,EAAE,EAC7C,OAAO,EAAE,UAAU,GAAG,SAAS,GAAG,IAAI,GACvC,OAAO,CAAC,4BAA4B,EAAE,CAAC;IAO1C;;;;OAIG;IACI,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,4BAA4B,EAAE;IAI7E;;;;;;OAMG;IACI,uCAAuC,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,4BAA4B,EAAE;CAQzK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityActionEngine-Base.js","sourceRoot":"","sources":["../src/EntityActionEngine-Base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAqE,MAAM,sBAAsB,CAAC;AACrH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"EntityActionEngine-Base.js","sourceRoot":"","sources":["../src/EntityActionEngine-Base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAqE,MAAM,sBAAsB,CAAC;AACrH,OAAO,EAAE,UAAU,E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@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview What changed about a record, in the shape a filter can reason about.
|
|
3
|
+
*
|
|
4
|
+
* **This is the contract transition filters were missing.** An entity action bound to `AfterUpdate`
|
|
5
|
+
* has always been able to see the record's *current* state and nothing else — so "when an invoice
|
|
6
|
+
* crosses 90 days" or "when Status becomes Approved" were unexpressible, and the workflow layer had
|
|
7
|
+
* to refuse a `filter` outright rather than accept one it could not honor. Deciding those questions
|
|
8
|
+
* needs the values on *both* sides of the save, which `BaseEntity` has tracked all along on each
|
|
9
|
+
* `EntityField` — it was simply never carried to the place filters run.
|
|
10
|
+
*
|
|
11
|
+
* Deliberately a plain data shape rather than the live entity: a filter runs against a snapshot of
|
|
12
|
+
* what happened, and handing it a mutable `BaseEntity` would let a predicate quietly alter the record
|
|
13
|
+
* it was asked to judge.
|
|
14
|
+
*
|
|
15
|
+
* @module @memberjunction/actions-base
|
|
16
|
+
*/
|
|
17
|
+
/** The before/after picture of one save, as seen by a filter. */
|
|
18
|
+
export type EntityChangeContext = {
|
|
19
|
+
/**
|
|
20
|
+
* Field values as they were when the record was loaded. Empty on a create — there is no "before".
|
|
21
|
+
*/
|
|
22
|
+
OldValues: Readonly<Record<string, unknown>>;
|
|
23
|
+
/** Field values as they are now. */
|
|
24
|
+
NewValues: Readonly<Record<string, unknown>>;
|
|
25
|
+
/**
|
|
26
|
+
* Names of fields whose value actually differs.
|
|
27
|
+
*
|
|
28
|
+
* Computed from a value comparison rather than from the dirty flag: a field can be assigned its
|
|
29
|
+
* existing value and still read as dirty, and a filter that fired on that would be reporting a
|
|
30
|
+
* change that did not happen.
|
|
31
|
+
*/
|
|
32
|
+
ChangedFields: readonly string[];
|
|
33
|
+
/** True when the record is being created, so every field is "new" and none of them changed. */
|
|
34
|
+
IsCreate: boolean;
|
|
35
|
+
};
|
|
36
|
+
/** True when `fieldName` is among the fields that changed. Case-insensitive, as field names are. */
|
|
37
|
+
export declare function DidFieldChange(change: EntityChangeContext | undefined, fieldName: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* True when `fieldName` changed AND its new value equals `value`.
|
|
40
|
+
*
|
|
41
|
+
* The equality is deliberately loose — a filter's configured value arrives as a string from
|
|
42
|
+
* metadata, while the field may hold a number, boolean or date. Comparing raw would make
|
|
43
|
+
* `Status = 1` never match a numeric 1, which is the kind of silent no-match that leaves someone
|
|
44
|
+
* convinced their automation is broken rather than misconfigured.
|
|
45
|
+
*/
|
|
46
|
+
export declare function DidFieldChangeToValue(change: EntityChangeContext | undefined, fieldName: string, value: unknown): boolean;
|
|
47
|
+
/** Reads a field from a values bag case-insensitively. */
|
|
48
|
+
export declare function ReadFieldValue(values: Readonly<Record<string, unknown>>, fieldName: string): unknown;
|
|
49
|
+
/**
|
|
50
|
+
* Compares a field value to a configured one across the string boundary metadata forces.
|
|
51
|
+
*
|
|
52
|
+
* Null and undefined are treated as the same absence — a filter author writing "when Owner becomes
|
|
53
|
+
* empty" should not have to know which one the provider produced.
|
|
54
|
+
*/
|
|
55
|
+
export declare function LooseEquals(actual: unknown, expected: unknown): boolean;
|
|
56
|
+
/** The minimum of a `BaseEntity` this builder needs — kept structural so this module stays free of
|
|
57
|
+
* a dependency on the entity layer, which would invert the package graph. */
|
|
58
|
+
export type ChangeTrackedEntity = {
|
|
59
|
+
IsSaved: boolean;
|
|
60
|
+
Fields: ReadonlyArray<{
|
|
61
|
+
Name: string;
|
|
62
|
+
Value: unknown;
|
|
63
|
+
OldValue: unknown;
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Builds the before/after picture from an entity about to be, or just, saved.
|
|
68
|
+
*
|
|
69
|
+
* Reads `EntityField.OldValue`, which `BaseEntity` has populated since the record was loaded — no
|
|
70
|
+
* new tracking, just carrying what already exists to where filters run.
|
|
71
|
+
*
|
|
72
|
+
* `IsSaved === false` means a create, and a create has no "before": every field is reported as new
|
|
73
|
+
* and `ChangedFields` is empty. Saying a field "changed" on insert would make a transition filter
|
|
74
|
+
* fire on creation, which is the opposite of what "when Status BECOMES Approved" asks for — that
|
|
75
|
+
* record's status did not become anything, it started that way.
|
|
76
|
+
*/
|
|
77
|
+
export declare function BuildEntityChangeContext(entity: ChangeTrackedEntity): EntityChangeContext;
|
|
78
|
+
/**
|
|
79
|
+
* Wraps a filter expression as the body of an `ActionFilter.Code`.
|
|
80
|
+
*
|
|
81
|
+
* Two different authoring surfaces reach this: a workflow's `WorkflowEntityEventTrigger.filter` and
|
|
82
|
+
* a Record Process's `OnChangeFilter`. Both mean the same thing — "only fire when this is true of
|
|
83
|
+
* the change" — so both compile to one shape rather than each inventing its own dialect, and a user
|
|
84
|
+
* who learns one has learned the other.
|
|
85
|
+
*
|
|
86
|
+
* It also lives on both sides of the check/store divide: the validator compiles the result to prove
|
|
87
|
+
* it parses, and the reconciler persists exactly that string. Anything less than a shared function
|
|
88
|
+
* admits the failure where a spec validates and then fails closed forever at runtime.
|
|
89
|
+
*
|
|
90
|
+
* The shorthands are destructured from the context rather than injected as separate function
|
|
91
|
+
* arguments, so an author's expression sees exactly the names the field's documentation promises
|
|
92
|
+
* and nothing else leaks in.
|
|
93
|
+
*/
|
|
94
|
+
export declare function BuildChangeFilterCode(filter: string): string;
|
|
95
|
+
/**
|
|
96
|
+
* Whether a filter expression parses.
|
|
97
|
+
*
|
|
98
|
+
* Compiles but never invokes, so nothing in the expression can run here. `EvalError` is treated as
|
|
99
|
+
* "cannot tell" rather than "invalid": under a Content-Security-Policy that forbids `new Function`,
|
|
100
|
+
* every filter would otherwise be reported as broken in the browser while working perfectly on the
|
|
101
|
+
* server that actually evaluates it.
|
|
102
|
+
*/
|
|
103
|
+
export declare function IsChangeFilterParseable(filter: string): {
|
|
104
|
+
Parseable: boolean;
|
|
105
|
+
Message?: string;
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=EntityChangeContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityChangeContext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AAC,MAAM,EAAE,mBAAmB,GAAG,mBAAmB,CAqBzF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAO5D;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAQhG"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview What changed about a record, in the shape a filter can reason about.
|
|
3
|
+
*
|
|
4
|
+
* **This is the contract transition filters were missing.** An entity action bound to `AfterUpdate`
|
|
5
|
+
* has always been able to see the record's *current* state and nothing else — so "when an invoice
|
|
6
|
+
* crosses 90 days" or "when Status becomes Approved" were unexpressible, and the workflow layer had
|
|
7
|
+
* to refuse a `filter` outright rather than accept one it could not honor. Deciding those questions
|
|
8
|
+
* needs the values on *both* sides of the save, which `BaseEntity` has tracked all along on each
|
|
9
|
+
* `EntityField` — it was simply never carried to the place filters run.
|
|
10
|
+
*
|
|
11
|
+
* Deliberately a plain data shape rather than the live entity: a filter runs against a snapshot of
|
|
12
|
+
* what happened, and handing it a mutable `BaseEntity` would let a predicate quietly alter the record
|
|
13
|
+
* it was asked to judge.
|
|
14
|
+
*
|
|
15
|
+
* @module @memberjunction/actions-base
|
|
16
|
+
*/
|
|
17
|
+
/** True when `fieldName` is among the fields that changed. Case-insensitive, as field names are. */
|
|
18
|
+
export function DidFieldChange(change, fieldName) {
|
|
19
|
+
if (!change || !fieldName) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
const wanted = fieldName.trim().toLowerCase();
|
|
23
|
+
return change.ChangedFields.some((f) => f.toLowerCase() === wanted);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* True when `fieldName` changed AND its new value equals `value`.
|
|
27
|
+
*
|
|
28
|
+
* The equality is deliberately loose — a filter's configured value arrives as a string from
|
|
29
|
+
* metadata, while the field may hold a number, boolean or date. Comparing raw would make
|
|
30
|
+
* `Status = 1` never match a numeric 1, which is the kind of silent no-match that leaves someone
|
|
31
|
+
* convinced their automation is broken rather than misconfigured.
|
|
32
|
+
*/
|
|
33
|
+
export function DidFieldChangeToValue(change, fieldName, value) {
|
|
34
|
+
if (!DidFieldChange(change, fieldName)) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
const actual = ReadFieldValue(change.NewValues, fieldName);
|
|
38
|
+
return LooseEquals(actual, value);
|
|
39
|
+
}
|
|
40
|
+
/** Reads a field from a values bag case-insensitively. */
|
|
41
|
+
export function ReadFieldValue(values, fieldName) {
|
|
42
|
+
const wanted = fieldName.trim().toLowerCase();
|
|
43
|
+
const key = Object.keys(values).find((k) => k.toLowerCase() === wanted);
|
|
44
|
+
return key === undefined ? undefined : values[key];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Compares a field value to a configured one across the string boundary metadata forces.
|
|
48
|
+
*
|
|
49
|
+
* Null and undefined are treated as the same absence — a filter author writing "when Owner becomes
|
|
50
|
+
* empty" should not have to know which one the provider produced.
|
|
51
|
+
*/
|
|
52
|
+
export function LooseEquals(actual, expected) {
|
|
53
|
+
if (actual === expected) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
if (actual == null && expected == null) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
if (actual == null || expected == null) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
if (actual instanceof Date || expected instanceof Date) {
|
|
63
|
+
const a = actual instanceof Date ? actual.getTime() : new Date(String(actual)).getTime();
|
|
64
|
+
const b = expected instanceof Date ? expected.getTime() : new Date(String(expected)).getTime();
|
|
65
|
+
return !Number.isNaN(a) && !Number.isNaN(b) && a === b;
|
|
66
|
+
}
|
|
67
|
+
if (typeof actual === 'boolean' || typeof expected === 'boolean') {
|
|
68
|
+
return ToBool(actual) === ToBool(expected);
|
|
69
|
+
}
|
|
70
|
+
return String(actual).trim().toLowerCase() === String(expected).trim().toLowerCase();
|
|
71
|
+
}
|
|
72
|
+
/** Interprets the several ways a boolean arrives from metadata or a database. */
|
|
73
|
+
function ToBool(v) {
|
|
74
|
+
if (typeof v === 'boolean')
|
|
75
|
+
return v;
|
|
76
|
+
const s = String(v).trim().toLowerCase();
|
|
77
|
+
return s === 'true' || s === '1' || s === 'yes';
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Builds the before/after picture from an entity about to be, or just, saved.
|
|
81
|
+
*
|
|
82
|
+
* Reads `EntityField.OldValue`, which `BaseEntity` has populated since the record was loaded — no
|
|
83
|
+
* new tracking, just carrying what already exists to where filters run.
|
|
84
|
+
*
|
|
85
|
+
* `IsSaved === false` means a create, and a create has no "before": every field is reported as new
|
|
86
|
+
* and `ChangedFields` is empty. Saying a field "changed" on insert would make a transition filter
|
|
87
|
+
* fire on creation, which is the opposite of what "when Status BECOMES Approved" asks for — that
|
|
88
|
+
* record's status did not become anything, it started that way.
|
|
89
|
+
*/
|
|
90
|
+
export function BuildEntityChangeContext(entity) {
|
|
91
|
+
const oldValues = {};
|
|
92
|
+
const newValues = {};
|
|
93
|
+
const changed = [];
|
|
94
|
+
const isCreate = !entity.IsSaved;
|
|
95
|
+
for (const f of entity.Fields) {
|
|
96
|
+
newValues[f.Name] = f.Value;
|
|
97
|
+
if (isCreate) {
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
oldValues[f.Name] = f.OldValue;
|
|
101
|
+
// Compared by value rather than by the dirty flag: assigning a field its existing value
|
|
102
|
+
// still marks it dirty, and a filter firing on that would report a change that never
|
|
103
|
+
// happened.
|
|
104
|
+
if (!LooseEquals(f.OldValue, f.Value)) {
|
|
105
|
+
changed.push(f.Name);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return { OldValues: oldValues, NewValues: newValues, ChangedFields: changed, IsCreate: isCreate };
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Wraps a filter expression as the body of an `ActionFilter.Code`.
|
|
112
|
+
*
|
|
113
|
+
* Two different authoring surfaces reach this: a workflow's `WorkflowEntityEventTrigger.filter` and
|
|
114
|
+
* a Record Process's `OnChangeFilter`. Both mean the same thing — "only fire when this is true of
|
|
115
|
+
* the change" — so both compile to one shape rather than each inventing its own dialect, and a user
|
|
116
|
+
* who learns one has learned the other.
|
|
117
|
+
*
|
|
118
|
+
* It also lives on both sides of the check/store divide: the validator compiles the result to prove
|
|
119
|
+
* it parses, and the reconciler persists exactly that string. Anything less than a shared function
|
|
120
|
+
* admits the failure where a spec validates and then fails closed forever at runtime.
|
|
121
|
+
*
|
|
122
|
+
* The shorthands are destructured from the context rather than injected as separate function
|
|
123
|
+
* arguments, so an author's expression sees exactly the names the field's documentation promises
|
|
124
|
+
* and nothing else leaks in.
|
|
125
|
+
*/
|
|
126
|
+
export function BuildChangeFilterCode(filter) {
|
|
127
|
+
return [
|
|
128
|
+
'// Generated from a change-filter expression. Edit the definition that owns this row,',
|
|
129
|
+
'// not the row itself — re-saving the owner overwrites this code.',
|
|
130
|
+
'const { OldValues, NewValues, DidFieldChange, DidFieldChangeToValue } = ActionFilterContext;',
|
|
131
|
+
`return (${filter.trim()});`,
|
|
132
|
+
].join('\n');
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Whether a filter expression parses.
|
|
136
|
+
*
|
|
137
|
+
* Compiles but never invokes, so nothing in the expression can run here. `EvalError` is treated as
|
|
138
|
+
* "cannot tell" rather than "invalid": under a Content-Security-Policy that forbids `new Function`,
|
|
139
|
+
* every filter would otherwise be reported as broken in the browser while working perfectly on the
|
|
140
|
+
* server that actually evaluates it.
|
|
141
|
+
*/
|
|
142
|
+
export function IsChangeFilterParseable(filter) {
|
|
143
|
+
try {
|
|
144
|
+
new Function('ActionFilterContext', BuildChangeFilterCode(filter));
|
|
145
|
+
return { Parseable: true };
|
|
146
|
+
}
|
|
147
|
+
catch (e) {
|
|
148
|
+
if (e instanceof EvalError)
|
|
149
|
+
return { Parseable: true };
|
|
150
|
+
return { Parseable: false, Message: e instanceof Error ? e.message : String(e) };
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=EntityChangeContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityChangeContext.js","sourceRoot":"","sources":["../src/EntityChangeContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAyBH,oGAAoG;AACpG,MAAM,UAAU,cAAc,CAAC,MAAuC,EAAE,SAAiB;IACrF,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9C,OAAO,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,CAAC;AACxE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACjC,MAAuC,EACvC,SAAiB,EACjB,KAAc;IAEd,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC;QACrC,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,MAAM,MAAM,GAAG,cAAc,CAAC,MAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAC5D,OAAO,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACtC,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,cAAc,CAAC,MAAyC,EAAE,SAAiB;IACvF,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9C,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IA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,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AACtG,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAc;IAChD,OAAO;QACH,uFAAuF;QACvF,mEAAmE;QACnE,8FAA8F;QAC9F,WAAW,MAAM,CAAC,IAAI,EAAE,IAAI;KAC/B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAc;IAClD,IAAI,CAAC;QACD,IAAI,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;QACnE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAC/B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,IAAI,CAAC,YAAY,SAAS;YAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QACvD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrF,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityChangeContext.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/EntityChangeContext.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for the change contract that makes transition filters possible.
|
|
3
|
+
*
|
|
4
|
+
* The distinction this whole module exists to draw is **state vs transition**: "Status is Approved"
|
|
5
|
+
* is true on every save after the approval, while "Status became Approved" is true exactly once.
|
|
6
|
+
* Every test here is really about keeping that line sharp, because the failure mode on the wrong
|
|
7
|
+
* side of it is a workflow that runs an agent on every subsequent save of the record — expensive,
|
|
8
|
+
* and invisible until someone reads a bill.
|
|
9
|
+
*/
|
|
10
|
+
import { describe, it, expect } from 'vitest';
|
|
11
|
+
import { BuildEntityChangeContext, DidFieldChange, DidFieldChangeToValue, LooseEquals, ReadFieldValue, } from '../EntityChangeContext.js';
|
|
12
|
+
/** A stand-in for the parts of BaseEntity the builder reads. */
|
|
13
|
+
const entity = (IsSaved, fields) => ({ IsSaved, Fields: fields });
|
|
14
|
+
describe('BuildEntityChangeContext', () => {
|
|
15
|
+
it('reports only the fields whose value actually differs', () => {
|
|
16
|
+
const change = BuildEntityChangeContext(entity(true, [
|
|
17
|
+
{ Name: 'Status', Value: 'Approved', OldValue: 'Pending' },
|
|
18
|
+
{ Name: 'Amount', Value: 100, OldValue: 100 },
|
|
19
|
+
]));
|
|
20
|
+
expect(change.ChangedFields).toEqual(['Status']);
|
|
21
|
+
});
|
|
22
|
+
it('does NOT report a field re-assigned its existing value', () => {
|
|
23
|
+
// The dirty flag would say yes here — assigning a field its current value still marks it
|
|
24
|
+
// dirty — and a filter firing on that reports a change that did not happen.
|
|
25
|
+
const change = BuildEntityChangeContext(entity(true, [
|
|
26
|
+
{ Name: 'Status', Value: 'Approved', OldValue: 'Approved' },
|
|
27
|
+
]));
|
|
28
|
+
expect(change.ChangedFields).toEqual([]);
|
|
29
|
+
});
|
|
30
|
+
it('treats a create as having no before, so nothing "changed"', () => {
|
|
31
|
+
// A record whose Status started at Approved did not BECOME approved. Saying otherwise would
|
|
32
|
+
// fire every "when Status becomes X" trigger on every insert.
|
|
33
|
+
const change = BuildEntityChangeContext(entity(false, [
|
|
34
|
+
{ Name: 'Status', Value: 'Approved', OldValue: null },
|
|
35
|
+
]));
|
|
36
|
+
expect(change.IsCreate).toBe(true);
|
|
37
|
+
expect(change.ChangedFields).toEqual([]);
|
|
38
|
+
expect(change.OldValues).toEqual({});
|
|
39
|
+
expect(change.NewValues).toEqual({ Status: 'Approved' });
|
|
40
|
+
});
|
|
41
|
+
it('carries both sides for an update', () => {
|
|
42
|
+
const change = BuildEntityChangeContext(entity(true, [
|
|
43
|
+
{ Name: 'Status', Value: 'Approved', OldValue: 'Pending' },
|
|
44
|
+
]));
|
|
45
|
+
expect(change.OldValues).toEqual({ Status: 'Pending' });
|
|
46
|
+
expect(change.NewValues).toEqual({ Status: 'Approved' });
|
|
47
|
+
});
|
|
48
|
+
it('counts a transition into null as a change', () => {
|
|
49
|
+
const change = BuildEntityChangeContext(entity(true, [
|
|
50
|
+
{ Name: 'OwnerID', Value: null, OldValue: 'user-1' },
|
|
51
|
+
]));
|
|
52
|
+
expect(change.ChangedFields).toEqual(['OwnerID']);
|
|
53
|
+
});
|
|
54
|
+
it('does not count null becoming undefined — both are absence', () => {
|
|
55
|
+
const change = BuildEntityChangeContext(entity(true, [
|
|
56
|
+
{ Name: 'OwnerID', Value: undefined, OldValue: null },
|
|
57
|
+
]));
|
|
58
|
+
expect(change.ChangedFields).toEqual([]);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
describe('DidFieldChange', () => {
|
|
62
|
+
const change = BuildEntityChangeContext(entity(true, [
|
|
63
|
+
{ Name: 'Status', Value: 'Approved', OldValue: 'Pending' },
|
|
64
|
+
]));
|
|
65
|
+
it('matches regardless of case, as field names do everywhere else in MJ', () => {
|
|
66
|
+
expect(DidFieldChange(change, 'status')).toBe(true);
|
|
67
|
+
expect(DidFieldChange(change, ' Status ')).toBe(true);
|
|
68
|
+
});
|
|
69
|
+
it('is false for a field that did not change', () => {
|
|
70
|
+
expect(DidFieldChange(change, 'Amount')).toBe(false);
|
|
71
|
+
});
|
|
72
|
+
it('is false when there is no change context at all', () => {
|
|
73
|
+
// A direct invocation or a View fan-out has no save behind it. "I cannot tell" must read as
|
|
74
|
+
// false, because filters gate execution — the alternative is firing on a question nobody
|
|
75
|
+
// could answer.
|
|
76
|
+
expect(DidFieldChange(undefined, 'Status')).toBe(false);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
describe('DidFieldChangeToValue', () => {
|
|
80
|
+
const toApproved = BuildEntityChangeContext(entity(true, [
|
|
81
|
+
{ Name: 'Status', Value: 'Approved', OldValue: 'Pending' },
|
|
82
|
+
]));
|
|
83
|
+
it('is true only when the field changed AND landed on the value', () => {
|
|
84
|
+
expect(DidFieldChangeToValue(toApproved, 'Status', 'Approved')).toBe(true);
|
|
85
|
+
expect(DidFieldChangeToValue(toApproved, 'Status', 'Rejected')).toBe(false);
|
|
86
|
+
});
|
|
87
|
+
it('is false when the field already held the value — that is state, not transition', () => {
|
|
88
|
+
const stillApproved = BuildEntityChangeContext(entity(true, [
|
|
89
|
+
{ Name: 'Status', Value: 'Approved', OldValue: 'Approved' },
|
|
90
|
+
]));
|
|
91
|
+
expect(DidFieldChangeToValue(stillApproved, 'Status', 'Approved')).toBe(false);
|
|
92
|
+
});
|
|
93
|
+
it('is false on a create, even though the new value matches', () => {
|
|
94
|
+
const created = BuildEntityChangeContext(entity(false, [
|
|
95
|
+
{ Name: 'Status', Value: 'Approved', OldValue: null },
|
|
96
|
+
]));
|
|
97
|
+
expect(DidFieldChangeToValue(created, 'Status', 'Approved')).toBe(false);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
describe('LooseEquals — comparing across the string boundary metadata forces', () => {
|
|
101
|
+
it('matches a number against its string form', () => {
|
|
102
|
+
// A filter's configured value arrives as text; the field holds a number. Comparing strictly
|
|
103
|
+
// would make the filter silently never match, which reads as "my automation is broken".
|
|
104
|
+
expect(LooseEquals(1, '1')).toBe(true);
|
|
105
|
+
});
|
|
106
|
+
it('matches booleans written the several ways a database produces them', () => {
|
|
107
|
+
expect(LooseEquals(true, 'true')).toBe(true);
|
|
108
|
+
expect(LooseEquals(true, 1)).toBe(true);
|
|
109
|
+
expect(LooseEquals(false, '0')).toBe(true);
|
|
110
|
+
expect(LooseEquals(true, 'no')).toBe(false);
|
|
111
|
+
});
|
|
112
|
+
it('matches dates against their serialized form', () => {
|
|
113
|
+
const d = new Date('2026-01-01T00:00:00.000Z');
|
|
114
|
+
expect(LooseEquals(d, '2026-01-01T00:00:00.000Z')).toBe(true);
|
|
115
|
+
});
|
|
116
|
+
it('treats null and undefined as the same absence', () => {
|
|
117
|
+
expect(LooseEquals(null, undefined)).toBe(true);
|
|
118
|
+
expect(LooseEquals(null, '')).toBe(false);
|
|
119
|
+
});
|
|
120
|
+
it('ignores surrounding whitespace and case for strings', () => {
|
|
121
|
+
expect(LooseEquals(' Approved ', 'approved')).toBe(true);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
describe('ReadFieldValue', () => {
|
|
125
|
+
it('reads case-insensitively', () => {
|
|
126
|
+
expect(ReadFieldValue({ Status: 'Approved' }, 'status')).toBe('Approved');
|
|
127
|
+
});
|
|
128
|
+
it('returns undefined for a field the record does not have', () => {
|
|
129
|
+
expect(ReadFieldValue({ Status: 'Approved' }, 'Nope')).toBeUndefined();
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
//# sourceMappingURL=EntityChangeContext.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityChangeContext.test.js","sourceRoot":"","sources":["../../src/__tests__/EntityChangeContext.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACH,wBAAwB,EACxB,cAAc,EACd,qBAAqB,EACrB,WAAW,EACX,cAAc,GAEjB,MAAM,wBAAwB,CAAC;AAEhC,gEAAgE;AAChE,MAAM,MAAM,GAAG,CACX,OAAgB,EAChB,MAAkE,EAC/C,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AAExD,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACtC,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC5D,MAAM,MAAM,GAAG,wBAAwB,CAAC,MAAM,C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CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAC9D,MAAM,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;IAC3E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from './ActionEngine-Base.js';
|
|
2
|
+
export * from './DurableEntityActionSubmitter.js';
|
|
3
|
+
export * from './EntityChangeContext.js';
|
|
2
4
|
export * from './ParamRedaction.js';
|
|
3
5
|
export * from './EntityActionScopeResolver.js';
|
|
4
6
|
export * from './MJActionEntityExtended.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAG/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAG/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from './ActionEngine-Base.js';
|
|
2
|
+
export * from './DurableEntityActionSubmitter.js';
|
|
3
|
+
export * from './EntityChangeContext.js';
|
|
2
4
|
export * from './ParamRedaction.js';
|
|
3
5
|
export * from './EntityActionScopeResolver.js';
|
|
4
6
|
export * from './MJActionEntityExtended.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAG/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAG/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/actions-base",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.1.0-edge.
|
|
4
|
+
"version": "6.1.0-edge.3",
|
|
5
5
|
"description": "Base Classes for MemberJunction Actions. This library is used on both server and network nodes.",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
"/dist"
|
|
10
10
|
],
|
|
11
11
|
"author": "MemberJunction.com",
|
|
12
|
-
"license": "
|
|
12
|
+
"license": "BUSL-1.1",
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"ts-node-dev": "^2.0.0",
|
|
15
15
|
"typescript": "^5.9.3"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@memberjunction/code-execution": "6.1.0-edge.
|
|
19
|
-
"@memberjunction/core": "6.1.0-edge.
|
|
20
|
-
"@memberjunction/core-entities": "6.1.0-edge.
|
|
21
|
-
"@memberjunction/global": "6.1.0-edge.
|
|
18
|
+
"@memberjunction/code-execution": "6.1.0-edge.3",
|
|
19
|
+
"@memberjunction/core": "6.1.0-edge.3",
|
|
20
|
+
"@memberjunction/core-entities": "6.1.0-edge.3",
|
|
21
|
+
"@memberjunction/global": "6.1.0-edge.3",
|
|
22
22
|
"zod": "^3.25.0"
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|