@quillsql/admin 1.7.3 → 1.7.4

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
@@ -606,7 +606,7 @@ var MemoizedButton = ({
606
606
  color: ${primary ? state.theme?.primaryButtonTextColor ?? "white" : state.theme?.secondaryTextColor}
607
607
  }
608
608
  .quill-button:hover {
609
- background-color: ${primary ? state.theme?.hoverPrimaryButtonColor : "rgba(56, 65, 81, 0.9)"};
609
+ background-color: ${primary ? state.theme?.hoverPrimaryButtonColor ?? "rgba(56, 65, 81, 0.9)" : "rgba(56, 65, 81, 0.9)"};
610
610
  color: ${primary ? state.theme?.hoverPrimaryButtonTextColor ?? "white" : state.theme?.secondaryTextColor}
611
611
  }` }),
612
612
  isLoading ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { position: "absolute" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LoadingSpinner, {}) }) : null,
@@ -1935,7 +1935,7 @@ var quillFetch = async ({
1935
1935
  };
1936
1936
 
1937
1937
  // src/api/ConnectionClient.ts
1938
- async function testConnectionString(queryEndpoint, connectionString, databaseType, getToken, clientId, queryHeaders) {
1938
+ async function testConnectionString(queryEndpoint, connectionString, databaseType, getToken, clientId, queryHeaders, withCredentials) {
1939
1939
  const controller = new AbortController();
1940
1940
  const timeoutId = setTimeout(() => controller.abort(), 1e4);
1941
1941
  try {
@@ -1960,7 +1960,7 @@ async function testConnectionString(queryEndpoint, connectionString, databaseTyp
1960
1960
  queryEndpoint,
1961
1961
  queryHeaders,
1962
1962
  clientId,
1963
- withCredentials: false
1963
+ withCredentials: !!withCredentials
1964
1964
  },
1965
1965
  task: "test-connection",
1966
1966
  metadata: {
@@ -1981,13 +1981,13 @@ async function testConnectionString(queryEndpoint, connectionString, databaseTyp
1981
1981
  throw error;
1982
1982
  }
1983
1983
  }
1984
- async function setSchemaNames(queryEndpoint, clientId, schemaNames, getToken, queryHeaders) {
1984
+ async function setSchemaNames(queryEndpoint, clientId, schemaNames, getToken, queryHeaders, withCredentials) {
1985
1985
  await quillFetch({
1986
1986
  client: {
1987
1987
  queryEndpoint,
1988
1988
  queryHeaders,
1989
1989
  clientId,
1990
- withCredentials: false
1990
+ withCredentials: !!withCredentials
1991
1991
  },
1992
1992
  task: "set-schemas",
1993
1993
  metadata: {
@@ -1997,14 +1997,14 @@ async function setSchemaNames(queryEndpoint, clientId, schemaNames, getToken, qu
1997
1997
  getToken
1998
1998
  });
1999
1999
  }
2000
- async function getSchemaTables(schemas, databaseType, queryEndpoint, clientId, getToken, queryHeaders) {
2000
+ async function getSchemaTables(schemas, databaseType, queryEndpoint, clientId, getToken, queryHeaders, withCredentials) {
2001
2001
  const schemaMap = {};
2002
2002
  const { queries } = await quillFetch({
2003
2003
  client: {
2004
2004
  queryEndpoint,
2005
2005
  queryHeaders,
2006
2006
  clientId,
2007
- withCredentials: false
2007
+ withCredentials: !!withCredentials
2008
2008
  },
2009
2009
  task: "get-tables-by-schemas",
2010
2010
  metadata: {
@@ -2036,13 +2036,13 @@ async function getSchemaTables(schemas, databaseType, queryEndpoint, clientId, g
2036
2036
  }
2037
2037
  return { tables: allTables.flat(), schema: schemaMap };
2038
2038
  }
2039
- async function getTableColumns(tables, databaseType, queryEndpoint, clientId, getToken, queryHeaders) {
2039
+ async function getTableColumns(tables, databaseType, queryEndpoint, clientId, getToken, queryHeaders, withCredentials) {
2040
2040
  const { queries } = await quillFetch({
2041
2041
  client: {
2042
2042
  queryEndpoint,
2043
2043
  queryHeaders,
2044
2044
  clientId,
2045
- withCredentials: false
2045
+ withCredentials: !!withCredentials
2046
2046
  },
2047
2047
  task: "get-schema-table-columns",
2048
2048
  metadata: {
@@ -2077,7 +2077,7 @@ async function getTableColumns(tables, databaseType, queryEndpoint, clientId, ge
2077
2077
  }
2078
2078
  return columnsByTable;
2079
2079
  }
2080
- async function getTableColumnsBySchema(isSelfHosted, queryEndpoint, clientId, databaseType, getToken, schemas, queryHeaders) {
2080
+ async function getTableColumnsBySchema(isSelfHosted, queryEndpoint, clientId, databaseType, getToken, schemas, queryHeaders, withCredentials) {
2081
2081
  if (isSelfHosted) {
2082
2082
  const { tables, schema } = await getSchemaTables(
2083
2083
  schemas,
@@ -2085,7 +2085,8 @@ async function getTableColumnsBySchema(isSelfHosted, queryEndpoint, clientId, da
2085
2085
  queryEndpoint,
2086
2086
  clientId,
2087
2087
  getToken,
2088
- queryHeaders
2088
+ queryHeaders,
2089
+ withCredentials
2089
2090
  );
2090
2091
  const columnsByTable = await getTableColumns(
2091
2092
  tables,
@@ -2093,7 +2094,8 @@ async function getTableColumnsBySchema(isSelfHosted, queryEndpoint, clientId, da
2093
2094
  queryEndpoint,
2094
2095
  clientId,
2095
2096
  getToken,
2096
- queryHeaders
2097
+ queryHeaders,
2098
+ withCredentials
2097
2099
  );
2098
2100
  return { columnsByTable, schema };
2099
2101
  } else {
@@ -2102,7 +2104,7 @@ async function getTableColumnsBySchema(isSelfHosted, queryEndpoint, clientId, da
2102
2104
  queryEndpoint,
2103
2105
  queryHeaders,
2104
2106
  clientId,
2105
- withCredentials: false
2107
+ withCredentials: !!withCredentials
2106
2108
  },
2107
2109
  task: "table-info-by-schema",
2108
2110
  metadata: {
@@ -2132,7 +2134,7 @@ async function getTableColumnsBySchema(isSelfHosted, queryEndpoint, clientId, da
2132
2134
  return { columnsByTable: formattedResults, schema: results.data.schema };
2133
2135
  }
2134
2136
  }
2135
- async function getVirtualTableData(clientId, query, databaseType, queryEndpoint, getToken, eventTracking, queryHeaders) {
2137
+ async function getVirtualTableData(clientId, query, databaseType, queryEndpoint, getToken, eventTracking, queryHeaders, withCredentials) {
2136
2138
  let queryAst = void 0;
2137
2139
  try {
2138
2140
  const { data } = await quillFetch({
@@ -2140,7 +2142,7 @@ async function getVirtualTableData(clientId, query, databaseType, queryEndpoint,
2140
2142
  queryEndpoint,
2141
2143
  queryHeaders,
2142
2144
  clientId,
2143
- withCredentials: false
2145
+ withCredentials: !!withCredentials
2144
2146
  },
2145
2147
  task: "astify",
2146
2148
  metadata: {
@@ -2148,6 +2150,7 @@ async function getVirtualTableData(clientId, query, databaseType, queryEndpoint,
2148
2150
  query,
2149
2151
  useNewNodeSql: true
2150
2152
  },
2153
+ credentials: withCredentials ? "include" : "omit",
2151
2154
  getToken
2152
2155
  });
2153
2156
  queryAst = data;
@@ -2179,7 +2182,7 @@ async function getVirtualTableData(clientId, query, databaseType, queryEndpoint,
2179
2182
  queryEndpoint,
2180
2183
  queryHeaders,
2181
2184
  clientId,
2182
- withCredentials: false
2185
+ withCredentials: !!withCredentials
2183
2186
  },
2184
2187
  task: "query-view",
2185
2188
  metadata: {
@@ -2251,7 +2254,7 @@ async function getVirtualTableData(clientId, query, databaseType, queryEndpoint,
2251
2254
  success: results.status === "success" ? true : false
2252
2255
  } : { ...results, ...queryAst };
2253
2256
  }
2254
- async function getQueryFromAiWithConnection(isSelfHosted, databaseSchema, queryEndpoint, aiPrompt, clientId, getToken, schemaNames, queryHeaders) {
2257
+ async function getQueryFromAiWithConnection(isSelfHosted, databaseSchema, queryEndpoint, aiPrompt, clientId, getToken, schemaNames, queryHeaders, withCredentials) {
2255
2258
  if (aiPrompt.trim().length > 500) {
2256
2259
  return "";
2257
2260
  }
@@ -2260,7 +2263,7 @@ async function getQueryFromAiWithConnection(isSelfHosted, databaseSchema, queryE
2260
2263
  queryEndpoint,
2261
2264
  queryHeaders,
2262
2265
  clientId,
2263
- withCredentials: false
2266
+ withCredentials: !!withCredentials
2264
2267
  },
2265
2268
  task: "ai-from-client-schema",
2266
2269
  metadata: {
@@ -3709,7 +3712,8 @@ function ConnectDatabase({
3709
3712
  clientId,
3710
3713
  selectedSchemas,
3711
3714
  getToken,
3712
- state.queryHeaders
3715
+ state.queryHeaders,
3716
+ state.withCredentials
3713
3717
  );
3714
3718
  const databaseSchema = await getTableColumnsBySchema(
3715
3719
  state.isSelfHosted,
@@ -3718,7 +3722,8 @@ function ConnectDatabase({
3718
3722
  databaseConnectionDetails.type,
3719
3723
  getToken,
3720
3724
  selectedSchemas,
3721
- state.queryHeaders
3725
+ state.queryHeaders,
3726
+ state.withCredentials
3722
3727
  ).then((res) => res.columnsByTable);
3723
3728
  setEnvironmentDetails(
3724
3729
  databaseConnectionDetails,
@@ -3785,7 +3790,8 @@ function ConnectDatabase({
3785
3790
  databaseConnectionDetails.type,
3786
3791
  getToken,
3787
3792
  clientId,
3788
- state.queryHeaders
3793
+ state.queryHeaders,
3794
+ state.withCredentials
3789
3795
  );
3790
3796
  if (result.success) {
3791
3797
  try {
@@ -4400,7 +4406,8 @@ var useDatabaseSchema = () => {
4400
4406
  state.client.databaseType,
4401
4407
  getToken,
4402
4408
  state.client.schemaNames ?? [],
4403
- state.queryHeaders
4409
+ state.queryHeaders,
4410
+ state.withCredentials
4404
4411
  );
4405
4412
  dispatch({
4406
4413
  type: "SET_DATABASE_SCHEMA",
@@ -5746,7 +5753,8 @@ function EditTenant({
5746
5753
  queryEndpoint,
5747
5754
  getToken,
5748
5755
  eventTracking,
5749
- client.queryHeaders
5756
+ client.queryHeaders,
5757
+ state.withCredentials
5750
5758
  );
5751
5759
  if (resp.status === "error") {
5752
5760
  throw new Error(resp.error);
@@ -5774,7 +5782,8 @@ function EditTenant({
5774
5782
  queryEndpoint,
5775
5783
  getToken,
5776
5784
  eventTracking,
5777
- client.queryHeaders
5785
+ client.queryHeaders,
5786
+ state.withCredentials
5778
5787
  );
5779
5788
  if (resp.status === "error") {
5780
5789
  throw new Error(resp.error);
@@ -5818,7 +5827,7 @@ function EditTenant({
5818
5827
  client: {
5819
5828
  queryEndpoint,
5820
5829
  clientId: client._id,
5821
- withCredentials: false,
5830
+ withCredentials: !!state.withCredentials,
5822
5831
  queryHeaders: client.queryHeaders
5823
5832
  },
5824
5833
  task: "validate-tenant-mapping",
@@ -7694,7 +7703,8 @@ function CreateEnvironment({
7694
7703
  connection.type,
7695
7704
  getToken,
7696
7705
  selectedSchemaNames,
7697
- state.queryHeaders
7706
+ state.queryHeaders,
7707
+ state.withCredentials
7698
7708
  ).then((schema2) => {
7699
7709
  dispatch({
7700
7710
  type: "SET_DATABASE_SCHEMA",
@@ -8285,7 +8295,8 @@ function AdminProvider({
8285
8295
  labelFontWeight: theme?.labelFontWeight ?? defaultTheme.labelFontWeight,
8286
8296
  fontSize: theme?.fontSize ?? defaultTheme.fontSize,
8287
8297
  primaryButtonTextColor: theme?.primaryButtonTextColor ?? defaultTheme.primaryButtonTextColor,
8288
- hoverBackgroundColor: theme?.hoverBackgroundColor ?? defaultTheme.hoverBackgroundColor
8298
+ hoverBackgroundColor: theme?.hoverBackgroundColor ?? defaultTheme.hoverBackgroundColor,
8299
+ hoverPrimaryButtonColor: theme?.hoverBackgroundColor ?? defaultTheme.hoverPrimaryButtonColor
8289
8300
  };
8290
8301
  return {
8291
8302
  loading: true,
@@ -12610,11 +12621,27 @@ var convertCustomIntervalToDateRange = (interval) => {
12610
12621
  endDate: endOfToday()
12611
12622
  };
12612
12623
  case "repeating": {
12613
- const currentMonth = (/* @__PURE__ */ new Date()).getMonth() + 1;
12614
- const currentDay = (/* @__PURE__ */ new Date()).getDate();
12615
- const currentSubInterval = interval.subIntervals.find(
12616
- (subInterval) => subInterval.startDate.month <= currentMonth && subInterval.endDate.month >= currentMonth && subInterval.startDate.day <= currentDay && subInterval.endDate.day >= currentDay
12617
- );
12624
+ const currentDate = /* @__PURE__ */ new Date();
12625
+ const currentYear = currentDate.getFullYear();
12626
+ const currentSubInterval = interval.subIntervals.find((subInterval) => {
12627
+ const intervalStart = set(/* @__PURE__ */ new Date(), {
12628
+ year: currentYear,
12629
+ month: subInterval.startDate.month - 1,
12630
+ date: subInterval.startDate.day,
12631
+ hours: 0,
12632
+ minutes: 0,
12633
+ seconds: 0
12634
+ });
12635
+ const intervalEnd = set(/* @__PURE__ */ new Date(), {
12636
+ year: currentYear,
12637
+ month: subInterval.endDate.month - 1,
12638
+ date: subInterval.endDate.day,
12639
+ hours: 23,
12640
+ minutes: 59,
12641
+ seconds: 59
12642
+ });
12643
+ return currentDate >= intervalStart && currentDate <= intervalEnd;
12644
+ });
12618
12645
  if (!currentSubInterval) {
12619
12646
  throw new Error("Date is not valid in this interval");
12620
12647
  }
@@ -12772,10 +12799,29 @@ var convertPresetOptionsToSelectableList = (customIntervals, defaultIntervals) =
12772
12799
  let currentDate = endOfDay(option.loopEnd ?? /* @__PURE__ */ new Date());
12773
12800
  const cutoffDate = option.loopStart;
12774
12801
  while (currentDate > cutoffDate) {
12775
- const currentMonth = currentDate.getMonth() + 1;
12776
- const currentDay = currentDate.getDate();
12802
+ const loopCurrentYear = currentDate.getFullYear();
12777
12803
  const currentSubInterval = option.subIntervals.find(
12778
- (subInterval) => subInterval.startDate.month <= currentMonth && subInterval.endDate.month >= currentMonth && subInterval.startDate.day <= currentDay && subInterval.endDate.day >= currentDay
12804
+ (subInterval) => {
12805
+ const intervalStart2 = set(/* @__PURE__ */ new Date(), {
12806
+ year: loopCurrentYear,
12807
+ month: subInterval.startDate.month - 1,
12808
+ // convert 1-index to 0-index
12809
+ date: subInterval.startDate.day,
12810
+ hours: 0,
12811
+ minutes: 0,
12812
+ seconds: 0
12813
+ });
12814
+ const intervalEnd = set(/* @__PURE__ */ new Date(), {
12815
+ year: loopCurrentYear,
12816
+ month: subInterval.endDate.month - 1,
12817
+ // convert 1-index to 0-index
12818
+ date: subInterval.endDate.day,
12819
+ hours: 23,
12820
+ minutes: 59,
12821
+ seconds: 59
12822
+ });
12823
+ return currentDate >= intervalStart2 && currentDate <= intervalEnd;
12824
+ }
12779
12825
  );
12780
12826
  if (!currentSubInterval) {
12781
12827
  return [];
@@ -12794,6 +12840,7 @@ var convertPresetOptionsToSelectableList = (customIntervals, defaultIntervals) =
12794
12840
  startDate: set(/* @__PURE__ */ new Date(), {
12795
12841
  year: currentYear,
12796
12842
  month: currentSubInterval.startDate.month - 1,
12843
+ // convert 1-index to 0-index
12797
12844
  date: currentSubInterval.startDate.day,
12798
12845
  minutes: 0,
12799
12846
  hours: 0,
@@ -12802,6 +12849,7 @@ var convertPresetOptionsToSelectableList = (customIntervals, defaultIntervals) =
12802
12849
  endDate: set(/* @__PURE__ */ new Date(), {
12803
12850
  year: currentYear,
12804
12851
  month: currentSubInterval.endDate.month - 1,
12852
+ // convert 1-index to 0-index
12805
12853
  date: currentSubInterval.endDate.day,
12806
12854
  minutes: 59,
12807
12855
  hours: 23,
@@ -18470,7 +18518,7 @@ function EditFiltersModal({
18470
18518
  onClick: () => {
18471
18519
  openPromoteModal();
18472
18520
  },
18473
- label: "Choose Destination",
18521
+ label: "Promote Dashboard",
18474
18522
  style: {
18475
18523
  width: "fit-content"
18476
18524
  }
@@ -20146,7 +20194,8 @@ function EditEnvironmentModal({
20146
20194
  state.client.databaseType,
20147
20195
  getToken,
20148
20196
  state.client.schemaNames ?? [],
20149
- state.queryHeaders
20197
+ state.queryHeaders,
20198
+ state.withCredentials
20150
20199
  );
20151
20200
  const tenantTables = state.client.allTenantTypes?.filter(
20152
20201
  (t2) => t2.tenantTable !== void 0
@@ -26699,7 +26748,8 @@ function CreateEditVirtualTable({
26699
26748
  state.client._id,
26700
26749
  getToken,
26701
26750
  state.client.schemaNames,
26702
- state.queryHeaders
26751
+ state.queryHeaders,
26752
+ state.withCredentials
26703
26753
  );
26704
26754
  setEditVirtualTableQuery(results);
26705
26755
  setAskAIButtonLoading(false);
@@ -26748,7 +26798,8 @@ function CreateEditVirtualTable({
26748
26798
  state.queryEndpoint,
26749
26799
  getToken,
26750
26800
  eventTracking,
26751
- state.queryHeaders
26801
+ state.queryHeaders,
26802
+ state.withCredentials
26752
26803
  );
26753
26804
  if (!resp.success) {
26754
26805
  setErrorInfo({ show: true, message: resp.error });
@@ -26791,7 +26842,7 @@ function CreateEditVirtualTable({
26791
26842
  queryEndpoint: state.queryEndpoint,
26792
26843
  queryHeaders: state.queryHeaders,
26793
26844
  clientId: state.client._id,
26794
- withCredentials: false
26845
+ withCredentials: !!state.withCredentials
26795
26846
  },
26796
26847
  task: "sqlify",
26797
26848
  metadata: {
@@ -29035,7 +29086,8 @@ function EditAddViewModal({
29035
29086
  state.queryEndpoint,
29036
29087
  getToken,
29037
29088
  eventTracking,
29038
- state.queryHeaders
29089
+ state.queryHeaders,
29090
+ state.withCredentials
29039
29091
  );
29040
29092
  if (!getSqlResults.success) {
29041
29093
  setErrorInfo({
package/dist/index.js CHANGED
@@ -580,7 +580,7 @@ var MemoizedButton = ({
580
580
  color: ${primary ? state.theme?.primaryButtonTextColor ?? "white" : state.theme?.secondaryTextColor}
581
581
  }
582
582
  .quill-button:hover {
583
- background-color: ${primary ? state.theme?.hoverPrimaryButtonColor : "rgba(56, 65, 81, 0.9)"};
583
+ background-color: ${primary ? state.theme?.hoverPrimaryButtonColor ?? "rgba(56, 65, 81, 0.9)" : "rgba(56, 65, 81, 0.9)"};
584
584
  color: ${primary ? state.theme?.hoverPrimaryButtonTextColor ?? "white" : state.theme?.secondaryTextColor}
585
585
  }` }),
586
586
  isLoading ? /* @__PURE__ */ jsx5("div", { style: { position: "absolute" }, children: /* @__PURE__ */ jsx5(LoadingSpinner, {}) }) : null,
@@ -1909,7 +1909,7 @@ var quillFetch = async ({
1909
1909
  };
1910
1910
 
1911
1911
  // src/api/ConnectionClient.ts
1912
- async function testConnectionString(queryEndpoint, connectionString, databaseType, getToken, clientId, queryHeaders) {
1912
+ async function testConnectionString(queryEndpoint, connectionString, databaseType, getToken, clientId, queryHeaders, withCredentials) {
1913
1913
  const controller = new AbortController();
1914
1914
  const timeoutId = setTimeout(() => controller.abort(), 1e4);
1915
1915
  try {
@@ -1934,7 +1934,7 @@ async function testConnectionString(queryEndpoint, connectionString, databaseTyp
1934
1934
  queryEndpoint,
1935
1935
  queryHeaders,
1936
1936
  clientId,
1937
- withCredentials: false
1937
+ withCredentials: !!withCredentials
1938
1938
  },
1939
1939
  task: "test-connection",
1940
1940
  metadata: {
@@ -1955,13 +1955,13 @@ async function testConnectionString(queryEndpoint, connectionString, databaseTyp
1955
1955
  throw error;
1956
1956
  }
1957
1957
  }
1958
- async function setSchemaNames(queryEndpoint, clientId, schemaNames, getToken, queryHeaders) {
1958
+ async function setSchemaNames(queryEndpoint, clientId, schemaNames, getToken, queryHeaders, withCredentials) {
1959
1959
  await quillFetch({
1960
1960
  client: {
1961
1961
  queryEndpoint,
1962
1962
  queryHeaders,
1963
1963
  clientId,
1964
- withCredentials: false
1964
+ withCredentials: !!withCredentials
1965
1965
  },
1966
1966
  task: "set-schemas",
1967
1967
  metadata: {
@@ -1971,14 +1971,14 @@ async function setSchemaNames(queryEndpoint, clientId, schemaNames, getToken, qu
1971
1971
  getToken
1972
1972
  });
1973
1973
  }
1974
- async function getSchemaTables(schemas, databaseType, queryEndpoint, clientId, getToken, queryHeaders) {
1974
+ async function getSchemaTables(schemas, databaseType, queryEndpoint, clientId, getToken, queryHeaders, withCredentials) {
1975
1975
  const schemaMap = {};
1976
1976
  const { queries } = await quillFetch({
1977
1977
  client: {
1978
1978
  queryEndpoint,
1979
1979
  queryHeaders,
1980
1980
  clientId,
1981
- withCredentials: false
1981
+ withCredentials: !!withCredentials
1982
1982
  },
1983
1983
  task: "get-tables-by-schemas",
1984
1984
  metadata: {
@@ -2010,13 +2010,13 @@ async function getSchemaTables(schemas, databaseType, queryEndpoint, clientId, g
2010
2010
  }
2011
2011
  return { tables: allTables.flat(), schema: schemaMap };
2012
2012
  }
2013
- async function getTableColumns(tables, databaseType, queryEndpoint, clientId, getToken, queryHeaders) {
2013
+ async function getTableColumns(tables, databaseType, queryEndpoint, clientId, getToken, queryHeaders, withCredentials) {
2014
2014
  const { queries } = await quillFetch({
2015
2015
  client: {
2016
2016
  queryEndpoint,
2017
2017
  queryHeaders,
2018
2018
  clientId,
2019
- withCredentials: false
2019
+ withCredentials: !!withCredentials
2020
2020
  },
2021
2021
  task: "get-schema-table-columns",
2022
2022
  metadata: {
@@ -2051,7 +2051,7 @@ async function getTableColumns(tables, databaseType, queryEndpoint, clientId, ge
2051
2051
  }
2052
2052
  return columnsByTable;
2053
2053
  }
2054
- async function getTableColumnsBySchema(isSelfHosted, queryEndpoint, clientId, databaseType, getToken, schemas, queryHeaders) {
2054
+ async function getTableColumnsBySchema(isSelfHosted, queryEndpoint, clientId, databaseType, getToken, schemas, queryHeaders, withCredentials) {
2055
2055
  if (isSelfHosted) {
2056
2056
  const { tables, schema } = await getSchemaTables(
2057
2057
  schemas,
@@ -2059,7 +2059,8 @@ async function getTableColumnsBySchema(isSelfHosted, queryEndpoint, clientId, da
2059
2059
  queryEndpoint,
2060
2060
  clientId,
2061
2061
  getToken,
2062
- queryHeaders
2062
+ queryHeaders,
2063
+ withCredentials
2063
2064
  );
2064
2065
  const columnsByTable = await getTableColumns(
2065
2066
  tables,
@@ -2067,7 +2068,8 @@ async function getTableColumnsBySchema(isSelfHosted, queryEndpoint, clientId, da
2067
2068
  queryEndpoint,
2068
2069
  clientId,
2069
2070
  getToken,
2070
- queryHeaders
2071
+ queryHeaders,
2072
+ withCredentials
2071
2073
  );
2072
2074
  return { columnsByTable, schema };
2073
2075
  } else {
@@ -2076,7 +2078,7 @@ async function getTableColumnsBySchema(isSelfHosted, queryEndpoint, clientId, da
2076
2078
  queryEndpoint,
2077
2079
  queryHeaders,
2078
2080
  clientId,
2079
- withCredentials: false
2081
+ withCredentials: !!withCredentials
2080
2082
  },
2081
2083
  task: "table-info-by-schema",
2082
2084
  metadata: {
@@ -2106,7 +2108,7 @@ async function getTableColumnsBySchema(isSelfHosted, queryEndpoint, clientId, da
2106
2108
  return { columnsByTable: formattedResults, schema: results.data.schema };
2107
2109
  }
2108
2110
  }
2109
- async function getVirtualTableData(clientId, query, databaseType, queryEndpoint, getToken, eventTracking, queryHeaders) {
2111
+ async function getVirtualTableData(clientId, query, databaseType, queryEndpoint, getToken, eventTracking, queryHeaders, withCredentials) {
2110
2112
  let queryAst = void 0;
2111
2113
  try {
2112
2114
  const { data } = await quillFetch({
@@ -2114,7 +2116,7 @@ async function getVirtualTableData(clientId, query, databaseType, queryEndpoint,
2114
2116
  queryEndpoint,
2115
2117
  queryHeaders,
2116
2118
  clientId,
2117
- withCredentials: false
2119
+ withCredentials: !!withCredentials
2118
2120
  },
2119
2121
  task: "astify",
2120
2122
  metadata: {
@@ -2122,6 +2124,7 @@ async function getVirtualTableData(clientId, query, databaseType, queryEndpoint,
2122
2124
  query,
2123
2125
  useNewNodeSql: true
2124
2126
  },
2127
+ credentials: withCredentials ? "include" : "omit",
2125
2128
  getToken
2126
2129
  });
2127
2130
  queryAst = data;
@@ -2153,7 +2156,7 @@ async function getVirtualTableData(clientId, query, databaseType, queryEndpoint,
2153
2156
  queryEndpoint,
2154
2157
  queryHeaders,
2155
2158
  clientId,
2156
- withCredentials: false
2159
+ withCredentials: !!withCredentials
2157
2160
  },
2158
2161
  task: "query-view",
2159
2162
  metadata: {
@@ -2225,7 +2228,7 @@ async function getVirtualTableData(clientId, query, databaseType, queryEndpoint,
2225
2228
  success: results.status === "success" ? true : false
2226
2229
  } : { ...results, ...queryAst };
2227
2230
  }
2228
- async function getQueryFromAiWithConnection(isSelfHosted, databaseSchema, queryEndpoint, aiPrompt, clientId, getToken, schemaNames, queryHeaders) {
2231
+ async function getQueryFromAiWithConnection(isSelfHosted, databaseSchema, queryEndpoint, aiPrompt, clientId, getToken, schemaNames, queryHeaders, withCredentials) {
2229
2232
  if (aiPrompt.trim().length > 500) {
2230
2233
  return "";
2231
2234
  }
@@ -2234,7 +2237,7 @@ async function getQueryFromAiWithConnection(isSelfHosted, databaseSchema, queryE
2234
2237
  queryEndpoint,
2235
2238
  queryHeaders,
2236
2239
  clientId,
2237
- withCredentials: false
2240
+ withCredentials: !!withCredentials
2238
2241
  },
2239
2242
  task: "ai-from-client-schema",
2240
2243
  metadata: {
@@ -3683,7 +3686,8 @@ function ConnectDatabase({
3683
3686
  clientId,
3684
3687
  selectedSchemas,
3685
3688
  getToken,
3686
- state.queryHeaders
3689
+ state.queryHeaders,
3690
+ state.withCredentials
3687
3691
  );
3688
3692
  const databaseSchema = await getTableColumnsBySchema(
3689
3693
  state.isSelfHosted,
@@ -3692,7 +3696,8 @@ function ConnectDatabase({
3692
3696
  databaseConnectionDetails.type,
3693
3697
  getToken,
3694
3698
  selectedSchemas,
3695
- state.queryHeaders
3699
+ state.queryHeaders,
3700
+ state.withCredentials
3696
3701
  ).then((res) => res.columnsByTable);
3697
3702
  setEnvironmentDetails(
3698
3703
  databaseConnectionDetails,
@@ -3759,7 +3764,8 @@ function ConnectDatabase({
3759
3764
  databaseConnectionDetails.type,
3760
3765
  getToken,
3761
3766
  clientId,
3762
- state.queryHeaders
3767
+ state.queryHeaders,
3768
+ state.withCredentials
3763
3769
  );
3764
3770
  if (result.success) {
3765
3771
  try {
@@ -4379,7 +4385,8 @@ var useDatabaseSchema = () => {
4379
4385
  state.client.databaseType,
4380
4386
  getToken,
4381
4387
  state.client.schemaNames ?? [],
4382
- state.queryHeaders
4388
+ state.queryHeaders,
4389
+ state.withCredentials
4383
4390
  );
4384
4391
  dispatch({
4385
4392
  type: "SET_DATABASE_SCHEMA",
@@ -5734,7 +5741,8 @@ function EditTenant({
5734
5741
  queryEndpoint,
5735
5742
  getToken,
5736
5743
  eventTracking,
5737
- client.queryHeaders
5744
+ client.queryHeaders,
5745
+ state.withCredentials
5738
5746
  );
5739
5747
  if (resp.status === "error") {
5740
5748
  throw new Error(resp.error);
@@ -5762,7 +5770,8 @@ function EditTenant({
5762
5770
  queryEndpoint,
5763
5771
  getToken,
5764
5772
  eventTracking,
5765
- client.queryHeaders
5773
+ client.queryHeaders,
5774
+ state.withCredentials
5766
5775
  );
5767
5776
  if (resp.status === "error") {
5768
5777
  throw new Error(resp.error);
@@ -5806,7 +5815,7 @@ function EditTenant({
5806
5815
  client: {
5807
5816
  queryEndpoint,
5808
5817
  clientId: client._id,
5809
- withCredentials: false,
5818
+ withCredentials: !!state.withCredentials,
5810
5819
  queryHeaders: client.queryHeaders
5811
5820
  },
5812
5821
  task: "validate-tenant-mapping",
@@ -7682,7 +7691,8 @@ function CreateEnvironment({
7682
7691
  connection.type,
7683
7692
  getToken,
7684
7693
  selectedSchemaNames,
7685
- state.queryHeaders
7694
+ state.queryHeaders,
7695
+ state.withCredentials
7686
7696
  ).then((schema2) => {
7687
7697
  dispatch({
7688
7698
  type: "SET_DATABASE_SCHEMA",
@@ -8273,7 +8283,8 @@ function AdminProvider({
8273
8283
  labelFontWeight: theme?.labelFontWeight ?? defaultTheme.labelFontWeight,
8274
8284
  fontSize: theme?.fontSize ?? defaultTheme.fontSize,
8275
8285
  primaryButtonTextColor: theme?.primaryButtonTextColor ?? defaultTheme.primaryButtonTextColor,
8276
- hoverBackgroundColor: theme?.hoverBackgroundColor ?? defaultTheme.hoverBackgroundColor
8286
+ hoverBackgroundColor: theme?.hoverBackgroundColor ?? defaultTheme.hoverBackgroundColor,
8287
+ hoverPrimaryButtonColor: theme?.hoverBackgroundColor ?? defaultTheme.hoverPrimaryButtonColor
8277
8288
  };
8278
8289
  return {
8279
8290
  loading: true,
@@ -12609,11 +12620,27 @@ var convertCustomIntervalToDateRange = (interval) => {
12609
12620
  endDate: endOfToday()
12610
12621
  };
12611
12622
  case "repeating": {
12612
- const currentMonth = (/* @__PURE__ */ new Date()).getMonth() + 1;
12613
- const currentDay = (/* @__PURE__ */ new Date()).getDate();
12614
- const currentSubInterval = interval.subIntervals.find(
12615
- (subInterval) => subInterval.startDate.month <= currentMonth && subInterval.endDate.month >= currentMonth && subInterval.startDate.day <= currentDay && subInterval.endDate.day >= currentDay
12616
- );
12623
+ const currentDate = /* @__PURE__ */ new Date();
12624
+ const currentYear = currentDate.getFullYear();
12625
+ const currentSubInterval = interval.subIntervals.find((subInterval) => {
12626
+ const intervalStart = set(/* @__PURE__ */ new Date(), {
12627
+ year: currentYear,
12628
+ month: subInterval.startDate.month - 1,
12629
+ date: subInterval.startDate.day,
12630
+ hours: 0,
12631
+ minutes: 0,
12632
+ seconds: 0
12633
+ });
12634
+ const intervalEnd = set(/* @__PURE__ */ new Date(), {
12635
+ year: currentYear,
12636
+ month: subInterval.endDate.month - 1,
12637
+ date: subInterval.endDate.day,
12638
+ hours: 23,
12639
+ minutes: 59,
12640
+ seconds: 59
12641
+ });
12642
+ return currentDate >= intervalStart && currentDate <= intervalEnd;
12643
+ });
12617
12644
  if (!currentSubInterval) {
12618
12645
  throw new Error("Date is not valid in this interval");
12619
12646
  }
@@ -12771,10 +12798,29 @@ var convertPresetOptionsToSelectableList = (customIntervals, defaultIntervals) =
12771
12798
  let currentDate = endOfDay(option.loopEnd ?? /* @__PURE__ */ new Date());
12772
12799
  const cutoffDate = option.loopStart;
12773
12800
  while (currentDate > cutoffDate) {
12774
- const currentMonth = currentDate.getMonth() + 1;
12775
- const currentDay = currentDate.getDate();
12801
+ const loopCurrentYear = currentDate.getFullYear();
12776
12802
  const currentSubInterval = option.subIntervals.find(
12777
- (subInterval) => subInterval.startDate.month <= currentMonth && subInterval.endDate.month >= currentMonth && subInterval.startDate.day <= currentDay && subInterval.endDate.day >= currentDay
12803
+ (subInterval) => {
12804
+ const intervalStart2 = set(/* @__PURE__ */ new Date(), {
12805
+ year: loopCurrentYear,
12806
+ month: subInterval.startDate.month - 1,
12807
+ // convert 1-index to 0-index
12808
+ date: subInterval.startDate.day,
12809
+ hours: 0,
12810
+ minutes: 0,
12811
+ seconds: 0
12812
+ });
12813
+ const intervalEnd = set(/* @__PURE__ */ new Date(), {
12814
+ year: loopCurrentYear,
12815
+ month: subInterval.endDate.month - 1,
12816
+ // convert 1-index to 0-index
12817
+ date: subInterval.endDate.day,
12818
+ hours: 23,
12819
+ minutes: 59,
12820
+ seconds: 59
12821
+ });
12822
+ return currentDate >= intervalStart2 && currentDate <= intervalEnd;
12823
+ }
12778
12824
  );
12779
12825
  if (!currentSubInterval) {
12780
12826
  return [];
@@ -12793,6 +12839,7 @@ var convertPresetOptionsToSelectableList = (customIntervals, defaultIntervals) =
12793
12839
  startDate: set(/* @__PURE__ */ new Date(), {
12794
12840
  year: currentYear,
12795
12841
  month: currentSubInterval.startDate.month - 1,
12842
+ // convert 1-index to 0-index
12796
12843
  date: currentSubInterval.startDate.day,
12797
12844
  minutes: 0,
12798
12845
  hours: 0,
@@ -12801,6 +12848,7 @@ var convertPresetOptionsToSelectableList = (customIntervals, defaultIntervals) =
12801
12848
  endDate: set(/* @__PURE__ */ new Date(), {
12802
12849
  year: currentYear,
12803
12850
  month: currentSubInterval.endDate.month - 1,
12851
+ // convert 1-index to 0-index
12804
12852
  date: currentSubInterval.endDate.day,
12805
12853
  minutes: 59,
12806
12854
  hours: 23,
@@ -18473,7 +18521,7 @@ function EditFiltersModal({
18473
18521
  onClick: () => {
18474
18522
  openPromoteModal();
18475
18523
  },
18476
- label: "Choose Destination",
18524
+ label: "Promote Dashboard",
18477
18525
  style: {
18478
18526
  width: "fit-content"
18479
18527
  }
@@ -20156,7 +20204,8 @@ function EditEnvironmentModal({
20156
20204
  state.client.databaseType,
20157
20205
  getToken,
20158
20206
  state.client.schemaNames ?? [],
20159
- state.queryHeaders
20207
+ state.queryHeaders,
20208
+ state.withCredentials
20160
20209
  );
20161
20210
  const tenantTables = state.client.allTenantTypes?.filter(
20162
20211
  (t2) => t2.tenantTable !== void 0
@@ -26750,7 +26799,8 @@ function CreateEditVirtualTable({
26750
26799
  state.client._id,
26751
26800
  getToken,
26752
26801
  state.client.schemaNames,
26753
- state.queryHeaders
26802
+ state.queryHeaders,
26803
+ state.withCredentials
26754
26804
  );
26755
26805
  setEditVirtualTableQuery(results);
26756
26806
  setAskAIButtonLoading(false);
@@ -26799,7 +26849,8 @@ function CreateEditVirtualTable({
26799
26849
  state.queryEndpoint,
26800
26850
  getToken,
26801
26851
  eventTracking,
26802
- state.queryHeaders
26852
+ state.queryHeaders,
26853
+ state.withCredentials
26803
26854
  );
26804
26855
  if (!resp.success) {
26805
26856
  setErrorInfo({ show: true, message: resp.error });
@@ -26842,7 +26893,7 @@ function CreateEditVirtualTable({
26842
26893
  queryEndpoint: state.queryEndpoint,
26843
26894
  queryHeaders: state.queryHeaders,
26844
26895
  clientId: state.client._id,
26845
- withCredentials: false
26896
+ withCredentials: !!state.withCredentials
26846
26897
  },
26847
26898
  task: "sqlify",
26848
26899
  metadata: {
@@ -29100,7 +29151,8 @@ function EditAddViewModal({
29100
29151
  state.queryEndpoint,
29101
29152
  getToken,
29102
29153
  eventTracking,
29103
- state.queryHeaders
29154
+ state.queryHeaders,
29155
+ state.withCredentials
29104
29156
  );
29105
29157
  if (!getSqlResults.success) {
29106
29158
  setErrorInfo({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/admin",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
4
4
  "description": "Admin tools for Quill",
5
5
  "type": "module",
6
6
  "exports": {