@memberjunction/ng-conversations 6.3.0-edge.0 → 6.3.0-edge.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -22
- package/dist/assets/edge-ai.worker.js +32515 -0
- package/dist/lib/components/artifact/artifact-share-modal.component.d.ts +39 -6
- package/dist/lib/components/artifact/artifact-share-modal.component.d.ts.map +1 -1
- package/dist/lib/components/artifact/artifact-share-modal.component.js +620 -74
- package/dist/lib/components/artifact/artifact-share-modal.component.js.map +1 -1
- package/dist/lib/components/collection/collection-tree.component.d.ts.map +1 -1
- package/dist/lib/components/collection/collection-tree.component.js +19 -18
- package/dist/lib/components/collection/collection-tree.component.js.map +1 -1
- package/dist/lib/components/collection/collection-view.component.d.ts +6 -4
- package/dist/lib/components/collection/collection-view.component.d.ts.map +1 -1
- package/dist/lib/components/collection/collection-view.component.js +35 -17
- package/dist/lib/components/collection/collection-view.component.js.map +1 -1
- package/dist/lib/components/collection/collections-full-view.component.d.ts +1 -0
- package/dist/lib/components/collection/collections-full-view.component.d.ts.map +1 -1
- package/dist/lib/components/collection/collections-full-view.component.js +108 -106
- package/dist/lib/components/collection/collections-full-view.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts +36 -10
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.js +101 -37
- package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-list.component.d.ts +14 -0
- package/dist/lib/components/conversation/conversation-list.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-list.component.js +93 -42
- package/dist/lib/components/conversation/conversation-list.component.js.map +1 -1
- package/dist/lib/components/export/export-modal.component.d.ts +7 -2
- package/dist/lib/components/export/export-modal.component.d.ts.map +1 -1
- package/dist/lib/components/export/export-modal.component.js +13 -2
- package/dist/lib/components/export/export-modal.component.js.map +1 -1
- package/dist/lib/components/library/library-create-dialog.component.d.ts +136 -0
- package/dist/lib/components/library/library-create-dialog.component.d.ts.map +1 -0
- package/dist/lib/components/library/library-create-dialog.component.js +1620 -0
- package/dist/lib/components/library/library-create-dialog.component.js.map +1 -0
- package/dist/lib/components/library/library-full-view.component.d.ts +10 -4
- package/dist/lib/components/library/library-full-view.component.d.ts.map +1 -1
- package/dist/lib/components/library/library-full-view.component.js +216 -40
- package/dist/lib/components/library/library-full-view.component.js.map +1 -1
- package/dist/lib/components/library/library-remote-drive-pane.component.d.ts +97 -0
- package/dist/lib/components/library/library-remote-drive-pane.component.d.ts.map +1 -0
- package/dist/lib/components/library/library-remote-drive-pane.component.js +1229 -0
- package/dist/lib/components/library/library-remote-drive-pane.component.js.map +1 -0
- package/dist/lib/components/library/library-workspace.component.d.ts +265 -0
- package/dist/lib/components/library/library-workspace.component.d.ts.map +1 -0
- package/dist/lib/components/library/library-workspace.component.js +4420 -0
- package/dist/lib/components/library/library-workspace.component.js.map +1 -0
- package/dist/lib/components/library/library.models.d.ts +162 -0
- package/dist/lib/components/library/library.models.d.ts.map +1 -0
- package/dist/lib/components/library/library.models.js +2 -0
- package/dist/lib/components/library/library.models.js.map +1 -0
- package/dist/lib/components/message/conversation-message-rating.component.d.ts +5 -0
- package/dist/lib/components/message/conversation-message-rating.component.d.ts.map +1 -1
- package/dist/lib/components/message/conversation-message-rating.component.js +72 -16
- package/dist/lib/components/message/conversation-message-rating.component.js.map +1 -1
- package/dist/lib/components/message/message-input.component.d.ts +26 -14
- package/dist/lib/components/message/message-input.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-input.component.js +91 -56
- package/dist/lib/components/message/message-input.component.js.map +1 -1
- package/dist/lib/components/message/message-item.component.d.ts +35 -1
- package/dist/lib/components/message/message-item.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-item.component.js +583 -392
- package/dist/lib/components/message/message-item.component.js.map +1 -1
- package/dist/lib/components/message/message-list.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-list.component.js +2 -0
- package/dist/lib/components/message/message-list.component.js.map +1 -1
- package/dist/lib/components/navigation/conversation-navigation.component.js +9 -9
- package/dist/lib/components/navigation/conversation-navigation.component.js.map +1 -1
- package/dist/lib/components/overlay/chat-overlay.component.d.ts +94 -6
- package/dist/lib/components/overlay/chat-overlay.component.d.ts.map +1 -1
- package/dist/lib/components/overlay/chat-overlay.component.js +249 -59
- package/dist/lib/components/overlay/chat-overlay.component.js.map +1 -1
- package/dist/lib/components/project/project-form-modal.component.d.ts +6 -0
- package/dist/lib/components/project/project-form-modal.component.d.ts.map +1 -1
- package/dist/lib/components/project/project-form-modal.component.js +81 -61
- package/dist/lib/components/project/project-form-modal.component.js.map +1 -1
- package/dist/lib/components/project/project-selector.component.d.ts +5 -0
- package/dist/lib/components/project/project-selector.component.d.ts.map +1 -1
- package/dist/lib/components/project/project-selector.component.js +11 -4
- package/dist/lib/components/project/project-selector.component.js.map +1 -1
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.d.ts +55 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.d.ts.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.js +944 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.js.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-engine.d.ts +66 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-engine.d.ts.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-engine.js +253 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-engine.js.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-types.d.ts +80 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-types.d.ts.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-types.js +49 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-types.js.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/realtime-artifact-workspace-surface.component.d.ts +54 -0
- package/dist/lib/components/realtime/artifact-workspace/realtime-artifact-workspace-surface.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/realtime-artifact-workspace-surface.component.js +386 -0
- package/dist/lib/components/realtime/artifact-workspace/realtime-artifact-workspace-surface.component.js.map +1 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.d.ts +1 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.js +15 -2
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.js.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-banner.component.js +2 -2
- package/dist/lib/components/realtime/realtime-agent-banner.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-picker.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-picker.component.js +3 -3
- package/dist/lib/components/realtime/realtime-agent-picker.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-composer.component.js +5 -3
- package/dist/lib/components/realtime/realtime-composer.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts +81 -32
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-overlay.component.js +506 -185
- package/dist/lib/components/realtime/realtime-session-overlay.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-session-thread.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-thread.component.js +89 -4
- package/dist/lib/components/realtime/realtime-session-thread.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-stage.model.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-stage.model.js +2 -1
- package/dist/lib/components/realtime/realtime-surface-stage.model.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tab-style.d.ts +4 -4
- package/dist/lib/components/realtime/realtime-surface-tab-style.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tab-style.js +5 -5
- package/dist/lib/components/realtime/realtime-surface-tab-style.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts +7 -9
- package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.model.js +12 -13
- package/dist/lib/components/realtime/realtime-surface-tabs.model.js.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts +27 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js +141 -2
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts +101 -3
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js +503 -55
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.d.ts +48 -5
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.js +249 -53
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.js.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js.map +1 -1
- package/dist/lib/components/search/search-panel.component.d.ts +10 -0
- package/dist/lib/components/search/search-panel.component.d.ts.map +1 -1
- package/dist/lib/components/search/search-panel.component.js +25 -3
- package/dist/lib/components/search/search-panel.component.js.map +1 -1
- package/dist/lib/components/task/tasks-full-view.component.d.ts +31 -8
- package/dist/lib/components/task/tasks-full-view.component.d.ts.map +1 -1
- package/dist/lib/components/task/tasks-full-view.component.js +692 -497
- package/dist/lib/components/task/tasks-full-view.component.js.map +1 -1
- package/dist/lib/components/workspace/conversation-workspace.component.d.ts.map +1 -1
- package/dist/lib/components/workspace/conversation-workspace.component.js +15 -2
- package/dist/lib/components/workspace/conversation-workspace.component.js.map +1 -1
- package/dist/lib/conversations.module.d.ts +66 -61
- package/dist/lib/conversations.module.d.ts.map +1 -1
- package/dist/lib/conversations.module.js +60 -1
- package/dist/lib/conversations.module.js.map +1 -1
- package/dist/lib/models/agent-turn.model.d.ts +7 -1
- package/dist/lib/models/agent-turn.model.d.ts.map +1 -1
- package/dist/lib/models/agent-turn.model.js.map +1 -1
- package/dist/lib/services/agent-state.service.d.ts.map +1 -1
- package/dist/lib/services/agent-state.service.js +14 -3
- package/dist/lib/services/agent-state.service.js.map +1 -1
- package/dist/lib/services/artifact-permission.service.d.ts.map +1 -1
- package/dist/lib/services/artifact-permission.service.js +14 -3
- package/dist/lib/services/artifact-permission.service.js.map +1 -1
- package/dist/lib/services/artifact-state.service.d.ts.map +1 -1
- package/dist/lib/services/artifact-state.service.js +43 -11
- package/dist/lib/services/artifact-state.service.js.map +1 -1
- package/dist/lib/services/conversation-agent.service.d.ts +8 -3
- package/dist/lib/services/conversation-agent.service.d.ts.map +1 -1
- package/dist/lib/services/conversation-agent.service.js +9 -3
- package/dist/lib/services/conversation-agent.service.js.map +1 -1
- package/dist/lib/services/conversation-tasks-filter.d.ts +59 -2
- package/dist/lib/services/conversation-tasks-filter.d.ts.map +1 -1
- package/dist/lib/services/conversation-tasks-filter.js +222 -18
- package/dist/lib/services/conversation-tasks-filter.js.map +1 -1
- package/dist/lib/services/edge-ai/edge-agent-pre-discovery.service.d.ts +85 -0
- package/dist/lib/services/edge-ai/edge-agent-pre-discovery.service.d.ts.map +1 -0
- package/dist/lib/services/edge-ai/edge-agent-pre-discovery.service.js +257 -0
- package/dist/lib/services/edge-ai/edge-agent-pre-discovery.service.js.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai-protocol.d.ts +85 -0
- package/dist/lib/services/edge-ai/edge-ai-protocol.d.ts.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai-protocol.js +10 -0
- package/dist/lib/services/edge-ai/edge-ai-protocol.js.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai-worker-host.d.ts +90 -0
- package/dist/lib/services/edge-ai/edge-ai-worker-host.d.ts.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai-worker-host.js +386 -0
- package/dist/lib/services/edge-ai/edge-ai-worker-host.js.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai.worker.d.ts +13 -0
- package/dist/lib/services/edge-ai/edge-ai.worker.d.ts.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai.worker.js +201 -0
- package/dist/lib/services/edge-ai/edge-ai.worker.js.map +1 -0
- package/dist/lib/services/export.service.d.ts +64 -0
- package/dist/lib/services/export.service.d.ts.map +1 -1
- package/dist/lib/services/export.service.js +185 -6
- package/dist/lib/services/export.service.js.map +1 -1
- package/dist/lib/services/library-creation.service.d.ts +304 -0
- package/dist/lib/services/library-creation.service.d.ts.map +1 -0
- package/dist/lib/services/library-creation.service.js +1244 -0
- package/dist/lib/services/library-creation.service.js.map +1 -0
- package/dist/lib/services/realtime-pairing.d.ts +3 -3
- package/dist/lib/services/realtime-pairing.js +4 -4
- package/dist/lib/services/realtime-pairing.js.map +1 -1
- package/dist/lib/services/realtime-session-review.service.d.ts +14 -0
- package/dist/lib/services/realtime-session-review.service.d.ts.map +1 -1
- package/dist/lib/services/realtime-session-review.service.js +46 -4
- package/dist/lib/services/realtime-session-review.service.js.map +1 -1
- package/dist/lib/services/search.service.d.ts +19 -2
- package/dist/lib/services/search.service.d.ts.map +1 -1
- package/dist/lib/services/search.service.js +99 -36
- package/dist/lib/services/search.service.js.map +1 -1
- package/dist/lib/utils/decision-routing.d.ts +5 -2
- package/dist/lib/utils/decision-routing.d.ts.map +1 -1
- package/dist/lib/utils/decision-routing.js +9 -4
- package/dist/lib/utils/decision-routing.js.map +1 -1
- package/dist/public-api.d.ts +13 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +15 -1
- package/dist/public-api.js.map +1 -1
- package/package.json +42 -37
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export.service.js","sourceRoot":"","sources":["../../../src/lib/services/export.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAuE,MAAM,+BAA+B,CAAC;AACxI,OAAO,EAAE,OAAO,EAAY,QAAQ,EAAqB,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;;AAsFpD;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAsB;IAC5D,cAAc;IACd,mBAAmB;IACnB,qBAAqB;IACrB,oBAAoB;IACpB,qBAAqB;IACrB,oBAAoB;IACpB,0BAA0B;IAC1B,sBAAsB;IACtB,kBAAkB;IAClB,gBAAgB;CACjB,CAAC;AA6BF,MAAM,OAAO,aAAa;IAChB,SAAS,GAA6B,IAAI,CAAC;IAEnD;;OAEG;IACH,IAAW,QAAQ,CAAC,KAA+B;QAC/C,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,IAAI,QAAQ,CAAC,QAAQ,CAAC;IAC/C,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,kBAAkB,CACtB,cAAsB,EACtB,KAAwB,EACxB,MAAoB,EACpB,WAAqB,EACrB,UAAyB,EAAE;QAE3B,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,cAAc,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;QACzF,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,kBAA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EAAE,CAAC;IACpE,CAAC;IAEO,UAAU,CAAC,IAAY;QAC7B,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC1C,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC;QACvB,OAAO,GAAG,CAAC,SAAS,CAAC;IACvB,CAAC;IAED,kFAAkF;IAC1E,UAAU,CAAC,IAAY;QAC7B,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACvD,CAAC;IAEO,YAAY;QAClB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;uGA7kBU,aAAa;gEAAb,aAAa,WAAb,aAAa,mBAFZ,MAAM;;iFAEP,aAAa;cAHzB,UAAU;eAAC;gBACV,UAAU,EAAE,MAAM;aACnB","sourcesContent":["import { Injectable } from '@angular/core';\nimport { ConversationEngine, ConversationScope, MJConversationEntity, MJConversationDetailEntity } from '@memberjunction/core-entities';\nimport { RunView, UserInfo, Metadata, IMetadataProvider } from '@memberjunction/core';\nimport { UUIDsEqual } from '@memberjunction/global';\n\nexport type ExportFormat = 'json' | 'markdown' | 'html' | 'text';\n\n/**\n * Branding applied to exported files, across EVERY format. HTML gets the full\n * treatment (theme colors, an inlined logo, the title, and a trademark footer);\n * JSON/markdown/text carry the title and trademark (markdown also references the\n * logo). Hosts supply this via `mj-conversation-chat-area`'s `exportBranding`\n * input. Color theming (`brandTokens`) is HTML-only — it has no meaning in the\n * data/plain-text formats.\n */\nexport interface ExportBranding {\n /**\n * CSS custom-property snapshot emitted as a `:root{}` block in the exported\n * document, so the export's stylesheet (which reads `var(--mj-…, fallback)`)\n * renders in the app's theme. HTML export only. Keys must be valid\n * custom-property names (`--like-this`). Entries are DROPPED when the key is\n * invalid or the value carries declaration-escape / network-call characters\n * (`<>{};@\\`, `url(`, `expression(`) — plain colors, `var()`, and\n * `color-mix()` pass. When omitted and `ExportOptions.includeTheme` is true,\n * the current theme is auto-snapshotted from `document.documentElement` (see\n * {@link DEFAULT_EXPORT_THEME_TOKENS}).\n */\n brandTokens?: Record<string, string>;\n /**\n * Logo URL. In HTML it is fetched and inlined as a data URI (so the file stays\n * self-contained) and rendered above the title — requires\n * `ExportOptions.includeCSS`, since it needs its stylesheet rule. In markdown it is\n * referenced by URL. JSON carries it as a string; plain text omits it.\n *\n * If the fetch fails, or the response isn't `content-type: image/*`, the raw URL is\n * emitted instead — so the exported file will reach out to that URL when opened.\n * There is no size or timeout guard on the fetch: a very large logo inflates the\n * export.\n */\n logoUrl?: string;\n /** Overrides the exported document's title (defaults to the conversation name). */\n title?: string;\n /**\n * A short trademark / attribution line (e.g. `© 2026 Acme Association ·\n * Powered by Betty`) rendered at the FOOT of the exported document: a styled HTML\n * footer, a markdown/text trailer, and a field in the JSON `branding` block.\n *\n * In HTML it needs its stylesheet rule, so — like the logo — it is emitted only when\n * `ExportOptions.includeCSS` is true. The markdown/text/JSON trailers have no such\n * dependency and always emit.\n *\n * NOT escaped for markdown: a value containing `_`, `]`, `)`, or a newline can break\n * the surrounding markdown. Supply plain text (HTML and JSON are escaped).\n */\n trademark?: string;\n}\n\nexport interface ExportOptions {\n includeMessages?: boolean;\n includeMetadata?: boolean;\n prettyPrint?: boolean;\n includeCSS?: boolean;\n /**\n * Emit the current app theme into the HTML export. When true and\n * `branding.brandTokens` is absent, the {@link DEFAULT_EXPORT_THEME_TOKENS}\n * are auto-snapshotted from the live document at export time. Default false —\n * an unthemed export renders exactly as before (the stylesheet's `var()`\n * fallbacks carry the legacy palette).\n *\n * Gates only the TOKEN auto-snapshot: a supplied `branding`'s `logoUrl`,\n * `title`, and `trademark` apply whenever `branding` is present — in HTML AND\n * in the JSON/markdown/text formats. (The export modal passes `branding`\n * through only while its \"Include branding\" checkbox is on, so in the UI flow\n * everything travels together.)\n */\n includeTheme?: boolean;\n /**\n * Which theme mode the snapshot captures — NOT whichever mode the app happens to be\n * in when the user clicks Export. Defaults to `'light'`: an export taken during a\n * dark session would otherwise bake dark text onto the page's white background and\n * come out unreadable. `'dark'` pairs the dark palette with the dark\n * `--mj-bg-page` the body rule applies, so the file is coherent either way.\n * HTML only — the data formats carry no colors.\n */\n themeMode?: 'light' | 'dark';\n /** Branding (tokens / logo / title) applied to the export — see {@link ExportBranding}. */\n branding?: ExportBranding;\n}\n\n/**\n * Tokens captured by the theme auto-snapshot — exactly the custom properties the\n * HTML export's stylesheet consumes. Hosts wanting more control supply their own\n * map via {@link ExportBranding.brandTokens} instead.\n */\nexport const DEFAULT_EXPORT_THEME_TOKENS: readonly string[] = [\n '--mj-bg-page',\n '--mj-text-primary',\n '--mj-text-secondary',\n '--mj-text-disabled',\n '--mj-border-default',\n '--mj-brand-primary',\n '--mj-brand-accent-subtle',\n '--mj-bg-surface-card',\n '--mj-font-family',\n '--mj-radius-md',\n];\n\n/** The conversation and the messages one export writes. */\nexport interface ExportConversationData {\n conversation: MJConversationEntity;\n details: MJConversationDetailEntity[];\n /**\n * The fork the messages come from, as the header names it (its display name). Absent or null\n * in Main.\n */\n fork?: string | null;\n}\n\n/** Internal: options with defaults applied (branding stays optional). */\ntype ResolvedExportOptions = Required<Omit<ExportOptions, 'branding'>> & Pick<ExportOptions, 'branding'>;\n\n/** Internal: the theme pieces resolved once per HTML export. */\ninterface ResolvedExportTheme {\n /** `<style>:root{…}</style>` block (empty string when no tokens resolved). */\n rootBlock: string;\n /** Inlined logo (data URI, or the raw URL on fetch failure); null = no logo. */\n logoDataUri: string | null;\n /** Document-title override; null = use the conversation name. */\n title: string | null;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ExportService {\n private _provider: IMetadataProvider | null = null;\n\n /**\n * Set the metadata provider this service should use. When unset, falls back to Metadata.Provider.\n */\n public set Provider(value: IMetadataProvider | null) {\n this._provider = value;\n }\n\n public get Provider(): IMetadataProvider {\n return this._provider ?? Metadata.Provider;\n }\n\n /**\n * Exports the messages of one scope of a conversation (Main, or one fork's path) and\n * downloads the file. In a fork the export header names the fork.\n * @throws when the scope belongs to another conversation, or the conversation is not found.\n */\n async ExportConversation(\n conversationId: string,\n scope: ConversationScope,\n format: ExportFormat,\n currentUser: UserInfo,\n options: ExportOptions = {}\n ): Promise<void> {\n const conversation = await this.loadConversationData(conversationId, scope, currentUser);\n const { content, filename, mimeType } = await this.BuildExportContent(conversation, format, options);\n this.downloadFile(content, filename, mimeType);\n }\n\n /**\n * @deprecated Use {@link ExportConversation}. Without `scope`, exports Main.\n */\n async exportConversation(\n conversationId: string,\n format: ExportFormat,\n currentUser: UserInfo,\n options: ExportOptions = {},\n scope?: ConversationScope\n ): Promise<void> {\n const resolved = scope ?? ConversationEngine.TrunkScope(conversationId);\n return this.ExportConversation(conversationId, resolved, format, currentUser, options);\n }\n\n /**\n * Build the export document for already-loaded conversation data — the\n * download-free seam of {@link ExportConversation}. Async because HTML-format\n * branding may inline a logo. Exposed publicly so hosts (and tests) can build\n * export content without triggering a browser download.\n */\n public async BuildExportContent(\n data: ExportConversationData,\n format: ExportFormat,\n options: ExportOptions = {}\n ): Promise<{ content: string; filename: string; mimeType: string }> {\n const exportOptions: ResolvedExportOptions = {\n includeMessages: options.includeMessages ?? true,\n includeMetadata: options.includeMetadata ?? true,\n prettyPrint: options.prettyPrint ?? true,\n includeCSS: options.includeCSS ?? true,\n includeTheme: options.includeTheme ?? false,\n themeMode: options.themeMode ?? 'light',\n branding: options.branding\n };\n const baseName = `conversation-${data.conversation.Name}-${this.getTimestamp()}`;\n\n switch (format) {\n case 'json':\n return { content: this.exportAsJSON(data, exportOptions), filename: `${baseName}.json`, mimeType: 'application/json' };\n case 'markdown':\n return { content: this.exportAsMarkdown(data, exportOptions), filename: `${baseName}.md`, mimeType: 'text/markdown' };\n case 'html':\n return {\n content: this.exportAsHTML(data, exportOptions, await this.resolveTheme(exportOptions)),\n filename: `${baseName}.html`,\n mimeType: 'text/html'\n };\n case 'text':\n return { content: this.exportAsText(data, exportOptions), filename: `${baseName}.txt`, mimeType: 'text/plain' };\n default:\n throw new Error(`Unsupported export format: ${format}`);\n }\n }\n\n /**\n * Snapshot the given theme tokens from the live document. Empty/unset tokens are\n * skipped.\n *\n * `mode` captures a SPECIFIC palette rather than whatever the app is rendering right\n * now. Without it, exporting from a dark session bakes dark text onto the export's\n * white page and the file is unreadable. When the requested mode isn't the active one,\n * `data-theme` is flipped on `documentElement`, read, and restored — all synchronous\n * within one task, so the browser never paints the intermediate state. Omit `mode`\n * to read the live values as-is.\n */\n public SnapshotBrandTokens(\n tokens: readonly string[] = DEFAULT_EXPORT_THEME_TOKENS,\n mode?: 'light' | 'dark'\n ): Record<string, string> {\n const root = document.documentElement;\n const previous = root.getAttribute('data-theme');\n // The app's two real states are `data-theme=\"dark\"` and NO attribute at all —\n // `MJExplorerAppComponent` removes it for light rather than writing \"light\"\n // (explorer-app.component.ts). Reproduce those exactly rather than inventing a\n // third state, so the transient DOM is one the stylesheet has actually seen.\n const wantDark = mode === 'dark';\n const isDark = previous === 'dark';\n const mustSwap = mode != null && wantDark !== isDark;\n\n if (mustSwap) {\n if (wantDark) {\n root.setAttribute('data-theme', 'dark');\n } else {\n root.removeAttribute('data-theme');\n }\n }\n try {\n const style = getComputedStyle(root);\n const out: Record<string, string> = {};\n for (const token of tokens) {\n const value = style.getPropertyValue(token).trim();\n if (value) {\n out[token] = value;\n }\n }\n return out;\n } finally {\n // Restore even if reading throws — never strand the app in the other theme.\n if (mustSwap) {\n if (previous === null) {\n root.removeAttribute('data-theme');\n } else {\n root.setAttribute('data-theme', previous);\n }\n }\n }\n }\n\n /** Resolve the HTML export's theme pieces once: tokens (explicit > snapshot), logo, title. */\n private async resolveTheme(options: ResolvedExportOptions): Promise<ResolvedExportTheme> {\n const tokens = this.resolveBrandTokens(options);\n const rootBlock = tokens ? this.buildRootBlock(tokens) : '';\n const logoUrl = options.branding?.logoUrl?.trim();\n return {\n rootBlock,\n // The logo needs its `.brand-logo` rule (as the trademark footer needs its own),\n // so both are gated on includeCSS — a CSS-less export must never carry a\n // full-size unstyled logo. The modal enforces this too, but the public\n // BuildExportContent seam has to hold the line on its own.\n logoDataUri: options.includeCSS && logoUrl ? await this.inlineLogo(logoUrl) : null,\n // The title is deliberately NOT includeCSS-gated: it lands in <title>/<h1>, needs\n // no stylesheet, and is the one branding field every format carries unconditionally.\n title: options.branding?.title?.trim() || null\n };\n }\n\n /** Explicit host tokens win; `includeTheme` falls back to a live snapshot; else no theme. */\n private resolveBrandTokens(options: ResolvedExportOptions): Record<string, string> | null {\n const explicit = options.branding?.brandTokens;\n if (explicit && Object.keys(explicit).length > 0) {\n return explicit;\n }\n return options.includeTheme ? this.SnapshotBrandTokens(DEFAULT_EXPORT_THEME_TOKENS, options.themeMode) : null;\n }\n\n /** Document title used by every format: branding override → conversation name → generic. */\n private resolveTitle(\n data: ExportConversationData,\n options: ResolvedExportOptions\n ): string {\n return options.branding?.title?.trim() || data.conversation.Name || 'Conversation';\n }\n\n /**\n * The JSON `branding` block — the data-format analogue of the HTML header +\n * trademark footer. Carries the title, trademark, and logo URL the host set;\n * null when no branding (or none of those fields) is present. Theme color\n * tokens are HTML-only and never included here.\n */\n private buildBrandingBlock(options: ResolvedExportOptions): Record<string, string> | null {\n const b = options.branding;\n if (!b) {\n return null;\n }\n const block: Record<string, string> = {};\n const title = b.title?.trim();\n const trademark = b.trademark?.trim();\n const logoUrl = b.logoUrl?.trim();\n if (title) block.title = title;\n if (trademark) block.trademark = trademark;\n if (logoUrl) block.logoUrl = logoUrl;\n return Object.keys(block).length > 0 ? block : null;\n }\n\n /**\n * CSS functions permitted inside an exported token value. This is an ALLOWLIST\n * (not a blocklist) so no network-capable function can slip through: blocking\n * only `url(`/`expression(` let `image-set()`, `-webkit-image-set()`,\n * `cross-fade()`, `image()`, and `src()` fetch a beacon URL without ever\n * writing the literal `url(`. Anything not on this list drops the whole entry.\n * The set is the safe value/color-math functions the export could legitimately\n * carry; extend it only with functions that CANNOT load an external resource.\n */\n private static readonly SAFE_CSS_FUNCTIONS = new Set([\n 'var', 'calc', 'min', 'max', 'clamp',\n 'rgb', 'rgba', 'hsl', 'hsla', 'hwb', 'lab', 'lch', 'oklab', 'oklch',\n 'color', 'color-mix',\n ]);\n\n /**\n * Emit the sanitized `:root{}` style block. Keys must be custom-property names.\n * A value is REJECTED (the entry is dropped, not stripped) when it carries any\n * declaration/tag-escape or network-reach vector: `<>{}` (tag/rule breakout),\n * `;` (declaration breakout — e.g. `; background: url(beacon)`), `\\` (CSS\n * escapes), `@` (at-rules), OR any CSS function not in\n * {@link SAFE_CSS_FUNCTIONS} (which excludes every resource-loading function —\n * url/image-set/cross-fade/image/src/expression/…). Plain colors, `var()`, and\n * `color-mix()` pass untouched.\n */\n private buildRootBlock(tokens: Record<string, string>): string {\n const rules: string[] = [];\n for (const [key, rawValue] of Object.entries(tokens)) {\n if (!/^--[A-Za-z0-9_-]+$/.test(key)) {\n continue;\n }\n const value = String(rawValue).trim();\n if (!value || /[<>{};@\\\\]/.test(value) || this.hasUnsafeCssFunction(value)) {\n continue;\n }\n rules.push(`${key}: ${value};`);\n }\n return rules.length > 0 ? `\n <style>:root { ${rules.join(' ')} }</style>` : '';\n }\n\n /** True if the value calls any CSS function outside {@link SAFE_CSS_FUNCTIONS}. */\n private hasUnsafeCssFunction(value: string): boolean {\n // Every `name(` occurrence — the identifier immediately before a '('.\n const calls = value.match(/([a-zA-Z][a-zA-Z-]*)\\s*\\(/g) ?? [];\n return calls.some((c) => {\n const name = c.replace(/\\s*\\($/, '').toLowerCase();\n return !ExportService.SAFE_CSS_FUNCTIONS.has(name);\n });\n }\n\n /** Fetch → data URI so the export stays self-contained; raw URL on any failure\n * (or when the response isn't actually an image — don't inline HTML/other as\n * a bogus `data:` image). */\n private async inlineLogo(url: string): Promise<string> {\n try {\n const response = await fetch(url);\n if (!response.ok) {\n return url;\n }\n const contentType = response.headers.get('content-type') ?? '';\n if (!/^image\\//i.test(contentType)) {\n return url;\n }\n const blob = await response.blob();\n return await new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onloadend = () => resolve(String(reader.result));\n reader.onerror = () => reject(reader.error);\n reader.readAsDataURL(blob);\n });\n } catch {\n return url;\n }\n }\n\n /** Loads the conversation and the messages in the scope that no rerun replaced, in Sequence order. */\n private async loadConversationData(\n conversationId: string,\n scope: ConversationScope,\n currentUser: UserInfo\n ): Promise<ExportConversationData> {\n if (!UUIDsEqual(scope.ConversationID, conversationId)) {\n throw new Error(`Conversation ${conversationId} cannot be exported with the scope of conversation ${scope.ConversationID}`);\n }\n const rv = RunView.FromMetadataProvider(this.Provider);\n\n // Load conversation and details in parallel\n const [conversationResult, detailsResult] = await rv.RunViews([\n {\n EntityName: 'MJ: Conversations',\n ExtraFilter: `ID='${conversationId}'`,\n ResultType: 'entity_object'\n },\n {\n EntityName: 'MJ: Conversation Details',\n ExtraFilter: ConversationEngine.LiveRowsFilter(ConversationEngine.ScopeFilter(scope)),\n OrderBy: 'Sequence ASC',\n ResultType: 'entity_object'\n }\n ], currentUser);\n\n if (!conversationResult.Success || !conversationResult.Results?.length) {\n throw new Error('Conversation not found');\n }\n\n const details = (detailsResult.Results || []) as MJConversationDetailEntity[];\n return {\n conversation: conversationResult.Results[0] as MJConversationEntity,\n details,\n fork: this.forkLabel(scope, details)\n };\n }\n\n /** The header name of the scope's fork: its display name; null in Main. */\n private forkLabel(scope: ConversationScope, details: ReadonlyArray<MJConversationDetailEntity>): string | null {\n if (scope.BranchID == null) {\n return null;\n }\n const fork = scope.Branches.find(b => UUIDsEqual(b.ID, scope.BranchID));\n if (!fork) {\n return scope.BranchID;\n }\n const first = [...details]\n .filter(d => UUIDsEqual(d.BranchID ?? null, scope.BranchID))\n .sort((a, b) => a.Sequence - b.Sequence)\n .find(d => ConversationEngine.ForkPlainText(d.Message) != null);\n return ConversationEngine.ForkDisplayName(fork, first?.Message ?? null);\n }\n\n private exportAsJSON(\n data: ExportConversationData,\n options: ResolvedExportOptions\n ): string {\n const exportData: Record<string, unknown> = {};\n\n // Add metadata if requested\n const conversationBlock: Record<string, unknown> = options.includeMetadata\n ? {\n id: data.conversation.ID,\n name: data.conversation.Name,\n description: data.conversation.Description,\n createdAt: data.conversation.__mj_CreatedAt,\n updatedAt: data.conversation.__mj_UpdatedAt\n }\n : { name: data.conversation.Name };\n if (data.fork) {\n conversationBlock.fork = data.fork;\n }\n exportData.conversation = conversationBlock;\n\n // Branding block (title / trademark / logo) when the host supplied branding —\n // the data-format analogue of the HTML header + trademark footer.\n const branding = this.buildBrandingBlock(options);\n if (branding) {\n exportData.branding = branding;\n }\n\n // Add messages if requested\n if (options.includeMessages) {\n exportData.messages = data.details.map((detail, index) => {\n const message: Record<string, unknown> = {\n role: detail.Role,\n message: detail.Message\n };\n\n if (options.includeMetadata) {\n message.id = detail.ID;\n message.sequence = index + 1;\n message.timestamp = detail.__mj_CreatedAt;\n }\n\n return message;\n });\n }\n\n // Use pretty print option\n return JSON.stringify(exportData, null, options.prettyPrint ? 2 : 0);\n }\n\n private exportAsMarkdown(\n data: ExportConversationData,\n options: ResolvedExportOptions\n ): string {\n const logoUrl = options.branding?.logoUrl?.trim();\n // Unbranded markdown must stay byte-identical to before (`# <Name>`), so DON'T\n // route through resolveTitle's 'Conversation' fallback here — only a supplied\n // branding title overrides the raw conversation name.\n const title = options.branding?.title?.trim() || data.conversation.Name;\n let md = '';\n if (logoUrl) {\n md += `\\n\\n`;\n }\n md += `# ${title}\\n\\n`;\n\n if (data.conversation.Description) {\n md += `${data.conversation.Description}\\n\\n`;\n }\n\n if (options.includeMetadata) {\n md += `**Created:** ${this.formatDate(data.conversation.__mj_CreatedAt)}\\n\\n`;\n }\n\n if (data.fork) {\n md += `**Fork:** ${data.fork}\\n\\n`;\n }\n\n md += `---\\n\\n`;\n\n if (options.includeMessages) {\n for (const detail of data.details) {\n md += `## ${this.capitalizeRole(detail.Role || 'Unknown')}\\n\\n`;\n md += `${detail.Message}\\n\\n`;\n\n if (options.includeMetadata) {\n md += `*${this.formatDate(detail.__mj_CreatedAt)}*\\n\\n`;\n }\n\n md += `---\\n\\n`;\n }\n }\n\n const trademark = options.branding?.trademark?.trim();\n if (trademark) {\n md += `_${trademark}_\\n`;\n }\n\n return md;\n }\n\n private exportAsHTML(\n data: ExportConversationData,\n options: ResolvedExportOptions,\n theme: ResolvedExportTheme\n ): string {\n const trademark = options.branding?.trademark?.trim();\n // Every color reads a theme token with the legacy hex as its fallback, so an\n // unthemed export (no :root block emitted) renders exactly as it always has,\n // while a themed one follows the app's palette.\n const styles = options.includeCSS ? `\n <style>\n body { font-family: var(--mj-font-family, system-ui, -apple-system, sans-serif); background: var(--mj-bg-page, #fff); color: var(--mj-text-primary, #333); max-width: 800px; margin: 40px auto; padding: 0 20px; line-height: 1.6; }\n h1 { color: var(--mj-text-primary, #333); border-bottom: 2px solid var(--mj-brand-primary, #007bff); padding-bottom: 10px; }\n .meta { color: var(--mj-text-secondary, #666); font-size: 14px; margin-bottom: 30px; }\n .message { margin-bottom: 30px; padding: 20px; border-radius: var(--mj-radius-md, 8px); background: var(--mj-bg-surface-card, #f5f5f5); }\n .message.user { background: var(--mj-brand-accent-subtle, #e3f2fd); }\n .message.assistant { background: var(--mj-bg-surface-card, #f5f5f5); }\n .role { font-weight: 600; color: var(--mj-brand-primary, #007bff); margin-bottom: 10px; }\n .content { white-space: pre-wrap; }\n .timestamp { color: var(--mj-text-disabled, #999); font-size: 12px; margin-top: 10px; }${theme.logoDataUri ? `\n .brand-logo { display: block; max-height: 48px; margin-bottom: 12px; }` : ''}${trademark ? `\n .brand-trademark { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--mj-border-default, #ddd); color: var(--mj-text-secondary, #666); font-size: 12px; text-align: center; }` : ''}\n </style>${theme.rootBlock}` : '';\n\n const title = theme.title ?? (data.conversation.Name || 'Conversation');\n let html = `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>${this.escapeHtml(title)}</title>${styles}\n</head>\n<body>\n ${theme.logoDataUri ? `<img class=\"brand-logo\" src=\"${this.escapeAttr(theme.logoDataUri)}\" alt=\"\" />\n ` : ''}<h1>${this.escapeHtml(title)}</h1>`;\n\n const forkLine = data.fork ? `\n <p>Fork: ${this.escapeHtml(data.fork)}</p>` : '';\n if (options.includeMetadata) {\n html += `\n <div class=\"meta\">\n ${data.conversation.Description ? `<p>${this.escapeHtml(data.conversation.Description)}</p>` : ''}\n <p>Created: ${this.formatDate(data.conversation.__mj_CreatedAt)}</p>${forkLine}\n </div>`;\n } else if (forkLine) {\n html += `\n <div class=\"meta\">${forkLine}\n </div>`;\n }\n\n if (options.includeMessages) {\n for (const detail of data.details) {\n const roleClass = detail.Role?.toLowerCase() || 'unknown';\n html += `\n <div class=\"message ${roleClass}\">\n <div class=\"role\">${this.capitalizeRole(detail.Role || 'Unknown')}</div>\n <div class=\"content\">${this.escapeHtml(detail.Message || '')}</div>`;\n\n if (options.includeMetadata) {\n html += `\n <div class=\"timestamp\">${this.formatDate(detail.__mj_CreatedAt)}</div>`;\n }\n\n html += `\n </div>`;\n }\n }\n\n if (options.includeCSS && trademark) {\n html += `\n <footer class=\"brand-trademark\">${this.escapeHtml(trademark)}</footer>`;\n }\n\n html += `\n</body>\n</html>`;\n\n return html;\n }\n\n private exportAsText(\n data: ExportConversationData,\n options: ResolvedExportOptions\n ): string {\n const name = this.resolveTitle(data, options) || 'Conversation';\n let text = `${name}\\n`;\n text += '='.repeat(name.length) + '\\n\\n';\n\n if (data.conversation.Description) {\n text += `${data.conversation.Description}\\n\\n`;\n }\n\n if (options.includeMetadata) {\n text += `Created: ${this.formatDate(data.conversation.__mj_CreatedAt)}\\n\\n`;\n }\n\n if (data.fork) {\n text += `Fork: ${data.fork}\\n\\n`;\n }\n\n text += '-'.repeat(80) + '\\n\\n';\n\n if (options.includeMessages) {\n for (const detail of data.details) {\n text += `[${this.capitalizeRole(detail.Role || 'Unknown')}]\\n`;\n text += `${detail.Message}\\n`;\n\n if (options.includeMetadata) {\n text += `(${this.formatDate(detail.__mj_CreatedAt)})\\n`;\n }\n\n text += '\\n' + '-'.repeat(80) + '\\n\\n';\n }\n }\n\n const trademark = options.branding?.trademark?.trim();\n if (trademark) {\n text += `${trademark}\\n`;\n }\n\n return text;\n }\n\n private downloadFile(content: string, filename: string, mimeType: string): void {\n const blob = new Blob([content], { type: mimeType });\n const url = URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.href = url;\n link.download = filename;\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n URL.revokeObjectURL(url);\n }\n\n private formatDate(date: Date | string): string {\n const d = new Date(date);\n return d.toLocaleString('en-US', {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit'\n });\n }\n\n private capitalizeRole(role: string): string {\n return role.charAt(0).toUpperCase() + role.slice(1).toLowerCase();\n }\n\n private escapeHtml(text: string): string {\n const div = document.createElement('div');\n div.textContent = text;\n return div.innerHTML;\n }\n\n /** escapeHtml + quote escaping — for values interpolated into HTML attributes. */\n private escapeAttr(text: string): string {\n return this.escapeHtml(text).replace(/\"/g, '"');\n }\n\n private getTimestamp(): string {\n const now = new Date();\n return now.toISOString().replace(/[:.]/g, '-').slice(0, -5);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"export.service.js","sourceRoot":"","sources":["../../../src/lib/services/export.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,kBAAkB,EAOnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,OAAO,EAAY,QAAQ,EAAqB,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,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GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC1C,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC;QACvB,OAAO,GAAG,CAAC,SAAS,CAAC;IACvB,CAAC;IAED,kFAAkF;IAC1E,UAAU,CAAC,IAAY;QAC7B,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACvD,CAAC;IAEO,YAAY;QAClB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;uGAtxBU,aAAa;gEAAb,aAAa,WAAb,aAAa,mBAFZ,MAAM;;iFAEP,aAAa;cAHzB,UAAU;eAAC;gBACV,UAAU,EAAE,MAAM;aACnB","sourcesContent":["import { Injectable } from '@angular/core';\nimport {\n ConversationEngine,\n ConversationScope,\n MJConversationEntity,\n MJConversationDetailEntity,\n MJConversationDetailArtifactEntity,\n MJArtifactVersionEntity,\n MJArtifactEntity\n} from '@memberjunction/core-entities';\nimport { RunView, UserInfo, Metadata, IMetadataProvider } from '@memberjunction/core';\nimport { EscapeSQLString, UUIDsEqual } from '@memberjunction/global';\n\nexport type ExportFormat = 'json' | 'markdown' | 'html' | 'text';\n\n/**\n * Branding applied to exported files, across EVERY format. HTML gets the full\n * treatment (theme colors, an inlined logo, the title, and a trademark footer);\n * JSON/markdown/text carry the title and trademark (markdown also references the\n * logo). Hosts supply this via `mj-conversation-chat-area`'s `exportBranding`\n * input. Color theming (`brandTokens`) is HTML-only — it has no meaning in the\n * data/plain-text formats.\n */\nexport interface ExportBranding {\n /**\n * CSS custom-property snapshot emitted as a `:root{}` block in the exported\n * document, so the export's stylesheet (which reads `var(--mj-…, fallback)`)\n * renders in the app's theme. HTML export only. Keys must be valid\n * custom-property names (`--like-this`). Entries are DROPPED when the key is\n * invalid or the value carries declaration-escape / network-call characters\n * (`<>{};@\\`, `url(`, `expression(`) — plain colors, `var()`, and\n * `color-mix()` pass. When omitted and `ExportOptions.includeTheme` is true,\n * the current theme is auto-snapshotted from `document.documentElement` (see\n * {@link DEFAULT_EXPORT_THEME_TOKENS}).\n */\n brandTokens?: Record<string, string>;\n /**\n * Logo URL. In HTML it is fetched and inlined as a data URI (so the file stays\n * self-contained) and rendered above the title — requires\n * `ExportOptions.includeCSS`, since it needs its stylesheet rule. In markdown it is\n * referenced by URL. JSON carries it as a string; plain text omits it.\n *\n * If the fetch fails, or the response isn't `content-type: image/*`, the raw URL is\n * emitted instead — so the exported file will reach out to that URL when opened.\n * There is no size or timeout guard on the fetch: a very large logo inflates the\n * export.\n */\n logoUrl?: string;\n /** Overrides the exported document's title (defaults to the conversation name). */\n title?: string;\n /**\n * A short trademark / attribution line (e.g. `© 2026 Acme Association ·\n * Powered by Betty`) rendered at the FOOT of the exported document: a styled HTML\n * footer, a markdown/text trailer, and a field in the JSON `branding` block.\n *\n * In HTML it needs its stylesheet rule, so — like the logo — it is emitted only when\n * `ExportOptions.includeCSS` is true. The markdown/text/JSON trailers have no such\n * dependency and always emit.\n *\n * NOT escaped for markdown: a value containing `_`, `]`, `)`, or a newline can break\n * the surrounding markdown. Supply plain text (HTML and JSON are escaped).\n */\n trademark?: string;\n}\n\nexport interface ExportOptions {\n includeMessages?: boolean;\n includeMetadata?: boolean;\n prettyPrint?: boolean;\n includeCSS?: boolean;\n /**\n * Emit the current app theme into the HTML export. When true and\n * `branding.brandTokens` is absent, the {@link DEFAULT_EXPORT_THEME_TOKENS}\n * are auto-snapshotted from the live document at export time. Default false —\n * an unthemed export renders exactly as before (the stylesheet's `var()`\n * fallbacks carry the legacy palette).\n *\n * Gates only the TOKEN auto-snapshot: a supplied `branding`'s `logoUrl`,\n * `title`, and `trademark` apply whenever `branding` is present — in HTML AND\n * in the JSON/markdown/text formats. (The export modal passes `branding`\n * through only while its \"Include branding\" checkbox is on, so in the UI flow\n * everything travels together.)\n */\n includeTheme?: boolean;\n /**\n * Which theme mode the snapshot captures — NOT whichever mode the app happens to be\n * in when the user clicks Export. Defaults to `'light'`: an export taken during a\n * dark session would otherwise bake dark text onto the page's white background and\n * come out unreadable. `'dark'` pairs the dark palette with the dark\n * `--mj-bg-page` the body rule applies, so the file is coherent either way.\n * HTML only — the data formats carry no colors.\n */\n themeMode?: 'light' | 'dark';\n /** Branding (tokens / logo / title) applied to the export — see {@link ExportBranding}. */\n branding?: ExportBranding;\n /**\n * Write the artifacts each message produced under that message: name, type, version, a link\n * when {@link artifactLink} is set, and the stored content as text. File-backed versions\n * (PDF, spreadsheets, images) carry their MIME type instead of content. Default true.\n */\n includeArtifacts?: boolean;\n /**\n * Builds a link that opens an exported artifact in the app. This package has no router, so\n * the host supplies it; without it (or when it returns null) the export carries IDs only.\n * Only `http(s)` links are written.\n */\n artifactLink?: (target: ExportArtifactLinkTarget) => string | null;\n}\n\n/** What {@link ExportOptions.artifactLink} receives for each exported artifact. */\nexport interface ExportArtifactLinkTarget {\n ConversationID: string;\n ArtifactID: string;\n VersionID: string;\n VersionNumber: number;\n}\n\n/** One artifact version a message produced, as an export writes it. */\nexport interface ExportArtifact {\n ArtifactID: string;\n VersionID: string;\n Name: string;\n /** The artifact type's name (e.g. \"Component\", \"Report\"). */\n Type: string;\n VersionNumber: number;\n /** Stored text content; null for a file-backed version. */\n Content: string | null;\n MimeType: string | null;\n /** True when the version's content lives in a file rather than as text. */\n FileBacked: boolean;\n}\n\n/**\n * Longest artifact content the Markdown, HTML and text formats write; longer content is cut\n * with a marker line. JSON carries content as stored.\n */\nexport const EXPORT_ARTIFACT_CONTENT_LIMIT = 20000;\n\n/**\n * Tokens captured by the theme auto-snapshot — exactly the custom properties the\n * HTML export's stylesheet consumes. Hosts wanting more control supply their own\n * map via {@link ExportBranding.brandTokens} instead.\n */\nexport const DEFAULT_EXPORT_THEME_TOKENS: readonly string[] = [\n '--mj-bg-page',\n '--mj-text-primary',\n '--mj-text-secondary',\n '--mj-text-disabled',\n '--mj-border-default',\n '--mj-brand-primary',\n '--mj-brand-accent-subtle',\n '--mj-bg-surface-card',\n '--mj-font-family',\n '--mj-radius-md',\n];\n\n/** The conversation and the messages one export writes. */\nexport interface ExportConversationData {\n conversation: MJConversationEntity;\n details: MJConversationDetailEntity[];\n /**\n * The fork the messages come from, as the header names it (its display name). Absent or null\n * in Main.\n */\n fork?: string | null;\n /**\n * The output artifacts of each message, keyed by lower-cased message ID, in creation order.\n * Absent or empty when the messages produced none.\n */\n artifacts?: Map<string, ExportArtifact[]>;\n}\n\n/** Internal: options with defaults applied (branding and the link builder stay optional). */\ntype ResolvedExportOptions = Required<Omit<ExportOptions, 'branding' | 'artifactLink'>> &\n Pick<ExportOptions, 'branding' | 'artifactLink'>;\n\n/** The junction columns the export reads. */\ntype ExportArtifactLinkRow = Pick<MJConversationDetailArtifactEntity, 'ConversationDetailID' | 'ArtifactVersionID'>;\n/** The version columns the export reads. */\ntype ExportArtifactVersionRow = Pick<\n MJArtifactVersionEntity,\n 'ID' | 'ArtifactID' | 'VersionNumber' | 'Name' | 'Content' | 'FileID' | 'MimeType'\n>;\n/** The artifact columns the export reads. */\ntype ExportArtifactRow = Pick<MJArtifactEntity, 'ID' | 'Name' | 'Type'>;\n\n/** Internal: the theme pieces resolved once per HTML export. */\ninterface ResolvedExportTheme {\n /** `<style>:root{…}</style>` block (empty string when no tokens resolved). */\n rootBlock: string;\n /** Inlined logo (data URI, or the raw URL on fetch failure); null = no logo. */\n logoDataUri: string | null;\n /** Document-title override; null = use the conversation name. */\n title: string | null;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ExportService {\n private _provider: IMetadataProvider | null = null;\n\n /**\n * Set the metadata provider this service should use. When unset, falls back to Metadata.Provider.\n */\n public set Provider(value: IMetadataProvider | null) {\n this._provider = value;\n }\n\n public get Provider(): IMetadataProvider {\n return this._provider ?? Metadata.Provider;\n }\n\n /**\n * Exports the messages of one scope of a conversation (Main, or one fork's path) and\n * downloads the file. In a fork the export header names the fork.\n * @throws when the scope belongs to another conversation, or the conversation is not found.\n */\n async ExportConversation(\n conversationId: string,\n scope: ConversationScope,\n format: ExportFormat,\n currentUser: UserInfo,\n options: ExportOptions = {}\n ): Promise<void> {\n const conversation = await this.loadConversationData(conversationId, scope, currentUser, options.includeArtifacts ?? true);\n const { content, filename, mimeType } = await this.BuildExportContent(conversation, format, options);\n this.downloadFile(content, filename, mimeType);\n }\n\n /**\n * @deprecated Use {@link ExportConversation}. Without `scope`, exports Main.\n */\n async exportConversation(\n conversationId: string,\n format: ExportFormat,\n currentUser: UserInfo,\n options: ExportOptions = {},\n scope?: ConversationScope\n ): Promise<void> {\n const resolved = scope ?? ConversationEngine.TrunkScope(conversationId);\n return this.ExportConversation(conversationId, resolved, format, currentUser, options);\n }\n\n /**\n * Build the export document for already-loaded conversation data — the\n * download-free seam of {@link ExportConversation}. Async because HTML-format\n * branding may inline a logo. Exposed publicly so hosts (and tests) can build\n * export content without triggering a browser download.\n */\n public async BuildExportContent(\n data: ExportConversationData,\n format: ExportFormat,\n options: ExportOptions = {}\n ): Promise<{ content: string; filename: string; mimeType: string }> {\n const exportOptions: ResolvedExportOptions = {\n includeMessages: options.includeMessages ?? true,\n includeMetadata: options.includeMetadata ?? true,\n prettyPrint: options.prettyPrint ?? true,\n includeCSS: options.includeCSS ?? true,\n includeTheme: options.includeTheme ?? false,\n themeMode: options.themeMode ?? 'light',\n includeArtifacts: options.includeArtifacts ?? true,\n branding: options.branding,\n artifactLink: options.artifactLink\n };\n const baseName = `conversation-${data.conversation.Name}-${this.getTimestamp()}`;\n\n switch (format) {\n case 'json':\n return { content: this.exportAsJSON(data, exportOptions), filename: `${baseName}.json`, mimeType: 'application/json' };\n case 'markdown':\n return { content: this.exportAsMarkdown(data, exportOptions), filename: `${baseName}.md`, mimeType: 'text/markdown' };\n case 'html':\n return {\n content: this.exportAsHTML(data, exportOptions, await this.resolveTheme(exportOptions)),\n filename: `${baseName}.html`,\n mimeType: 'text/html'\n };\n case 'text':\n return { content: this.exportAsText(data, exportOptions), filename: `${baseName}.txt`, mimeType: 'text/plain' };\n default:\n throw new Error(`Unsupported export format: ${format}`);\n }\n }\n\n /**\n * Snapshot the given theme tokens from the live document. Empty/unset tokens are\n * skipped.\n *\n * `mode` captures a SPECIFIC palette rather than whatever the app is rendering right\n * now. Without it, exporting from a dark session bakes dark text onto the export's\n * white page and the file is unreadable. When the requested mode isn't the active one,\n * `data-theme` is flipped on `documentElement`, read, and restored — all synchronous\n * within one task, so the browser never paints the intermediate state. Omit `mode`\n * to read the live values as-is.\n */\n public SnapshotBrandTokens(\n tokens: readonly string[] = DEFAULT_EXPORT_THEME_TOKENS,\n mode?: 'light' | 'dark'\n ): Record<string, string> {\n const root = document.documentElement;\n const previous = root.getAttribute('data-theme');\n // The app's two real states are `data-theme=\"dark\"` and NO attribute at all —\n // `MJExplorerAppComponent` removes it for light rather than writing \"light\"\n // (explorer-app.component.ts). Reproduce those exactly rather than inventing a\n // third state, so the transient DOM is one the stylesheet has actually seen.\n const wantDark = mode === 'dark';\n const isDark = previous === 'dark';\n const mustSwap = mode != null && wantDark !== isDark;\n\n if (mustSwap) {\n if (wantDark) {\n root.setAttribute('data-theme', 'dark');\n } else {\n root.removeAttribute('data-theme');\n }\n }\n try {\n const style = getComputedStyle(root);\n const out: Record<string, string> = {};\n for (const token of tokens) {\n const value = style.getPropertyValue(token).trim();\n if (value) {\n out[token] = value;\n }\n }\n return out;\n } finally {\n // Restore even if reading throws — never strand the app in the other theme.\n if (mustSwap) {\n if (previous === null) {\n root.removeAttribute('data-theme');\n } else {\n root.setAttribute('data-theme', previous);\n }\n }\n }\n }\n\n /** Resolve the HTML export's theme pieces once: tokens (explicit > snapshot), logo, title. */\n private async resolveTheme(options: ResolvedExportOptions): Promise<ResolvedExportTheme> {\n const tokens = this.resolveBrandTokens(options);\n const rootBlock = tokens ? this.buildRootBlock(tokens) : '';\n const logoUrl = options.branding?.logoUrl?.trim();\n return {\n rootBlock,\n // The logo needs its `.brand-logo` rule (as the trademark footer needs its own),\n // so both are gated on includeCSS — a CSS-less export must never carry a\n // full-size unstyled logo. The modal enforces this too, but the public\n // BuildExportContent seam has to hold the line on its own.\n logoDataUri: options.includeCSS && logoUrl ? await this.inlineLogo(logoUrl) : null,\n // The title is deliberately NOT includeCSS-gated: it lands in <title>/<h1>, needs\n // no stylesheet, and is the one branding field every format carries unconditionally.\n title: options.branding?.title?.trim() || null\n };\n }\n\n /** Explicit host tokens win; `includeTheme` falls back to a live snapshot; else no theme. */\n private resolveBrandTokens(options: ResolvedExportOptions): Record<string, string> | null {\n const explicit = options.branding?.brandTokens;\n if (explicit && Object.keys(explicit).length > 0) {\n return explicit;\n }\n return options.includeTheme ? this.SnapshotBrandTokens(DEFAULT_EXPORT_THEME_TOKENS, options.themeMode) : null;\n }\n\n /** Document title used by every format: branding override → conversation name → generic. */\n private resolveTitle(\n data: ExportConversationData,\n options: ResolvedExportOptions\n ): string {\n return options.branding?.title?.trim() || data.conversation.Name || 'Conversation';\n }\n\n /**\n * The JSON `branding` block — the data-format analogue of the HTML header +\n * trademark footer. Carries the title, trademark, and logo URL the host set;\n * null when no branding (or none of those fields) is present. Theme color\n * tokens are HTML-only and never included here.\n */\n private buildBrandingBlock(options: ResolvedExportOptions): Record<string, string> | null {\n const b = options.branding;\n if (!b) {\n return null;\n }\n const block: Record<string, string> = {};\n const title = b.title?.trim();\n const trademark = b.trademark?.trim();\n const logoUrl = b.logoUrl?.trim();\n if (title) block.title = title;\n if (trademark) block.trademark = trademark;\n if (logoUrl) block.logoUrl = logoUrl;\n return Object.keys(block).length > 0 ? block : null;\n }\n\n /**\n * CSS functions permitted inside an exported token value. This is an ALLOWLIST\n * (not a blocklist) so no network-capable function can slip through: blocking\n * only `url(`/`expression(` let `image-set()`, `-webkit-image-set()`,\n * `cross-fade()`, `image()`, and `src()` fetch a beacon URL without ever\n * writing the literal `url(`. Anything not on this list drops the whole entry.\n * The set is the safe value/color-math functions the export could legitimately\n * carry; extend it only with functions that CANNOT load an external resource.\n */\n private static readonly SAFE_CSS_FUNCTIONS = new Set([\n 'var', 'calc', 'min', 'max', 'clamp',\n 'rgb', 'rgba', 'hsl', 'hsla', 'hwb', 'lab', 'lch', 'oklab', 'oklch',\n 'color', 'color-mix',\n ]);\n\n /**\n * Emit the sanitized `:root{}` style block. Keys must be custom-property names.\n * A value is REJECTED (the entry is dropped, not stripped) when it carries any\n * declaration/tag-escape or network-reach vector: `<>{}` (tag/rule breakout),\n * `;` (declaration breakout — e.g. `; background: url(beacon)`), `\\` (CSS\n * escapes), `@` (at-rules), OR any CSS function not in\n * {@link SAFE_CSS_FUNCTIONS} (which excludes every resource-loading function —\n * url/image-set/cross-fade/image/src/expression/…). Plain colors, `var()`, and\n * `color-mix()` pass untouched.\n */\n private buildRootBlock(tokens: Record<string, string>): string {\n const rules: string[] = [];\n for (const [key, rawValue] of Object.entries(tokens)) {\n if (!/^--[A-Za-z0-9_-]+$/.test(key)) {\n continue;\n }\n const value = String(rawValue).trim();\n if (!value || /[<>{};@\\\\]/.test(value) || this.hasUnsafeCssFunction(value)) {\n continue;\n }\n rules.push(`${key}: ${value};`);\n }\n return rules.length > 0 ? `\n <style>:root { ${rules.join(' ')} }</style>` : '';\n }\n\n /** True if the value calls any CSS function outside {@link SAFE_CSS_FUNCTIONS}. */\n private hasUnsafeCssFunction(value: string): boolean {\n // Every `name(` occurrence — the identifier immediately before a '('.\n const calls = value.match(/([a-zA-Z][a-zA-Z-]*)\\s*\\(/g) ?? [];\n return calls.some((c) => {\n const name = c.replace(/\\s*\\($/, '').toLowerCase();\n return !ExportService.SAFE_CSS_FUNCTIONS.has(name);\n });\n }\n\n /** Fetch → data URI so the export stays self-contained; raw URL on any failure\n * (or when the response isn't actually an image — don't inline HTML/other as\n * a bogus `data:` image). */\n private async inlineLogo(url: string): Promise<string> {\n try {\n const response = await fetch(url);\n if (!response.ok) {\n return url;\n }\n const contentType = response.headers.get('content-type') ?? '';\n if (!/^image\\//i.test(contentType)) {\n return url;\n }\n const blob = await response.blob();\n return await new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onloadend = () => resolve(String(reader.result));\n reader.onerror = () => reject(reader.error);\n reader.readAsDataURL(blob);\n });\n } catch {\n return url;\n }\n }\n\n /** Loads the conversation and the messages in the scope that no rerun replaced, in Sequence order. */\n private async loadConversationData(\n conversationId: string,\n scope: ConversationScope,\n currentUser: UserInfo,\n includeArtifacts: boolean\n ): Promise<ExportConversationData> {\n if (!UUIDsEqual(scope.ConversationID, conversationId)) {\n throw new Error(`Conversation ${conversationId} cannot be exported with the scope of conversation ${scope.ConversationID}`);\n }\n const rv = RunView.FromMetadataProvider(this.Provider);\n\n // Load conversation and details in parallel\n const [conversationResult, detailsResult] = await rv.RunViews([\n {\n EntityName: 'MJ: Conversations',\n ExtraFilter: `ID='${conversationId}'`,\n ResultType: 'entity_object'\n },\n {\n EntityName: 'MJ: Conversation Details',\n ExtraFilter: ConversationEngine.LiveRowsFilter(ConversationEngine.ScopeFilter(scope)),\n OrderBy: 'Sequence ASC',\n ResultType: 'entity_object'\n }\n ], currentUser);\n\n if (!conversationResult.Success || !conversationResult.Results?.length) {\n throw new Error('Conversation not found');\n }\n\n const details = (detailsResult.Results || []) as MJConversationDetailEntity[];\n return {\n conversation: conversationResult.Results[0] as MJConversationEntity,\n details,\n fork: this.forkLabel(scope, details),\n artifacts: includeArtifacts ? await this.loadOutputArtifacts(details, currentUser) : undefined\n };\n }\n\n /**\n * The output artifacts of the exported messages, keyed by lower-cased message ID. Reads run as\n * the current user, so row-level security decides what an export carries. A failed read\n * exports the messages without artifacts.\n */\n private async loadOutputArtifacts(\n details: ReadonlyArray<MJConversationDetailEntity>,\n currentUser: UserInfo\n ): Promise<Map<string, ExportArtifact[]>> {\n const byDetail = new Map<string, ExportArtifact[]>();\n if (details.length === 0) {\n return byDetail;\n }\n const rv = RunView.FromMetadataProvider(this.Provider);\n const inList = (ids: Iterable<string>): string => [...ids].map(id => `'${EscapeSQLString(id)}'`).join(',');\n\n const links = await rv.RunView<ExportArtifactLinkRow>({\n EntityName: 'MJ: Conversation Detail Artifacts',\n ExtraFilter: `ConversationDetailID IN (${inList(details.map(d => d.ID))}) AND Direction='Output'`,\n Fields: ['ConversationDetailID', 'ArtifactVersionID'],\n OrderBy: '__mj_CreatedAt ASC',\n ResultType: 'simple'\n }, currentUser);\n const linkRows = links.Success ? links.Results ?? [] : [];\n if (!links.Success) {\n console.error('Failed to load artifacts for the export:', links.ErrorMessage);\n }\n if (linkRows.length === 0) {\n return byDetail;\n }\n\n const versionIds = new Set(linkRows.map(l => l.ArtifactVersionID));\n const versions = await rv.RunView<ExportArtifactVersionRow>({\n EntityName: 'MJ: Artifact Versions',\n ExtraFilter: `ID IN (${inList(versionIds)})`,\n Fields: ['ID', 'ArtifactID', 'VersionNumber', 'Name', 'Content', 'FileID', 'MimeType'],\n ResultType: 'simple'\n }, currentUser);\n const versionRows = versions.Success ? versions.Results ?? [] : [];\n if (versionRows.length === 0) {\n return byDetail;\n }\n\n const artifacts = await rv.RunView<ExportArtifactRow>({\n EntityName: 'MJ: Artifacts',\n ExtraFilter: `ID IN (${inList(new Set(versionRows.map(v => v.ArtifactID)))})`,\n Fields: ['ID', 'Name', 'Type'],\n ResultType: 'simple'\n }, currentUser);\n const artifactById = new Map((artifacts.Success ? artifacts.Results ?? [] : []).map(a => [a.ID.toLowerCase(), a]));\n const versionById = new Map(versionRows.map(v => [v.ID.toLowerCase(), v]));\n\n for (const link of linkRows) {\n const version = versionById.get(link.ArtifactVersionID.toLowerCase());\n // A version the user cannot read, or whose artifact they cannot read, is left out.\n const artifact = version ? artifactById.get(version.ArtifactID.toLowerCase()) : undefined;\n if (!version || !artifact) {\n continue;\n }\n const key = link.ConversationDetailID.toLowerCase();\n const list = byDetail.get(key) ?? [];\n list.push({\n ArtifactID: artifact.ID,\n VersionID: version.ID,\n Name: version.Name || artifact.Name || 'Untitled artifact',\n Type: artifact.Type ?? 'Unknown type',\n VersionNumber: version.VersionNumber,\n Content: version.FileID ? null : version.Content,\n MimeType: version.MimeType,\n FileBacked: !!version.FileID\n });\n byDetail.set(key, list);\n }\n return byDetail;\n }\n\n /** The artifacts to write under one message: none when artifacts are off or it produced none. */\n private artifactsFor(\n data: ExportConversationData,\n detail: MJConversationDetailEntity,\n options: ResolvedExportOptions\n ): ExportArtifact[] {\n if (!options.includeArtifacts || !data.artifacts) {\n return [];\n }\n return data.artifacts.get(detail.ID.toLowerCase()) ?? [];\n }\n\n /** The host's link for an artifact, when it builds one and the link is http(s). */\n private artifactUrl(\n data: ExportConversationData,\n artifact: ExportArtifact,\n options: ResolvedExportOptions\n ): string | null {\n const url = options.artifactLink?.({\n ConversationID: data.conversation.ID,\n ArtifactID: artifact.ArtifactID,\n VersionID: artifact.VersionID,\n VersionNumber: artifact.VersionNumber\n })?.trim();\n return url && /^https?:\\/\\//i.test(url) ? url : null;\n }\n\n /** \"Type, version N\" plus the MIME type of a file-backed version. */\n private artifactSummary(artifact: ExportArtifact): string {\n const mime = artifact.FileBacked && artifact.MimeType ? `, ${artifact.MimeType}` : '';\n return `${artifact.Type}, version ${artifact.VersionNumber}${mime}`;\n }\n\n /**\n * Text content for the Markdown, HTML and text formats, cut at\n * {@link EXPORT_ARTIFACT_CONTENT_LIMIT} with a marker line. Null when there is none.\n */\n private artifactText(artifact: ExportArtifact): string | null {\n const content = artifact.Content;\n if (artifact.FileBacked || content == null || content.length === 0) {\n return null;\n }\n if (content.length <= EXPORT_ARTIFACT_CONTENT_LIMIT) {\n return content;\n }\n return `${content.slice(0, EXPORT_ARTIFACT_CONTENT_LIMIT)}\\n[truncated: ${EXPORT_ARTIFACT_CONTENT_LIMIT} of ${content.length} characters shown]`;\n }\n\n /** A Markdown code fence longer than any backtick run inside the content. */\n private markdownFence(content: string): string {\n const longest = Math.max(0, ...(content.match(/`+/g) ?? []).map(run => run.length));\n return '`'.repeat(Math.max(3, longest + 1));\n }\n\n /** The header name of the scope's fork: its display name; null in Main. */\n private forkLabel(scope: ConversationScope, details: ReadonlyArray<MJConversationDetailEntity>): string | null {\n if (scope.BranchID == null) {\n return null;\n }\n const fork = scope.Branches.find(b => UUIDsEqual(b.ID, scope.BranchID));\n if (!fork) {\n return scope.BranchID;\n }\n const first = [...details]\n .filter(d => UUIDsEqual(d.BranchID ?? null, scope.BranchID))\n .sort((a, b) => a.Sequence - b.Sequence)\n .find(d => ConversationEngine.ForkPlainText(d.Message) != null);\n return ConversationEngine.ForkDisplayName(fork, first?.Message ?? null);\n }\n\n private exportAsJSON(\n data: ExportConversationData,\n options: ResolvedExportOptions\n ): string {\n const exportData: Record<string, unknown> = {};\n\n // Add metadata if requested\n const conversationBlock: Record<string, unknown> = options.includeMetadata\n ? {\n id: data.conversation.ID,\n name: data.conversation.Name,\n description: data.conversation.Description,\n createdAt: data.conversation.__mj_CreatedAt,\n updatedAt: data.conversation.__mj_UpdatedAt\n }\n : { name: data.conversation.Name };\n if (data.fork) {\n conversationBlock.fork = data.fork;\n }\n exportData.conversation = conversationBlock;\n\n // Branding block (title / trademark / logo) when the host supplied branding —\n // the data-format analogue of the HTML header + trademark footer.\n const branding = this.buildBrandingBlock(options);\n if (branding) {\n exportData.branding = branding;\n }\n\n // Add messages if requested\n if (options.includeMessages) {\n exportData.messages = data.details.map((detail, index) => {\n const message: Record<string, unknown> = {\n role: detail.Role,\n message: detail.Message\n };\n\n if (options.includeMetadata) {\n message.id = detail.ID;\n message.sequence = index + 1;\n message.timestamp = detail.__mj_CreatedAt;\n }\n\n const artifacts = this.artifactsFor(data, detail, options);\n if (artifacts.length > 0) {\n message.artifacts = artifacts.map(artifact => {\n const entry: Record<string, unknown> = {\n id: artifact.ArtifactID,\n versionId: artifact.VersionID,\n name: artifact.Name,\n type: artifact.Type,\n version: artifact.VersionNumber\n };\n if (artifact.FileBacked) {\n entry.mimeType = artifact.MimeType;\n }\n const link = this.artifactUrl(data, artifact, options);\n if (link) {\n entry.link = link;\n }\n entry.content = artifact.Content;\n return entry;\n });\n }\n\n return message;\n });\n }\n\n // Use pretty print option\n return JSON.stringify(exportData, null, options.prettyPrint ? 2 : 0);\n }\n\n private exportAsMarkdown(\n data: ExportConversationData,\n options: ResolvedExportOptions\n ): string {\n const logoUrl = options.branding?.logoUrl?.trim();\n // Unbranded markdown must stay byte-identical to before (`# <Name>`), so DON'T\n // route through resolveTitle's 'Conversation' fallback here — only a supplied\n // branding title overrides the raw conversation name.\n const title = options.branding?.title?.trim() || data.conversation.Name;\n let md = '';\n if (logoUrl) {\n md += `\\n\\n`;\n }\n md += `# ${title}\\n\\n`;\n\n if (data.conversation.Description) {\n md += `${data.conversation.Description}\\n\\n`;\n }\n\n if (options.includeMetadata) {\n md += `**Created:** ${this.formatDate(data.conversation.__mj_CreatedAt)}\\n\\n`;\n }\n\n if (data.fork) {\n md += `**Fork:** ${data.fork}\\n\\n`;\n }\n\n md += `---\\n\\n`;\n\n if (options.includeMessages) {\n for (const detail of data.details) {\n md += `## ${this.capitalizeRole(detail.Role || 'Unknown')}\\n\\n`;\n md += `${detail.Message}\\n\\n`;\n\n for (const artifact of this.artifactsFor(data, detail, options)) {\n md += `**Artifact:** ${artifact.Name} (${this.artifactSummary(artifact)})\\n\\n`;\n const link = this.artifactUrl(data, artifact, options);\n if (link) {\n md += `[Open in the app](${link})\\n\\n`;\n }\n const text = this.artifactText(artifact);\n if (text) {\n const fence = this.markdownFence(text);\n md += `${fence}\\n${text}\\n${fence}\\n\\n`;\n }\n }\n\n if (options.includeMetadata) {\n md += `*${this.formatDate(detail.__mj_CreatedAt)}*\\n\\n`;\n }\n\n md += `---\\n\\n`;\n }\n }\n\n const trademark = options.branding?.trademark?.trim();\n if (trademark) {\n md += `_${trademark}_\\n`;\n }\n\n return md;\n }\n\n private exportAsHTML(\n data: ExportConversationData,\n options: ResolvedExportOptions,\n theme: ResolvedExportTheme\n ): string {\n const trademark = options.branding?.trademark?.trim();\n // Every color reads a theme token with the legacy hex as its fallback, so an\n // unthemed export (no :root block emitted) renders exactly as it always has,\n // while a themed one follows the app's palette.\n const styles = options.includeCSS ? `\n <style>\n body { font-family: var(--mj-font-family, system-ui, -apple-system, sans-serif); background: var(--mj-bg-page, #fff); color: var(--mj-text-primary, #333); max-width: 800px; margin: 40px auto; padding: 0 20px; line-height: 1.6; }\n h1 { color: var(--mj-text-primary, #333); border-bottom: 2px solid var(--mj-brand-primary, #007bff); padding-bottom: 10px; }\n .meta { color: var(--mj-text-secondary, #666); font-size: 14px; margin-bottom: 30px; }\n .message { margin-bottom: 30px; padding: 20px; border-radius: var(--mj-radius-md, 8px); background: var(--mj-bg-surface-card, #f5f5f5); }\n .message.user { background: var(--mj-brand-accent-subtle, #e3f2fd); }\n .message.assistant { background: var(--mj-bg-surface-card, #f5f5f5); }\n .role { font-weight: 600; color: var(--mj-brand-primary, #007bff); margin-bottom: 10px; }\n .content { white-space: pre-wrap; }\n .timestamp { color: var(--mj-text-disabled, #999); font-size: 12px; margin-top: 10px; }${this.hasArtifacts(data, options) ? `\n .artifact { margin-top: 12px; padding: 12px; border: 1px solid var(--mj-border-default, #ddd); border-radius: var(--mj-radius-md, 8px); background: var(--mj-bg-page, #fff); }\n .artifact-name { font-weight: 600; }\n .artifact-meta { color: var(--mj-text-secondary, #666); font-size: 12px; }\n .artifact-content { white-space: pre-wrap; overflow-x: auto; font-size: 13px; margin: 8px 0 0; }` : ''}${theme.logoDataUri ? `\n .brand-logo { display: block; max-height: 48px; margin-bottom: 12px; }` : ''}${trademark ? `\n .brand-trademark { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--mj-border-default, #ddd); color: var(--mj-text-secondary, #666); font-size: 12px; text-align: center; }` : ''}\n </style>${theme.rootBlock}` : '';\n\n const title = theme.title ?? (data.conversation.Name || 'Conversation');\n let html = `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>${this.escapeHtml(title)}</title>${styles}\n</head>\n<body>\n ${theme.logoDataUri ? `<img class=\"brand-logo\" src=\"${this.escapeAttr(theme.logoDataUri)}\" alt=\"\" />\n ` : ''}<h1>${this.escapeHtml(title)}</h1>`;\n\n const forkLine = data.fork ? `\n <p>Fork: ${this.escapeHtml(data.fork)}</p>` : '';\n if (options.includeMetadata) {\n html += `\n <div class=\"meta\">\n ${data.conversation.Description ? `<p>${this.escapeHtml(data.conversation.Description)}</p>` : ''}\n <p>Created: ${this.formatDate(data.conversation.__mj_CreatedAt)}</p>${forkLine}\n </div>`;\n } else if (forkLine) {\n html += `\n <div class=\"meta\">${forkLine}\n </div>`;\n }\n\n if (options.includeMessages) {\n for (const detail of data.details) {\n const roleClass = detail.Role?.toLowerCase() || 'unknown';\n html += `\n <div class=\"message ${roleClass}\">\n <div class=\"role\">${this.capitalizeRole(detail.Role || 'Unknown')}</div>\n <div class=\"content\">${this.escapeHtml(detail.Message || '')}</div>`;\n\n for (const artifact of this.artifactsFor(data, detail, options)) {\n const link = this.artifactUrl(data, artifact, options);\n const text = this.artifactText(artifact);\n html += `\n <div class=\"artifact\">\n <div class=\"artifact-name\">${this.escapeHtml(artifact.Name)}</div>\n <div class=\"artifact-meta\">${this.escapeHtml(this.artifactSummary(artifact))}${link ? ` · <a href=\"${this.escapeAttr(link)}\">Open in the app</a>` : ''}</div>${text ? `\n <pre class=\"artifact-content\">${this.escapeHtml(text)}</pre>` : ''}\n </div>`;\n }\n\n if (options.includeMetadata) {\n html += `\n <div class=\"timestamp\">${this.formatDate(detail.__mj_CreatedAt)}</div>`;\n }\n\n html += `\n </div>`;\n }\n }\n\n if (options.includeCSS && trademark) {\n html += `\n <footer class=\"brand-trademark\">${this.escapeHtml(trademark)}</footer>`;\n }\n\n html += `\n</body>\n</html>`;\n\n return html;\n }\n\n private exportAsText(\n data: ExportConversationData,\n options: ResolvedExportOptions\n ): string {\n const name = this.resolveTitle(data, options) || 'Conversation';\n let text = `${name}\\n`;\n text += '='.repeat(name.length) + '\\n\\n';\n\n if (data.conversation.Description) {\n text += `${data.conversation.Description}\\n\\n`;\n }\n\n if (options.includeMetadata) {\n text += `Created: ${this.formatDate(data.conversation.__mj_CreatedAt)}\\n\\n`;\n }\n\n if (data.fork) {\n text += `Fork: ${data.fork}\\n\\n`;\n }\n\n text += '-'.repeat(80) + '\\n\\n';\n\n if (options.includeMessages) {\n for (const detail of data.details) {\n text += `[${this.capitalizeRole(detail.Role || 'Unknown')}]\\n`;\n text += `${detail.Message}\\n`;\n\n for (const artifact of this.artifactsFor(data, detail, options)) {\n text += `\\n[Artifact] ${artifact.Name} (${this.artifactSummary(artifact)})\\n`;\n const link = this.artifactUrl(data, artifact, options);\n if (link) {\n text += `Link: ${link}\\n`;\n }\n const content = this.artifactText(artifact);\n if (content) {\n text += `${content}\\n`;\n }\n }\n\n if (options.includeMetadata) {\n text += `(${this.formatDate(detail.__mj_CreatedAt)})\\n`;\n }\n\n text += '\\n' + '-'.repeat(80) + '\\n\\n';\n }\n }\n\n const trademark = options.branding?.trademark?.trim();\n if (trademark) {\n text += `${trademark}\\n`;\n }\n\n return text;\n }\n\n /** True when any exported message carries an artifact (the HTML adds its rules only then). */\n private hasArtifacts(data: ExportConversationData, options: ResolvedExportOptions): boolean {\n return options.includeMessages && data.details.some(d => this.artifactsFor(data, d, options).length > 0);\n }\n\n private downloadFile(content: string, filename: string, mimeType: string): void {\n const blob = new Blob([content], { type: mimeType });\n const url = URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.href = url;\n link.download = filename;\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n URL.revokeObjectURL(url);\n }\n\n private formatDate(date: Date | string): string {\n const d = new Date(date);\n return d.toLocaleString('en-US', {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit'\n });\n }\n\n private capitalizeRole(role: string): string {\n return role.charAt(0).toUpperCase() + role.slice(1).toLowerCase();\n }\n\n private escapeHtml(text: string): string {\n const div = document.createElement('div');\n div.textContent = text;\n return div.innerHTML;\n }\n\n /** escapeHtml + quote escaping — for values interpolated into HTML attributes. */\n private escapeAttr(text: string): string {\n return this.escapeHtml(text).replace(/\"/g, '"');\n }\n\n private getTimestamp(): string {\n const now = new Date();\n return now.toISOString().replace(/[:.]/g, '-').slice(0, -5);\n }\n}\n"]}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { IMetadataProvider, RemoteOpProgress, UserInfo } from '@memberjunction/core';
|
|
2
|
+
import { ArtifactSynthesisTargetKind, MJArtifactEntity, MJArtifactTypeEntity, MJArtifactVersionEntity, MJCollectionArtifactEntity } from '@memberjunction/core-entities';
|
|
3
|
+
import { GraphQLFileStorageClient } from '@memberjunction/graphql-dataprovider';
|
|
4
|
+
import { GraphQLAttachmentBlobStore } from './graphql-attachment-blob-store';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* First-class blank artifact starter templates surfaced in the Library Hub & Create dialog.
|
|
8
|
+
*/
|
|
9
|
+
export type LibraryStarterKind = 'document' | 'spreadsheet' | 'presentation' | 'query';
|
|
10
|
+
/**
|
|
11
|
+
* Export formats supported when publishing a native Library artifact version directly to an external Connected Drive.
|
|
12
|
+
*/
|
|
13
|
+
export type LibraryDriveExportFormat = 'original' | 'docx' | 'md' | 'xlsx' | 'csv' | 'pptx' | 'json' | 'sql' | 'txt';
|
|
14
|
+
/**
|
|
15
|
+
* Thrown by {@link LibraryCreationService.PublishArtifactVersionToConnectedDrive} when a file with the
|
|
16
|
+
* target name already exists in the remote folder and `AllowOverwrite` has not been confirmed.
|
|
17
|
+
*/
|
|
18
|
+
export declare class RemoteDriveFileExistsError extends Error {
|
|
19
|
+
readonly ObjectPath: string;
|
|
20
|
+
constructor(objectPath: string, fileName: string);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Thrown by {@link LibraryCreationService.PushVersionToConnectedDrive} when the remote file ETag
|
|
24
|
+
* changed since the last sync and `ForceOverwrite` is false.
|
|
25
|
+
*/
|
|
26
|
+
export declare class RemoteDriveConflictError extends Error {
|
|
27
|
+
readonly ObjectPath: string;
|
|
28
|
+
readonly ExpectedETag?: string;
|
|
29
|
+
readonly ActualETag?: string;
|
|
30
|
+
constructor(objectPath: string, expectedETag?: string, actualETag?: string);
|
|
31
|
+
}
|
|
32
|
+
export interface CreateBlankArtifactOptions {
|
|
33
|
+
Kind: LibraryStarterKind;
|
|
34
|
+
Title: string;
|
|
35
|
+
Description?: string;
|
|
36
|
+
CollectionID?: string | null;
|
|
37
|
+
EnvironmentID?: string;
|
|
38
|
+
CurrentUser: UserInfo;
|
|
39
|
+
Provider?: IMetadataProvider;
|
|
40
|
+
}
|
|
41
|
+
export interface CreateCustomTextArtifactOptions {
|
|
42
|
+
Title: string;
|
|
43
|
+
Description?: string;
|
|
44
|
+
Content: string;
|
|
45
|
+
ArtifactTypeID: string;
|
|
46
|
+
CollectionID?: string | null;
|
|
47
|
+
EnvironmentID?: string;
|
|
48
|
+
CurrentUser: UserInfo;
|
|
49
|
+
Provider?: IMetadataProvider;
|
|
50
|
+
}
|
|
51
|
+
export interface ImportLocalFileOptions {
|
|
52
|
+
File: File;
|
|
53
|
+
/**
|
|
54
|
+
* When `true` and the file extension is convertible (`.docx`, `.md`, `.txt`, `.xlsx`, `.csv`, `.sql`, `.json`),
|
|
55
|
+
* imports the content into a collaborative `ContentMode = 'Text'` native MJ Artifact with zero `MJ: Files` row.
|
|
56
|
+
* When `false` (or for binary files like `.pdf`, `.png`, `.mp4`), uploads the file into MJ Storage and creates
|
|
57
|
+
* a `ContentMode = 'File'` native Library artifact.
|
|
58
|
+
*/
|
|
59
|
+
ConvertToEditable: boolean;
|
|
60
|
+
Title?: string;
|
|
61
|
+
Description?: string;
|
|
62
|
+
CollectionID?: string | null;
|
|
63
|
+
EnvironmentID?: string;
|
|
64
|
+
CurrentUser: UserInfo;
|
|
65
|
+
Provider?: IMetadataProvider;
|
|
66
|
+
}
|
|
67
|
+
export interface ConvertRemoteDriveObjectOptions {
|
|
68
|
+
AccountID: string;
|
|
69
|
+
ObjectPath: string;
|
|
70
|
+
FileName: string;
|
|
71
|
+
ProviderType?: string;
|
|
72
|
+
FolderID?: string;
|
|
73
|
+
WebUrl?: string;
|
|
74
|
+
ETag?: string;
|
|
75
|
+
RemoteModifiedAt?: string;
|
|
76
|
+
Title?: string;
|
|
77
|
+
CollectionID?: string | null;
|
|
78
|
+
EnvironmentID?: string;
|
|
79
|
+
CurrentUser: UserInfo;
|
|
80
|
+
Provider?: IMetadataProvider;
|
|
81
|
+
StorageClientOverride?: Pick<GraphQLFileStorageClient, 'CreatePreAuthDownloadUrl'> & Partial<Pick<GraphQLFileStorageClient, 'ListObjects'>>;
|
|
82
|
+
FetchBytesOverride?: (url: string) => Promise<ArrayBuffer>;
|
|
83
|
+
}
|
|
84
|
+
export interface PushVersionToConnectedDriveOptions {
|
|
85
|
+
ArtifactID: string;
|
|
86
|
+
VersionID?: string | null;
|
|
87
|
+
AccountID?: string;
|
|
88
|
+
ObjectPath?: string;
|
|
89
|
+
Format?: LibraryDriveExportFormat;
|
|
90
|
+
ForceOverwrite?: boolean;
|
|
91
|
+
CurrentUser: UserInfo;
|
|
92
|
+
Provider?: IMetadataProvider;
|
|
93
|
+
StorageClientOverride?: Pick<GraphQLFileStorageClient, 'CreatePreAuthUploadUrl'> & Partial<Pick<GraphQLFileStorageClient, 'ListObjects' | 'ObjectExists' | 'SearchFiles'>>;
|
|
94
|
+
UploadBytesOverride?: (uploadUrl: string, bytes: Uint8Array, mimeType: string) => Promise<void>;
|
|
95
|
+
DownloadFileBytesOverride?: (params: {
|
|
96
|
+
ArtifactVersionID?: string | null;
|
|
97
|
+
FileID?: string | null;
|
|
98
|
+
}) => Promise<Uint8Array>;
|
|
99
|
+
}
|
|
100
|
+
export interface PushVersionToConnectedDriveResult {
|
|
101
|
+
ArtifactID: string;
|
|
102
|
+
VersionID: string;
|
|
103
|
+
VersionNumber: number;
|
|
104
|
+
ObjectPath: string;
|
|
105
|
+
ByteLength: number;
|
|
106
|
+
ETag?: string;
|
|
107
|
+
UpdatedConfiguration: string;
|
|
108
|
+
}
|
|
109
|
+
export interface PullConnectedDriveVersionOptions {
|
|
110
|
+
ArtifactID: string;
|
|
111
|
+
VersionID?: string | null;
|
|
112
|
+
AccountID?: string;
|
|
113
|
+
ObjectPath?: string;
|
|
114
|
+
CurrentUser: UserInfo;
|
|
115
|
+
Provider?: IMetadataProvider;
|
|
116
|
+
StorageClientOverride?: Pick<GraphQLFileStorageClient, 'CreatePreAuthDownloadUrl'> & Partial<Pick<GraphQLFileStorageClient, 'ListObjects'>>;
|
|
117
|
+
FetchBytesOverride?: (url: string) => Promise<ArrayBuffer>;
|
|
118
|
+
}
|
|
119
|
+
export interface PullConnectedDriveVersionResult {
|
|
120
|
+
ArtifactID: string;
|
|
121
|
+
PreviousVersionNumber: number;
|
|
122
|
+
NewVersionID: string;
|
|
123
|
+
NewVersionNumber: number;
|
|
124
|
+
ObjectPath: string;
|
|
125
|
+
ETag?: string;
|
|
126
|
+
UpdatedConfiguration: string;
|
|
127
|
+
}
|
|
128
|
+
export interface PublishToConnectedDriveOptions {
|
|
129
|
+
ArtifactName: string;
|
|
130
|
+
VersionContent: string;
|
|
131
|
+
VersionConfiguration?: string | null;
|
|
132
|
+
VersionContentMode?: MJArtifactVersionEntity['ContentMode'];
|
|
133
|
+
ArtifactVersionID?: string | null;
|
|
134
|
+
VersionFileID?: string | null;
|
|
135
|
+
VersionMimeType?: string | null;
|
|
136
|
+
VersionFileName?: string | null;
|
|
137
|
+
Format: LibraryDriveExportFormat;
|
|
138
|
+
AccountID: string;
|
|
139
|
+
TargetFolderPrefix?: string;
|
|
140
|
+
TargetFileName?: string;
|
|
141
|
+
AllowOverwrite?: boolean;
|
|
142
|
+
CurrentUser: UserInfo;
|
|
143
|
+
Provider?: IMetadataProvider;
|
|
144
|
+
StorageClientOverride?: Pick<GraphQLFileStorageClient, 'CreatePreAuthUploadUrl'> & Partial<Pick<GraphQLFileStorageClient, 'ListObjects' | 'ObjectExists' | 'SearchFiles'>>;
|
|
145
|
+
UploadBytesOverride?: (uploadUrl: string, bytes: Uint8Array, mimeType: string) => Promise<void>;
|
|
146
|
+
DownloadFileBytesOverride?: (params: {
|
|
147
|
+
ArtifactVersionID?: string | null;
|
|
148
|
+
FileID?: string | null;
|
|
149
|
+
}) => Promise<Uint8Array>;
|
|
150
|
+
}
|
|
151
|
+
export interface SynthesizeArtifactFromSourcesOptions {
|
|
152
|
+
TargetKind: ArtifactSynthesisTargetKind;
|
|
153
|
+
Goal: string;
|
|
154
|
+
SourceArtifactIds: ReadonlyArray<string>;
|
|
155
|
+
CollectionID?: string | null;
|
|
156
|
+
Title?: string | null;
|
|
157
|
+
AgentHandle?: string | null;
|
|
158
|
+
LinkChartsAndRanges?: boolean;
|
|
159
|
+
CurrentUser: UserInfo;
|
|
160
|
+
Provider?: IMetadataProvider;
|
|
161
|
+
OnProgress?: (progress: RemoteOpProgress) => void;
|
|
162
|
+
}
|
|
163
|
+
export interface SynthesizeArtifactFromSourcesResult {
|
|
164
|
+
Success: boolean;
|
|
165
|
+
AccessDenied?: boolean;
|
|
166
|
+
ErrorMessage?: string;
|
|
167
|
+
ArtifactID: string;
|
|
168
|
+
VersionID: string;
|
|
169
|
+
VersionNumber: number;
|
|
170
|
+
Title: string;
|
|
171
|
+
ArtifactTypeName: string;
|
|
172
|
+
LinkedChartCount: number;
|
|
173
|
+
SourceCount: number;
|
|
174
|
+
Warnings: string[];
|
|
175
|
+
UsedFallback: boolean;
|
|
176
|
+
}
|
|
177
|
+
export interface CreatedLibraryArtifactResult {
|
|
178
|
+
Artifact: MJArtifactEntity;
|
|
179
|
+
Version: MJArtifactVersionEntity;
|
|
180
|
+
ArtifactType: MJArtifactTypeEntity;
|
|
181
|
+
CollectionLink: MJCollectionArtifactEntity | null;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Service encapsulating native Library artifact creation, local file upload/conversion,
|
|
185
|
+
* and stateless conversions/exports between Native Library and external Connected Drives.
|
|
186
|
+
*
|
|
187
|
+
* Architectural invariant:
|
|
188
|
+
* - External Connected Drive operations (`ConvertRemoteDriveObjectToNativeArtifact` and
|
|
189
|
+
* `PublishArtifactVersionToConnectedDrive`) NEVER create `MJ: Files` database records.
|
|
190
|
+
* - `MJ: Files` is created ONLY when a user uploads a binary file directly into Native Library
|
|
191
|
+
* (`ImportLocalFileToLibrary` with `ConvertToEditable = false` or non-convertible binary).
|
|
192
|
+
*/
|
|
193
|
+
export declare class LibraryCreationService {
|
|
194
|
+
private readonly docImportExport;
|
|
195
|
+
private readonly slideExport;
|
|
196
|
+
private readonly collectionPermissions;
|
|
197
|
+
private readonly artifactFileService;
|
|
198
|
+
private blobStoreOverride;
|
|
199
|
+
/**
|
|
200
|
+
* Optional test seam to override the attachment blob store used for binary `ContentMode = 'File'` uploads.
|
|
201
|
+
*/
|
|
202
|
+
SetBlobStoreOverride(store: GraphQLAttachmentBlobStore | null): void;
|
|
203
|
+
/**
|
|
204
|
+
* Returns `true` when a filename extension can be converted into an inline collaborative MJ artifact (`ContentMode = 'Text'`).
|
|
205
|
+
*/
|
|
206
|
+
IsConvertibleFileName(fileName: string): boolean;
|
|
207
|
+
/**
|
|
208
|
+
* Loads enabled `MJ: Artifact Types` via `ArtifactMetadataEngine` (falling back to `RunView` if cache is empty).
|
|
209
|
+
*/
|
|
210
|
+
LoadEnabledArtifactTypes(user: UserInfo, provider?: IMetadataProvider): Promise<MJArtifactTypeEntity[]>;
|
|
211
|
+
/**
|
|
212
|
+
* Resolves the canonical `MJ: Artifact Types` record for one of the four Hub starter tiles.
|
|
213
|
+
*/
|
|
214
|
+
FindStarterArtifactType(kind: LibraryStarterKind, types: ReadonlyArray<MJArtifactTypeEntity>): MJArtifactTypeEntity | undefined;
|
|
215
|
+
/**
|
|
216
|
+
* Generates starter `Content` for a newly created blank native artifact.
|
|
217
|
+
*/
|
|
218
|
+
BuildStarterContent(kind: LibraryStarterKind, title: string): string;
|
|
219
|
+
/**
|
|
220
|
+
* Creates a new blank collaborative Document, Spreadsheet, Presentation, or SQL Query in Native Library.
|
|
221
|
+
*/
|
|
222
|
+
CreateBlankArtifact(options: CreateBlankArtifactOptions): Promise<CreatedLibraryArtifactResult>;
|
|
223
|
+
/**
|
|
224
|
+
* Creates a custom text artifact with an explicit `ArtifactTypeID` and raw `Content`.
|
|
225
|
+
*/
|
|
226
|
+
CreateCustomTextArtifact(options: CreateCustomTextArtifactOptions): Promise<CreatedLibraryArtifactResult>;
|
|
227
|
+
/**
|
|
228
|
+
* Imports a local browser `File` into Native Library:
|
|
229
|
+
* - When `ConvertToEditable` is `true` and the extension is convertible, converts `.docx`/`.md`/`.xlsx`/`.csv`/`.sql`/`.json`
|
|
230
|
+
* into an editable `ContentMode = 'Text'` artifact (zero `MJ: Files` row).
|
|
231
|
+
* - Otherwise uploads the binary via `GraphQLAttachmentBlobStore` into MJ Storage and creates a `ContentMode = 'File'`
|
|
232
|
+
* artifact version referencing `FileID`.
|
|
233
|
+
*/
|
|
234
|
+
ImportLocalFileToLibrary(options: ImportLocalFileOptions): Promise<CreatedLibraryArtifactResult>;
|
|
235
|
+
/**
|
|
236
|
+
* Streams an external Connected Drive file via a short-lived pre-authenticated URL and converts it
|
|
237
|
+
* in memory into a collaborative `ContentMode = 'Text'` native MJ Artifact.
|
|
238
|
+
*
|
|
239
|
+
* **Zero `MJ: Files` database records are created.**
|
|
240
|
+
*/
|
|
241
|
+
ConvertRemoteDriveObjectToNativeArtifact(options: ConvertRemoteDriveObjectOptions): Promise<CreatedLibraryArtifactResult>;
|
|
242
|
+
/**
|
|
243
|
+
* 1-Click Connected Drive Round-Trip Push (§6.1): serializes the current artifact version
|
|
244
|
+
* back to its linked Connected Drive path after verifying the remote ETag has not drifted
|
|
245
|
+
* (zero `MJ: Files` rows created).
|
|
246
|
+
*/
|
|
247
|
+
PushVersionToConnectedDrive(options: PushVersionToConnectedDriveOptions): Promise<PushVersionToConnectedDriveResult>;
|
|
248
|
+
/**
|
|
249
|
+
* 1-Click Connected Drive Round-Trip Pull (§6.1): downloads the latest remote bytes
|
|
250
|
+
* from a linked Connected Drive file and creates `vN+1` in MJ Library without creating
|
|
251
|
+
* any `MJ: Files` row, returning version numbers so the host can open the diff view.
|
|
252
|
+
*/
|
|
253
|
+
PullLatestFromConnectedDriveAsNewVersion(options: PullConnectedDriveVersionOptions): Promise<PullConnectedDriveVersionResult>;
|
|
254
|
+
/**
|
|
255
|
+
* Executes the `Artifact.SynthesizeFromSources` remote operation (`SynthesizeArtifactFromSourcesOperation`)
|
|
256
|
+
* to read multiple governed artifacts, synthesize a brand-new `Presentation`, `Markdown Document`, or
|
|
257
|
+
* `Excel Spreadsheet` with live chart/range links, enforce `CanRead` / `CanEdit` permissions, stream
|
|
258
|
+
* progress updates, and save v1.
|
|
259
|
+
*/
|
|
260
|
+
SynthesizeArtifactFromSources(options: SynthesizeArtifactFromSourcesOptions): Promise<SynthesizeArtifactFromSourcesResult>;
|
|
261
|
+
/**
|
|
262
|
+
* Exports a native MJ Artifact version into `.docx`, `.md`, `.xlsx`, `.csv`, `.pptx`, `.json`, `.sql`, `.txt`,
|
|
263
|
+
* or its original binary file bytes (`ContentMode === 'File'`), checks for target path collisions,
|
|
264
|
+
* and uploads directly to an external Connected Drive path via `CreatePreAuthUploadUrl`.
|
|
265
|
+
*
|
|
266
|
+
* **Zero `MJ: Files` database records are created.**
|
|
267
|
+
*/
|
|
268
|
+
PublishArtifactVersionToConnectedDrive(options: PublishToConnectedDriveOptions): Promise<{
|
|
269
|
+
ObjectPath: string;
|
|
270
|
+
ByteLength: number;
|
|
271
|
+
MimeType: string;
|
|
272
|
+
}>;
|
|
273
|
+
/**
|
|
274
|
+
* Returns recommended Connected Drive export formats for a given `DriverClass`, `ArtifactType` name,
|
|
275
|
+
* or binary `ContentMode = 'File'` artifact.
|
|
276
|
+
*/
|
|
277
|
+
GetSupportedDriveExportFormats(driverClass?: string | null, typeName?: string | null, contentMode?: MJArtifactVersionEntity['ContentMode'] | null, fileName?: string | null): Array<{
|
|
278
|
+
Format: LibraryDriveExportFormat;
|
|
279
|
+
Label: string;
|
|
280
|
+
}>;
|
|
281
|
+
private persistArtifactAndVersion;
|
|
282
|
+
private assertCanWriteCollection;
|
|
283
|
+
private convertBytesToNativeText;
|
|
284
|
+
private serializeExportPayload;
|
|
285
|
+
private downloadFileVersionBytes;
|
|
286
|
+
private createGraphQLFileStorageClient;
|
|
287
|
+
private remoteObjectExists;
|
|
288
|
+
private extensionFromMime;
|
|
289
|
+
private resolveBinaryArtifactType;
|
|
290
|
+
private defaultTitleForStarter;
|
|
291
|
+
private extractExtension;
|
|
292
|
+
private stripExtension;
|
|
293
|
+
private sanitizeFileName;
|
|
294
|
+
private inferMimeFromExtension;
|
|
295
|
+
private arrayBufferToBase64;
|
|
296
|
+
private loadArtifactVersionsDesc;
|
|
297
|
+
private splitObjectPath;
|
|
298
|
+
private inferExportFormat;
|
|
299
|
+
private findRemoteObjectMetadata;
|
|
300
|
+
private recordConnectedDriveAuditLog;
|
|
301
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LibraryCreationService, never>;
|
|
302
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LibraryCreationService>;
|
|
303
|
+
}
|
|
304
|
+
//# sourceMappingURL=library-creation.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library-creation.service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/library-creation.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAY,gBAAgB,EAAW,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACxG,OAAO,EAGL,2BAA2B,EAK3B,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EAGvB,0BAA0B,EAO3B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAA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