@memberjunction/core-entities 2.50.0 → 2.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,14 @@
1
- import { AIModelEntity } from "../generated/entity_subclasses";
1
+ import { AIModelEntity, AIModelVendorEntity } from "../generated/entity_subclasses";
2
2
  export declare class AIModelEntityExtended extends AIModelEntity {
3
3
  /**
4
4
  * Returns the APIName if it exists, otherwise returns the Name
5
5
  */
6
6
  get APINameOrName(): string;
7
+ private _modelVendors;
8
+ /**
9
+ * Helper property to hold the model vendors, this is populated ONLY
10
+ * when you load an AIModelEntity from the AIEngine
11
+ */
12
+ get ModelVendors(): AIModelVendorEntity[];
7
13
  }
8
14
  //# sourceMappingURL=AIModelExtended.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AIModelExtended.d.ts","sourceRoot":"","sources":["../../src/custom/AIModelExtended.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,qBACa,qBAAsB,SAAQ,aAAa;IACpD;;OAEG;IACH,IAAW,aAAa,IAAI,MAAM,CAEjC;CACJ"}
1
+ {"version":3,"file":"AIModelExtended.d.ts","sourceRoot":"","sources":["../../src/custom/AIModelExtended.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAEpF,qBACa,qBAAsB,SAAQ,aAAa;IACpD;;OAEG;IACH,IAAW,aAAa,IAAI,MAAM,CAEjC;IAED,OAAO,CAAC,aAAa,CAA6B;IAClD;;;OAGG;IACH,IAAW,YAAY,IAAI,mBAAmB,EAAE,CAE/C;CACJ"}
@@ -11,12 +11,23 @@ const core_1 = require("@memberjunction/core");
11
11
  const global_1 = require("@memberjunction/global");
12
12
  const entity_subclasses_1 = require("../generated/entity_subclasses");
13
13
  let AIModelEntityExtended = class AIModelEntityExtended extends entity_subclasses_1.AIModelEntity {
14
+ constructor() {
15
+ super(...arguments);
16
+ this._modelVendors = [];
17
+ }
14
18
  /**
15
19
  * Returns the APIName if it exists, otherwise returns the Name
16
20
  */
17
21
  get APINameOrName() {
18
22
  return this.APIName ? this.APIName : this.Name;
19
23
  }
24
+ /**
25
+ * Helper property to hold the model vendors, this is populated ONLY
26
+ * when you load an AIModelEntity from the AIEngine
27
+ */
28
+ get ModelVendors() {
29
+ return this._modelVendors;
30
+ }
20
31
  };
21
32
  exports.AIModelEntityExtended = AIModelEntityExtended;
22
33
  exports.AIModelEntityExtended = AIModelEntityExtended = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"AIModelExtended.js","sourceRoot":"","sources":["../../src/custom/AIModelExtended.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAAsE;AACtE,mDAAuD;AACvD,sEAA+D;AAGxD,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,iCAAa;IACpD;;OAEG;IACH,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IACnD,CAAC;CACJ,CAAA;AAPY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,sBAAa,EAAC,iBAAU,EAAE,WAAW,CAAC;GAC1B,qBAAqB,CAOjC"}
1
+ {"version":3,"file":"AIModelExtended.js","sourceRoot":"","sources":["../../src/custom/AIModelExtended.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAAsE;AACtE,mDAAuD;AACvD,sEAAoF;AAG7E,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,iCAAa;IAAjD;;QAQK,kBAAa,GAA0B,EAAE,CAAC;IAQtD,CAAC;IAfG;;OAEG;IACH,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IACnD,CAAC;IAGD;;;OAGG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;CACJ,CAAA;AAhBY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,sBAAa,EAAC,iBAAU,EAAE,WAAW,CAAC;GAC1B,qBAAqB,CAgBjC"}
@@ -1,6 +1,20 @@
1
1
  import { ValidationResult } from "@memberjunction/core";
2
2
  import { AIPromptEntity } from "../generated/entity_subclasses";
3
3
  export declare class AIPromptEntityExtended extends AIPromptEntity {
4
+ /**
5
+ * private property to hold the template text.
6
+ */
7
+ private _templateText;
8
+ /**
9
+ * Virtual property to hold the template text.
10
+ * This property is used to create or update the Template and Template Contents entity records automatically
11
+ * whenever the AIPrompt is saved.
12
+ */
13
+ get TemplateText(): string;
14
+ set TemplateText(value: string);
15
+ LoadFromData(data: any, replaceOldValues?: boolean): boolean;
16
+ protected LoadTemplateText(): Promise<boolean>;
17
+ Load(ID: string, EntityRelationshipsToLoad?: string[]): Promise<boolean>;
4
18
  /**
5
19
  * Fix bug in generated code where new records have a null ID and that matches
6
20
  * the ResultSelectorPromptID, which causes a validation error. When that code
@@ -1 +1 @@
1
- {"version":3,"file":"AIPromptExtended.d.ts","sourceRoot":"","sources":["../../src/custom/AIPromptExtended.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwD,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC9G,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGhE,qBACa,sBAAuB,SAAQ,cAAc;IACtD;;;;;OAKG;IACM,wCAAwC,CAAC,MAAM,EAAE,gBAAgB;CAM7E"}
1
+ {"version":3,"file":"AIPromptExtended.d.ts","sourceRoot":"","sources":["../../src/custom/AIPromptExtended.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmF,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACzI,OAAO,EAAE,cAAc,EAAyB,MAAM,gCAAgC,CAAC;AAGvF,qBACa,sBAAuB,SAAQ,cAAc;IACtD;;OAEG;IACH,OAAO,CAAC,aAAa,CAAc;IACnC;;;;OAIG;IACH,IAAW,YAAY,IAAI,MAAM,CAEhC;IACD,IAAW,YAAY,CAAC,KAAK,EAAE,MAAM,EAEpC;IAGQ,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,gBAAgB,CAAC,EAAE,OAAO,GAAG,OAAO;cASrD,gBAAgB;IAyBjB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,yBAAyB,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAOvF;;;;;OAKG;IACM,wCAAwC,CAAC,MAAM,EAAE,gBAAgB;CAK7E"}
@@ -11,6 +11,59 @@ const core_1 = require("@memberjunction/core");
11
11
  const entity_subclasses_1 = require("../generated/entity_subclasses");
12
12
  const global_1 = require("@memberjunction/global");
13
13
  let AIPromptEntityExtended = class AIPromptEntityExtended extends entity_subclasses_1.AIPromptEntity {
14
+ constructor() {
15
+ super(...arguments);
16
+ /**
17
+ * private property to hold the template text.
18
+ */
19
+ this._templateText = "";
20
+ }
21
+ /**
22
+ * Virtual property to hold the template text.
23
+ * This property is used to create or update the Template and Template Contents entity records automatically
24
+ * whenever the AIPrompt is saved.
25
+ */
26
+ get TemplateText() {
27
+ return this._templateText;
28
+ }
29
+ set TemplateText(value) {
30
+ this._templateText = value;
31
+ }
32
+ LoadFromData(data, replaceOldValues) {
33
+ // call the base class method to load the data
34
+ const result = super.LoadFromData(data, replaceOldValues);
35
+ this.LoadTemplateText(); // load the Template Text if it exists // cant do async b/c this method is not async
36
+ return result;
37
+ }
38
+ async LoadTemplateText() {
39
+ if (this.TemplateID && !this.TemplateText) {
40
+ // need to get the Template Contents for this AI Prompt
41
+ const rv = new core_1.RunView(this.ProviderToUse);
42
+ const templateContentResult = await rv.RunView({
43
+ EntityName: "Template Contents",
44
+ ExtraFilter: `TemplateID='${this.TemplateID}'`,
45
+ OrderBy: "__mj_CreatedAt ASC", // first one
46
+ MaxRows: 1 // should only be one row
47
+ }, this.ContextCurrentUser);
48
+ if (templateContentResult && templateContentResult.Success) {
49
+ if (templateContentResult.Results.length > 0) {
50
+ // we found the Template Contents, set the TemplateText property
51
+ this.TemplateText = templateContentResult.Results[0].TemplateText || "";
52
+ }
53
+ return true; // we successfully loaded the Template Contents
54
+ }
55
+ else {
56
+ // if we did not find any Template Contents, we can set the TemplateText to an empty string
57
+ this.TemplateText = "";
58
+ return false; // should be able to load Template Contents even if not found
59
+ }
60
+ }
61
+ }
62
+ async Load(ID, EntityRelationshipsToLoad) {
63
+ const result = await super.Load(ID, EntityRelationshipsToLoad);
64
+ await this.LoadTemplateText(); // load the Template Text if it exists
65
+ return result;
66
+ }
14
67
  /**
15
68
  * Fix bug in generated code where new records have a null ID and that matches
16
69
  * the ResultSelectorPromptID, which causes a validation error. When that code
@@ -1 +1 @@
1
- {"version":3,"file":"AIPromptExtended.js","sourceRoot":"","sources":["../../src/custom/AIPromptExtended.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAA8G;AAC9G,sEAAgE;AAChE,mDAAuD;AAGhD,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,kCAAc;IACtD;;;;;OAKG;IACM,wCAAwC,CAAC,MAAwB;QACtE,IAAI,IAAI,CAAC,sBAAsB,KAAK,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC;YAC/E,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,0BAAmB,CAAC,wBAAwB,EAAE,4GAA4G,EAAE,IAAI,CAAC,sBAAsB,EAAE,0BAAmB,CAAC,OAAO,CAAC,CAAC,CAAC;QAClP,CAAC;IACL,CAAC;CAEJ,CAAA;AAbY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,sBAAa,EAAC,iBAAU,EAAE,YAAY,CAAC;GAC3B,sBAAsB,CAalC"}
1
+ {"version":3,"file":"AIPromptExtended.js","sourceRoot":"","sources":["../../src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qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,YAAY,IAAI,EAAE,CAAC;gBAC5E,CAAC;gBACD,OAAO,IAAI,CAAC,CAAC,+CAA+C;YAChE,CAAC;iBACI,CAAC;gBACF,2FAA2F;gBAC3F,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;gBACvB,OAAO,KAAK,CAAC,CAAC,6DAA6D;YAC/E,CAAC;QACL,CAAC;IACL,CAAC;IAEQ,KAAK,CAAC,IAAI,CAAC,EAAU,EAAE,yBAAoC;QAChE,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,yBAAyB,CAAC,CAAC;QAC/D,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,sCAAsC;QACrE,OAAO,MAAM,CAAC;IAClB,CAAC;IAGD;;;;;OAKG;IACM,wCAAwC,CAAC,MAAwB;QACtE,IAAI,IAAI,CAAC,sBAAsB,KAAK,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC;YAC/E,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,0BAAmB,CAAC,wBAAwB,EAAE,4GAA4G,EAAE,IAAI,CAAC,sBAAsB,EAAE,0BAAmB,CAAC,OAAO,CAAC,CAAC,CAAC;QAClP,CAAC;IACL,CAAC;CACJ,CAAA;AAtEY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,sBAAa,EAAC,iBAAU,EAAE,YAAY,CAAC;GAC3B,sBAAsB,CAsElC"}
@@ -134,6 +134,7 @@ export declare const ActionExecutionLogSchema: z.ZodObject<{
134
134
  RetentionPeriod: z.ZodNullable<z.ZodNumber>;
135
135
  __mj_CreatedAt: z.ZodDate;
136
136
  __mj_UpdatedAt: z.ZodDate;
137
+ Message: z.ZodNullable<z.ZodString>;
137
138
  Action: z.ZodString;
138
139
  User: z.ZodString;
139
140
  }, "strip", z.ZodTypeAny, {
@@ -148,6 +149,7 @@ export declare const ActionExecutionLogSchema: z.ZodObject<{
148
149
  ResultCode?: string;
149
150
  UserID?: string;
150
151
  RetentionPeriod?: number;
152
+ Message?: string;
151
153
  User?: string;
152
154
  }, {
153
155
  ID?: string;
@@ -161,6 +163,7 @@ export declare const ActionExecutionLogSchema: z.ZodObject<{
161
163
  ResultCode?: string;
162
164
  UserID?: string;
163
165
  RetentionPeriod?: number;
166
+ Message?: string;
164
167
  User?: string;
165
168
  }>;
166
169
  export type ActionExecutionLogEntityType = z.infer<typeof ActionExecutionLogSchema>;
@@ -2187,12 +2190,12 @@ export declare const ConversationDetailSchema: z.ZodObject<{
2187
2190
  __mj_CreatedAt?: Date;
2188
2191
  __mj_UpdatedAt?: Date;
2189
2192
  UserID?: string;
2193
+ Message?: string;
2190
2194
  User?: string;
2191
2195
  Role?: "User" | "AI" | "Error";
2192
2196
  ConversationID?: string;
2193
2197
  ExternalID?: string;
2194
2198
  Error?: string;
2195
- Message?: string;
2196
2199
  HiddenToUser?: boolean;
2197
2200
  UserRating?: number;
2198
2201
  UserFeedback?: string;
@@ -2208,12 +2211,12 @@ export declare const ConversationDetailSchema: z.ZodObject<{
2208
2211
  __mj_CreatedAt?: Date;
2209
2212
  __mj_UpdatedAt?: Date;
2210
2213
  UserID?: string;
2214
+ Message?: string;
2211
2215
  User?: string;
2212
2216
  Role?: "User" | "AI" | "Error";
2213
2217
  ConversationID?: string;
2214
2218
  ExternalID?: string;
2215
2219
  Error?: string;
2216
- Message?: string;
2217
2220
  HiddenToUser?: boolean;
2218
2221
  UserRating?: number;
2219
2222
  UserFeedback?: string;
@@ -3961,11 +3964,11 @@ export declare const ErrorLogSchema: z.ZodObject<{
3961
3964
  __mj_CreatedAt?: Date;
3962
3965
  __mj_UpdatedAt?: Date;
3963
3966
  Status?: string;
3967
+ Message?: string;
3964
3968
  Code?: string;
3965
3969
  Category?: string;
3966
3970
  Details?: string;
3967
3971
  CompanyIntegrationRunID?: string;
3968
- Message?: string;
3969
3972
  CompanyIntegrationRunDetailID?: string;
3970
3973
  CreatedBy?: string;
3971
3974
  }, {
@@ -3973,11 +3976,11 @@ export declare const ErrorLogSchema: z.ZodObject<{
3973
3976
  __mj_CreatedAt?: Date;
3974
3977
  __mj_UpdatedAt?: Date;
3975
3978
  Status?: string;
3979
+ Message?: string;
3976
3980
  Code?: string;
3977
3981
  Category?: string;
3978
3982
  Details?: string;
3979
3983
  CompanyIntegrationRunID?: string;
3980
- Message?: string;
3981
3984
  CompanyIntegrationRunDetailID?: string;
3982
3985
  CreatedBy?: string;
3983
3986
  }>;
@@ -7139,8 +7142,8 @@ export declare const UserNotificationSchema: z.ZodObject<{
7139
7142
  __mj_CreatedAt?: Date;
7140
7143
  __mj_UpdatedAt?: Date;
7141
7144
  UserID?: string;
7142
- User?: string;
7143
7145
  Message?: string;
7146
+ User?: string;
7144
7147
  Title?: string;
7145
7148
  ResourceTypeID?: string;
7146
7149
  ResourceRecordID?: string;
@@ -7153,8 +7156,8 @@ export declare const UserNotificationSchema: z.ZodObject<{
7153
7156
  __mj_CreatedAt?: Date;
7154
7157
  __mj_UpdatedAt?: Date;
7155
7158
  UserID?: string;
7156
- User?: string;
7157
7159
  Message?: string;
7160
+ User?: string;
7158
7161
  Title?: string;
7159
7162
  ResourceTypeID?: string;
7160
7163
  ResourceRecordID?: string;
@@ -8168,17 +8171,17 @@ export declare class ActionExecutionLogEntity extends BaseEntity<ActionExecution
8168
8171
  /**
8169
8172
  * * Field Name: StartedAt
8170
8173
  * * Display Name: Started At
8171
- * * SQL Data Type: datetime
8172
- * * Default Value: getdate()
8173
- * * Description: Timestamp of when the action started execution.
8174
+ * * SQL Data Type: datetimeoffset
8175
+ * * Default Value: sysdatetimeoffset()
8176
+ * * Description: Timestamp when the action execution started (timezone-aware)
8174
8177
  */
8175
8178
  get StartedAt(): Date;
8176
8179
  set StartedAt(value: Date);
8177
8180
  /**
8178
8181
  * * Field Name: EndedAt
8179
8182
  * * Display Name: Ended At
8180
- * * SQL Data Type: datetime
8181
- * * Description: Timestamp of when the action ended execution.
8183
+ * * SQL Data Type: datetimeoffset
8184
+ * * Description: Timestamp when the action execution ended (timezone-aware)
8182
8185
  */
8183
8186
  get EndedAt(): Date | null;
8184
8187
  set EndedAt(value: Date | null);
@@ -8227,6 +8230,14 @@ export declare class ActionExecutionLogEntity extends BaseEntity<ActionExecution
8227
8230
  */
8228
8231
  get __mj_UpdatedAt(): Date;
8229
8232
  /**
8233
+ * * Field Name: Message
8234
+ * * Display Name: Message
8235
+ * * SQL Data Type: nvarchar(MAX)
8236
+ * * Description: JSON-formatted output data or response from the action execution
8237
+ */
8238
+ get Message(): string | null;
8239
+ set Message(value: string | null);
8240
+ /**
8230
8241
  * * Field Name: Action
8231
8242
  * * Display Name: Action
8232
8243
  * * SQL Data Type: nvarchar(425)