@quillsql/admin 1.3.6 → 1.3.8
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.
- package/dist/cjs/Admin.d.ts.map +1 -1
- package/dist/cjs/Admin.js +25 -15
- package/dist/cjs/AdminProvider.d.ts +10 -0
- package/dist/cjs/AdminProvider.d.ts.map +1 -1
- package/dist/cjs/AdminProvider.js +63 -43
- package/dist/cjs/api/ConnectionClient.d.ts +12 -10
- package/dist/cjs/api/ConnectionClient.d.ts.map +1 -1
- package/dist/cjs/api/ConnectionClient.js +100 -29
- package/dist/cjs/assets/ArrowDownHeadIcon.d.ts +5 -0
- package/dist/cjs/assets/ArrowDownHeadIcon.d.ts.map +1 -0
- package/dist/cjs/assets/ArrowDownHeadIcon.js +5 -0
- package/dist/cjs/assets/XIcon.d.ts +5 -0
- package/dist/cjs/assets/XIcon.d.ts.map +1 -0
- package/dist/cjs/assets/XIcon.js +5 -0
- package/dist/cjs/assets/index.d.ts +3 -0
- package/dist/cjs/assets/index.d.ts.map +1 -0
- package/dist/cjs/assets/index.js +10 -0
- package/dist/cjs/components/DatabaseMismatchCard.d.ts +6 -0
- package/dist/cjs/components/DatabaseMismatchCard.d.ts.map +1 -0
- package/dist/cjs/components/DatabaseMismatchCard.js +18 -0
- package/dist/cjs/components/DatabaseSelector.d.ts +2 -1
- package/dist/cjs/components/DatabaseSelector.d.ts.map +1 -1
- package/dist/cjs/components/DatabaseSelector.js +2 -2
- package/dist/cjs/components/DropDownMenuWithLabel.d.ts +2 -1
- package/dist/cjs/components/DropDownMenuWithLabel.d.ts.map +1 -1
- package/dist/cjs/components/DropDownMenuWithLabel.js +160 -39
- package/dist/cjs/components/DynamicBanner.d.ts +11 -0
- package/dist/cjs/components/DynamicBanner.d.ts.map +1 -0
- package/dist/cjs/components/DynamicBanner.js +22 -0
- package/dist/cjs/components/EnvSelectPopover.d.ts.map +1 -1
- package/dist/cjs/components/EnvSelectPopover.js +0 -1
- package/dist/cjs/components/OrgSelect.d.ts +23 -0
- package/dist/cjs/components/OrgSelect.d.ts.map +1 -1
- package/dist/cjs/components/OrgSelect.js +55 -15
- package/dist/cjs/components/SqlTextEditor.d.ts +7 -0
- package/dist/cjs/components/SqlTextEditor.d.ts.map +1 -0
- package/dist/cjs/components/SqlTextEditor.js +44 -0
- package/dist/cjs/components/UiComponents.d.ts +119 -0
- package/dist/cjs/components/UiComponents.d.ts.map +1 -0
- package/dist/cjs/components/UiComponents.js +268 -0
- package/dist/cjs/forms/client_onboard/ConnectDatabase.d.ts +3 -2
- package/dist/cjs/forms/client_onboard/ConnectDatabase.d.ts.map +1 -1
- package/dist/cjs/forms/client_onboard/ConnectDatabase.js +101 -43
- package/dist/cjs/forms/client_onboard/ConnectSchema.d.ts +3 -1
- package/dist/cjs/forms/client_onboard/ConnectSchema.d.ts.map +1 -1
- package/dist/cjs/forms/client_onboard/ConnectSchema.js +13 -14
- package/dist/cjs/forms/client_onboard/CreateSqlViews.d.ts +10 -1
- package/dist/cjs/forms/client_onboard/CreateSqlViews.d.ts.map +1 -1
- package/dist/cjs/forms/client_onboard/CreateSqlViews.js +12 -10
- package/dist/cjs/forms/sql_views/CreateEditSqlView.d.ts +24 -0
- package/dist/cjs/forms/sql_views/CreateEditSqlView.d.ts.map +1 -0
- package/dist/cjs/forms/sql_views/CreateEditSqlView.js +161 -0
- package/dist/cjs/modals/NewDashboardModal.js +1 -1
- package/dist/cjs/public_components/CreateEnvironment.d.ts.map +1 -1
- package/dist/cjs/public_components/CreateEnvironment.js +34 -8
- package/dist/cjs/public_components/DashboardBuilder.d.ts.map +1 -1
- package/dist/cjs/public_components/DashboardBuilder.js +30 -16
- package/dist/cjs/public_components/DashboardManager.d.ts.map +1 -1
- package/dist/cjs/public_components/DashboardManager.js +110 -93
- package/dist/cjs/public_components/SQLViewManager.d.ts.map +1 -1
- package/dist/cjs/public_components/SQLViewManager.js +252 -333
- package/dist/cjs/utils/constants.d.ts +1 -1
- package/dist/cjs/utils/constants.d.ts.map +1 -1
- package/dist/cjs/utils/constants.js +1 -2
- package/dist/cjs/utils/dataEditor.d.ts +4 -0
- package/dist/cjs/utils/dataEditor.d.ts.map +1 -0
- package/dist/cjs/utils/dataEditor.js +144 -0
- package/dist/cjs/utils/dataFetcher.d.ts +3 -0
- package/dist/cjs/utils/dataFetcher.d.ts.map +1 -0
- package/dist/cjs/utils/dataFetcher.js +68 -0
- package/dist/cjs/utils/databases.d.ts +13 -2
- package/dist/cjs/utils/databases.d.ts.map +1 -1
- package/dist/cjs/utils/databases.js +52 -9
- package/dist/cjs/utils/table.d.ts +2 -0
- package/dist/cjs/utils/table.d.ts.map +1 -1
- package/dist/esm/Admin.d.ts.map +1 -1
- package/dist/esm/Admin.js +25 -15
- package/dist/esm/AdminProvider.d.ts +10 -0
- package/dist/esm/AdminProvider.d.ts.map +1 -1
- package/dist/esm/AdminProvider.js +61 -44
- package/dist/esm/api/ConnectionClient.d.ts +12 -10
- package/dist/esm/api/ConnectionClient.d.ts.map +1 -1
- package/dist/esm/api/ConnectionClient.js +97 -28
- package/dist/esm/assets/ArrowDownHeadIcon.d.ts +5 -0
- package/dist/esm/assets/ArrowDownHeadIcon.d.ts.map +1 -0
- package/dist/esm/assets/ArrowDownHeadIcon.js +3 -0
- package/dist/esm/assets/XIcon.d.ts +5 -0
- package/dist/esm/assets/XIcon.d.ts.map +1 -0
- package/dist/esm/assets/XIcon.js +3 -0
- package/dist/esm/assets/index.d.ts +3 -0
- package/dist/esm/assets/index.d.ts.map +1 -0
- package/dist/esm/assets/index.js +2 -0
- package/dist/esm/components/DatabaseMismatchCard.d.ts +6 -0
- package/dist/esm/components/DatabaseMismatchCard.d.ts.map +1 -0
- package/dist/esm/components/DatabaseMismatchCard.js +15 -0
- package/dist/esm/components/DatabaseSelector.d.ts +2 -1
- package/dist/esm/components/DatabaseSelector.d.ts.map +1 -1
- package/dist/esm/components/DatabaseSelector.js +2 -2
- package/dist/esm/components/DropDownMenuWithLabel.d.ts +2 -1
- package/dist/esm/components/DropDownMenuWithLabel.d.ts.map +1 -1
- package/dist/esm/components/DropDownMenuWithLabel.js +137 -39
- package/dist/esm/components/DynamicBanner.d.ts +11 -0
- package/dist/esm/components/DynamicBanner.d.ts.map +1 -0
- package/dist/esm/components/DynamicBanner.js +16 -0
- package/dist/esm/components/EnvSelectPopover.d.ts.map +1 -1
- package/dist/esm/components/EnvSelectPopover.js +0 -1
- package/dist/esm/components/OrgSelect.d.ts +23 -0
- package/dist/esm/components/OrgSelect.d.ts.map +1 -1
- package/dist/esm/components/OrgSelect.js +52 -16
- package/dist/esm/components/SqlTextEditor.d.ts +7 -0
- package/dist/esm/components/SqlTextEditor.d.ts.map +1 -0
- package/dist/esm/components/SqlTextEditor.js +38 -0
- package/dist/esm/components/UiComponents.d.ts +119 -0
- package/dist/esm/components/UiComponents.d.ts.map +1 -0
- package/dist/esm/components/UiComponents.js +254 -0
- package/dist/esm/forms/client_onboard/ConnectDatabase.d.ts +3 -2
- package/dist/esm/forms/client_onboard/ConnectDatabase.d.ts.map +1 -1
- package/dist/esm/forms/client_onboard/ConnectDatabase.js +102 -44
- package/dist/esm/forms/client_onboard/ConnectSchema.d.ts +3 -1
- package/dist/esm/forms/client_onboard/ConnectSchema.d.ts.map +1 -1
- package/dist/esm/forms/client_onboard/ConnectSchema.js +13 -14
- package/dist/esm/forms/client_onboard/CreateSqlViews.d.ts +10 -1
- package/dist/esm/forms/client_onboard/CreateSqlViews.d.ts.map +1 -1
- package/dist/esm/forms/client_onboard/CreateSqlViews.js +11 -11
- package/dist/esm/forms/sql_views/CreateEditSqlView.d.ts +24 -0
- package/dist/esm/forms/sql_views/CreateEditSqlView.d.ts.map +1 -0
- package/dist/esm/forms/sql_views/CreateEditSqlView.js +155 -0
- package/dist/esm/modals/NewDashboardModal.js +1 -1
- package/dist/esm/public_components/CreateEnvironment.d.ts.map +1 -1
- package/dist/esm/public_components/CreateEnvironment.js +12 -9
- package/dist/esm/public_components/DashboardBuilder.d.ts.map +1 -1
- package/dist/esm/public_components/DashboardBuilder.js +30 -16
- package/dist/esm/public_components/DashboardManager.d.ts.map +1 -1
- package/dist/esm/public_components/DashboardManager.js +111 -94
- package/dist/esm/public_components/SQLViewManager.d.ts.map +1 -1
- package/dist/esm/public_components/SQLViewManager.js +254 -335
- package/dist/esm/utils/constants.d.ts +1 -1
- package/dist/esm/utils/constants.d.ts.map +1 -1
- package/dist/esm/utils/constants.js +1 -2
- package/dist/esm/utils/dataEditor.d.ts +4 -0
- package/dist/esm/utils/dataEditor.d.ts.map +1 -0
- package/dist/esm/utils/dataEditor.js +138 -0
- package/dist/esm/utils/dataFetcher.d.ts +3 -0
- package/dist/esm/utils/dataFetcher.d.ts.map +1 -0
- package/dist/esm/utils/dataFetcher.js +63 -0
- package/dist/esm/utils/databases.d.ts +13 -2
- package/dist/esm/utils/databases.d.ts.map +1 -1
- package/dist/esm/utils/databases.js +52 -9
- package/dist/esm/utils/table.d.ts +2 -0
- package/dist/esm/utils/table.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -22,5 +22,5 @@ export declare const defaultDateRange: {
|
|
|
22
22
|
readonly value: "LAST_90_DAYS";
|
|
23
23
|
readonly label: "Last 90 days";
|
|
24
24
|
};
|
|
25
|
-
export declare const QUILL_SERVER
|
|
25
|
+
export declare const QUILL_SERVER: string;
|
|
26
26
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;EAM1B,CAAC;AACX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AACvE,eAAO,MAAM,gBAAgB;;;CAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;EAM1B,CAAC;AACX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AACvE,eAAO,MAAM,gBAAgB;;;CAA6B,CAAC;AAE3D,eAAO,MAAM,YAAY,QACiD,CAAC"}
|
|
@@ -9,5 +9,4 @@ export const InitialDateRangeOptions = [
|
|
|
9
9
|
{ value: 'ALL_TIME', label: 'All time' },
|
|
10
10
|
];
|
|
11
11
|
export const defaultDateRange = InitialDateRangeOptions[0];
|
|
12
|
-
|
|
13
|
-
export const QUILL_SERVER = 'https://quill-344421.uc.r.appspot.com';
|
|
12
|
+
export const QUILL_SERVER = process.env.QUILL_SERVER_HOST ?? 'https://quill-344421.uc.r.appspot.com';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const editSQLView: (editName: string, editViewQuery: string, editViewId: string, state: any) => Promise<any>;
|
|
2
|
+
export declare const addSqlView: (name: string, editViewQuery: string, state: any) => Promise<any>;
|
|
3
|
+
export declare const deleteSQLView: (id: string, state: any) => Promise<any>;
|
|
4
|
+
//# sourceMappingURL=dataEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataEditor.d.ts","sourceRoot":"","sources":["../../../src/utils/dataEditor.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,aACZ,MAAM,iBACD,MAAM,cACT,MAAM,SACX,GAAG,iBAsDX,CAAC;AAEF,eAAO,MAAM,UAAU,SACf,MAAM,iBACG,MAAM,SACd,GAAG,iBA+CX,CAAC;AAEF,eAAO,MAAM,aAAa,OAAc,MAAM,SAAS,GAAG,iBAmCzD,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { QUILL_SERVER } from './constants';
|
|
2
|
+
export const editSQLView = async (editName, editViewQuery, editViewId, state) => {
|
|
3
|
+
if (!editName.length) {
|
|
4
|
+
alert('Please enter a table name.');
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
if (!editViewQuery.length) {
|
|
8
|
+
alert('Please enter a table query.');
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (!editViewId) {
|
|
12
|
+
alert('Could not save.');
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
let response;
|
|
16
|
+
if (state.queryEndpoint) {
|
|
17
|
+
response = await fetch(state.queryEndpoint, {
|
|
18
|
+
method: 'POST',
|
|
19
|
+
headers: {
|
|
20
|
+
'Content-Type': 'application/json',
|
|
21
|
+
...state.queryHeaders,
|
|
22
|
+
},
|
|
23
|
+
body: JSON.stringify({
|
|
24
|
+
metadata: {
|
|
25
|
+
preQueries: [editViewQuery.replace(/;/, '')],
|
|
26
|
+
name: editName,
|
|
27
|
+
task: 'view',
|
|
28
|
+
id: editViewId,
|
|
29
|
+
clientId: state.client._id,
|
|
30
|
+
runQueryConfig: { getColumns: true },
|
|
31
|
+
databaseType: state.client.databaseType,
|
|
32
|
+
},
|
|
33
|
+
}),
|
|
34
|
+
credentials: state.withCredentials ? 'include' : 'omit', // If withCredentials is true, set to 'include'. Otherwise, set to 'omit'.
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
response = await fetch(`${QUILL_SERVER}/table/${state.client._id}/`, {
|
|
39
|
+
method: 'POST',
|
|
40
|
+
headers: {
|
|
41
|
+
'Content-Type': 'application/json',
|
|
42
|
+
Authorization: `Bearer `,
|
|
43
|
+
},
|
|
44
|
+
body: JSON.stringify({
|
|
45
|
+
viewQuery: editViewQuery[editViewQuery.length - 1] === ';'
|
|
46
|
+
? editViewQuery.slice(0, -1)
|
|
47
|
+
: editViewQuery,
|
|
48
|
+
name: editName,
|
|
49
|
+
id: editViewId,
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return await response.json();
|
|
54
|
+
};
|
|
55
|
+
export const addSqlView = async (name, editViewQuery, state) => {
|
|
56
|
+
if (!name.length) {
|
|
57
|
+
alert('Please enter a table name.');
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (!editViewQuery.length) {
|
|
61
|
+
alert('Please enter a table query.');
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
let response;
|
|
65
|
+
if (state.queryEndpoint) {
|
|
66
|
+
response = await fetch(state.queryEndpoint, {
|
|
67
|
+
method: 'POST',
|
|
68
|
+
headers: {
|
|
69
|
+
'Content-Type': 'application/json',
|
|
70
|
+
...state.queryHeaders,
|
|
71
|
+
},
|
|
72
|
+
body: JSON.stringify({
|
|
73
|
+
metadata: {
|
|
74
|
+
preQueries: [editViewQuery.replace(/;/, '')],
|
|
75
|
+
name: name,
|
|
76
|
+
task: 'view',
|
|
77
|
+
clientId: state.client._id,
|
|
78
|
+
runQueryConfig: { getColumns: true },
|
|
79
|
+
databaseType: state.client.databaseType,
|
|
80
|
+
},
|
|
81
|
+
}),
|
|
82
|
+
credentials: state.withCredentials ? 'include' : 'omit', // If withCredentials is true, set to 'include'. Otherwise, set to 'omit'.
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
response = await fetch(`${QUILL_SERVER}/table/${state.client._id}/`, {
|
|
87
|
+
method: 'POST',
|
|
88
|
+
headers: {
|
|
89
|
+
'Content-Type': 'application/json',
|
|
90
|
+
Authorization: `Bearer `,
|
|
91
|
+
},
|
|
92
|
+
body: JSON.stringify({
|
|
93
|
+
viewQuery: editViewQuery[editViewQuery.length - 1] === ';'
|
|
94
|
+
? editViewQuery.slice(0, -1)
|
|
95
|
+
: editViewQuery,
|
|
96
|
+
name: name,
|
|
97
|
+
}),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return await response.json();
|
|
101
|
+
};
|
|
102
|
+
export const deleteSQLView = async (id, state) => {
|
|
103
|
+
let response;
|
|
104
|
+
if (state.queryEndpoint) {
|
|
105
|
+
response = await fetch(state.queryEndpoint, {
|
|
106
|
+
method: 'POST',
|
|
107
|
+
headers: {
|
|
108
|
+
'Content-Type': 'application/json',
|
|
109
|
+
...state.queryHeaders,
|
|
110
|
+
},
|
|
111
|
+
body: JSON.stringify({
|
|
112
|
+
metadata: {
|
|
113
|
+
task: 'view',
|
|
114
|
+
id: id,
|
|
115
|
+
deleted: true,
|
|
116
|
+
clientId: state.client._id,
|
|
117
|
+
runQueryConfig: { getColumns: true },
|
|
118
|
+
databaseType: state.client.databaseType,
|
|
119
|
+
},
|
|
120
|
+
}),
|
|
121
|
+
credentials: state.withCredentials ? 'include' : 'omit', // If withCredentials is true, set to 'include'. Otherwise, set to 'omit'.
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
response = await fetch(`${QUILL_SERVER}/table/${state.client._id}/`, {
|
|
126
|
+
method: 'POST',
|
|
127
|
+
headers: {
|
|
128
|
+
'Content-Type': 'application/json',
|
|
129
|
+
Authorization: `Bearer `,
|
|
130
|
+
},
|
|
131
|
+
body: JSON.stringify({
|
|
132
|
+
id: id,
|
|
133
|
+
deleted: true,
|
|
134
|
+
}),
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return await response.json();
|
|
138
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function getData(client: any, cloudQueryEndpoint: string, noCred: RequestCredentials, hostedRequestBody: any, cloudRequestBody: any, method?: string): Promise<any>;
|
|
2
|
+
export declare function getDataFromCloud(client: any, cloudQueryEndpoint: string, cloudRequestBody: any, method?: string): Promise<any>;
|
|
3
|
+
//# sourceMappingURL=dataFetcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataFetcher.d.ts","sourceRoot":"","sources":["../../../src/utils/dataFetcher.tsx"],"names":[],"mappings":"AAEA,wBAAsB,OAAO,CAC3B,MAAM,EAAE,GAAG,EACX,kBAAkB,EAAE,MAAM,EAC1B,MAAM,EAAE,kBAAkB,EAC1B,iBAAiB,EAAE,GAAG,EACtB,gBAAgB,EAAE,GAAG,EACrB,MAAM,SAAS,gBAkChB;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,GAAG,EACX,kBAAkB,EAAE,MAAM,EAC1B,gBAAgB,EAAE,GAAG,EACrB,MAAM,SAAS,gBAgChB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// this function gets the data either from the self hosted endpoint or
|
|
2
|
+
// our cloud server
|
|
3
|
+
export async function getData(client, cloudQueryEndpoint, noCred, hostedRequestBody, cloudRequestBody, method = 'POST') {
|
|
4
|
+
if (client.queryEndpoint) {
|
|
5
|
+
// self hosted
|
|
6
|
+
const resp = await fetch(client.queryEndpoint, {
|
|
7
|
+
method: 'POST',
|
|
8
|
+
headers: {
|
|
9
|
+
...client.queryHeaders,
|
|
10
|
+
'Content-Type': 'application/json',
|
|
11
|
+
},
|
|
12
|
+
credentials: client.withCredentials ? 'include' : noCred,
|
|
13
|
+
body: JSON.stringify(hostedRequestBody),
|
|
14
|
+
});
|
|
15
|
+
try {
|
|
16
|
+
const responseJson = await resp.json();
|
|
17
|
+
const result = {
|
|
18
|
+
...responseJson.data,
|
|
19
|
+
rows: responseJson?.queries?.queryResults[0]?.rows,
|
|
20
|
+
compareRows: responseJson?.queries?.queryResults[1]?.rows,
|
|
21
|
+
};
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
console.error('Failed to parse JSON:', e);
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
// cloud
|
|
31
|
+
return await getDataFromCloud(client, cloudQueryEndpoint, cloudRequestBody, method);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export async function getDataFromCloud(client, cloudQueryEndpoint, cloudRequestBody, method = 'POST') {
|
|
35
|
+
const environment = client?.environment;
|
|
36
|
+
const resp = await fetch(
|
|
37
|
+
// `https://quill-344421.uc.r.appspot.com/${cloudQueryEndpoint}`,
|
|
38
|
+
`http://localhost:8080/${cloudQueryEndpoint}`, {
|
|
39
|
+
method,
|
|
40
|
+
headers: {
|
|
41
|
+
Authorization: 'Bearer ',
|
|
42
|
+
...(environment ? { environment } : {}), // Remember to provide the actual token
|
|
43
|
+
'Content-Type': 'application/json',
|
|
44
|
+
environment: environment || undefined,
|
|
45
|
+
},
|
|
46
|
+
body: method === 'POST'
|
|
47
|
+
? JSON.stringify({
|
|
48
|
+
...cloudRequestBody,
|
|
49
|
+
...{
|
|
50
|
+
publicKey: client?._id,
|
|
51
|
+
orgId: client?.adminCustomerId,
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
: null,
|
|
55
|
+
});
|
|
56
|
+
try {
|
|
57
|
+
return await resp.json();
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
console.error('Failed to parse JSON:', e);
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -21,7 +21,18 @@ interface MySQLConnection extends DatabaseConnection {
|
|
|
21
21
|
databaseName: string;
|
|
22
22
|
port: string;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
interface SnowflakeConnection extends DatabaseConnection {
|
|
25
|
+
user: string;
|
|
26
|
+
password: string;
|
|
27
|
+
host: string;
|
|
28
|
+
databaseName: string;
|
|
29
|
+
port: string;
|
|
30
|
+
}
|
|
31
|
+
interface BigQueryConnection extends DatabaseConnection {
|
|
32
|
+
companyTag: string;
|
|
33
|
+
jsonString: string;
|
|
34
|
+
}
|
|
35
|
+
export type ConnectionType = DatabaseConnection | PostgresConnection | MySQLConnection | SnowflakeConnection | BigQueryConnection;
|
|
25
36
|
export interface DatabaseDefaultInfo {
|
|
26
37
|
label: string;
|
|
27
38
|
value: string;
|
|
@@ -29,6 +40,6 @@ export interface DatabaseDefaultInfo {
|
|
|
29
40
|
}
|
|
30
41
|
export declare const DATABASE_DEFAULT_INFO: DatabaseDefaultInfo[];
|
|
31
42
|
export declare function getDatabaseConnectionFormat(databaseName: string): ConnectionType | undefined;
|
|
32
|
-
export declare function formConnectionString(connection
|
|
43
|
+
export declare function formConnectionString(connection?: DatabaseConnection, jsonFile?: File): string;
|
|
33
44
|
export {};
|
|
34
45
|
//# sourceMappingURL=databases.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"databases.d.ts","sourceRoot":"","sources":["../../../src/utils/databases.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,kBAAmB,SAAQ,kBAAkB;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,eAAgB,SAAQ,kBAAkB;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,cAAc,GACtB,kBAAkB,GAClB,kBAAkB,GAClB,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"databases.d.ts","sourceRoot":"","sources":["../../../src/utils/databases.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,kBAAmB,SAAQ,kBAAkB;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,eAAgB,SAAQ,kBAAkB;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,mBAAoB,SAAQ,kBAAkB;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,kBAAmB,SAAQ,kBAAkB;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,cAAc,GACtB,kBAAkB,GAClB,kBAAkB,GAClB,eAAe,GACf,mBAAmB,GACnB,kBAAkB,CAAC;AAEvB,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,qBAAqB,EAAE,mBAAmB,EAyBtD,CAAC;AAEF,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,MAAM,GACnB,cAAc,GAAG,SAAS,CAwC5B;AAED,wBAAgB,oBAAoB,CAClC,UAAU,CAAC,EAAE,kBAAkB,EAC/B,QAAQ,CAAC,EAAE,IAAI,UAyBhB"}
|
|
@@ -4,12 +4,21 @@ export const DATABASE_DEFAULT_INFO = [
|
|
|
4
4
|
value: 'PostgreSQL',
|
|
5
5
|
imageUrl: 'https://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Postgresql_elephant.svg/640px-Postgresql_elephant.svg.png',
|
|
6
6
|
},
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
{
|
|
8
|
+
label: 'Big Query',
|
|
9
|
+
value: 'BigQuery',
|
|
10
|
+
imageUrl: 'https://cdn.icon-icons.com/icons2/2699/PNG/512/google_bigquery_logo_icon_168150.png',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
label: 'Snowflake',
|
|
14
|
+
value: 'Snowflake',
|
|
15
|
+
imageUrl: 'https://estuary.dev/static/972ca52d0addb818460efc144940d25f/f8411/7154a4_Snowflake_a6a3c49601.png',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
label: 'MySQL',
|
|
19
|
+
value: 'MySQL',
|
|
20
|
+
imageUrl: 'https://d1.awsstatic.com/asset-repository/products/amazon-rds/1024px-MySQL.ff87215b43fd7292af172e2a5d9b844217262571.png',
|
|
21
|
+
},
|
|
13
22
|
];
|
|
14
23
|
export function getDatabaseConnectionFormat(databaseName) {
|
|
15
24
|
if (databaseName === 'PostgreSQL') {
|
|
@@ -23,20 +32,39 @@ export function getDatabaseConnectionFormat(databaseName) {
|
|
|
23
32
|
connectionString: '',
|
|
24
33
|
};
|
|
25
34
|
}
|
|
26
|
-
else if (databaseName === '
|
|
35
|
+
else if (databaseName === 'MySQL') {
|
|
27
36
|
return {
|
|
28
37
|
user: '',
|
|
29
38
|
password: '',
|
|
30
39
|
host: '',
|
|
31
40
|
databaseName: '',
|
|
32
41
|
port: '',
|
|
33
|
-
type: '
|
|
42
|
+
type: 'MySQL',
|
|
34
43
|
connectionString: '',
|
|
35
44
|
};
|
|
36
45
|
}
|
|
46
|
+
else if (databaseName === 'Snowflake') {
|
|
47
|
+
return {
|
|
48
|
+
user: '',
|
|
49
|
+
password: '',
|
|
50
|
+
host: '',
|
|
51
|
+
databaseName: '',
|
|
52
|
+
port: '',
|
|
53
|
+
type: 'Snowflake',
|
|
54
|
+
connectionString: '',
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
else if (databaseName === 'BigQuery') {
|
|
58
|
+
return {
|
|
59
|
+
type: 'BigQuery',
|
|
60
|
+
connectionString: '',
|
|
61
|
+
companyTag: '',
|
|
62
|
+
jsonString: '',
|
|
63
|
+
};
|
|
64
|
+
}
|
|
37
65
|
return undefined;
|
|
38
66
|
}
|
|
39
|
-
export function formConnectionString(connection) {
|
|
67
|
+
export function formConnectionString(connection, jsonFile) {
|
|
40
68
|
if (!connection) {
|
|
41
69
|
return 'There is no connection info';
|
|
42
70
|
}
|
|
@@ -47,5 +75,20 @@ export function formConnectionString(connection) {
|
|
|
47
75
|
const typedConnection = connection;
|
|
48
76
|
return `postgres://${typedConnection.user}:${typedConnection.password}@${typedConnection.host}:${typedConnection.port}/${typedConnection.databaseName}`;
|
|
49
77
|
}
|
|
78
|
+
else if (connection.type === 'mysql') {
|
|
79
|
+
const typedConnection = connection;
|
|
80
|
+
return `mysql://${typedConnection.user}:${typedConnection.password}@${typedConnection.host}:${typedConnection.port}`;
|
|
81
|
+
}
|
|
82
|
+
else if (connection.type === 'snowflake') {
|
|
83
|
+
const typedConnection = connection;
|
|
84
|
+
return `mysql://${typedConnection.user}:${typedConnection.password}@${typedConnection.host}:${typedConnection.port}`;
|
|
85
|
+
}
|
|
86
|
+
else if (connection.type === 'BigQuery') {
|
|
87
|
+
const typedConnection = connection;
|
|
88
|
+
const cleanedJsonString = typedConnection.jsonString
|
|
89
|
+
.replace(/\\(?![n"])/g, '')
|
|
90
|
+
.replace(/\n/g, '');
|
|
91
|
+
return `${typedConnection.companyTag}${cleanedJsonString}`;
|
|
92
|
+
}
|
|
50
93
|
return '';
|
|
51
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/utils/table.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE;QACP,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;KACpB,EAAE,CAAC;CACL;AAED,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/utils/table.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE;QACP,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;KACpB,EAAE,CAAC;CACL;AAED,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quillsql/admin",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
4
4
|
"description": "Admin tools for Quill",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "rm -rf dist && tsc -p tsconfig.json && tsc -p tsconfig.esm.json",
|
|
17
|
-
"dev": "tsc -p tsconfig.json -w & tsc -p tsconfig.esm.json",
|
|
17
|
+
"dev": "tsc -p tsconfig.json -w & tsc -p tsconfig.esm.json -w",
|
|
18
18
|
"lint": "eslint . --max-warnings 0"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|