@memberjunction/ng-artifacts 5.28.0 → 5.30.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 (67) hide show
  1. package/dist/lib/__tests__/artifact-snapshots.test.d.ts +2 -0
  2. package/dist/lib/__tests__/artifact-snapshots.test.d.ts.map +1 -0
  3. package/dist/lib/__tests__/artifact-snapshots.test.js +155 -0
  4. package/dist/lib/__tests__/artifact-snapshots.test.js.map +1 -0
  5. package/dist/lib/components/artifact-viewer-panel.component.d.ts +16 -2
  6. package/dist/lib/components/artifact-viewer-panel.component.d.ts.map +1 -1
  7. package/dist/lib/components/artifact-viewer-panel.component.js +128 -98
  8. package/dist/lib/components/artifact-viewer-panel.component.js.map +1 -1
  9. package/dist/lib/components/base-artifact-viewer.component.d.ts +24 -0
  10. package/dist/lib/components/base-artifact-viewer.component.d.ts.map +1 -1
  11. package/dist/lib/components/base-artifact-viewer.component.js +15 -1
  12. package/dist/lib/components/base-artifact-viewer.component.js.map +1 -1
  13. package/dist/lib/components/plugins/code-artifact-viewer.component.d.ts +2 -0
  14. package/dist/lib/components/plugins/code-artifact-viewer.component.d.ts.map +1 -1
  15. package/dist/lib/components/plugins/code-artifact-viewer.component.js +5 -1
  16. package/dist/lib/components/plugins/code-artifact-viewer.component.js.map +1 -1
  17. package/dist/lib/components/plugins/component-artifact-viewer.component.d.ts +2 -1
  18. package/dist/lib/components/plugins/component-artifact-viewer.component.d.ts.map +1 -1
  19. package/dist/lib/components/plugins/component-artifact-viewer.component.js +29 -0
  20. package/dist/lib/components/plugins/component-artifact-viewer.component.js.map +1 -1
  21. package/dist/lib/components/plugins/data-artifact-viewer.component.d.ts +50 -43
  22. package/dist/lib/components/plugins/data-artifact-viewer.component.d.ts.map +1 -1
  23. package/dist/lib/components/plugins/data-artifact-viewer.component.js +336 -137
  24. package/dist/lib/components/plugins/data-artifact-viewer.component.js.map +1 -1
  25. package/dist/lib/components/plugins/docx-artifact-viewer.component.d.ts +2 -0
  26. package/dist/lib/components/plugins/docx-artifact-viewer.component.d.ts.map +1 -1
  27. package/dist/lib/components/plugins/docx-artifact-viewer.component.js +21 -6
  28. package/dist/lib/components/plugins/docx-artifact-viewer.component.js.map +1 -1
  29. package/dist/lib/components/plugins/html-artifact-viewer.component.d.ts +2 -0
  30. package/dist/lib/components/plugins/html-artifact-viewer.component.d.ts.map +1 -1
  31. package/dist/lib/components/plugins/html-artifact-viewer.component.js +11 -1
  32. package/dist/lib/components/plugins/html-artifact-viewer.component.js.map +1 -1
  33. package/dist/lib/components/plugins/json-artifact-viewer.component.d.ts +2 -0
  34. package/dist/lib/components/plugins/json-artifact-viewer.component.d.ts.map +1 -1
  35. package/dist/lib/components/plugins/json-artifact-viewer.component.js +5 -1
  36. package/dist/lib/components/plugins/json-artifact-viewer.component.js.map +1 -1
  37. package/dist/lib/components/plugins/markdown-artifact-viewer.component.d.ts +2 -0
  38. package/dist/lib/components/plugins/markdown-artifact-viewer.component.d.ts.map +1 -1
  39. package/dist/lib/components/plugins/markdown-artifact-viewer.component.js +5 -1
  40. package/dist/lib/components/plugins/markdown-artifact-viewer.component.js.map +1 -1
  41. package/dist/lib/components/plugins/pdf-artifact-viewer.component.d.ts +2 -0
  42. package/dist/lib/components/plugins/pdf-artifact-viewer.component.d.ts.map +1 -1
  43. package/dist/lib/components/plugins/pdf-artifact-viewer.component.js +29 -10
  44. package/dist/lib/components/plugins/pdf-artifact-viewer.component.js.map +1 -1
  45. package/dist/lib/components/plugins/save-query-dialog.component.js +2 -2
  46. package/dist/lib/components/plugins/save-query-dialog.component.js.map +1 -1
  47. package/dist/lib/components/plugins/svg-artifact-viewer.component.d.ts +2 -0
  48. package/dist/lib/components/plugins/svg-artifact-viewer.component.d.ts.map +1 -1
  49. package/dist/lib/components/plugins/svg-artifact-viewer.component.js +11 -1
  50. package/dist/lib/components/plugins/svg-artifact-viewer.component.js.map +1 -1
  51. package/dist/lib/components/plugins/xlsx-artifact-viewer.component.d.ts +2 -0
  52. package/dist/lib/components/plugins/xlsx-artifact-viewer.component.d.ts.map +1 -1
  53. package/dist/lib/components/plugins/xlsx-artifact-viewer.component.js +39 -13
  54. package/dist/lib/components/plugins/xlsx-artifact-viewer.component.js.map +1 -1
  55. package/dist/lib/services/analyze-artifact.service.d.ts +77 -0
  56. package/dist/lib/services/analyze-artifact.service.d.ts.map +1 -0
  57. package/dist/lib/services/analyze-artifact.service.js +120 -0
  58. package/dist/lib/services/analyze-artifact.service.js.map +1 -0
  59. package/dist/lib/snapshot-helpers.d.ts +48 -0
  60. package/dist/lib/snapshot-helpers.d.ts.map +1 -0
  61. package/dist/lib/snapshot-helpers.js +79 -0
  62. package/dist/lib/snapshot-helpers.js.map +1 -0
  63. package/dist/public-api.d.ts +2 -0
  64. package/dist/public-api.d.ts.map +1 -1
  65. package/dist/public-api.js +3 -0
  66. package/dist/public-api.js.map +1 -1
  67. package/package.json +16 -16
@@ -0,0 +1,77 @@
1
+ import { DataSnapshot, UserInfo } from '@memberjunction/core';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * Arguments for {@link AnalyzeArtifactService.StartAnalysisConversation}.
5
+ */
6
+ export interface StartAnalysisConversationArgs {
7
+ /** The DataSnapshot captured from the source artifact's GetCurrentStateSnapshot(). */
8
+ snapshot: DataSnapshot;
9
+ /** Context user for all entity saves. */
10
+ currentUser: UserInfo;
11
+ /** Environment the new conversation and artifact belong to. */
12
+ environmentId: string;
13
+ /** Optional title override. Defaults to snapshot.title or 'Untitled Snapshot'. */
14
+ title?: string;
15
+ /** Optional initial user message text. Defaults to 'Analyze "<title>"'. */
16
+ initialMessage?: string;
17
+ }
18
+ /**
19
+ * Arguments for {@link AnalyzeArtifactService.CreateSnapshotArtifact}.
20
+ * Creates just the Artifact + ArtifactVersion — no conversation, no junction.
21
+ * Used by callers who already have a conversation and just want to persist
22
+ * the snapshot and link it to a specific user message themselves.
23
+ */
24
+ export interface CreateSnapshotArtifactArgs {
25
+ snapshot: DataSnapshot;
26
+ currentUser: UserInfo;
27
+ environmentId: string;
28
+ title?: string;
29
+ }
30
+ /**
31
+ * Result of {@link AnalyzeArtifactService.CreateSnapshotArtifact}.
32
+ */
33
+ export interface CreateSnapshotArtifactResult {
34
+ artifactId: string;
35
+ artifactVersionId: string;
36
+ title: string;
37
+ }
38
+ /**
39
+ * Result of {@link AnalyzeArtifactService.StartAnalysisConversation}.
40
+ */
41
+ export interface AnalyzeArtifactResult {
42
+ conversationId: string;
43
+ conversationDetailId: string;
44
+ artifactId: string;
45
+ artifactVersionId: string;
46
+ }
47
+ /**
48
+ * Plumbing for the standalone "Analyze" flow (unified data layer plan §8.8).
49
+ *
50
+ * Given a captured {@link DataSnapshot} from any artifact viewer, creates a
51
+ * fresh "Data Snapshot" artifact containing the snapshot JSON, a new
52
+ * conversation, an initial user message, and a junction linking the artifact
53
+ * version as `Direction='Input'` on that message. Agent kickoff and navigation
54
+ * are the caller's responsibility.
55
+ *
56
+ * Consumers subscribe to `(analyzeRequested)` on `<mj-artifact-viewer-panel>`,
57
+ * call `StartAnalysisConversation`, then route the user to the returned
58
+ * `conversationId`.
59
+ */
60
+ export declare class AnalyzeArtifactService {
61
+ /**
62
+ * Creates ONLY the Artifact + ArtifactVersion for a captured snapshot.
63
+ * Does not create a conversation or any junctions. Used by callers who
64
+ * already have a conversation and want to attach the snapshot to a
65
+ * message they're about to send (e.g., in-conversation Analyze flow).
66
+ */
67
+ CreateSnapshotArtifact(args: CreateSnapshotArtifactArgs): Promise<CreateSnapshotArtifactResult>;
68
+ /**
69
+ * Create a new analysis conversation seeded with the captured snapshot.
70
+ * Performs six sequential saves; throws with the underlying entity error
71
+ * message on any failure.
72
+ */
73
+ StartAnalysisConversation(args: StartAnalysisConversationArgs): Promise<AnalyzeArtifactResult>;
74
+ static ɵfac: i0.ɵɵFactoryDeclaration<AnalyzeArtifactService, never>;
75
+ static ɵprov: i0.ɵɵInjectableDeclaration<AnalyzeArtifactService>;
76
+ }
77
+ //# sourceMappingURL=analyze-artifact.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyze-artifact.service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/analyze-artifact.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAuB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;;AAUnF;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,sFAAsF;IACtF,QAAQ,EAAE,YAAY,CAAC;IACvB,yCAAyC;IACzC,WAAW,EAAE,QAAQ,CAAC;IACtB,+DAA+D;IAC/D,aAAa,EAAE,MAAM,CAAC;IACtB,kFAAkF;IAClF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,YAAY,CAAC;IACvB,WAAW,EAAE,QAAQ,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;GAYG;AACH,qBACa,sBAAsB;IACjC;;;;;OAKG;IACG,sBAAsB,CAAC,IAAI,EAAE,0BAA0B,GAAG,OAAO,CAAC,4BAA4B,CAAC;IA+CrG;;;;OAIG;IACG,yBAAyB,CAAC,IAAI,EAAE,6BAA6B,GAAG,OAAO,CAAC,qBAAqB,CAAC;yCA3DzF,sBAAsB;6CAAtB,sBAAsB;CAgHlC"}
@@ -0,0 +1,120 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { LogStatus, Metadata } from '@memberjunction/core';
3
+ import { ArtifactMetadataEngine, } from '@memberjunction/core-entities';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * Plumbing for the standalone "Analyze" flow (unified data layer plan §8.8).
7
+ *
8
+ * Given a captured {@link DataSnapshot} from any artifact viewer, creates a
9
+ * fresh "Data Snapshot" artifact containing the snapshot JSON, a new
10
+ * conversation, an initial user message, and a junction linking the artifact
11
+ * version as `Direction='Input'` on that message. Agent kickoff and navigation
12
+ * are the caller's responsibility.
13
+ *
14
+ * Consumers subscribe to `(analyzeRequested)` on `<mj-artifact-viewer-panel>`,
15
+ * call `StartAnalysisConversation`, then route the user to the returned
16
+ * `conversationId`.
17
+ */
18
+ export class AnalyzeArtifactService {
19
+ /**
20
+ * Creates ONLY the Artifact + ArtifactVersion for a captured snapshot.
21
+ * Does not create a conversation or any junctions. Used by callers who
22
+ * already have a conversation and want to attach the snapshot to a
23
+ * message they're about to send (e.g., in-conversation Analyze flow).
24
+ */
25
+ async CreateSnapshotArtifact(args) {
26
+ const { snapshot, currentUser, environmentId } = args;
27
+ const title = args.title || snapshot.title || 'Untitled Snapshot';
28
+ // Resolve the "Data Snapshot" artifact type.
29
+ const engine = ArtifactMetadataEngine.Instance;
30
+ await engine.Config(false, currentUser);
31
+ let snapshotType = engine.FindArtifactType('Data Snapshot');
32
+ if (!snapshotType) {
33
+ await engine.Config(true, currentUser);
34
+ snapshotType = engine.FindArtifactType('Data Snapshot');
35
+ }
36
+ if (!snapshotType) {
37
+ throw new Error('AnalyzeArtifactService: "Data Snapshot" artifact type not found. Ensure metadata has been pushed.');
38
+ }
39
+ const md = new Metadata();
40
+ const artifact = await md.GetEntityObject('MJ: Artifacts', currentUser);
41
+ artifact.Name = title;
42
+ artifact.Description = `Snapshot captured for analysis at ${new Date().toISOString()}`;
43
+ artifact.TypeID = snapshotType.ID;
44
+ artifact.UserID = currentUser.ID;
45
+ artifact.EnvironmentID = environmentId;
46
+ if (!(await artifact.Save())) {
47
+ throw new Error(`Failed to save artifact: ${artifact.LatestResult?.CompleteMessage ?? 'unknown error'}`);
48
+ }
49
+ const version = await md.GetEntityObject('MJ: Artifact Versions', currentUser);
50
+ version.ArtifactID = artifact.ID;
51
+ version.VersionNumber = 1;
52
+ version.Content = JSON.stringify(snapshot);
53
+ version.UserID = currentUser.ID;
54
+ version.Name = title;
55
+ if (!(await version.Save())) {
56
+ throw new Error(`Failed to save artifact version: ${version.LatestResult?.CompleteMessage ?? 'unknown error'}`);
57
+ }
58
+ return {
59
+ artifactId: artifact.ID,
60
+ artifactVersionId: version.ID,
61
+ title,
62
+ };
63
+ }
64
+ /**
65
+ * Create a new analysis conversation seeded with the captured snapshot.
66
+ * Performs six sequential saves; throws with the underlying entity error
67
+ * message on any failure.
68
+ */
69
+ async StartAnalysisConversation(args) {
70
+ const { snapshot, currentUser, environmentId } = args;
71
+ const title = args.title || snapshot.title || 'Untitled Snapshot';
72
+ const initialMessage = args.initialMessage || `Analyze "${title}"`;
73
+ // Steps 1-3: Create the Data Snapshot artifact + version (shared with CreateSnapshotArtifact)
74
+ const { artifactId, artifactVersionId } = await this.CreateSnapshotArtifact({
75
+ snapshot,
76
+ currentUser,
77
+ environmentId,
78
+ title,
79
+ });
80
+ const md = new Metadata();
81
+ // 4. Create the conversation
82
+ const conversation = await md.GetEntityObject('MJ: Conversations', currentUser);
83
+ conversation.Name = `Analyze: ${title}`;
84
+ conversation.UserID = currentUser.ID;
85
+ conversation.EnvironmentID = environmentId;
86
+ if (!(await conversation.Save())) {
87
+ throw new Error(`Failed to save conversation: ${conversation.LatestResult?.CompleteMessage ?? 'unknown error'}`);
88
+ }
89
+ // 5. Seed the initial user message
90
+ const detail = await md.GetEntityObject('MJ: Conversation Details', currentUser);
91
+ detail.ConversationID = conversation.ID;
92
+ detail.Role = 'User';
93
+ detail.Message = initialMessage;
94
+ if (!(await detail.Save())) {
95
+ throw new Error(`Failed to save conversation detail: ${detail.LatestResult?.CompleteMessage ?? 'unknown error'}`);
96
+ }
97
+ // 6. Link the snapshot as an input artifact on that message
98
+ const junction = await md.GetEntityObject('MJ: Conversation Detail Artifacts', currentUser);
99
+ junction.ConversationDetailID = detail.ID;
100
+ junction.ArtifactVersionID = artifactVersionId;
101
+ junction.Direction = 'Input';
102
+ if (!(await junction.Save())) {
103
+ throw new Error(`Failed to link artifact to conversation: ${junction.LatestResult?.CompleteMessage ?? 'unknown error'}`);
104
+ }
105
+ LogStatus(`[AnalyzeArtifactService] Created conversation ${conversation.ID} with input artifact ${artifactId} v1`);
106
+ return {
107
+ conversationId: conversation.ID,
108
+ conversationDetailId: detail.ID,
109
+ artifactId,
110
+ artifactVersionId,
111
+ };
112
+ }
113
+ static ɵfac = function AnalyzeArtifactService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AnalyzeArtifactService)(); };
114
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AnalyzeArtifactService, factory: AnalyzeArtifactService.ɵfac, providedIn: 'root' });
115
+ }
116
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AnalyzeArtifactService, [{
117
+ type: Injectable,
118
+ args: [{ providedIn: 'root' }]
119
+ }], null, null); })();
120
+ //# sourceMappingURL=analyze-artifact.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyze-artifact.service.js","sourceRoot":"","sources":["../../../src/lib/services/analyze-artifact.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAgB,SAAS,EAAE,QAAQ,EAAY,MAAM,sBAAsB,CAAC;AACnF,OAAO,EACL,sBAAsB,GAMvB,MAAM,+BAA+B,CAAC;;AAkDvC;;;;;;;;;;;;GAYG;AAEH,MAAM,OAAO,sBAAsB;IACjC;;;;;OAKG;IACH,KAAK,CAAC,sBAAsB,CAAC,IAAgC;QAC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,CAAC;QAC3H,CAAC;QAED,SAAS,CACP,iDAAiD,YAAY,CAAC,EAAE,wBAAwB,UAAU,KAAK,CACxG,CAAC;QAEF,OAAO;YACL,cAAc,EAAE,YAAY,CAAC,EAAE;YAC/B,oBAAoB,EAAE,MAAM,CAAC,EAAE;YAC/B,UAAU;YACV,iBAAiB;SAClB,CAAC;IACJ,CAAC;gHA/GU,sBAAsB;gEAAtB,sBAAsB,WAAtB,sBAAsB,mBADT,MAAM;;iFACnB,sBAAsB;cADlC,UAAU;eAAC,EAAE,UAAU,EAAE,MAAM,EAAE","sourcesContent":["import { Injectable } from '@angular/core';\nimport { DataSnapshot, LogStatus, Metadata, UserInfo } from '@memberjunction/core';\nimport {\n ArtifactMetadataEngine,\n MJArtifactEntity,\n MJArtifactVersionEntity,\n MJConversationEntity,\n MJConversationDetailEntity,\n MJConversationDetailArtifactEntity,\n} from '@memberjunction/core-entities';\n\n/**\n * Arguments for {@link AnalyzeArtifactService.StartAnalysisConversation}.\n */\nexport interface StartAnalysisConversationArgs {\n /** The DataSnapshot captured from the source artifact's GetCurrentStateSnapshot(). */\n snapshot: DataSnapshot;\n /** Context user for all entity saves. */\n currentUser: UserInfo;\n /** Environment the new conversation and artifact belong to. */\n environmentId: string;\n /** Optional title override. Defaults to snapshot.title or 'Untitled Snapshot'. */\n title?: string;\n /** Optional initial user message text. Defaults to 'Analyze \"<title>\"'. */\n initialMessage?: string;\n}\n\n/**\n * Arguments for {@link AnalyzeArtifactService.CreateSnapshotArtifact}.\n * Creates just the Artifact + ArtifactVersion — no conversation, no junction.\n * Used by callers who already have a conversation and just want to persist\n * the snapshot and link it to a specific user message themselves.\n */\nexport interface CreateSnapshotArtifactArgs {\n snapshot: DataSnapshot;\n currentUser: UserInfo;\n environmentId: string;\n title?: string;\n}\n\n/**\n * Result of {@link AnalyzeArtifactService.CreateSnapshotArtifact}.\n */\nexport interface CreateSnapshotArtifactResult {\n artifactId: string;\n artifactVersionId: string;\n title: string;\n}\n\n/**\n * Result of {@link AnalyzeArtifactService.StartAnalysisConversation}.\n */\nexport interface AnalyzeArtifactResult {\n conversationId: string;\n conversationDetailId: string;\n artifactId: string;\n artifactVersionId: string;\n}\n\n/**\n * Plumbing for the standalone \"Analyze\" flow (unified data layer plan §8.8).\n *\n * Given a captured {@link DataSnapshot} from any artifact viewer, creates a\n * fresh \"Data Snapshot\" artifact containing the snapshot JSON, a new\n * conversation, an initial user message, and a junction linking the artifact\n * version as `Direction='Input'` on that message. Agent kickoff and navigation\n * are the caller's responsibility.\n *\n * Consumers subscribe to `(analyzeRequested)` on `<mj-artifact-viewer-panel>`,\n * call `StartAnalysisConversation`, then route the user to the returned\n * `conversationId`.\n */\n@Injectable({ providedIn: 'root' })\nexport class AnalyzeArtifactService {\n /**\n * Creates ONLY the Artifact + ArtifactVersion for a captured snapshot.\n * Does not create a conversation or any junctions. Used by callers who\n * already have a conversation and want to attach the snapshot to a\n * message they're about to send (e.g., in-conversation Analyze flow).\n */\n async CreateSnapshotArtifact(args: CreateSnapshotArtifactArgs): Promise<CreateSnapshotArtifactResult> {\n const { snapshot, currentUser, environmentId } = args;\n const title = args.title || snapshot.title || 'Untitled Snapshot';\n\n // Resolve the \"Data Snapshot\" artifact type.\n const engine = ArtifactMetadataEngine.Instance;\n await engine.Config(false, currentUser);\n let snapshotType = engine.FindArtifactType('Data Snapshot');\n if (!snapshotType) {\n await engine.Config(true, currentUser);\n snapshotType = engine.FindArtifactType('Data Snapshot');\n }\n if (!snapshotType) {\n throw new Error(\n 'AnalyzeArtifactService: \"Data Snapshot\" artifact type not found. Ensure metadata has been pushed.',\n );\n }\n\n const md = new Metadata();\n\n const artifact = await md.GetEntityObject<MJArtifactEntity>('MJ: Artifacts', currentUser);\n artifact.Name = title;\n artifact.Description = `Snapshot captured for analysis at ${new Date().toISOString()}`;\n artifact.TypeID = snapshotType.ID;\n artifact.UserID = currentUser.ID;\n artifact.EnvironmentID = environmentId;\n if (!(await artifact.Save())) {\n throw new Error(`Failed to save artifact: ${artifact.LatestResult?.CompleteMessage ?? 'unknown error'}`);\n }\n\n const version = await md.GetEntityObject<MJArtifactVersionEntity>('MJ: Artifact Versions', currentUser);\n version.ArtifactID = artifact.ID;\n version.VersionNumber = 1;\n version.Content = JSON.stringify(snapshot);\n version.UserID = currentUser.ID;\n version.Name = title;\n if (!(await version.Save())) {\n throw new Error(`Failed to save artifact version: ${version.LatestResult?.CompleteMessage ?? 'unknown error'}`);\n }\n\n return {\n artifactId: artifact.ID,\n artifactVersionId: version.ID,\n title,\n };\n }\n\n /**\n * Create a new analysis conversation seeded with the captured snapshot.\n * Performs six sequential saves; throws with the underlying entity error\n * message on any failure.\n */\n async StartAnalysisConversation(args: StartAnalysisConversationArgs): Promise<AnalyzeArtifactResult> {\n const { snapshot, currentUser, environmentId } = args;\n const title = args.title || snapshot.title || 'Untitled Snapshot';\n const initialMessage = args.initialMessage || `Analyze \"${title}\"`;\n\n // Steps 1-3: Create the Data Snapshot artifact + version (shared with CreateSnapshotArtifact)\n const { artifactId, artifactVersionId } = await this.CreateSnapshotArtifact({\n snapshot,\n currentUser,\n environmentId,\n title,\n });\n\n const md = new Metadata();\n\n // 4. Create the conversation\n const conversation = await md.GetEntityObject<MJConversationEntity>('MJ: Conversations', currentUser);\n conversation.Name = `Analyze: ${title}`;\n conversation.UserID = currentUser.ID;\n conversation.EnvironmentID = environmentId;\n if (!(await conversation.Save())) {\n throw new Error(`Failed to save conversation: ${conversation.LatestResult?.CompleteMessage ?? 'unknown error'}`);\n }\n\n // 5. Seed the initial user message\n const detail = await md.GetEntityObject<MJConversationDetailEntity>('MJ: Conversation Details', currentUser);\n detail.ConversationID = conversation.ID;\n detail.Role = 'User';\n detail.Message = initialMessage;\n if (!(await detail.Save())) {\n throw new Error(`Failed to save conversation detail: ${detail.LatestResult?.CompleteMessage ?? 'unknown error'}`);\n }\n\n // 6. Link the snapshot as an input artifact on that message\n const junction = await md.GetEntityObject<MJConversationDetailArtifactEntity>('MJ: Conversation Detail Artifacts', currentUser);\n junction.ConversationDetailID = detail.ID;\n junction.ArtifactVersionID = artifactVersionId;\n junction.Direction = 'Input';\n if (!(await junction.Save())) {\n throw new Error(`Failed to link artifact to conversation: ${junction.LatestResult?.CompleteMessage ?? 'unknown error'}`);\n }\n\n LogStatus(\n `[AnalyzeArtifactService] Created conversation ${conversation.ID} with input artifact ${artifactId} v1`,\n );\n\n return {\n conversationId: conversation.ID,\n conversationDetailId: detail.ID,\n artifactId,\n artifactVersionId,\n };\n }\n}\n"]}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Pure helper functions for creating DataSnapshots from artifact content.
3
+ *
4
+ * These are extracted from Angular viewer components so the logic can be
5
+ * unit-tested without Angular TestBed. Each viewer plugin delegates to
6
+ * the corresponding function here.
7
+ */
8
+ import { DataSnapshot, DataTable } from '@memberjunction/core';
9
+ /**
10
+ * Shape of a DataArtifactSpec that the data viewer works with.
11
+ * Only the fields relevant to snapshot creation are required.
12
+ */
13
+ interface DataArtifactSpecLike {
14
+ title?: string;
15
+ columns?: {
16
+ field: string;
17
+ headerName?: string;
18
+ sqlBaseType?: string;
19
+ }[];
20
+ rows?: Record<string, unknown>[];
21
+ }
22
+ /**
23
+ * Create a DataSnapshot from JSON artifact content.
24
+ * Parses the JSON, counts top-level keys, and stores the parsed value in custom.
25
+ */
26
+ export declare function createJsonSnapshot(content: string | null, title: string | null): DataSnapshot | null;
27
+ /**
28
+ * Create a DataSnapshot from code artifact content.
29
+ * Counts lines and stores content plus lineCount in custom.
30
+ */
31
+ export declare function createCodeSnapshot(content: string | null, title: string | null): DataSnapshot | null;
32
+ /**
33
+ * Create a DataSnapshot from markdown artifact content.
34
+ * Stores the raw content in custom.
35
+ */
36
+ export declare function createMarkdownSnapshot(content: string | null, title: string | null): DataSnapshot | null;
37
+ /**
38
+ * Create a DataSnapshot from a DataArtifactSpec (data viewer).
39
+ * Uses NormalizeToTables to convert the spec into a tabular snapshot.
40
+ */
41
+ /**
42
+ * Build a combined SQL string from multiple tables, each with a header comment.
43
+ * Returns null if no tables have SQL.
44
+ */
45
+ export declare function buildMultiTableSql(tables: DataTable[]): string | null;
46
+ export declare function createDataSnapshot(spec: DataArtifactSpecLike | null): DataSnapshot | null;
47
+ export {};
48
+ //# sourceMappingURL=snapshot-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot-helpers.d.ts","sourceRoot":"","sources":["../../src/lib/snapshot-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAqB,MAAM,sBAAsB,CAAC;AAElF;;;GAGG;AACH,UAAU,oBAAoB;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,YAAY,GAAG,IAAI,CAcpG;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,YAAY,GAAG,IAAI,CAQpG;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,YAAY,GAAG,IAAI,CAMxG;AAED;;;GAGG;AACH;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,GAAG,IAAI,CAMrE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI,GAAG,YAAY,GAAG,IAAI,CAKzF"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Pure helper functions for creating DataSnapshots from artifact content.
3
+ *
4
+ * These are extracted from Angular viewer components so the logic can be
5
+ * unit-tested without Angular TestBed. Each viewer plugin delegates to
6
+ * the corresponding function here.
7
+ */
8
+ import { DataSnapshot, NormalizeToTables } from '@memberjunction/core';
9
+ /**
10
+ * Create a DataSnapshot from JSON artifact content.
11
+ * Parses the JSON, counts top-level keys, and stores the parsed value in custom.
12
+ */
13
+ export function createJsonSnapshot(content, title) {
14
+ if (!content)
15
+ return null;
16
+ try {
17
+ const parsed = JSON.parse(content);
18
+ const snap = new DataSnapshot();
19
+ snap.title = title ?? undefined;
20
+ if (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)) {
21
+ snap.interpretation = `JSON artifact with ${Object.keys(parsed).length} top-level keys.`;
22
+ }
23
+ snap.custom = parsed;
24
+ return snap;
25
+ }
26
+ catch {
27
+ return null;
28
+ }
29
+ }
30
+ /**
31
+ * Create a DataSnapshot from code artifact content.
32
+ * Counts lines and stores content plus lineCount in custom.
33
+ */
34
+ export function createCodeSnapshot(content, title) {
35
+ if (!content)
36
+ return null;
37
+ const lineCount = content.split('\n').length;
38
+ const snap = new DataSnapshot();
39
+ snap.title = title ?? undefined;
40
+ snap.interpretation = `Code artifact, ${lineCount} lines.`;
41
+ snap.custom = { content, lineCount };
42
+ return snap;
43
+ }
44
+ /**
45
+ * Create a DataSnapshot from markdown artifact content.
46
+ * Stores the raw content in custom.
47
+ */
48
+ export function createMarkdownSnapshot(content, title) {
49
+ if (!content)
50
+ return null;
51
+ const snap = new DataSnapshot();
52
+ snap.title = title ?? undefined;
53
+ snap.custom = { content };
54
+ return snap;
55
+ }
56
+ /**
57
+ * Create a DataSnapshot from a DataArtifactSpec (data viewer).
58
+ * Uses NormalizeToTables to convert the spec into a tabular snapshot.
59
+ */
60
+ /**
61
+ * Build a combined SQL string from multiple tables, each with a header comment.
62
+ * Returns null if no tables have SQL.
63
+ */
64
+ export function buildMultiTableSql(tables) {
65
+ const sqlTables = tables.filter(t => t.metadata?.sql);
66
+ if (sqlTables.length === 0)
67
+ return null;
68
+ return sqlTables
69
+ .map(t => `-- ═══ ${t.name} ═══\n${t.metadata.sql}`)
70
+ .join('\n\n');
71
+ }
72
+ export function createDataSnapshot(spec) {
73
+ if (!spec)
74
+ return null;
75
+ const tableName = spec.title || 'Results';
76
+ const tables = NormalizeToTables(spec, tableName);
77
+ return DataSnapshot.FromTables(tables, spec.title);
78
+ }
79
+ //# sourceMappingURL=snapshot-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot-helpers.js","sourceRoot":"","sources":["../../src/lib/snapshot-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,YAAY,EAAa,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAYlF;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAsB,EAAE,KAAoB;IAC7E,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAA4B,CAAC;QAC9D,MAAM,IAAI,GAAG,IAAI,YAAY,EAAE,CAAC;QAChC,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,SAAS,CAAC;QAChC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC5E,IAAI,CAAC,cAAc,GAAG,sBAAsB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,kBAAkB,CAAC;QAC3F,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,MAAiC,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;I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B,CAAC,IAAiC;IAClE,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,IAAI,SAAS,CAAC;IAC1C,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAA+B,EAAE,SAAS,CAAC,CAAC;IAC7E,OAAO,YAAY,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;AACrD,CAAC","sourcesContent":["/**\n * Pure helper functions for creating DataSnapshots from artifact content.\n *\n * These are extracted from Angular viewer components so the logic can be\n * unit-tested without Angular TestBed. Each viewer plugin delegates to\n * the corresponding function here.\n */\nimport { DataSnapshot, DataTable, NormalizeToTables } from '@memberjunction/core';\n\n/**\n * Shape of a DataArtifactSpec that the data viewer works with.\n * Only the fields relevant to snapshot creation are required.\n */\ninterface DataArtifactSpecLike {\n title?: string;\n columns?: { field: string; headerName?: string; sqlBaseType?: string }[];\n rows?: Record<string, unknown>[];\n}\n\n/**\n * Create a DataSnapshot from JSON artifact content.\n * Parses the JSON, counts top-level keys, and stores the parsed value in custom.\n */\nexport function createJsonSnapshot(content: string | null, title: string | null): DataSnapshot | null {\n if (!content) return null;\n try {\n const parsed = JSON.parse(content) as Record<string, unknown>;\n const snap = new DataSnapshot();\n snap.title = title ?? undefined;\n if (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)) {\n snap.interpretation = `JSON artifact with ${Object.keys(parsed).length} top-level keys.`;\n }\n snap.custom = parsed as Record<string, unknown>;\n return snap;\n } catch {\n return null;\n }\n}\n\n/**\n * Create a DataSnapshot from code artifact content.\n * Counts lines and stores content plus lineCount in custom.\n */\nexport function createCodeSnapshot(content: string | null, title: string | null): DataSnapshot | null {\n if (!content) return null;\n const lineCount = content.split('\\n').length;\n const snap = new DataSnapshot();\n snap.title = title ?? undefined;\n snap.interpretation = `Code artifact, ${lineCount} lines.`;\n snap.custom = { content, lineCount };\n return snap;\n}\n\n/**\n * Create a DataSnapshot from markdown artifact content.\n * Stores the raw content in custom.\n */\nexport function createMarkdownSnapshot(content: string | null, title: string | null): DataSnapshot | null {\n if (!content) return null;\n const snap = new DataSnapshot();\n snap.title = title ?? undefined;\n snap.custom = { content };\n return snap;\n}\n\n/**\n * Create a DataSnapshot from a DataArtifactSpec (data viewer).\n * Uses NormalizeToTables to convert the spec into a tabular snapshot.\n */\n/**\n * Build a combined SQL string from multiple tables, each with a header comment.\n * Returns null if no tables have SQL.\n */\nexport function buildMultiTableSql(tables: DataTable[]): string | null {\n const sqlTables = tables.filter(t => t.metadata?.sql);\n if (sqlTables.length === 0) return null;\n return sqlTables\n .map(t => `-- ═══ ${t.name} ═══\\n${t.metadata!.sql!}`)\n .join('\\n\\n');\n}\n\nexport function createDataSnapshot(spec: DataArtifactSpecLike | null): DataSnapshot | null {\n if (!spec) return null;\n const tableName = spec.title || 'Results';\n const tables = NormalizeToTables(spec as Record<string, unknown>, tableName);\n return DataSnapshot.FromTables(tables, spec.title);\n}\n"]}
@@ -1,8 +1,10 @@
1
1
  export * from './lib/artifacts.module';
2
2
  export * from './lib/services/artifact-icon.service';
3
3
  export * from './lib/services/artifact-file.service';
4
+ export * from './lib/services/analyze-artifact.service';
4
5
  export * from './lib/interfaces/artifact-viewer-plugin.interface';
5
6
  export * from './lib/components/base-artifact-viewer.component';
7
+ export * from './lib/snapshot-helpers';
6
8
  export * from './lib/components/artifact-type-plugin-viewer.component';
7
9
  export * from './lib/components/artifact-viewer-panel.component';
8
10
  export * from './lib/components/artifact-version-history.component';
@@ -1 +1 @@
1
- {"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAKA,cAAc,wBAAwB,CAAC;AAGvC,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AAGrD,cAAc,mDAAmD,CAAC;AAGlE,cAAc,iDAAiD,CAAC;AAGhE,cAAc,wDAAwD,CAAC;AAGvE,cAAc,kDAAkD,CAAC;AACjE,cAAc,qDAAqD,CAAC;AACpE,cAAc,kDAAkD,CAAC;AAGjE,cAAc,yDAAyD,CAAC;AACxE,cAAc,yDAAyD,CAAC;AACxE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,yDAAyD,CAAC;AACxE,cAAc,wDAAwD,CAAC;AACvE,cAAc,8DAA8D,CAAC;AAC7E,cAAc,yDAAyD,CAAC;AACxE,cAAc,sFAAsF,CAAC;AAGrG,cAAc,kDAAkD,CAAC;AACjE,cAAc,wDAAwD,CAAC;AACvE,cAAc,yDAAyD,CAAC;AACxE,cAAc,yDAAyD,CAAC"}
1
+ {"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAKA,cAAc,wBAAwB,CAAC;AAGvC,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,yCAAyC,CAAC;AAGxD,cAAc,mDAAmD,CAAC;AAGlE,cAAc,iDAAiD,CAAC;AAGhE,cAAc,wBAAwB,CAAC;AAGvC,cAAc,wDAAwD,CAAC;AAGvE,cAAc,kDAAkD,CAAC;AACjE,cAAc,qDAAqD,CAAC;AACpE,cAAc,kDAAkD,CAAC;AAGjE,cAAc,yDAAyD,CAAC;AACxE,cAAc,yDAAyD,CAAC;AACxE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,yDAAyD,CAAC;AACxE,cAAc,wDAAwD,CAAC;AACvE,cAAc,8DAA8D,CAAC;AAC7E,cAAc,yDAAyD,CAAC;AACxE,cAAc,sFAAsF,CAAC;AAGrG,cAAc,kDAAkD,CAAC;AACjE,cAAc,wDAAwD,CAAC;AACvE,cAAc,yDAAyD,CAAC;AACxE,cAAc,yDAAyD,CAAC"}
@@ -6,10 +6,13 @@ export * from './lib/artifacts.module';
6
6
  // Services
7
7
  export * from './lib/services/artifact-icon.service';
8
8
  export * from './lib/services/artifact-file.service';
9
+ export * from './lib/services/analyze-artifact.service';
9
10
  // Interfaces
10
11
  export * from './lib/interfaces/artifact-viewer-plugin.interface';
11
12
  // Base component
12
13
  export * from './lib/components/base-artifact-viewer.component';
14
+ // Snapshot helpers (pure functions for creating DataSnapshots from artifact content)
15
+ export * from './lib/snapshot-helpers';
13
16
  // Artifact type plugin viewer (loads appropriate plugin based on DriverClass)
14
17
  export * from './lib/components/artifact-type-plugin-viewer.component';
15
18
  // Artifact viewer UI components
@@ -1 +1 @@
1
- {"version":3,"file":"public-api.js","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,SAAS;AACT,cAAc,wBAAwB,CAAC;AAEvC,WAAW;AACX,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AAErD,aAAa;AACb,cAAc,mDAAmD,CAAC;AAElE,iBAAiB;AACjB,cAAc,iDAAiD,CAAC;AAEhE,8EAA8E;AAC9E,cAAc,wDAAwD,CAAC;AAEvE,gCAAgC;AAChC,cAAc,kDAAkD,CAAC;AACjE,cAAc,qDAAqD,CAAC;AACpE,cAAc,kDAAkD,CAAC;AAEjE,oBAAoB;AACpB,cAAc,yDAAyD,CAAC;AACxE,cAAc,yDAAyD,CAAC;AACxE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,yDAAyD,CAAC;AACxE,cAAc,wDAAwD,CAAC;AACvE,cAAc,8DAA8D,CAAC;AAC7E,cAAc,yDAAyD,CAAC;AACxE,cAAc,sFAAsF,CAAC;AAErG,kCAAkC;AAClC,cAAc,kDAAkD,CAAC;AACjE,cAAc,wDAAwD,CAAC;AACvE,cAAc,yDAAyD,CAAC;AACxE,cAAc,yDAAyD,CAAC","sourcesContent":["/*\n * Public API Surface of @memberjunction/ng-artifacts\n */\n\n// Module\nexport * from './lib/artifacts.module';\n\n// Services\nexport * from './lib/services/artifact-icon.service';\nexport * from './lib/services/artifact-file.service';\n\n// Interfaces\nexport * from './lib/interfaces/artifact-viewer-plugin.interface';\n\n// Base component\nexport * from './lib/components/base-artifact-viewer.component';\n\n// Artifact type plugin viewer (loads appropriate plugin based on DriverClass)\nexport * from './lib/components/artifact-type-plugin-viewer.component';\n\n// Artifact viewer UI components\nexport * from './lib/components/artifact-viewer-panel.component';\nexport * from './lib/components/artifact-version-history.component';\nexport * from './lib/components/artifact-message-card.component';\n\n// Plugin components\nexport * from './lib/components/plugins/json-artifact-viewer.component';\nexport * from './lib/components/plugins/code-artifact-viewer.component';\nexport * from './lib/components/plugins/markdown-artifact-viewer.component';\nexport * from './lib/components/plugins/html-artifact-viewer.component';\nexport * from './lib/components/plugins/svg-artifact-viewer.component';\nexport * from './lib/components/plugins/component-artifact-viewer.component';\nexport * from './lib/components/plugins/data-artifact-viewer.component';\nexport * from './lib/components/plugins/component-feedback-panel/component-feedback-panel.component';\n\n// File viewer toolbar and plugins\nexport * from './lib/components/file-artifact-toolbar.component';\nexport * from './lib/components/plugins/pdf-artifact-viewer.component';\nexport * from './lib/components/plugins/xlsx-artifact-viewer.component';\nexport * from './lib/components/plugins/docx-artifact-viewer.component';\n"]}
1
+ {"version":3,"file":"public-api.js","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,SAAS;AACT,cAAc,wBAAwB,CAAC;AAEvC,WAAW;AACX,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,yCAAyC,CAAC;AAExD,aAAa;AACb,cAAc,mDAAmD,CAAC;AAElE,iBAAiB;AACjB,cAAc,iDAAiD,CAAC;AAEhE,qFAAqF;AACrF,cAAc,wBAAwB,CAAC;AAEvC,8EAA8E;AAC9E,cAAc,wDAAwD,CAAC;AAEvE,gCAAgC;AAChC,cAAc,kDAAkD,CAAC;AACjE,cAAc,qDAAqD,CAAC;AACpE,cAAc,kDAAkD,CAAC;AAEjE,oBAAoB;AACpB,cAAc,yDAAyD,CAAC;AACxE,cAAc,yDAAyD,CAAC;AACxE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,yDAAyD,CAAC;AACxE,cAAc,wDAAwD,CAAC;AACvE,cAAc,8DAA8D,CAAC;AAC7E,cAAc,yDAAyD,CAAC;AACxE,cAAc,sFAAsF,CAAC;AAErG,kCAAkC;AAClC,cAAc,kDAAkD,CAAC;AACjE,cAAc,wDAAwD,CAAC;AACvE,cAAc,yDAAyD,CAAC;AACxE,cAAc,yDAAyD,CAAC","sourcesContent":["/*\n * Public API Surface of @memberjunction/ng-artifacts\n */\n\n// Module\nexport * from './lib/artifacts.module';\n\n// Services\nexport * from './lib/services/artifact-icon.service';\nexport * from './lib/services/artifact-file.service';\nexport * from './lib/services/analyze-artifact.service';\n\n// Interfaces\nexport * from './lib/interfaces/artifact-viewer-plugin.interface';\n\n// Base component\nexport * from './lib/components/base-artifact-viewer.component';\n\n// Snapshot helpers (pure functions for creating DataSnapshots from artifact content)\nexport * from './lib/snapshot-helpers';\n\n// Artifact type plugin viewer (loads appropriate plugin based on DriverClass)\nexport * from './lib/components/artifact-type-plugin-viewer.component';\n\n// Artifact viewer UI components\nexport * from './lib/components/artifact-viewer-panel.component';\nexport * from './lib/components/artifact-version-history.component';\nexport * from './lib/components/artifact-message-card.component';\n\n// Plugin components\nexport * from './lib/components/plugins/json-artifact-viewer.component';\nexport * from './lib/components/plugins/code-artifact-viewer.component';\nexport * from './lib/components/plugins/markdown-artifact-viewer.component';\nexport * from './lib/components/plugins/html-artifact-viewer.component';\nexport * from './lib/components/plugins/svg-artifact-viewer.component';\nexport * from './lib/components/plugins/component-artifact-viewer.component';\nexport * from './lib/components/plugins/data-artifact-viewer.component';\nexport * from './lib/components/plugins/component-feedback-panel/component-feedback-panel.component';\n\n// File viewer toolbar and plugins\nexport * from './lib/components/file-artifact-toolbar.component';\nexport * from './lib/components/plugins/pdf-artifact-viewer.component';\nexport * from './lib/components/plugins/xlsx-artifact-viewer.component';\nexport * from './lib/components/plugins/docx-artifact-viewer.component';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-artifacts",
3
- "version": "5.28.0",
3
+ "version": "5.30.0",
4
4
  "description": "MemberJunction: Artifact viewer plugin system for rendering different artifact types (JSON, Code, Markdown, HTML, SVG, Components)",
5
5
  "main": "./dist/public-api.js",
6
6
  "typings": "./dist/public-api.d.ts",
@@ -32,21 +32,21 @@
32
32
  "dependencies": {
33
33
  "@angular/cdk": "21.1.3",
34
34
  "@angular/forms": "21.1.3",
35
- "@memberjunction/core": "5.28.0",
36
- "@memberjunction/core-entities": "5.28.0",
37
- "@memberjunction/global": "5.28.0",
38
- "@memberjunction/interactive-component-types": "5.28.0",
39
- "@memberjunction/ng-base-types": "5.28.0",
40
- "@memberjunction/ng-code-editor": "5.28.0",
41
- "@memberjunction/ng-notifications": "5.28.0",
42
- "@memberjunction/ng-react": "5.28.0",
43
- "@memberjunction/ng-pagination": "5.28.0",
44
- "@memberjunction/ng-shared-generic": "5.28.0",
45
- "@memberjunction/ng-query-viewer": "5.28.0",
46
- "@memberjunction/ng-trees": "5.28.0",
47
- "@memberjunction/ng-export-service": "5.28.0",
48
- "@memberjunction/ng-markdown": "5.28.0",
49
- "@memberjunction/graphql-dataprovider": "5.28.0",
35
+ "@memberjunction/core": "5.30.0",
36
+ "@memberjunction/core-entities": "5.30.0",
37
+ "@memberjunction/global": "5.30.0",
38
+ "@memberjunction/interactive-component-types": "5.30.0",
39
+ "@memberjunction/ng-base-types": "5.30.0",
40
+ "@memberjunction/ng-code-editor": "5.30.0",
41
+ "@memberjunction/ng-notifications": "5.30.0",
42
+ "@memberjunction/ng-react": "5.30.0",
43
+ "@memberjunction/ng-pagination": "5.30.0",
44
+ "@memberjunction/ng-shared-generic": "5.30.0",
45
+ "@memberjunction/ng-query-viewer": "5.30.0",
46
+ "@memberjunction/ng-trees": "5.30.0",
47
+ "@memberjunction/ng-export-service": "5.30.0",
48
+ "@memberjunction/ng-markdown": "5.30.0",
49
+ "@memberjunction/graphql-dataprovider": "5.30.0",
50
50
  "mammoth": "^1.8.0",
51
51
  "pdfjs-dist": "^4.10.38",
52
52
  "rxjs": "^7.8.2",