@budibase/server 2.7.7-alpha.2 → 2.7.7-alpha.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.
@@ -8,8 +8,8 @@
8
8
  <link rel="preconnect" href="https://fonts.gstatic.com" />
9
9
  <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap"
10
10
  rel="stylesheet" />
11
- <script type="module" crossorigin src="/builder/assets/index.fbee8e8b.js"></script>
12
- <link rel="stylesheet" href="/builder/assets/index.b33e8ad5.css">
11
+ <script type="module" crossorigin src="/builder/assets/index.4afe46bb.js"></script>
12
+ <link rel="stylesheet" href="/builder/assets/index.3c336b18.css">
13
13
  </head>
14
14
 
15
15
  <body id="app">
@@ -18882,11 +18882,39 @@ var init_filters = __esm({
18882
18882
  // ../shared-core/src/utils.ts
18883
18883
  var utils_exports5 = {};
18884
18884
  __export(utils_exports5, {
18885
+ parallelForeach: () => parallelForeach,
18885
18886
  unreachable: () => unreachable
18886
18887
  });
18887
18888
  function unreachable(value, message = `No such case in exhaustive switch: ${value}`) {
18888
18889
  throw new Error(message);
18889
18890
  }
18891
+ async function parallelForeach(items, task, maxConcurrency) {
18892
+ const promises = [];
18893
+ let index2 = 0;
18894
+ const processItem = async (item) => {
18895
+ try {
18896
+ await task(item);
18897
+ } finally {
18898
+ processNext();
18899
+ }
18900
+ };
18901
+ const processNext = () => {
18902
+ if (index2 >= items.length) {
18903
+ return;
18904
+ }
18905
+ const item = items[index2];
18906
+ index2++;
18907
+ const promise = processItem(item);
18908
+ promises.push(promise);
18909
+ if (promises.length >= maxConcurrency) {
18910
+ Promise.race(promises).then(processNext);
18911
+ } else {
18912
+ processNext();
18913
+ }
18914
+ };
18915
+ processNext();
18916
+ await Promise.all(promises);
18917
+ }
18890
18918
  var init_utils12 = __esm({
18891
18919
  "../shared-core/src/utils.ts"() {
18892
18920
  }
@@ -21249,7 +21277,8 @@ var init_postgres = __esm({
21249
21277
  try {
21250
21278
  await this.openConnection();
21251
21279
  const columnsResponse = await this.client.query(this.COLUMNS_SQL);
21252
- return columnsResponse.rows.map((row) => row.table_name);
21280
+ const names = columnsResponse.rows.map((row) => row.table_name);
21281
+ return [...new Set(names)];
21253
21282
  } finally {
21254
21283
  await this.closeConnection();
21255
21284
  }
@@ -23921,7 +23950,6 @@ var init_googlesheets = __esm({
23921
23950
  }
23922
23951
  async testConnection() {
23923
23952
  try {
23924
- await setupCreationAuth(this.config);
23925
23953
  await this.connect();
23926
23954
  return { connected: true };
23927
23955
  } catch (e) {
@@ -23973,6 +24001,7 @@ var init_googlesheets = __esm({
23973
24001
  async connect() {
23974
24002
  var _a;
23975
24003
  try {
24004
+ await setupCreationAuth(this.config);
23976
24005
  let googleConfig = await configs_exports.getGoogleDatasourceConfig();
23977
24006
  if (!googleConfig) {
23978
24007
  throw new HTTPError("Google config not found", 400);
@@ -24023,21 +24052,22 @@ var init_googlesheets = __esm({
24023
24052
  return table;
24024
24053
  }
24025
24054
  async buildSchema(datasourceId, entities) {
24026
- if (!this.config.auth) {
24027
- return;
24028
- }
24029
24055
  await this.connect();
24030
24056
  const sheets = this.client.sheetsByIndex;
24031
24057
  const tables = {};
24032
- for (let sheet of sheets) {
24033
- await sheet.getRows();
24034
- const id = buildExternalTableId(datasourceId, sheet.title);
24035
- tables[sheet.title] = this.getTableSchema(
24036
- sheet.title,
24037
- sheet.headerValues,
24038
- id
24039
- );
24040
- }
24058
+ await utils_exports5.parallelForeach(
24059
+ sheets,
24060
+ async (sheet) => {
24061
+ await sheet.getRows({ limit: 0, offset: 0 });
24062
+ const id = buildExternalTableId(datasourceId, sheet.title);
24063
+ tables[sheet.title] = this.getTableSchema(
24064
+ sheet.title,
24065
+ sheet.headerValues,
24066
+ id
24067
+ );
24068
+ },
24069
+ 10
24070
+ );
24041
24071
  const final = finaliseExternalTables(tables, entities);
24042
24072
  this.tables = final.tables;
24043
24073
  this.schemaErrors = final.errors;