@memberjunction/actions 1.7.1 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { BaseEngine, BaseEntity, UserInfo } from "@memberjunction/core";
2
- import { EntityActionFilterEntity, EntityActionInvocationEntity, EntityActionInvocationTypeEntity } from "@memberjunction/core-entities";
2
+ import { ActionExecutionLogEntity, ActionResultCodeEntity, EntityActionFilterEntity, EntityActionInvocationEntity, EntityActionInvocationTypeEntity, EntityActionParamEntity } from "@memberjunction/core-entities";
3
3
  import { EntityActionEntityServer } from "./EntityActionEntity.server";
4
- import { ActionResult } from "../generic/ActionEngine";
4
+ import { ActionParam, RunActionParams } from "../generic/ActionEngine";
5
5
  /**
6
6
  * Parameters type for invoking an entity action
7
7
  */
@@ -31,12 +31,42 @@ export declare class EntityActionInvocationParams {
31
31
  */
32
32
  ListID?: number;
33
33
  }
34
+ /**
35
+ * Class that has the result of a complete action execution, returned by the Run method of the ActionEngine.
36
+ */
37
+ export declare class EntityActionResult {
38
+ /**
39
+ * Contains the parameters that were used to run the action as a convenience.
40
+ */
41
+ RunParams: RunActionParams;
42
+ /**
43
+ * Indicates if the action was successful or not.
44
+ */
45
+ Success: boolean;
46
+ /**
47
+ * A code that indicates the outcome of the action. Will be one of the possible ResultCodes enumerated in the ActionResultCodeEntity
48
+ */
49
+ Result?: ActionResultCodeEntity;
50
+ /**
51
+ * Whenever an action is executed a log entry is created. This log entry is stored in the database and can be used to track the execution of the action. This property contains the log entry object for the action that was run.
52
+ */
53
+ LogEntry: ActionExecutionLogEntity;
54
+ /**
55
+ * Optional, a message an action can include that describes the outcome of the action. This is typically used to display a message to the user.
56
+ */
57
+ Message?: string;
58
+ /**
59
+ * All parameters including inputs and outputs are provided here for convenience
60
+ */
61
+ Params?: ActionParam[];
62
+ }
34
63
  /**
35
64
  * The purpose of this class is to handle the invocation of actions for entities in all of the supported invocation contexts.
36
65
  */
37
66
  export declare class EntityActionEngine extends BaseEngine<EntityActionEngine> {
38
67
  static get Instance(): EntityActionEngine;
39
68
  private _EntityActions;
69
+ private _EntityActionParams;
40
70
  private _EntityActionInvocationTypes;
41
71
  private _EntityActionFilters;
42
72
  private _EntityActionInvocations;
@@ -63,12 +93,17 @@ export declare class EntityActionEngine extends BaseEngine<EntityActionEngine> {
63
93
  * List of all the Entity Action objects that are available for use in the system. Make sure you call Config() before any other methods on this class.
64
94
  */
65
95
  get EntityActions(): EntityActionEntityServer[];
96
+ /**
97
+ * List of all of the Entity Action Params that are available for use in the system. Make sure you call Config() before any other methods on this class.
98
+ */
99
+ get Params(): EntityActionParamEntity[];
66
100
  /**
67
101
  * Helper method to get the EntityActionEntityServer object for a given entity name
68
102
  * @param entityName
103
+ * @param status Optional, if provided will filter the results based on the status
69
104
  * @returns
70
105
  */
71
- GetActionsByEntityName(entityName: string): EntityActionEntityServer[];
106
+ GetActionsByEntityName(entityName: string, status?: 'Active' | 'Pending' | 'Disabled'): EntityActionEntityServer[];
72
107
  /**
73
108
  * Helper method to get the EntityActionEntityServer object for a given entity ID
74
109
  * @param entityID
@@ -79,14 +114,15 @@ export declare class EntityActionEngine extends BaseEngine<EntityActionEngine> {
79
114
  * Helper method to get the EntityActionEntityServer object for a given entity name and invocation type
80
115
  * @param entityName
81
116
  * @param invocationType
117
+ * @param status Optional, if provided will filter the results based on the status
82
118
  * @returns
83
119
  */
84
- GetActionsByEntityNameAndInvocationType(entityName: string, invocationType: string): EntityActionEntityServer[];
120
+ GetActionsByEntityNameAndInvocationType(entityName: string, invocationType: string, status?: 'Active' | 'Pending' | 'Disabled'): EntityActionEntityServer[];
85
121
  /**
86
122
  * Method will invoke an action given the provided parameters. The method will return true if the action was successfully invoked, false otherwise.
87
123
  * @param params Parameters for the action invocation
88
124
  * @returns
89
125
  */
90
- RunEntityAction(params: EntityActionInvocationParams): Promise<ActionResult>;
126
+ RunEntityAction(params: EntityActionInvocationParams): Promise<EntityActionResult>;
91
127
  }
92
128
  //# sourceMappingURL=EntityActionEngine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EntityActionEngine.d.ts","sourceRoot":"","sources":["../../src/entity-actions/EntityActionEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA4B,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAClG,OAAO,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AAEzI,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD;;GAEG;AACH,qBAAa,4BAA4B;IACrC;;OAEG;IACI,YAAY,EAAE,wBAAwB,CAAC;IAE9C;;OAEG;IACI,cAAc,EAAE,gCAAgC,CAAC;IAExD;;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;CAC1B;AAGD;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,UAAU,CAAC,kBAAkB,CAAC;IAClE,WAAkB,QAAQ,IAAI,kBAAkB,CAE/C;IAID,OAAO,CAAC,cAAc,CAAkC;IACxD,OAAO,CAAC,4BAA4B,CAA0C;IAC9E,OAAO,CAAC,oBAAoB,CAAkC;IAC9D,OAAO,CAAC,wBAAwB,CAAsC;IAEtE;;;;;OAKG;IACU,MAAM,CAAC,YAAY,GAAE,OAAe,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBzF;;OAEG;IACH,IAAW,eAAe,IAAI,gCAAgC,EAAE,CAE/D;IAED;;OAEG;IACH,IAAW,OAAO,IAAI,wBAAwB,EAAE,CAE/C;IAED;;OAEG;IACH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AAE,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,wBAAwB,EAAE;IASlK;;;;OAIG;IACU,eAAe,CAAC,MAAM,EAAE,4BAA4B,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAsBlG"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EntityActionEngine = exports.EntityActionInvocationParams = void 0;
3
+ exports.EntityActionEngine = exports.EntityActionResult = exports.EntityActionInvocationParams = void 0;
4
4
  const core_1 = require("@memberjunction/core");
5
5
  const global_1 = require("@memberjunction/global");
6
6
  const EntityActionInvocationTypes_1 = require("./EntityActionInvocationTypes");
@@ -10,6 +10,12 @@ const EntityActionInvocationTypes_1 = require("./EntityActionInvocationTypes");
10
10
  class EntityActionInvocationParams {
11
11
  }
12
12
  exports.EntityActionInvocationParams = EntityActionInvocationParams;
13
+ /**
14
+ * Class that has the result of a complete action execution, returned by the Run method of the ActionEngine.
15
+ */
16
+ class EntityActionResult {
17
+ }
18
+ exports.EntityActionResult = EntityActionResult;
13
19
  /**
14
20
  * The purpose of this class is to handle the invocation of actions for entities in all of the supported invocation contexts.
15
21
  */
@@ -18,6 +24,7 @@ class EntityActionEngine extends core_1.BaseEngine {
18
24
  super(...arguments);
19
25
  // internal instance properties used for the singleton pattern
20
26
  this._EntityActions = [];
27
+ this._EntityActionParams = [];
21
28
  this._EntityActionInvocationTypes = [];
22
29
  this._EntityActionFilters = [];
23
30
  this._EntityActionInvocations = [];
@@ -46,8 +53,12 @@ class EntityActionEngine extends core_1.BaseEngine {
46
53
  PropertyName: '_EntityActionInvocations'
47
54
  },
48
55
  {
49
- EntityName: 'Entity Actions',
56
+ EntityName: 'Entity Actions', // sub-class for this will handle dynamic loading of filters, invocations, and params when needed by callers of those read-only properties
50
57
  PropertyName: '_EntityActions'
58
+ },
59
+ {
60
+ EntityName: 'Entity Action Params',
61
+ PropertyName: '_EntityActionParams'
51
62
  }
52
63
  ];
53
64
  await this.Load(configs, forceRefresh, contextUser);
@@ -76,13 +87,20 @@ class EntityActionEngine extends core_1.BaseEngine {
76
87
  get EntityActions() {
77
88
  return this._EntityActions;
78
89
  }
90
+ /**
91
+ * List of all of the Entity Action Params that are available for use in the system. Make sure you call Config() before any other methods on this class.
92
+ */
93
+ get Params() {
94
+ return this._EntityActionParams;
95
+ }
79
96
  /**
80
97
  * Helper method to get the EntityActionEntityServer object for a given entity name
81
98
  * @param entityName
99
+ * @param status Optional, if provided will filter the results based on the status
82
100
  * @returns
83
101
  */
84
- GetActionsByEntityName(entityName) {
85
- return this._EntityActions.filter(e => e.Entity.trim().toLowerCase() === entityName.trim().toLowerCase());
102
+ GetActionsByEntityName(entityName, status) {
103
+ return this._EntityActions.filter(e => (!status || e.Status === status) && e.Entity.trim().toLowerCase() === entityName.trim().toLowerCase());
86
104
  }
87
105
  /**
88
106
  * Helper method to get the EntityActionEntityServer object for a given entity ID
@@ -96,13 +114,14 @@ class EntityActionEngine extends core_1.BaseEngine {
96
114
  * Helper method to get the EntityActionEntityServer object for a given entity name and invocation type
97
115
  * @param entityName
98
116
  * @param invocationType
117
+ * @param status Optional, if provided will filter the results based on the status
99
118
  * @returns
100
119
  */
101
- GetActionsByEntityNameAndInvocationType(entityName, invocationType) {
102
- const entityActions = this.GetActionsByEntityName(entityName);
120
+ GetActionsByEntityNameAndInvocationType(entityName, invocationType, status) {
121
+ const entityActions = this.GetActionsByEntityName(entityName, status);
103
122
  // now extract the ones that have the right invocation type
104
123
  return entityActions.filter(e => {
105
- const invocations = e.Invocations.find(i => i.InvocationType.trim().toLowerCase() === invocationType.trim().toLowerCase());
124
+ const invocations = e.Invocations.find(i => (!status || i.Status === status) && i.InvocationType.trim().toLowerCase() === invocationType.trim().toLowerCase());
106
125
  return invocations ? true : false;
107
126
  });
108
127
  }
@@ -1 +1 @@
1
- {"version":3,"file":"EntityActionEngine.js","sourceRoot":"","sources":["../../src/entity-actions/EntityActionEngine.ts"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AA0B,EAAE,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC7J,IAAI,CAAC,kBAAkB;YACnB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAElE,8CAA8C;QAC9C,OAAO,kBAAkB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;CAEJ;AAhID,gDAgIC"}
1
+ {"version":3,"file":"EntityActionEngine.js","sourceRoot":"","sources":["../../src/entity-actions/EntityActionEngine.ts"],"names":[],"mappings":";;;AAAA,+CAAkG;AAElG,mDAAkD;AAElD,+EAA2E;AAG3E;;GAEG;AACH,MAAa,4BAA4B;CA4BxC;AA5BD,oEA4BC;AAID;;GAEG;AACH,MAAa,kBAAkB;CA8B7B;AA9BF,gDA8BE;AAEF;;GAEG;AACH,MAAa,kBAAmB,SAAQ,iBAA8B;IAAtE;;QAMI,8DAA8D;QACtD,mBAAc,GAA+B,EAAE,CAAC;QAChD,wBAAmB,GAA8B,EAAE,CAAC;QACpD,iCAA4B,GAAuC,EAAE,CAAC;QACtE,yBAAoB,GAA+B,EAAE,CAAC;QACtD,6BAAwB,GAAmC,EAAE,CAAC;IAoI1E,CAAC;IA9IU,MAAM,KAAK,QAAQ;QACtB,OAAO,KAAK,CAAC,WAAW,EAAsB,CAAC;IACnD,CAAC;IAUD;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAC,eAAwB,KAAK,EAAE,WAAsB;QACrE,MAAM,OAAO,GAAwC;YACjD;gBACI,UAAU,EAAE,gCAAgC;gBAC5C,YAAY,EAAE,8BAA8B;aAC/C;YACD;gBACI,UAAU,EAAE,uBAAuB;gBACnC,YAAY,EAAE,sBAAsB;aACvC;YACD;gBACI,UAAU,EAAE,2BAA2B;gBACvC,YAAY,EAAE,0BAA0B;aAC3C;YACD;gBACI,UAAU,EAAE,gBAAgB,EAAE,0IAA0I;gBACxK,YAAY,EAAE,gBAAgB;aACjC;YACD;gBACI,UAAU,EAAE,sBAAsB;gBA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EAAE;YAC5B,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,cAAc,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAA;YAC9J,OAAO,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QACtC,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,eAAe,CAAC,MAAoC;QAC7D;;;;WAIG;QACH,IAAI,CAAC,MAAM,CAAC,YAAY;YACpB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAE/D,wDAAwD;QACxD,IAAI,CAAC,MAAM,CAAC,cAAc;YACtB,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAExD,gHAAgH;QAChH,MAAM,kBAAkB,GAAG,iBAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,cAAc,CAA6B,wDAA0B,EAAE,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC7J,IAAI,CAAC,kBAAkB;YACnB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAElE,8CAA8C;QAC9C,OAAO,kBAAkB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;CAEJ;AA/ID,gDA+IC"}
@@ -1,8 +1,9 @@
1
1
  import { UserInfo } from "@memberjunction/core";
2
- import { EntityActionEntity, EntityActionFilterEntity, EntityActionInvocationEntity } from "@memberjunction/core-entities";
2
+ import { EntityActionEntity, EntityActionFilterEntity, EntityActionInvocationEntity, EntityActionParamEntity } from "@memberjunction/core-entities";
3
3
  export declare class EntityActionEntityServer extends EntityActionEntity {
4
4
  private _filters;
5
5
  private _invocations;
6
+ private _params;
6
7
  /**
7
8
  * Get the filters for this entity action
8
9
  */
@@ -11,6 +12,7 @@ export declare class EntityActionEntityServer extends EntityActionEntity {
11
12
  * Get the invocations for this entity action
12
13
  */
13
14
  get Invocations(): EntityActionInvocationEntity[];
15
+ get Params(): EntityActionParamEntity[];
14
16
  /**
15
17
  * Override the base class Config in order to ensure that EntityActionEngine is configured
16
18
  * @param contextUser
@@ -1 +1 @@
1
- {"version":3,"file":"EntityActionEntity.server.d.ts","sourceRoot":"","sources":["../../src/entity-actions/EntityActionEntity.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAI3H,qBACa,wBAAyB,SAAQ,kBAAkB;IAC5D,OAAO,CAAC,QAAQ,CAAoC;IACpD,OAAO,CAAC,YAAY,CAAwC;IAE5D;;OAEG;IACH,IAAW,OAAO,IAAI,wBAAwB,EAAE,CAM/C;IAED;;OAEG;IACH,IAAW,WAAW,IAAI,4BAA4B,EAAE,CAMvD;IAGD;;;OAGG;IACmB,MAAM,CAAC,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAKrE"}
1
+ {"version":3,"file":"EntityActionEntity.server.d.ts","sourceRoot":"","sources":["../../src/entity-actions/EntityActionEntity.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAIpJ,qBACa,wBAAyB,SAAQ,kBAAkB;IAC5D,OAAO,CAAC,QAAQ,CAAoC;IACpD,OAAO,CAAC,YAAY,CAAwC;IAC5D,OAAO,CAAC,OAAO,CAAmC;IAElD;;OAEG;IACH,IAAW,OAAO,IAAI,wBAAwB,EAAE,CAM/C;IAED;;OAEG;IACH,IAAW,WAAW,IAAI,4BAA4B,EAAE,CAMvD;IAED,IAAW,MAAM,IAAI,uBAAuB,EAAE,CAM7C;IAGD;;;OAGG;IACmB,MAAM,CAAC,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAKrE"}
@@ -16,6 +16,7 @@ let EntityActionEntityServer = class EntityActionEntityServer extends core_entit
16
16
  super(...arguments);
17
17
  this._filters = null;
18
18
  this._invocations = null;
19
+ this._params = null;
19
20
  }
20
21
  /**
21
22
  * Get the filters for this entity action
@@ -37,6 +38,13 @@ let EntityActionEntityServer = class EntityActionEntityServer extends core_entit
37
38
  }
38
39
  return this._invocations;
39
40
  }
41
+ get Params() {
42
+ if (!this._params) {
43
+ // load the data from the EntityActionEngine
44
+ this._params = EntityActionEngine_1.EntityActionEngine.Instance.Params?.filter(p => p.EntityActionID === this.ID) ?? [];
45
+ }
46
+ return this._params;
47
+ }
40
48
  /**
41
49
  * Override the base class Config in order to ensure that EntityActionEngine is configured
42
50
  * @param contextUser
@@ -1 +1 @@
1
- {"version":3,"file":"EntityActionEntity.server.js","sourceRoot":"","sources":["../../src/entity-actions/EntityActionEntity.server.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAA4D;AAC5D,iEAA2H;AAC3H,mDAAuD;AACvD,6DAA0D;AAGnD,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,kCAAkB;IAAzD;;QACK,aAAQ,GAA+B,IAAI,CAAC;QAC5C,iBAAY,GAAmC,IAAI,CAAC;IAkChE,CAAC;IAhCG;;OAEG;IACH,IAAW,OAAO;QACd,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjB,uEAAuE;YACvE,IAAI,CAAC,QAAQ,GAAG,uCAAkB,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,KAAK,IAAI,CAAC,EAAE,CAAC,IA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ionEngine";
3
- import { ActionParamEntity } from "@memberjunction/core-entities";
1
+ import { EntityActionInvocationParams, EntityActionResult } from "./EntityActionEngine";
2
+ import { ActionParam, ActionResult } from "../generic/ActionEngine";
3
+ import { ActionParamEntity, EntityActionParamEntity } from "@memberjunction/core-entities";
4
+ import { BaseEntity } from "@memberjunction/core";
4
5
  /**
5
6
  * Base class for invocation of any entity action invocation type
6
7
  */
7
8
  export declare abstract class EntityActionInvocationBase {
8
- abstract InvokeAction(params: EntityActionInvocationParams): Promise<ActionResult>;
9
+ abstract InvokeAction(params: EntityActionInvocationParams): Promise<EntityActionResult>;
9
10
  /**
10
11
  * Case insensitive helper method to find a param by valueType
11
12
  * @param allParams
12
13
  * @param valueType
13
14
  */
14
- FindParam(allParams: ActionParamEntity[], valueType: "Scalar" | "Simple Object" | "BaseEntity Sub-Class" | "Other"): ActionParamEntity;
15
+ FindActionParam(allParams: ActionParamEntity[], valueType: "Scalar" | "Simple Object" | "BaseEntity Sub-Class" | "Other"): ActionParamEntity;
16
+ MapActionResultToEntityActionResult(result: ActionResult): EntityActionResult;
17
+ /**
18
+ * This method will map the Entity Action Params to the Action Params and where needed evaluate scripts to get the run-time values that need
19
+ * to get passed to the Action.
20
+ * @param params
21
+ * @param entityActionParams
22
+ * @param entityObject
23
+ * @returns
24
+ */
25
+ MapParams(params: ActionParamEntity[], entityActionParams: EntityActionParamEntity[], entityObject: BaseEntity): Promise<ActionParam[]>;
26
+ private _scriptCache;
27
+ /**
28
+ * Attempt to execute a script and wraps in try/catch to handle any errors so that no exceptions are thrown
29
+ * The scripts are passed an object called EntityActionContext which has a property called entityObject that is the entity object
30
+ * for the current Entity Action. The script can do whatever it wants to do, and passes back a value in the result property of the EntityActionContext object
31
+ * @param scriptText the script to execute
32
+ * @param entityObject the entity object to pass to the script
33
+ */
34
+ SafeEvalScript(EntityActionID: number, scriptText: string, entityObject: BaseEntity): Promise<any>;
15
35
  }
16
36
  /**
17
37
  * Base class for invocation of any entity action invocation type that is single record oriented
18
38
  */
19
39
  export declare class EntityActionInvocationSingleRecord extends EntityActionInvocationBase {
20
40
  ValidateParams(params: EntityActionInvocationParams): Promise<boolean>;
21
- InvokeAction(params: EntityActionInvocationParams): Promise<ActionResult>;
41
+ InvokeAction(params: EntityActionInvocationParams): Promise<EntityActionResult>;
42
+ }
43
+ /**
44
+ * Base class for invocation of any entity action invocation type that is multiple-record oriented. Handles
45
+ * getting the list of records from the provided parameters (either ListID or ViewID), getting the actual records
46
+ * for each of those scenarios, and then invoking the action for each record, aggregating the results and returning
47
+ * a single ActionResult object.
48
+ */
49
+ export declare class EntityActionInvocationMultipleRecords extends EntityActionInvocationBase {
50
+ ValidateParams(params: EntityActionInvocationParams): Promise<boolean>;
51
+ InvokeAction(params: EntityActionInvocationParams): Promise<EntityActionResult>;
52
+ protected GetRecordList(): Promise<BaseEntity[]>;
22
53
  }
23
54
  /**
24
55
  * This class handles the invocation type of Validate and uses Entity Actions to validate a record and provide the results back to the caller
25
56
  */
26
57
  export declare class EntityActionInvocationValidate extends EntityActionInvocationSingleRecord {
27
- InvokeAction(params: EntityActionInvocationParams): Promise<ActionResult>;
58
+ InvokeAction(params: EntityActionInvocationParams): Promise<EntityActionResult>;
28
59
  }
29
60
  //# sourceMappingURL=EntityActionInvocationTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EntityActionInvocationTypes.d.ts","sourceRoot":"","sources":["../../src/entity-actions/EntityActionInvocationTypes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAA6B,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE;;GAEG;AACH,8BAAsB,0BAA0B;aAC5B,YAAY,CAAC,MAAM,EAAE,4BAA4B,GAAG,OAAO,CAAC,YAAY,CAAC;IAEzF;;;;OAIG;IACI,SAAS,CAAC,SAAS,EAAE,iBAAiB,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AAO,CAAC,YAAY,CAAsD;IAE1E;;;;;;OAMG;IACU,cAAc,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;CA0BlH;AAED;;GAEG;AACH,qBAQa,kCAAmC,SAAQ,0BAA0B;IACjE,cAAc,CAAC,MAAM,EAAE,4BAA4B,GAAG,OAAO,CAAC,OAAO,CAAC;IAQtE,YAAY,CAAC,MAAM,EAAE,4BAA4B,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA2B/F;AAED;;;;;GAKG;AACH,qBAEa,qCAAsC,SAAQ,0BAA0B;IACpE,cAAc,CAAC,MAAM,EAAE,4BAA4B,GAAG,OAAO,CAAC,OAAO,CAAC;IAgBtE,YAAY,CAAC,MAAM,EAAE,4BAA4B,GAAG,OAAO,CAAC,kBAAkB,CAAC;cAqC5E,aAAa,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;CAGzD;AAED;;GAEG;AACH,qBACa,8BAA+B,SAAQ,kCAAkC;IAC5D,YAAY,CAAC,MAAM,EAAE,4BAA4B,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAwBxG"}
@@ -6,21 +6,100 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.EntityActionInvocationValidate = exports.EntityActionInvocationSingleRecord = exports.EntityActionInvocationBase = void 0;
9
+ exports.EntityActionInvocationValidate = exports.EntityActionInvocationMultipleRecords = exports.EntityActionInvocationSingleRecord = exports.EntityActionInvocationBase = void 0;
10
10
  const global_1 = require("@memberjunction/global");
11
11
  const ActionEngine_1 = require("../generic/ActionEngine");
12
12
  /**
13
13
  * Base class for invocation of any entity action invocation type
14
14
  */
15
15
  class EntityActionInvocationBase {
16
+ constructor() {
17
+ this._scriptCache = new Map();
18
+ }
16
19
  /**
17
20
  * Case insensitive helper method to find a param by valueType
18
21
  * @param allParams
19
22
  * @param valueType
20
23
  */
21
- FindParam(allParams, valueType) {
24
+ FindActionParam(allParams, valueType) {
22
25
  return allParams.find(p => p.ValueType.trim().toLowerCase() === valueType.trim().toLowerCase());
23
26
  }
27
+ MapActionResultToEntityActionResult(result) {
28
+ return {
29
+ Success: result.Success,
30
+ Message: result.Message,
31
+ RunParams: result.RunParams,
32
+ LogEntry: result.LogEntry
33
+ };
34
+ }
35
+ /**
36
+ * This method will map the Entity Action Params to the Action Params and where needed evaluate scripts to get the run-time values that need
37
+ * to get passed to the Action.
38
+ * @param params
39
+ * @param entityActionParams
40
+ * @param entityObject
41
+ * @returns
42
+ */
43
+ async MapParams(params, entityActionParams, entityObject) {
44
+ const returnValues = [];
45
+ for (const eap of entityActionParams) {
46
+ const param = params.find(p => p.ID === eap.ActionParamID);
47
+ let value = null;
48
+ switch (eap.ValueType) {
49
+ case 'Static':
50
+ // value could be a scalar or could be JSON. if JSON, we need to parse it so attempt to parse it and if we get a non-null value
51
+ // back then we use that, otherwise we use the original value
52
+ const jsonValue = (0, global_1.SafeJSONParse)(eap.Value);
53
+ if (jsonValue)
54
+ value = jsonValue;
55
+ else
56
+ value = eap.Value;
57
+ break;
58
+ case 'Entity Object':
59
+ value = entityObject;
60
+ break;
61
+ case 'Script':
62
+ value = await this.SafeEvalScript(eap.ID, eap.Value, entityObject);
63
+ break;
64
+ }
65
+ returnValues.push({
66
+ Name: param.Name,
67
+ Value: value
68
+ });
69
+ }
70
+ return returnValues;
71
+ }
72
+ /**
73
+ * Attempt to execute a script and wraps in try/catch to handle any errors so that no exceptions are thrown
74
+ * The scripts are passed an object called EntityActionContext which has a property called entityObject that is the entity object
75
+ * for the current Entity Action. The script can do whatever it wants to do, and passes back a value in the result property of the EntityActionContext object
76
+ * @param scriptText the script to execute
77
+ * @param entityObject the entity object to pass to the script
78
+ */
79
+ async SafeEvalScript(EntityActionID, scriptText, entityObject) {
80
+ const entityActionContext = {
81
+ entityObject,
82
+ result: null
83
+ };
84
+ try {
85
+ let scriptFunction;
86
+ if (this._scriptCache.has(EntityActionID)) {
87
+ scriptFunction = this._scriptCache.get(EntityActionID);
88
+ }
89
+ else
90
+ scriptFunction = new Function('EntityActionContext', `
91
+ return (async () => {
92
+ ${scriptText}
93
+ })();
94
+ `);
95
+ await scriptFunction(entityActionContext);
96
+ return entityActionContext.result;
97
+ }
98
+ catch (e) {
99
+ console.error(`Error executing script: ${e.message}`);
100
+ return null;
101
+ }
102
+ }
24
103
  }
25
104
  exports.EntityActionInvocationBase = EntityActionInvocationBase;
26
105
  /**
@@ -40,19 +119,17 @@ let EntityActionInvocationSingleRecord = class EntityActionInvocationSingleRecor
40
119
  // now do the work
41
120
  // get the class that is derived from BaseAction for the Action Name
42
121
  await ActionEngine_1.ActionEngine.Instance.Config(false, params.ContextUser);
122
+ // prepare the variables for the action
43
123
  const action = ActionEngine_1.ActionEngine.Instance.Actions.find(a => a.ID === params.EntityAction.ActionID);
44
- const param = this.FindParam(action.Params, 'BaseEntity Sub-Class'); // find the base entity sub-class param
45
- const internalParams = [{
46
- Name: param.Name, // parameter could be named anything, but we know it's the base entity sub-class so we are using it here
47
- Value: params.EntityObject
48
- }];
124
+ const internalParams = await this.MapParams(action.Params, params.EntityAction.Params, params.EntityObject);
125
+ const filters = params.EntityAction.Filters.map(f => {
126
+ const filter = ActionEngine_1.ActionEngine.Instance.ActionFilters.find(fi => fi.ID === f.ActionFilterID);
127
+ return filter;
128
+ });
49
129
  const result = await ActionEngine_1.ActionEngine.Instance.RunAction({
50
130
  Action: action,
51
131
  ContextUser: params.ContextUser,
52
- Filters: params.EntityAction.Filters.map(f => {
53
- const filter = ActionEngine_1.ActionEngine.Instance.ActionFilters.find(fi => fi.ID === f.ActionFilterID);
54
- return filter;
55
- }),
132
+ Filters: filters,
56
133
  Params: internalParams
57
134
  });
58
135
  return result;
@@ -69,8 +146,72 @@ exports.EntityActionInvocationSingleRecord = EntityActionInvocationSingleRecord
69
146
  (0, global_1.RegisterClass)(EntityActionInvocationBase, 'BeforeDelete'),
70
147
  (0, global_1.RegisterClass)(EntityActionInvocationBase, 'AfterCreate'),
71
148
  (0, global_1.RegisterClass)(EntityActionInvocationBase, 'AfterUpdate'),
72
- (0, global_1.RegisterClass)(EntityActionInvocationBase, 'AfterDelete')
149
+ (0, global_1.RegisterClass)(EntityActionInvocationBase, 'AfterDelete'),
150
+ (0, global_1.RegisterClass)(EntityActionInvocationBase, 'SingleRecord')
73
151
  ], EntityActionInvocationSingleRecord);
152
+ /**
153
+ * Base class for invocation of any entity action invocation type that is multiple-record oriented. Handles
154
+ * getting the list of records from the provided parameters (either ListID or ViewID), getting the actual records
155
+ * for each of those scenarios, and then invoking the action for each record, aggregating the results and returning
156
+ * a single ActionResult object.
157
+ */
158
+ let EntityActionInvocationMultipleRecords = class EntityActionInvocationMultipleRecords extends EntityActionInvocationBase {
159
+ async ValidateParams(params) {
160
+ // for this type of invocation we need to validate that the EntityObject is not null
161
+ const invoType = params.InvocationType.Name.trim().toLowerCase();
162
+ if (invoType === 'list' && !params.ListID) {
163
+ throw new Error('ListID is required for multiple record invocation when InvocationType=List');
164
+ }
165
+ else if (invoType === 'view' && !params.ViewID) {
166
+ throw new Error('ViewID is required for multiple record invocation when InvocationType=View');
167
+ }
168
+ else if (invoType !== 'list' && invoType !== 'view') {
169
+ throw new Error('This class only supports invocation types of List or View.');
170
+ }
171
+ else
172
+ return true;
173
+ }
174
+ async InvokeAction(params) {
175
+ // for this type of invocation we need to validate that we have either a list or a view
176
+ if (this.ValidateParams(params)) {
177
+ // now do the work
178
+ // get the class that is derived from BaseAction for the Action Name
179
+ await ActionEngine_1.ActionEngine.Instance.Config(false, params.ContextUser);
180
+ // prepare the variables for the action
181
+ const action = ActionEngine_1.ActionEngine.Instance.Actions.find(a => a.ID === params.EntityAction.ActionID);
182
+ // get the priority sub-class for the SingleRecord invocation type that we need now
183
+ const invocationInstance = global_1.MJGlobal.Instance.ClassFactory.CreateInstance(EntityActionInvocationBase, 'SingleRecord'); // get the single record class
184
+ if (!invocationInstance)
185
+ throw new Error('Error creating instance of invocation type');
186
+ // now, we loop through the list of records and invoke the action for each one
187
+ const recordList = await this.GetRecordList();
188
+ const results = [];
189
+ for (const record of recordList) {
190
+ const innerParams = { ...params };
191
+ innerParams.EntityObject = record;
192
+ const result = await invocationInstance.InvokeAction(innerParams);
193
+ results.push(result);
194
+ }
195
+ const consolidatedResult = {
196
+ Success: results.every(r => r.Success),
197
+ Message: results.map(r => r.Message).join('\n'),
198
+ RunParams: null,
199
+ LogEntry: null
200
+ };
201
+ return consolidatedResult;
202
+ }
203
+ else
204
+ return null;
205
+ }
206
+ async GetRecordList() {
207
+ return [];
208
+ }
209
+ };
210
+ exports.EntityActionInvocationMultipleRecords = EntityActionInvocationMultipleRecords;
211
+ exports.EntityActionInvocationMultipleRecords = EntityActionInvocationMultipleRecords = __decorate([
212
+ (0, global_1.RegisterClass)(EntityActionInvocationBase, 'List'),
213
+ (0, global_1.RegisterClass)(EntityActionInvocationBase, 'View')
214
+ ], EntityActionInvocationMultipleRecords);
74
215
  /**
75
216
  * This class handles the invocation type of Validate and uses Entity Actions to validate a record and provide the results back to the caller
76
217
  */
@@ -81,11 +222,7 @@ let EntityActionInvocationValidate = class EntityActionInvocationValidate extend
81
222
  // make sure the action engine is good to go, the below won't do anything if it was already configured
82
223
  await ActionEngine_1.ActionEngine.Instance.Config(false, params.ContextUser);
83
224
  const action = ActionEngine_1.ActionEngine.Instance.Actions.find(a => a.ID === params.EntityAction.ActionID);
84
- const param = this.FindParam(action.Params, 'BaseEntity Sub-Class'); // find the base entity sub-class param
85
- const internalParams = [{
86
- Name: param.Name, // parameter could be named anything, but we know it's the base entity sub-class so we are using it here
87
- Value: params.EntityObject
88
- }];
225
+ const internalParams = await this.MapParams(action.Params, params.EntityAction.Params, params.EntityObject);
89
226
  const result = await ActionEngine_1.ActionEngine.Instance.RunAction({
90
227
  Action: action,
91
228
  ContextUser: params.ContextUser,
@@ -1 +1 @@
1
- {"version":3,"file":"EntityActionInvocationTypes.js","sourceRoot":"","sources":["../../src/entity-actions/EntityActionInvocationTypes.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAAuD;AAEvD,0DAAkF;AAGlF;;GAEG;AACH,MAAsB,0BAA0B;IAG5C;;;;OAIG;IACI,SAAS,CAAC,SAA8B,EAAE,SAAwE;QACrH,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;IACpG,CAAC;CACJ;AAXD,gEAWC;AAED;;GAEG;AAQI,IAAM,kCAAkC,GAAxC,MAAM,kCAAmC,SAAQ,0BAA0B;IACvE,KAAK,CAAC,cAAc,CAAC,MAAoC;QAC5D,oFAAoF;QACpF,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,mFAAmF,CAAC,CAAC;QACzG,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,MAAoC;QAC1D,oFAAoF;QACpF,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9B,kBAAkB;YAClB,oEAAoE;YACpE,MAAM,2BAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;YAE9D,MAAM,MAAM,GAAG,2BAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;YAC9F,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC,CAAC,wCAAwC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CAAC,CAAC,EAAE;oBACzC,MAAM,MAAM,GAAG,2BAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,cAAc,CAAC,CAAC;oBAC1F,OAAO,MAAM,CAAC;gBAClB,CAAC,CAAC;gBACF,MAAM,EAAE,cAAc;aACzB,CAAC,CAAA;YAEF,OAAO,MAAM,CAAA;QACjB,CAAC;;YAEG,OAAO,IAAI,CAAC;IACpB,CAAC;CACJ,CAAA;AAzBY,wEAA8B;yCAA9B,8BAA8B;IAD1C,IAAA,sBAAa,EAAC,0BAA0B,EAAE,UAAU,CAAC;GACzC,8BAA8B,CAyB1C"}
@@ -81,7 +81,7 @@ export declare class ActionResult {
81
81
  Params?: ActionParam[];
82
82
  }
83
83
  /**
84
- * Generic class for holding parameters for an action for both inputs and outputs
84
+ * Runtime parameter class that is used to pass key/value pairs in arrays to/from the action engine.
85
85
  */
86
86
  export declare class ActionParam {
87
87
  /**
@@ -26,7 +26,7 @@ class ActionResult {
26
26
  }
27
27
  exports.ActionResult = ActionResult;
28
28
  /**
29
- * Generic class for holding parameters for an action for both inputs and outputs
29
+ * Runtime parameter class that is used to pass key/value pairs in arrays to/from the action engine.
30
30
  */
31
31
  class ActionParam {
32
32
  }
@@ -1,6 +1,6 @@
1
1
  import { EntityInfo, EntitySaveOptions } from "@memberjunction/core";
2
2
  import { ActionEntity, ActionLibraryEntity, ActionParamEntity, ActionResultCodeEntity } from "@memberjunction/core-entities";
3
- import { GeneratedCode } from "./ActionEngine";
3
+ import { ActionLibrary, GeneratedCode } from "./ActionEngine";
4
4
  import { BaseLLM, ChatParams } from "@memberjunction/ai";
5
5
  /**
6
6
  * Server-Only custom sub-class for Actions entity. This sub-class handles the process of auto-generation code for the Actions entity.
@@ -36,6 +36,7 @@ export declare class ActionEntityServerEntity extends ActionEntity {
36
36
  * @returns
37
37
  */
38
38
  Save(options?: EntitySaveOptions): Promise<boolean>;
39
+ protected manageLibraries(codeLibraries: ActionLibrary[], wasNewRecord: boolean): Promise<boolean>;
39
40
  protected SendMessage(message: string): void;
40
41
  /**
41
42
  * This method will generate code using a combination of the UserPrompt field as well as the overall context of how an Action gets executed. Code from the Action is later used by CodeGen to inject into
@@ -44,7 +45,11 @@ export declare class ActionEntityServerEntity extends ActionEntity {
44
45
  */
45
46
  GenerateCode(maxAttempts?: number): Promise<GeneratedCode>;
46
47
  protected InternalGenerateCode(llm: BaseLLM, chatParams: ChatParams, attemptsRemaining: number): Promise<GeneratedCode>;
48
+ protected ValidateCode(llm: BaseLLM, userRequest: string, generatedCode: GeneratedCode, attemptsRemaining: number): Promise<GeneratedCode>;
47
49
  GenerateSysPrompt(): string;
50
+ GenerateValidateCodePrompt(userRequest: string, generatedCode: GeneratedCode): string;
51
+ GenerateContextInfo(): string;
52
+ GenerateRunViewParamsInfo(): string;
48
53
  }
49
54
  export declare function LoadActionEntityServer(): void;
50
55
  //# sourceMappingURL=ActionEntity.server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActionEntity.server.d.ts","sourceRoot":"","sources":["../../src/generic/ActionEntity.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,UAAU,EAAE,iBAAiB,EAA+B,MAAM,sBAAsB,CAAC;AAClI,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAI7H,OAAO,EAA+B,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,UAAU,EAAe,MAAM,oBAAoB,CAAC;AAEtE;;GAEG;AACH,qBACa,wBAAyB,SAAQ,YAAY;gBAC1C,MAAM,EAAE,UAAU;IAO9B;;;OAGG;IACH,SAAS,KAAK,YAAY,IAAI,MAAM,CAEnC;IAED;;OAEG;IACH,IAAW,gBAAgB,IAAI,MAAM,CAEpC;IAED;;OAEG;IACH,IAAW,YAAY,I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;IAED;;OAEG;IACH,IAAW,YAAY,IAAI,OAAO,CAEjC;IAED,OAAO,CAAC,YAAY,CAAkC;IACtD;;OAEG;IACH,IAAW,WAAW,IAAI,sBAAsB,EAAE,CAMjD;IAED,OAAO,CAAC,OAAO,CAA6B;IAC5C,IAAW,MAAM,IAAI,iBAAiB,EAAE,CAMvC;IAED,OAAO,CAAC,KAAK,CAA+B;IAC5C,IAAW,SAAS,IAAI,mBAAmB,EAAE,CAM5C;IAGD;;;;;OAKG;IACmB,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;cAsCzD,eAAe,CAAC,aAAa,EAAE,aAAa,EAAE,EAAE,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IA4DxG,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM;IAQrC;;;;OAIG;IACU,YAAY,CAAC,WAAW,GAAE,MAAU,GAAG,OAAO,CAAC,aAAa,CAAC;cAqC1D,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;cAqD7G,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IA8BzI,iBAAiB,IAAI,MAAM;IA+B3B,0BAA0B,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,GAAG,MAAM;IA2DrF,mBAAmB,IAAI,MAAM;IAsH7B,yBAAyB,IAAI,MAAM;CAsG7C;AAED,wBAAgB,sBAAsB,SAIrC"}
@@ -16,6 +16,7 @@ const global_1 = require("@memberjunction/global");
16
16
  const aiengine_1 = require("@memberjunction/aiengine");
17
17
  const ActionEngine_1 = require("./ActionEngine");
18
18
  const ai_1 = require("@memberjunction/ai");
19
+ const doc_utils_1 = require("@memberjunction/doc-utils");
19
20
  /**
20
21
  * Server-Only custom sub-class for Actions entity. This sub-class handles the process of auto-generation code for the Actions entity.
21
22
  */
@@ -81,9 +82,13 @@ let ActionEntityServerEntity = class ActionEntityServerEntity extends core_entit
81
82
  async Save(options) {
82
83
  // make sure the ActionEngine is configured
83
84
  await ActionEngine_1.ActionEngine.Instance.Config(false, this.ContextCurrentUser);
85
+ await doc_utils_1.DocumentationEngine.Instance.Config(false, this.ContextCurrentUser);
84
86
  let newCodeGenerated = false;
85
87
  let codeLibraries = [];
86
- if (this.GetFieldByName('UserPrompt').Dirty || !this.IsSaved || this.ForceCodeGeneration) {
88
+ if (this.Type === 'Generated' && // only generate when the type is Generated
89
+ !this.CodeLocked && // only generate when the code is not locked
90
+ (this.GetFieldByName('UserPrompt').Dirty || !this.IsSaved || this.ForceCodeGeneration) // only generate when the UserPrompt field is dirty or this is a new record or we are being asked to FORCE code generation
91
+ ) {
87
92
  // UserPrompt field is dirty, or this is a new record, either way, this is the condition where we want to generate the Code.
88
93
  const result = await this.GenerateCode();
89
94
  if (result.Success) {
@@ -101,64 +106,66 @@ let ActionEntityServerEntity = class ActionEntityServerEntity extends core_entit
101
106
  this.ForceCodeGeneration = false; // make sure to reset this flag every time we save, it should never live past one run of the Save method, of course if Save fails, below, then it will not be reset
102
107
  const wasNewRecord = !this.IsSaved;
103
108
  if (await super.Save(options)) {
104
- if (newCodeGenerated) {
105
- // new code was generated, we need to sync up the ActionLibraries table with the libraries used in the code for this Action
106
- // get a list of existing ActionLibrary records that match this Action
107
- const existingLibraries = [];
108
- if (!wasNewRecord) {
109
- const rv = new core_1.RunView();
110
- const libResult = await rv.RunView({
111
- EntityName: 'Action Libraries',
112
- ExtraFilter: `ActionID = ${this.ID}`,
113
- ResultType: 'entity_object'
114
- }, this.ContextCurrentUser);
115
- if (libResult.Success && libResult.Results.length > 0) {
116
- existingLibraries.push(...libResult.Results);
117
- }
118
- }
119
- // now we need to go through the libraries we ARE currently using in the current code and make sure they are in the ActionLibraries table
120
- // and make sure nothing is in the table that we are not using
121
- const librariesToAdd = codeLibraries.filter(l => !existingLibraries.some(el => el.Library.trim().toLowerCase() === l.LibraryName.trim().toLowerCase()));
122
- const librariesToRemove = existingLibraries.filter(el => !codeLibraries.some(l => l.LibraryName.trim().toLowerCase() === el.Library.trim().toLowerCase()));
123
- const librariesToUpdate = existingLibraries.filter(el => codeLibraries.some(l => l.LibraryName.trim().toLowerCase() === el.Library.trim().toLowerCase()));
124
- const md = new core_1.Metadata();
125
- const tg = await md.CreateTransactionGroup();
126
- for (const lib of librariesToAdd) {
127
- const libMetadata = md.Libraries.find(l => l.Name.trim().toLowerCase() === lib.LibraryName.trim().toLowerCase());
128
- if (libMetadata) {
129
- const newLib = await md.GetEntityObject('Action Libraries', this.ContextCurrentUser);
130
- newLib.ActionID = this.ID;
131
- newLib.LibraryID = libMetadata.ID;
132
- newLib.ItemsUsed = lib.ItemsUsed.join(',');
133
- newLib.TransactionGroup = tg;
134
- newLib.Save(); // no await, within a TG
135
- }
136
- }
137
- // now update the libraries that were already in place to ensure the ItemsUsed are up to date
138
- for (const lib of librariesToUpdate) {
139
- const newCode = codeLibraries.find(l => l.LibraryName.trim().toLowerCase() === lib.Library.trim().toLowerCase());
140
- lib.ItemsUsed = newCode.ItemsUsed.join(',');
141
- lib.TransactionGroup = tg;
142
- lib.Save(); // no await, within a TG
143
- }
144
- // now remove the libraries that are no longer used
145
- for (const lib of librariesToRemove) {
146
- // each lib in this array iteration is already a BaseEntity derived object
147
- lib.TransactionGroup = tg;
148
- lib.Delete(); // no await, within a TG
149
- }
150
- // now commit the transaction
151
- if (await tg.Submit())
152
- return true;
153
- else
154
- return false;
155
- }
109
+ if (newCodeGenerated)
110
+ return this.manageLibraries(codeLibraries, wasNewRecord);
156
111
  else
157
112
  return true;
158
113
  }
159
114
  else
160
115
  return false;
161
116
  }
117
+ async manageLibraries(codeLibraries, wasNewRecord) {
118
+ // new code was generated, we need to sync up the ActionLibraries table with the libraries used in the code for this Action
119
+ // get a list of existing ActionLibrary records that match this Action
120
+ const existingLibraries = [];
121
+ if (!wasNewRecord) {
122
+ const rv = new core_1.RunView();
123
+ const libResult = await rv.RunView({
124
+ EntityName: 'Action Libraries',
125
+ ExtraFilter: `ActionID = ${this.ID}`,
126
+ ResultType: 'entity_object'
127
+ }, this.ContextCurrentUser);
128
+ if (libResult.Success && libResult.Results.length > 0) {
129
+ existingLibraries.push(...libResult.Results);
130
+ }
131
+ }
132
+ // now we need to go through the libraries we ARE currently using in the current code and make sure they are in the ActionLibraries table
133
+ // and make sure nothing is in the table that we are not using
134
+ const librariesToAdd = codeLibraries.filter(l => !existingLibraries.some(el => el.Library.trim().toLowerCase() === l.LibraryName.trim().toLowerCase()));
135
+ const librariesToRemove = existingLibraries.filter(el => !codeLibraries.some(l => l.LibraryName.trim().toLowerCase() === el.Library.trim().toLowerCase()));
136
+ const librariesToUpdate = existingLibraries.filter(el => codeLibraries.some(l => l.LibraryName.trim().toLowerCase() === el.Library.trim().toLowerCase()));
137
+ const md = new core_1.Metadata();
138
+ const tg = await md.CreateTransactionGroup();
139
+ for (const lib of librariesToAdd) {
140
+ const libMetadata = md.Libraries.find(l => l.Name.trim().toLowerCase() === lib.LibraryName.trim().toLowerCase());
141
+ if (libMetadata) {
142
+ const newLib = await md.GetEntityObject('Action Libraries', this.ContextCurrentUser);
143
+ newLib.ActionID = this.ID;
144
+ newLib.LibraryID = libMetadata.ID;
145
+ newLib.ItemsUsed = lib.ItemsUsed.join(',');
146
+ newLib.TransactionGroup = tg;
147
+ newLib.Save(); // no await, within a TG
148
+ }
149
+ }
150
+ // now update the libraries that were already in place to ensure the ItemsUsed are up to date
151
+ for (const lib of librariesToUpdate) {
152
+ const newCode = codeLibraries.find(l => l.LibraryName.trim().toLowerCase() === lib.Library.trim().toLowerCase());
153
+ lib.ItemsUsed = newCode.ItemsUsed.join(',');
154
+ lib.TransactionGroup = tg;
155
+ lib.Save(); // no await, within a TG
156
+ }
157
+ // now remove the libraries that are no longer used
158
+ for (const lib of librariesToRemove) {
159
+ // each lib in this array iteration is already a BaseEntity derived object
160
+ lib.TransactionGroup = tg;
161
+ lib.Delete(); // no await, within a TG
162
+ }
163
+ // now commit the transaction
164
+ if (await tg.Submit())
165
+ return true;
166
+ else
167
+ return false;
168
+ }
162
169
  SendMessage(message) {
163
170
  global_1.MJGlobal.Instance.RaiseEvent({
164
171
  args: { message },
@@ -174,7 +181,7 @@ let ActionEntityServerEntity = class ActionEntityServerEntity extends core_entit
174
181
  */
175
182
  async GenerateCode(maxAttempts = 3) {
176
183
  try {
177
- this.SendMessage('Generating code for action ' + this.Name);
184
+ this.SendMessage('Generating code... ');
178
185
  const model = await aiengine_1.AIEngine.Instance.GetHighestPowerModel(this.AIVendorName, 'llm', this.ContextCurrentUser);
179
186
  const llm = global_1.MJGlobal.Instance.ClassFactory.CreateInstance(ai_1.BaseLLM, model.DriverClass, (0, ai_1.GetAIAPIKey)(model.DriverClass));
180
187
  const chatParams = {
@@ -190,7 +197,16 @@ let ActionEntityServerEntity = class ActionEntityServerEntity extends core_entit
190
197
  },
191
198
  ],
192
199
  };
193
- return await this.InternalGenerateCode(llm, chatParams, maxAttempts);
200
+ let result = await this.InternalGenerateCode(llm, chatParams, maxAttempts);
201
+ if (result.Success) {
202
+ //now run the code through the QA agent to make sure the code is valid
203
+ let qaResult = await this.ValidateCode(llm, this.UserPrompt, result, maxAttempts);
204
+ return qaResult;
205
+ }
206
+ else {
207
+ //something went wrong in the first pass, just return the error
208
+ return result;
209
+ }
194
210
  }
195
211
  catch (e) {
196
212
  (0, core_1.LogError)(e);
@@ -210,12 +226,17 @@ let ActionEntityServerEntity = class ActionEntityServerEntity extends core_entit
210
226
  const parsed = JSON.parse(cleansed);
211
227
  if (parsed.code && parsed.code.length > 0) {
212
228
  const trimmed = parsed.code.trim();
213
- return {
229
+ let comments = parsed.explanation;
230
+ if (parsed.reflection) {
231
+ comments = comments + `\n ${parsed.reflection}`;
232
+ }
233
+ const result = {
214
234
  Success: true,
215
235
  Code: trimmed,
216
236
  Comments: parsed.explanation,
217
237
  LibrariesUsed: parsed.libraries
218
238
  };
239
+ return result;
219
240
  }
220
241
  else {
221
242
  throw new Error('Invalid JSON response from AI: ' + llmResponse);
@@ -231,7 +252,6 @@ let ActionEntityServerEntity = class ActionEntityServerEntity extends core_entit
231
252
  (0, core_1.LogError)(e);
232
253
  if (attemptsRemaining > 1) {
233
254
  // try again
234
- this.SendMessage(`Failed to generate code, trying again (up to ${attemptsRemaining} time${attemptsRemaining > 1 ? 's' : ''})`);
235
255
  return await this.InternalGenerateCode(llm, chatParams, attemptsRemaining - 1);
236
256
  }
237
257
  else
@@ -243,6 +263,33 @@ let ActionEntityServerEntity = class ActionEntityServerEntity extends core_entit
243
263
  };
244
264
  }
245
265
  }
266
+ async ValidateCode(llm, userRequest, generatedCode, attemptsRemaining) {
267
+ this.SendMessage(`Reviewing code...`);
268
+ const model = await aiengine_1.AIEngine.Instance.GetHighestPowerModel(this.AIVendorName, 'llm', this.ContextCurrentUser);
269
+ const promptMessage = this.GenerateValidateCodePrompt(userRequest, generatedCode);
270
+ const validatePrompt = {
271
+ role: 'system',
272
+ content: promptMessage
273
+ };
274
+ let chatParams = new ai_1.ChatParams();
275
+ chatParams.messages = [validatePrompt];
276
+ chatParams.model = model.APINameOrName;
277
+ let result = await this.InternalGenerateCode(llm, chatParams, attemptsRemaining);
278
+ if (result.Success) {
279
+ return result;
280
+ }
281
+ else if (attemptsRemaining > 1) {
282
+ return this.ValidateCode(llm, userRequest, generatedCode, attemptsRemaining - 1);
283
+ }
284
+ else {
285
+ return {
286
+ Success: false,
287
+ Code: '',
288
+ Comments: `Error communicating with AI: ${result.Comments}`,
289
+ LibrariesUsed: []
290
+ };
291
+ }
292
+ }
246
293
  GenerateSysPrompt() {
247
294
  const prompt = `<RETURN_FORMAT>
248
295
  * CRITICAL - I am a bot, I can ONLY understand fully formed JSON responses
@@ -258,7 +305,82 @@ for inputs/outputs and the ActionResultSimple class that is provided. The code y
258
305
  it is called by the user.
259
306
  </INTRODUCTION>
260
307
 
261
- <CODE_EXAMPLE>
308
+ ${this.GenerateContextInfo()}
309
+
310
+ Your response must be JSON and parsable into this type:
311
+ const returnType = {
312
+ code: string, // The typescript code you will create that will work in the context described above. Make sure to include line breaks, but not tabs. That is, pretty format in terms of new lines, but do NOT indent with spaces/tabs, as I'll handle indentation.
313
+ explanation: string // an explanation for a semi-technical person explaining what the code does. Here again use line breaks liberally to make it easy to read but do NOT indent with spaces/tabs as I will handle that. Use * lists and numbered lists as appropriate.
314
+ libraries: [
315
+ {LibraryName: string, ItemsUsed: string[]}, // tell me the libraries you have used in the code you created here in this array of libraries. I need this info to properly import them in the final code.
316
+ ]
317
+ };
318
+ </CRITICAL>
319
+ **** REMEMBER **** I am a BOT, do not return anything other than the above JSON format to me or I will choke on your response!
320
+ `;
321
+ return prompt;
322
+ }
323
+ GenerateValidateCodePrompt(userRequest, generatedCode) {
324
+ return `<RETURN_FORMAT>
325
+ * CRITICAL - I am a bot, I can ONLY understand fully formed JSON responses
326
+ * YOUR RESPONSE MUST BE A JSON OBJECT
327
+ * MORE INFO BELOW
328
+ </RETURN_FORMAT>
329
+
330
+ <INTRODUCTION>
331
+ You are an expert in TypeScript coding and business applications. You take great pride in easy to read, commented, and nicely formatted code.
332
+ You are also exceptional in catching errors in other people's code and providing clear and easy to understand bug fixes, with comments explaining the
333
+ issues and how you corrected it.
334
+ You will be provided a request for how to handle a specific type of action that they want created, as well code written by someone else that attempts
335
+ to satisfy the request. An action is a "verb" in the MemberJunction framework that can do basically anything the user asks for.
336
+ Your job is to:
337
+ 1 - Verify that the given code can successfully compile and run, using the provided libraries and parameters.
338
+ 2- Verify that the given code satifies the user's request.
339
+ </INTRODUCTION>
340
+
341
+ The user's original request was:
342
+ ${userRequest}
343
+
344
+ The generated code is below:
345
+ <GENERATEDCODE>
346
+ ${generatedCode.Code}
347
+ </GENERATEDCODE>
348
+
349
+ Here are some comments about the above code:
350
+ <CODECOMMENTS>
351
+ ${generatedCode.Comments}
352
+ </CODECOMMENTS>
353
+
354
+ As well as the libraries used in the above code:
355
+ <LIBRARIESUSED>
356
+ ${JSON.stringify(generatedCode.LibrariesUsed, null, 2)}
357
+ </LIBRARIESUSED>
358
+
359
+ <CONTEXTINFO>
360
+ Here is some additional info to help you:
361
+ ${this.GenerateContextInfo()}
362
+ </CONTEXTINFO>
363
+
364
+ <RUNVIEWINFO>
365
+ Here is some additonal info regarding the RunViewParams object
366
+ ${this.GenerateRunViewParamsInfo()}
367
+ </RUNVIEWINFO>
368
+
369
+ Your response must be JSON and parsable into this type:
370
+ const returnType = {
371
+ reflection: string, //Jot down your notes here on why you think the given code was valid or not. If it wasnt, write down why it isnt. Is it because there are syntax or logic errors, or because it doesnt satisfy the user's request?
372
+ success: boolean //whether or not the above code is valid and can successfully compile and run, using the given libraries and data types
373
+ code: string, // If the code is not valid, you will populate this field with the same code but with corrections
374
+ explanation: string // If the code is not valid, you will provide an explanation for a semi-technical person explaining what the corrected code does. Here again use line breaks liberally to make it easy to read but do NOT indent with spaces/tabs as I will handle that. Use * lists and numbered lists as appropriate.
375
+ libraries: [
376
+ {LibraryName: string, ItemsUsed: string[]}, // If the code is not valid, tell me the libraries you have used in the corrected code you created here in this array of libraries. I need this info to properly import them in the final code.
377
+ ]
378
+ };
379
+ `;
380
+ }
381
+ GenerateContextInfo() {
382
+ return `
383
+ <CODE_EXAMPLE>
262
384
  export class ${this.ProgrammaticName}Action extends BaseAction {
263
385
  public async Run(params: RunActionParams): Promise<ActionResultSimple> {
264
386
  // IMPORTANT: your code will go here, do not generate the method signature, just the code inside the method
@@ -284,7 +406,16 @@ the parameter has a type of input/output, you will receive the value as an input
284
406
  The following libraries are available for use in your code. THEY ARE ALREADY IMPORTED. **DO NOT IMPORT THEM IN YOUR CODE**
285
407
  Use the code examples and reference information shown below, only use properties and methods shown in the documentation/examples.
286
408
  IMPORTANT: DO NOT GENERATE IMPORT STATEMENTS FOR THESE LIBRARIES, THEY ARE ALREADY IMPORTED FOR YOU!
287
- ${JSON.stringify(core_1.Metadata.Provider.Libraries)}
409
+ ${doc_utils_1.DocumentationEngine.Instance.Libraries.map((library) => {
410
+ return library.Items.map((item) => {
411
+ return `
412
+ {
413
+ "LibraryName": ${item.Name},
414
+ "Content": ${item.HTMLContent}
415
+ }
416
+ `;
417
+ });
418
+ })}
288
419
  </AVAILABLE_LIBRARIES>
289
420
 
290
421
  <REFERENCE_TYPES>
@@ -357,20 +488,110 @@ ${JSON.stringify(core_1.Metadata.Provider.Entities.map(e => {
357
488
  The next message, which will be a user message in the conversation, will contain the sys admin's requested behavior for this entity.
358
489
 
359
490
  <CRITICAL>
360
- I am a bot and can only understand FULLY FORMED JSON responses that can be parsed with JSON.parse().
491
+ I am a bot and can only understand FULLY FORMED JSON responses that can be parsed with JSON.parse().
492
+ `;
493
+ }
494
+ GenerateRunViewParamsInfo() {
495
+ return `/**
496
+ * Parameters for running either a stored or dynamic view.
497
+ * A stored view is a view that is saved in the database and can be run either by ID or Name.
498
+ * A dynamic view is one that is not stored in the database and you provide parameters to return data as
499
+ * desired programatically.
500
+ */
501
+ export type RunViewParams = {
502
+ /**
503
+ * optional - ID of the UserView record to run, if provided, ViewName is ignored
504
+ */
505
+ ViewID?: number
506
+ /**
507
+ * optional - Name of the UserView record to run, if you are using this, make sure to use a naming convention
508
+ * so that your view names are unique. For example use a prefix like __Entity_View_ etc so that you're
509
+ * likely to have a single result. If more than one view is available that matches a provided view name an
510
+ * exception will be thrown.
511
+ */
512
+ ViewName?: string
513
+ /**
514
+ * optional - this is the loaded instance of the BaseEntity (UserViewEntityComplete or a subclass of it).
515
+ * This is the preferred parameter to use IF you already have a view entity object loaded up in your code
516
+ * becuase by passing this in, the RunView() method doesn't have to lookup all the metadata for the view and it is faster.
517
+ * If you provide ViewEntity, ViewID/ViewName are ignored.
518
+ */
519
+ ViewEntity?: BaseEntity
520
+ /**
521
+ * optional - this is only used if ViewID/ViewName/ViewEntity are not provided, it is used for
522
+ * Dynamic Views in combination with the optional ExtraFilter
523
+ */
524
+ EntityName?: string
525
+ /**
526
+ * An optional SQL WHERE clause that you can add to the existing filters on a stored view. For dynamic views, you can either
527
+ * run a view without a filter (if the entity definition allows it with AllowAllRowsAPI=1) or filter with any valid SQL WHERE clause.
528
+ */
529
+ ExtraFilter?: string
530
+ /**
531
+ * An optional SQL ORDER BY clause that you can use for dynamic views, as well as to OVERRIDE the stored view's sorting order.
532
+ */
533
+ OrderBy?: string
534
+ /**
535
+ * An optional array of field names that you want returned. The RunView() function will always return ID so you don't need to ask for that. If you leave this null then
536
+ * for a dynamic view all fields are returned, and for stored views, the fields stored in it view configuration are returned.
537
+ */
538
+ Fields?: string[]
539
+ /**
540
+ * optional - string that represents a user "search" - typically from a text search option in a UI somewhere. This field is then used in the view filtering to search whichever fields are configured to be included in search in the Entity Fields definition.
541
+ * Search String is combined with the stored view filters as well as ExtraFilter with an AND.
542
+ */
543
+ UserSearchString?: string
544
+ /**
545
+ * optional - if provided, records that were returned in the specified UserViewRunID will NOT be allowed in the result set.
546
+ * This is useful if you want to run a particular view over time and exclude a specific prior run's resulting data set. If you
547
+ * want to exclude ALL data returned from ALL prior runs, use the ExcludeDataFromAllPriorViewRuns property instead.
548
+ */
549
+ ExcludeUserViewRunID?: number
550
+ /**
551
+ * optional - if set to true, the resulting data will filter out ANY records that were ever returned by this view, when the SaveViewResults property was set to true.
552
+ * This is useful if you want to run a particular view over time and make sure the results returned each time are new to the view.
553
+ */
554
+ ExcludeDataFromAllPriorViewRuns?: boolean
555
+ /**
556
+ * optional - if you are providing the optional ExcludeUserViewRunID property, you can also optionally provide
557
+ * this filter which will negate the specific list of record IDs that are excluded by the ExcludeUserViewRunID property.
558
+ * This can be useful if you want to ensure a certain class of data is always allowed into your view and not filtered out
559
+ * by a prior view run.
560
+ *
561
+ */
562
+ OverrideExcludeFilter?: string
563
+ /**
564
+ * optional - if set to true, the LIST OF ID values from the view run will be stored in the User View Runs entity and the
565
+ * newly created UserViewRun.ID value will be returned in the RunViewResult that the RunView() function sends back to ya.
566
+ */
567
+ SaveViewResults?: boolean
568
+ /**
569
+ * optional - if set to true, if there IS any UserViewMaxRows property set for the entity in question, it will be IGNORED. This is useful in scenarios where you
570
+ * want to programmatically run a view and get ALL the data back, regardless of the MaxRows setting on the entity.
571
+ */
572
+ IgnoreMaxRows?: boolean
361
573
 
362
- Your response must be JSON and parsable into this type:
363
- const returnType = {
364
- code: string, // The typescript code you will create that will work in the context described above. Make sure to include line breaks, but not tabs. That is, pretty format in terms of new lines, but do NOT indent with spaces/tabs, as I'll handle indentation.
365
- explanation: string // an explanation for a semi-technical person explaining what the code does. Here again use line breaks liberally to make it easy to read but do NOT indent with spaces/tabs as I will handle that. Use * lists and numbered lists as appropriate.
366
- libraries: [
367
- {LibraryName: string, ItemsUsed: string[]}, // tell me the libraries you have used in the code you created here in this array of libraries. I need this info to properly import them in the final code.
368
- ]
369
- };
370
- </CRITICAL>
371
- **** REMEMBER **** I am a BOT, do not return anything other than the above JSON format to me or I will choke on your response!
372
- `;
373
- return prompt;
574
+ /**
575
+ * optional - if provided, and if IgnoreMaxRows = false, this value will be used to constrain the total # of rows returned by the view. If this is not provided, either the default settings at the entity-level will be used, or if the entity has no UserViewMaxRows setting, all rows will be returned that match any filter, if provided.
576
+ */
577
+ MaxRows?: number
578
+ /**
579
+ * optional - if set to true, the view run will ALWAYS be logged to the Audit Log, regardless of the entity's property settings for logging view runs.
580
+ */
581
+ ForceAuditLog?: boolean
582
+ /**
583
+ * optional - if provided and either ForceAuditLog is set, or the entity's property settings for logging view runs are set to true, this will be used as the Audit Log Description.
584
+ */
585
+ AuditLogDescription?: string
586
+
587
+ /**
588
+ * Result Type is: 'simple', 'entity_object', or 'count_only' and defaults to 'simple'. If 'entity_object' is specified, the Results[] array will contain
589
+ * BaseEntity-derived objects instead of simple objects. This is useful if you want to work with the data in a more strongly typed manner and/or
590
+ * if you plan to do any update/delete operations on the data after it is returned. The 'count_only' option will return no rows, but the TotalRowCount property of the RunViewResult object will be populated.
591
+ */
592
+ ResultType?: 'simple' | 'entity_object' | 'count_only';
593
+ }
594
+ `;
374
595
  }
375
596
  };
376
597
  exports.ActionEntityServerEntity = ActionEntityServerEntity;
@@ -1 +1 @@
1
- {"version":3,"file":"ActionEntity.server.js","sourceRoot":"","sources":["../../src/generic/ActionEntity.server.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAkI;AAClI,iEAA6H;AAC7H,mDAAyF;AACzF,uDAAoD;AAEpD,iDAA4E;AAC5E,2CAAsE;AAEtE;;GAEG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,4BAAY;IACtD,YAAY,MAAkB;QAC1B,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa;QA4BxB,iBAAY,GAA6B,IAAI,CAAC;QAY9C,YAAO,GAAwB,IAAI,CAAC;QASpC,UAAK,GAA0B,IAAI,CAAC;QA/CxC,MAAM,EAAE,GAAG,IAAI,eAAQ,EAAE,CAAC;QAC1B,IAAI,EAAE,CAAC,YAAY,KAAK,UAAU;YAC9B,MAAM,IAAI,KAAK,CAAC,6GAA6G,CAAC,CAAC;IACvI,CAAC;IACD;;;OAGG;IACH,IAAc,YAAY;QACtB,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,IAAW,gBAAgB;QACvB,OAAO,IAAA,yBAAkB,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,2BAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC/G,CAAC;IAGD;;OAEG;IACH,IAAW,WAAW;QAClB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACrB,wBAAwB;YACxB,I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":3,"file":"BaseAction.d.ts","sourceRoot":"","sources":["../../src/generic/BaseAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAErE;;GAEG;AACH,8BAAsB,UAAU;IAChB,GAAG,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAItE,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAC5F"}
@@ -1 +1 @@
1
- {"version":3,"file":"BaseAction.js","sourceRoot":"","sources":["../../src/generic/BaseAction.ts"],"names":[],"mappings":";;;AAGA;;GAEG;AACH,MAAsB,UAAU;IACtB,KAAK,CAAC,GAAG,CAAC,MAAuB;QACrC,OAAO,MAAM,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;CAGH;AAND,gCAMC"}
1
+ {"version":3,"file":"BaseAction.js","sourceRoot":"","sources":["../../src/generic/BaseAction.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,MAAsB,UAAU;IACtB,KAAK,CAAC,GAAG,CAAC,MAAuB;QACrC,OAAO,MAAM,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;CAGH;AAND,gCAMC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/actions",
3
- "version": "1.7.1",
3
+ "version": "1.8.1",
4
4
  "description": "Main library for MemberJunction Actions. This library is only intended to be imported on the server side.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,11 +19,11 @@
19
19
  "typescript": "^5.4.5"
20
20
  },
21
21
  "dependencies": {
22
- "rxjs": "^7.8.1",
23
- "@memberjunction/global": "1.7.1",
24
- "@memberjunction/core": "1.7.1",
25
- "@memberjunction/core-entities": "1.7.1",
26
- "@memberjunction/ai": "1.7.1",
27
- "@memberjunction/aiengine": "1.7.1"
22
+ "@memberjunction/global": "1.8.1",
23
+ "@memberjunction/core": "1.8.1",
24
+ "@memberjunction/core-entities": "1.8.1",
25
+ "@memberjunction/ai": "1.8.1",
26
+ "@memberjunction/aiengine": "1.8.1",
27
+ "@memberjunction/doc-utils": "1.8.1"
28
28
  }
29
29
  }