@budibase/server 2.7.2 → 2.7.3
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.9e2b9286.js → index.4ca5529d.js} +399 -399
- package/builder/assets/{index.b33e8ad5.css → index.a86e2071.css} +1 -1
- package/builder/index.html +2 -2
- package/dist/automation.js +34 -45
- package/dist/automation.js.map +3 -3
- package/dist/index.js +34 -49
- package/dist/index.js.map +3 -3
- package/dist/query.js +19 -22
- package/dist/query.js.map +3 -3
- package/package.json +8 -8
- package/src/api/controllers/datasource.ts +1 -13
- package/src/integrations/googlesheets.ts +2 -18
package/builder/index.html
CHANGED
|
@@ -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.
|
|
12
|
-
<link rel="stylesheet" href="/builder/assets/index.
|
|
11
|
+
<script type="module" crossorigin src="/builder/assets/index.4ca5529d.js"></script>
|
|
12
|
+
<link rel="stylesheet" href="/builder/assets/index.a86e2071.css">
|
|
13
13
|
</head>
|
|
14
14
|
|
|
15
15
|
<body id="app">
|
package/dist/automation.js
CHANGED
|
@@ -5357,11 +5357,11 @@ function makeCacheItem(doc, lastWrite = null) {
|
|
|
5357
5357
|
return { doc, lastWrite: lastWrite || Date.now() };
|
|
5358
5358
|
}
|
|
5359
5359
|
async function put(db2, doc, writeRateMs = DEFAULT_WRITE_RATE_MS) {
|
|
5360
|
-
const
|
|
5360
|
+
const cache2 = await getCache();
|
|
5361
5361
|
const key = doc._id;
|
|
5362
5362
|
let cacheItem;
|
|
5363
5363
|
if (key) {
|
|
5364
|
-
cacheItem = await
|
|
5364
|
+
cacheItem = await cache2.get(makeCacheKey(db2, key));
|
|
5365
5365
|
}
|
|
5366
5366
|
const updateDb = !cacheItem || cacheItem.lastWrite < Date.now() - writeRateMs;
|
|
5367
5367
|
let output = doc;
|
|
@@ -5399,30 +5399,30 @@ async function put(db2, doc, writeRateMs = DEFAULT_WRITE_RATE_MS) {
|
|
|
5399
5399
|
}
|
|
5400
5400
|
cacheItem = makeCacheItem(output, updateDb ? null : cacheItem == null ? void 0 : cacheItem.lastWrite);
|
|
5401
5401
|
if (output._id) {
|
|
5402
|
-
await
|
|
5402
|
+
await cache2.store(makeCacheKey(db2, output._id), cacheItem);
|
|
5403
5403
|
}
|
|
5404
5404
|
return { ok: true, id: output._id, rev: output._rev };
|
|
5405
5405
|
}
|
|
5406
5406
|
async function get2(db2, id) {
|
|
5407
|
-
const
|
|
5407
|
+
const cache2 = await getCache();
|
|
5408
5408
|
const cacheKey = makeCacheKey(db2, id);
|
|
5409
|
-
let cacheItem = await
|
|
5409
|
+
let cacheItem = await cache2.get(cacheKey);
|
|
5410
5410
|
if (!cacheItem) {
|
|
5411
5411
|
const doc = await db2.get(id);
|
|
5412
5412
|
cacheItem = makeCacheItem(doc);
|
|
5413
|
-
await
|
|
5413
|
+
await cache2.store(cacheKey, cacheItem);
|
|
5414
5414
|
}
|
|
5415
5415
|
return cacheItem.doc;
|
|
5416
5416
|
}
|
|
5417
5417
|
async function remove(db2, docOrId, rev) {
|
|
5418
|
-
const
|
|
5418
|
+
const cache2 = await getCache();
|
|
5419
5419
|
if (!docOrId) {
|
|
5420
5420
|
throw new Error("No ID/Rev provided.");
|
|
5421
5421
|
}
|
|
5422
5422
|
const id = typeof docOrId === "string" ? docOrId : docOrId._id;
|
|
5423
5423
|
rev = typeof docOrId === "string" ? rev : docOrId._rev;
|
|
5424
5424
|
try {
|
|
5425
|
-
await
|
|
5425
|
+
await cache2.delete(makeCacheKey(db2, id));
|
|
5426
5426
|
} finally {
|
|
5427
5427
|
await db2.remove(id, rev);
|
|
5428
5428
|
}
|
|
@@ -9781,8 +9781,8 @@ async function preAuth(passport2, ctx, next) {
|
|
|
9781
9781
|
callbackUrl,
|
|
9782
9782
|
ssoSaveUserNoOp
|
|
9783
9783
|
);
|
|
9784
|
-
if (!ctx.query.appId) {
|
|
9785
|
-
ctx.throw(400, "appId query
|
|
9784
|
+
if (!ctx.query.appId || !ctx.query.datasourceId) {
|
|
9785
|
+
ctx.throw(400, "appId and datasourceId query params not present.");
|
|
9786
9786
|
}
|
|
9787
9787
|
return passport2.authenticate(strategy, {
|
|
9788
9788
|
scope: ["profile", "email", "https://www.googleapis.com/auth/spreadsheets"],
|
|
@@ -9802,7 +9802,7 @@ async function postAuth(passport2, ctx, next) {
|
|
|
9802
9802
|
clientSecret: config.clientSecret,
|
|
9803
9803
|
callbackURL: callbackUrl
|
|
9804
9804
|
},
|
|
9805
|
-
(accessToken, refreshToken,
|
|
9805
|
+
(accessToken, refreshToken, profile, done) => {
|
|
9806
9806
|
clearCookie(ctx, "budibase:datasourceauth" /* DatasourceAuth */);
|
|
9807
9807
|
done(null, { accessToken, refreshToken });
|
|
9808
9808
|
}
|
|
@@ -9810,14 +9810,22 @@ async function postAuth(passport2, ctx, next) {
|
|
|
9810
9810
|
{ successRedirect: "/", failureRedirect: "/error" },
|
|
9811
9811
|
async (err, tokens) => {
|
|
9812
9812
|
const baseUrl = `/builder/app/${authStateCookie.appId}/data`;
|
|
9813
|
-
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9813
|
+
await doWithDB(authStateCookie.appId, async (db2) => {
|
|
9814
|
+
let datasource2;
|
|
9815
|
+
try {
|
|
9816
|
+
datasource2 = await db2.get(authStateCookie.datasourceId);
|
|
9817
|
+
} catch (err2) {
|
|
9818
|
+
if (err2.status === 404) {
|
|
9819
|
+
ctx.redirect(baseUrl);
|
|
9820
|
+
}
|
|
9818
9821
|
}
|
|
9819
|
-
|
|
9820
|
-
|
|
9822
|
+
if (!datasource2.config) {
|
|
9823
|
+
datasource2.config = {};
|
|
9824
|
+
}
|
|
9825
|
+
datasource2.config.auth = { type: "google", ...tokens };
|
|
9826
|
+
await db2.put(datasource2);
|
|
9827
|
+
ctx.redirect(`${baseUrl}/datasource/${authStateCookie.datasourceId}`);
|
|
9828
|
+
});
|
|
9821
9829
|
}
|
|
9822
9830
|
)(ctx, next);
|
|
9823
9831
|
}
|
|
@@ -9827,9 +9835,9 @@ var init_google2 = __esm({
|
|
|
9827
9835
|
init_google();
|
|
9828
9836
|
init_constants2();
|
|
9829
9837
|
init_utils5();
|
|
9838
|
+
init_db5();
|
|
9830
9839
|
init_configs3();
|
|
9831
9840
|
init_sso2();
|
|
9832
|
-
init_src2();
|
|
9833
9841
|
GoogleStrategy2 = require("passport-google-oauth").OAuth2Strategy;
|
|
9834
9842
|
}
|
|
9835
9843
|
});
|
|
@@ -23803,20 +23811,9 @@ var init_rest = __esm({
|
|
|
23803
23811
|
});
|
|
23804
23812
|
|
|
23805
23813
|
// src/integrations/googlesheets.ts
|
|
23806
|
-
async function setupCreationAuth(datasouce) {
|
|
23807
|
-
if (datasouce.continueSetupId) {
|
|
23808
|
-
const appId = context_exports.getAppId();
|
|
23809
|
-
const tokens = await cache_exports.get(
|
|
23810
|
-
`datasource:creation:${appId}:google:${datasouce.continueSetupId}`
|
|
23811
|
-
);
|
|
23812
|
-
datasouce.auth = tokens.tokens;
|
|
23813
|
-
delete datasouce.continueSetupId;
|
|
23814
|
-
}
|
|
23815
|
-
}
|
|
23816
23814
|
var import_google_auth_library, import_google_spreadsheet, import_node_fetch9, ALLOWED_TYPES, SCHEMA12, GoogleSheetsIntegration, googlesheets_default;
|
|
23817
23815
|
var init_googlesheets = __esm({
|
|
23818
23816
|
"src/integrations/googlesheets.ts"() {
|
|
23819
|
-
"use strict";
|
|
23820
23817
|
init_src();
|
|
23821
23818
|
import_google_auth_library = require("google-auth-library");
|
|
23822
23819
|
init_utils14();
|
|
@@ -23851,7 +23848,7 @@ var init_googlesheets = __esm({
|
|
|
23851
23848
|
},
|
|
23852
23849
|
datasource: {
|
|
23853
23850
|
spreadsheetId: {
|
|
23854
|
-
display: "
|
|
23851
|
+
display: "Google Sheet URL",
|
|
23855
23852
|
type: "string" /* STRING */,
|
|
23856
23853
|
required: true
|
|
23857
23854
|
}
|
|
@@ -23921,7 +23918,6 @@ var init_googlesheets = __esm({
|
|
|
23921
23918
|
}
|
|
23922
23919
|
async testConnection() {
|
|
23923
23920
|
try {
|
|
23924
|
-
await setupCreationAuth(this.config);
|
|
23925
23921
|
await this.connect();
|
|
23926
23922
|
return { connected: true };
|
|
23927
23923
|
} catch (e) {
|
|
@@ -26893,22 +26889,22 @@ function threadSetup() {
|
|
|
26893
26889
|
init8();
|
|
26894
26890
|
}
|
|
26895
26891
|
async function checkCacheForDynamicVariable(queryId, variable) {
|
|
26896
|
-
const
|
|
26897
|
-
return
|
|
26892
|
+
const cache2 = await getClient2();
|
|
26893
|
+
return cache2.get(makeVariableKey(queryId, variable));
|
|
26898
26894
|
}
|
|
26899
26895
|
async function invalidateDynamicVariables(cachedVars) {
|
|
26900
|
-
const
|
|
26896
|
+
const cache2 = await getClient2();
|
|
26901
26897
|
let promises = [];
|
|
26902
26898
|
for (let variable of cachedVars) {
|
|
26903
26899
|
promises.push(
|
|
26904
|
-
|
|
26900
|
+
cache2.delete(makeVariableKey(variable.queryId, variable.name))
|
|
26905
26901
|
);
|
|
26906
26902
|
}
|
|
26907
26903
|
await Promise.all(promises);
|
|
26908
26904
|
}
|
|
26909
26905
|
async function storeDynamicVariable(queryId, variable, value) {
|
|
26910
|
-
const
|
|
26911
|
-
await
|
|
26906
|
+
const cache2 = await getClient2();
|
|
26907
|
+
await cache2.store(
|
|
26912
26908
|
makeVariableKey(queryId, variable),
|
|
26913
26909
|
value,
|
|
26914
26910
|
VARIABLE_TTL_SECONDS
|
|
@@ -30686,15 +30682,8 @@ init_constants6();
|
|
|
30686
30682
|
init_integrations2();
|
|
30687
30683
|
init_utils20();
|
|
30688
30684
|
init_src2();
|
|
30689
|
-
init_src();
|
|
30690
30685
|
init_sdk3();
|
|
30691
30686
|
init_websockets();
|
|
30692
|
-
init_googlesheets();
|
|
30693
|
-
var preSaveAction = {
|
|
30694
|
-
["GOOGLE_SHEETS" /* GOOGLE_SHEETS */]: async (datasource2) => {
|
|
30695
|
-
await setupCreationAuth(datasource2.config);
|
|
30696
|
-
}
|
|
30697
|
-
};
|
|
30698
30687
|
|
|
30699
30688
|
// src/api/controllers/query/validation.ts
|
|
30700
30689
|
init_src2();
|