@vizzly/api-client 0.0.43 → 0.0.44

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.
@@ -4,6 +4,12 @@ export declare class DashboardRepository {
4
4
  private vizzly;
5
5
  private repo;
6
6
  constructor(vizzly: Vizzly);
7
+ static EmptyDashboardDefinition(): {
8
+ componentLibrary: never[];
9
+ customFields: {};
10
+ display: never[];
11
+ globalFilters: never[];
12
+ };
7
13
  createDashboard(createParams: CreateDashboardParams): Promise<{
8
14
  dashboard: Dashboard;
9
15
  permissions: DashboardPermission[];
@@ -23,6 +23,14 @@ class DashboardRepository {
23
23
  this.vizzly = vizzly;
24
24
  this.repo = new Repository_1.Repository('id');
25
25
  }
26
+ static EmptyDashboardDefinition() {
27
+ return {
28
+ componentLibrary: [],
29
+ customFields: {},
30
+ display: [],
31
+ globalFilters: [],
32
+ };
33
+ }
26
34
  createDashboard(createParams) {
27
35
  return __awaiter(this, void 0, void 0, function* () {
28
36
  let builtDashboard;
@@ -19,6 +19,7 @@ const FailedToFetchProject_1 = require("../errors/FailedToFetchProject");
19
19
  const FailedToUpdateQueryEngineUser_1 = require("../errors/FailedToUpdateQueryEngineUser");
20
20
  const FailedToSaveProjectEncryptedEncryptionSecret_1 = require("../errors/FailedToSaveProjectEncryptedEncryptionSecret");
21
21
  const ProjectEncryptedSecretAlreadySaved_1 = require("../errors/ProjectEncryptedSecretAlreadySaved");
22
+ const DashboardRepository_1 = require("./DashboardRepository");
22
23
  class VizzlyApi extends Api_1.Api {
23
24
  constructor(auth, host = 'https://api.vizzly.co') {
24
25
  super(auth, host);
@@ -71,7 +72,7 @@ class VizzlyApi extends Api_1.Api {
71
72
  method: 'post',
72
73
  body: {
73
74
  dashboardAccessToken: this.auth.getDashboardAccessToken(),
74
- definition: params.definition,
75
+ definition: params.definition || DashboardRepository_1.DashboardRepository.EmptyDashboardDefinition(),
75
76
  meta: params.metadata || params.meta || {},
76
77
  parentDashboardId: params.parentDashboardId,
77
78
  permissions: params.permissions,
@@ -100,7 +101,8 @@ class VizzlyApi extends Api_1.Api {
100
101
  method: 'post',
101
102
  body: {
102
103
  projectId: params.projectId,
103
- definition: params.definition,
104
+ definition: params.definition || DashboardRepository_1.DashboardRepository.EmptyDashboardDefinition(),
105
+ name: params.name,
104
106
  },
105
107
  abortSignal: params.abortSignal,
106
108
  };
@@ -468,6 +470,7 @@ class VizzlyApi extends Api_1.Api {
468
470
  definition: params.definition,
469
471
  meta: params.metadata || params.meta || {},
470
472
  deleted: params.deleted,
473
+ name: params.name,
471
474
  },
472
475
  abortSignal: params.abortSignal,
473
476
  };
@@ -15,6 +15,7 @@ const SQLPreviewError_1 = require("../errors/SQLPreviewError");
15
15
  const FailedToResolveDataSets_1 = require("../errors/FailedToResolveDataSets");
16
16
  const FailedToSetupProject_1 = require("../errors/FailedToSetupProject");
17
17
  const errors_1 = require("../errors");
18
+ const DashboardRepository_1 = require("./DashboardRepository");
18
19
  class VizzlyQueryEngineApi extends Api_1.Api {
19
20
  constructor(auth, host, extraHeaders) {
20
21
  super(auth, host, extraHeaders);
@@ -26,7 +27,7 @@ class VizzlyQueryEngineApi extends Api_1.Api {
26
27
  abortSignal: params.abortSignal,
27
28
  body: {
28
29
  dashboardAccessToken: this.auth.getDashboardAccessToken(),
29
- definition: params.definition,
30
+ definition: params.definition || DashboardRepository_1.DashboardRepository.EmptyDashboardDefinition(),
30
31
  meta: params.metadata || params.meta || {},
31
32
  parentDashboardId: params.parentDashboardId,
32
33
  permissions: params.permissions,
@@ -375,6 +376,7 @@ class VizzlyQueryEngineApi extends Api_1.Api {
375
376
  definition: params.definition,
376
377
  meta: params.metadata || params.meta || {},
377
378
  deleted: params.deleted,
379
+ name: params.name,
378
380
  },
379
381
  };
380
382
  }
package/dist/types.d.ts CHANGED
@@ -48,7 +48,7 @@ export type CreateGlobalLibraryParams = {
48
48
  }>;
49
49
  };
50
50
  export type CreateDashboardParams = {
51
- definition: DashboardDefinition | string;
51
+ definition?: DashboardDefinition | string;
52
52
  /** @deprecated - use `metadata` instead */
53
53
  meta?: any;
54
54
  metadata?: any;
@@ -65,6 +65,7 @@ export type UpdateDashboardParams = {
65
65
  meta?: any;
66
66
  metadata?: any;
67
67
  deleted?: boolean;
68
+ name?: string;
68
69
  };
69
70
  export type APIs = {
70
71
  vizzlyApi: VizzlyApi;
@@ -138,8 +139,10 @@ export declare namespace nVizzlyApi {
138
139
  dashboardAccessToken: string;
139
140
  };
140
141
  type CreateParentDashboardParams = {
141
- definition: any;
142
- projectId: string;
142
+ definition?: any;
143
+ name?: string;
144
+ /** Optional, only when using project API key for auth. */
145
+ projectId?: string;
143
146
  };
144
147
  type CreateParentGlobalLibraryParams = {
145
148
  library: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizzly/api-client",
3
- "version": "0.0.43",
3
+ "version": "0.0.44",
4
4
  "private": false,
5
5
  "license": "NONE",
6
6
  "source": "src/index.ts",