@memberjunction/core-entities 2.132.0 → 3.0.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.
Files changed (57) hide show
  1. package/dist/custom/AIAgentExtended.d.ts +13 -0
  2. package/dist/custom/AIAgentExtended.d.ts.map +1 -0
  3. package/dist/custom/AIAgentExtended.js +37 -0
  4. package/dist/custom/AIAgentExtended.js.map +1 -0
  5. package/dist/custom/AIAgentRunExtended.d.ts +32 -0
  6. package/dist/custom/AIAgentRunExtended.d.ts.map +1 -0
  7. package/dist/custom/AIAgentRunExtended.js +136 -0
  8. package/dist/custom/AIAgentRunExtended.js.map +1 -0
  9. package/dist/custom/AIAgentRunStepExtended.d.ts +48 -0
  10. package/dist/custom/AIAgentRunStepExtended.d.ts.map +1 -0
  11. package/dist/custom/AIAgentRunStepExtended.js +149 -0
  12. package/dist/custom/AIAgentRunStepExtended.js.map +1 -0
  13. package/dist/custom/AIModelExtended.d.ts +14 -0
  14. package/dist/custom/AIModelExtended.d.ts.map +1 -0
  15. package/dist/custom/AIModelExtended.js +36 -0
  16. package/dist/custom/AIModelExtended.js.map +1 -0
  17. package/dist/custom/AIPromptCategoryExtended.d.ts +7 -0
  18. package/dist/custom/AIPromptCategoryExtended.d.ts.map +1 -0
  19. package/dist/custom/AIPromptCategoryExtended.js +26 -0
  20. package/dist/custom/AIPromptCategoryExtended.js.map +1 -0
  21. package/dist/custom/AIPromptExtended.d.ts +51 -0
  22. package/dist/custom/AIPromptExtended.d.ts.map +1 -0
  23. package/dist/custom/AIPromptExtended.js +169 -0
  24. package/dist/custom/AIPromptExtended.js.map +1 -0
  25. package/dist/custom/AIPromptRunEntityExtended.d.ts +47 -0
  26. package/dist/custom/AIPromptRunEntityExtended.d.ts.map +1 -0
  27. package/dist/custom/AIPromptRunEntityExtended.js +156 -0
  28. package/dist/custom/AIPromptRunEntityExtended.js.map +1 -0
  29. package/dist/custom/ListDetailEntityExtended.d.ts +42 -0
  30. package/dist/custom/ListDetailEntityExtended.d.ts.map +1 -1
  31. package/dist/custom/ListDetailEntityExtended.js +124 -0
  32. package/dist/custom/ListDetailEntityExtended.js.map +1 -1
  33. package/dist/custom/TypeTablesCache.d.ts +12 -0
  34. package/dist/custom/TypeTablesCache.d.ts.map +1 -0
  35. package/dist/custom/TypeTablesCache.js +31 -0
  36. package/dist/custom/TypeTablesCache.js.map +1 -0
  37. package/dist/custom/UserViewEntity.d.ts +146 -9
  38. package/dist/custom/UserViewEntity.d.ts.map +1 -1
  39. package/dist/custom/UserViewEntity.js +71 -16
  40. package/dist/custom/UserViewEntity.js.map +1 -1
  41. package/dist/engines/UserInfoEngine.d.ts +26 -0
  42. package/dist/engines/UserInfoEngine.d.ts.map +1 -1
  43. package/dist/engines/UserInfoEngine.js +95 -0
  44. package/dist/engines/UserInfoEngine.js.map +1 -1
  45. package/dist/engines/UserViewEngine.d.ts +133 -0
  46. package/dist/engines/UserViewEngine.d.ts.map +1 -0
  47. package/dist/engines/UserViewEngine.js +244 -0
  48. package/dist/engines/UserViewEngine.js.map +1 -0
  49. package/dist/generated/entity_subclasses.d.ts +612 -8
  50. package/dist/generated/entity_subclasses.d.ts.map +1 -1
  51. package/dist/generated/entity_subclasses.js +868 -8
  52. package/dist/generated/entity_subclasses.js.map +1 -1
  53. package/dist/index.d.ts +1 -0
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +1 -0
  56. package/dist/index.js.map +1 -1
  57. package/package.json +5 -5
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AIPromptEntityExtended = void 0;
10
+ const core_1 = require("@memberjunction/core");
11
+ const entity_subclasses_1 = require("../generated/entity_subclasses");
12
+ const global_1 = require("@memberjunction/global");
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._originalTemplateText = "";
20
+ this._templateText = "";
21
+ /**
22
+ * private property to cache template parameters.
23
+ */
24
+ this._templateParams = null;
25
+ }
26
+ /**
27
+ * Virtual property to hold the template text.
28
+ * This property is used to create or update the Template and Template Contents entity records automatically
29
+ * whenever the AIPrompt is saved.
30
+ */
31
+ get TemplateText() {
32
+ return this._templateText;
33
+ }
34
+ set TemplateText(value) {
35
+ this._templateText = value;
36
+ }
37
+ get TemplateTextDirty() {
38
+ return this._templateText !== this._originalTemplateText;
39
+ }
40
+ Set(FieldName, Value) {
41
+ if (FieldName?.trim().toLowerCase() === "templatetext") {
42
+ this.TemplateText = Value;
43
+ }
44
+ else {
45
+ super.Set(FieldName, Value);
46
+ }
47
+ }
48
+ get Dirty() {
49
+ const dirty = super.Dirty;
50
+ if (dirty) {
51
+ // if the base entity is dirty, we don't need to check TemplateTextDirty
52
+ return true;
53
+ }
54
+ else if (this.TemplateTextDirty) {
55
+ // if TemplateText is dirty, we consider the entity dirty
56
+ return true;
57
+ }
58
+ return false;
59
+ // otherwise, return false
60
+ // return super.Dirty || this.TemplateTextDirty;
61
+ }
62
+ /**
63
+ * Virtual property to get the template parameters for this AI Prompt.
64
+ * Returns the cached parameters if available, or an empty array if not loaded yet.
65
+ * Call LoadTemplateParams() to ensure params are loaded.
66
+ */
67
+ get TemplateParams() {
68
+ return this._templateParams || [];
69
+ }
70
+ /**
71
+ * Async getter for template parameters that ensures they are loaded.
72
+ * Use this when you need to guarantee the parameters are loaded from the database.
73
+ */
74
+ async GetTemplateParams() {
75
+ if (this._templateParams === null) {
76
+ await this.LoadTemplateParams();
77
+ }
78
+ return this._templateParams || [];
79
+ }
80
+ async LoadFromData(data, replaceOldValues) {
81
+ // call the base class method to load the data
82
+ const result = await super.LoadFromData(data, replaceOldValues);
83
+ await this.LoadRelatedEntities();
84
+ return result;
85
+ }
86
+ async LoadTemplateText() {
87
+ if (this.TemplateID && !this.TemplateText) {
88
+ // need to get the Template Contents for this AI Prompt
89
+ const rv = this.RunViewProviderToUse;
90
+ const templateContentResult = await rv.RunView({
91
+ EntityName: "Template Contents",
92
+ ExtraFilter: `TemplateID='${this.TemplateID}'`,
93
+ OrderBy: "__mj_CreatedAt ASC", // first one
94
+ MaxRows: 1 // should only be one row
95
+ }, this.ContextCurrentUser);
96
+ if (templateContentResult && templateContentResult.Success) {
97
+ if (templateContentResult.Results.length > 0) {
98
+ // we found the Template Contents, set the TemplateText property
99
+ this.TemplateText = templateContentResult.Results[0].TemplateText || "";
100
+ }
101
+ this._originalTemplateText = this.TemplateText; // store the original text for comparison later
102
+ return true; // we successfully loaded the Template Contents
103
+ }
104
+ else {
105
+ // if we did not find any Template Contents, we can set the TemplateText to an empty string
106
+ this.TemplateText = "";
107
+ this._originalTemplateText = ""; // reset original text
108
+ return false; // should be able to load Template Contents even if not found
109
+ }
110
+ }
111
+ }
112
+ /**
113
+ * Loads the template parameters for this AI Prompt if it has a TemplateID.
114
+ * This method populates the _templateParams array.
115
+ */
116
+ async LoadTemplateParams() {
117
+ if (this.TemplateID) {
118
+ const rv = this.RunViewProviderToUse;
119
+ const templateParamsResult = await rv.RunView({
120
+ EntityName: "Template Params",
121
+ ExtraFilter: `TemplateID='${this.TemplateID}'`,
122
+ OrderBy: "Name ASC",
123
+ ResultType: 'entity_object'
124
+ }, this.ContextCurrentUser);
125
+ if (templateParamsResult && templateParamsResult.Success) {
126
+ this._templateParams = templateParamsResult.Results || [];
127
+ return true;
128
+ }
129
+ else {
130
+ // If we failed to load, set to empty array
131
+ this._templateParams = [];
132
+ return false;
133
+ }
134
+ }
135
+ else {
136
+ // No TemplateID, so no params
137
+ this._templateParams = [];
138
+ return true;
139
+ }
140
+ }
141
+ async LoadRelatedEntities() {
142
+ await Promise.all([
143
+ this.LoadTemplateText(),
144
+ this.LoadTemplateParams()
145
+ ]);
146
+ }
147
+ async InnerLoad(CompositeKey, EntityRelationshipsToLoad) {
148
+ const result = await super.InnerLoad(CompositeKey, EntityRelationshipsToLoad);
149
+ // Load both template text and params in parallel for better performance
150
+ await this.LoadRelatedEntities();
151
+ return result;
152
+ }
153
+ /**
154
+ * Fix bug in generated code where new records have a null ID and that matches
155
+ * the ResultSelectorPromptID, which causes a validation error. When that code
156
+ * gets regenerated we can remove this override.
157
+ * @param result
158
+ */
159
+ ValidateResultSelectorPromptIDNotEqualID(result) {
160
+ if (this.ResultSelectorPromptID === this.ID && this.ID /*make sure ID !== null*/) {
161
+ result.Errors.push(new core_1.ValidationErrorInfo("ResultSelectorPromptID", "The ResultSelectorPromptID cannot be the same as the ID. A result selector prompt cannot reference itself.", this.ResultSelectorPromptID, core_1.ValidationErrorType.Failure));
162
+ }
163
+ }
164
+ };
165
+ exports.AIPromptEntityExtended = AIPromptEntityExtended;
166
+ exports.AIPromptEntityExtended = AIPromptEntityExtended = __decorate([
167
+ (0, global_1.RegisterClass)(core_1.BaseEntity, "AI Prompts")
168
+ ], AIPromptEntityExtended);
169
+ //# sourceMappingURL=AIPromptExtended.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AIPromptExtended.js","sourceRoot":"","sources":["../../src/custom/AIPromptExtended.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAAuJ;AACvJ,sEAA4G;AAC5G,mDAA6E;AAGtE,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,kCAAc;IAAnD;;QACH;;WAEG;QACO,0BAAqB,GAAW,EAAE,CAAC;QACrC,kBAAa,GAAW,EAAE,CAAC;QA0C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I,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;AArKY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,sBAAa,EAAC,iBAAU,EAAE,YAAY,CAAC;GAC3B,sBAAsB,CAqKlC"}
@@ -0,0 +1,47 @@
1
+ import { AIPromptRunEntity } from '../generated/entity_subclasses';
2
+ import { ChatMessage } from '@memberjunction/ai';
3
+ /**
4
+ * Extended AIPromptRunEntity class with helper methods for extracting
5
+ * conversation messages and data from the stored JSON.
6
+ */
7
+ export declare class AIPromptRunEntityExtended extends AIPromptRunEntity {
8
+ /**
9
+ * Parses and extracts all message data from the Messages field.
10
+ * This uses the exact logic from the AI Prompt Run form component.
11
+ * @returns Object containing chatMessages, inputData, and formattedMessages
12
+ */
13
+ ParseMessagesData(): {
14
+ chatMessages: ChatMessage[];
15
+ inputData: any | null;
16
+ formattedMessages: string;
17
+ formattedData: string;
18
+ };
19
+ /**
20
+ * Extracts just the chat messages from the stored Messages JSON field.
21
+ * @returns Array of ChatMessage objects, or empty array if no messages found
22
+ */
23
+ GetChatMessages(): ChatMessage[];
24
+ /**
25
+ * Extracts the data context from the stored Messages JSON field.
26
+ * @returns The data object if found, or null
27
+ */
28
+ GetDataContext(): any | null;
29
+ /**
30
+ * Formats the Messages field for display with proper JSON formatting.
31
+ * @returns Formatted JSON string
32
+ */
33
+ GetFormattedMessages(): string;
34
+ /**
35
+ * Formats the Result field for display with proper JSON formatting.
36
+ * Uses exact logic from AI Prompt Run form.
37
+ * @returns Formatted JSON string
38
+ */
39
+ GetFormattedResult(): string;
40
+ /**
41
+ * Extracts the system prompt from the chat messages.
42
+ * This is useful for re-running prompts with the exact same system prompt.
43
+ * @returns The system prompt content if found, or null
44
+ */
45
+ GetSystemPrompt(): string | null;
46
+ }
47
+ //# sourceMappingURL=AIPromptRunEntityExtended.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AIPromptRunEntityExtended.d.ts","sourceRoot":"","sources":["../../src/custom/AIPromptRunEntityExtended.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;GAGG;AACH,qBACa,yBAA0B,SAAQ,iBAAiB;IAE5D;;;;OAIG;IACI,iBAAiB,IAAI;QACxB,YAAY,EAAE,WAAW,EAAE,CAAC;QAC5B,SAAS,EAAE,GAAG,GAAG,IAAI,CAAC;QACtB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,aAAa,EAAE,MAAM,CAAC;KACzB;IA0DD;;;OAGG;IACI,eAAe,IAAI,WAAW,EAAE;IAKvC;;;OAGG;IACI,cAAc,IAAI,GAAG,GAAG,IAAI;IAKnC;;;OAGG;IACI,oBAAoB,IAAI,MAAM;IAKrC;;;;OAIG;IACI,kBAAkB,IAAI,MAAM;IAoBnC;;;;OAIG;IACI,eAAe,IAAI,MAAM,GAAG,IAAI;CAuB1C"}
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AIPromptRunEntityExtended = void 0;
10
+ const global_1 = require("@memberjunction/global");
11
+ const core_1 = require("@memberjunction/core");
12
+ const entity_subclasses_1 = require("../generated/entity_subclasses");
13
+ /**
14
+ * Extended AIPromptRunEntity class with helper methods for extracting
15
+ * conversation messages and data from the stored JSON.
16
+ */
17
+ let AIPromptRunEntityExtended = class AIPromptRunEntityExtended extends entity_subclasses_1.AIPromptRunEntity {
18
+ /**
19
+ * Parses and extracts all message data from the Messages field.
20
+ * This uses the exact logic from the AI Prompt Run form component.
21
+ * @returns Object containing chatMessages, inputData, and formattedMessages
22
+ */
23
+ ParseMessagesData() {
24
+ const parseOptions = {
25
+ extractInlineJson: true,
26
+ maxDepth: 100,
27
+ debug: false
28
+ };
29
+ let chatMessages = [];
30
+ let inputData = null;
31
+ let formattedMessages = '';
32
+ let formattedData = '';
33
+ // Format messages with recursive JSON parsing
34
+ if (this.Messages) {
35
+ try {
36
+ const parsed = JSON.parse(this.Messages);
37
+ const recursivelyParsed = (0, global_1.ParseJSONRecursive)(parsed, parseOptions);
38
+ formattedMessages = JSON.stringify(recursivelyParsed, null, 2);
39
+ // Extract messages array and data
40
+ if (recursivelyParsed && typeof recursivelyParsed === 'object') {
41
+ // Extract chat messages if they exist
42
+ if (recursivelyParsed.messages && Array.isArray(recursivelyParsed.messages)) {
43
+ chatMessages = recursivelyParsed.messages;
44
+ }
45
+ else {
46
+ chatMessages = [];
47
+ }
48
+ // Extract data object if it exists
49
+ if (recursivelyParsed.data) {
50
+ inputData = recursivelyParsed.data;
51
+ formattedData = JSON.stringify(recursivelyParsed.data, null, 2);
52
+ }
53
+ else {
54
+ inputData = null;
55
+ formattedData = '';
56
+ }
57
+ }
58
+ }
59
+ catch {
60
+ formattedMessages = this.Messages;
61
+ chatMessages = [];
62
+ inputData = null;
63
+ formattedData = '';
64
+ }
65
+ }
66
+ else {
67
+ formattedMessages = '';
68
+ chatMessages = [];
69
+ inputData = null;
70
+ formattedData = '';
71
+ }
72
+ return {
73
+ chatMessages,
74
+ inputData,
75
+ formattedMessages,
76
+ formattedData
77
+ };
78
+ }
79
+ /**
80
+ * Extracts just the chat messages from the stored Messages JSON field.
81
+ * @returns Array of ChatMessage objects, or empty array if no messages found
82
+ */
83
+ GetChatMessages() {
84
+ const { chatMessages } = this.ParseMessagesData();
85
+ return chatMessages;
86
+ }
87
+ /**
88
+ * Extracts the data context from the stored Messages JSON field.
89
+ * @returns The data object if found, or null
90
+ */
91
+ GetDataContext() {
92
+ const { inputData } = this.ParseMessagesData();
93
+ return inputData;
94
+ }
95
+ /**
96
+ * Formats the Messages field for display with proper JSON formatting.
97
+ * @returns Formatted JSON string
98
+ */
99
+ GetFormattedMessages() {
100
+ const { formattedMessages } = this.ParseMessagesData();
101
+ return formattedMessages;
102
+ }
103
+ /**
104
+ * Formats the Result field for display with proper JSON formatting.
105
+ * Uses exact logic from AI Prompt Run form.
106
+ * @returns Formatted JSON string
107
+ */
108
+ GetFormattedResult() {
109
+ if (!this.Result) {
110
+ return '';
111
+ }
112
+ const parseOptions = {
113
+ extractInlineJson: true,
114
+ maxDepth: 100,
115
+ debug: false
116
+ };
117
+ try {
118
+ const parsed = JSON.parse(this.Result);
119
+ const recursivelyParsed = (0, global_1.ParseJSONRecursive)(parsed, parseOptions);
120
+ return JSON.stringify(recursivelyParsed, null, 2);
121
+ }
122
+ catch {
123
+ return this.Result;
124
+ }
125
+ }
126
+ /**
127
+ * Extracts the system prompt from the chat messages.
128
+ * This is useful for re-running prompts with the exact same system prompt.
129
+ * @returns The system prompt content if found, or null
130
+ */
131
+ GetSystemPrompt() {
132
+ const messages = this.GetChatMessages();
133
+ // Find the first system message
134
+ const systemMessage = messages.find(msg => msg.role === 'system');
135
+ if (!systemMessage) {
136
+ return null;
137
+ }
138
+ // Handle different content types
139
+ if (typeof systemMessage.content === 'string') {
140
+ return systemMessage.content;
141
+ }
142
+ else if (Array.isArray(systemMessage.content)) {
143
+ // If content is an array of content blocks, extract text content
144
+ const textBlocks = systemMessage.content.filter(block => block.type === 'text');
145
+ if (textBlocks.length > 0) {
146
+ return textBlocks.map(block => block.content).join('\n');
147
+ }
148
+ }
149
+ return null;
150
+ }
151
+ };
152
+ exports.AIPromptRunEntityExtended = AIPromptRunEntityExtended;
153
+ exports.AIPromptRunEntityExtended = AIPromptRunEntityExtended = __decorate([
154
+ (0, global_1.RegisterClass)(core_1.BaseEntity, 'MJ: AI Prompt Runs')
155
+ ], AIPromptRunEntityExtended);
156
+ //# sourceMappingURL=AIPromptRunEntityExtended.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AIPromptRunEntityExtended.js","sourceRoot":"","sources":["../../src/custom/AIPromptRunEntityExtended.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAA6F;AAC7F,+CAAkD;AAClD,sEAAmE;AAGnE;;;GAGG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,qCAAiB;IAE5D;;;;OAIG;IACI,iBAAiB;QAMpB,MAAM,YAAY,GAAqB;YACnC,iBAAiB,EAAE,IAAI;YACvB,QAAQ,EAAE,GAAG;YACb,KAAK,EAAE,KAAK;SACf,CAAC;QAEF,IAAI,YAAY,GAAkB,EAAE,CAAC;QACrC,IAAI,SAAS,GAAQ,IAAI,CAAC;QAC1B,IAAI,iBAAiB,GAAW,EAAE,CAAC;QACnC,IAAI,aAAa,GAAW,EAAE,CAAC;QAE/B,8CAA8C;QAC9C,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,IAAI,CAAC;gBACD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACzC,MAAM,iBAAiB,GAAG,IAAA,2BAAkB,EAAC,MAAM,EAAE,YAAY,CAAC,CAAC;gBACnE,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;gBAE/D,kCAAkC;gBAClC,IAAI,iBAAiB,IAAI,OAAO,iBAAiB,KA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AM,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;YAChF,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACxB,OAAO,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC7D,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AAtJY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,sBAAa,EAAC,iBAAU,EAAE,oBAAoB,CAAC;GACnC,yBAAyB,CAsJrC"}
@@ -1,5 +1,47 @@
1
+ import { BaseEntity, CompositeKey, EntityInfo } from "@memberjunction/core";
1
2
  import { ListDetailEntity } from "../generated/entity_subclasses";
2
3
  export declare class ListDetailEntityExtended extends ListDetailEntity {
4
+ private _recordCompositeKey;
5
+ private _sourceEntityInfo;
6
+ /**
7
+ * Sets the RecordID from a source entity record.
8
+ * For single PK entities, stores just the raw PK value.
9
+ * For composite PK entities, stores the concatenated key format (Field1|Value1||Field2|Value2).
10
+ * @param entityInfo The EntityInfo for the source entity
11
+ * @param record The source record (can be a BaseEntity or plain object with PK values)
12
+ */
13
+ SetRecordIDFromEntity(entityInfo: EntityInfo, record: BaseEntity | Record<string, unknown>): void;
14
+ /**
15
+ * Gets a CompositeKey from the stored RecordID.
16
+ * Lazily builds and caches the CompositeKey.
17
+ * @param entityInfo Optional EntityInfo - required if not previously set via SetRecordIDFromEntity
18
+ * @returns CompositeKey representing the stored RecordID
19
+ */
20
+ GetCompositeKey(entityInfo?: EntityInfo): CompositeKey;
21
+ /**
22
+ * Extracts the raw primary key value(s) from the RecordID.
23
+ * For single PK, returns the raw value directly.
24
+ * For composite PK, returns an object with field names and values.
25
+ * @param entityInfo The EntityInfo for the source entity
26
+ * @returns The raw PK value (string) for single PK, or Record<string, unknown> for composite
27
+ */
28
+ GetRawPrimaryKeyValue(entityInfo: EntityInfo): string | Record<string, unknown>;
29
+ /**
30
+ * Static utility to build the appropriate RecordID value from a source record.
31
+ * Use this when you need to build a RecordID without creating a ListDetailEntity.
32
+ * @param entityInfo The EntityInfo for the source entity
33
+ * @param record The source record
34
+ * @returns The properly formatted RecordID string
35
+ */
36
+ static BuildRecordID(entityInfo: EntityInfo, record: BaseEntity | Record<string, unknown>): string;
37
+ /**
38
+ * Static utility to extract raw PK value from a RecordID string.
39
+ * Handles both single PK (raw value) and composite PK (concatenated) formats.
40
+ * @param recordId The RecordID value from a ListDetail record
41
+ * @param entityInfo The EntityInfo for the source entity
42
+ * @returns For single PK: the raw value. For composite PK: the full concatenated string.
43
+ */
44
+ static ExtractPrimaryKeyValue(recordId: string, entityInfo: EntityInfo): string;
3
45
  Save(): Promise<boolean>;
4
46
  }
5
47
  //# sourceMappingURL=ListDetailEntityExtended.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ListDetailEntityExtended.d.ts","sourceRoot":"","sources":["../../src/custom/ListDetailEntityExtended.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,qBACa,wBAAyB,SAAQ,gBAAgB;IAC7C,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;CAkDxC"}
1
+ {"version":3,"file":"ListDetailEntityExtended.d.ts","sourceRoot":"","sources":["../../src/custom/ListDetailEntityExtended.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAoB,YAAY,EAAE,UAAU,EAAY,MAAM,sBAAsB,CAAC;AAExG,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,qBACa,wBAAyB,SAAQ,gBAAgB;IAC1D,OAAO,CAAC,mBAAmB,CAA6B;IACxD,OAAO,CAAC,iBAAiB,CAA2B;IAEpD;;;;;;OAMG;IACI,qBAAqB,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAoBxG;;;;;OAKG;IACI,eAAe,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,YAAY;IAmC7D;;;;;;OAMG;IACI,qBAAqB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAiBtF;;;;;;OAMG;WACW,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;IAgBzG;;;;;;OAMG;WACW,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,MAAM;IAOzE,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;CAkDxC"}
@@ -11,6 +11,130 @@ 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 ListDetailEntityExtended = class ListDetailEntityExtended extends entity_subclasses_1.ListDetailEntity {
14
+ constructor() {
15
+ super(...arguments);
16
+ this._recordCompositeKey = null;
17
+ this._sourceEntityInfo = null;
18
+ }
19
+ /**
20
+ * Sets the RecordID from a source entity record.
21
+ * For single PK entities, stores just the raw PK value.
22
+ * For composite PK entities, stores the concatenated key format (Field1|Value1||Field2|Value2).
23
+ * @param entityInfo The EntityInfo for the source entity
24
+ * @param record The source record (can be a BaseEntity or plain object with PK values)
25
+ */
26
+ SetRecordIDFromEntity(entityInfo, record) {
27
+ this._sourceEntityInfo = entityInfo;
28
+ const primaryKeys = entityInfo.PrimaryKeys;
29
+ if (primaryKeys.length === 1) {
30
+ // Single PK: store just the raw value
31
+ const pkField = primaryKeys[0].Name;
32
+ const value = record instanceof core_1.BaseEntity ? record.Get(pkField) : record[pkField];
33
+ this.RecordID = String(value);
34
+ }
35
+ else {
36
+ // Composite PK: store concatenated format
37
+ const compositeKey = new core_1.CompositeKey();
38
+ compositeKey.LoadFromEntityInfoAndRecord(entityInfo, record);
39
+ this.RecordID = compositeKey.ToConcatenatedString();
40
+ }
41
+ // Clear cached composite key since RecordID changed
42
+ this._recordCompositeKey = null;
43
+ }
44
+ /**
45
+ * Gets a CompositeKey from the stored RecordID.
46
+ * Lazily builds and caches the CompositeKey.
47
+ * @param entityInfo Optional EntityInfo - required if not previously set via SetRecordIDFromEntity
48
+ * @returns CompositeKey representing the stored RecordID
49
+ */
50
+ GetCompositeKey(entityInfo) {
51
+ if (this._recordCompositeKey) {
52
+ return this._recordCompositeKey;
53
+ }
54
+ const effectiveEntityInfo = entityInfo || this._sourceEntityInfo;
55
+ if (!effectiveEntityInfo) {
56
+ // Try to get entity info from the List's EntityID
57
+ const md = new core_1.Metadata();
58
+ const list = md.Entities.find(e => e.Name === 'Lists');
59
+ if (!list) {
60
+ throw new Error('Cannot determine entity info. Provide entityInfo parameter or call SetRecordIDFromEntity first.');
61
+ }
62
+ }
63
+ this._recordCompositeKey = new core_1.CompositeKey();
64
+ if (effectiveEntityInfo && effectiveEntityInfo.PrimaryKeys.length === 1) {
65
+ // Single PK: RecordID is just the raw value
66
+ const pkField = effectiveEntityInfo.PrimaryKeys[0].Name;
67
+ this._recordCompositeKey.KeyValuePairs = [{ FieldName: pkField, Value: this.RecordID }];
68
+ }
69
+ else {
70
+ // Composite PK or unknown: try to parse as concatenated string
71
+ this._recordCompositeKey.LoadFromConcatenatedString(this.RecordID);
72
+ // If parsing failed (no delimiters found), treat as single value
73
+ if (this._recordCompositeKey.KeyValuePairs.length === 0) {
74
+ const pkField = effectiveEntityInfo?.PrimaryKeys[0]?.Name || 'ID';
75
+ this._recordCompositeKey.KeyValuePairs = [{ FieldName: pkField, Value: this.RecordID }];
76
+ }
77
+ }
78
+ return this._recordCompositeKey;
79
+ }
80
+ /**
81
+ * Extracts the raw primary key value(s) from the RecordID.
82
+ * For single PK, returns the raw value directly.
83
+ * For composite PK, returns an object with field names and values.
84
+ * @param entityInfo The EntityInfo for the source entity
85
+ * @returns The raw PK value (string) for single PK, or Record<string, unknown> for composite
86
+ */
87
+ GetRawPrimaryKeyValue(entityInfo) {
88
+ const primaryKeys = entityInfo.PrimaryKeys;
89
+ if (primaryKeys.length === 1) {
90
+ // Single PK: RecordID is the raw value
91
+ return this.RecordID;
92
+ }
93
+ else {
94
+ // Composite PK: parse and return as object
95
+ const compositeKey = this.GetCompositeKey(entityInfo);
96
+ const result = {};
97
+ for (const kvp of compositeKey.KeyValuePairs) {
98
+ result[kvp.FieldName] = kvp.Value;
99
+ }
100
+ return result;
101
+ }
102
+ }
103
+ /**
104
+ * Static utility to build the appropriate RecordID value from a source record.
105
+ * Use this when you need to build a RecordID without creating a ListDetailEntity.
106
+ * @param entityInfo The EntityInfo for the source entity
107
+ * @param record The source record
108
+ * @returns The properly formatted RecordID string
109
+ */
110
+ static BuildRecordID(entityInfo, record) {
111
+ const primaryKeys = entityInfo.PrimaryKeys;
112
+ if (primaryKeys.length === 1) {
113
+ // Single PK: return just the raw value
114
+ const pkField = primaryKeys[0].Name;
115
+ const value = record instanceof core_1.BaseEntity ? record.Get(pkField) : record[pkField];
116
+ return String(value);
117
+ }
118
+ else {
119
+ // Composite PK: return concatenated format
120
+ const compositeKey = new core_1.CompositeKey();
121
+ compositeKey.LoadFromEntityInfoAndRecord(entityInfo, record);
122
+ return compositeKey.ToConcatenatedString();
123
+ }
124
+ }
125
+ /**
126
+ * Static utility to extract raw PK value from a RecordID string.
127
+ * Handles both single PK (raw value) and composite PK (concatenated) formats.
128
+ * @param recordId The RecordID value from a ListDetail record
129
+ * @param entityInfo The EntityInfo for the source entity
130
+ * @returns For single PK: the raw value. For composite PK: the full concatenated string.
131
+ */
132
+ static ExtractPrimaryKeyValue(recordId, entityInfo) {
133
+ // For single PK entities, RecordID is stored as raw value, so return as-is
134
+ // For composite PK entities, RecordID is stored as concatenated string, return as-is
135
+ // The caller should use this value appropriately based on their context
136
+ return recordId;
137
+ }
14
138
  async Save() {
15
139
  const currentResultCount = this.ResultHistory.length;
16
140
  const newResult = new core_1.BaseEntityResult();
@@ -1 +1 @@
1
- {"version":3,"file":"ListDetailEntityExtended.js","sourceRoot":"","sources":["../../src/custom/ListDetailEntityExtended.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAA6E;AAC7E,mDAAuD;AACvD,sEAAkE;AAG3D,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,oCAAgB;IACnD,KAAK,CAAC,IAAI;QACb,MAAM,kBAAkB,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;QACrD,MAAM,SAAS,GAAG,IAAI,uBAAgB,EAAE,CAAC;QACzC,SAAS,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;QAEjC,IAAG,CAAC;YACA,MAAM,EAAE,GAAG,IAAI,CAAC,oBAAoB,CAAC;YAErC,IAAG,CAAC,IAAI,CAAC,MAAM,EAAC,CAAC;gBACb,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;YAC7C,CAAC;YAED,IAAG,CAAC,IAAI,CAAC,QAAQ,EAAC,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;YAC/C,CAAC;YAED,IAAG,CAAC,IAAI,CAAC,kBAAkB,EAAC,CAAC;gBACzB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;YACzD,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC;gBAC9B,UAAU,EAAE,cAAc;gBAC1B,WAAW,EAAE,aAAa,IAAI,CAAC,MAAM,qBAAqB,IAAI,CAAC,QAAQ,GAAG;aAC7E,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;YAE5B,IAAG,CAAC,QAAQ,CAAC,OAAO,EAAC,CAAC;gBAClB,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,YA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AK,CAAC,IAAI,EAAE,CAAC;YACtC,OAAO,UAAU,CAAC;QACtB,CAAC;QACD,OAAO,CAAC,EAAE,CAAC;YACP,IAAI,kBAAkB,KAAK,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;gBAAA,CAAC,CAAA;gBACpD,qEAAqE;gBACrE,qDAAqD;gBACrD,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;gBAC1B,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;gBACpD,SAAS,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;gBAC9B,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAC,SAAS,EAAE,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAC,CAAA,CAAC,CAAC,CAAC,CAAC;gBACvG,SAAS,CAAC,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;gBAC/B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACvC,CAAC;YACD,OAAO,KAAK,CAAC;QACjB,CAAC;IACL,CAAC;CACJ,CAAA;AAvLY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,sBAAa,EAAC,iBAAU,EAAE,cAAc,CAAC;GAC7B,wBAAwB,CAuLpC"}
@@ -0,0 +1,12 @@
1
+ import { BaseEngine, IMetadataProvider, UserInfo } from "@memberjunction/core";
2
+ import { EntityRelationshipDisplayComponentEntity } from "../generated/entity_subclasses";
3
+ /**
4
+ * Simple cache for commonly used type tables across the system that are outside of what we have in the Metadata object
5
+ */
6
+ export declare class TypeTablesCache extends BaseEngine<TypeTablesCache> {
7
+ Config(forceRefresh?: boolean, contextUser?: UserInfo, provider?: IMetadataProvider): Promise<void>;
8
+ static get Instance(): TypeTablesCache;
9
+ get EntityRelationshipDisplayComponents(): EntityRelationshipDisplayComponentEntity[];
10
+ private _EntityRelationshipDisplayComponents;
11
+ }
12
+ //# sourceMappingURL=TypeTablesCache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypeTablesCache.d.ts","sourceRoot":"","sources":["../../src/custom/TypeTablesCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA4B,iBAAiB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACzG,OAAO,EAAE,wCAAwC,EAAE,MAAM,gCAAgC,CAAC;AAE1F;;GAEG;AACH,qBAAa,eAAgB,SAAQ,UAAU,CAAC,eAAe,CAAC;IAC/C,MAAM,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,iBAAiB;IAWhG,WAAkB,QAAQ,IAAI,eAAe,CAE5C;IAED,IAAW,mCAAmC,+CAE7C;IACD,OAAO,CAAC,oCAAoC,CAAkD;CACjG"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TypeTablesCache = void 0;
4
+ const core_1 = require("@memberjunction/core");
5
+ /**
6
+ * Simple cache for commonly used type tables across the system that are outside of what we have in the Metadata object
7
+ */
8
+ class TypeTablesCache extends core_1.BaseEngine {
9
+ constructor() {
10
+ super(...arguments);
11
+ this._EntityRelationshipDisplayComponents = [];
12
+ }
13
+ async Config(forceRefresh, contextUser, provider) {
14
+ const c = [
15
+ {
16
+ Type: 'entity',
17
+ EntityName: 'Entity Relationship Display Components',
18
+ PropertyName: '_EntityRelationshipDisplayComponents'
19
+ }
20
+ ];
21
+ await this.Load(c, provider, forceRefresh, contextUser);
22
+ }
23
+ static get Instance() {
24
+ return super.getInstance();
25
+ }
26
+ get EntityRelationshipDisplayComponents() {
27
+ return this._EntityRelationshipDisplayComponents;
28
+ }
29
+ }
30
+ exports.TypeTablesCache = TypeTablesCache;
31
+ //# sourceMappingURL=TypeTablesCache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypeTablesCache.js","sourceRoot":"","sources":["../../src/custom/TypeTablesCache.ts"],"names":[],"mappings":";;;AAAA,+CAAyG;AAGzG;;GAEG;AACH,MAAa,eAAgB,SAAQ,iBAA2B;IAAhE;;QAmBY,yCAAoC,GAA+C,EAAE,CAAC;IAClG,CAAC;IAnBU,KAAK,CAAC,MAAM,CAAC,YAAsB,EAAE,WAAsB,EAAE,QAA4B;QAC5F,MAAM,CAAC,GAAwC;YAC3C;gBACI,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE,wCAAwC;gBACpD,YAAY,EAAE,sCAAsC;aACvD;SACJ,CAAC;QACF,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;IAC5D,CAAC;IAEM,MAAM,KAAK,QAAQ;QACtB,OAAO,KAAK,CAAC,WAAW,EAAmB,CAAC;IAChD,CAAC;IAED,IAAW,mCAAmC;QAC1C,OAAO,IAAI,CAAC,oCAAoC,CAAC;IACrD,CAAC;CAEJ;AApBD,0CAoBC"}