@memberjunction/ng-dashboards 6.1.0-edge.2 → 6.1.0-edge.4

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 (46) hide show
  1. package/LICENSE +180 -4
  2. package/README.md +1 -1
  3. package/dist/AI/components/analytics/realtime/realtime-transcripts-data.d.ts.map +1 -1
  4. package/dist/AI/components/analytics/realtime/realtime-transcripts-data.js +4 -4
  5. package/dist/AI/components/analytics/realtime/realtime-transcripts-data.js.map +1 -1
  6. package/dist/DatabaseDesigner/services/database-designer.engine.d.ts.map +1 -1
  7. package/dist/DatabaseDesigner/services/database-designer.engine.js +5 -9
  8. package/dist/DatabaseDesigner/services/database-designer.engine.js.map +1 -1
  9. package/dist/Integration/components/activity/activity.component.d.ts +7 -1
  10. package/dist/Integration/components/activity/activity.component.d.ts.map +1 -1
  11. package/dist/Integration/components/activity/activity.component.js +2 -2
  12. package/dist/Integration/components/activity/activity.component.js.map +1 -1
  13. package/dist/Integration/components/mapping-workspace/mapping-workspace.component.d.ts.map +1 -1
  14. package/dist/Integration/components/mapping-workspace/mapping-workspace.component.js +3 -0
  15. package/dist/Integration/components/mapping-workspace/mapping-workspace.component.js.map +1 -1
  16. package/dist/Integration/components/overview/overview.component.d.ts.map +1 -1
  17. package/dist/Integration/components/overview/overview.component.js +2 -1
  18. package/dist/Integration/components/overview/overview.component.js.map +1 -1
  19. package/dist/Integration/components/widgets/integration-card.component.d.ts.map +1 -1
  20. package/dist/Integration/components/widgets/integration-card.component.js +8 -7
  21. package/dist/Integration/components/widgets/integration-card.component.js.map +1 -1
  22. package/dist/Integration/components/widgets/run-history-panel.component.d.ts +1 -1
  23. package/dist/Integration/components/widgets/run-history-panel.component.d.ts.map +1 -1
  24. package/dist/Integration/components/widgets/run-history-panel.component.js +6 -0
  25. package/dist/Integration/components/widgets/run-history-panel.component.js.map +1 -1
  26. package/dist/Integration/services/integration-data.service.d.ts +13 -3
  27. package/dist/Integration/services/integration-data.service.d.ts.map +1 -1
  28. package/dist/Integration/services/integration-data.service.js +13 -2
  29. package/dist/Integration/services/integration-data.service.js.map +1 -1
  30. package/dist/Workflows/components/workflow-run-debug-state.d.ts +41 -0
  31. package/dist/Workflows/components/workflow-run-debug-state.d.ts.map +1 -0
  32. package/dist/Workflows/components/workflow-run-debug-state.js +78 -0
  33. package/dist/Workflows/components/workflow-run-debug-state.js.map +1 -0
  34. package/dist/Workflows/components/workflow-run-layout.d.ts +83 -0
  35. package/dist/Workflows/components/workflow-run-layout.d.ts.map +1 -0
  36. package/dist/Workflows/components/workflow-run-layout.js +133 -0
  37. package/dist/Workflows/components/workflow-run-layout.js.map +1 -0
  38. package/dist/Workflows/components/workflow-runs-resource.component.d.ts +146 -3
  39. package/dist/Workflows/components/workflow-runs-resource.component.d.ts.map +1 -1
  40. package/dist/Workflows/components/workflow-runs-resource.component.js +1271 -125
  41. package/dist/Workflows/components/workflow-runs-resource.component.js.map +1 -1
  42. package/dist/workflows-dashboards.module.d.ts +2 -1
  43. package/dist/workflows-dashboards.module.d.ts.map +1 -1
  44. package/dist/workflows-dashboards.module.js +6 -2
  45. package/dist/workflows-dashboards.module.js.map +1 -1
  46. package/package.json +64 -64
package/LICENSE CHANGED
@@ -1,7 +1,183 @@
1
- ISC License
1
+ Business Source License 1.1
2
2
 
3
- Copyright (c) 2023 MemberJunction
3
+ License text copyright (c) 2024 MariaDB plc, All Rights Reserved.
4
+ "Business Source License" is a trademark of MariaDB plc.
4
5
 
5
- Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
6
+ -----------------------------------------------------------------------------
6
7
 
7
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
8
+ Parameters
9
+
10
+ Licensor: Blue Cypress, Inc.
11
+
12
+ Licensed Work: MemberJunction.
13
+ The Licensed Work is (c) 2023-2026 Blue Cypress, Inc.
14
+
15
+ Additional Use Grant: Subject to the terms of this License, Licensor grants
16
+ you the following additional rights to make Production
17
+ Use of the Licensed Work.
18
+
19
+ 1. Internal Use
20
+
21
+ You may make production use of the Licensed Work for
22
+ your own internal business or organizational operations.
23
+
24
+ 2. Nonprofit Use
25
+
26
+ If you are a Nonprofit, you may make production use of
27
+ the Licensed Work for the operations and activities of
28
+ your Organizational Family.
29
+
30
+ 3. MemberJunction Certified Program Use
31
+
32
+ If you are authorized by Licensor under the
33
+ MemberJunction Certified Program to provide professional
34
+ services using the Licensed Work, you may make
35
+ production use of the Licensed Work in providing such
36
+ professional services to a client, provided that:
37
+
38
+ (a) the Licensed Work is deployed in, and the applicable
39
+ production use occurs within, an environment owned,
40
+ leased, licensed, subscribed to, or otherwise controlled
41
+ by that client; and
42
+
43
+ (b) the production use is for that client's own internal
44
+ business or organizational operations or is otherwise
45
+ independently permitted to that client under this
46
+ Additional Use Grant.
47
+
48
+ 4. Definitions Applicable to the Additional Use Grant
49
+
50
+ "Affiliate" means, with respect to a specified Person,
51
+ any other Person that directly or indirectly Controls,
52
+ is Controlled by, or is under common Control with such
53
+ specified Person.
54
+
55
+ "Control" (including the terms "Controls," "Controlled
56
+ by," and "under common Control with") means the direct
57
+ or indirect possession of the power to direct or cause
58
+ the direction of the management and policies of a
59
+ Person, whether through ownership of voting interests,
60
+ by contract, or otherwise.
61
+
62
+ "Organizational Family" means, with respect to a Person,
63
+ (a) such Person and its Affiliates, and (b) any
64
+ nonprofit organization, governmental entity, chapter,
65
+ division, local affiliate, regional affiliate, state
66
+ affiliate, national affiliate, or other entity that is
67
+ formally affiliated with such Person through governing
68
+ documents, a charter, bylaws, a membership agreement, or
69
+ another written organizational instrument, and is
70
+ recognized under such documents as part of the same
71
+ organizational structure.
72
+
73
+ "Nonprofit" means a Person recognized by the Internal
74
+ Revenue Service as exempt from federal income taxation
75
+ under Section 501(c)(3), 501(c)(4), 501(c)(5), or
76
+ 501(c)(6) of the Internal Revenue Code, or a foreign
77
+ organization recognized under substantially equivalent
78
+ laws.
79
+
80
+ A Person claiming eligibility as a Nonprofit shall, upon
81
+ Licensor's reasonable request, provide documentation
82
+ reasonably sufficient to demonstrate that it qualifies
83
+ as a Nonprofit. If such Person materially misrepresents,
84
+ or is unable to demonstrate, its qualification as a
85
+ Nonprofit, the rights granted to such Person under
86
+ Section 2 of this Additional Use Grant shall terminate.
87
+
88
+ "MemberJunction Certified Program" means Licensor's
89
+ then-current program for certifying and authorizing a
90
+ Person to provide professional services using the
91
+ Licensed Work.
92
+
93
+ "Person" means any individual, corporation, limited
94
+ liability company, partnership, association, nonprofit
95
+ organization, governmental entity, or other legal or
96
+ organizational entity.
97
+
98
+ Change Date: Four (4) years from the date the Licensed Work is first
99
+ made available.
100
+
101
+ Change License: MIT License.
102
+
103
+ For information about alternative licensing arrangements for the Licensed
104
+ Work, please contact Blue Cypress, Inc.
105
+
106
+ -----------------------------------------------------------------------------
107
+
108
+ Terms
109
+
110
+ The Licensor hereby grants you the right to copy, modify, create derivative
111
+ works, redistribute, and make non-production use of the Licensed Work. The
112
+ Licensor may make an Additional Use Grant, above, permitting limited
113
+ production use.
114
+
115
+ Effective on the Change Date, or the fourth anniversary of the first publicly
116
+ available distribution of a specific version of the Licensed Work under this
117
+ License, whichever comes first, the Licensor hereby grants you rights under
118
+ the terms of the Change License, and the rights granted in the paragraph
119
+ above terminate.
120
+
121
+ If your use of the Licensed Work does not comply with the requirements
122
+ currently in effect as described in this License, you must purchase a
123
+ commercial license from the Licensor, its affiliated entities, or authorized
124
+ resellers, or you must refrain from using the Licensed Work.
125
+
126
+ All copies of the original and modified Licensed Work, and derivative works
127
+ of the Licensed Work, are subject to this License. This License applies
128
+ separately for each version of the Licensed Work and the Change Date may vary
129
+ for each version of the Licensed Work released by Licensor.
130
+
131
+ You must conspicuously display this License on each original or modified copy
132
+ of the Licensed Work. If you receive the Licensed Work in original or
133
+ modified form from a third party, the terms and conditions set forth in this
134
+ License apply to your use of that work.
135
+
136
+ Any use of the Licensed Work in violation of this License will automatically
137
+ terminate your rights under this License for the current and all other
138
+ versions of the Licensed Work.
139
+
140
+ This License does not grant you any right in any trademark or logo of
141
+ Licensor or its affiliates (provided that you may use a trademark or logo of
142
+ Licensor as expressly required by this License).
143
+
144
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
145
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
146
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
147
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
148
+ TITLE.
149
+
150
+ MariaDB hereby grants you permission to use this License's text to license
151
+ your works, and to refer to it using the trademark "Business Source License",
152
+ as long as you comply with the Covenants of Licensor below.
153
+
154
+ -----------------------------------------------------------------------------
155
+
156
+ Covenants of Licensor
157
+
158
+ In consideration of the right to use this License's text and the "Business
159
+ Source License" name and trademark, Licensor covenants to MariaDB, and to all
160
+ other recipients of the licensed work to be provided by Licensor:
161
+
162
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
163
+ or a license that is compatible with GPL Version 2.0 or a later version,
164
+ where "compatible" means that software provided under the Change License
165
+ can be included in a program with software provided under GPL Version 2.0
166
+ or a later version. Licensor may specify additional Change Licenses without
167
+ limitation.
168
+
169
+ 2. To either: (a) specify an additional grant of rights to use that does not
170
+ impose any additional restriction on the right granted in this License, as
171
+ the Additional Use Grant; or (b) insert the text "None".
172
+
173
+ 3. To specify a Change Date.
174
+
175
+ 4. Not to modify this License in any other way.
176
+
177
+ -----------------------------------------------------------------------------
178
+
179
+ Notice
180
+
181
+ The Business Source License (this document, or the "License") is not an Open
182
+ Source license. However, the Licensed Work will eventually be made available
183
+ under an Open Source License, as stated in this License.
package/README.md CHANGED
@@ -221,4 +221,4 @@ cd packages/Angular/Explorer/dashboards && npm run build
221
221
 
222
222
  ## License
223
223
 
224
- ISC
224
+ Business Source License 1.1 — see [LICENSE](../../../../LICENSE) for details.
@@ -1 +1 @@
1
- {"version":3,"file":"realtime-transcripts-data.d.ts","sourceRoot":"","sources":["../../../../../src/AI/components/analytics/realtime/realtime-transcripts-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,iBAAiB,EAAW,MAAM,sBAAsB,CAAC;AAQlE,oDAAoD;AACpD,MAAM,WAAW,kBAAkB;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,sGAAsG;IACtG,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,YAAY,EAAE,IAAI,CAAC;CACtB;AAED,kEAAkE;AAClE,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,mGAAmG;IACnG,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAClC,mGAAmG;IACnG,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,IAAI,CAAC;CACZ;AAKD;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,OAAO,SAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAuBhH;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACpC,QAAQ,EAAE,iBAAiB,EAC3B,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,EAAE,CAAC,CAyB3B;AAqDD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CACzB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1B,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,EACjE,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,cAAc,CAqBhB"}
1
+ {"version":3,"file":"realtime-transcripts-data.d.ts","sourceRoot":"","sources":["../../../../../src/AI/components/analytics/realtime/realtime-transcripts-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,iBAAiB,EAAW,MAAM,sBAAsB,CAAC;AASlE,oDAAoD;AACpD,MAAM,WAAW,kBAAkB;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,sGAAsG;IACtG,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,YAAY,EAAE,IAAI,CAAC;CACtB;AAED,kEAAkE;AAClE,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,mGAAmG;IACnG,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAClC,mGAAmG;IACnG,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,IAAI,CAAC;CACZ;AAID;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,OAAO,SAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAuBhH;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACpC,QAAQ,EAAE,iBAAiB,EAC3B,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,EAAE,CAAC,CAyB3B;AAqDD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CACzB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1B,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,EACjE,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,cAAc,CAqBhB"}
@@ -8,12 +8,12 @@
8
8
  * @module @memberjunction/ng-dashboards
9
9
  */
10
10
  import { RunView } from '@memberjunction/core';
11
+ import { EscapeSQLString } from '@memberjunction/global';
11
12
  import { AIEngineBase } from '@memberjunction/ai-engine-base';
12
13
  const CONVERSATION_ENTITY = 'MJ: Conversations';
13
14
  const CONVERSATION_DETAIL_ENTITY = 'MJ: Conversation Details';
14
15
  const BRIDGE_ENTITY = 'MJ: AI Agent Session Bridges';
15
16
  const PARTICIPANT_ENTITY = 'MJ: AI Agent Session Bridge Participants';
16
- const escapeSql = (v) => v.replace(/'/g, "''");
17
17
  const toDate = (v) => (v instanceof Date ? v : new Date(String(v ?? '')));
18
18
  /**
19
19
  * Loads the meeting-room transcript LIST (light — no per-room detail load). Newest activity first.
@@ -56,7 +56,7 @@ export async function LoadRoomTranscript(provider, conversationID, roomKey) {
56
56
  const [detailResult, bridgeResult] = await rv.RunViews([
57
57
  {
58
58
  EntityName: CONVERSATION_DETAIL_ENTITY,
59
- ExtraFilter: `ConversationID='${escapeSql(conversationID)}'`,
59
+ ExtraFilter: `ConversationID='${EscapeSQLString(conversationID)}'`,
60
60
  Fields: ['ID', 'Role', 'Message', 'AgentID', 'ExternalID', 'Error', '__mj_CreatedAt'],
61
61
  OrderBy: '__mj_CreatedAt ASC',
62
62
  MaxRows: 5000,
@@ -64,7 +64,7 @@ export async function LoadRoomTranscript(provider, conversationID, roomKey) {
64
64
  },
65
65
  {
66
66
  EntityName: BRIDGE_ENTITY,
67
- ExtraFilter: roomKey ? `ExternalConnectionID='${escapeSql(roomKey)}'` : `1=0`,
67
+ ExtraFilter: roomKey ? `ExternalConnectionID='${EscapeSQLString(roomKey)}'` : `1=0`,
68
68
  Fields: ['ID'],
69
69
  MaxRows: 100,
70
70
  ResultType: 'simple',
@@ -81,7 +81,7 @@ async function loadParticipantNames(provider, rv, bridgeIds) {
81
81
  if (bridgeIds.length === 0) {
82
82
  return map;
83
83
  }
84
- const inClause = bridgeIds.map((id) => `'${escapeSql(id)}'`).join(',');
84
+ const inClause = bridgeIds.map((id) => `'${EscapeSQLString(id)}'`).join(',');
85
85
  const result = await rv.RunView({
86
86
  EntityName: PARTICIPANT_ENTITY,
87
87
  ExtraFilter: `SessionBridgeID IN (${inClause})`,
@@ -1 +1 @@
1
- {"version":3,"file":"realtime-transcripts-data.js","sourceRoot":"","sources":["../../../../../src/AI/components/analytics/realtime/realtime-transcripts-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAqB,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,MAAM,mBAAmB,GAAG,mBAAmB,CAAC;AAChD,MAAM,0BAA0B,GAAG,0BAA0B,CAAC;AAC9D,MAAM,aAAa,GAAG,8BAA8B,CAAC;AACrD,MAAM,kBAAkB,GAAG,0CAA0C,CAAC;AAuBtE,MAAM,SAAS,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC/D,MAAM,MAAM,GAAG,CAAC,CAAU,EAAQ,EAAE,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAEzF;;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E,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,OAAO,EAAE,CAAC;IAClF,CAAC;IACD,yGAAyG;IACzG,MAAM,WAAW,GAAG,UAAU,CAAC,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9E,IAAI,WAAW,EAAE,CAAC;QACd,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC;IACjG,CAAC;IACD,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;AAC9D,CAAC","sourcesContent":["/**\n * @fileoverview Pure data layer for the Realtime \"Voice Transcripts\" view. Loads the unified per-room\n * meeting transcripts the bridge writes (one `MJ: Conversations` of `Type='Meeting Room'` per room +\n * `MJ: Conversation Details` per utterance), and resolves each line's speaker — agent lines via `AgentID`,\n * heard ('User') lines via the diarized `ExternalID` → the room's `AIAgentSessionBridgeParticipant` roster\n * (DisplayName + IsAgent). No Angular imports — RunView(s) + client-side aggregation only.\n *\n * @module @memberjunction/ng-dashboards\n */\nimport { IMetadataProvider, RunView } from '@memberjunction/core';\nimport { AIEngineBase } from '@memberjunction/ai-engine-base';\n\nconst CONVERSATION_ENTITY = 'MJ: Conversations';\nconst CONVERSATION_DETAIL_ENTITY = 'MJ: Conversation Details';\nconst BRIDGE_ENTITY = 'MJ: AI Agent Session Bridges';\nconst PARTICIPANT_ENTITY = 'MJ: AI Agent Session Bridge Participants';\n\n/** One meeting-room transcript in the list view. */\nexport interface MeetingRoomSummary {\n ConversationID: string;\n Name: string;\n /** The room's external connection id (`ExternalID`) — the join key to the bridge/participant rows. */\n RoomKey: string;\n CreatedAt: Date;\n LastActivity: Date;\n}\n\n/** A speaker-attributed transcript line for the drill-in view. */\nexport interface TranscriptLine {\n ID: string;\n /** `'agent'` = an agent spoke; `'human'` = a human/participant spoke; `'error'` = an error row. */\n Kind: 'agent' | 'human' | 'error';\n /** Resolved display name of the speaker (agent name, participant name, or a sensible fallback). */\n Speaker: string;\n Message: string;\n At: Date;\n}\n\nconst escapeSql = (v: string): string => v.replace(/'/g, \"''\");\nconst toDate = (v: unknown): Date => (v instanceof Date ? v : new Date(String(v ?? '')));\n\n/**\n * Loads the meeting-room transcript LIST (light — no per-room detail load). Newest activity first.\n *\n * @param provider The request-scoped metadata provider.\n * @param maxRows Cap on rooms returned (default 500).\n */\nexport async function LoadMeetingRooms(provider: IMetadataProvider, maxRows = 500): Promise<MeetingRoomSummary[]> {\n const rv = RunView.FromMetadataProvider(provider);\n const result = await rv.RunView<Record<string, unknown>>(\n {\n EntityName: CONVERSATION_ENTITY,\n ExtraFilter: `Type='Meeting Room'`,\n Fields: ['ID', 'Name', 'ExternalID', '__mj_CreatedAt', '__mj_UpdatedAt'],\n OrderBy: '__mj_UpdatedAt DESC',\n MaxRows: maxRows,\n ResultType: 'simple',\n },\n provider.CurrentUser,\n );\n if (!result.Success) {\n return [];\n }\n return result.Results.map((r) => ({\n ConversationID: String(r['ID']),\n Name: String(r['Name'] ?? 'Meeting Room'),\n RoomKey: String(r['ExternalID'] ?? ''),\n CreatedAt: toDate(r['__mj_CreatedAt']),\n LastActivity: toDate(r['__mj_UpdatedAt']),\n }));\n}\n\n/**\n * Loads + speaker-attributes one room's transcript. Resolves agent lines via `AgentID` (AIEngine cache) and\n * heard lines via the diarized `ExternalID` against the room's participant roster (so a `User` line reads as\n * the actual person, and another agent heard in the room reads as that agent — not a generic \"User\").\n *\n * @param provider The request-scoped metadata provider.\n * @param conversationID The room conversation id.\n * @param roomKey The room's external id (to load its bridge participants for attribution).\n */\nexport async function LoadRoomTranscript(\n provider: IMetadataProvider,\n conversationID: string,\n roomKey: string,\n): Promise<TranscriptLine[]> {\n const rv = RunView.FromMetadataProvider(provider);\n const [detailResult, bridgeResult] = await rv.RunViews([\n {\n EntityName: CONVERSATION_DETAIL_ENTITY,\n ExtraFilter: `ConversationID='${escapeSql(conversationID)}'`,\n Fields: ['ID', 'Role', 'Message', 'AgentID', 'ExternalID', 'Error', '__mj_CreatedAt'],\n OrderBy: '__mj_CreatedAt ASC',\n MaxRows: 5000,\n ResultType: 'simple',\n },\n {\n EntityName: BRIDGE_ENTITY,\n ExtraFilter: roomKey ? `ExternalConnectionID='${escapeSql(roomKey)}'` : `1=0`,\n Fields: ['ID'],\n MaxRows: 100,\n ResultType: 'simple',\n },\n ], provider.CurrentUser);\n\n const participantNames = await loadParticipantNames(provider, rv, (bridgeResult?.Results ?? []).map((b) => String(b['ID'])));\n const agentName = buildAgentNameLookup();\n\n const details = detailResult?.Success ? detailResult.Results : [];\n return details.map((d) => attributeLine(d, participantNames, agentName));\n}\n\n/** roomBridges → a map of `ExternalParticipantID → { name, isAgent }` for diarized-line attribution. */\nasync function loadParticipantNames(\n provider: IMetadataProvider,\n rv: RunView,\n bridgeIds: string[],\n): Promise<Map<string, { name: string; isAgent: boolean }>> {\n const map = new Map<string, { name: string; isAgent: boolean }>();\n if (bridgeIds.length === 0) {\n return map;\n }\n const inClause = bridgeIds.map((id) => `'${escapeSql(id)}'`).join(',');\n const result = await rv.RunView<Record<string, unknown>>(\n {\n EntityName: PARTICIPANT_ENTITY,\n ExtraFilter: `SessionBridgeID IN (${inClause})`,\n Fields: ['ExternalParticipantID', 'DisplayName', 'IsAgent'],\n MaxRows: 1000,\n ResultType: 'simple',\n },\n provider.CurrentUser,\n );\n if (result.Success) {\n for (const p of result.Results) {\n const id = String(p['ExternalParticipantID'] ?? '').toLowerCase();\n if (!id) {\n continue;\n }\n // Each agent appears on multiple bridges' rosters — `IsAgent=1` only on its OWN bridge (where it's\n // the bot), `IsAgent=0` where another agent merely heard it. OR-reduce so it resolves to an agent,\n // and keep the most specific (non-fallback) DisplayName we've seen for the identity.\n const isAgent = p['IsAgent'] === true;\n const name = String(p['DisplayName'] ?? '');\n const prev = map.get(id);\n map.set(id, {\n name: name || prev?.name || 'Participant',\n isAgent: (prev?.isAgent ?? false) || isAgent,\n });\n }\n }\n return map;\n}\n\n/** AgentID → agent name, from the AIEngine cache (agents are always loaded for the analytics shell). */\nfunction buildAgentNameLookup(): Map<string, string> {\n const map = new Map<string, string>();\n for (const a of AIEngineBase.Instance.Agents ?? []) {\n map.set(a.ID.toLowerCase(), a.Name ?? 'Agent');\n }\n return map;\n}\n\n/**\n * Resolves one raw detail row into a display-ready, speaker-attributed line — the diarization-attribution\n * core. Exported for unit testing (the maps are easy to construct directly, no RunView mocking needed).\n *\n * @param d The raw `MJ: Conversation Details` row.\n * @param participantNames `ExternalParticipantID(lower) → { name, isAgent }` from the room roster.\n * @param agentName `AgentID(lower) → agent name`.\n */\nexport function attributeLine(\n d: Record<string, unknown>,\n participantNames: Map<string, { name: string; isAgent: boolean }>,\n agentName: Map<string, string>,\n): TranscriptLine {\n const role = String(d['Role'] ?? 'User');\n const externalId = String(d['ExternalID'] ?? '').toLowerCase();\n const base = {\n ID: String(d['ID']),\n Message: String(d['Message'] ?? d['Error'] ?? ''),\n At: toDate(d['__mj_CreatedAt']),\n };\n if (role === 'Error') {\n return { ...base, Kind: 'error', Speaker: 'Error' };\n }\n if (role === 'AI') {\n const agentId = String(d['AgentID'] ?? '').toLowerCase();\n return { ...base, Kind: 'agent', Speaker: agentName.get(agentId) ?? 'Agent' };\n }\n // 'User' — diarized to a participant when we have the speaker label; another agent heard reads as agent.\n const participant = externalId ? participantNames.get(externalId) : undefined;\n if (participant) {\n return { ...base, Kind: participant.isAgent ? 'agent' : 'human', Speaker: participant.name };\n }\n return { ...base, Kind: 'human', Speaker: 'Participant' };\n}\n"]}
1
+ {"version":3,"file":"realtime-transcripts-data.js","sourceRoot":"","sources":["../../../../../src/AI/components/analytics/realtime/realtime-transcripts-data.ts"],"names":[],"mapp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AE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACjD,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;KAClC,CAAC;IACF,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACnB,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IACxD,CAAC;IACD,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAChB,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QACzD,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,OAAO,EAAE,CAAC;IAClF,CAAC;IACD,yGAAyG;IACzG,MAAM,WAAW,GAAG,UAAU,CAAC,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9E,IAAI,WAAW,EAAE,CAAC;QACd,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC;IACjG,CAAC;IACD,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;AAC9D,CAAC","sourcesContent":["/**\n * @fileoverview Pure data layer for the Realtime \"Voice Transcripts\" view. Loads the unified per-room\n * meeting transcripts the bridge writes (one `MJ: Conversations` of `Type='Meeting Room'` per room +\n * `MJ: Conversation Details` per utterance), and resolves each line's speaker — agent lines via `AgentID`,\n * heard ('User') lines via the diarized `ExternalID` → the room's `AIAgentSessionBridgeParticipant` roster\n * (DisplayName + IsAgent). No Angular imports — RunView(s) + client-side aggregation only.\n *\n * @module @memberjunction/ng-dashboards\n */\nimport { IMetadataProvider, RunView } from '@memberjunction/core';\nimport { EscapeSQLString } from '@memberjunction/global';\nimport { AIEngineBase } from '@memberjunction/ai-engine-base';\n\nconst CONVERSATION_ENTITY = 'MJ: Conversations';\nconst CONVERSATION_DETAIL_ENTITY = 'MJ: Conversation Details';\nconst BRIDGE_ENTITY = 'MJ: AI Agent Session Bridges';\nconst PARTICIPANT_ENTITY = 'MJ: AI Agent Session Bridge Participants';\n\n/** One meeting-room transcript in the list view. */\nexport interface MeetingRoomSummary {\n ConversationID: string;\n Name: string;\n /** The room's external connection id (`ExternalID`) — the join key to the bridge/participant rows. */\n RoomKey: string;\n CreatedAt: Date;\n LastActivity: Date;\n}\n\n/** A speaker-attributed transcript line for the drill-in view. */\nexport interface TranscriptLine {\n ID: string;\n /** `'agent'` = an agent spoke; `'human'` = a human/participant spoke; `'error'` = an error row. */\n Kind: 'agent' | 'human' | 'error';\n /** Resolved display name of the speaker (agent name, participant name, or a sensible fallback). */\n Speaker: string;\n Message: string;\n At: Date;\n}\n\nconst toDate = (v: unknown): Date => (v instanceof Date ? v : new Date(String(v ?? '')));\n\n/**\n * Loads the meeting-room transcript LIST (light — no per-room detail load). Newest activity first.\n *\n * @param provider The request-scoped metadata provider.\n * @param maxRows Cap on rooms returned (default 500).\n */\nexport async function LoadMeetingRooms(provider: IMetadataProvider, maxRows = 500): Promise<MeetingRoomSummary[]> {\n const rv = RunView.FromMetadataProvider(provider);\n const result = await rv.RunView<Record<string, unknown>>(\n {\n EntityName: CONVERSATION_ENTITY,\n ExtraFilter: `Type='Meeting Room'`,\n Fields: ['ID', 'Name', 'ExternalID', '__mj_CreatedAt', '__mj_UpdatedAt'],\n OrderBy: '__mj_UpdatedAt DESC',\n MaxRows: maxRows,\n ResultType: 'simple',\n },\n provider.CurrentUser,\n );\n if (!result.Success) {\n return [];\n }\n return result.Results.map((r) => ({\n ConversationID: String(r['ID']),\n Name: String(r['Name'] ?? 'Meeting Room'),\n RoomKey: String(r['ExternalID'] ?? ''),\n CreatedAt: toDate(r['__mj_CreatedAt']),\n LastActivity: toDate(r['__mj_UpdatedAt']),\n }));\n}\n\n/**\n * Loads + speaker-attributes one room's transcript. Resolves agent lines via `AgentID` (AIEngine cache) and\n * heard lines via the diarized `ExternalID` against the room's participant roster (so a `User` line reads as\n * the actual person, and another agent heard in the room reads as that agent — not a generic \"User\").\n *\n * @param provider The request-scoped metadata provider.\n * @param conversationID The room conversation id.\n * @param roomKey The room's external id (to load its bridge participants for attribution).\n */\nexport async function LoadRoomTranscript(\n provider: IMetadataProvider,\n conversationID: string,\n roomKey: string,\n): Promise<TranscriptLine[]> {\n const rv = RunView.FromMetadataProvider(provider);\n const [detailResult, bridgeResult] = await rv.RunViews([\n {\n EntityName: CONVERSATION_DETAIL_ENTITY,\n ExtraFilter: `ConversationID='${EscapeSQLString(conversationID)}'`,\n Fields: ['ID', 'Role', 'Message', 'AgentID', 'ExternalID', 'Error', '__mj_CreatedAt'],\n OrderBy: '__mj_CreatedAt ASC',\n MaxRows: 5000,\n ResultType: 'simple',\n },\n {\n EntityName: BRIDGE_ENTITY,\n ExtraFilter: roomKey ? `ExternalConnectionID='${EscapeSQLString(roomKey)}'` : `1=0`,\n Fields: ['ID'],\n MaxRows: 100,\n ResultType: 'simple',\n },\n ], provider.CurrentUser);\n\n const participantNames = await loadParticipantNames(provider, rv, (bridgeResult?.Results ?? []).map((b) => String(b['ID'])));\n const agentName = buildAgentNameLookup();\n\n const details = detailResult?.Success ? detailResult.Results : [];\n return details.map((d) => attributeLine(d, participantNames, agentName));\n}\n\n/** roomBridges → a map of `ExternalParticipantID → { name, isAgent }` for diarized-line attribution. */\nasync function loadParticipantNames(\n provider: IMetadataProvider,\n rv: RunView,\n bridgeIds: string[],\n): Promise<Map<string, { name: string; isAgent: boolean }>> {\n const map = new Map<string, { name: string; isAgent: boolean }>();\n if (bridgeIds.length === 0) {\n return map;\n }\n const inClause = bridgeIds.map((id) => `'${EscapeSQLString(id)}'`).join(',');\n const result = await rv.RunView<Record<string, unknown>>(\n {\n EntityName: PARTICIPANT_ENTITY,\n ExtraFilter: `SessionBridgeID IN (${inClause})`,\n Fields: ['ExternalParticipantID', 'DisplayName', 'IsAgent'],\n MaxRows: 1000,\n ResultType: 'simple',\n },\n provider.CurrentUser,\n );\n if (result.Success) {\n for (const p of result.Results) {\n const id = String(p['ExternalParticipantID'] ?? '').toLowerCase();\n if (!id) {\n continue;\n }\n // Each agent appears on multiple bridges' rosters — `IsAgent=1` only on its OWN bridge (where it's\n // the bot), `IsAgent=0` where another agent merely heard it. OR-reduce so it resolves to an agent,\n // and keep the most specific (non-fallback) DisplayName we've seen for the identity.\n const isAgent = p['IsAgent'] === true;\n const name = String(p['DisplayName'] ?? '');\n const prev = map.get(id);\n map.set(id, {\n name: name || prev?.name || 'Participant',\n isAgent: (prev?.isAgent ?? false) || isAgent,\n });\n }\n }\n return map;\n}\n\n/** AgentID → agent name, from the AIEngine cache (agents are always loaded for the analytics shell). */\nfunction buildAgentNameLookup(): Map<string, string> {\n const map = new Map<string, string>();\n for (const a of AIEngineBase.Instance.Agents ?? []) {\n map.set(a.ID.toLowerCase(), a.Name ?? 'Agent');\n }\n return map;\n}\n\n/**\n * Resolves one raw detail row into a display-ready, speaker-attributed line — the diarization-attribution\n * core. Exported for unit testing (the maps are easy to construct directly, no RunView mocking needed).\n *\n * @param d The raw `MJ: Conversation Details` row.\n * @param participantNames `ExternalParticipantID(lower) → { name, isAgent }` from the room roster.\n * @param agentName `AgentID(lower) → agent name`.\n */\nexport function attributeLine(\n d: Record<string, unknown>,\n participantNames: Map<string, { name: string; isAgent: boolean }>,\n agentName: Map<string, string>,\n): TranscriptLine {\n const role = String(d['Role'] ?? 'User');\n const externalId = String(d['ExternalID'] ?? '').toLowerCase();\n const base = {\n ID: String(d['ID']),\n Message: String(d['Message'] ?? d['Error'] ?? ''),\n At: toDate(d['__mj_CreatedAt']),\n };\n if (role === 'Error') {\n return { ...base, Kind: 'error', Speaker: 'Error' };\n }\n if (role === 'AI') {\n const agentId = String(d['AgentID'] ?? '').toLowerCase();\n return { ...base, Kind: 'agent', Speaker: agentName.get(agentId) ?? 'Agent' };\n }\n // 'User' — diarized to a participant when we have the speaker label; another agent heard reads as agent.\n const participant = externalId ? participantNames.get(externalId) : undefined;\n if (participant) {\n return { ...base, Kind: participant.isAgent ? 'agent' : 'human', Speaker: participant.name };\n }\n return { ...base, Kind: 'human', Speaker: 'Participant' };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"database-designer.engine.d.ts","sourceRoot":"","sources":["../../../src/DatabaseDesigner/services/database-designer.engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAE,aAAa,EAAc,MAAM,wBAAwB,CAAC;AAEnE,OAAO,KAAK,EACR,gBAAgB,EAChB,sBAAsB,EAGtB,YAAY,EACf,MAAM,+BAA+B,CAAC;AAwEvC;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,aAAa,CAAC,sBAAsB,CAAC;IAE7E,WAAkB,QAAQ,IAAI,sBAAsB,CAEnD;IAED,SAAS;IAIT,gDAAgD;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2C;IAElE,oFAAoF;IACpF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAuC;IAEpE,sFAAsF;IAC/E,eAAe,IAAI,IAAI;IAU9B;;;;;;;;OAQG;IACU,sBAAsB,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAmBlE;;;OAGG;IACU,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC;IAqDvF;;;;;;;;;;;;;;OAcG;IACU,oBAAoB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAc5D,iFAAiF;YACnE,qBAAqB;IA+CnC,0FAA0F;YAC5E,iBAAiB;IAe/B;;;;;OAKG;IACU,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAgBzG,uFAAuF;YACzE,eAAe;IAsD7B,oEAAoE;YACtD,iBAAiB;IAkC/B,kFAAkF;YACpE,kBAAkB;IAmBhC,oFAAoF;IACpF,OAAO,CAAC,uBAAuB;IAQ/B,2EAA2E;IAC3E,OAAO,CAAC,oBAAoB;CAe/B"}
1
+ {"version":3,"file":"database-designer.engine.d.ts","sourceRoot":"","sources":["../../../src/DatabaseDesigner/services/database-designer.engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAE,aAAa,EAA+B,MAAM,wBAAwB,CAAC;AAEpF,OAAO,KAAK,EACR,gBAAgB,EAChB,sBAAsB,EAGtB,YAAY,EACf,MAAM,+BAA+B,CAAC;AAwEvC;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,aAAa,CAAC,sBAAsB,CAAC;IAE7E,WAAkB,QAAQ,IAAI,sBAAsB,CAEnD;IAED,SAAS;IAIT,gDAAgD;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2C;IAElE,oFAAoF;IACpF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAuC;IAEpE,sFAAsF;IAC/E,eAAe,IAAI,IAAI;IAU9B;;;;;;;;OAQG;IACU,sBAAsB,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAmBlE;;;OAGG;IACU,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC;IAqDvF;;;;;;;;;;;;;;OAcG;IACU,oBAAoB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAc5D,iFAAiF;YACnE,qBAAqB;IA+CnC,0FAA0F;YAC5E,iBAAiB;IAe/B;;;;;OAKG;IACU,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAgBzG,uFAAuF;YACzE,eAAe;IAsD7B,oEAAoE;YACtD,iBAAiB;IAkC/B,kFAAkF;YACpE,kBAAkB;IAmBhC,oFAAoF;IACpF,OAAO,CAAC,uBAAuB;IAQ/B,2EAA2E;IAC3E,OAAO,CAAC,oBAAoB;CAe/B"}
@@ -24,7 +24,7 @@
24
24
  * @see DatabaseDesignerService — for action invocation (create, modify, validate)
25
25
  */
26
26
  import { Metadata, RunView, AuthorizationEvaluator } from '@memberjunction/core';
27
- import { BaseSingleton, UUIDsEqual } from '@memberjunction/global';
27
+ import { BaseSingleton, UUIDsEqual, EscapeSQLString } from '@memberjunction/global';
28
28
  // ─── Constants (mirror database-designer-core/src/interfaces.ts) ───────────────
29
29
  // These string values MUST stay in sync with the server-side constants.
30
30
  // If the server-side values change, update here in parallel.
@@ -247,8 +247,8 @@ export class DatabaseDesignerEngine extends BaseSingleton {
247
247
  const rv = new RunView();
248
248
  const result = await rv.RunView({
249
249
  EntityName: 'MJ: Entities',
250
- ExtraFilter: `(Name = '${escapeSqlLiteral(entityName)}' OR BaseTable = '${escapeSqlLiteral(tableName)}') ` +
251
- `AND SchemaName = '${escapeSqlLiteral(schemaName)}'`,
250
+ ExtraFilter: `(Name = '${EscapeSQLString(entityName)}' OR BaseTable = '${EscapeSQLString(tableName)}') ` +
251
+ `AND SchemaName = '${EscapeSQLString(schemaName)}'`,
252
252
  Fields: ['ID'],
253
253
  ResultType: 'simple',
254
254
  });
@@ -308,7 +308,7 @@ export class DatabaseDesignerEngine extends BaseSingleton {
308
308
  // Find entities owned by this user
309
309
  const ownerResult = await rv.RunView({
310
310
  EntityName: 'MJ: Entity Settings',
311
- ExtraFilter: `Name = '${UDT_SETTINGS.OWNER_KEY}' AND Value = '${escapeSqlLiteral(userId)}'`,
311
+ ExtraFilter: `Name = '${UDT_SETTINGS.OWNER_KEY}' AND Value = '${EscapeSQLString(userId)}'`,
312
312
  Fields: ['EntityID', 'Value'],
313
313
  ResultType: 'simple',
314
314
  });
@@ -343,7 +343,7 @@ export class DatabaseDesignerEngine extends BaseSingleton {
343
343
  EntityName: 'MJ: Entity Settings',
344
344
  ExtraFilter: (`EntityID = '${escapeSqlId(entityId)}' ` +
345
345
  `AND Name = '${UDT_SETTINGS.OWNER_KEY}' ` +
346
- `AND Value = '${escapeSqlLiteral(userId)}'`),
346
+ `AND Value = '${EscapeSQLString(userId)}'`),
347
347
  Fields: ['EntityID', 'Value'],
348
348
  ResultType: 'simple',
349
349
  });
@@ -385,8 +385,4 @@ function buildInFilter(column, ids) {
385
385
  function escapeSqlId(id) {
386
386
  return id.replace(/[^a-zA-Z0-9-]/g, '');
387
387
  }
388
- /** Escape a string value for safe embedding in a SQL single-quoted literal. */
389
- function escapeSqlLiteral(value) {
390
- return value.replace(/'/g, "''");
391
- }
392
388
  //# sourceMappingURL=database-designer.engine.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"database-designer.engine.js","sourceRoot":"","sources":["../../../src/DatabaseDesigner/services/database-designer.engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAUnE,kFAAkF;AAClF,wEAAwE;AACxE,6DAA6D;AAE7D,MAAM,eAAe,GAAG,UAAU,CAAC;AAEnC,MAAM,YAAY,GAAG;IACjB,SAAS,EAAE,cAAc;IACzB,UAAU,EAAE,eAAe;IAC3B,wBAAwB,EAAE,kBAAkB;IAC5C,oBAAoB,EAAE,cAAc;CAC9B,CAAC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BAAgB,EAAE,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED,+EAA+E;AAC/E,SAAS,gBAAgB,CAAC,KAAa;IACnC,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC","sourcesContent":["/**\n * @module database-designer.engine\n * @description Read-only data access engine for the Database Designer Angular UI.\n *\n * `DatabaseDesignerEngine` is a `BaseSingleton` (NOT an Angular service) that:\n * - Loads the list of entities accessible to the current user\n * - Loads full entity detail for the modify wizard\n * - Loads available schemas from `MJ: Schema Info` (async, cached per-user)\n * - Checks whether a proposed entity name / table name is available\n *\n * ### Why BaseSingleton, not @Injectable?\n * Engine classes hold a cross-request cache that must survive Angular's DI\n * lifecycle boundaries (the same instance is reused across multiple wizard\n * openings in the same session). `BaseSingleton` uses the MJ Global Object\n * Store which guarantees exactly one instance per process, even across ESBuild\n * code-split chunks.\n *\n * ### Usage\n * ```typescript\n * const engine = DatabaseDesignerEngine.Instance;\n * const entities = await engine.loadAccessibleEntities();\n * ```\n *\n * @see DatabaseDesignerService — for action invocation (create, modify, validate)\n */\n\nimport { Metadata, RunView, AuthorizationEvaluator } from '@memberjunction/core';\nimport { BaseSingleton, UUIDsEqual } from '@memberjunction/global';\n\nimport type {\n AccessibleEntity,\n AccessibleEntityDetail,\n ColumnSpec,\n ForeignKeySpec,\n SchemaOption,\n} from '../database-designer.types.js';\n\n// ─── Constants (mirror database-designer-core/src/interfaces.ts) ───────────────\n// These string values MUST stay in sync with the server-side constants.\n// If the server-side values change, update here in parallel.\n\nconst UDT_SCHEMA_NAME = '__mj_UDT';\n\nconst UDT_SETTINGS = {\n OWNER_KEY: 'MJ:UDT:Owner',\n SOURCE_KEY: 'MJ:UDT:Source',\n SOURCE_DATABASE_DESIGNER: 'DatabaseDesigner',\n SOURCE_AGENT_MANAGER: 'AgentManager',\n} as const;\n\nconst ENTITY_DESIGNER_AUTH = {\n CREATE_IN_UDT_SCHEMA: 'Create in UDT Schema',\n CREATE_IN_CUSTOM_SCHEMA: 'Create in Custom Schema',\n MODIFY_OWN_ENTITIES: 'Modify Own Entities',\n MODIFY_ANY_UDT_ENTITIES: 'Modify Any UDT Entities',\n} as const;\n\n/** Cache TTL in milliseconds (5 minutes). */\nconst CACHE_TTL_MS = 5 * 60 * 1_000;\n\n// ─── Columns managed automatically by CodeGen (never shown as user-editable) ─\n\n/**\n * Normalised lower-case set of column names that CodeGen injects on every entity.\n * These are filtered out of the modify wizard so users cannot inadvertently remove or\n * rename them. The set is compared after calling `.toLowerCase()` on each column name\n * so it is case-insensitive regardless of DB platform.\n */\nconst AUTO_MANAGED_COLUMNS = new Set(['id', '__mj_createdat', '__mj_updatedat']);\n\n// ─── Internal row types for RunView results ───────────────────────────────────\n\ninterface SettingsRow { EntityID: string; Value: string }\ninterface EntityRow { ID: string; Name: string; BaseTable: string; SchemaName: string; __mj_CreatedAt: string }\ninterface FieldRow {\n ID: string;\n EntityID: string;\n Name: string;\n Type: string;\n AllowsNull: boolean;\n Description: string;\n DefaultValue: string | null;\n MaxLength: number | null;\n Precision: number | null;\n Scale: number | null;\n}\n\n// ─── Cache entry ─────────────────────────────────────────────────────────────\n\ninterface EntityListCacheEntry {\n entities: AccessibleEntity[];\n timestamp: number;\n}\n\ninterface SchemaCacheEntry {\n schemas: SchemaOption[];\n timestamp: number;\n}\n\n// ─── Frontend-only schema blocklist ──────────────────────────────────────────\n// `MJ: Schema Info` only surfaces MJ-registered schemas, so system schemas\n// (sys, dbo, information_schema) never appear. Only __mj must be blocked here.\n// Server-side RSM.GetAllProtectedSchemas() remains the authoritative gate.\nconst FRONTEND_BLOCKED_SCHEMAS = new Set(['__mj']);\n\n// ─── Engine ──────────────────────────────────────────────────────────────────\n\n/**\n * Singleton data access engine for Database Designer.\n * All methods read data; none modifies state (mutations go through `DatabaseDesignerService`).\n */\nexport class DatabaseDesignerEngine extends BaseSingleton<DatabaseDesignerEngine> {\n\n public static get Instance(): DatabaseDesignerEngine {\n return super.getInstance<DatabaseDesignerEngine>();\n }\n\n protected constructor() { super(); }\n\n // ─── Cache ────────────────────────────────────────────────────────────\n\n /** Per-user entity list cache. Key = userID. */\n private readonly _cache = new Map<string, EntityListCacheEntry>();\n\n /** Per-user schema list cache. Key = userID. Invalidated alongside entity cache. */\n private readonly _schemaCache = new Map<string, SchemaCacheEntry>();\n\n /** Invalidate all per-user caches for the current user (call after create/modify). */\n public invalidateCache(): void {\n const userId = new Metadata().CurrentUser?.ID; // global-provider-ok: client-side Angular engine, single provider\n if (userId) {\n this._cache.delete(userId);\n this._schemaCache.delete(userId);\n }\n }\n\n // ─── Entity list ──────────────────────────────────────────────────────\n\n /**\n * Load all entities accessible to the current user.\n *\n * - **Admin** (holds `Modify Any UDT Entities`): sees all entities created by\n * Database Designer or Agent Manager, with ownership annotations.\n * - **Regular user**: sees only entities they own (`MJ:UDT:Owner = userId`).\n *\n * Results are cached per-user with a 5-minute TTL.\n */\n public async loadAccessibleEntities(): Promise<AccessibleEntity[]> {\n const md = new Metadata(); // global-provider-ok: client-side Angular engine, single provider\n const userId = md.CurrentUser?.ID;\n if (!userId) return [];\n\n const cached = this._cache.get(userId);\n if (cached && Date.now() - cached.timestamp < CACHE_TTL_MS) {\n return cached.entities;\n }\n\n const isAdmin = this.currentUserCanModifyAny();\n const entities = isAdmin\n ? await this.loadAllEntities(userId)\n : await this.loadOwnedEntities(userId);\n\n this._cache.set(userId, { entities, timestamp: Date.now() });\n return entities;\n }\n\n /**\n * Load full entity detail (columns, foreign keys, description) for the modify wizard.\n * Not cached — always fetches fresh data so the wizard reflects current DB state.\n */\n public async loadEntityDetail(entityId: string): Promise<AccessibleEntityDetail | null> {\n const rv = new RunView();\n // BypassCache: true on both queries because CodeGen writes Entity Fields via direct\n // SQL (outside BaseEntity.Save()), so the server-side RunView cache never receives\n // an invalidation event after a pipeline run. Without this, the detail view would\n // show stale field data (e.g. old AllowsNull value) until MJAPI restarts.\n const [entityResult, fieldsResult] = await rv.RunViews([\n {\n EntityName: 'MJ: Entities',\n ExtraFilter: `ID = '${escapeSqlId(entityId)}'`,\n Fields: ['ID', 'Name', 'BaseTable', 'SchemaName', 'Description', '__mj_CreatedAt'],\n ResultType: 'simple',\n BypassCache: true,\n },\n {\n EntityName: 'MJ: Entity Fields',\n ExtraFilter: `EntityID = '${escapeSqlId(entityId)}' AND IsVirtual = 0`,\n Fields: ['ID', 'EntityID', 'Name', 'Type', 'AllowsNull', 'Description', 'DefaultValue', 'MaxLength', 'Precision', 'Scale'],\n OrderBy: 'Sequence ASC, Name ASC',\n ResultType: 'simple',\n BypassCache: true,\n },\n ]);\n\n if (!entityResult.Success || entityResult.Results.length === 0) return null;\n\n const entity = entityResult.Results[0] as EntityRow & { Description: string };\n const fieldRows = (fieldsResult.Results ?? []) as FieldRow[];\n\n const isOwner = await this.isCurrentUserOwner(entityId);\n\n // Exclude auto-managed columns (ID, __mj_CreatedAt, __mj_UpdatedAt) from the editable\n // column list. CodeGen injects these automatically — they must not be user-modified.\n const editableFields = fieldRows.filter(\n f => !AUTO_MANAGED_COLUMNS.has(f.Name.toLowerCase())\n );\n\n return {\n entityId: entity.ID,\n entityName: entity.Name,\n tableName: entity.BaseTable,\n schemaName: entity.SchemaName,\n description: entity.Description ?? '',\n fieldCount: editableFields.length,\n createdAt: new Date(entity.__mj_CreatedAt),\n isOwner,\n columns: editableFields.map(f => this.mapFieldToColumnSpec(f)),\n foreignKeys: [], // FK detail loaded on demand — Phase 5e\n };\n }\n\n // ─── Schema options ───────────────────────────────────────────────────\n\n /**\n * Return the list of schemas the current user is authorized to create tables in.\n *\n * Async — queries `MJ: Schema Info` to surface real DB schemas for users\n * with `Create in Custom Schema` authorization. Results are cached per-user\n * with the same 5-minute TTL as the entity list.\n *\n * Order:\n * 1. `__mj_UDT` (if user holds `Create in UDT Schema`)\n * 2. Real DB schemas from `MJ: Schema Info`, excluding blocked schemas\n * and `__mj_UDT` (already listed first)\n * 3. \"Other (enter schema name)\" free-text option, at the end\n *\n * All items beyond #1 require `Create in Custom Schema` authorization.\n */\n public async loadAvailableSchemas(): Promise<SchemaOption[]> {\n const userId = new Metadata().CurrentUser?.ID; // global-provider-ok: client-side Angular engine, single provider\n if (!userId) return [];\n\n const cached = this._schemaCache.get(userId);\n if (cached && Date.now() - cached.timestamp < CACHE_TTL_MS) {\n return cached.schemas;\n }\n\n const schemas = await this.fetchAvailableSchemas();\n this._schemaCache.set(userId, { schemas, timestamp: Date.now() });\n return schemas;\n }\n\n /** Build the schema option list: UDT first, then real DB schemas, then Other. */\n private async fetchAvailableSchemas(): Promise<SchemaOption[]> {\n const md = new Metadata(); // global-provider-ok: client-side Angular engine, single provider\n const evaluator = new AuthorizationEvaluator();\n\n const udtAuth = md.Authorizations.find(a => a.Name === ENTITY_DESIGNER_AUTH.CREATE_IN_UDT_SCHEMA);\n const customAuth = md.Authorizations.find(a => a.Name === ENTITY_DESIGNER_AUTH.CREATE_IN_CUSTOM_SCHEMA);\n\n const canUseUdt = !!(udtAuth && evaluator.CurrentUserCanExecuteWithAncestors(udtAuth));\n const canUseCustom = !!(customAuth && evaluator.CurrentUserCanExecuteWithAncestors(customAuth));\n\n const schemas: SchemaOption[] = [];\n\n if (canUseUdt) {\n schemas.push({\n value: UDT_SCHEMA_NAME,\n label: `${UDT_SCHEMA_NAME} — User-Defined Tables (default)`,\n isDefault: true,\n requiresElevatedAuth: false,\n });\n }\n\n if (canUseCustom) {\n const dbSchemas = await this.loadDbSchemaNames();\n for (const schemaName of dbSchemas) {\n // Skip the UDT schema (already first) and any server-blocked schemas\n if (schemaName === UDT_SCHEMA_NAME) continue;\n if (FRONTEND_BLOCKED_SCHEMAS.has(schemaName)) continue;\n schemas.push({\n value: schemaName,\n label: schemaName,\n isDefault: false,\n requiresElevatedAuth: true,\n });\n }\n\n // Free-text escape hatch for schemas not yet registered with MJ\n schemas.push({\n value: '',\n label: 'Other (enter schema name)',\n isDefault: false,\n requiresElevatedAuth: true,\n });\n }\n\n return schemas;\n }\n\n /** Query `MJ: Schema Info` for distinct schema names registered with this MJ instance. */\n private async loadDbSchemaNames(): Promise<string[]> {\n const rv = new RunView();\n const result = await rv.RunView<{ SchemaName: string }>({\n EntityName: 'MJ: Schema Info',\n Fields: ['SchemaName'],\n OrderBy: 'SchemaName ASC',\n ResultType: 'simple',\n });\n\n if (!result.Success) return [];\n return result.Results.map(r => r.SchemaName).filter(Boolean);\n }\n\n // ─── Name availability ────────────────────────────────────────────────\n\n /**\n * Check whether the proposed entity name and table name are available\n * (no existing MJ entity in the same schema shares either).\n *\n * Returns true when the proposed names are safe to use.\n */\n public async isNameAvailable(entityName: string, tableName: string, schemaName: string): Promise<boolean> {\n const rv = new RunView();\n const result = await rv.RunView<{ ID: string }>({\n EntityName: 'MJ: Entities',\n ExtraFilter:\n `(Name = '${escapeSqlLiteral(entityName)}' OR BaseTable = '${escapeSqlLiteral(tableName)}') ` +\n `AND SchemaName = '${escapeSqlLiteral(schemaName)}'`,\n Fields: ['ID'],\n ResultType: 'simple',\n });\n\n return result.Success && result.Results.length === 0;\n }\n\n // ─── Private helpers ──────────────────────────────────────────────────\n\n /** Admin path: load all database-Designer-managed entities + ownership annotations. */\n private async loadAllEntities(currentUserId: string): Promise<AccessibleEntity[]> {\n const rv = new RunView();\n\n // Round 1: get entity IDs from provenance settings and owner map\n const [sourceResult, ownerResult] = await rv.RunViews([\n {\n EntityName: 'MJ: Entity Settings',\n ExtraFilter: (\n `Name = '${UDT_SETTINGS.SOURCE_KEY}' ` +\n `AND Value IN ('${UDT_SETTINGS.SOURCE_DATABASE_DESIGNER}', '${UDT_SETTINGS.SOURCE_AGENT_MANAGER}')`\n ),\n Fields: ['EntityID', 'Value'],\n ResultType: 'simple',\n },\n {\n EntityName: 'MJ: Entity Settings',\n ExtraFilter: `Name = '${UDT_SETTINGS.OWNER_KEY}'`,\n Fields: ['EntityID', 'Value'],\n ResultType: 'simple',\n },\n ]);\n\n const sourceRows = (sourceResult.Results ?? []) as SettingsRow[];\n const ownerRows = (ownerResult.Results ?? []) as SettingsRow[];\n\n const entityIds = Array.from(new Set(sourceRows.map(r => r.EntityID)));\n if (entityIds.length === 0) return [];\n\n const ownerMap = new Map(ownerRows.map(r => [r.EntityID, r.Value]));\n\n // Round 2: entity details\n const entityResult = await rv.RunView<EntityRow>({\n EntityName: 'MJ: Entities',\n ExtraFilter: buildInFilter('ID', entityIds),\n Fields: ['ID', 'Name', 'BaseTable', 'SchemaName', '__mj_CreatedAt'],\n OrderBy: 'Name ASC',\n ResultType: 'simple',\n });\n\n return (entityResult.Results ?? []).map(row => {\n const ownerUserId = ownerMap.get(row.ID);\n return {\n entityId: row.ID,\n entityName: row.Name,\n tableName: row.BaseTable,\n schemaName: row.SchemaName,\n fieldCount: 0, // loaded on demand in detail view\n createdAt: new Date(row.__mj_CreatedAt),\n // UUIDsEqual handles SQL Server uppercase vs PostgreSQL lowercase UUIDs\n isOwner: ownerUserId != null && UUIDsEqual(ownerUserId, currentUserId),\n } satisfies AccessibleEntity;\n });\n }\n\n /** Non-admin path: load only entities owned by the current user. */\n private async loadOwnedEntities(userId: string): Promise<AccessibleEntity[]> {\n const rv = new RunView();\n\n // Find entities owned by this user\n const ownerResult = await rv.RunView<SettingsRow>({\n EntityName: 'MJ: Entity Settings',\n ExtraFilter: `Name = '${UDT_SETTINGS.OWNER_KEY}' AND Value = '${escapeSqlLiteral(userId)}'`,\n Fields: ['EntityID', 'Value'],\n ResultType: 'simple',\n });\n\n const entityIds = (ownerResult.Results ?? []).map(r => r.EntityID);\n if (entityIds.length === 0) return [];\n\n // Fetch entity details\n const entityResult = await rv.RunView<EntityRow>({\n EntityName: 'MJ: Entities',\n ExtraFilter: buildInFilter('ID', entityIds),\n Fields: ['ID', 'Name', 'BaseTable', 'SchemaName', '__mj_CreatedAt'],\n OrderBy: 'Name ASC',\n ResultType: 'simple',\n });\n\n return (entityResult.Results ?? []).map(row => ({\n entityId: row.ID,\n entityName: row.Name,\n tableName: row.BaseTable,\n schemaName: row.SchemaName,\n fieldCount: 0,\n createdAt: new Date(row.__mj_CreatedAt),\n isOwner: true, // user can only see their own entities in this path\n } satisfies AccessibleEntity));\n }\n\n /** Check if the current user owns the given entity (via MJ:UDT:Owner setting). */\n private async isCurrentUserOwner(entityId: string): Promise<boolean> {\n const userId = new Metadata().CurrentUser?.ID; // global-provider-ok: client-side Angular engine, single provider\n if (!userId) return false;\n\n const rv = new RunView();\n const result = await rv.RunView<SettingsRow>({\n EntityName: 'MJ: Entity Settings',\n ExtraFilter: (\n `EntityID = '${escapeSqlId(entityId)}' ` +\n `AND Name = '${UDT_SETTINGS.OWNER_KEY}' ` +\n `AND Value = '${escapeSqlLiteral(userId)}'`\n ),\n Fields: ['EntityID', 'Value'],\n ResultType: 'simple',\n });\n\n return result.Success && result.Results.length > 0;\n }\n\n /** True when the current user holds the `Modify Any UDT Entities` authorization. */\n private currentUserCanModifyAny(): boolean {\n const md = new Metadata(); // global-provider-ok: client-side Angular engine, single provider\n const auth = md.Authorizations.find(a => a.Name === ENTITY_DESIGNER_AUTH.MODIFY_ANY_UDT_ENTITIES);\n if (!auth) return false;\n const evaluator = new AuthorizationEvaluator();\n return evaluator.CurrentUserCanExecuteWithAncestors(auth);\n }\n\n /** Map a `MJ: Entity Fields` row to a `ColumnSpec` for the detail view. */\n private mapFieldToColumnSpec(field: FieldRow): ColumnSpec {\n return {\n Name: field.Name,\n Type: 'string', // detail view uses RawSqlType for display; Type is semantic\n RawSqlType: field.Type,\n IsNullable: field.AllowsNull,\n // Preserve precision/scale metadata so the modify wizard renders the correct\n // field type controls (e.g. DECIMAL(18,2) vs DECIMAL with no constraints)\n MaxLength: field.MaxLength ?? undefined,\n Precision: field.Precision ?? undefined,\n Scale: field.Scale ?? undefined,\n DefaultValue: field.DefaultValue ?? undefined,\n Description: field.Description ?? undefined,\n };\n }\n}\n\n// ─── Private module-level utilities ──────────────────────────────────────────\n\n/** Build a SQL `column IN ('id1', 'id2', ...)` filter for a UUID list. */\nfunction buildInFilter(column: string, ids: string[]): string {\n const quoted = ids.map(id => `'${escapeSqlId(id)}'`).join(', ');\n return `${column} IN (${quoted})`;\n}\n\n/** Escape a UUID for safe embedding in a SQL filter (UUIDs are alphanumeric + dashes, but be explicit). */\nfunction escapeSqlId(id: string): string {\n return id.replace(/[^a-zA-Z0-9-]/g, '');\n}\n\n/** Escape a string value for safe embedding in a SQL single-quoted literal. */\nfunction escapeSqlLiteral(value: string): string {\n return value.replace(/'/g, \"''\");\n}\n"]}
1
+ {"version":3,"file":"database-designer.engine.js","sourceRoot":"","sources":["../../../src/DatabaseDesigner/services/database-designer.engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAUpF,kFAAkF;AAClF,wEAAwE;AACxE,6DAA6D;AAE7D,MAAM,eAAe,GAAG,UAAU,CAAC;AAEnC,MAAM,YAAY,GAAG;IACjB,SAAS,EAAE,cAAc;IACzB,UAAU,EAAE,eAAe;IAC3B,wBAAwB,EAAE,kBAAkB;IAC5C,oBAAoB,EAAE,cAAc;CAC9B,CAAC;AAEX,MAAM,oBAAoB,GAAG;IACzB,oBAAoB,EAAE,sBAAsB;IAC5C,uBAAuB,EAAE,yBAAyB;IAClD,mBAAmB,EAAE,qBAAqB;IAC1C,uBAAuB,EAAE,yBAAyB;CAC5C,CAAC;AAEX,6CAA6C;AAC7C,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;AAEpC,gFAAgF;AAEhF;;;;;GAKG;AACH,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC;AA+BjF,gFAAgF;AAChF,2EAA2E;AAC3E,gFAAgF;AAChF,2EAA2E;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I;YAChB,IAAI,EAAE,QAAQ,EAAG,4DAA4D;YAC7E,UAAU,EAAE,KAAK,CAAC,IAAI;YACtB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,6EAA6E;YAC7E,0EAA0E;YAC1E,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,SAAS;YACvC,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,SAAS;YACvC,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,SAAS;YAC/B,YAAY,EAAE,KAAK,CAAC,YAAY,IAAI,SAAS;YAC7C,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,SAAS;SAC9C,CAAC;IACN,CAAC;CACJ;AAED,gFAAgF;AAEhF,0EAA0E;AAC1E,SAAS,aAAa,CAAC,MAAc,EAAE,GAAa;IAChD,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChE,OAAO,GAAG,MAAM,QAAQ,MAAM,GAAG,CAAC;AACtC,CAAC;AAED,2GAA2G;AAC3G,SAAS,WAAW,CAAC,EAAU;IAC3B,OAAO,EAAE,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["/**\n * @module database-designer.engine\n * @description Read-only data access engine for the Database Designer Angular UI.\n *\n * `DatabaseDesignerEngine` is a `BaseSingleton` (NOT an Angular service) that:\n * - Loads the list of entities accessible to the current user\n * - Loads full entity detail for the modify wizard\n * - Loads available schemas from `MJ: Schema Info` (async, cached per-user)\n * - Checks whether a proposed entity name / table name is available\n *\n * ### Why BaseSingleton, not @Injectable?\n * Engine classes hold a cross-request cache that must survive Angular's DI\n * lifecycle boundaries (the same instance is reused across multiple wizard\n * openings in the same session). `BaseSingleton` uses the MJ Global Object\n * Store which guarantees exactly one instance per process, even across ESBuild\n * code-split chunks.\n *\n * ### Usage\n * ```typescript\n * const engine = DatabaseDesignerEngine.Instance;\n * const entities = await engine.loadAccessibleEntities();\n * ```\n *\n * @see DatabaseDesignerService — for action invocation (create, modify, validate)\n */\n\nimport { Metadata, RunView, AuthorizationEvaluator } from '@memberjunction/core';\nimport { BaseSingleton, UUIDsEqual, EscapeSQLString } from '@memberjunction/global';\n\nimport type {\n AccessibleEntity,\n AccessibleEntityDetail,\n ColumnSpec,\n ForeignKeySpec,\n SchemaOption,\n} from '../database-designer.types.js';\n\n// ─── Constants (mirror database-designer-core/src/interfaces.ts) ───────────────\n// These string values MUST stay in sync with the server-side constants.\n// If the server-side values change, update here in parallel.\n\nconst UDT_SCHEMA_NAME = '__mj_UDT';\n\nconst UDT_SETTINGS = {\n OWNER_KEY: 'MJ:UDT:Owner',\n SOURCE_KEY: 'MJ:UDT:Source',\n SOURCE_DATABASE_DESIGNER: 'DatabaseDesigner',\n SOURCE_AGENT_MANAGER: 'AgentManager',\n} as const;\n\nconst ENTITY_DESIGNER_AUTH = {\n CREATE_IN_UDT_SCHEMA: 'Create in UDT Schema',\n CREATE_IN_CUSTOM_SCHEMA: 'Create in Custom Schema',\n MODIFY_OWN_ENTITIES: 'Modify Own Entities',\n MODIFY_ANY_UDT_ENTITIES: 'Modify Any UDT Entities',\n} as const;\n\n/** Cache TTL in milliseconds (5 minutes). */\nconst CACHE_TTL_MS = 5 * 60 * 1_000;\n\n// ─── Columns managed automatically by CodeGen (never shown as user-editable) ─\n\n/**\n * Normalised lower-case set of column names that CodeGen injects on every entity.\n * These are filtered out of the modify wizard so users cannot inadvertently remove or\n * rename them. The set is compared after calling `.toLowerCase()` on each column name\n * so it is case-insensitive regardless of DB platform.\n */\nconst AUTO_MANAGED_COLUMNS = new Set(['id', '__mj_createdat', '__mj_updatedat']);\n\n// ─── Internal row types for RunView results ───────────────────────────────────\n\ninterface SettingsRow { EntityID: string; Value: string }\ninterface EntityRow { ID: string; Name: string; BaseTable: string; SchemaName: string; __mj_CreatedAt: string }\ninterface FieldRow {\n ID: string;\n EntityID: string;\n Name: string;\n Type: string;\n AllowsNull: boolean;\n Description: string;\n DefaultValue: string | null;\n MaxLength: number | null;\n Precision: number | null;\n Scale: number | null;\n}\n\n// ─── Cache entry ─────────────────────────────────────────────────────────────\n\ninterface EntityListCacheEntry {\n entities: AccessibleEntity[];\n timestamp: number;\n}\n\ninterface SchemaCacheEntry {\n schemas: SchemaOption[];\n timestamp: number;\n}\n\n// ─── Frontend-only schema blocklist ──────────────────────────────────────────\n// `MJ: Schema Info` only surfaces MJ-registered schemas, so system schemas\n// (sys, dbo, information_schema) never appear. Only __mj must be blocked here.\n// Server-side RSM.GetAllProtectedSchemas() remains the authoritative gate.\nconst FRONTEND_BLOCKED_SCHEMAS = new Set(['__mj']);\n\n// ─── Engine ──────────────────────────────────────────────────────────────────\n\n/**\n * Singleton data access engine for Database Designer.\n * All methods read data; none modifies state (mutations go through `DatabaseDesignerService`).\n */\nexport class DatabaseDesignerEngine extends BaseSingleton<DatabaseDesignerEngine> {\n\n public static get Instance(): DatabaseDesignerEngine {\n return super.getInstance<DatabaseDesignerEngine>();\n }\n\n protected constructor() { super(); }\n\n // ─── Cache ────────────────────────────────────────────────────────────\n\n /** Per-user entity list cache. Key = userID. */\n private readonly _cache = new Map<string, EntityListCacheEntry>();\n\n /** Per-user schema list cache. Key = userID. Invalidated alongside entity cache. */\n private readonly _schemaCache = new Map<string, SchemaCacheEntry>();\n\n /** Invalidate all per-user caches for the current user (call after create/modify). */\n public invalidateCache(): void {\n const userId = new Metadata().CurrentUser?.ID; // global-provider-ok: client-side Angular engine, single provider\n if (userId) {\n this._cache.delete(userId);\n this._schemaCache.delete(userId);\n }\n }\n\n // ─── Entity list ──────────────────────────────────────────────────────\n\n /**\n * Load all entities accessible to the current user.\n *\n * - **Admin** (holds `Modify Any UDT Entities`): sees all entities created by\n * Database Designer or Agent Manager, with ownership annotations.\n * - **Regular user**: sees only entities they own (`MJ:UDT:Owner = userId`).\n *\n * Results are cached per-user with a 5-minute TTL.\n */\n public async loadAccessibleEntities(): Promise<AccessibleEntity[]> {\n const md = new Metadata(); // global-provider-ok: client-side Angular engine, single provider\n const userId = md.CurrentUser?.ID;\n if (!userId) return [];\n\n const cached = this._cache.get(userId);\n if (cached && Date.now() - cached.timestamp < CACHE_TTL_MS) {\n return cached.entities;\n }\n\n const isAdmin = this.currentUserCanModifyAny();\n const entities = isAdmin\n ? await this.loadAllEntities(userId)\n : await this.loadOwnedEntities(userId);\n\n this._cache.set(userId, { entities, timestamp: Date.now() });\n return entities;\n }\n\n /**\n * Load full entity detail (columns, foreign keys, description) for the modify wizard.\n * Not cached — always fetches fresh data so the wizard reflects current DB state.\n */\n public async loadEntityDetail(entityId: string): Promise<AccessibleEntityDetail | null> {\n const rv = new RunView();\n // BypassCache: true on both queries because CodeGen writes Entity Fields via direct\n // SQL (outside BaseEntity.Save()), so the server-side RunView cache never receives\n // an invalidation event after a pipeline run. Without this, the detail view would\n // show stale field data (e.g. old AllowsNull value) until MJAPI restarts.\n const [entityResult, fieldsResult] = await rv.RunViews([\n {\n EntityName: 'MJ: Entities',\n ExtraFilter: `ID = '${escapeSqlId(entityId)}'`,\n Fields: ['ID', 'Name', 'BaseTable', 'SchemaName', 'Description', '__mj_CreatedAt'],\n ResultType: 'simple',\n BypassCache: true,\n },\n {\n EntityName: 'MJ: Entity Fields',\n ExtraFilter: `EntityID = '${escapeSqlId(entityId)}' AND IsVirtual = 0`,\n Fields: ['ID', 'EntityID', 'Name', 'Type', 'AllowsNull', 'Description', 'DefaultValue', 'MaxLength', 'Precision', 'Scale'],\n OrderBy: 'Sequence ASC, Name ASC',\n ResultType: 'simple',\n BypassCache: true,\n },\n ]);\n\n if (!entityResult.Success || entityResult.Results.length === 0) return null;\n\n const entity = entityResult.Results[0] as EntityRow & { Description: string };\n const fieldRows = (fieldsResult.Results ?? []) as FieldRow[];\n\n const isOwner = await this.isCurrentUserOwner(entityId);\n\n // Exclude auto-managed columns (ID, __mj_CreatedAt, __mj_UpdatedAt) from the editable\n // column list. CodeGen injects these automatically — they must not be user-modified.\n const editableFields = fieldRows.filter(\n f => !AUTO_MANAGED_COLUMNS.has(f.Name.toLowerCase())\n );\n\n return {\n entityId: entity.ID,\n entityName: entity.Name,\n tableName: entity.BaseTable,\n schemaName: entity.SchemaName,\n description: entity.Description ?? '',\n fieldCount: editableFields.length,\n createdAt: new Date(entity.__mj_CreatedAt),\n isOwner,\n columns: editableFields.map(f => this.mapFieldToColumnSpec(f)),\n foreignKeys: [], // FK detail loaded on demand — Phase 5e\n };\n }\n\n // ─── Schema options ───────────────────────────────────────────────────\n\n /**\n * Return the list of schemas the current user is authorized to create tables in.\n *\n * Async — queries `MJ: Schema Info` to surface real DB schemas for users\n * with `Create in Custom Schema` authorization. Results are cached per-user\n * with the same 5-minute TTL as the entity list.\n *\n * Order:\n * 1. `__mj_UDT` (if user holds `Create in UDT Schema`)\n * 2. Real DB schemas from `MJ: Schema Info`, excluding blocked schemas\n * and `__mj_UDT` (already listed first)\n * 3. \"Other (enter schema name)\" free-text option, at the end\n *\n * All items beyond #1 require `Create in Custom Schema` authorization.\n */\n public async loadAvailableSchemas(): Promise<SchemaOption[]> {\n const userId = new Metadata().CurrentUser?.ID; // global-provider-ok: client-side Angular engine, single provider\n if (!userId) return [];\n\n const cached = this._schemaCache.get(userId);\n if (cached && Date.now() - cached.timestamp < CACHE_TTL_MS) {\n return cached.schemas;\n }\n\n const schemas = await this.fetchAvailableSchemas();\n this._schemaCache.set(userId, { schemas, timestamp: Date.now() });\n return schemas;\n }\n\n /** Build the schema option list: UDT first, then real DB schemas, then Other. */\n private async fetchAvailableSchemas(): Promise<SchemaOption[]> {\n const md = new Metadata(); // global-provider-ok: client-side Angular engine, single provider\n const evaluator = new AuthorizationEvaluator();\n\n const udtAuth = md.Authorizations.find(a => a.Name === ENTITY_DESIGNER_AUTH.CREATE_IN_UDT_SCHEMA);\n const customAuth = md.Authorizations.find(a => a.Name === ENTITY_DESIGNER_AUTH.CREATE_IN_CUSTOM_SCHEMA);\n\n const canUseUdt = !!(udtAuth && evaluator.CurrentUserCanExecuteWithAncestors(udtAuth));\n const canUseCustom = !!(customAuth && evaluator.CurrentUserCanExecuteWithAncestors(customAuth));\n\n const schemas: SchemaOption[] = [];\n\n if (canUseUdt) {\n schemas.push({\n value: UDT_SCHEMA_NAME,\n label: `${UDT_SCHEMA_NAME} — User-Defined Tables (default)`,\n isDefault: true,\n requiresElevatedAuth: false,\n });\n }\n\n if (canUseCustom) {\n const dbSchemas = await this.loadDbSchemaNames();\n for (const schemaName of dbSchemas) {\n // Skip the UDT schema (already first) and any server-blocked schemas\n if (schemaName === UDT_SCHEMA_NAME) continue;\n if (FRONTEND_BLOCKED_SCHEMAS.has(schemaName)) continue;\n schemas.push({\n value: schemaName,\n label: schemaName,\n isDefault: false,\n requiresElevatedAuth: true,\n });\n }\n\n // Free-text escape hatch for schemas not yet registered with MJ\n schemas.push({\n value: '',\n label: 'Other (enter schema name)',\n isDefault: false,\n requiresElevatedAuth: true,\n });\n }\n\n return schemas;\n }\n\n /** Query `MJ: Schema Info` for distinct schema names registered with this MJ instance. */\n private async loadDbSchemaNames(): Promise<string[]> {\n const rv = new RunView();\n const result = await rv.RunView<{ SchemaName: string }>({\n EntityName: 'MJ: Schema Info',\n Fields: ['SchemaName'],\n OrderBy: 'SchemaName ASC',\n ResultType: 'simple',\n });\n\n if (!result.Success) return [];\n return result.Results.map(r => r.SchemaName).filter(Boolean);\n }\n\n // ─── Name availability ────────────────────────────────────────────────\n\n /**\n * Check whether the proposed entity name and table name are available\n * (no existing MJ entity in the same schema shares either).\n *\n * Returns true when the proposed names are safe to use.\n */\n public async isNameAvailable(entityName: string, tableName: string, schemaName: string): Promise<boolean> {\n const rv = new RunView();\n const result = await rv.RunView<{ ID: string }>({\n EntityName: 'MJ: Entities',\n ExtraFilter:\n `(Name = '${EscapeSQLString(entityName)}' OR BaseTable = '${EscapeSQLString(tableName)}') ` +\n `AND SchemaName = '${EscapeSQLString(schemaName)}'`,\n Fields: ['ID'],\n ResultType: 'simple',\n });\n\n return result.Success && result.Results.length === 0;\n }\n\n // ─── Private helpers ──────────────────────────────────────────────────\n\n /** Admin path: load all database-Designer-managed entities + ownership annotations. */\n private async loadAllEntities(currentUserId: string): Promise<AccessibleEntity[]> {\n const rv = new RunView();\n\n // Round 1: get entity IDs from provenance settings and owner map\n const [sourceResult, ownerResult] = await rv.RunViews([\n {\n EntityName: 'MJ: Entity Settings',\n ExtraFilter: (\n `Name = '${UDT_SETTINGS.SOURCE_KEY}' ` +\n `AND Value IN ('${UDT_SETTINGS.SOURCE_DATABASE_DESIGNER}', '${UDT_SETTINGS.SOURCE_AGENT_MANAGER}')`\n ),\n Fields: ['EntityID', 'Value'],\n ResultType: 'simple',\n },\n {\n EntityName: 'MJ: Entity Settings',\n ExtraFilter: `Name = '${UDT_SETTINGS.OWNER_KEY}'`,\n Fields: ['EntityID', 'Value'],\n ResultType: 'simple',\n },\n ]);\n\n const sourceRows = (sourceResult.Results ?? []) as SettingsRow[];\n const ownerRows = (ownerResult.Results ?? []) as SettingsRow[];\n\n const entityIds = Array.from(new Set(sourceRows.map(r => r.EntityID)));\n if (entityIds.length === 0) return [];\n\n const ownerMap = new Map(ownerRows.map(r => [r.EntityID, r.Value]));\n\n // Round 2: entity details\n const entityResult = await rv.RunView<EntityRow>({\n EntityName: 'MJ: Entities',\n ExtraFilter: buildInFilter('ID', entityIds),\n Fields: ['ID', 'Name', 'BaseTable', 'SchemaName', '__mj_CreatedAt'],\n OrderBy: 'Name ASC',\n ResultType: 'simple',\n });\n\n return (entityResult.Results ?? []).map(row => {\n const ownerUserId = ownerMap.get(row.ID);\n return {\n entityId: row.ID,\n entityName: row.Name,\n tableName: row.BaseTable,\n schemaName: row.SchemaName,\n fieldCount: 0, // loaded on demand in detail view\n createdAt: new Date(row.__mj_CreatedAt),\n // UUIDsEqual handles SQL Server uppercase vs PostgreSQL lowercase UUIDs\n isOwner: ownerUserId != null && UUIDsEqual(ownerUserId, currentUserId),\n } satisfies AccessibleEntity;\n });\n }\n\n /** Non-admin path: load only entities owned by the current user. */\n private async loadOwnedEntities(userId: string): Promise<AccessibleEntity[]> {\n const rv = new RunView();\n\n // Find entities owned by this user\n const ownerResult = await rv.RunView<SettingsRow>({\n EntityName: 'MJ: Entity Settings',\n ExtraFilter: `Name = '${UDT_SETTINGS.OWNER_KEY}' AND Value = '${EscapeSQLString(userId)}'`,\n Fields: ['EntityID', 'Value'],\n ResultType: 'simple',\n });\n\n const entityIds = (ownerResult.Results ?? []).map(r => r.EntityID);\n if (entityIds.length === 0) return [];\n\n // Fetch entity details\n const entityResult = await rv.RunView<EntityRow>({\n EntityName: 'MJ: Entities',\n ExtraFilter: buildInFilter('ID', entityIds),\n Fields: ['ID', 'Name', 'BaseTable', 'SchemaName', '__mj_CreatedAt'],\n OrderBy: 'Name ASC',\n ResultType: 'simple',\n });\n\n return (entityResult.Results ?? []).map(row => ({\n entityId: row.ID,\n entityName: row.Name,\n tableName: row.BaseTable,\n schemaName: row.SchemaName,\n fieldCount: 0,\n createdAt: new Date(row.__mj_CreatedAt),\n isOwner: true, // user can only see their own entities in this path\n } satisfies AccessibleEntity));\n }\n\n /** Check if the current user owns the given entity (via MJ:UDT:Owner setting). */\n private async isCurrentUserOwner(entityId: string): Promise<boolean> {\n const userId = new Metadata().CurrentUser?.ID; // global-provider-ok: client-side Angular engine, single provider\n if (!userId) return false;\n\n const rv = new RunView();\n const result = await rv.RunView<SettingsRow>({\n EntityName: 'MJ: Entity Settings',\n ExtraFilter: (\n `EntityID = '${escapeSqlId(entityId)}' ` +\n `AND Name = '${UDT_SETTINGS.OWNER_KEY}' ` +\n `AND Value = '${EscapeSQLString(userId)}'`\n ),\n Fields: ['EntityID', 'Value'],\n ResultType: 'simple',\n });\n\n return result.Success && result.Results.length > 0;\n }\n\n /** True when the current user holds the `Modify Any UDT Entities` authorization. */\n private currentUserCanModifyAny(): boolean {\n const md = new Metadata(); // global-provider-ok: client-side Angular engine, single provider\n const auth = md.Authorizations.find(a => a.Name === ENTITY_DESIGNER_AUTH.MODIFY_ANY_UDT_ENTITIES);\n if (!auth) return false;\n const evaluator = new AuthorizationEvaluator();\n return evaluator.CurrentUserCanExecuteWithAncestors(auth);\n }\n\n /** Map a `MJ: Entity Fields` row to a `ColumnSpec` for the detail view. */\n private mapFieldToColumnSpec(field: FieldRow): ColumnSpec {\n return {\n Name: field.Name,\n Type: 'string', // detail view uses RawSqlType for display; Type is semantic\n RawSqlType: field.Type,\n IsNullable: field.AllowsNull,\n // Preserve precision/scale metadata so the modify wizard renders the correct\n // field type controls (e.g. DECIMAL(18,2) vs DECIMAL with no constraints)\n MaxLength: field.MaxLength ?? undefined,\n Precision: field.Precision ?? undefined,\n Scale: field.Scale ?? undefined,\n DefaultValue: field.DefaultValue ?? undefined,\n Description: field.Description ?? undefined,\n };\n }\n}\n\n// ─── Private module-level utilities ──────────────────────────────────────────\n\n/** Build a SQL `column IN ('id1', 'id2', ...)` filter for a UUID list. */\nfunction buildInFilter(column: string, ids: string[]): string {\n const quoted = ids.map(id => `'${escapeSqlId(id)}'`).join(', ');\n return `${column} IN (${quoted})`;\n}\n\n/** Escape a UUID for safe embedding in a SQL filter (UUIDs are alphanumeric + dashes, but be explicit). */\nfunction escapeSqlId(id: string): string {\n return id.replace(/[^a-zA-Z0-9-]/g, '');\n}\n"]}
@@ -2,9 +2,15 @@ import { OnInit, AfterViewInit } from '@angular/core';
2
2
  import { BaseResourceComponent } from '@memberjunction/ng-shared';
3
3
  import { FilterFieldConfig } from '@memberjunction/ng-ui-components';
4
4
  import { ResourceData } from '@memberjunction/core-entities';
5
+ import type { MJCompanyIntegrationRunEntity } from '@memberjunction/core-entities';
5
6
  import { IntegrationSummary, IntegrationRunRow, RunDetailRow } from '../../services/integration-data.service';
6
7
  import * as i0 from "@angular/core";
7
- type StatusFilterType = 'All' | 'Success' | 'Failed' | 'In Progress' | 'Pending';
8
+ /**
9
+ * The activity filter's choices: 'All' plus every real run status, derived from the entity so the
10
+ * filter can never silently lose a status the database can produce. The hand-written union this
11
+ * replaces had already fallen behind — 'Queued' rows existed and were unfilterable.
12
+ */
13
+ type StatusFilterType = 'All' | MJCompanyIntegrationRunEntity['Status'];
8
14
  type DateFilterType = 'today' | '7d' | '30d' | 'all';
9
15
  interface WatermarkRow {
10
16
  ID: string;
@@ -1 +1 @@
1
- {"version":3,"file":"activity.component.d.ts","sourceRoot":"","sources":["../../../../src/Integration/components/activity/activity.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,MAAM,EAAE,aAAa,EAAU,MAAM,eAAe,CAAC;AAE5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAEL,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EAEb,MAAM,yCAAyC,CAAC;;AAYjD,KAAK,gBAAgB,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,GAAG,aAAa,GAAG,SAAS,CAAC;AACjF,KAAK,cAAc,GAAG,OAAO,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,CAAC;AAErD,UAAU,YAAY;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,iBAAiB;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAOa,iBAAkB,SAAQ,qBAAsB,YAAW,MAAM,EAAE,aAAa;IAG3F,OAAO,EAAE,iBAAiB,EAAE,CAAM;IAClC,YAAY,EAAE,iBAAiB,EA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,wBAAgB,qBAAqB,IAAI,IAAI,CAG5C"}
1
+ {"version":3,"file":"activity.component.d.ts","sourceRoot":"","sources":["../../../../src/Integration/components/activity/activity.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,MAAM,EAAE,aAAa,EAAU,MAAM,eAAe,CAAC;AAE5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAEnF,OAAO,EAEL,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EAEb,MAAM,yCAAyC,CAAC;;AAYjD;;;;GAIG;AACH,KAAK,gBAAgB,GAAG,KAAK,GAAG,6BAA6B,CAAC,QAAQ,CAAC,CAAC;AACxE,KAAK,cAAc,GAAG,OAAO,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,CAAC;AAErD,UAAU,YAAY;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,iBAAiB;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAOa,iBAAkB,SAAQ,qBAAsB,YAAW,MAAM,EAAE,aAAa;IAG3F,OAAO,EAAE,iBAAiB,EAAE,CAAM;IAClC,YAAY,EAAE,iBAAiB,EAAE,CAAM;IACvC,SAAS,EAAE,kBAAkB,EAAE,CAAM;IACrC,YAAY,EAAE,iBAAiB,EAAE,CAAM;IACvC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAQ;IACpC,kBAAkB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