@budibase/server 2.7.7-alpha.3 → 2.7.7-alpha.5
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/builder/assets/{index.b33e8ad5.css → index.3c336b18.css} +1 -1
- package/builder/assets/{index.7f26f181.js → index.4afe46bb.js} +374 -374
- package/builder/index.html +2 -2
- package/dist/automation.js +46 -14
- package/dist/automation.js.map +3 -3
- package/dist/index.js +71 -35
- package/dist/index.js.map +3 -3
- package/dist/query.js +46 -14
- package/dist/query.js.map +3 -3
- package/package.json +9 -9
- package/src/api/controllers/datasource.ts +28 -23
- package/src/integrations/googlesheets.ts +18 -17
- package/src/integrations/mongodb.ts +4 -2
- package/src/integrations/postgres.ts +2 -1
- package/src/sdk/app/datasources/datasources.ts +1 -0
package/dist/query.js
CHANGED
|
@@ -14345,7 +14345,8 @@ var PostgresIntegration = class extends sql_default {
|
|
|
14345
14345
|
try {
|
|
14346
14346
|
await this.openConnection();
|
|
14347
14347
|
const columnsResponse = await this.client.query(this.COLUMNS_SQL);
|
|
14348
|
-
|
|
14348
|
+
const names = columnsResponse.rows.map((row) => row.table_name);
|
|
14349
|
+
return [...new Set(names)];
|
|
14349
14350
|
} finally {
|
|
14350
14351
|
await this.closeConnection();
|
|
14351
14352
|
}
|
|
@@ -14958,6 +14959,8 @@ var MongoIntegration = class {
|
|
|
14958
14959
|
response.connected = true;
|
|
14959
14960
|
} catch (e) {
|
|
14960
14961
|
response.error = e.message;
|
|
14962
|
+
} finally {
|
|
14963
|
+
await this.client.close();
|
|
14961
14964
|
}
|
|
14962
14965
|
return response;
|
|
14963
14966
|
}
|
|
@@ -17220,11 +17223,39 @@ var hasFilters = (query) => {
|
|
|
17220
17223
|
// ../shared-core/src/utils.ts
|
|
17221
17224
|
var utils_exports3 = {};
|
|
17222
17225
|
__export(utils_exports3, {
|
|
17226
|
+
parallelForeach: () => parallelForeach,
|
|
17223
17227
|
unreachable: () => unreachable
|
|
17224
17228
|
});
|
|
17225
17229
|
function unreachable(value, message = `No such case in exhaustive switch: ${value}`) {
|
|
17226
17230
|
throw new Error(message);
|
|
17227
17231
|
}
|
|
17232
|
+
async function parallelForeach(items, task, maxConcurrency) {
|
|
17233
|
+
const promises = [];
|
|
17234
|
+
let index2 = 0;
|
|
17235
|
+
const processItem = async (item) => {
|
|
17236
|
+
try {
|
|
17237
|
+
await task(item);
|
|
17238
|
+
} finally {
|
|
17239
|
+
processNext();
|
|
17240
|
+
}
|
|
17241
|
+
};
|
|
17242
|
+
const processNext = () => {
|
|
17243
|
+
if (index2 >= items.length) {
|
|
17244
|
+
return;
|
|
17245
|
+
}
|
|
17246
|
+
const item = items[index2];
|
|
17247
|
+
index2++;
|
|
17248
|
+
const promise = processItem(item);
|
|
17249
|
+
promises.push(promise);
|
|
17250
|
+
if (promises.length >= maxConcurrency) {
|
|
17251
|
+
Promise.race(promises).then(processNext);
|
|
17252
|
+
} else {
|
|
17253
|
+
processNext();
|
|
17254
|
+
}
|
|
17255
|
+
};
|
|
17256
|
+
processNext();
|
|
17257
|
+
await Promise.all(promises);
|
|
17258
|
+
}
|
|
17228
17259
|
|
|
17229
17260
|
// src/integrations/googlesheets.ts
|
|
17230
17261
|
var ALLOWED_TYPES = [
|
|
@@ -17323,7 +17354,6 @@ var GoogleSheetsIntegration = class {
|
|
|
17323
17354
|
}
|
|
17324
17355
|
async testConnection() {
|
|
17325
17356
|
try {
|
|
17326
|
-
await setupCreationAuth(this.config);
|
|
17327
17357
|
await this.connect();
|
|
17328
17358
|
return { connected: true };
|
|
17329
17359
|
} catch (e) {
|
|
@@ -17375,6 +17405,7 @@ var GoogleSheetsIntegration = class {
|
|
|
17375
17405
|
async connect() {
|
|
17376
17406
|
var _a;
|
|
17377
17407
|
try {
|
|
17408
|
+
await setupCreationAuth(this.config);
|
|
17378
17409
|
let googleConfig = await configs_exports.getGoogleDatasourceConfig();
|
|
17379
17410
|
if (!googleConfig) {
|
|
17380
17411
|
throw new HTTPError("Google config not found", 400);
|
|
@@ -17425,21 +17456,22 @@ var GoogleSheetsIntegration = class {
|
|
|
17425
17456
|
return table;
|
|
17426
17457
|
}
|
|
17427
17458
|
async buildSchema(datasourceId, entities) {
|
|
17428
|
-
if (!this.config.auth) {
|
|
17429
|
-
return;
|
|
17430
|
-
}
|
|
17431
17459
|
await this.connect();
|
|
17432
17460
|
const sheets = this.client.sheetsByIndex;
|
|
17433
17461
|
const tables = {};
|
|
17434
|
-
|
|
17435
|
-
|
|
17436
|
-
|
|
17437
|
-
|
|
17438
|
-
sheet.title
|
|
17439
|
-
sheet.
|
|
17440
|
-
|
|
17441
|
-
|
|
17442
|
-
|
|
17462
|
+
await utils_exports3.parallelForeach(
|
|
17463
|
+
sheets,
|
|
17464
|
+
async (sheet) => {
|
|
17465
|
+
await sheet.getRows({ limit: 0, offset: 0 });
|
|
17466
|
+
const id = buildExternalTableId(datasourceId, sheet.title);
|
|
17467
|
+
tables[sheet.title] = this.getTableSchema(
|
|
17468
|
+
sheet.title,
|
|
17469
|
+
sheet.headerValues,
|
|
17470
|
+
id
|
|
17471
|
+
);
|
|
17472
|
+
},
|
|
17473
|
+
10
|
|
17474
|
+
);
|
|
17443
17475
|
const final = finaliseExternalTables(tables, entities);
|
|
17444
17476
|
this.tables = final.tables;
|
|
17445
17477
|
this.schemaErrors = final.errors;
|