@quillsql/admin 1.8.0 → 1.8.2

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/index.cjs CHANGED
@@ -69,10 +69,10 @@ var ALL_TENANTS = "QUILL_ALL_TENANTS";
69
69
  var SINGLE_TENANT = "QUILL_SINGLE_TENANT";
70
70
  var SAVED_QUERIES_DASHBOARD = "quill-saved-queries";
71
71
  var QUILL_SERVER = typeof process !== "undefined" && process.env ? process.env.QUILL_SERVER_HOST ?? "https://quill-344421.uc.r.appspot.com" : "https://quill-344421.uc.r.appspot.com";
72
- var QUILL_QUERY_ENDPOINT = typeof process !== "undefined" && process.env ? process.env.QUILL_QUERY_ENDPOINT ?? "/cloud" : "/cloud";
72
+ var QUILL_QUERY_ENDPOINT = "/cloud/engine";
73
73
  var QUILL_ENDPOINTS = [
74
- "https://quill-344421.uc.r.appspot.com/cloud",
75
- "https://quill-ruby-server.onrender.com/cloud"
74
+ "https://quill-344421.uc.r.appspot.com/cloud/engine",
75
+ "https://quill-ruby-server.onrender.com/cloud/engine"
76
76
  ];
77
77
 
78
78
  // src/public_components/CreateEnvironment.tsx
@@ -2186,7 +2186,7 @@ async function getVirtualTableData(clientId, query, databaseType, queryEndpoint,
2186
2186
  },
2187
2187
  task: "query-view",
2188
2188
  metadata: {
2189
- preQueries: [query],
2189
+ view: query,
2190
2190
  clientId,
2191
2191
  runQueryConfig: {
2192
2192
  convertDatatypes: true,
@@ -2248,7 +2248,7 @@ async function getVirtualTableData(clientId, query, databaseType, queryEndpoint,
2248
2248
  }
2249
2249
  }
2250
2250
  return queryEndpoint ? {
2251
- ...results.data.queryResults[0],
2251
+ ...results.queries.queryResults[0],
2252
2252
  ...queryAst,
2253
2253
  success: results.status === "success" ? true : false
2254
2254
  } : { ...results, ...queryAst };
@@ -8267,15 +8267,7 @@ function AdminProvider({
8267
8267
  }
8268
8268
  return adminState;
8269
8269
  };
8270
- const initialState = (0, import_react23.useMemo)(() => {
8271
- const localState = JSON.parse(
8272
- sessionStorage.getItem("quill-adminState") ?? "null"
8273
- );
8274
- if (clerkOrgId && localState?.clerkOrgId === clerkOrgId) {
8275
- return parsedSessionStorageAdminState(localState);
8276
- }
8277
- sessionStorage.removeItem("quill-adminState");
8278
- sessionStorage.removeItem("quill-client");
8270
+ const buildDefaultState = () => {
8279
8271
  const populatedTheme = {
8280
8272
  ...theme,
8281
8273
  fontFamily: theme?.fontFamily ?? defaultTheme.fontFamily,
@@ -8305,20 +8297,15 @@ function AdminProvider({
8305
8297
  withCredentials,
8306
8298
  client: null,
8307
8299
  clients: [],
8308
- organization: null,
8309
- organizations: [],
8310
- organizationId: null,
8311
8300
  activeQuery: "",
8312
8301
  activeEditItem: void 0,
8313
8302
  tables: [],
8314
8303
  schema: [],
8315
8304
  activeComponent: "Dashboards",
8316
- dashboards: [],
8317
8305
  selectedDashboard: null,
8318
8306
  reportId: null,
8319
8307
  report: null,
8320
8308
  theme: populatedTheme,
8321
- organizationIdSet: false,
8322
8309
  dateFilter: {},
8323
8310
  clerkOrgId: clerkOrgId || "",
8324
8311
  databaseTypeMismatch: { show: false, backendDatabaseType: "" },
@@ -8326,6 +8313,30 @@ function AdminProvider({
8326
8313
  databaseSchema: void 0,
8327
8314
  AskAIButton
8328
8315
  };
8316
+ };
8317
+ const hydrateStateFromSessionStorage = () => {
8318
+ if (typeof window === "undefined") {
8319
+ return null;
8320
+ }
8321
+ try {
8322
+ const localState = JSON.parse(
8323
+ window.sessionStorage.getItem("quill-adminState") ?? "null"
8324
+ );
8325
+ if (clerkOrgId && localState?.clerkOrgId === clerkOrgId) {
8326
+ return parsedSessionStorageAdminState(localState);
8327
+ }
8328
+ } catch (error2) {
8329
+ console.warn(
8330
+ "AdminProvider: unable to parse quill-adminState from sessionStorage",
8331
+ error2
8332
+ );
8333
+ }
8334
+ window.sessionStorage.removeItem("quill-adminState");
8335
+ window.sessionStorage.removeItem("quill-client");
8336
+ return null;
8337
+ };
8338
+ const initialState = (0, import_react23.useMemo)(() => {
8339
+ return hydrateStateFromSessionStorage() ?? buildDefaultState();
8329
8340
  }, []);
8330
8341
  const [state, dispatch] = (0, import_react23.useReducer)(reducer, initialState);
8331
8342
  const stateWithFlagsList = (0, import_react23.useMemo)(() => {
@@ -8539,11 +8550,16 @@ function AdminProvider({
8539
8550
  }
8540
8551
  }, [clerkOrgId]);
8541
8552
  (0, import_react23.useEffect)(() => {
8553
+ if (typeof window === "undefined") {
8554
+ return;
8555
+ }
8542
8556
  if (publicKeyRef.current !== publicKey) {
8543
8557
  dispatch({ type: "SET_ALL_STATE", payload: initialState });
8544
8558
  publicKeyRef.current = publicKey;
8545
8559
  }
8546
- const client = JSON.parse(sessionStorage.getItem("quill-client") || "null");
8560
+ const client = JSON.parse(
8561
+ window.sessionStorage.getItem("quill-client") ?? "null"
8562
+ );
8547
8563
  let overridePublicKey = null;
8548
8564
  if (client && client.clerkOrgId === clerkOrgId) {
8549
8565
  overridePublicKey = client.id || client._id || client.publicKey;
@@ -8558,7 +8574,10 @@ function AdminProvider({
8558
8574
  }
8559
8575
  }, [publicKey]);
8560
8576
  (0, import_react23.useEffect)(() => {
8561
- sessionStorage.setItem(
8577
+ if (typeof window === "undefined") {
8578
+ return;
8579
+ }
8580
+ window.sessionStorage.setItem(
8562
8581
  "quill-adminState",
8563
8582
  JSON.stringify({
8564
8583
  ...state,
@@ -8568,7 +8587,6 @@ function AdminProvider({
8568
8587
  },
8569
8588
  clients: [],
8570
8589
  tables: [],
8571
- dashboards: [],
8572
8590
  allTenantTypes: void 0,
8573
8591
  selectedTenantValues: void 0,
8574
8592
  selectedDashboardTenantIds: void 0,
@@ -15909,9 +15927,6 @@ function EditFiltersModal({
15909
15927
  ),
15910
15928
  [state.client?.allTenantTypes, state.client?.ownerTenantFields]
15911
15929
  );
15912
- (0, import_react40.useEffect)(() => {
15913
- console.log("New tenant filters:", newTenantFilters);
15914
- }, [newTenantFilters]);
15915
15930
  const assignDefaultInterval = (label, set2, loopStart, loopEnd) => {
15916
15931
  if (!newDateFilter) return;
15917
15932
  if (set2) {
@@ -19862,7 +19877,6 @@ function ChartQueryBuilder({
19862
19877
  import_react46.SQLEditor,
19863
19878
  {
19864
19879
  isAdminEnabled: true,
19865
- showTableFormatOptions: true,
19866
19880
  showAccessControlOptions: true,
19867
19881
  showDateFieldOptions: true,
19868
19882
  defaultQuery: query,
package/dist/index.js CHANGED
@@ -29,10 +29,10 @@ var ALL_TENANTS = "QUILL_ALL_TENANTS";
29
29
  var SINGLE_TENANT = "QUILL_SINGLE_TENANT";
30
30
  var SAVED_QUERIES_DASHBOARD = "quill-saved-queries";
31
31
  var QUILL_SERVER = typeof process !== "undefined" && process.env ? process.env.QUILL_SERVER_HOST ?? "https://quill-344421.uc.r.appspot.com" : "https://quill-344421.uc.r.appspot.com";
32
- var QUILL_QUERY_ENDPOINT = typeof process !== "undefined" && process.env ? process.env.QUILL_QUERY_ENDPOINT ?? "/cloud" : "/cloud";
32
+ var QUILL_QUERY_ENDPOINT = "/cloud/engine";
33
33
  var QUILL_ENDPOINTS = [
34
- "https://quill-344421.uc.r.appspot.com/cloud",
35
- "https://quill-ruby-server.onrender.com/cloud"
34
+ "https://quill-344421.uc.r.appspot.com/cloud/engine",
35
+ "https://quill-ruby-server.onrender.com/cloud/engine"
36
36
  ];
37
37
 
38
38
  // src/public_components/CreateEnvironment.tsx
@@ -2160,7 +2160,7 @@ async function getVirtualTableData(clientId, query, databaseType, queryEndpoint,
2160
2160
  },
2161
2161
  task: "query-view",
2162
2162
  metadata: {
2163
- preQueries: [query],
2163
+ view: query,
2164
2164
  clientId,
2165
2165
  runQueryConfig: {
2166
2166
  convertDatatypes: true,
@@ -2222,7 +2222,7 @@ async function getVirtualTableData(clientId, query, databaseType, queryEndpoint,
2222
2222
  }
2223
2223
  }
2224
2224
  return queryEndpoint ? {
2225
- ...results.data.queryResults[0],
2225
+ ...results.queries.queryResults[0],
2226
2226
  ...queryAst,
2227
2227
  success: results.status === "success" ? true : false
2228
2228
  } : { ...results, ...queryAst };
@@ -8255,15 +8255,7 @@ function AdminProvider({
8255
8255
  }
8256
8256
  return adminState;
8257
8257
  };
8258
- const initialState = useMemo7(() => {
8259
- const localState = JSON.parse(
8260
- sessionStorage.getItem("quill-adminState") ?? "null"
8261
- );
8262
- if (clerkOrgId && localState?.clerkOrgId === clerkOrgId) {
8263
- return parsedSessionStorageAdminState(localState);
8264
- }
8265
- sessionStorage.removeItem("quill-adminState");
8266
- sessionStorage.removeItem("quill-client");
8258
+ const buildDefaultState = () => {
8267
8259
  const populatedTheme = {
8268
8260
  ...theme,
8269
8261
  fontFamily: theme?.fontFamily ?? defaultTheme.fontFamily,
@@ -8293,20 +8285,15 @@ function AdminProvider({
8293
8285
  withCredentials,
8294
8286
  client: null,
8295
8287
  clients: [],
8296
- organization: null,
8297
- organizations: [],
8298
- organizationId: null,
8299
8288
  activeQuery: "",
8300
8289
  activeEditItem: void 0,
8301
8290
  tables: [],
8302
8291
  schema: [],
8303
8292
  activeComponent: "Dashboards",
8304
- dashboards: [],
8305
8293
  selectedDashboard: null,
8306
8294
  reportId: null,
8307
8295
  report: null,
8308
8296
  theme: populatedTheme,
8309
- organizationIdSet: false,
8310
8297
  dateFilter: {},
8311
8298
  clerkOrgId: clerkOrgId || "",
8312
8299
  databaseTypeMismatch: { show: false, backendDatabaseType: "" },
@@ -8314,6 +8301,30 @@ function AdminProvider({
8314
8301
  databaseSchema: void 0,
8315
8302
  AskAIButton
8316
8303
  };
8304
+ };
8305
+ const hydrateStateFromSessionStorage = () => {
8306
+ if (typeof window === "undefined") {
8307
+ return null;
8308
+ }
8309
+ try {
8310
+ const localState = JSON.parse(
8311
+ window.sessionStorage.getItem("quill-adminState") ?? "null"
8312
+ );
8313
+ if (clerkOrgId && localState?.clerkOrgId === clerkOrgId) {
8314
+ return parsedSessionStorageAdminState(localState);
8315
+ }
8316
+ } catch (error2) {
8317
+ console.warn(
8318
+ "AdminProvider: unable to parse quill-adminState from sessionStorage",
8319
+ error2
8320
+ );
8321
+ }
8322
+ window.sessionStorage.removeItem("quill-adminState");
8323
+ window.sessionStorage.removeItem("quill-client");
8324
+ return null;
8325
+ };
8326
+ const initialState = useMemo7(() => {
8327
+ return hydrateStateFromSessionStorage() ?? buildDefaultState();
8317
8328
  }, []);
8318
8329
  const [state, dispatch] = useReducer(reducer, initialState);
8319
8330
  const stateWithFlagsList = useMemo7(() => {
@@ -8527,11 +8538,16 @@ function AdminProvider({
8527
8538
  }
8528
8539
  }, [clerkOrgId]);
8529
8540
  useEffect15(() => {
8541
+ if (typeof window === "undefined") {
8542
+ return;
8543
+ }
8530
8544
  if (publicKeyRef.current !== publicKey) {
8531
8545
  dispatch({ type: "SET_ALL_STATE", payload: initialState });
8532
8546
  publicKeyRef.current = publicKey;
8533
8547
  }
8534
- const client = JSON.parse(sessionStorage.getItem("quill-client") || "null");
8548
+ const client = JSON.parse(
8549
+ window.sessionStorage.getItem("quill-client") ?? "null"
8550
+ );
8535
8551
  let overridePublicKey = null;
8536
8552
  if (client && client.clerkOrgId === clerkOrgId) {
8537
8553
  overridePublicKey = client.id || client._id || client.publicKey;
@@ -8546,7 +8562,10 @@ function AdminProvider({
8546
8562
  }
8547
8563
  }, [publicKey]);
8548
8564
  useEffect15(() => {
8549
- sessionStorage.setItem(
8565
+ if (typeof window === "undefined") {
8566
+ return;
8567
+ }
8568
+ window.sessionStorage.setItem(
8550
8569
  "quill-adminState",
8551
8570
  JSON.stringify({
8552
8571
  ...state,
@@ -8556,7 +8575,6 @@ function AdminProvider({
8556
8575
  },
8557
8576
  clients: [],
8558
8577
  tables: [],
8559
- dashboards: [],
8560
8578
  allTenantTypes: void 0,
8561
8579
  selectedTenantValues: void 0,
8562
8580
  selectedDashboardTenantIds: void 0,
@@ -15912,9 +15930,6 @@ function EditFiltersModal({
15912
15930
  ),
15913
15931
  [state.client?.allTenantTypes, state.client?.ownerTenantFields]
15914
15932
  );
15915
- useEffect22(() => {
15916
- console.log("New tenant filters:", newTenantFilters);
15917
- }, [newTenantFilters]);
15918
15933
  const assignDefaultInterval = (label, set2, loopStart, loopEnd) => {
15919
15934
  if (!newDateFilter) return;
15920
15935
  if (set2) {
@@ -19869,7 +19884,6 @@ function ChartQueryBuilder({
19869
19884
  SQLEditor2,
19870
19885
  {
19871
19886
  isAdminEnabled: true,
19872
- showTableFormatOptions: true,
19873
19887
  showAccessControlOptions: true,
19874
19888
  showDateFieldOptions: true,
19875
19889
  defaultQuery: query,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/admin",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "description": "Admin tools for Quill",
5
5
  "type": "module",
6
6
  "exports": {