@vizzly/semantic-layer-public 0.0.227 → 0.0.228

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.
@@ -0,0 +1,140 @@
1
+ import { PartialBy } from '@vizzly/api-client';
2
+ import { Client, NormalizedDataType, SQLQuery, AnyConnection } from '@vizzly/sqlbuilder-public';
3
+ import { SQLOperator } from '@vizzly/sqlbuilder-public';
4
+ export declare namespace nSemanticLayer {
5
+ export namespace Result {
6
+ type Content = any[][];
7
+ }
8
+ export type Result = {
9
+ content: Result.Content;
10
+ hasMoreResults: boolean | null;
11
+ };
12
+ export type DataAccessConfig = {
13
+ projectId?: string;
14
+ dataSetIds: string[] | '*';
15
+ secureFilters: {
16
+ [dataSetId: string]: {
17
+ field: string;
18
+ op: SQLOperator;
19
+ value: any;
20
+ function?: string;
21
+ }[][];
22
+ };
23
+ parameters?: Object;
24
+ expires: string;
25
+ signature: string;
26
+ };
27
+ type Field = {
28
+ /**
29
+ * ID of the field. Should rarely change as the charts,
30
+ * tables and maps will reference this.
31
+ */
32
+ id: string;
33
+ /** Public facing field description */
34
+ description?: string;
35
+ /**
36
+ Name of the field, public facing.
37
+
38
+ If no publicName is provided, then the field is private.
39
+ */
40
+ publicName?: string;
41
+ /** Database native field type. e.g BIGINT instead of normalized type number */
42
+ dataType: string;
43
+ /** Can the field be used in groupings */
44
+ canBeDimension?: boolean;
45
+ /** Can the field be used in metrics (e.g mean, mode etc...) */
46
+ canBeMeasure?: boolean;
47
+ /** What time granularities can be used? e.g month, day, hour, minute... */
48
+ allowedGranularities?: string[];
49
+ /** What comparison operators can be used? e.g =, <, <= */
50
+ allowedOperators?: string[];
51
+ };
52
+ export type AddressField = Field & {
53
+ address: string[];
54
+ };
55
+ export type SQLField = Field & {
56
+ sql: string;
57
+ };
58
+ export type JoinOn = {
59
+ type: 'rightJoin' | 'leftJoin' | 'innerJoin' | 'outerJoin' | 'leftOuterJoin' | 'rightOuterJoin';
60
+ left: AddressField['address'];
61
+ right: AddressField['address'];
62
+ as?: string;
63
+ };
64
+ export type DataSet = {
65
+ /** Unique ID of the data set */
66
+ id: string;
67
+ /** Public name of the data set */
68
+ name: string;
69
+ /** Which connection does this data set relate too? */
70
+ connectionId?: string;
71
+ /** Should the field be hidden from the frontend? */
72
+ hide?: boolean;
73
+ /** Public facing description of the data set. */
74
+ description?: string;
75
+ secureFilterGuards?: SecureFilterGuard[];
76
+ sql?: string;
77
+ /** parameters used to interpolate into the SQL for testing. */
78
+ testParameters?: string;
79
+ /** Fields in the data set... */
80
+ fields: (AddressField | SQLField)[];
81
+ /** What joins are needed on underlying tables to make the right fields available? */
82
+ joins?: JoinOn[];
83
+ /** permanent filters */
84
+ permanentFilters?: SQLQuery['filter'];
85
+ };
86
+ export type PublicDataSet = {
87
+ id: string;
88
+ name: string;
89
+ hide?: boolean;
90
+ description?: string;
91
+ preAggregated?: undefined | false | Array<string>;
92
+ fields: Array<{
93
+ id: string;
94
+ publicName: string;
95
+ description?: string;
96
+ dataType: NormalizedDataType;
97
+ canBeDimension?: boolean;
98
+ canBeMeasure?: boolean;
99
+ allowedGranularities: string[];
100
+ allowedOperators: string[];
101
+ }>;
102
+ };
103
+ export type SecureFilterGuard = {
104
+ fieldId: string;
105
+ op: SQLOperator;
106
+ };
107
+ export type SqlViewStore = {
108
+ [sqlViewId: string]: SqlView;
109
+ };
110
+ export type SqlView = {
111
+ sql: string;
112
+ name: string;
113
+ };
114
+ export type Config = {
115
+ version: 1;
116
+ dataSets: DataSet[];
117
+ executableDashboardConfigForPDF: string | null;
118
+ publicKeys: string[];
119
+ sqlViews: SqlViewStore;
120
+ connections: {
121
+ [connectionId: string]: {
122
+ client: Client;
123
+ name?: string;
124
+ encryptedCredentials?: string;
125
+ unencryptedCredentials?: AnyConnection;
126
+ };
127
+ };
128
+ };
129
+ export type LoadedConfig = PartialBy<Config, 'connections' | 'publicKeys' | 'sqlViews' | 'executableDashboardConfigForPDF'>;
130
+ export {};
131
+ }
132
+ export type OldConfig = {
133
+ dataSets: nSemanticLayer.Config['dataSets'];
134
+ executableDashboardConfigForPDF?: nSemanticLayer.Config['executableDashboardConfigForPDF'];
135
+ publicKeyCertificates?: nSemanticLayer.Config['publicKeys'];
136
+ sqlViews?: nSemanticLayer.Config['sqlViews'];
137
+ connection?: {
138
+ client?: Client;
139
+ };
140
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/types.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export type OriginId = 'direct' | 'environment' | 'vizzly_api' | 'github' | 'remote' | 's3' | 'file' | 'encrypted_blob';
2
2
  export type * from './QueryEngineConfig/types';
3
+ export type * from './types/semanticLayerConfig';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizzly/semantic-layer-public",
3
- "version": "0.0.227",
3
+ "version": "0.0.228",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,10 +21,10 @@
21
21
  "jest": "^29.7.0",
22
22
  "ts-jest": "^29.1.2",
23
23
  "typescript": "^5.4.5",
24
- "@vizzly/sqlbuilder-public": "0.1.30"
24
+ "@vizzly/sqlbuilder-public": "0.1.31"
25
25
  },
26
26
  "peerDependencies": {
27
- "@vizzly/sqlbuilder-public": "0.1.30",
27
+ "@vizzly/sqlbuilder-public": "0.1.31",
28
28
  "@vizzly/joi": "^17.11.0"
29
29
  }
30
30
  }