@sisense/sdk-ai-core 0.17.0 → 0.60.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.
Files changed (167) hide show
  1. package/dist/__vite-browser-external-l0sNRNKZ.js +1 -0
  2. package/dist/constants.d.ts +35 -0
  3. package/dist/engines/atomic-handle-args.d.ts +45 -0
  4. package/dist/engines/atomic-tool-requirements.d.ts +38 -0
  5. package/dist/engines/author-pulse/actions/create.d.ts +9 -0
  6. package/dist/engines/author-pulse/actions/define.d.ts +9 -0
  7. package/dist/engines/author-pulse/actions/load-existing.d.ts +9 -0
  8. package/dist/engines/author-pulse/actions/redefine.d.ts +9 -0
  9. package/dist/engines/author-pulse/actions/set-receive-notifications.d.ts +8 -0
  10. package/dist/engines/author-pulse/actions/update-spec.d.ts +11 -0
  11. package/dist/engines/author-pulse/actions/update-workflow.d.ts +9 -0
  12. package/dist/engines/author-pulse/atomic-adapter.d.ts +10 -0
  13. package/dist/engines/author-pulse/atomic-tools.d.ts +362 -0
  14. package/dist/engines/author-pulse/author-pulse-engine.d.ts +21 -0
  15. package/dist/engines/author-pulse/index.d.ts +9 -0
  16. package/dist/engines/author-pulse/shared/adjustment-error.d.ts +15 -0
  17. package/dist/engines/author-pulse/shared/assemble-create-workflow-payload.d.ts +36 -0
  18. package/dist/engines/author-pulse/shared/assert-agentic-workflow.d.ts +12 -0
  19. package/dist/engines/author-pulse/shared/compile-query-from-prompt.d.ts +95 -0
  20. package/dist/engines/author-pulse/shared/decision-spec-validation.d.ts +84 -0
  21. package/dist/engines/author-pulse/shared/notification-urls.d.ts +52 -0
  22. package/dist/engines/author-pulse/shared/pulse-knowledge.d.ts +36 -0
  23. package/dist/engines/author-pulse/shared/pulse-signature.d.ts +39 -0
  24. package/dist/engines/author-pulse/shared/resolve-frequency.d.ts +18 -0
  25. package/dist/engines/author-pulse/shared/staging.d.ts +65 -0
  26. package/dist/engines/author-pulse/shared/workflow-ownership.d.ts +14 -0
  27. package/dist/engines/author-pulse/types.d.ts +1385 -0
  28. package/dist/engines/build-chart/atomic-adapter.d.ts +20 -0
  29. package/dist/engines/build-chart/atomic-tools.d.ts +214 -0
  30. package/dist/engines/build-chart/build-chart-engine.d.ts +1 -1
  31. package/dist/engines/build-chart/chart-tool-name.d.ts +3 -0
  32. package/dist/engines/build-chart/create-chart/assemble-chart-widget.d.ts +1 -1
  33. package/dist/engines/build-chart/create-chart/chart-json-axes-mapping.d.ts +1 -1
  34. package/dist/engines/build-chart/create-chart/create-chart.d.ts +1 -1
  35. package/dist/engines/build-chart/create-chart/derive-chart-title.d.ts +7 -0
  36. package/dist/engines/build-chart/create-chart/generate-chart-recommendations.d.ts +2 -2
  37. package/dist/engines/build-chart/create-chart/resolve-chart-query.d.ts +4 -0
  38. package/dist/engines/build-chart/shared/normalize-cartesian-axes-mapping.d.ts +1 -1
  39. package/dist/engines/build-chart/shared/sync-chart-state-measure-flags.d.ts +3 -0
  40. package/dist/engines/build-chart/types.d.ts +38 -19
  41. package/dist/engines/build-chart/update-chart/apply-prior-chart-style.d.ts +8 -5
  42. package/dist/engines/build-chart/update-chart/chart-options-schemas.d.ts +18 -18
  43. package/dist/engines/build-chart/update-chart/schemas.d.ts +2 -2
  44. package/dist/engines/build-chart/update-chart/update-chart-data-options.d.ts +7 -2
  45. package/dist/engines/build-chart/update-chart/update-chart-query.d.ts +1 -1
  46. package/dist/engines/build-chart/update-chart/update-chart-style-options.d.ts +7 -2
  47. package/dist/engines/build-chart/update-chart/update-chart-title.d.ts +1 -1
  48. package/dist/engines/build-chart/update-chart/update-chart-type.d.ts +7 -2
  49. package/dist/engines/build-csv-model/build-csv-model-engine.d.ts +1 -1
  50. package/dist/engines/build-csv-model/types.d.ts +1 -1
  51. package/dist/engines/build-dashboard/add-dashboard-narration.d.ts +50 -0
  52. package/dist/engines/build-dashboard/add-dashboard-widgets.d.ts +1 -1
  53. package/dist/engines/build-dashboard/atomic-adapter.d.ts +21 -0
  54. package/dist/engines/build-dashboard/atomic-tools.d.ts +231 -0
  55. package/dist/engines/build-dashboard/build-dashboard-engine.d.ts +1 -1
  56. package/dist/engines/build-dashboard/build-dashboard-service.d.ts +2 -1
  57. package/dist/engines/build-dashboard/create-dashboard.d.ts +3 -4
  58. package/dist/engines/build-dashboard/dashboard-filters/manipulate-dashboard-filters.d.ts +2 -1
  59. package/dist/engines/build-dashboard/dashboard-filters/translate-filters.d.ts +17 -1
  60. package/dist/engines/build-dashboard/index.d.ts +2 -0
  61. package/dist/engines/build-dashboard/layout/place-widget.d.ts +53 -0
  62. package/dist/engines/build-dashboard/load-existing-fusion-dashboard.d.ts +1 -1
  63. package/dist/engines/build-dashboard/remove-dashboard-widgets.d.ts +4 -0
  64. package/dist/engines/build-dashboard/resolve-chart-widgets.d.ts +16 -0
  65. package/dist/engines/build-dashboard/types.d.ts +180 -18
  66. package/dist/engines/build-data-model/build-data-model-engine.d.ts +1 -1
  67. package/dist/engines/build-data-model/types.d.ts +1 -1
  68. package/dist/engines/build-query/build-query-engine.d.ts +33 -5
  69. package/dist/engines/build-query/index.d.ts +1 -1
  70. package/dist/engines/build-query/types.d.ts +216 -3
  71. package/dist/engines/build-status/build-status-engine.d.ts +8 -0
  72. package/dist/engines/build-status/builds-client.d.ts +44 -0
  73. package/dist/engines/build-status/index.d.ts +2 -0
  74. package/dist/engines/build-status/types.d.ts +177 -0
  75. package/dist/engines/datamodel-graph/data-model-map-text.d.ts +28 -0
  76. package/dist/engines/datamodel-graph/datamodel-graph-engine.d.ts +31 -0
  77. package/dist/engines/datamodel-graph/index.d.ts +4 -0
  78. package/dist/engines/datamodel-graph/summaries.d.ts +97 -0
  79. package/dist/engines/datamodel-graph/test-fixtures.d.ts +42 -0
  80. package/dist/engines/datamodel-graph/types.d.ts +190 -0
  81. package/dist/engines/evaluate-pulse/evaluate-pulse-engine.d.ts +10 -0
  82. package/dist/engines/evaluate-pulse/index.d.ts +2 -0
  83. package/dist/engines/evaluate-pulse/types.d.ts +85 -0
  84. package/dist/engines/get-dashboard-narration/get-dashboard-narration-engine.d.ts +23 -0
  85. package/dist/engines/get-dashboard-narration/index.d.ts +2 -0
  86. package/dist/engines/get-dashboard-narration/types.d.ts +64 -0
  87. package/dist/engines/get-dashboards/get-dashboards-engine.d.ts +1 -1
  88. package/dist/engines/get-dashboards/types.d.ts +16 -4
  89. package/dist/engines/get-data-preview/get-data-preview-engine.d.ts +18 -0
  90. package/dist/engines/get-data-preview/index.d.ts +2 -0
  91. package/dist/engines/get-data-preview/types.d.ts +35 -0
  92. package/dist/engines/get-data-source-fields/get-data-source-fields-engine.d.ts +12 -6
  93. package/dist/engines/get-data-source-fields/index.d.ts +1 -0
  94. package/dist/engines/get-data-source-fields/model-relations.d.ts +38 -0
  95. package/dist/engines/get-data-source-fields/types.d.ts +49 -3
  96. package/dist/engines/get-data-sources/get-data-sources-engine.d.ts +1 -1
  97. package/dist/engines/get-data-sources/types.d.ts +2 -2
  98. package/dist/engines/index.d.ts +17 -0
  99. package/dist/engines/inspect-pulse/atomic-adapter.d.ts +8 -0
  100. package/dist/engines/inspect-pulse/atomic-tools.d.ts +60 -0
  101. package/dist/engines/inspect-pulse/index.d.ts +4 -0
  102. package/dist/engines/inspect-pulse/inspect-pulse-engine.d.ts +7 -0
  103. package/dist/engines/inspect-pulse/types.d.ts +209 -0
  104. package/dist/engines/manage-perspectives/manage-perspectives-engine.d.ts +5 -1
  105. package/dist/engines/manage-perspectives/types.d.ts +13 -8
  106. package/dist/engines/pulse-tool-words.d.ts +62 -0
  107. package/dist/engines/recommend-queries/recommend-queries-engine.d.ts +1 -1
  108. package/dist/engines/recommend-queries/types.d.ts +1 -1
  109. package/dist/engines/shared/existing-answer-cascade.d.ts +52 -0
  110. package/dist/engines/shared/get-filters-json-for-llm-summary.d.ts +2 -2
  111. package/dist/engines/shared/nlq-query-helpers.d.ts +2 -2
  112. package/dist/engines/shared/project-dashboard-json.d.ts +151 -0
  113. package/dist/engines/shared/project-widget-json.d.ts +67 -0
  114. package/dist/engines/shared/projection-helpers.d.ts +19 -0
  115. package/dist/engines/shared/redact-data-models-closed-to-ai.d.ts +55 -0
  116. package/dist/engines/shared/redact-hidden-columns-from-ai.d.ts +55 -0
  117. package/dist/index.d.ts +20 -0
  118. package/dist/index.js +57916 -30543
  119. package/dist/services/ai-access/ai-access-service.d.ts +68 -0
  120. package/dist/services/dashboards/dashboards-service.d.ts +9 -3
  121. package/dist/services/dashboards/fusion-dashboards-service.d.ts +34 -4
  122. package/dist/services/data-sources/data-sources-service.d.ts +131 -2
  123. package/dist/services/data-sources/find-data-source-by-title.d.ts +8 -0
  124. package/dist/services/datamodel-graph/datamodel-graph-service.d.ts +457 -0
  125. package/dist/services/existing-answer/existing-answer-query-service.d.ts +31 -0
  126. package/dist/services/formulas/formulas-service.d.ts +19 -0
  127. package/dist/services/hide-from-ai/hide-from-ai.d.ts +31 -0
  128. package/dist/services/knowledge-graph/knowledge-graph-service.d.ts +96 -0
  129. package/dist/services/llm/llm-consumption-service.d.ts +7 -2
  130. package/dist/services/llm/llm-settings-service.d.ts +49 -5
  131. package/dist/services/nlq/nlq-preview-dataset.d.ts +34 -0
  132. package/dist/services/nlq/nlq-service.d.ts +138 -3
  133. package/dist/services/pulse/evaluate-pulse-client.d.ts +78 -0
  134. package/dist/services/pulse/pulse-alerts-service.d.ts +264 -0
  135. package/dist/services/pulse/pulse-events-service.d.ts +217 -0
  136. package/dist/services/semantic-search/semantic-search-service.d.ts +43 -0
  137. package/dist/services/tool-store/tool-store-service.d.ts +32 -0
  138. package/dist/services/users-groups-service.d.ts +37 -0
  139. package/dist/skills/index.d.ts +127 -0
  140. package/dist/tool-availability/controlled-tools.d.ts +56 -0
  141. package/dist/tool-availability/index.d.ts +4 -0
  142. package/dist/tool-availability/offer-tools.d.ts +44 -0
  143. package/dist/tool-availability/resolve-tool-availability.d.ts +68 -0
  144. package/dist/tool-availability/withdrawn-text.d.ts +33 -0
  145. package/dist/tool-catalog/catalog.d.ts +387 -0
  146. package/dist/tool-catalog/index.d.ts +3 -0
  147. package/dist/tool-catalog/manifest.d.ts +5 -0
  148. package/dist/tool-catalog/prototype-lookup.d.ts +10 -0
  149. package/dist/tool-catalog/types.d.ts +67 -0
  150. package/dist/tools.manifest.json +826 -0
  151. package/dist/utils/chat-stream-errors.d.ts +42 -0
  152. package/dist/utils/create-custom-fetch.d.ts +19 -1
  153. package/dist/utils/create-stream-completion.d.ts +84 -6
  154. package/dist/utils/create-structured-completion.d.ts +29 -2
  155. package/dist/utils/create-tools-completion.d.ts +9 -0
  156. package/dist/utils/deferred-tools.d.ts +45 -0
  157. package/dist/utils/dev-debug.d.ts +5 -0
  158. package/dist/utils/generate-suggestions.d.ts +32 -0
  159. package/dist/utils/http-client.d.ts +3 -1
  160. package/dist/utils/llm-call-observer.d.ts +83 -0
  161. package/dist/utils/llm-client.d.ts +11 -1
  162. package/dist/utils/quoted-text.d.ts +6 -0
  163. package/dist/utils/server-error-body.d.ts +23 -0
  164. package/dist/utils/text-tokens.d.ts +35 -0
  165. package/dist/utils/user-action-tracking.d.ts +48 -5
  166. package/dist/utils/zod-utils.d.ts +9 -1
  167. package/package.json +28 -19
@@ -0,0 +1,68 @@
1
+ import { HttpClient } from '@sisense/sdk-rest-client';
2
+ /** The assistant surface whose AI access flag applies. */
3
+ export type AiAccessSurface = 'genai' | 'studioAssistant';
4
+ /** Effective AI access settings of one data model, as model-graphql reports them. */
5
+ export type AiAccessControlSettings = {
6
+ availableForAnalyticsAssistant?: boolean;
7
+ availableForStudioAssistant?: boolean;
8
+ availableForSemanticEnrichment?: boolean;
9
+ };
10
+ /**
11
+ * Declare which assistant surface this runtime serves. Until a host declares one, nothing is
12
+ * filtered: the flag to check differs per surface, and hosts without a flag of their own
13
+ * (e.g. the MCP server) keep their current behaviour.
14
+ */
15
+ export declare function setAiAccessSurface(surface: AiAccessSurface | null): void;
16
+ export declare function getAiAccessSurface(): AiAccessSurface | null;
17
+ /**
18
+ * Whether AI access is checked in this runtime: true once a host declared its surface. The one
19
+ * place the "no surface → no filtering" default lives. A host that never declares one (e.g. the
20
+ * MCP server) is told so once in its own log, rather than only in documentation.
21
+ */
22
+ export declare function aiAccessEnforced(): boolean;
23
+ /** Drop cached lookups, e.g. after an administrator changed a model's AI access. */
24
+ export declare function resetAiAccessCache(): void;
25
+ /** The phrase every refusal carries, so a host can tell one from other tool errors. */
26
+ export declare const DATA_MODEL_AI_ACCESS_DENIED_MARKER = "is not available to the AI assistant";
27
+ /** Whether an error message (or a serialized error envelope) is an AI access refusal. */
28
+ export declare function isDataModelAiAccessDeniedMessage(message: string): boolean;
29
+ /**
30
+ * Thrown when the LLM asks for a data model whose AI access is off. The message is written for
31
+ * the model: it says what happened and how to answer the user, so the conversation carries on.
32
+ */
33
+ export declare class DataModelAiAccessDeniedError extends Error {
34
+ constructor(dataModelName?: string);
35
+ }
36
+ /**
37
+ * How a data model is named for its AI access lookup. A datasource `fullname` (`LocalHost/Title`,
38
+ * `live:Title`) tells an ElastiCube from its Live twin and from same-titled models; a title alone
39
+ * cannot, so the fullname is used whenever the caller has one.
40
+ */
41
+ export type DataModelRef = {
42
+ title: string;
43
+ fullname?: string;
44
+ };
45
+ /** The key a reference is looked up and reported by: its fullname, else its title. */
46
+ export declare function dataModelRefKey(ref: DataModelRef): string;
47
+ /** Whether the current assistant surface may use the data model with this title. */
48
+ export declare function isDataModelAvailableToAi(title: string, httpClient?: HttpClient): Promise<boolean>;
49
+ /**
50
+ * The data models, of those given, the current assistant surface may not use, reported by
51
+ * {@link dataModelRefKey}. A plain string is a title.
52
+ */
53
+ export declare function findDataModelsClosedToAi(refs: Array<string | DataModelRef>, httpClient?: HttpClient): Promise<Set<string>>;
54
+ /**
55
+ * Throws {@link DataModelAiAccessDeniedError} when any of a dashboard's data models is closed to
56
+ * AI. The refusal names no model: these titles come from the dashboard, not from the user, and
57
+ * the model must not learn a closed one.
58
+ */
59
+ export declare function assertDataModelsAvailableToAi(refs: Array<string | DataModelRef>, httpClient?: HttpClient): Promise<void>;
60
+ /** Throws {@link DataModelAiAccessDeniedError} when the titled data model is closed to AI. */
61
+ export declare function assertDataModelAvailableToAi(title: string, httpClient?: HttpClient): Promise<void>;
62
+ /**
63
+ * Throws {@link DataModelAiAccessDeniedError} when the data model is closed to AI. A perspective
64
+ * oid resolves to its parent data model server-side.
65
+ */
66
+ export declare function assertDataModelOidAvailableToAi(oid: string, httpClient?: HttpClient): Promise<void>;
67
+ /** Keeps the items whose data model (by title) the current assistant surface may use. */
68
+ export declare function filterDataModelsAvailableToAi<T>(items: T[], dataModelTitleOf: (item: T) => string, httpClient?: HttpClient): Promise<T[]>;
@@ -1,6 +1,7 @@
1
1
  import { DashboardChangeEvent, DashboardConfig, DashboardProps, WidgetProps, WidgetsPanelColumnLayout } from '@sisense/sdk-ui';
2
2
  import { HttpClient } from '@sisense/sdk-rest-client';
3
3
  import { JaqlDataSourceForDto } from '@sisense/sdk-data';
4
+ import { WidgetPlacement } from '../../engines/build-dashboard/layout/place-widget';
4
5
  export type DashboardChangeResult = {
5
6
  changed: boolean;
6
7
  updatedDashboardProps: DashboardProps;
@@ -10,7 +11,8 @@ export type DashboardChangeResult = {
10
11
  */
11
12
  export declare function extractWidgetIdsFromLayout(layout: WidgetsPanelColumnLayout): string[];
12
13
  /**
13
- * Remove cells that reference non-existent widgets, empty rows, and empty columns
14
+ * Remove cells that reference non-existent widgets, empty rows, and empty columns.
15
+ * Remaining cells in each row are rebalanced so they fill the free width.
14
16
  */
15
17
  export declare function cleanupOrphanedCells(layout: WidgetsPanelColumnLayout, existingWidgetIds: Set<string>): WidgetsPanelColumnLayout;
16
18
  /**
@@ -35,13 +37,17 @@ export declare function layoutDashboardWidgets(widgetOids: string[]): WidgetsPan
35
37
  * @returns The updated layout object with the new widget added.
36
38
  */
37
39
  export declare function withWidgetAdded(layout: WidgetsPanelColumnLayout, widgetId: string): WidgetsPanelColumnLayout;
40
+ export type WidgetLayoutAddition = {
41
+ widgetId: string;
42
+ placement?: WidgetPlacement;
43
+ };
38
44
  export declare function getBaseDashboardConfig(): DashboardConfig;
39
45
  export declare function createEmptyDashboard(dataSourceTitle: string, dashboardTitle: string, httpClient?: HttpClient): Promise<DashboardProps>;
40
46
  export declare function resetWidgetForDashboard(widget: WidgetProps): WidgetProps;
41
47
  export declare function addWidgetsToDashboard(dashboardProps: DashboardProps, widgetsToAdd: WidgetProps[]): DashboardProps;
42
- export declare function updateDashboardWidgetsLayout(dashboardProps: DashboardProps, newWidgetIds?: string[]): DashboardProps;
48
+ export declare function updateDashboardWidgetsLayout(dashboardProps: DashboardProps, additions?: WidgetLayoutAddition[]): DashboardProps;
43
49
  export declare function updateDashboardTitle(dashboardProps: DashboardProps, dashboardTitle: string): DashboardProps;
44
50
  export declare function createNewDashboard(dataSourceTitle: string, dashboardTitle: string, widgets?: WidgetProps[], httpClient?: HttpClient): Promise<DashboardProps>;
45
- export declare function addWidgetsToExistingDashboard(dashboardProps: DashboardProps, widgets: WidgetProps[]): DashboardProps;
51
+ export declare function addWidgetsToExistingDashboard(dashboardProps: DashboardProps, widgets: WidgetProps[], placements?: Array<WidgetPlacement | undefined>): DashboardProps;
46
52
  export declare function deleteWidgetsFromDashboard(dashboardProps: DashboardProps, widgetIds: string[]): DashboardProps;
47
53
  export declare function changeDashboard(dashboardProps: DashboardProps, event: DashboardChangeEvent): DashboardChangeResult;
@@ -1,4 +1,5 @@
1
- import { DashboardProps, WidgetDto, WidgetProps, DashboardDto } from '@sisense/sdk-ui';
1
+ import { DashboardProps, WidgetProps } from '@sisense/sdk-ui';
2
+ import { WidgetDto, DashboardDto } from '@sisense/sdk-ui/sisense-internal';
2
3
  import { HttpClient } from '@sisense/sdk-rest-client';
3
4
  import { Filter, FilterRelations, JaqlDataSourceForDto } from '@sisense/sdk-data';
4
5
  type GetDashboardsOptions = {
@@ -33,7 +34,19 @@ export declare function patchFusionDashboard(dashboardOid: string, dashboard: Pa
33
34
  */
34
35
  export declare function addWidgetToFusionDashboard(dashboardOid: string, widgetDto: WidgetDto, httpClient?: HttpClient): Promise<WidgetDto | null>;
35
36
  /**
36
- * Create an empty dashboard
37
+ * Create an empty dashboard.
38
+ *
39
+ * `settings.managedByTool` has no reader left in this repo. It was added in SNS-122541 as one half
40
+ * of a matched pair — the write here, and `managedByTool === 'studio-assistant'` filters in
41
+ * `getAvailableFusionDashboards` and `getFusionDashboardProps`, both marked "TEMP: for public
42
+ * preview" — and SNS-130621 removed both filters and left the write. Nothing in `@sisense/sdk-ui`
43
+ * reads it either; `DashboardSettings.managedByTool?: string` is only the REST payload shape.
44
+ *
45
+ * Kept anyway, because whether Fusion itself acts on it (attribution, a badge, an edit
46
+ * restriction) cannot be answered from this repo — removing it is a cross-repo question, not
47
+ * drive-by cleanup, and the failure mode is silent: assistant-built dashboards would just stop
48
+ * being attributable. Tracked in SNS-133717: verify the PrismWebClient side, then either remove
49
+ * the write or replace this block with a pointer to the real consumer.
37
50
  */
38
51
  export declare function createEmptyFusionDashboard(dashboardTitle: string, dataSource: JaqlDataSourceForDto, httpClient?: HttpClient): Promise<DashboardDto | null>;
39
52
  /**
@@ -41,7 +54,15 @@ export declare function createEmptyFusionDashboard(dashboardTitle: string, dataS
41
54
  */
42
55
  export declare function deleteFusionDashboard(dashboardOid: string, httpClient?: HttpClient): Promise<void>;
43
56
  /**
44
- * Get available Fusion dashboards (filtered by studio-assistant)
57
+ * Get every Fusion dashboard the requesting user can access (SNS-130621).
58
+ *
59
+ * Authorization is the server's: `GET /api/v1/dashboards` returns exactly what this user is
60
+ * permitted to see, which is why opening this up is not privilege escalation — the previous
61
+ * `managedByTool === 'studio-assistant'` filter was a public-preview scope limit layered on top of
62
+ * an already-authorized list, not an access control.
63
+ *
64
+ * Returns the full accessible set. Callers that hand this to an LLM must bound it themselves —
65
+ * see `getDashboardsEngine`.
45
66
  */
46
67
  export declare function getAvailableFusionDashboards(httpClient?: HttpClient): Promise<Dashboard[]>;
47
68
  /**
@@ -52,10 +73,19 @@ export declare function getFusionDashboardProps(dashboardOid: string, httpClient
52
73
  * Load existing dashboard from Fusion
53
74
  */
54
75
  export declare function loadExistingDashboardFromFusion(dashboardId: string, httpClient?: HttpClient): Promise<DashboardProps>;
76
+ /**
77
+ * Translates widgets to Fusion widget DTOs. Throws when one cannot be translated, so a caller can
78
+ * build every DTO before it changes anything on the server.
79
+ * @param widgets - Widgets to translate.
80
+ * @param dashboardDataSource - The dashboard's data source. Fusion requires one on every widget,
81
+ * and a widget that runs no query (the Dashboard Narrative) has none of its own.
82
+ * @returns One DTO per widget, in order.
83
+ */
84
+ export declare function toFusionWidgetDtos(widgets: WidgetProps[], dashboardDataSource?: JaqlDataSourceForDto): WidgetDto[];
55
85
  /**
56
86
  * Add widgets to Fusion dashboard
57
87
  */
58
- export declare function addWidgetsToFusionDashboard(dashboardOid: string, widgetsToAdd: WidgetProps[], httpClient?: HttpClient): Promise<WidgetDto[]>;
88
+ export declare function addWidgetsToFusionDashboard(dashboardOid: string, widgetsToAdd: WidgetProps[], httpClient?: HttpClient, dashboardDataSource?: JaqlDataSourceForDto): Promise<WidgetDto[]>;
59
89
  /**
60
90
  * Update Fusion dashboard filters
61
91
  */
@@ -1,5 +1,6 @@
1
1
  import { DataSourceField, JaqlDataSourceForDto } from '@sisense/sdk-data';
2
2
  import { HttpClient } from '@sisense/sdk-rest-client';
3
+ import { AiGraphQlOperation } from '../hide-from-ai/hide-from-ai';
3
4
  export declare const DATA_SOURCES_API_URL_PATH = "api/datasources";
4
5
  /**
5
6
  * Mirrors CSDK {@link DisplayNameConfig} from `@sisense/sdk-query-client/dispatcher`
@@ -17,6 +18,50 @@ export type DataSourceFieldWithDescription = DataSourceField & {
17
18
  description?: string;
18
19
  tableDescription?: string;
19
20
  };
21
+ /**
22
+ * Designer-authored semantic facets available at model, table and column level via
23
+ * the aifields API. All facets are optional and omitted when unset.
24
+ */
25
+ export type AiFieldFacets = {
26
+ description?: string;
27
+ tags?: string[];
28
+ aiContext?: string;
29
+ displayName?: string;
30
+ };
31
+ /** Response of endpoint A: model-level facets + per-table facets (no columns). */
32
+ export type AiFieldsModelResponse = AiFieldFacets & {
33
+ tables?: (AiFieldFacets & {
34
+ table: string;
35
+ })[];
36
+ };
37
+ /** Response of endpoint B: one table's facets + its per-column facets. */
38
+ export type AiFieldsTableResponse = AiFieldFacets & {
39
+ table: string;
40
+ columns?: (AiFieldFacets & {
41
+ column: string;
42
+ })[];
43
+ };
44
+ /** Facets for a data source, keyed for lookup during summary rendering. */
45
+ export type DataSourceAiFields = {
46
+ model: AiFieldFacets;
47
+ tablesByName: Record<string, AiFieldFacets>;
48
+ columnsByTable: Record<string, Record<string, AiFieldFacets>>;
49
+ };
50
+ /**
51
+ * Reserved tag: a table or column carrying it is removed from the schema before it is
52
+ * sent to any LLM (SNS-131767). Governance/privacy guarantee — applied unconditionally.
53
+ * Matched case-insensitively and trimmed.
54
+ */
55
+ export declare const HIDE_FROM_AI_TAG = "hide_from_ai";
56
+ /** True when the facets entry is tagged hide_from_ai. */
57
+ export declare function isHiddenFromAi(facets?: AiFieldFacets): boolean;
58
+ /**
59
+ * Return a copy of the facets with every hide_from_ai entity removed: hidden tables
60
+ * drop out of `tablesByName` (and `columnsByTable`), and hidden columns drop out of
61
+ * each surviving table's column map. Used so no hidden table/column name leaks into
62
+ * the tool result, not just the field list (SNS-131767).
63
+ */
64
+ export declare function stripHiddenFromAiFields(aiFields: DataSourceAiFields): DataSourceAiFields;
20
65
  export type NormalizedDataSourceField = {
21
66
  table: string;
22
67
  column: string;
@@ -35,22 +80,106 @@ export type DataSourceWithStatus = JaqlDataSourceForDto & {
35
80
  * createPerspective, etc.
36
81
  */
37
82
  oid?: string;
83
+ /**
84
+ * User-editable label (PR-762 / FR-032). Nullable and LABEL-ONLY: render
85
+ * `displayName ?? title`, but keep binding queries, JAQL, permissions and every
86
+ * tool argument to the immutable `title`. Read from the model's default perspective
87
+ * through `elasticubesMetadata.displayName` (model-graphql !2571), so a rename shows
88
+ * without a build and drafts carry it too; where that field is not served yet, the
89
+ * copy `/api/datasources` took at the last build (see {@link getDataSources}).
90
+ */
91
+ displayName?: string;
38
92
  };
93
+ /**
94
+ * The label to show for a data source: the user-editable display name when it has one,
95
+ * otherwise the immutable identity title (PR-762 / FR-032). Blank and whitespace-only
96
+ * values count as unset, matching the backend's own "no new label to promote" rule.
97
+ *
98
+ * Uniqueness (FR-011): the EFFECTIVE name — what this function returns — is unique per
99
+ * tenant, compared case-insensitively, enforced at request time by an FE pre-check and
100
+ * an authoritative BE write (`PerspectiveDisplayNameAlreadyExists`). There is no DB
101
+ * unique index in v1, so it is an application-level guarantee, the same one identity
102
+ * `title` has always had. Two rows therefore cannot render the same label.
103
+ *
104
+ * What it does NOT preclude: a display name equalling the identity title of a model
105
+ * that has itself been renamed, since that model's effective name is its own label, not
106
+ * its title. That residual case is why callers which must stay unambiguous render the
107
+ * identity alongside the label instead of relying on the label alone.
108
+ */
109
+ export declare function effectiveDisplayName(dataSource: Pick<DataSourceWithStatus, 'title' | 'displayName'>): string;
110
+ /**
111
+ * A display name as stored: trimmed, and `undefined` when unset or blank. Blank and null
112
+ * both mean "no label" — the identity title is the effective name then.
113
+ * @param displayName - Raw label from a wire payload.
114
+ * @returns The trimmed label, or `undefined` when there is none.
115
+ */
116
+ export declare function normalizeDisplayName(displayName: string | null | undefined): string | undefined;
117
+ /**
118
+ * An `elasticubesMetadata` read that leaves out models tagged `hide_from_ai` (SNS-135153), with
119
+ * the plain query for servers without the `availableFor` argument.
120
+ */
121
+ export declare function elasticubesMetadataOperation(operationName: string, fields: string): AiGraphQlOperation;
122
+ /**
123
+ * Display names of the default perspective of every ECM model, keyed by model oid. A key
124
+ * whose value is `undefined` is a model that exists and has no label (unset or cleared).
125
+ * `null` means the request failed — older model-graphql without the field, restricted
126
+ * permissions — so the caller keeps whatever label it already has. A model whose
127
+ * `displayName` field errored is left out of the map, so its row keeps its label too:
128
+ * a failed field is not a cleared label.
129
+ */
130
+ export type ElasticubeDisplayNames = Map<string, string | undefined> | null;
131
+ export declare function fetchElasticubeDisplayNames(client: HttpClient): Promise<ElasticubeDisplayNames>;
39
132
  export declare function getDataSources(httpClient?: HttpClient): Promise<DataSourceWithStatus[]>;
133
+ /**
134
+ * Resolve a data source title to its `datamodelOid` — the value the schema and perspective tools
135
+ * take as `datamodelOid`.
136
+ *
137
+ * Covers **every ECM-managed data model, live as well as extract**: the metadata query reports a
138
+ * `type` of `'extract' | 'live'` and both carry an oid and a readable schema. Returns `undefined`
139
+ * only when nothing in ECM matches the title — a data source backed by a bare connection rather
140
+ * than a model, or a title that does not exist.
141
+ *
142
+ * Cheaper than `getDataSources`, which also lists the queryable sources: this hits only the
143
+ * elasticubes-metadata query, which is the sole place the oid comes from. Matches exactly first,
144
+ * then case-insensitively — callers echo back a canonical title whose case may differ from what the
145
+ * user typed.
146
+ */
147
+ export declare function getDatamodelOidByTitle(dataSourceTitle: string, httpClient?: HttpClient): Promise<string | undefined>;
40
148
  /**
41
149
  * Get a data source by title in a viewer-safe way (list + local filter).
42
150
  * Prefer this over GET api/datasources/{title}, which requires manage/viewschema.
43
151
  */
44
152
  export declare function getDataSourceByTitle(dataSourceTitle: string, httpClient?: HttpClient): Promise<JaqlDataSourceForDto | null>;
45
153
  /**
46
- * Get data source fields via CSDK QueryApiDispatcher.
47
- * Omit displayNameConfig (or leave flags false) → viewer-safe fields/search.
154
+ * Get data source fields via CSDK {@link QueryApiDispatcher.getDataSourceFields}.
155
+ * Pass `displayNameConfig` from app settings when available.
48
156
  */
49
157
  export declare function getDataSourceFields(dataSourceTitle: string, options?: GetDataSourceFieldsOptions): Promise<DataSourceField[] | null>;
50
158
  /**
51
159
  * Get data source fields with descriptions from schema
52
160
  */
53
161
  export declare function getDataSourceFieldsWithDescriptions(dataSourceTitle: string, options?: GetDataSourceFieldsOptions): Promise<DataSourceFieldWithDescription[] | DataSourceField[]>;
162
+ /**
163
+ * Get model-level and per-table AI fields (endpoint A). No columns.
164
+ */
165
+ export declare function getDataSourceAiFields(dataSourceTitle: string, httpClient?: HttpClient): Promise<AiFieldsModelResponse | null>;
166
+ /**
167
+ * Get per-column AI fields for a single table (endpoint B).
168
+ */
169
+ export declare function getTableAiFields(dataSourceTitle: string, tableName: string, httpClient?: HttpClient): Promise<AiFieldsTableResponse | null>;
170
+ /**
171
+ * Fetch designer AI fields for a data source: model + tables (A) once, then
172
+ * per-table columns (B) in parallel. Best-effort: any failure (e.g. the API is
173
+ * absent on older versions) degrades to null / partial data so the assistant's
174
+ * field tool keeps working without AI context.
175
+ *
176
+ * With `strict`, only an unsupported endpoint (404 or 405: an older server with no tags to read)
177
+ * degrades quietly; any other failure is thrown, so a caller that must not mistake an unread tag
178
+ * for "not hidden" can tell the two apart (SNS-136150).
179
+ */
180
+ export declare function fetchDataSourceAiFields(dataSourceTitle: string, tableNames: string[], httpClient?: HttpClient, options?: {
181
+ strict?: boolean;
182
+ }): Promise<DataSourceAiFields | null>;
54
183
  /**
55
184
  * Normalize data source fields (pure function - easily testable)
56
185
  */
@@ -0,0 +1,8 @@
1
+ import { JaqlDataSourceForDto } from '@sisense/sdk-data';
2
+ import { HttpClient } from '@sisense/sdk-rest-client';
3
+ /**
4
+ * Like `getDataSourceByTitle` (the viewer-safe data source list), but a title in another case
5
+ * also matches: exact first, then case-insensitive, as `getDatamodelOidByTitle` does for callers
6
+ * that echo a title back. Not exported from the package root.
7
+ */
8
+ export declare function findDataSourceByTitle(dataSourceTitle: string, httpClient?: HttpClient): Promise<JaqlDataSourceForDto | null>;