@databrainhq/plugin 0.8.10 → 0.8.11

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,5 +1,6 @@
1
- /// <reference types="react" />
1
+ import { Dispatch, SetStateAction } from 'react';
2
2
  import { AxisSettings, BackgroundSettings, CustomSettings, LabelSettings, LegendSettings, RlsCondition, FloatingDropDownOption, TableSettings } from './app';
3
+ import { ExternalMetrics } from '@/utils/generated/graphql';
3
4
  declare type ColumnData = {
4
5
  name: string;
5
6
  datatype: string;
@@ -8,10 +9,15 @@ declare type ColumnData = {
8
9
  export declare type EmbeddedMetricCreationProps = {
9
10
  clientId: string;
10
11
  companyId: string;
11
- mode: boolean;
12
+ isLiveMode: boolean;
12
13
  externalDashboardId: string;
14
+ userProvidedDashboardId: string;
13
15
  variant?: 'static' | 'floating';
14
16
  chartColors?: string[];
17
+ setShowMetricCreateModal: Dispatch<SetStateAction<boolean>>;
18
+ isShowMetricCreateModal: boolean;
19
+ metric?: ExternalMetrics;
20
+ metricData?: Record<string, any>[];
15
21
  workspaceId: string;
16
22
  };
17
23
  export declare type HeaderProps = {
@@ -50,6 +56,7 @@ export declare type MetricsValue = {
50
56
  };
51
57
  export declare type MetricOutputProps = {
52
58
  data: any[] | undefined;
59
+ isUpdateMetric?: boolean;
53
60
  query?: string;
54
61
  error: string;
55
62
  clientName?: string;
package/dist/typings.d.ts CHANGED
@@ -1,17 +1,17 @@
1
- /**
2
- * Default CSS definition for typescript,
3
- * will be overridden with file-specific definitions by rollup
4
- */
5
- declare module '*.css' {
6
- const content: Record<string, string>;
7
- export default content;
8
- }
9
-
10
- interface SvgrComponent extends React.FC<React.SVGAttributes<SVGElement>> {}
11
-
12
- declare module '*.svg' {
13
- const svgUrl: string;
14
- const svgComponent: SvgrComponent;
15
- export default svgUrl;
16
- export { svgComponent as ReactComponent };
17
- }
1
+ /**
2
+ * Default CSS definition for typescript,
3
+ * will be overridden with file-specific definitions by rollup
4
+ */
5
+ declare module '*.css' {
6
+ const content: Record<string, string>;
7
+ export default content;
8
+ }
9
+
10
+ interface SvgrComponent extends React.FC<React.SVGAttributes<SVGElement>> {}
11
+
12
+ declare module '*.svg' {
13
+ const svgUrl: string;
14
+ const svgComponent: SvgrComponent;
15
+ export default svgUrl;
16
+ export { svgComponent as ReactComponent };
17
+ }
@@ -778,7 +778,6 @@ export declare type ExternalMetrics = {
778
778
  isCreatedByClient: Scalars['Boolean'];
779
779
  isEnableGroupBy: Scalars['Boolean'];
780
780
  isLive: Scalars['Boolean'];
781
- isMarkedDeleted: Scalars['Boolean'];
782
781
  metricId: Scalars['String'];
783
782
  metricQuery?: Maybe<Scalars['String']>;
784
783
  name: Scalars['String'];
@@ -939,6 +938,7 @@ export declare type ExternalMetrics_Aggregate_Order_By = {
939
938
  };
940
939
  /** append existing jsonb value of filtered columns with new jsonb value */
941
940
  export declare type ExternalMetrics_Append_Input = {
941
+ chartOptions?: InputMaybe<Scalars['jsonb']>;
942
942
  resizeAttributes?: InputMaybe<Scalars['jsonb']>;
943
943
  };
944
944
  /** Boolean expression to filter rows from the table "externalMetrics". All fields are combined with a logical 'AND'. */
@@ -965,7 +965,6 @@ export declare type ExternalMetrics_Bool_Exp = {
965
965
  isCreatedByClient?: InputMaybe<Boolean_Comparison_Exp>;
966
966
  isEnableGroupBy?: InputMaybe<Boolean_Comparison_Exp>;
967
967
  isLive?: InputMaybe<Boolean_Comparison_Exp>;
968
- isMarkedDeleted?: InputMaybe<Boolean_Comparison_Exp>;
969
968
  metricId?: InputMaybe<String_Comparison_Exp>;
970
969
  metricQuery?: InputMaybe<String_Comparison_Exp>;
971
970
  name?: InputMaybe<String_Comparison_Exp>;
@@ -986,14 +985,17 @@ export declare enum ExternalMetrics_Constraint {
986
985
  }
987
986
  /** delete the field or element with specified path (for JSON arrays, negative integers count from the end) */
988
987
  export declare type ExternalMetrics_Delete_At_Path_Input = {
988
+ chartOptions?: InputMaybe<Array<Scalars['String']>>;
989
989
  resizeAttributes?: InputMaybe<Array<Scalars['String']>>;
990
990
  };
991
991
  /** delete the array element with specified index (negative integers count from the end). throws an error if top level container is not an array */
992
992
  export declare type ExternalMetrics_Delete_Elem_Input = {
993
+ chartOptions?: InputMaybe<Scalars['Int']>;
993
994
  resizeAttributes?: InputMaybe<Scalars['Int']>;
994
995
  };
995
996
  /** delete key/value pair or string element. key/value pairs are matched based on their key value */
996
997
  export declare type ExternalMetrics_Delete_Key_Input = {
998
+ chartOptions?: InputMaybe<Scalars['String']>;
997
999
  resizeAttributes?: InputMaybe<Scalars['String']>;
998
1000
  };
999
1001
  /** input type for inserting data into table "externalMetrics" */
@@ -1101,7 +1103,6 @@ export declare type ExternalMetrics_Order_By = {
1101
1103
  isCreatedByClient?: InputMaybe<Order_By>;
1102
1104
  isEnableGroupBy?: InputMaybe<Order_By>;
1103
1105
  isLive?: InputMaybe<Order_By>;
1104
- isMarkedDeleted?: InputMaybe<Order_By>;
1105
1106
  metricId?: InputMaybe<Order_By>;
1106
1107
  metricQuery?: InputMaybe<Order_By>;
1107
1108
  name?: InputMaybe<Order_By>;
@@ -1119,6 +1120,7 @@ export declare type ExternalMetrics_Pk_Columns_Input = {
1119
1120
  };
1120
1121
  /** prepend existing jsonb value of filtered columns with new jsonb value */
1121
1122
  export declare type ExternalMetrics_Prepend_Input = {
1123
+ chartOptions?: InputMaybe<Scalars['jsonb']>;
1122
1124
  resizeAttributes?: InputMaybe<Scalars['jsonb']>;
1123
1125
  };
1124
1126
  /** select columns of table "externalMetrics" */
@@ -1154,8 +1156,6 @@ export declare enum ExternalMetrics_Select_Column {
1154
1156
  /** column name */
1155
1157
  IsLive = "isLive",
1156
1158
  /** column name */
1157
- IsMarkedDeleted = "isMarkedDeleted",
1158
- /** column name */
1159
1159
  MetricId = "metricId",
1160
1160
  /** column name */
1161
1161
  MetricQuery = "metricQuery",
@@ -1178,13 +1178,22 @@ export declare enum ExternalMetrics_Select_Column {
1178
1178
  }
1179
1179
  /** input type for updating data in table "externalMetrics" */
1180
1180
  export declare type ExternalMetrics_Set_Input = {
1181
- isMarkedDeleted?: InputMaybe<Scalars['Boolean']>;
1181
+ chartOptions?: InputMaybe<Scalars['jsonb']>;
1182
+ description?: InputMaybe<Scalars['String']>;
1183
+ metricId?: InputMaybe<Scalars['String']>;
1184
+ name?: InputMaybe<Scalars['String']>;
1182
1185
  resizeAttributes?: InputMaybe<Scalars['jsonb']>;
1183
1186
  };
1184
1187
  /** update columns of table "externalMetrics" */
1185
1188
  export declare enum ExternalMetrics_Update_Column {
1186
1189
  /** column name */
1187
- IsMarkedDeleted = "isMarkedDeleted",
1190
+ ChartOptions = "chartOptions",
1191
+ /** column name */
1192
+ Description = "description",
1193
+ /** column name */
1194
+ MetricId = "metricId",
1195
+ /** column name */
1196
+ Name = "name",
1188
1197
  /** column name */
1189
1198
  ResizeAttributes = "resizeAttributes"
1190
1199
  }
@@ -2218,6 +2227,62 @@ export declare type ResizeExternalMetricMutation = {
2218
2227
  resizeAttributes: any;
2219
2228
  } | null;
2220
2229
  };
2230
+ export declare type UpdateAdminMetricMutationVariables = Exact<{
2231
+ externalMetricId: Scalars['uuid'];
2232
+ object: ExternalMetrics_Insert_Input;
2233
+ clientId: Scalars['String'];
2234
+ }>;
2235
+ export declare type UpdateAdminMetricMutation = {
2236
+ __typename?: 'mutation_root';
2237
+ insert_clientDeletedMetrics_one?: {
2238
+ __typename?: 'clientDeletedMetrics';
2239
+ clientId: string;
2240
+ externalMetricId: any;
2241
+ } | null;
2242
+ insert_externalMetrics_one?: {
2243
+ __typename?: 'externalMetrics';
2244
+ chartOptions: any;
2245
+ clientId?: string | null;
2246
+ companyId: any;
2247
+ companyIntegrationId: any;
2248
+ createdAt: any;
2249
+ createdBy?: string | null;
2250
+ description: string;
2251
+ id: any;
2252
+ inputFields?: any | null;
2253
+ integrationName: string;
2254
+ isCreatedByClient: boolean;
2255
+ isLive: boolean;
2256
+ metricId: string;
2257
+ metricQuery?: string | null;
2258
+ name: string;
2259
+ outputColumns?: string | null;
2260
+ query: string;
2261
+ resizeAttributes: any;
2262
+ timeGrain?: string | null;
2263
+ updatedAt: any;
2264
+ selectedGroupBy: any;
2265
+ isEnableGroupBy: boolean;
2266
+ groupBy: any;
2267
+ rlsConditions: any;
2268
+ clickActions: any;
2269
+ companyIntegration: {
2270
+ __typename?: 'companyIntegrations';
2271
+ name: string;
2272
+ };
2273
+ } | null;
2274
+ };
2275
+ export declare type UpdateExternalMetricMutationVariables = Exact<{
2276
+ externalMetricId: Scalars['uuid'];
2277
+ set: ExternalMetrics_Set_Input;
2278
+ }>;
2279
+ export declare type UpdateExternalMetricMutation = {
2280
+ __typename?: 'mutation_root';
2281
+ update_externalMetrics_by_pk?: {
2282
+ __typename?: 'externalMetrics';
2283
+ id: any;
2284
+ } | null;
2285
+ };
2221
2286
  export declare const CreateExternalMetricDocument = "\n mutation CreateExternalMetric($chartOptions: jsonb = \"\", $companyId: uuid = \"\", $companyIntegrationId: uuid = \"\", $description: String = \"\", $inputFields: jsonb = \"\", $integrationName: String = \"\", $metricId: String = \"\", $metricQuery: String = \"\", $name: String = \"\", $outputColumns: String = \"\", $query: String = \"\", $isLive: Boolean, $clientId: String = \"\", $isCreatedByClient: Boolean = false, $createdBy: String = \"\", $timeGrain: String = \"\", $externalDashboardIds: [externalDashboardMetrics_insert_input!] = {}, $selectedGroupBy: jsonb = [], $isEnableGroupBy: Boolean = false, $groupBy: jsonb = {}) {\n insert_externalMetrics_one(\n object: {chartOptions: $chartOptions, companyId: $companyId, companyIntegrationId: $companyIntegrationId, description: $description, inputFields: $inputFields, integrationName: $integrationName, metricId: $metricId, metricQuery: $metricQuery, name: $name, outputColumns: $outputColumns, query: $query, isLive: $isLive, clientId: $clientId, isCreatedByClient: $isCreatedByClient, createdBy: $createdBy, timeGrain: $timeGrain, externalDashboardMetrics: {data: $externalDashboardIds}, selectedGroupBy: $selectedGroupBy, isEnableGroupBy: $isEnableGroupBy, groupBy: $groupBy}\n ) {\n id\n externalDashboardMetrics {\n externalDashboardId\n }\n }\n}\n ";
2222
2287
  export declare const useCreateExternalMetricMutation: <TError = unknown, TContext = unknown>(options?: UseMutationOptions<CreateExternalMetricMutation, TError, Exact<{
2223
2288
  chartOptions?: InputMaybe<Scalars['jsonb']>;
@@ -2376,3 +2441,21 @@ export declare const useResizeExternalMetricMutation: <TError = unknown, TContex
2376
2441
  id: Scalars['uuid'];
2377
2442
  resizeAttributes: Scalars['jsonb'];
2378
2443
  }>, TContext>;
2444
+ export declare const UpdateAdminMetricDocument = "\n mutation UpdateAdminMetric($externalMetricId: uuid!, $object: externalMetrics_insert_input!, $clientId: String!) {\n insert_clientDeletedMetrics_one(\n object: {externalMetricId: $externalMetricId, clientId: $clientId}\n ) {\n clientId\n externalMetricId\n }\n insert_externalMetrics_one(object: $object) {\n chartOptions\n clientId\n companyId\n companyIntegrationId\n createdAt\n createdBy\n description\n id\n inputFields\n integrationName\n isCreatedByClient\n isLive\n metricId\n metricQuery\n name\n outputColumns\n query\n resizeAttributes\n timeGrain\n updatedAt\n selectedGroupBy\n isEnableGroupBy\n groupBy\n rlsConditions\n companyIntegration {\n name\n }\n clickActions\n }\n}\n ";
2445
+ export declare const useUpdateAdminMetricMutation: <TError = unknown, TContext = unknown>(options?: UseMutationOptions<UpdateAdminMetricMutation, TError, Exact<{
2446
+ externalMetricId: Scalars['uuid'];
2447
+ object: ExternalMetrics_Insert_Input;
2448
+ clientId: Scalars['String'];
2449
+ }>, TContext> | undefined) => import("react-query").UseMutationResult<UpdateAdminMetricMutation, TError, Exact<{
2450
+ externalMetricId: Scalars['uuid'];
2451
+ object: ExternalMetrics_Insert_Input;
2452
+ clientId: Scalars['String'];
2453
+ }>, TContext>;
2454
+ export declare const UpdateExternalMetricDocument = "\n mutation UpdateExternalMetric($externalMetricId: uuid!, $set: externalMetrics_set_input!) {\n update_externalMetrics_by_pk(pk_columns: {id: $externalMetricId}, _set: $set) {\n id\n }\n}\n ";
2455
+ export declare const useUpdateExternalMetricMutation: <TError = unknown, TContext = unknown>(options?: UseMutationOptions<UpdateExternalMetricMutation, TError, Exact<{
2456
+ externalMetricId: Scalars['uuid'];
2457
+ set: ExternalMetrics_Set_Input;
2458
+ }>, TContext> | undefined) => import("react-query").UseMutationResult<UpdateExternalMetricMutation, TError, Exact<{
2459
+ externalMetricId: Scalars['uuid'];
2460
+ set: ExternalMetrics_Set_Input;
2461
+ }>, TContext>;
package/package.json CHANGED
@@ -1,98 +1,98 @@
1
- {
2
- "name": "@databrainhq/plugin",
3
- "version": "0.8.10",
4
- "description": "Databrain app dashboard ui plugin.",
5
- "author": "",
6
- "license": "MIT",
7
- "repository": "databrainhq/plugin",
8
- "source": "src/index.ts",
9
- "main": "./dist/index.umd.js",
10
- "module": "./dist/index.es.js",
11
- "types": "./dist/index.d.ts",
12
- "exports": {
13
- ".": {
14
- "import": "./dist/index.es.js",
15
- "require": "./dist/index.umd.js"
16
- },
17
- "./dist/style.css": "./dist/style.css"
18
- },
19
- "engines": {
20
- "node": "^14.13.1 || >=16.15.1",
21
- "yarn": "please-use-npm"
22
- },
23
- "scripts": {
24
- "serve": "vite --port 3005",
25
- "build:css": "tailwindcss build -i src/index.css -o dist/index.css",
26
- "build": "tsc && vite build",
27
- "husky": "husky install",
28
- "predeploy": "cd example && npm install && npm run build",
29
- "lint": "eslint --ext .tsx,.ts --ignore-path .gitignore --fix src",
30
- "codegen": "graphql-codegen --config codegen.yml -r dotenv/config",
31
- "prepare": "npm run build"
32
- },
33
- "devDependencies": {
34
- "@commitlint/cli": "^17.0.3",
35
- "@commitlint/config-conventional": "^17.0.3",
36
- "@graphql-codegen/cli": "^2.16.4",
37
- "@graphql-codegen/introspection": "^2.2.3",
38
- "@graphql-codegen/typescript": "^2.8.7",
39
- "@graphql-codegen/typescript-operations": "^2.5.12",
40
- "@graphql-codegen/typescript-react-apollo": "^3.3.7",
41
- "@graphql-codegen/typescript-react-query": "^3.6.2",
42
- "@iconify/json": "^2.2.6",
43
- "@svgr/core": "^6.5.1",
44
- "@types/node": "^12.12.38",
45
- "@types/react": "^18.0.26",
46
- "@types/react-dom": "^18.0.10",
47
- "@types/react-grid-layout": "^1.3.2",
48
- "@typescript-eslint/eslint-plugin": "^4.31.1",
49
- "@typescript-eslint/parser": "^4.31.1",
50
- "@vitejs/plugin-react": "^1.3.0",
51
- "autoprefixer": "^10.4.7",
52
- "babel-eslint": "^10.0.3",
53
- "cross-env": "^7.0.2",
54
- "eslint": "^7.32.0",
55
- "eslint-config-airbnb": "^18.2.1",
56
- "eslint-config-airbnb-typescript": "^14.0.0",
57
- "eslint-config-prettier": "^8.3.0",
58
- "eslint-plugin-import": "^2.24.2",
59
- "eslint-plugin-jsx-a11y": "^6.6.0",
60
- "eslint-plugin-prettier": "^4.0.0",
61
- "eslint-plugin-react": "^7.30.1",
62
- "eslint-plugin-react-hooks": "^4.6.0",
63
- "eslint-plugin-unicorn": "^36.0.0",
64
- "graphql": "^16.6.0",
65
- "husky": "^8.0.1",
66
- "lint-staged": "^13.0.3",
67
- "postcss": "^8.4.21",
68
- "prettier": "^2.0.4",
69
- "react": "^18.2.0",
70
- "react-dom": "^18.2.0",
71
- "tailwindcss": "^3.2.4",
72
- "ts-node": "^10.9.1",
73
- "typescript": "^4.6.3",
74
- "unplugin-icons": "^0.14.7",
75
- "vite": "^2.9.9",
76
- "vite-plugin-dts": "^1.7.1",
77
- "vite-tsconfig-paths": "^4.0.3"
78
- },
79
- "files": [
80
- "dist"
81
- ],
82
- "dependencies": {
83
- "@headlessui/react": "^1.7.2",
84
- "@tanstack/match-sorter-utils": "^8.8.4",
85
- "@tanstack/react-table": "^8.7.9",
86
- "classnames": "^2.3.2",
87
- "echarts": "^5.4.1",
88
- "echarts-for-react": "^3.0.2",
89
- "react-error-boundary": "^3.1.4",
90
- "react-grid-layout": "^1.3.4",
91
- "react-hook-form": "^7.33.1",
92
- "react-query": "^3.39.2"
93
- },
94
- "peerDependencies": {
95
- "react": "^18.2.0",
96
- "react-dom": "^18.2.0"
97
- }
98
- }
1
+ {
2
+ "name": "@databrainhq/plugin",
3
+ "version": "0.8.11",
4
+ "description": "Databrain app dashboard ui plugin.",
5
+ "author": "",
6
+ "license": "MIT",
7
+ "repository": "databrainhq/plugin",
8
+ "source": "src/index.ts",
9
+ "main": "./dist/index.umd.js",
10
+ "module": "./dist/index.es.js",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/index.es.js",
15
+ "require": "./dist/index.umd.js"
16
+ },
17
+ "./dist/style.css": "./dist/style.css"
18
+ },
19
+ "engines": {
20
+ "node": "^14.13.1 || >=16.15.1",
21
+ "yarn": "please-use-npm"
22
+ },
23
+ "scripts": {
24
+ "serve": "vite --port 3005",
25
+ "build:css": "tailwindcss build -i src/index.css -o dist/index.css",
26
+ "build": "tsc && vite build",
27
+ "husky": "husky install",
28
+ "predeploy": "cd example && npm install && npm run build",
29
+ "lint": "eslint --ext .tsx,.ts --ignore-path .gitignore --fix src",
30
+ "codegen": "graphql-codegen --config codegen.yml -r dotenv/config",
31
+ "prepare": "npm run build"
32
+ },
33
+ "devDependencies": {
34
+ "@commitlint/cli": "^17.0.3",
35
+ "@commitlint/config-conventional": "^17.0.3",
36
+ "@graphql-codegen/cli": "^2.16.4",
37
+ "@graphql-codegen/introspection": "^2.2.3",
38
+ "@graphql-codegen/typescript": "^2.8.7",
39
+ "@graphql-codegen/typescript-operations": "^2.5.12",
40
+ "@graphql-codegen/typescript-react-apollo": "^3.3.7",
41
+ "@graphql-codegen/typescript-react-query": "^3.6.2",
42
+ "@iconify/json": "^2.2.6",
43
+ "@svgr/core": "^6.5.1",
44
+ "@types/node": "^12.12.38",
45
+ "@types/react": "^18.0.26",
46
+ "@types/react-dom": "^18.0.10",
47
+ "@types/react-grid-layout": "^1.3.2",
48
+ "@typescript-eslint/eslint-plugin": "^4.31.1",
49
+ "@typescript-eslint/parser": "^4.31.1",
50
+ "@vitejs/plugin-react": "^1.3.0",
51
+ "autoprefixer": "^10.4.7",
52
+ "babel-eslint": "^10.0.3",
53
+ "cross-env": "^7.0.2",
54
+ "eslint": "^7.32.0",
55
+ "eslint-config-airbnb": "^18.2.1",
56
+ "eslint-config-airbnb-typescript": "^14.0.0",
57
+ "eslint-config-prettier": "^8.3.0",
58
+ "eslint-plugin-import": "^2.24.2",
59
+ "eslint-plugin-jsx-a11y": "^6.6.0",
60
+ "eslint-plugin-prettier": "^4.0.0",
61
+ "eslint-plugin-react": "^7.30.1",
62
+ "eslint-plugin-react-hooks": "^4.6.0",
63
+ "eslint-plugin-unicorn": "^36.0.0",
64
+ "graphql": "^16.6.0",
65
+ "husky": "^8.0.1",
66
+ "lint-staged": "^13.0.3",
67
+ "postcss": "^8.4.21",
68
+ "prettier": "^2.0.4",
69
+ "react": "^18.2.0",
70
+ "react-dom": "^18.2.0",
71
+ "tailwindcss": "^3.2.4",
72
+ "ts-node": "^10.9.1",
73
+ "typescript": "^4.6.3",
74
+ "unplugin-icons": "^0.14.7",
75
+ "vite": "^2.9.9",
76
+ "vite-plugin-dts": "^1.7.1",
77
+ "vite-tsconfig-paths": "^4.0.3"
78
+ },
79
+ "files": [
80
+ "dist"
81
+ ],
82
+ "dependencies": {
83
+ "@headlessui/react": "^1.7.2",
84
+ "@tanstack/match-sorter-utils": "^8.8.4",
85
+ "@tanstack/react-table": "^8.7.9",
86
+ "classnames": "^2.3.2",
87
+ "echarts": "^5.4.1",
88
+ "echarts-for-react": "^3.0.2",
89
+ "react-error-boundary": "^3.1.4",
90
+ "react-grid-layout": "^1.3.4",
91
+ "react-hook-form": "^7.33.1",
92
+ "react-query": "^3.39.2"
93
+ },
94
+ "peerDependencies": {
95
+ "react": "^18.2.0",
96
+ "react-dom": "^18.2.0"
97
+ }
98
+ }