@vizzly/api-client 0.0.69 → 0.0.71
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.
|
@@ -2,7 +2,7 @@ import { Api } from './Api';
|
|
|
2
2
|
import { Authentication } from './Authentication';
|
|
3
3
|
import { nVizzlyQueryEngine, Request, extraHeaders, CreateDashboardParams, UpdateDashboardParams, UpdateGlobalLibraryParams, GlobalLibrary, CreateGlobalLibraryParams, GlobalLibraryPermissionFromAPI, RequestParams, DataOptimiser } from '../types';
|
|
4
4
|
import { nSemanticLayer } from '@vizzly/semantic-layer-public';
|
|
5
|
-
import { SQLSchema } from '@vizzly/sqlbuilder-public';
|
|
5
|
+
import { HighLevelSQLSchema, SQLSchema } from '@vizzly/sqlbuilder-public';
|
|
6
6
|
export declare class VizzlyQueryEngineApi extends Api {
|
|
7
7
|
constructor(auth: Authentication, host: string, extraHeaders?: extraHeaders);
|
|
8
8
|
buildCreateDashboardRequest(params: RequestParams<CreateDashboardParams>): Request<CreateDashboardParams & {
|
|
@@ -29,6 +29,19 @@ export declare class VizzlyQueryEngineApi extends Api {
|
|
|
29
29
|
results: Array<nSemanticLayer.Result>;
|
|
30
30
|
}>>;
|
|
31
31
|
private buildCreateResultsRequest;
|
|
32
|
+
collectTreePartInstructions(params: RequestParams<nVizzlyQueryEngine.CollectTreePartInstructionsParams>): Promise<import("../types").Response<{
|
|
33
|
+
treeParts: DataOptimiser.TreePartInstruction[];
|
|
34
|
+
}>>;
|
|
35
|
+
private buildCollectTreePartInstructionsRequest;
|
|
36
|
+
collectTableSchema(params: RequestParams<nVizzlyQueryEngine.CollectTableSchemaParams>): Promise<import("../types").Response<{
|
|
37
|
+
tableSchemaByConnection: {
|
|
38
|
+
[connectionId: string]: {
|
|
39
|
+
/** ID of the connection */
|
|
40
|
+
id: string;
|
|
41
|
+
} & HighLevelSQLSchema;
|
|
42
|
+
};
|
|
43
|
+
}>>;
|
|
44
|
+
private buildCollectTableSchemaRequest;
|
|
32
45
|
collectSchema(params: RequestParams<nVizzlyQueryEngine.CollectSchemaParams>): Promise<import("../types").Response<{
|
|
33
46
|
schemaByConnection: {
|
|
34
47
|
[connectionId: string]: {
|
|
@@ -110,6 +110,40 @@ class VizzlyQueryEngineApi extends Api_1.Api {
|
|
|
110
110
|
acceptedAuthParams: ['queryEngineApiKey', 'dashboardAccessToken'],
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
+
collectTreePartInstructions(params) {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
return yield this.execute(this.buildCollectTreePartInstructionsRequest(params));
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
buildCollectTreePartInstructionsRequest(params) {
|
|
119
|
+
return {
|
|
120
|
+
path: `/api/v1/data-optimiser/tree-part-instructions`,
|
|
121
|
+
method: 'post',
|
|
122
|
+
abortSignal: params.abortSignal,
|
|
123
|
+
body: {
|
|
124
|
+
company: { id: params.companyId },
|
|
125
|
+
treeTableAddress: params.treeTableAddress,
|
|
126
|
+
},
|
|
127
|
+
acceptedAuthParams: ['queryEngineApiKey'],
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
collectTableSchema(params) {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
return yield this.execute(this.buildCollectTableSchemaRequest(params));
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
buildCollectTableSchemaRequest(params) {
|
|
136
|
+
return {
|
|
137
|
+
path: `/api/v1/schema/tables`,
|
|
138
|
+
method: 'post',
|
|
139
|
+
abortSignal: params.abortSignal,
|
|
140
|
+
body: {
|
|
141
|
+
allowedConfigOrigins: params.allowedConfigOrigins,
|
|
142
|
+
dynamicConfig: params.dynamicConfig,
|
|
143
|
+
},
|
|
144
|
+
acceptedAuthParams: ['queryEngineApiKey'],
|
|
145
|
+
};
|
|
146
|
+
}
|
|
113
147
|
collectSchema(params) {
|
|
114
148
|
return __awaiter(this, void 0, void 0, function* () {
|
|
115
149
|
return yield this.execute(this.buildCollectSchemaRequest(params));
|
|
@@ -123,7 +157,7 @@ class VizzlyQueryEngineApi extends Api_1.Api {
|
|
|
123
157
|
body: {
|
|
124
158
|
allowedConfigOrigins: params.allowedConfigOrigins,
|
|
125
159
|
dynamicConfig: params.dynamicConfig,
|
|
126
|
-
filterColumnsByTable: params.filterColumnsByTable
|
|
160
|
+
filterColumnsByTable: params.filterColumnsByTable,
|
|
127
161
|
},
|
|
128
162
|
acceptedAuthParams: ['queryEngineApiKey'],
|
|
129
163
|
};
|
|
@@ -490,7 +524,7 @@ class VizzlyQueryEngineApi extends Api_1.Api {
|
|
|
490
524
|
internalCompanyConnection: params.internalCompanyConnection,
|
|
491
525
|
externalSnowflakeConnection: params.externalSnowflakeConnection,
|
|
492
526
|
transformations: params.transformations,
|
|
493
|
-
previousWorkflowResults: params.previousWorkflowResults
|
|
527
|
+
previousWorkflowResults: params.previousWorkflowResults,
|
|
494
528
|
},
|
|
495
529
|
acceptedAuthParams: ['queryEngineApiKey'],
|
|
496
530
|
};
|
|
@@ -521,7 +555,7 @@ class VizzlyQueryEngineApi extends Api_1.Api {
|
|
|
521
555
|
cascadingInstructions: params.cascadingInstructions,
|
|
522
556
|
primaryDateFieldId: params.primaryDateFieldId,
|
|
523
557
|
internalCompanyConnection: params.internalCompanyConnection,
|
|
524
|
-
previousWorkflowResults: params.previousWorkflowResults
|
|
558
|
+
previousWorkflowResults: params.previousWorkflowResults,
|
|
525
559
|
},
|
|
526
560
|
acceptedAuthParams: ['queryEngineApiKey'],
|
|
527
561
|
};
|
|
@@ -548,7 +582,7 @@ class VizzlyQueryEngineApi extends Api_1.Api {
|
|
|
548
582
|
snapshotDataSourceId: params.snapshotDataSourceId,
|
|
549
583
|
subsnapDataSourceId: params.subsnapDataSourceId,
|
|
550
584
|
snapshotFields: params.snapshotFields,
|
|
551
|
-
internalCompanyConnection: params.internalCompanyConnection
|
|
585
|
+
internalCompanyConnection: params.internalCompanyConnection,
|
|
552
586
|
},
|
|
553
587
|
acceptedAuthParams: ['queryEngineApiKey'],
|
|
554
588
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export * from './types/team';
|
|
|
9
9
|
export * from './types/user';
|
|
10
10
|
import { DataAccessConfig } from '@vizzly/auth';
|
|
11
11
|
import { nSemanticLayer, OriginId } from '@vizzly/semantic-layer-public';
|
|
12
|
-
import { SnowflakeConnection } from '@vizzly/sqlbuilder-public';
|
|
12
|
+
import { DatabaseColumn, SnowflakeConnection } from '@vizzly/sqlbuilder-public';
|
|
13
13
|
export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
14
14
|
export type UpdateDashboardResponseBody = {
|
|
15
15
|
dashboard: DashboardFromAPI;
|
|
@@ -113,6 +113,14 @@ export declare namespace nVizzlyQueryEngine {
|
|
|
113
113
|
dynamicConfig?: nSemanticLayer.Config;
|
|
114
114
|
secureFilters?: DataAccessConfig['secureFilters'];
|
|
115
115
|
};
|
|
116
|
+
type CollectTreePartInstructionsParams = {
|
|
117
|
+
companyId: string;
|
|
118
|
+
treeTableAddress: [string, string, string];
|
|
119
|
+
};
|
|
120
|
+
type CollectTableSchemaParams = {
|
|
121
|
+
allowedConfigOrigins: OriginId[];
|
|
122
|
+
dynamicConfig?: nSemanticLayer.Config;
|
|
123
|
+
};
|
|
116
124
|
type CollectSchemaParams = {
|
|
117
125
|
allowedConfigOrigins: OriginId[];
|
|
118
126
|
dynamicConfig?: nSemanticLayer.Config;
|
|
@@ -470,14 +478,40 @@ export type GlobalLibraryPermissionFromAPI = {
|
|
|
470
478
|
scope: 'read' | 'read_write';
|
|
471
479
|
};
|
|
472
480
|
export declare namespace DataOptimiser {
|
|
473
|
-
type
|
|
481
|
+
type RenameColumnInstruction = {
|
|
482
|
+
type: 'rename_column';
|
|
483
|
+
columnToRename: DatabaseColumn;
|
|
484
|
+
newColumnName: string;
|
|
485
|
+
};
|
|
486
|
+
type RemoveColumnInstruction = {
|
|
487
|
+
type: 'remove_column';
|
|
488
|
+
columnToRemove: DatabaseColumn;
|
|
489
|
+
};
|
|
490
|
+
type KeepColumnWithoutChangesInstruction = {
|
|
491
|
+
type: 'keep_column_without_changes';
|
|
492
|
+
column: DatabaseColumn;
|
|
493
|
+
};
|
|
494
|
+
export type ColumnInstruction = RenameColumnInstruction | RemoveColumnInstruction | KeepColumnWithoutChangesInstruction;
|
|
495
|
+
export type TreePartInstruction = {
|
|
496
|
+
type: 'branch' | 'trunk';
|
|
497
|
+
columnInstructions: Array<ColumnInstruction>;
|
|
498
|
+
filter: Array<{
|
|
499
|
+
columnName: string;
|
|
500
|
+
value: any;
|
|
501
|
+
}>;
|
|
502
|
+
uniqueDimensionValues: {
|
|
503
|
+
brands: string[];
|
|
504
|
+
mediaChannels: string[];
|
|
505
|
+
};
|
|
506
|
+
};
|
|
507
|
+
export type DataSourceFields = Array<{
|
|
474
508
|
id: string;
|
|
475
509
|
address: string[];
|
|
476
510
|
data_type: string;
|
|
477
511
|
normalized_data_type: 'string' | 'number' | 'date_time' | 'boolean';
|
|
478
512
|
}>;
|
|
479
|
-
type EphemeralDataSourceFields = Array<Omit<DataSourceFields[number], 'id'>>;
|
|
480
|
-
type DimensionFieldsMapping = Array<{
|
|
513
|
+
export type EphemeralDataSourceFields = Array<Omit<DataSourceFields[number], 'id'>>;
|
|
514
|
+
export type DimensionFieldsMapping = Array<{
|
|
481
515
|
field_id: string;
|
|
482
516
|
gti_dimension_key: 'brands' | 'regions' | 'media_channels';
|
|
483
517
|
dimension_values_mappings: Array<{
|
|
@@ -498,22 +532,22 @@ export declare namespace DataOptimiser {
|
|
|
498
532
|
* snapshot in the same request without doing any logic, and the data
|
|
499
533
|
* optimiser will pick what it needs.
|
|
500
534
|
*/
|
|
501
|
-
type CascadingInstructions = Array<{
|
|
535
|
+
export type CascadingInstructions = Array<{
|
|
502
536
|
datasourceDimensionFieldMapping: DimensionFieldsMapping;
|
|
503
537
|
dataStartDate: string | null;
|
|
504
538
|
dataEndDate: string | null;
|
|
505
539
|
}>;
|
|
506
|
-
type ActionResultStatus = 'success' | 'failure' | 'no_action_taken' | 'started_in_background';
|
|
507
|
-
type ActionStatus<PlannedOutcome> = {
|
|
540
|
+
export type ActionResultStatus = 'success' | 'failure' | 'no_action_taken' | 'started_in_background';
|
|
541
|
+
export type ActionStatus<PlannedOutcome> = {
|
|
508
542
|
name: string;
|
|
509
543
|
status: ActionResultStatus;
|
|
510
544
|
plannedOutcome: PlannedOutcome;
|
|
511
545
|
};
|
|
512
|
-
type ActionResult<Content> = {
|
|
546
|
+
export type ActionResult<Content> = {
|
|
513
547
|
status: ActionResultStatus;
|
|
514
548
|
content: Content;
|
|
515
549
|
};
|
|
516
|
-
type StatusResponse<Status extends {
|
|
550
|
+
export type StatusResponse<Status extends {
|
|
517
551
|
[actionId: string]: {
|
|
518
552
|
name: string;
|
|
519
553
|
status: ActionResultStatus;
|
|
@@ -528,7 +562,7 @@ export declare namespace DataOptimiser {
|
|
|
528
562
|
};
|
|
529
563
|
status: Status;
|
|
530
564
|
};
|
|
531
|
-
type ExecuteResponse<WorkflowResult extends {
|
|
565
|
+
export type ExecuteResponse<WorkflowResult extends {
|
|
532
566
|
[actionId: string]: {
|
|
533
567
|
status: ActionResultStatus;
|
|
534
568
|
content: any;
|
|
@@ -536,11 +570,11 @@ export declare namespace DataOptimiser {
|
|
|
536
570
|
}> = {
|
|
537
571
|
workflowResults: WorkflowResult;
|
|
538
572
|
};
|
|
539
|
-
type QueryEngineConnection = {
|
|
573
|
+
export type QueryEngineConnection = {
|
|
540
574
|
encryptedCredentials: string;
|
|
541
575
|
unencryptedCredentials?: Partial<SnowflakeConnection>;
|
|
542
576
|
};
|
|
543
|
-
type IngestExecuteResponse = ExecuteResponse<{
|
|
577
|
+
export type IngestExecuteResponse = ExecuteResponse<{
|
|
544
578
|
setup_export_data_integration: DataOptimiser.ActionResult<{}>;
|
|
545
579
|
ingest_to_storage: DataOptimiser.ActionResult<{
|
|
546
580
|
toBucket: string;
|
|
@@ -553,10 +587,11 @@ export declare namespace DataOptimiser {
|
|
|
553
587
|
executedInSnowflakeSessionId: string;
|
|
554
588
|
}>;
|
|
555
589
|
}>;
|
|
556
|
-
type CreateSnapshotExecuteResponse = DataOptimiser.ExecuteResponse<{
|
|
590
|
+
export type CreateSnapshotExecuteResponse = DataOptimiser.ExecuteResponse<{
|
|
557
591
|
create_snapshot: DataOptimiser.ActionResult<{
|
|
558
592
|
executedInSnowflakeSessionId: string;
|
|
559
593
|
snapshotFields: DataOptimiser.DataSourceFields;
|
|
560
594
|
}>;
|
|
561
595
|
}>;
|
|
596
|
+
export {};
|
|
562
597
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizzly/api-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.71",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "NONE",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@vizzly/semantic-layer-public": ">=0.0.231",
|
|
37
|
-
"@vizzly/sqlbuilder-public": ">=0.1.
|
|
37
|
+
"@vizzly/sqlbuilder-public": ">=0.1.62",
|
|
38
38
|
"cross-fetch": "^4.0.0"
|
|
39
39
|
}
|
|
40
40
|
}
|