@vizzly/services 0.15.0-dev-3d764e5c2346be462bbcf7327369903e64b96b40 → 0.15.1-dev-7c85efb9d70a7b5e5367d265c0b48faf46ecac6e

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 (61) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/results-driver/src/driver/VizzlyQuery/AdditionalFilter/toQueries.d.ts +3 -7
  3. package/dist/results-driver/src/driver/VizzlyQuery/AreaChart/toQueries.d.ts +2 -2
  4. package/dist/results-driver/src/driver/VizzlyQuery/BarChart/toQueries.d.ts +2 -2
  5. package/dist/results-driver/src/driver/VizzlyQuery/BarChartV2/toQueries.d.ts +2 -2
  6. package/dist/results-driver/src/driver/VizzlyQuery/BasicTable/toQueries.d.ts +2 -2
  7. package/dist/results-driver/src/driver/VizzlyQuery/FunnelChart/toQueries.d.ts +2 -2
  8. package/dist/results-driver/src/driver/VizzlyQuery/HorizontalBarChart/toQueries.d.ts +2 -2
  9. package/dist/results-driver/src/driver/VizzlyQuery/LineChart/toQueries.d.ts +2 -2
  10. package/dist/results-driver/src/driver/VizzlyQuery/LineChartV2/toQueries.d.ts +2 -2
  11. package/dist/results-driver/src/driver/VizzlyQuery/PieChart/toQueries.d.ts +2 -2
  12. package/dist/results-driver/src/driver/VizzlyQuery/PivotTable/toQueries.d.ts +2 -2
  13. package/dist/results-driver/src/driver/VizzlyQuery/RadarChart/toQueries.d.ts +2 -2
  14. package/dist/results-driver/src/driver/VizzlyQuery/RichText/toQueries.d.ts +2 -2
  15. package/dist/results-driver/src/driver/VizzlyQuery/SunburstChart/toQueries.d.ts +2 -2
  16. package/dist/results-driver/src/driver/VizzlyQuery/WaterfallChart/toQueries.d.ts +3 -9
  17. package/dist/results-driver/src/driver/VizzlyQuery/buildVizzlyQuery.d.ts +5 -5
  18. package/dist/results-driver/src/driver/VizzlyQuery/commonToQueries.d.ts +1 -1
  19. package/dist/results-driver/src/types.d.ts +0 -2
  20. package/dist/services/src/VizzlyLoader.d.ts +1 -3
  21. package/dist/services/src/index.d.ts +0 -5
  22. package/dist/shared-logic/src/AdditionalFilter/AdditionalFilter.d.ts +7 -9
  23. package/dist/shared-logic/src/AdditionalFilter/FilterConfig.d.ts +3 -14
  24. package/dist/shared-logic/src/AdditionalFilter/toQueryAttributesFilter.d.ts +2 -2
  25. package/dist/shared-logic/src/AdditionalFilter/types.d.ts +2 -6
  26. package/dist/shared-logic/src/Component/sharedSchemas.d.ts +0 -2
  27. package/dist/shared-logic/src/Component/types.d.ts +7 -44
  28. package/dist/shared-logic/src/ComponentInterface/constants.d.ts +1 -1
  29. package/dist/shared-logic/src/ComponentInterface/types/namespaces.types.d.ts +15 -17
  30. package/dist/shared-logic/src/CustomField/AggregateMath/index.d.ts +1 -2
  31. package/dist/shared-logic/src/CustomField/Conditional/index.d.ts +2 -2
  32. package/dist/shared-logic/src/CustomField/CustomField.d.ts +1 -2
  33. package/dist/shared-logic/src/CustomField/CustomMetric/build.d.ts +1 -1
  34. package/dist/shared-logic/src/CustomField/DateCalculation/index.d.ts +1 -2
  35. package/dist/shared-logic/src/CustomField/Percentage/index.d.ts +5 -6
  36. package/dist/shared-logic/src/CustomField/RoundedNumber/index.d.ts +1 -2
  37. package/dist/shared-logic/src/CustomField/Rules/index.d.ts +2 -2
  38. package/dist/shared-logic/src/CustomField/SimpleMath/index.d.ts +1 -1
  39. package/dist/shared-logic/src/CustomField/types.d.ts +1 -6
  40. package/dist/shared-logic/src/DataPanelConfig/types.d.ts +1 -1
  41. package/dist/shared-logic/src/Filter/Filter.d.ts +4 -43
  42. package/dist/shared-logic/src/Filter/Where.d.ts +6 -0
  43. package/dist/shared-logic/src/Filter/combineFilters.d.ts +1 -0
  44. package/dist/shared-logic/src/Filter/types.d.ts +4 -2
  45. package/dist/shared-logic/src/FormatPanelConfig/types.d.ts +1 -3
  46. package/dist/shared-logic/src/JSQueryEngine/types.d.ts +8 -2
  47. package/dist/shared-logic/src/Query/Query.d.ts +3 -3
  48. package/dist/shared-logic/src/Query/buildFromQueryAttributes.d.ts +3 -3
  49. package/dist/shared-logic/src/Query/types.d.ts +109 -6
  50. package/dist/shared-logic/src/api/queryEngine/getRunQueriesCallback.d.ts +1 -2
  51. package/dist/shared-logic/src/getComponentInterface.d.ts +1 -1
  52. package/dist/shared-logic/src/utils/feedback.d.ts +2 -2
  53. package/package.json +1 -1
  54. package/dist/results-driver/src/driver/VizzlyQuery/HorizontalBarChartV2/toQueries.d.ts +0 -4
  55. package/dist/shared-logic/src/AliasFields/types.d.ts +0 -5
  56. package/dist/shared-logic/src/CustomField/AliasField/index.d.ts +0 -7
  57. package/dist/shared-logic/src/CustomField/constants.d.ts +0 -15
  58. package/dist/shared-logic/src/HorizontalBarChartV2/attributesSchema.d.ts +0 -3
  59. package/dist/shared-logic/src/HorizontalBarChartV2/constants.d.ts +0 -3
  60. package/dist/shared-logic/src/HorizontalBarChartV2/index.d.ts +0 -4
  61. package/dist/shared-logic/src/HorizontalBarChartV2/setAttributes.d.ts +0 -4
@@ -1,15 +1,108 @@
1
1
  import { DataSet } from '../DataSet/types';
2
- import { QueryNameSpace, SQLQuery } from '@vizzly/sqlbuilder-public';
3
- export type { QueryNameSpace } from '@vizzly/sqlbuilder-public';
2
+ export declare namespace QueryNameSpace {
3
+ /**
4
+ * Which direction should the values be sorted in?
5
+ */
6
+ type SortDirection = 'asc' | 'desc';
7
+ /**
8
+ * ID of the field. This is the same ID that is used in
9
+ * the data sets.
10
+ */
11
+ type Field = string;
12
+ /**
13
+ * Index of the measure to group the aggregates on.
14
+ * Index starts from 0.
15
+ */
16
+ type Group = {
17
+ index: number;
18
+ };
19
+ /**
20
+ * Index of the measure to sort the results by.
21
+ * Index starts from 0.
22
+ */
23
+ type Order = {
24
+ index: number;
25
+ direction: SortDirection;
26
+ };
27
+ /**
28
+ * Defines filters to apply on the query. This can be thought of
29
+ * as the WHERE clause in a SQL statement.
30
+ */
31
+ type Filter<Field, ComparisonOperator> = {
32
+ field: Field | BasicType;
33
+ op: ComparisonOperator;
34
+ value: any;
35
+ };
36
+ type SecureFilterGuard<ComparisonOperator> = {
37
+ fieldId: string;
38
+ op: ComparisonOperator;
39
+ };
40
+ /**
41
+ * Limit the number of results returned from the query.
42
+ */
43
+ type Limit = number;
44
+ /**
45
+ * Sets the offset of results to return.
46
+ */
47
+ type Offset = number;
48
+ type Cases<SupportedFunction = string, ComparisonOperator = string, MathsOp = string> = {
49
+ returns: BasicType | {
50
+ type: 'field';
51
+ value: string;
52
+ function: SupportedFunction;
53
+ };
54
+ filter: QueryNameSpace.Filter<QueryNameSpace.FieldDefinition<SupportedFunction, ComparisonOperator, MathsOp>, ComparisonOperator>[][];
55
+ };
56
+ type BasicType = {
57
+ type: 'number';
58
+ value: number;
59
+ } | {
60
+ type: 'string';
61
+ value: string;
62
+ } | {
63
+ type: 'null';
64
+ } | {
65
+ type: 'boolean';
66
+ value: boolean | null;
67
+ };
68
+ type ComplexType<SupportedFunction = string, ComparisonOperator = string, MathsOp = string> = {
69
+ type: 'field';
70
+ value: string;
71
+ function: SupportedFunction;
72
+ } | {
73
+ type: 'switchField';
74
+ value: {
75
+ cases: Cases<SupportedFunction, ComparisonOperator, MathsOp>[];
76
+ };
77
+ } | {
78
+ type: 'subquery';
79
+ value: SubQuery<SupportedFunction, ComparisonOperator, MathsOp>;
80
+ } | {
81
+ type: 'maths';
82
+ left: FieldDefinition<SupportedFunction, ComparisonOperator, MathsOp>;
83
+ op: MathsOp;
84
+ right: FieldDefinition<SupportedFunction, ComparisonOperator, MathsOp>;
85
+ } | {
86
+ type: 'date_maths';
87
+ left: FieldDefinition<SupportedFunction, ComparisonOperator, MathsOp>;
88
+ op: MathsOp;
89
+ right: FieldDefinition<SupportedFunction, ComparisonOperator, MathsOp>;
90
+ } | {
91
+ type: 'function';
92
+ function: SupportedFunction;
93
+ value: FieldDefinition<SupportedFunction, ComparisonOperator, MathsOp>;
94
+ };
95
+ type FieldDefinition<SupportedFunction = string, ComparisonOperator = string, MathsOp = string> = BasicType | ComplexType<SupportedFunction, ComparisonOperator, MathsOp>;
96
+ }
4
97
  export declare type MeasureDescription = {
5
98
  /** What is the underlying field of the data set? */
6
99
  field: DataSet.Field;
7
100
  /** What function was applied? */
8
101
  functionId: string;
9
102
  };
10
- export declare type SubQuery = {
11
- measure: [QueryNameSpace.FieldDefinition];
12
- filter: Query['filter'];
103
+ export declare type SubQuery<SupportedFunction = string, ComparisonOperator = string, MathsOp = string> = {
104
+ measure: [QueryNameSpace.FieldDefinition<SupportedFunction, ComparisonOperator, MathsOp>];
105
+ filter: QueryNameSpace.Filter<QueryNameSpace.FieldDefinition<SupportedFunction, ComparisonOperator, MathsOp>, ComparisonOperator>[][];
13
106
  };
14
107
  /** For when a query cannot be generalised into the TraditionalQuery format. We can provide a very specific query for a specific purpose. */
15
108
  declare type BasePreparedQuery<PreparedQueryType> = {
@@ -30,6 +123,16 @@ export declare type PreAggregatedQuery = BasePreparedQuery<'preAggregated'> & {
30
123
  };
31
124
  };
32
125
  export declare type PreparedQuery = UniqueArrayValuesQuery | PreAggregatedQuery;
33
- export declare type Query = Omit<SQLQuery, 'timeZone'> & {
126
+ /** Most commonly used query format. */
127
+ export declare type Query<SupportedFunction = string, ComparisonOperator = string, MathsOp = string> = {
128
+ type: 'query';
34
129
  timeZone?: string;
130
+ dataSetId: string;
131
+ measure: Array<QueryNameSpace.FieldDefinition<SupportedFunction, ComparisonOperator, MathsOp>>;
132
+ filter: QueryNameSpace.Filter<QueryNameSpace.FieldDefinition<SupportedFunction, ComparisonOperator, MathsOp>, ComparisonOperator>[][];
133
+ order: Array<QueryNameSpace.Order>;
134
+ group: Array<QueryNameSpace.Group>;
135
+ limit?: QueryNameSpace.Limit;
136
+ offset?: QueryNameSpace.Offset;
35
137
  };
138
+ export {};
@@ -9,7 +9,6 @@ import { Result } from '../../Result/types';
9
9
  import { DataSet } from '../../DataSet/types';
10
10
  import { IdentityConfig as IdentityConfigType } from '../../IdentityConfig/types';
11
11
  import { VariableList } from '../../Variables/types';
12
- import { AliasFields } from '../../AliasFields/types';
13
12
  declare type CallbackError = null;
14
13
  export declare type runQueriesCallback = (queries: Component.Attributes | AdditionalFilter | QueryAttributes[] | [PreparedQuery], params: {
15
14
  dataSets: DataSet[];
@@ -17,5 +16,5 @@ export declare type runQueriesCallback = (queries: Component.Attributes | Additi
17
16
  dataAccessToken?: string;
18
17
  filterConfig?: FilterConfig;
19
18
  }) => Promise<(Result | null)[] | Array<Result['content'] | null> | CallbackError>;
20
- declare const getRunQueriesCallback: (identityConfig: IdentityConfigType, queryEngineConfig: QueryEngineConfigType, timeRangeOptions: TimeRangeOptions, variables: VariableList, aliasFields: AliasFields, runQueries?: CustomDriver['runQueries'], data?: loadDataCallback, queryEngineEndpoint?: QueryEngineEndpoint, timeZone?: string) => runQueriesCallback;
19
+ declare const getRunQueriesCallback: (identityConfig: IdentityConfigType, queryEngineConfig: QueryEngineConfigType, timeRangeOptions: TimeRangeOptions, variables: VariableList, runQueries?: CustomDriver['runQueries'], data?: loadDataCallback, queryEngineEndpoint?: QueryEngineEndpoint, timeZone?: string) => runQueriesCallback;
21
20
  export default getRunQueriesCallback;
@@ -1,6 +1,6 @@
1
- import { BasicTableComponentInterface } from './BasicTable';
2
1
  import { Component, ComponentType } from './Component/types';
3
2
  import { ComponentInterface, ComponentInterfaceConfig } from './ComponentInterface/types';
3
+ import { BasicTableComponentInterface } from './BasicTable';
4
4
  declare function getComponentInterface(type: 'custom', config?: ComponentInterfaceConfig): ComponentInterface<Component.CustomViewAttributes>;
5
5
  declare function getComponentInterface(type: 'pieChart', config?: ComponentInterfaceConfig): ComponentInterface<Component.PieChartAttributes>;
6
6
  declare function getComponentInterface(type: 'bubbleChart', config?: ComponentInterfaceConfig): ComponentInterface<Component.BubbleChartAttributes>;
@@ -1,4 +1,4 @@
1
1
  import { Component } from '../../src/Component/types';
2
- export declare const getGroupingFeedbackMessage: (attributes: Component.Attributes) => string;
2
+ export declare const getGroupingFeedbackMessage: (attributes: Component.Attributes) => string | null;
3
3
  export declare const chartHasDimensions: (attributes: Component.Attributes) => boolean;
4
- export declare const createFeedback: (attribute: Component.Attributes) => string | true;
4
+ export declare const createFeedback: (attribute: Component.Attributes) => string | true | null;
package/package.json CHANGED
@@ -26,7 +26,7 @@
26
26
  "fix-type-alias": "tsc-alias -p tsconfig.json",
27
27
  "prepare": "yarn build"
28
28
  },
29
- "version": "0.15.0-dev-3d764e5c2346be462bbcf7327369903e64b96b40",
29
+ "version": "0.15.1-dev-7c85efb9d70a7b5e5367d265c0b48faf46ecac6e",
30
30
  "dependencies": {
31
31
  "@vizzly/api-client": "0.0.57",
32
32
  "@vizzly/joi": "^17.11.0",
@@ -1,4 +0,0 @@
1
- export declare const toQueries: (attributes: import("../../../../../shared-logic/src/Component/types").Component.AreaChartAttributes | import("../../../../../shared-logic/src/Component/types").Component.BarChartAttributes | import("../../../../../shared-logic/src/Component/types").Component.BasicTableAttributes | import("../../../../../shared-logic/src/Component/types").Component.BubbleChartV2Attributes | import("../../../../../shared-logic/src/Component/types").Component.DataTableAttributes | import("../../../../../shared-logic/src/Component/types").Component.FunnelChartAttributes | import("../../../../../shared-logic/src/Component/types").Component.HorizontalBarChartAttributes | import("../../../../../shared-logic/src/Component/types").Component.LineChartAttributes | import("../../../../../shared-logic/src/Component/types").Component.LineChartV2Attributes | import("../../../../../shared-logic/src/Component/types").Component.BarChartV2Attributes | import("../../../../../shared-logic/src/Component/types").Component.AreaChartV2Attributes | import("../../../../../shared-logic/src/Component/types").Component.PieChartAttributes | import("../../../../../shared-logic/src/Component/types").Component.SunburstChartAttributes | import("../../../../../shared-logic/src/Component/types").Component.RichTextAttributes | import("../../../../../shared-logic/src/Component/types").Component.WaterfallChartAttributes | import("../../../../../shared-logic/src/Component/types").Component.RadarChartAttributes | import("../../../../../shared-logic/src/Component/types").Component.HorizontalBarChartV2Attributes, dataSet: import("../../../../../shared-logic/src/DataSet/types").DataSet<import("../../../../../shared-logic/src/DataSet/types").DataSet.Field>, queryEngineConfig: import("@vizzly/semantic-layer-public/dist/types").QueryEngineConfig, params: import("../../../types").Params) => {
2
- queries: import("../../../../../shared-logic/src/Query/types").Query[];
3
- resultFields: import("../../../../../shared-logic/src/Result/types").Result.Field[][];
4
- };
@@ -1,5 +0,0 @@
1
- export declare type AliasFields = {
2
- [dataSetId: string]: {
3
- [fieldId: string]: string;
4
- };
5
- };
@@ -1,7 +0,0 @@
1
- import { Params } from '../../../../results-driver/src/types';
2
- import { DataSet } from '../../DataSet/types';
3
- import { Query } from '../../Query/types';
4
- import { QueryAttributes } from '../../QueryAttributes/types';
5
- import { QueryEngineConfig } from '../../QueryEngineConfig/types';
6
- import { AliasFieldType } from '../types';
7
- export declare const build: (measureAttribute: QueryAttributes.Measure, customField: AliasFieldType, _queryEngineConfig: QueryEngineConfig, dataSet: DataSet, _queryHasDimension: boolean, params: Params) => Query['measure'][number];
@@ -1,15 +0,0 @@
1
- import { Clause } from '../Filter/types';
2
- export declare const alwaysTrueFilter: {
3
- type: Clause.AND_WHERE;
4
- value: {
5
- type: Clause.WHERE;
6
- value: {
7
- field: {
8
- type: "number";
9
- value: number;
10
- };
11
- op: string;
12
- value: number;
13
- };
14
- }[];
15
- };
@@ -1,3 +0,0 @@
1
- import Joi from '@vizzly/joi';
2
- import { ComponentInterfaceConfig } from '../ComponentInterface/types';
3
- export declare const attributesSchema: (config: ComponentInterfaceConfig) => Joi.ObjectSchema<any>;
@@ -1,3 +0,0 @@
1
- import { ViewConstants } from '../ComponentInterface/types/namespaces.types';
2
- declare const CONSTANTS: ViewConstants;
3
- export default CONSTANTS;
@@ -1,4 +0,0 @@
1
- import { Component } from '../Component/types';
2
- import { LoadComponentInterface } from '../ComponentInterface/types';
3
- declare const HorizontalBarChart: LoadComponentInterface<Component.HorizontalBarChartV2Attributes, Component.HorizontalBarChartV2Attributes>;
4
- export default HorizontalBarChart;
@@ -1,4 +0,0 @@
1
- import { Component } from '../Component/types';
2
- import { ComponentInterfaceConfig } from '../ComponentInterface/types';
3
- declare const _default: (config: ComponentInterfaceConfig) => (horizontalBarChart: Component.HorizontalBarChartV2Attributes, partial: Partial<Component.HorizontalBarChartV2Attributes>) => Component.HorizontalBarChartV2Attributes;
4
- export default _default;