@vizzly/api-client 0.0.70 → 0.0.72
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Api } from './Api';
|
|
2
|
-
import { Authentication } from './Authentication';
|
|
3
|
-
import { nVizzlyQueryEngine, Request, extraHeaders, CreateDashboardParams, UpdateDashboardParams, UpdateGlobalLibraryParams, GlobalLibrary, CreateGlobalLibraryParams, GlobalLibraryPermissionFromAPI, RequestParams, DataOptimiser } from '../types';
|
|
4
1
|
import { nSemanticLayer } from '@vizzly/semantic-layer-public';
|
|
5
2
|
import { HighLevelSQLSchema, SQLSchema } from '@vizzly/sqlbuilder-public';
|
|
3
|
+
import { CreateDashboardParams, CreateGlobalLibraryParams, DataOptimiser, extraHeaders, GlobalLibrary, GlobalLibraryPermissionFromAPI, nVizzlyQueryEngine, Request, RequestParams, UpdateDashboardParams, UpdateGlobalLibraryParams } from '../types';
|
|
4
|
+
import { Api } from './Api';
|
|
5
|
+
import { Authentication } from './Authentication';
|
|
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,10 @@ 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;
|
|
32
36
|
collectTableSchema(params: RequestParams<nVizzlyQueryEngine.CollectTableSchemaParams>): Promise<import("../types").Response<{
|
|
33
37
|
tableSchemaByConnection: {
|
|
34
38
|
[connectionId: string]: {
|
|
@@ -227,4 +231,45 @@ export declare class VizzlyQueryEngineApi extends Api {
|
|
|
227
231
|
}>;
|
|
228
232
|
}>>>;
|
|
229
233
|
private buildCreateSubsnapRequest;
|
|
234
|
+
ingestFromUpload(params: RequestParams<{
|
|
235
|
+
dataSourceId: string;
|
|
236
|
+
ingestFields: DataOptimiser.EphemeralDataSourceFields;
|
|
237
|
+
transformations: Array<{
|
|
238
|
+
columnName: string;
|
|
239
|
+
function: string;
|
|
240
|
+
}>;
|
|
241
|
+
previousWorkflowResults: Partial<DataOptimiser.IngestFromUploadExecuteResponse['workflowResults']>;
|
|
242
|
+
}>): Promise<import("../types").Response<DataOptimiser.IngestFromUploadExecuteResponse>>;
|
|
243
|
+
getIngestFromUploadStatus(params: RequestParams<{
|
|
244
|
+
dataSourceId: string;
|
|
245
|
+
ingestFields: DataOptimiser.EphemeralDataSourceFields;
|
|
246
|
+
transformations: Array<{
|
|
247
|
+
columnName: string;
|
|
248
|
+
function: string;
|
|
249
|
+
}>;
|
|
250
|
+
previousWorkflowResults: Partial<DataOptimiser.IngestFromUploadExecuteResponse['workflowResults']>;
|
|
251
|
+
}>): Promise<import("../types").Response<DataOptimiser.StatusResponse<{}>>>;
|
|
252
|
+
private buildIngestFromUploadRequest;
|
|
253
|
+
/** Send request to create upload table */
|
|
254
|
+
createUploadTable(params: RequestParams<{
|
|
255
|
+
dataSourceId: string;
|
|
256
|
+
locationName: string;
|
|
257
|
+
folderPath: string;
|
|
258
|
+
fileName: string;
|
|
259
|
+
previousWorkflowResults: Partial<DataOptimiser.CreateUploadTableExecuteResponse['workflowResults']>;
|
|
260
|
+
}>): Promise<import("../types").Response<DataOptimiser.CreateUploadTableExecuteResponse>>;
|
|
261
|
+
/** Get the status of a create upload table call */
|
|
262
|
+
getCreateUploadTableStatus(params: RequestParams<{
|
|
263
|
+
dataSourceId: string;
|
|
264
|
+
locationName: string;
|
|
265
|
+
folderPath: string;
|
|
266
|
+
fileName: string;
|
|
267
|
+
previousWorkflowResults: Partial<DataOptimiser.CreateUploadTableExecuteResponse['workflowResults']>;
|
|
268
|
+
}>): Promise<import("../types").Response<DataOptimiser.StatusResponse<{
|
|
269
|
+
create_upload_table: DataOptimiser.ActionStatus<{
|
|
270
|
+
destinationAddress: string[];
|
|
271
|
+
destinationFields: DataOptimiser.DataSourceFields;
|
|
272
|
+
}>;
|
|
273
|
+
}>>>;
|
|
274
|
+
private buildCreateUploadTableRequest;
|
|
230
275
|
}
|
|
@@ -10,11 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.VizzlyQueryEngineApi = void 0;
|
|
13
|
-
const
|
|
14
|
-
const SQLPreviewError_1 = require("../errors/SQLPreviewError");
|
|
13
|
+
const errors_1 = require("../errors");
|
|
15
14
|
const FailedToResolveDataSets_1 = require("../errors/FailedToResolveDataSets");
|
|
16
15
|
const FailedToSetupProject_1 = require("../errors/FailedToSetupProject");
|
|
17
|
-
const
|
|
16
|
+
const SQLPreviewError_1 = require("../errors/SQLPreviewError");
|
|
17
|
+
const Api_1 = require("./Api");
|
|
18
18
|
const DashboardRepository_1 = require("./DashboardRepository");
|
|
19
19
|
const Path_1 = require("./Path");
|
|
20
20
|
class VizzlyQueryEngineApi extends Api_1.Api {
|
|
@@ -110,6 +110,23 @@ 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
|
+
}
|
|
113
130
|
collectTableSchema(params) {
|
|
114
131
|
return __awaiter(this, void 0, void 0, function* () {
|
|
115
132
|
return yield this.execute(this.buildCollectTableSchemaRequest(params));
|
|
@@ -122,7 +139,7 @@ class VizzlyQueryEngineApi extends Api_1.Api {
|
|
|
122
139
|
abortSignal: params.abortSignal,
|
|
123
140
|
body: {
|
|
124
141
|
allowedConfigOrigins: params.allowedConfigOrigins,
|
|
125
|
-
dynamicConfig: params.dynamicConfig
|
|
142
|
+
dynamicConfig: params.dynamicConfig,
|
|
126
143
|
},
|
|
127
144
|
acceptedAuthParams: ['queryEngineApiKey'],
|
|
128
145
|
};
|
|
@@ -140,7 +157,7 @@ class VizzlyQueryEngineApi extends Api_1.Api {
|
|
|
140
157
|
body: {
|
|
141
158
|
allowedConfigOrigins: params.allowedConfigOrigins,
|
|
142
159
|
dynamicConfig: params.dynamicConfig,
|
|
143
|
-
filterColumnsByTable: params.filterColumnsByTable
|
|
160
|
+
filterColumnsByTable: params.filterColumnsByTable,
|
|
144
161
|
},
|
|
145
162
|
acceptedAuthParams: ['queryEngineApiKey'],
|
|
146
163
|
};
|
|
@@ -507,7 +524,7 @@ class VizzlyQueryEngineApi extends Api_1.Api {
|
|
|
507
524
|
internalCompanyConnection: params.internalCompanyConnection,
|
|
508
525
|
externalSnowflakeConnection: params.externalSnowflakeConnection,
|
|
509
526
|
transformations: params.transformations,
|
|
510
|
-
previousWorkflowResults: params.previousWorkflowResults
|
|
527
|
+
previousWorkflowResults: params.previousWorkflowResults,
|
|
511
528
|
},
|
|
512
529
|
acceptedAuthParams: ['queryEngineApiKey'],
|
|
513
530
|
};
|
|
@@ -538,7 +555,7 @@ class VizzlyQueryEngineApi extends Api_1.Api {
|
|
|
538
555
|
cascadingInstructions: params.cascadingInstructions,
|
|
539
556
|
primaryDateFieldId: params.primaryDateFieldId,
|
|
540
557
|
internalCompanyConnection: params.internalCompanyConnection,
|
|
541
|
-
previousWorkflowResults: params.previousWorkflowResults
|
|
558
|
+
previousWorkflowResults: params.previousWorkflowResults,
|
|
542
559
|
},
|
|
543
560
|
acceptedAuthParams: ['queryEngineApiKey'],
|
|
544
561
|
};
|
|
@@ -565,7 +582,60 @@ class VizzlyQueryEngineApi extends Api_1.Api {
|
|
|
565
582
|
snapshotDataSourceId: params.snapshotDataSourceId,
|
|
566
583
|
subsnapDataSourceId: params.subsnapDataSourceId,
|
|
567
584
|
snapshotFields: params.snapshotFields,
|
|
568
|
-
internalCompanyConnection: params.internalCompanyConnection
|
|
585
|
+
internalCompanyConnection: params.internalCompanyConnection,
|
|
586
|
+
},
|
|
587
|
+
acceptedAuthParams: ['queryEngineApiKey'],
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
ingestFromUpload(params) {
|
|
591
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
592
|
+
return yield this.execute(this.buildIngestFromUploadRequest(params, { statusOnly: false }));
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
getIngestFromUploadStatus(params) {
|
|
596
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
597
|
+
return yield this.execute(this.buildIngestFromUploadRequest(params, { statusOnly: true }));
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
buildIngestFromUploadRequest(params, options) {
|
|
601
|
+
const maybeStatusRoutePath = (options === null || options === void 0 ? void 0 : options.statusOnly) ? '/status' : '';
|
|
602
|
+
return {
|
|
603
|
+
path: Path_1.Path.buildPath(`/api/v1/data-optimiser/ingest-from-upload`, maybeStatusRoutePath),
|
|
604
|
+
method: 'post',
|
|
605
|
+
abortSignal: params.abortSignal,
|
|
606
|
+
body: {
|
|
607
|
+
dataSourceId: params.dataSourceId,
|
|
608
|
+
ingestFields: params.ingestFields,
|
|
609
|
+
transformations: params.transformations,
|
|
610
|
+
previousWorkflowResults: params.previousWorkflowResults,
|
|
611
|
+
},
|
|
612
|
+
acceptedAuthParams: ['queryEngineApiKey'],
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
/** Send request to create upload table */
|
|
616
|
+
createUploadTable(params) {
|
|
617
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
618
|
+
return yield this.execute(this.buildCreateUploadTableRequest(params, { statusOnly: false }));
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
/** Get the status of a create upload table call */
|
|
622
|
+
getCreateUploadTableStatus(params) {
|
|
623
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
624
|
+
return yield this.execute(this.buildCreateUploadTableRequest(params, { statusOnly: true }));
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
buildCreateUploadTableRequest(params, options) {
|
|
628
|
+
const maybeStatusRoutePath = (options === null || options === void 0 ? void 0 : options.statusOnly) ? '/status' : '';
|
|
629
|
+
return {
|
|
630
|
+
path: Path_1.Path.buildPath(`/api/v1/data-optimiser/upload`, maybeStatusRoutePath),
|
|
631
|
+
method: 'post',
|
|
632
|
+
abortSignal: params.abortSignal,
|
|
633
|
+
body: {
|
|
634
|
+
dataSourceId: params.dataSourceId,
|
|
635
|
+
locationName: params.locationName,
|
|
636
|
+
folderPath: params.folderPath,
|
|
637
|
+
fileName: params.fileName,
|
|
638
|
+
previousWorkflowResults: params.previousWorkflowResults,
|
|
569
639
|
},
|
|
570
640
|
acceptedAuthParams: ['queryEngineApiKey'],
|
|
571
641
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DataAccessConfig } from '@vizzly/auth';
|
|
2
|
+
import { nSemanticLayer, OriginId } from '@vizzly/semantic-layer-public';
|
|
3
|
+
import { DatabaseColumn, SnowflakeConnection } from '@vizzly/sqlbuilder-public';
|
|
2
4
|
import { VizzlyApi } from './models/VizzlyApi';
|
|
3
5
|
import { VizzlyAppApi } from './models/VizzlyAppApi';
|
|
6
|
+
import { VizzlyQueryEngineApi } from './models/VizzlyQueryEngineApi';
|
|
4
7
|
import { DashboardDefinition, DashboardFromAPI } from './types/dashboard';
|
|
5
8
|
import { UserFromAPI } from './types/user';
|
|
6
9
|
export * from './types/dashboard';
|
|
7
10
|
export * from './types/project';
|
|
8
11
|
export * from './types/team';
|
|
9
12
|
export * from './types/user';
|
|
10
|
-
import { DataAccessConfig } from '@vizzly/auth';
|
|
11
|
-
import { nSemanticLayer, OriginId } from '@vizzly/semantic-layer-public';
|
|
12
|
-
import { 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,10 @@ 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
|
+
};
|
|
116
120
|
type CollectTableSchemaParams = {
|
|
117
121
|
allowedConfigOrigins: OriginId[];
|
|
118
122
|
dynamicConfig?: nSemanticLayer.Config;
|
|
@@ -474,14 +478,40 @@ export type GlobalLibraryPermissionFromAPI = {
|
|
|
474
478
|
scope: 'read' | 'read_write';
|
|
475
479
|
};
|
|
476
480
|
export declare namespace DataOptimiser {
|
|
477
|
-
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<{
|
|
478
508
|
id: string;
|
|
479
509
|
address: string[];
|
|
480
510
|
data_type: string;
|
|
481
511
|
normalized_data_type: 'string' | 'number' | 'date_time' | 'boolean';
|
|
482
512
|
}>;
|
|
483
|
-
type EphemeralDataSourceFields = Array<Omit<DataSourceFields[number], 'id'>>;
|
|
484
|
-
type DimensionFieldsMapping = Array<{
|
|
513
|
+
export type EphemeralDataSourceFields = Array<Omit<DataSourceFields[number], 'id'>>;
|
|
514
|
+
export type DimensionFieldsMapping = Array<{
|
|
485
515
|
field_id: string;
|
|
486
516
|
gti_dimension_key: 'brands' | 'regions' | 'media_channels';
|
|
487
517
|
dimension_values_mappings: Array<{
|
|
@@ -502,22 +532,22 @@ export declare namespace DataOptimiser {
|
|
|
502
532
|
* snapshot in the same request without doing any logic, and the data
|
|
503
533
|
* optimiser will pick what it needs.
|
|
504
534
|
*/
|
|
505
|
-
type CascadingInstructions = Array<{
|
|
535
|
+
export type CascadingInstructions = Array<{
|
|
506
536
|
datasourceDimensionFieldMapping: DimensionFieldsMapping;
|
|
507
537
|
dataStartDate: string | null;
|
|
508
538
|
dataEndDate: string | null;
|
|
509
539
|
}>;
|
|
510
|
-
type ActionResultStatus = 'success' | 'failure' | 'no_action_taken' | 'started_in_background';
|
|
511
|
-
type ActionStatus<PlannedOutcome> = {
|
|
540
|
+
export type ActionResultStatus = 'success' | 'failure' | 'no_action_taken' | 'started_in_background';
|
|
541
|
+
export type ActionStatus<PlannedOutcome> = {
|
|
512
542
|
name: string;
|
|
513
543
|
status: ActionResultStatus;
|
|
514
544
|
plannedOutcome: PlannedOutcome;
|
|
515
545
|
};
|
|
516
|
-
type ActionResult<Content> = {
|
|
546
|
+
export type ActionResult<Content> = {
|
|
517
547
|
status: ActionResultStatus;
|
|
518
548
|
content: Content;
|
|
519
549
|
};
|
|
520
|
-
type StatusResponse<Status extends {
|
|
550
|
+
export type StatusResponse<Status extends {
|
|
521
551
|
[actionId: string]: {
|
|
522
552
|
name: string;
|
|
523
553
|
status: ActionResultStatus;
|
|
@@ -532,7 +562,7 @@ export declare namespace DataOptimiser {
|
|
|
532
562
|
};
|
|
533
563
|
status: Status;
|
|
534
564
|
};
|
|
535
|
-
type ExecuteResponse<WorkflowResult extends {
|
|
565
|
+
export type ExecuteResponse<WorkflowResult extends {
|
|
536
566
|
[actionId: string]: {
|
|
537
567
|
status: ActionResultStatus;
|
|
538
568
|
content: any;
|
|
@@ -540,11 +570,11 @@ export declare namespace DataOptimiser {
|
|
|
540
570
|
}> = {
|
|
541
571
|
workflowResults: WorkflowResult;
|
|
542
572
|
};
|
|
543
|
-
type QueryEngineConnection = {
|
|
573
|
+
export type QueryEngineConnection = {
|
|
544
574
|
encryptedCredentials: string;
|
|
545
575
|
unencryptedCredentials?: Partial<SnowflakeConnection>;
|
|
546
576
|
};
|
|
547
|
-
type IngestExecuteResponse = ExecuteResponse<{
|
|
577
|
+
export type IngestExecuteResponse = ExecuteResponse<{
|
|
548
578
|
setup_export_data_integration: DataOptimiser.ActionResult<{}>;
|
|
549
579
|
ingest_to_storage: DataOptimiser.ActionResult<{
|
|
550
580
|
toBucket: string;
|
|
@@ -557,10 +587,21 @@ export declare namespace DataOptimiser {
|
|
|
557
587
|
executedInSnowflakeSessionId: string;
|
|
558
588
|
}>;
|
|
559
589
|
}>;
|
|
560
|
-
type CreateSnapshotExecuteResponse = DataOptimiser.ExecuteResponse<{
|
|
590
|
+
export type CreateSnapshotExecuteResponse = DataOptimiser.ExecuteResponse<{
|
|
561
591
|
create_snapshot: DataOptimiser.ActionResult<{
|
|
562
592
|
executedInSnowflakeSessionId: string;
|
|
563
593
|
snapshotFields: DataOptimiser.DataSourceFields;
|
|
564
594
|
}>;
|
|
565
595
|
}>;
|
|
596
|
+
export type IngestFromUploadExecuteResponse = DataOptimiser.ExecuteResponse<{
|
|
597
|
+
ingest_from_upload: DataOptimiser.ActionResult<{
|
|
598
|
+
success: boolean;
|
|
599
|
+
}>;
|
|
600
|
+
}>;
|
|
601
|
+
export type CreateUploadTableExecuteResponse = DataOptimiser.ExecuteResponse<{
|
|
602
|
+
create_upload_table: DataOptimiser.ActionResult<{
|
|
603
|
+
destinationAddress: string[];
|
|
604
|
+
}>;
|
|
605
|
+
}>;
|
|
606
|
+
export {};
|
|
566
607
|
}
|