@vizzly/services 0.11.0 → 0.12.0-dev-2ab7e33d0cfee4465500870d9b623dac4802c30e

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 (97) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/services/src/Services/{CellServices.d.ts → Cell.d.ts} +4 -4
  3. package/dist/services/src/Services/{DashboardServices.d.ts → Dashboard.d.ts} +6 -6
  4. package/dist/services/src/Services/{HeaderServices.d.ts → Header.d.ts} +1 -1
  5. package/dist/services/src/Services/{ComponentLibraryServices.d.ts → Library.d.ts} +8 -8
  6. package/dist/services/src/Services/{RowServices.d.ts → Row.d.ts} +1 -1
  7. package/dist/services/src/Services/View.d.ts +65 -0
  8. package/dist/services/src/VizzlyLoader.d.ts +44 -0
  9. package/dist/services/src/errors/TimeoutWaitingForVizzlyInstance.d.ts +3 -0
  10. package/dist/services/src/errors/VizzlyInstanceNotLoaded.d.ts +3 -0
  11. package/dist/services/src/index.d.ts +124 -31
  12. package/dist/services/src/schemaValidations/dashboard.d.ts +3 -3
  13. package/dist/services/src/schemaValidations/filters.d.ts +1 -1
  14. package/dist/services/src/schemaValidations/library.d.ts +2 -2
  15. package/dist/shared-logic/src/Callbacks/types.d.ts +2 -0
  16. package/dist/shared-logic/src/Component/sharedSchemas.d.ts +1 -1
  17. package/dist/shared-logic/src/Dashboard/fromRaw.d.ts +4 -0
  18. package/dist/shared-logic/src/Dashboard/types.d.ts +8 -0
  19. package/dist/shared-logic/src/DashboardAPI/dataSets.d.ts +2 -5
  20. package/dist/shared-logic/src/GlobalLibrary/GlobalLibrary.d.ts +1 -0
  21. package/dist/shared-logic/src/GlobalLibrary/fromRaw.d.ts +10 -0
  22. package/dist/shared-logic/src/GlobalLibrary/index.d.ts +2 -0
  23. package/dist/shared-logic/src/GlobalLibrary/types.d.ts +16 -0
  24. package/dist/shared-logic/src/QueryEngineConfig/loadQueryEngineConfig.d.ts +2 -2
  25. package/dist/shared-logic/src/QueryEngineConfig/supportedConstants.d.ts +125 -0
  26. package/dist/shared-logic/src/Theme/types.d.ts +1 -0
  27. package/dist/shared-logic/src/Translations/translateQueryEngineConfig.d.ts +3 -0
  28. package/dist/shared-logic/src/Translations/translation.types.d.ts +43 -8
  29. package/dist/shared-logic/src/ViewConfiguration/types.d.ts +4 -0
  30. package/dist/shared-logic/src/errors/InvalidIdentityPropType.d.ts +4 -0
  31. package/dist/shared-logic/src/getVizzly.d.ts +5 -0
  32. package/package.json +13 -4
  33. package/dist/services/src/Services/APIServices.d.ts +0 -155
  34. package/dist/services/src/Services/ViewServices.d.ts +0 -61
  35. package/dist/shared-logic/src/AI/types.d.ts +0 -31
  36. package/dist/shared-logic/src/ApiResource/index.d.ts +0 -7
  37. package/dist/shared-logic/src/DashboardAPI/clientDashboardSchema.d.ts +0 -3
  38. package/dist/shared-logic/src/DashboardAPI/dashboardAPI/creating.d.ts +0 -19
  39. package/dist/shared-logic/src/DashboardAPI/dashboardAPI/updating.d.ts +0 -19
  40. package/dist/shared-logic/src/DashboardAPI/dashboardAPI.d.ts +0 -17
  41. package/dist/shared-logic/src/DashboardAPI/dashboardManager.d.ts +0 -9
  42. package/dist/shared-logic/src/DashboardPermission/index.d.ts +0 -7
  43. package/dist/shared-logic/src/DashboardPermission/types.d.ts +0 -12
  44. package/dist/shared-logic/src/Project/types.d.ts +0 -74
  45. package/dist/shared-logic/src/api/index.d.ts +0 -66
  46. package/dist/shared-logic/src/api/queryEngine/createDashboard.d.ts +0 -20
  47. package/dist/shared-logic/src/api/queryEngine/multiGetDashboards.d.ts +0 -7
  48. package/dist/shared-logic/src/api/queryEngine/updateDashboard.d.ts +0 -13
  49. package/dist/shared-logic/src/api/vizzly/aiActions.d.ts +0 -18
  50. package/dist/shared-logic/src/api/vizzly/aiHelpers/buildAIResponse.d.ts +0 -5
  51. package/dist/shared-logic/src/api/vizzly/aiHelpers/buildDataSets.d.ts +0 -4
  52. package/dist/shared-logic/src/api/vizzly/aiHelpers/checkAiResponseStatus.d.ts +0 -3
  53. package/dist/shared-logic/src/api/vizzly/aiHelpers/types.d.ts +0 -23
  54. package/dist/shared-logic/src/api/vizzly/aiHelpers/validateAndUpcastAIAttributes.d.ts +0 -4
  55. package/dist/shared-logic/src/api/vizzly/aiHelpers/view.d.ts +0 -10
  56. package/dist/shared-logic/src/api/vizzly/askAi.d.ts +0 -6
  57. package/dist/shared-logic/src/api/vizzly/askAiForQuestionSuggestions.d.ts +0 -4
  58. package/dist/shared-logic/src/api/vizzly/createDashboard.d.ts +0 -20
  59. package/dist/shared-logic/src/api/vizzly/createDashboardAccess.d.ts +0 -8
  60. package/dist/shared-logic/src/api/vizzly/createProjectApiKey.d.ts +0 -2
  61. package/dist/shared-logic/src/api/vizzly/createQueryEngineUser.d.ts +0 -2
  62. package/dist/shared-logic/src/api/vizzly/createSelfHostedDynamicQueryEngine.d.ts +0 -3
  63. package/dist/shared-logic/src/api/vizzly/createSelfHostedInBrowserQueryEngineProject.d.ts +0 -3
  64. package/dist/shared-logic/src/api/vizzly/createSelfHostedQueryEngineProject.d.ts +0 -3
  65. package/dist/shared-logic/src/api/vizzly/createVizzlyConfigVersion.d.ts +0 -2
  66. package/dist/shared-logic/src/api/vizzly/getConnection.d.ts +0 -7
  67. package/dist/shared-logic/src/api/vizzly/getManagedQueryEngineKeyPair.d.ts +0 -5
  68. package/dist/shared-logic/src/api/vizzly/getParentDashboards.d.ts +0 -9
  69. package/dist/shared-logic/src/api/vizzly/getProject.d.ts +0 -3
  70. package/dist/shared-logic/src/api/vizzly/getQueryEngineUser.d.ts +0 -3
  71. package/dist/shared-logic/src/api/vizzly/getTeamMembers.d.ts +0 -11
  72. package/dist/shared-logic/src/api/vizzly/getVizzlyConfig.d.ts +0 -4
  73. package/dist/shared-logic/src/api/vizzly/multiGetDashboards.d.ts +0 -7
  74. package/dist/shared-logic/src/api/vizzly/multiGetEncryptedDashboards.d.ts +0 -7
  75. package/dist/shared-logic/src/api/vizzly/saveConnection.d.ts +0 -2
  76. package/dist/shared-logic/src/api/vizzly/saveEncryptedProjectEncryptionSecret.d.ts +0 -2
  77. package/dist/shared-logic/src/api/vizzly/saveScheduledReport.d.ts +0 -6
  78. package/dist/shared-logic/src/api/vizzly/updateDashboard.d.ts +0 -20
  79. package/dist/shared-logic/src/api/vizzly/updateProjectApiKey.d.ts +0 -6
  80. package/dist/shared-logic/src/api/vizzly/updateQueryEngineUser.d.ts +0 -2
  81. package/dist/shared-logic/src/errors/AIAborted.d.ts +0 -4
  82. package/dist/shared-logic/src/errors/AIContainsErrors.d.ts +0 -4
  83. package/dist/shared-logic/src/errors/AIFailedToFetch.d.ts +0 -4
  84. package/dist/shared-logic/src/errors/AIUsageLimitReached.d.ts +0 -4
  85. package/dist/shared-logic/src/errors/DashboardQuotaReached.d.ts +0 -4
  86. package/dist/shared-logic/src/errors/EncryptedProjectSecretAlreadyExists.d.ts +0 -4
  87. package/dist/shared-logic/src/errors/FailedToCreateDashboard.d.ts +0 -4
  88. package/dist/shared-logic/src/errors/FailedToCreateDashboardAccess.d.ts +0 -4
  89. package/dist/shared-logic/src/errors/FailedToGetDashboard.d.ts +0 -4
  90. package/dist/shared-logic/src/errors/FailedToSaveVizzlyConfigVersion.d.ts +0 -3
  91. package/dist/shared-logic/src/errors/FailedToUpdateDashboard.d.ts +0 -4
  92. package/dist/shared-logic/src/errors/ProjectEncryptedSecretAlreadySaved.d.ts +0 -4
  93. package/dist/shared-logic/src/errors/ReadOnlyPermissionNotFound.d.ts +0 -4
  94. package/dist/shared-logic/src/errors/ReadPermissionNotFound.d.ts +0 -4
  95. package/dist/shared-logic/src/errors/VizzlyApiCallErrorFailedToSetupProject.d.ts +0 -4
  96. package/dist/shared-logic/src/errors/WritePermissionNotFound.d.ts +0 -4
  97. package/dist/shared-logic/src/errors/index.d.ts +0 -5
@@ -1,5 +1,5 @@
1
- import * as ViewServices from './ViewServices';
2
1
  import { AdditionalFilter } from 'shared-logic/src/AdditionalFilter/types';
2
+ import { AnyView } from './View';
3
3
  /**
4
4
  * Represents a CellAttributes type.
5
5
  * @param component - The component contained within the cell. Optional.
@@ -7,7 +7,7 @@ import { AdditionalFilter } from 'shared-logic/src/AdditionalFilter/types';
7
7
  * @param localFilters - The local filters of the cell. Optional.
8
8
  */
9
9
  export declare type CellAttributes = {
10
- component?: ViewServices.View;
10
+ component?: AnyView;
11
11
  colSpan?: number;
12
12
  localFilters?: AdditionalFilter[];
13
13
  };
@@ -18,7 +18,7 @@ export declare class Cell {
18
18
  /**
19
19
  * The component contained within the cell. It's optional and can be undefined.
20
20
  */
21
- component: ViewServices.View | undefined;
21
+ component: AnyView | undefined;
22
22
  /**
23
23
  * The span of the cell in terms of columns. Defaults to 12.
24
24
  */
@@ -54,7 +54,7 @@ export declare class Cell {
54
54
  *
55
55
  * @param component The component to be set in the cell.
56
56
  */
57
- setComponent(component: ViewServices.View): void;
57
+ setComponent(component: AnyView): void;
58
58
  /**
59
59
  * Clears the component from the cell and optionally sets a new column span.
60
60
  * Marks the cell as empty.
@@ -1,8 +1,8 @@
1
- import * as DashboardTypes from '../../../shared-logic/src/Dashboard/types';
2
- import { Row } from './RowServices';
3
- import { CustomField } from '../../../shared-logic/src/CustomField/types';
4
- import { Header } from './HeaderServices';
5
- import { Library } from './ComponentLibraryServices';
1
+ import * as DashboardTypes from 'shared-logic/src/Dashboard/types';
2
+ import { Row } from './Row';
3
+ import { CustomField } from 'shared-logic/src/CustomField/types';
4
+ import { Header } from './Header';
5
+ import { Library } from './Library';
6
6
  /** Custom fields for a dashboard */
7
7
  export declare type CustomFields = {
8
8
  [dataSetId: string]: Array<CustomField>;
@@ -21,7 +21,7 @@ export declare type DashboardAttributes = {
21
21
  /**
22
22
  * Represents a Dashboard class.
23
23
  */
24
- export declare class Dashboard<T> {
24
+ export declare class Dashboard {
25
25
  private dashboard;
26
26
  /**
27
27
  * Constructs a new instance of the Dashboard class.
@@ -1,4 +1,4 @@
1
- import { DisplayRow } from '../../../shared-logic/src/Display/types';
1
+ import { DisplayRow } from 'shared-logic/src/Display/types';
2
2
  export declare type HeaderRow = DisplayRow[];
3
3
  /**
4
4
  * Represents a Header class.
@@ -1,12 +1,12 @@
1
1
  import { AdditionalFilter } from 'shared-logic/src/AdditionalFilter/types';
2
- import { Cell } from './CellServices';
3
- import * as ViewServices from './ViewServices';
2
+ import { Cell } from './Cell';
3
+ import * as Views from './View';
4
4
  /**
5
5
  * Represents a Library class.
6
6
  * @param components The `component` instance to be added to the library. `uniqueViewId` of the component, should always be the same and not auto-generated.
7
7
  */
8
- export declare type LibrayView = {
9
- component: ViewServices.View;
8
+ export declare type LibraryView = {
9
+ component: Views.AnyView;
10
10
  uniqueViewId: string;
11
11
  };
12
12
  export declare class Library {
@@ -20,7 +20,7 @@ export declare class Library {
20
20
  * @param components The `component` instance to be added to the library. `uniqueViewId` of the component, should always be the same and not auto-generated.
21
21
  */
22
22
  constructor(attributes?: {
23
- components?: LibrayView[];
23
+ components?: LibraryView[];
24
24
  });
25
25
  /**
26
26
  * Adds a cell to the library at a specified position or appends it at the end if no position is specified.
@@ -30,7 +30,7 @@ export declare class Library {
30
30
  * @example library.addComponent(Vizzly.AreaChart, "uniqueViewId");
31
31
  * @example library.addComponent(Vizzly.AreaChart, "uniqueViewId", { position: 0 });
32
32
  */
33
- addComponent(component: ViewServices.View, uniqueViewId: string, attributes?: {
33
+ addComponent(component: Views.AnyView, uniqueViewId: string, attributes?: {
34
34
  position?: number;
35
35
  localFilters?: AdditionalFilter[];
36
36
  }): void;
@@ -38,6 +38,6 @@ export declare class Library {
38
38
  * Adds an array of cells to the library.
39
39
  * @param components The `component` instance to be added to the library. `uniqueViewId` of the component, should always be the same and not auto-generated.
40
40
  */
41
- addComponents(components: LibrayView[]): void;
41
+ addComponents(components: LibraryView[]): void;
42
42
  }
43
- export declare const mergeInViewId: (component: ViewServices.View, uniqueViewId: string) => ViewServices.View;
43
+ export declare const mergeInViewId: (component: Views.AnyView, uniqueViewId: string) => Views.AnyView;
@@ -1,4 +1,4 @@
1
- import { Cell } from './CellServices';
1
+ import { Cell } from './Cell';
2
2
  /**
3
3
  * Represents a Row class.
4
4
  */
@@ -0,0 +1,65 @@
1
+ import type { Component } from 'shared-logic/src/Component/types';
2
+ import { ViewConfiguration as ViewConfigurationImported } from 'shared-logic/src/ViewConfiguration/types';
3
+ import { Vizzly } from '..';
4
+ export declare type ViewConfiguration = ViewConfigurationImported;
5
+ declare type RequiredAttributes<T extends Component.Attributes> = {
6
+ dataSetId: T['dataSetId'];
7
+ };
8
+ export declare class View<T extends Component.Attributes> {
9
+ attributes: T;
10
+ protected vizzly: Vizzly;
11
+ constructor(attributes: Partial<T> & {
12
+ type: T['type'];
13
+ } & RequiredAttributes<T>);
14
+ updateAttributes(newAttributes: Partial<T>): void;
15
+ }
16
+ export declare type AnyView = AreaChart | LineChart | BarChart | PieChart | ScatterChart | ComboChart | PivotTable | BasicTable | HorizontalBarChart | MercatorMap | SingleStat | Progress;
17
+ export declare class AreaChart extends View<Component.AreaChartAttributes> {
18
+ constructor(attributes: Partial<Component.AreaChartAttributes> & RequiredAttributes<Component.AreaChartAttributes>);
19
+ static type(): Component.AreaChartAttributes['type'];
20
+ }
21
+ export declare class LineChart extends View<Component.LineChartAttributes> {
22
+ constructor(attributes: Partial<Component.LineChartAttributes> & RequiredAttributes<Component.LineChartAttributes>);
23
+ static type(): Component.LineChartAttributes['type'];
24
+ }
25
+ export declare class BarChart extends View<Component.BarChartAttributes> {
26
+ constructor(attributes: Partial<Component.BarChartAttributes> & RequiredAttributes<Component.BarChartAttributes>);
27
+ static type(): Component.BarChartAttributes['type'];
28
+ }
29
+ export declare class PieChart extends View<Component.PieChartAttributes> {
30
+ constructor(attributes: Partial<Component.PieChartAttributes> & RequiredAttributes<Component.PieChartAttributes>);
31
+ static type(): Component.PieChartAttributes['type'];
32
+ }
33
+ export declare class ScatterChart extends View<Component.ScatterChartAttributes> {
34
+ constructor(attributes: Partial<Component.ScatterChartAttributes> & RequiredAttributes<Component.ScatterChartAttributes>);
35
+ static type(): Component.ScatterChartAttributes['type'];
36
+ }
37
+ export declare class ComboChart extends View<Component.ComboChartAttributes> {
38
+ constructor(attributes: Partial<Component.ComboChartAttributes> & RequiredAttributes<Component.ComboChartAttributes>);
39
+ static type(): Component.ComboChartAttributes['type'];
40
+ }
41
+ export declare class PivotTable extends View<Component.DataTableAttributes> {
42
+ constructor(attributes: Partial<Component.DataTableAttributes> & RequiredAttributes<Component.DataTableAttributes>);
43
+ static type(): Component.DataTableAttributes['type'];
44
+ }
45
+ export declare class BasicTable extends View<Component.BasicTableAttributes> {
46
+ constructor(attributes: Partial<Component.BasicTableAttributes> & RequiredAttributes<Component.BasicTableAttributes>);
47
+ static type(): Component.BasicTableAttributes['type'];
48
+ }
49
+ export declare class HorizontalBarChart extends View<Component.HorizontalBarChartAttributes> {
50
+ constructor(attributes: Partial<Component.HorizontalBarChartAttributes> & RequiredAttributes<Component.HorizontalBarChartAttributes>);
51
+ static type(): Component.HorizontalBarChartAttributes['type'];
52
+ }
53
+ export declare class MercatorMap extends View<Component.MercatorMapAttributes> {
54
+ constructor(attributes: Partial<Component.MercatorMapAttributes> & RequiredAttributes<Component.MercatorMapAttributes>);
55
+ static type(): Component.MercatorMapAttributes['type'];
56
+ }
57
+ export declare class SingleStat extends View<Component.SingleStatAttributes> {
58
+ constructor(attributes: Partial<Component.SingleStatAttributes> & RequiredAttributes<Component.SingleStatAttributes>);
59
+ static type(): Component.SingleStatAttributes['type'];
60
+ }
61
+ export declare class Progress extends View<Component.ProgressAttributes> {
62
+ constructor(attributes: Partial<Component.ProgressAttributes> & RequiredAttributes<Component.ProgressAttributes>);
63
+ static type(): Component.ProgressAttributes['type'];
64
+ }
65
+ export {};
@@ -0,0 +1,44 @@
1
+ import { QueryEngineConfig, QueryEngineEndpoint } from 'shared-logic/src/QueryEngineConfig/types';
2
+ import { identityCallback, loadDataSetsCallback, loadQueryEngineConfigCallback } from 'shared-logic/src/Callbacks/types';
3
+ import { IdentityConfig } from 'shared-logic/src/IdentityConfig/types';
4
+ import { DashboardStorageStrategy } from 'shared-logic/src/DashboardAPI/types';
5
+ import { VizzlyTranslations } from 'shared-logic/src/Translations/translation.types';
6
+ import { DataSet } from 'shared-logic/src/DataSet/types';
7
+ export declare type LoaderOptions = {
8
+ apiHost: string;
9
+ textOverrides?: VizzlyTranslations;
10
+ developerMode?: boolean;
11
+ };
12
+ declare type AccessTokens = Awaited<ReturnType<identityCallback>>;
13
+ /**
14
+ * A class to manage the up-front setting up of Vizzly.
15
+ * For example, fetching data sets, the query engine config and
16
+ * access tokens used for the identity logic.
17
+ */
18
+ export declare class VizzlyLoader {
19
+ private queryEngineConfig;
20
+ private dataSets;
21
+ private queryEngine;
22
+ private loadAccessTokens;
23
+ private loadDataSetsCallback?;
24
+ options: LoaderOptions;
25
+ constructor(queryEngine: 'in-browser' | QueryEngineEndpoint | loadQueryEngineConfigCallback | undefined, loadAccessTokens: identityCallback, loadDataSetsCallback?: loadDataSetsCallback, options?: LoaderOptions);
26
+ getQueryEngineConfig(): Promise<QueryEngineConfig>;
27
+ getIdentity(): Promise<{
28
+ accessTokens: AccessTokens;
29
+ identityConfig: IdentityConfig;
30
+ }>;
31
+ getDataSets(): Promise<DataSet[]>;
32
+ load(): Promise<{
33
+ queryEngineConfig: QueryEngineConfig;
34
+ dataSets: DataSet[];
35
+ identityConfig: IdentityConfig;
36
+ dashboardStorageStrategy: DashboardStorageStrategy;
37
+ }>;
38
+ /**
39
+ * Where should dashboards be fetched and saved from? Via the Query Engine for encryption
40
+ * or direct to the Vizzly API for non-encrypted storage.
41
+ */
42
+ getDashboardStorageStrategy(queryEngineConfig: QueryEngineConfig): DashboardStorageStrategy;
43
+ }
44
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare class TimeoutWaitingForVizzlyInstance extends Error {
2
+ constructor(instanceId: string, timeout: number);
3
+ }
@@ -0,0 +1,3 @@
1
+ export declare class VizzlyInstanceNotLoaded extends Error {
2
+ constructor(instanceId: string);
3
+ }
@@ -1,32 +1,125 @@
1
- import { QueryEngineConfig, QueryEngineEndpoint } from '../../shared-logic/src/QueryEngineConfig/types';
2
- import * as ViewServices from './Services/ViewServices';
3
- import { Cell } from './Services/CellServices';
4
- import { Row } from './Services/RowServices';
5
- import { Dashboard } from './Services/DashboardServices';
6
- import { Header } from './Services/HeaderServices';
7
- import { Library } from './Services/ComponentLibraryServices';
8
- import { loadQueryEngineConfigCallback } from '../../shared-logic/src/Callbacks/types';
9
- import { API } from './Services/APIServices';
10
- export declare class Vizzly {
11
- static queryEngineConfig: QueryEngineConfig | undefined;
12
- static queryEngineEndpoint: QueryEngineEndpoint | loadQueryEngineConfigCallback | 'in-browser' | undefined;
13
- static load(configUrl: QueryEngineEndpoint | loadQueryEngineConfigCallback | 'in-browser'): Promise<QueryEngineConfig | null>;
14
- static get Dashboard(): typeof Dashboard;
15
- static get Library(): typeof Library;
16
- static get Cell(): typeof Cell;
17
- static get Row(): typeof Row;
18
- static get Header(): typeof Header;
19
- static get API(): typeof API;
20
- static AreaChart: typeof ViewServices.AreaChart;
21
- static LineChart: typeof ViewServices.LineChart;
22
- static BarChart: typeof ViewServices.BarChart;
23
- static PieChart: typeof ViewServices.PieChart;
24
- static ScatterChart: typeof ViewServices.ScatterChart;
25
- static ComboChart: typeof ViewServices.ComboChart;
26
- static PivotTable: typeof ViewServices.PivotTable;
27
- static BasicTable: typeof ViewServices.BasicTable;
28
- static HorizontalBarChart: typeof ViewServices.HorizontalBarChart;
29
- static MercatorMap: typeof ViewServices.MercatorMap;
30
- static SingleStat: typeof ViewServices.SingleStat;
31
- static Progress: typeof ViewServices.Progress;
1
+ import { QueryEngineConfig, QueryEngineEndpoint } from 'shared-logic/src/QueryEngineConfig/types';
2
+ import { identityCallback, loadDataSetsCallback, loadQueryEngineConfigCallback, programmaticDashboardCallback } from 'shared-logic/src/Callbacks/types';
3
+ import { IdentityConfig } from 'shared-logic/src/IdentityConfig/types';
4
+ import { DashboardStorageStrategy } from 'shared-logic/src/DashboardAPI/types';
5
+ import { DataSet } from 'shared-logic/src/DataSet/types';
6
+ import { Dashboard as DashboardFromAPI } from '@vizzly/api-client';
7
+ import * as DashboardLogic from 'shared-logic/src/Dashboard';
8
+ import * as GlobalLibraryLogic from 'shared-logic/src/GlobalLibrary';
9
+ import { LoaderOptions } from './VizzlyLoader';
10
+ import { Row } from './Services/Row';
11
+ import { Cell } from './Services/Cell';
12
+ import { Dashboard } from './Services/Dashboard';
13
+ import { Header } from './Services/Header';
14
+ import { Library } from './Services/Library';
15
+ import * as Views from './Services/View';
16
+ import { ViewConfiguration } from 'shared-logic/src/ViewConfiguration/types';
17
+ export type { ViewConfiguration } from 'shared-logic/src/ViewConfiguration/types';
18
+ export { VizzlyInstanceNotLoaded } from './errors/VizzlyInstanceNotLoaded';
19
+ export declare type Options = {
20
+ apiHost: string;
21
+ };
22
+ export declare type FilterDashboardOptions = {
23
+ onlyAllowScope?: 'read' | 'read_write';
24
+ onlyChildDashboardsForParent?: string;
25
+ onlyChildDashboards?: boolean;
26
+ onlyParentDashboards?: boolean;
27
+ onlyDashboardsIncludingMetadata?: DashboardLogic.Dashboard['metadata'];
28
+ };
29
+ export declare type VizzlyServicesProperties = {
30
+ queryEngine: 'in-browser' | QueryEngineEndpoint | loadQueryEngineConfigCallback | undefined;
31
+ identity: identityCallback;
32
+ programmaticDashboard?: programmaticDashboardCallback;
33
+ dataSets?: loadDataSetsCallback;
34
+ };
35
+ declare class VizzlyServices {
36
+ private queryEngineConfig;
37
+ private dataSets;
38
+ private identityConfig;
39
+ private vizzlyAPIClient;
40
+ private programmaticDashboard;
41
+ static _instanceStore: {
42
+ [instanceId: string]: VizzlyServices;
43
+ };
44
+ static DEFAULT_INSTANCE_ID: string;
45
+ constructor(identityConfig: IdentityConfig, queryEngineConfig: QueryEngineConfig, dataSets: DataSet[], dashboardStorageStrategy: DashboardStorageStrategy, programmaticDashboard: programmaticDashboardCallback | undefined, options: {
46
+ host: string;
47
+ });
48
+ /**
49
+ * @param properties
50
+ * @param options
51
+ * @returns Vizzly instance for programmatically managing dashboards.
52
+ */
53
+ static load(properties: VizzlyServicesProperties, options?: LoaderOptions): Promise<VizzlyServices>;
54
+ static use(instanceId?: string): VizzlyServices;
55
+ static waitToUse(instanceId?: string, timeoutMs?: number): Promise<any>;
56
+ static clearInstances(): void;
57
+ /**
58
+ * Use the dashboard API to create the dashboard, upcast
59
+ * and return the dashboard with the data sets.
60
+ */
61
+ createDashboard(params: CreateDashboardParams): Promise<DashboardLogic.Dashboard>;
62
+ updateDashboard(params: UpdateDashboardParams): Promise<DashboardLogic.Dashboard>;
63
+ getDashboards(params?: {
64
+ abortController?: AbortController;
65
+ }): Promise<DashboardLogic.Dashboard[]>;
66
+ getGlobalLibraries(params?: {
67
+ abortController?: AbortController;
68
+ }): Promise<GlobalLibraryLogic.GlobalLibrary[]>;
69
+ /**
70
+ * Provides the configuration needed for each Vizzly view.
71
+ */
72
+ getViewConfiguration(): ViewConfiguration;
73
+ getIdentityConfig(): IdentityConfig;
74
+ static upcastDashboard(dashboard: DashboardFromAPI, dataSets: DataSet[], queryEngineConfig: QueryEngineConfig): Array<DashboardLogic.Dashboard>;
75
+ static filterDashboards(dashboards: DashboardLogic.Dashboard[], options: FilterDashboardOptions): DashboardLogic.Dashboard[];
76
+ static validateDashboard(dashboard: unknown): void;
77
+ static Row: typeof Row;
78
+ static Cell: typeof Cell;
79
+ static Dashboard: typeof Dashboard;
80
+ static Header: typeof Header;
81
+ static Library: typeof Library;
82
+ static AreaChart: typeof Views.AreaChart;
83
+ static LineChart: typeof Views.LineChart;
84
+ static BarChart: typeof Views.BarChart;
85
+ static PieChart: typeof Views.PieChart;
86
+ static ScatterChart: typeof Views.ScatterChart;
87
+ static ComboChart: typeof Views.ComboChart;
88
+ static PivotTable: typeof Views.PivotTable;
89
+ static BasicTable: typeof Views.BasicTable;
90
+ static HorizontalBarChart: typeof Views.HorizontalBarChart;
91
+ static MercatorMap: typeof Views.MercatorMap;
92
+ static SingleStat: typeof Views.SingleStat;
93
+ static Progress: typeof Views.Progress;
32
94
  }
95
+ export declare type UpdateDashboardParams = {
96
+ dashboardId: string;
97
+ definition?: DashboardLogic.SaveableDashboardDefinition;
98
+ deleted?: boolean;
99
+ metadata?: Object;
100
+ /** @deprecated Use metadata instead. */
101
+ meta?: Object;
102
+ abortSignal?: AbortSignal;
103
+ };
104
+ export declare type CreateDashboardParams = {
105
+ definition: DashboardLogic.SaveableDashboardDefinition;
106
+ /** @deprecated - use `metadata` instead */
107
+ meta?: Object;
108
+ /**
109
+ * The metadata for the dashboard.
110
+ *
111
+ * @property {any} meta - The metadata for the dashboard can be set to anything you require.
112
+ *
113
+ */
114
+ metadata?: Object;
115
+ /**
116
+ * The ID of the parent dashboard.
117
+ *
118
+ * @property {string} parentDashboardId - The ID of the parent dashboard.
119
+ * @default The default parent dashboard ID.
120
+ */
121
+ parentDashboardId: string;
122
+ abortSignal?: AbortSignal;
123
+ };
124
+ export declare type Vizzly = VizzlyServices;
125
+ export declare const Vizzly: typeof VizzlyServices;
@@ -1,4 +1,4 @@
1
- import { CreateDashboard, UpdateDashboardOptions } from '../Services/APIServices';
2
1
  import { QueryEngineConfig } from 'shared-logic/src/QueryEngineConfig/types';
3
- export declare const validateCreateDashboardParams: (params: CreateDashboard, queryEngineConfig: QueryEngineConfig | undefined) => void;
4
- export declare const validateUpdateDashboardParams: (params: UpdateDashboardOptions) => void;
2
+ import { CreateDashboardParams, UpdateDashboardParams } from '..';
3
+ export declare const validateCreateDashboardParams: (params: CreateDashboardParams, queryEngineConfig: QueryEngineConfig | undefined) => void;
4
+ export declare const validateUpdateDashboardParams: (params: UpdateDashboardParams, queryEngineConfig: QueryEngineConfig) => void;
@@ -1,3 +1,3 @@
1
1
  import { AdditionalFilter } from 'shared-logic/src/AdditionalFilter/types';
2
2
  import { QueryEngineConfig } from 'shared-logic/src/QueryEngineConfig/types';
3
- export declare function validateAndSetLocalFilters(localFilters: AdditionalFilter[], queryEngineConfig?: QueryEngineConfig): AdditionalFilter[];
3
+ export declare function validateAndSetLocalFilters(localFilters: AdditionalFilter[], queryEngineConfig: QueryEngineConfig): AdditionalFilter[];
@@ -1,2 +1,2 @@
1
- import { LibrayView } from '../Services/ComponentLibraryServices';
2
- export declare function validateLibraryComponent(item: LibrayView): void;
1
+ import { LibraryView } from '../Services/Library';
2
+ export declare function validateLibraryComponent(item: LibraryView): void;
@@ -1,8 +1,10 @@
1
+ import { SaveableDashboardDefinition } from '../Dashboard/types';
1
2
  import { DataSet } from '../DataSet/types';
2
3
  import { IdentityConfig } from '../IdentityConfig/types';
3
4
  import { DataMap } from '../JSQueryEngine/types';
4
5
  import { QueryEngineConfig } from '../QueryEngineConfig/types';
5
6
  declare type CallbackError = null;
7
+ export declare type programmaticDashboardCallback = (dataSets: DataSet[]) => Promise<Array<Partial<SaveableDashboardDefinition>>>;
6
8
  export declare type loadDataSetsCallback = (identityConfig: IdentityConfig, queryEngineConfig: QueryEngineConfig) => Promise<Array<DataSet>>;
7
9
  export declare type IdentityTokens = {
8
10
  dashboardAccessToken: string;
@@ -3,7 +3,7 @@ import { SupportedAggregates } from '../Aggregate';
3
3
  import { QueryEngineConfig } from '../QueryEngineConfig/types';
4
4
  import { SupportedTimeTruncFunctions } from '../TimeDimension/types';
5
5
  import { ComponentInterfaceConfig } from '../ComponentInterface/types';
6
- export declare const measureSchema: (supportedAggregates: SupportedAggregates, attributeSchemaOptions: ComponentInterfaceConfig['attributesSchemaOptions']) => Joi.ObjectSchema<any> | Joi.AlternativesSchema<any>;
6
+ export declare const measureSchema: (supportedAggregates: SupportedAggregates, attributeSchemaOptions: ComponentInterfaceConfig['attributesSchemaOptions']) => Joi.AlternativesSchema<any> | Joi.ObjectSchema<any>;
7
7
  export declare const orderSchema: (queryEngineConfig: QueryEngineConfig) => Joi.ObjectSchema<any>;
8
8
  export declare const timeDimensionSchema: (supportedTimeTruncFunctions: SupportedTimeTruncFunctions) => Joi.ObjectSchema<any>;
9
9
  export declare const dimensionSchema: (supportedTimeTruncFunctions: SupportedTimeTruncFunctions, attributeSchemaOptions: ComponentInterfaceConfig['attributesSchemaOptions']) => Joi.ArraySchema<any[]>;
@@ -14,5 +14,9 @@ export declare type RawDashboard<Definition = RawDefinition> = {
14
14
  updated_at: string;
15
15
  metadata?: Dashboard.ExternalMetadata;
16
16
  webhook_id: string | null;
17
+ permission: {
18
+ scope: 'read' | 'read_write';
19
+ token: string;
20
+ };
17
21
  };
18
22
  export declare const fromRaw: (rawDashboard: RawDashboard, queryEngineConfig: QueryEngineConfig | undefined) => Omit<Dashboard, 'dataSets'>;
@@ -13,6 +13,9 @@ export declare type Dashboard = {
13
13
  id: string;
14
14
  parentDashboardId: string | null;
15
15
  metadata: Dashboard.ExternalMetadata;
16
+ /**
17
+ * @deprecated
18
+ */
16
19
  theme: StoredTheme;
17
20
  display: Display;
18
21
  webhookId: string | null;
@@ -23,8 +26,13 @@ export declare type Dashboard = {
23
26
  isPlayground: boolean;
24
27
  createdAt: Date;
25
28
  updatedAt: Date;
29
+ /** @deprecated */
26
30
  protectedByOrganisation?: boolean;
27
31
  isProgrammatic?: boolean;
32
+ permission?: {
33
+ scope: 'read' | 'read_write';
34
+ token: string;
35
+ };
28
36
  };
29
37
  export declare type SaveableDashboardDefinition = {
30
38
  display: DisplayDumped;
@@ -1,12 +1,9 @@
1
1
  import Joi from '@vizzly/joi';
2
- import { loadDataSetsCallback } from 'shared-logic/src/Callbacks/types';
3
- import { IdentityConfig } from 'shared-logic/src/IdentityConfig/types';
2
+ import { loadDataSetsCallback, loadQueryEngineConfigCallback } from 'shared-logic/src/Callbacks/types';
4
3
  import { QueryEngineEndpoint } from 'shared-logic/src/QueryEngineConfig/types';
5
- import { DataSet } from '../DataSet/types';
6
- export declare type DataSetsCallback = (identityConfig: IdentityConfig) => Promise<Array<DataSet> | null>;
7
4
  export interface Property {
8
5
  schema: Joi.Schema;
9
6
  }
10
7
  declare const dataSets: Property;
11
8
  export default dataSets;
12
- export declare const withReturnValidation: (dataSets?: DataSetsCallback, querEngineEndpoint?: QueryEngineEndpoint) => loadDataSetsCallback;
9
+ export declare const withReturnValidation: (dataSets: loadDataSetsCallback | undefined, queryEngineEndpoint: QueryEngineEndpoint | loadQueryEngineConfigCallback | undefined) => loadDataSetsCallback;
@@ -0,0 +1 @@
1
+ export * from './fromRaw';
@@ -0,0 +1,10 @@
1
+ import { GlobalLibrary, GlobalLibraryLibrary } from './types';
2
+ export declare type RawGlobalLibrary = {
3
+ id: string;
4
+ name: string;
5
+ library: GlobalLibraryLibrary;
6
+ created_at: string;
7
+ updated_at: string;
8
+ parent_global_library_id: string;
9
+ };
10
+ export declare const fromRaw: (rawGlobalLibrary: RawGlobalLibrary) => GlobalLibrary;
@@ -0,0 +1,2 @@
1
+ export * from './GlobalLibrary';
2
+ export * from './types';
@@ -0,0 +1,16 @@
1
+ import { Component } from '../Component/types';
2
+ import { CustomField } from '../CustomField/types';
3
+ export declare type GlobalLibraryLibrary = {
4
+ views?: Component[];
5
+ customFields?: {
6
+ [dataSetId: string]: Array<CustomField>;
7
+ };
8
+ };
9
+ export declare type GlobalLibrary = {
10
+ id: string;
11
+ name: string;
12
+ library: GlobalLibraryLibrary;
13
+ createdAt: Date;
14
+ updatedAt: Date;
15
+ parentGlobalLibraryId: string;
16
+ };
@@ -1,3 +1,3 @@
1
1
  import { QueryEngineConfig, QueryEngineEndpoint } from '../QueryEngineConfig/types';
2
- import { loadQueryEngineConfigCallback } from '../Callbacks/types';
3
- export declare const loadQueryEngineConfig: (loadQueryEngineConfig: loadQueryEngineConfigCallback | QueryEngineEndpoint) => Promise<QueryEngineConfig>;
2
+ import { loadQueryEngineConfigCallback, loadDataSetsCallback } from '../Callbacks/types';
3
+ export declare const loadQueryEngineConfig: (loadQueryEngineConfig: loadQueryEngineConfigCallback | QueryEngineEndpoint, userProvidedLoadDataSetsCallback: loadDataSetsCallback | undefined) => Promise<QueryEngineConfig>;