@budibase/server 2.6.26 → 2.6.28-alpha.0
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.9bd22774.js → index.9465fac4.js} +399 -399
- package/builder/assets/{index.a86e2071.css → index.b33e8ad5.css} +1 -1
- package/builder/index.html +2 -2
- package/dist/automation.js +55 -35
- package/dist/automation.js.map +3 -3
- package/dist/index.js +60 -35
- package/dist/index.js.map +3 -3
- package/dist/query.js +32 -20
- package/dist/query.js.map +3 -3
- package/package.json +8 -8
- package/src/api/controllers/datasource.ts +13 -1
- package/src/integrations/googlesheets.ts +18 -2
- package/src/websockets/builder.ts +4 -1
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.9465fac4.js"></script>
|
|
12
|
+
<link rel="stylesheet" href="/builder/assets/index.b33e8ad5.css">
|
|
13
13
|
</head>
|
|
14
14
|
|
|
15
15
|
<body id="app">
|
package/dist/automation.js
CHANGED
|
@@ -229,6 +229,7 @@ var init_event = __esm({
|
|
|
229
229
|
Event6["USER_PASSWORD_UPDATED"] = "user:password:updated";
|
|
230
230
|
Event6["USER_PASSWORD_RESET_REQUESTED"] = "user:password:reset:requested";
|
|
231
231
|
Event6["USER_PASSWORD_RESET"] = "user:password:reset";
|
|
232
|
+
Event6["USER_DATA_COLLABORATION"] = "user:data:collaboration";
|
|
232
233
|
Event6["EMAIL_SMTP_CREATED"] = "email:smtp:created";
|
|
233
234
|
Event6["EMAIL_SMTP_UPDATED"] = "email:smtp:updated";
|
|
234
235
|
Event6["AUTH_SSO_CREATED"] = "auth:sso:created";
|
|
@@ -379,6 +380,7 @@ var init_event = __esm({
|
|
|
379
380
|
["user:password:force:reset" /* USER_PASSWORD_FORCE_RESET */]: void 0,
|
|
380
381
|
["user_group:onboarding_added" /* USER_GROUP_ONBOARDING */]: void 0,
|
|
381
382
|
["user:onboarding:complete" /* USER_ONBOARDING_COMPLETE */]: void 0,
|
|
383
|
+
["user:data:collaboration" /* USER_DATA_COLLABORATION */]: void 0,
|
|
382
384
|
// EMAIL
|
|
383
385
|
["email:smtp:created" /* EMAIL_SMTP_CREATED */]: `Email configuration created`,
|
|
384
386
|
["email:smtp:updated" /* EMAIL_SMTP_UPDATED */]: `Email configuration updated`,
|
|
@@ -5355,11 +5357,11 @@ function makeCacheItem(doc, lastWrite = null) {
|
|
|
5355
5357
|
return { doc, lastWrite: lastWrite || Date.now() };
|
|
5356
5358
|
}
|
|
5357
5359
|
async function put(db2, doc, writeRateMs = DEFAULT_WRITE_RATE_MS) {
|
|
5358
|
-
const
|
|
5360
|
+
const cache3 = await getCache();
|
|
5359
5361
|
const key = doc._id;
|
|
5360
5362
|
let cacheItem;
|
|
5361
5363
|
if (key) {
|
|
5362
|
-
cacheItem = await
|
|
5364
|
+
cacheItem = await cache3.get(makeCacheKey(db2, key));
|
|
5363
5365
|
}
|
|
5364
5366
|
const updateDb = !cacheItem || cacheItem.lastWrite < Date.now() - writeRateMs;
|
|
5365
5367
|
let output = doc;
|
|
@@ -5397,30 +5399,30 @@ async function put(db2, doc, writeRateMs = DEFAULT_WRITE_RATE_MS) {
|
|
|
5397
5399
|
}
|
|
5398
5400
|
cacheItem = makeCacheItem(output, updateDb ? null : cacheItem == null ? void 0 : cacheItem.lastWrite);
|
|
5399
5401
|
if (output._id) {
|
|
5400
|
-
await
|
|
5402
|
+
await cache3.store(makeCacheKey(db2, output._id), cacheItem);
|
|
5401
5403
|
}
|
|
5402
5404
|
return { ok: true, id: output._id, rev: output._rev };
|
|
5403
5405
|
}
|
|
5404
5406
|
async function get2(db2, id) {
|
|
5405
|
-
const
|
|
5407
|
+
const cache3 = await getCache();
|
|
5406
5408
|
const cacheKey = makeCacheKey(db2, id);
|
|
5407
|
-
let cacheItem = await
|
|
5409
|
+
let cacheItem = await cache3.get(cacheKey);
|
|
5408
5410
|
if (!cacheItem) {
|
|
5409
5411
|
const doc = await db2.get(id);
|
|
5410
5412
|
cacheItem = makeCacheItem(doc);
|
|
5411
|
-
await
|
|
5413
|
+
await cache3.store(cacheKey, cacheItem);
|
|
5412
5414
|
}
|
|
5413
5415
|
return cacheItem.doc;
|
|
5414
5416
|
}
|
|
5415
5417
|
async function remove(db2, docOrId, rev) {
|
|
5416
|
-
const
|
|
5418
|
+
const cache3 = await getCache();
|
|
5417
5419
|
if (!docOrId) {
|
|
5418
5420
|
throw new Error("No ID/Rev provided.");
|
|
5419
5421
|
}
|
|
5420
5422
|
const id = typeof docOrId === "string" ? docOrId : docOrId._id;
|
|
5421
5423
|
rev = typeof docOrId === "string" ? rev : docOrId._rev;
|
|
5422
5424
|
try {
|
|
5423
|
-
await
|
|
5425
|
+
await cache3.delete(makeCacheKey(db2, id));
|
|
5424
5426
|
} finally {
|
|
5425
5427
|
await db2.remove(id, rev);
|
|
5426
5428
|
}
|
|
@@ -8099,6 +8101,12 @@ async function passwordReset(user) {
|
|
|
8099
8101
|
};
|
|
8100
8102
|
await publishEvent("user:password:reset" /* USER_PASSWORD_RESET */, properties);
|
|
8101
8103
|
}
|
|
8104
|
+
async function dataCollaboration(users2) {
|
|
8105
|
+
const properties = {
|
|
8106
|
+
users: users2
|
|
8107
|
+
};
|
|
8108
|
+
await publishEvent("user:data:collaboration" /* USER_DATA_COLLABORATION */, properties);
|
|
8109
|
+
}
|
|
8102
8110
|
var user_default;
|
|
8103
8111
|
var init_user9 = __esm({
|
|
8104
8112
|
"../backend-core/src/events/publishers/user.ts"() {
|
|
@@ -8119,7 +8127,8 @@ var init_user9 = __esm({
|
|
|
8119
8127
|
passwordForceReset,
|
|
8120
8128
|
passwordUpdated,
|
|
8121
8129
|
passwordResetRequested,
|
|
8122
|
-
passwordReset
|
|
8130
|
+
passwordReset,
|
|
8131
|
+
dataCollaboration
|
|
8123
8132
|
};
|
|
8124
8133
|
}
|
|
8125
8134
|
});
|
|
@@ -9772,8 +9781,8 @@ async function preAuth(passport2, ctx, next) {
|
|
|
9772
9781
|
callbackUrl,
|
|
9773
9782
|
ssoSaveUserNoOp
|
|
9774
9783
|
);
|
|
9775
|
-
if (!ctx.query.appId
|
|
9776
|
-
ctx.throw(400, "appId
|
|
9784
|
+
if (!ctx.query.appId) {
|
|
9785
|
+
ctx.throw(400, "appId query param not present.");
|
|
9777
9786
|
}
|
|
9778
9787
|
return passport2.authenticate(strategy, {
|
|
9779
9788
|
scope: ["profile", "email", "https://www.googleapis.com/auth/spreadsheets"],
|
|
@@ -9793,7 +9802,7 @@ async function postAuth(passport2, ctx, next) {
|
|
|
9793
9802
|
clientSecret: config.clientSecret,
|
|
9794
9803
|
callbackURL: callbackUrl
|
|
9795
9804
|
},
|
|
9796
|
-
(accessToken, refreshToken,
|
|
9805
|
+
(accessToken, refreshToken, _profile, done) => {
|
|
9797
9806
|
clearCookie(ctx, "budibase:datasourceauth" /* DatasourceAuth */);
|
|
9798
9807
|
done(null, { accessToken, refreshToken });
|
|
9799
9808
|
}
|
|
@@ -9801,22 +9810,14 @@ async function postAuth(passport2, ctx, next) {
|
|
|
9801
9810
|
{ successRedirect: "/", failureRedirect: "/error" },
|
|
9802
9811
|
async (err, tokens) => {
|
|
9803
9812
|
const baseUrl = `/builder/app/${authStateCookie.appId}/data`;
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
if (err2.status === 404) {
|
|
9810
|
-
ctx.redirect(baseUrl);
|
|
9811
|
-
}
|
|
9812
|
-
}
|
|
9813
|
-
if (!datasource2.config) {
|
|
9814
|
-
datasource2.config = {};
|
|
9813
|
+
const id = utils_exports2.newid();
|
|
9814
|
+
await cache_exports.store(
|
|
9815
|
+
`datasource:creation:${authStateCookie.appId}:google:${id}`,
|
|
9816
|
+
{
|
|
9817
|
+
tokens
|
|
9815
9818
|
}
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
ctx.redirect(`${baseUrl}/datasource/${authStateCookie.datasourceId}`);
|
|
9819
|
-
});
|
|
9819
|
+
);
|
|
9820
|
+
ctx.redirect(`${baseUrl}/new?continue_google_setup=${id}`);
|
|
9820
9821
|
}
|
|
9821
9822
|
)(ctx, next);
|
|
9822
9823
|
}
|
|
@@ -9826,9 +9827,9 @@ var init_google2 = __esm({
|
|
|
9826
9827
|
init_google();
|
|
9827
9828
|
init_constants2();
|
|
9828
9829
|
init_utils5();
|
|
9829
|
-
init_db5();
|
|
9830
9830
|
init_configs3();
|
|
9831
9831
|
init_sso2();
|
|
9832
|
+
init_src2();
|
|
9832
9833
|
GoogleStrategy2 = require("passport-google-oauth").OAuth2Strategy;
|
|
9833
9834
|
}
|
|
9834
9835
|
});
|
|
@@ -23802,9 +23803,20 @@ var init_rest = __esm({
|
|
|
23802
23803
|
});
|
|
23803
23804
|
|
|
23804
23805
|
// 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
|
+
}
|
|
23805
23816
|
var import_google_auth_library, import_google_spreadsheet, import_node_fetch9, ALLOWED_TYPES, SCHEMA12, GoogleSheetsIntegration, googlesheets_default;
|
|
23806
23817
|
var init_googlesheets = __esm({
|
|
23807
23818
|
"src/integrations/googlesheets.ts"() {
|
|
23819
|
+
"use strict";
|
|
23808
23820
|
init_src();
|
|
23809
23821
|
import_google_auth_library = require("google-auth-library");
|
|
23810
23822
|
init_utils14();
|
|
@@ -23839,7 +23851,7 @@ var init_googlesheets = __esm({
|
|
|
23839
23851
|
},
|
|
23840
23852
|
datasource: {
|
|
23841
23853
|
spreadsheetId: {
|
|
23842
|
-
display: "
|
|
23854
|
+
display: "Spreadsheet URL",
|
|
23843
23855
|
type: "string" /* STRING */,
|
|
23844
23856
|
required: true
|
|
23845
23857
|
}
|
|
@@ -23909,6 +23921,7 @@ var init_googlesheets = __esm({
|
|
|
23909
23921
|
}
|
|
23910
23922
|
async testConnection() {
|
|
23911
23923
|
try {
|
|
23924
|
+
await setupCreationAuth(this.config);
|
|
23912
23925
|
await this.connect();
|
|
23913
23926
|
return { connected: true };
|
|
23914
23927
|
} catch (e) {
|
|
@@ -26880,22 +26893,22 @@ function threadSetup() {
|
|
|
26880
26893
|
init8();
|
|
26881
26894
|
}
|
|
26882
26895
|
async function checkCacheForDynamicVariable(queryId, variable) {
|
|
26883
|
-
const
|
|
26884
|
-
return
|
|
26896
|
+
const cache3 = await getClient2();
|
|
26897
|
+
return cache3.get(makeVariableKey(queryId, variable));
|
|
26885
26898
|
}
|
|
26886
26899
|
async function invalidateDynamicVariables(cachedVars) {
|
|
26887
|
-
const
|
|
26900
|
+
const cache3 = await getClient2();
|
|
26888
26901
|
let promises = [];
|
|
26889
26902
|
for (let variable of cachedVars) {
|
|
26890
26903
|
promises.push(
|
|
26891
|
-
|
|
26904
|
+
cache3.delete(makeVariableKey(variable.queryId, variable.name))
|
|
26892
26905
|
);
|
|
26893
26906
|
}
|
|
26894
26907
|
await Promise.all(promises);
|
|
26895
26908
|
}
|
|
26896
26909
|
async function storeDynamicVariable(queryId, variable, value) {
|
|
26897
|
-
const
|
|
26898
|
-
await
|
|
26910
|
+
const cache3 = await getClient2();
|
|
26911
|
+
await cache3.store(
|
|
26899
26912
|
makeVariableKey(queryId, variable),
|
|
26900
26913
|
value,
|
|
26901
26914
|
VARIABLE_TTL_SECONDS
|
|
@@ -30673,8 +30686,15 @@ init_constants6();
|
|
|
30673
30686
|
init_integrations2();
|
|
30674
30687
|
init_utils20();
|
|
30675
30688
|
init_src2();
|
|
30689
|
+
init_src();
|
|
30676
30690
|
init_sdk3();
|
|
30677
30691
|
init_websockets();
|
|
30692
|
+
init_googlesheets();
|
|
30693
|
+
var preSaveAction = {
|
|
30694
|
+
["GOOGLE_SHEETS" /* GOOGLE_SHEETS */]: async (datasource2) => {
|
|
30695
|
+
await setupCreationAuth(datasource2.config);
|
|
30696
|
+
}
|
|
30697
|
+
};
|
|
30678
30698
|
|
|
30679
30699
|
// src/api/controllers/query/validation.ts
|
|
30680
30700
|
init_src2();
|