@budibase/server 2.7.7-alpha.3 → 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.
- 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 +44 -14
- package/dist/automation.js.map +3 -3
- package/dist/index.js +69 -35
- package/dist/index.js.map +3 -3
- package/dist/query.js +44 -14
- package/dist/query.js.map +3 -3
- package/package.json +8 -8
- package/src/api/controllers/datasource.ts +28 -23
- package/src/integrations/googlesheets.ts +18 -17
- 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
|
}
|
|
@@ -17220,11 +17221,39 @@ var hasFilters = (query) => {
|
|
|
17220
17221
|
// ../shared-core/src/utils.ts
|
|
17221
17222
|
var utils_exports3 = {};
|
|
17222
17223
|
__export(utils_exports3, {
|
|
17224
|
+
parallelForeach: () => parallelForeach,
|
|
17223
17225
|
unreachable: () => unreachable
|
|
17224
17226
|
});
|
|
17225
17227
|
function unreachable(value, message = `No such case in exhaustive switch: ${value}`) {
|
|
17226
17228
|
throw new Error(message);
|
|
17227
17229
|
}
|
|
17230
|
+
async function parallelForeach(items, task, maxConcurrency) {
|
|
17231
|
+
const promises = [];
|
|
17232
|
+
let index2 = 0;
|
|
17233
|
+
const processItem = async (item) => {
|
|
17234
|
+
try {
|
|
17235
|
+
await task(item);
|
|
17236
|
+
} finally {
|
|
17237
|
+
processNext();
|
|
17238
|
+
}
|
|
17239
|
+
};
|
|
17240
|
+
const processNext = () => {
|
|
17241
|
+
if (index2 >= items.length) {
|
|
17242
|
+
return;
|
|
17243
|
+
}
|
|
17244
|
+
const item = items[index2];
|
|
17245
|
+
index2++;
|
|
17246
|
+
const promise = processItem(item);
|
|
17247
|
+
promises.push(promise);
|
|
17248
|
+
if (promises.length >= maxConcurrency) {
|
|
17249
|
+
Promise.race(promises).then(processNext);
|
|
17250
|
+
} else {
|
|
17251
|
+
processNext();
|
|
17252
|
+
}
|
|
17253
|
+
};
|
|
17254
|
+
processNext();
|
|
17255
|
+
await Promise.all(promises);
|
|
17256
|
+
}
|
|
17228
17257
|
|
|
17229
17258
|
// src/integrations/googlesheets.ts
|
|
17230
17259
|
var ALLOWED_TYPES = [
|
|
@@ -17323,7 +17352,6 @@ var GoogleSheetsIntegration = class {
|
|
|
17323
17352
|
}
|
|
17324
17353
|
async testConnection() {
|
|
17325
17354
|
try {
|
|
17326
|
-
await setupCreationAuth(this.config);
|
|
17327
17355
|
await this.connect();
|
|
17328
17356
|
return { connected: true };
|
|
17329
17357
|
} catch (e) {
|
|
@@ -17375,6 +17403,7 @@ var GoogleSheetsIntegration = class {
|
|
|
17375
17403
|
async connect() {
|
|
17376
17404
|
var _a;
|
|
17377
17405
|
try {
|
|
17406
|
+
await setupCreationAuth(this.config);
|
|
17378
17407
|
let googleConfig = await configs_exports.getGoogleDatasourceConfig();
|
|
17379
17408
|
if (!googleConfig) {
|
|
17380
17409
|
throw new HTTPError("Google config not found", 400);
|
|
@@ -17425,21 +17454,22 @@ var GoogleSheetsIntegration = class {
|
|
|
17425
17454
|
return table;
|
|
17426
17455
|
}
|
|
17427
17456
|
async buildSchema(datasourceId, entities) {
|
|
17428
|
-
if (!this.config.auth) {
|
|
17429
|
-
return;
|
|
17430
|
-
}
|
|
17431
17457
|
await this.connect();
|
|
17432
17458
|
const sheets = this.client.sheetsByIndex;
|
|
17433
17459
|
const tables = {};
|
|
17434
|
-
|
|
17435
|
-
|
|
17436
|
-
|
|
17437
|
-
|
|
17438
|
-
sheet.title
|
|
17439
|
-
sheet.
|
|
17440
|
-
|
|
17441
|
-
|
|
17442
|
-
|
|
17460
|
+
await utils_exports3.parallelForeach(
|
|
17461
|
+
sheets,
|
|
17462
|
+
async (sheet) => {
|
|
17463
|
+
await sheet.getRows({ limit: 0, offset: 0 });
|
|
17464
|
+
const id = buildExternalTableId(datasourceId, sheet.title);
|
|
17465
|
+
tables[sheet.title] = this.getTableSchema(
|
|
17466
|
+
sheet.title,
|
|
17467
|
+
sheet.headerValues,
|
|
17468
|
+
id
|
|
17469
|
+
);
|
|
17470
|
+
},
|
|
17471
|
+
10
|
|
17472
|
+
);
|
|
17443
17473
|
const final = finaliseExternalTables(tables, entities);
|
|
17444
17474
|
this.tables = final.tables;
|
|
17445
17475
|
this.schemaErrors = final.errors;
|