@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/dist/index.js
CHANGED
|
@@ -121,6 +121,7 @@ var init_event = __esm({
|
|
|
121
121
|
Event6["USER_PASSWORD_UPDATED"] = "user:password:updated";
|
|
122
122
|
Event6["USER_PASSWORD_RESET_REQUESTED"] = "user:password:reset:requested";
|
|
123
123
|
Event6["USER_PASSWORD_RESET"] = "user:password:reset";
|
|
124
|
+
Event6["USER_DATA_COLLABORATION"] = "user:data:collaboration";
|
|
124
125
|
Event6["EMAIL_SMTP_CREATED"] = "email:smtp:created";
|
|
125
126
|
Event6["EMAIL_SMTP_UPDATED"] = "email:smtp:updated";
|
|
126
127
|
Event6["AUTH_SSO_CREATED"] = "auth:sso:created";
|
|
@@ -271,6 +272,7 @@ var init_event = __esm({
|
|
|
271
272
|
["user:password:force:reset" /* USER_PASSWORD_FORCE_RESET */]: void 0,
|
|
272
273
|
["user_group:onboarding_added" /* USER_GROUP_ONBOARDING */]: void 0,
|
|
273
274
|
["user:onboarding:complete" /* USER_ONBOARDING_COMPLETE */]: void 0,
|
|
275
|
+
["user:data:collaboration" /* USER_DATA_COLLABORATION */]: void 0,
|
|
274
276
|
// EMAIL
|
|
275
277
|
["email:smtp:created" /* EMAIL_SMTP_CREATED */]: `Email configuration created`,
|
|
276
278
|
["email:smtp:updated" /* EMAIL_SMTP_UPDATED */]: `Email configuration updated`,
|
|
@@ -5395,11 +5397,11 @@ function makeCacheItem(doc, lastWrite = null) {
|
|
|
5395
5397
|
return { doc, lastWrite: lastWrite || Date.now() };
|
|
5396
5398
|
}
|
|
5397
5399
|
async function put(db2, doc, writeRateMs = DEFAULT_WRITE_RATE_MS) {
|
|
5398
|
-
const
|
|
5400
|
+
const cache3 = await getCache();
|
|
5399
5401
|
const key = doc._id;
|
|
5400
5402
|
let cacheItem;
|
|
5401
5403
|
if (key) {
|
|
5402
|
-
cacheItem = await
|
|
5404
|
+
cacheItem = await cache3.get(makeCacheKey(db2, key));
|
|
5403
5405
|
}
|
|
5404
5406
|
const updateDb = !cacheItem || cacheItem.lastWrite < Date.now() - writeRateMs;
|
|
5405
5407
|
let output = doc;
|
|
@@ -5437,30 +5439,30 @@ async function put(db2, doc, writeRateMs = DEFAULT_WRITE_RATE_MS) {
|
|
|
5437
5439
|
}
|
|
5438
5440
|
cacheItem = makeCacheItem(output, updateDb ? null : cacheItem == null ? void 0 : cacheItem.lastWrite);
|
|
5439
5441
|
if (output._id) {
|
|
5440
|
-
await
|
|
5442
|
+
await cache3.store(makeCacheKey(db2, output._id), cacheItem);
|
|
5441
5443
|
}
|
|
5442
5444
|
return { ok: true, id: output._id, rev: output._rev };
|
|
5443
5445
|
}
|
|
5444
5446
|
async function get2(db2, id) {
|
|
5445
|
-
const
|
|
5447
|
+
const cache3 = await getCache();
|
|
5446
5448
|
const cacheKey = makeCacheKey(db2, id);
|
|
5447
|
-
let cacheItem = await
|
|
5449
|
+
let cacheItem = await cache3.get(cacheKey);
|
|
5448
5450
|
if (!cacheItem) {
|
|
5449
5451
|
const doc = await db2.get(id);
|
|
5450
5452
|
cacheItem = makeCacheItem(doc);
|
|
5451
|
-
await
|
|
5453
|
+
await cache3.store(cacheKey, cacheItem);
|
|
5452
5454
|
}
|
|
5453
5455
|
return cacheItem.doc;
|
|
5454
5456
|
}
|
|
5455
5457
|
async function remove(db2, docOrId, rev) {
|
|
5456
|
-
const
|
|
5458
|
+
const cache3 = await getCache();
|
|
5457
5459
|
if (!docOrId) {
|
|
5458
5460
|
throw new Error("No ID/Rev provided.");
|
|
5459
5461
|
}
|
|
5460
5462
|
const id = typeof docOrId === "string" ? docOrId : docOrId._id;
|
|
5461
5463
|
rev = typeof docOrId === "string" ? rev : docOrId._rev;
|
|
5462
5464
|
try {
|
|
5463
|
-
await
|
|
5465
|
+
await cache3.delete(makeCacheKey(db2, id));
|
|
5464
5466
|
} finally {
|
|
5465
5467
|
await db2.remove(id, rev);
|
|
5466
5468
|
}
|
|
@@ -8144,6 +8146,12 @@ async function passwordReset(user2) {
|
|
|
8144
8146
|
};
|
|
8145
8147
|
await publishEvent("user:password:reset" /* USER_PASSWORD_RESET */, properties);
|
|
8146
8148
|
}
|
|
8149
|
+
async function dataCollaboration(users2) {
|
|
8150
|
+
const properties = {
|
|
8151
|
+
users: users2
|
|
8152
|
+
};
|
|
8153
|
+
await publishEvent("user:data:collaboration" /* USER_DATA_COLLABORATION */, properties);
|
|
8154
|
+
}
|
|
8147
8155
|
var user_default;
|
|
8148
8156
|
var init_user9 = __esm({
|
|
8149
8157
|
"../backend-core/src/events/publishers/user.ts"() {
|
|
@@ -8164,7 +8172,8 @@ var init_user9 = __esm({
|
|
|
8164
8172
|
passwordForceReset,
|
|
8165
8173
|
passwordUpdated,
|
|
8166
8174
|
passwordResetRequested,
|
|
8167
|
-
passwordReset
|
|
8175
|
+
passwordReset,
|
|
8176
|
+
dataCollaboration
|
|
8168
8177
|
};
|
|
8169
8178
|
}
|
|
8170
8179
|
});
|
|
@@ -10051,8 +10060,8 @@ async function preAuth(passport2, ctx, next) {
|
|
|
10051
10060
|
callbackUrl,
|
|
10052
10061
|
ssoSaveUserNoOp
|
|
10053
10062
|
);
|
|
10054
|
-
if (!ctx.query.appId
|
|
10055
|
-
ctx.throw(400, "appId
|
|
10063
|
+
if (!ctx.query.appId) {
|
|
10064
|
+
ctx.throw(400, "appId query param not present.");
|
|
10056
10065
|
}
|
|
10057
10066
|
return passport2.authenticate(strategy, {
|
|
10058
10067
|
scope: ["profile", "email", "https://www.googleapis.com/auth/spreadsheets"],
|
|
@@ -10072,7 +10081,7 @@ async function postAuth(passport2, ctx, next) {
|
|
|
10072
10081
|
clientSecret: config.clientSecret,
|
|
10073
10082
|
callbackURL: callbackUrl
|
|
10074
10083
|
},
|
|
10075
|
-
(accessToken, refreshToken,
|
|
10084
|
+
(accessToken, refreshToken, _profile, done) => {
|
|
10076
10085
|
clearCookie(ctx, "budibase:datasourceauth" /* DatasourceAuth */);
|
|
10077
10086
|
done(null, { accessToken, refreshToken });
|
|
10078
10087
|
}
|
|
@@ -10080,22 +10089,14 @@ async function postAuth(passport2, ctx, next) {
|
|
|
10080
10089
|
{ successRedirect: "/", failureRedirect: "/error" },
|
|
10081
10090
|
async (err, tokens) => {
|
|
10082
10091
|
const baseUrl = `/builder/app/${authStateCookie.appId}/data`;
|
|
10083
|
-
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
|
-
if (err2.status === 404) {
|
|
10089
|
-
ctx.redirect(baseUrl);
|
|
10090
|
-
}
|
|
10091
|
-
}
|
|
10092
|
-
if (!datasource2.config) {
|
|
10093
|
-
datasource2.config = {};
|
|
10092
|
+
const id = utils_exports2.newid();
|
|
10093
|
+
await cache_exports.store(
|
|
10094
|
+
`datasource:creation:${authStateCookie.appId}:google:${id}`,
|
|
10095
|
+
{
|
|
10096
|
+
tokens
|
|
10094
10097
|
}
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
ctx.redirect(`${baseUrl}/datasource/${authStateCookie.datasourceId}`);
|
|
10098
|
-
});
|
|
10098
|
+
);
|
|
10099
|
+
ctx.redirect(`${baseUrl}/new?continue_google_setup=${id}`);
|
|
10099
10100
|
}
|
|
10100
10101
|
)(ctx, next);
|
|
10101
10102
|
}
|
|
@@ -10105,9 +10106,9 @@ var init_google2 = __esm({
|
|
|
10105
10106
|
init_google();
|
|
10106
10107
|
init_constants2();
|
|
10107
10108
|
init_utils5();
|
|
10108
|
-
init_db5();
|
|
10109
10109
|
init_configs3();
|
|
10110
10110
|
init_sso2();
|
|
10111
|
+
init_src2();
|
|
10111
10112
|
GoogleStrategy2 = require("passport-google-oauth").OAuth2Strategy;
|
|
10112
10113
|
}
|
|
10113
10114
|
});
|
|
@@ -24838,22 +24839,22 @@ function threadSetup() {
|
|
|
24838
24839
|
init10();
|
|
24839
24840
|
}
|
|
24840
24841
|
async function checkCacheForDynamicVariable(queryId, variable) {
|
|
24841
|
-
const
|
|
24842
|
-
return
|
|
24842
|
+
const cache3 = await getClient3();
|
|
24843
|
+
return cache3.get(makeVariableKey(queryId, variable));
|
|
24843
24844
|
}
|
|
24844
24845
|
async function invalidateDynamicVariables(cachedVars) {
|
|
24845
|
-
const
|
|
24846
|
+
const cache3 = await getClient3();
|
|
24846
24847
|
let promises = [];
|
|
24847
24848
|
for (let variable of cachedVars) {
|
|
24848
24849
|
promises.push(
|
|
24849
|
-
|
|
24850
|
+
cache3.delete(makeVariableKey(variable.queryId, variable.name))
|
|
24850
24851
|
);
|
|
24851
24852
|
}
|
|
24852
24853
|
await Promise.all(promises);
|
|
24853
24854
|
}
|
|
24854
24855
|
async function storeDynamicVariable(queryId, variable, value) {
|
|
24855
|
-
const
|
|
24856
|
-
await
|
|
24856
|
+
const cache3 = await getClient3();
|
|
24857
|
+
await cache3.store(
|
|
24857
24858
|
makeVariableKey(queryId, variable),
|
|
24858
24859
|
value,
|
|
24859
24860
|
VARIABLE_TTL_SECONDS
|
|
@@ -29029,9 +29030,20 @@ var init_rest = __esm({
|
|
|
29029
29030
|
});
|
|
29030
29031
|
|
|
29031
29032
|
// src/integrations/googlesheets.ts
|
|
29033
|
+
async function setupCreationAuth(datasouce) {
|
|
29034
|
+
if (datasouce.continueSetupId) {
|
|
29035
|
+
const appId = context_exports.getAppId();
|
|
29036
|
+
const tokens = await cache_exports.get(
|
|
29037
|
+
`datasource:creation:${appId}:google:${datasouce.continueSetupId}`
|
|
29038
|
+
);
|
|
29039
|
+
datasouce.auth = tokens.tokens;
|
|
29040
|
+
delete datasouce.continueSetupId;
|
|
29041
|
+
}
|
|
29042
|
+
}
|
|
29032
29043
|
var import_google_auth_library, import_google_spreadsheet, import_node_fetch10, ALLOWED_TYPES, SCHEMA12, GoogleSheetsIntegration, googlesheets_default;
|
|
29033
29044
|
var init_googlesheets = __esm({
|
|
29034
29045
|
"src/integrations/googlesheets.ts"() {
|
|
29046
|
+
"use strict";
|
|
29035
29047
|
init_src();
|
|
29036
29048
|
import_google_auth_library = require("google-auth-library");
|
|
29037
29049
|
init_utils19();
|
|
@@ -29066,7 +29078,7 @@ var init_googlesheets = __esm({
|
|
|
29066
29078
|
},
|
|
29067
29079
|
datasource: {
|
|
29068
29080
|
spreadsheetId: {
|
|
29069
|
-
display: "
|
|
29081
|
+
display: "Spreadsheet URL",
|
|
29070
29082
|
type: "string" /* STRING */,
|
|
29071
29083
|
required: true
|
|
29072
29084
|
}
|
|
@@ -29136,6 +29148,7 @@ var init_googlesheets = __esm({
|
|
|
29136
29148
|
}
|
|
29137
29149
|
async testConnection() {
|
|
29138
29150
|
try {
|
|
29151
|
+
await setupCreationAuth(this.config);
|
|
29139
29152
|
await this.connect();
|
|
29140
29153
|
return { connected: true };
|
|
29141
29154
|
} catch (e) {
|
|
@@ -31747,6 +31760,7 @@ var init_builder2 = __esm({
|
|
|
31747
31760
|
await this.joinRoom(socket, appId);
|
|
31748
31761
|
const sessions = await this.getRoomSessions(appId);
|
|
31749
31762
|
callback({ users: sessions });
|
|
31763
|
+
await events_exports.user.dataCollaboration(sessions.length);
|
|
31750
31764
|
});
|
|
31751
31765
|
}
|
|
31752
31766
|
async onDisconnect(socket) {
|
|
@@ -34783,6 +34797,9 @@ async function save13(ctx) {
|
|
|
34783
34797
|
datasource2.entities = tables;
|
|
34784
34798
|
setDefaultDisplayColumns(datasource2);
|
|
34785
34799
|
}
|
|
34800
|
+
if (preSaveAction[datasource2.source]) {
|
|
34801
|
+
await preSaveAction[datasource2.source](datasource2);
|
|
34802
|
+
}
|
|
34786
34803
|
const dbResp = await db2.put(datasource2);
|
|
34787
34804
|
await events_exports.datasource.created(datasource2);
|
|
34788
34805
|
datasource2._rev = dbResp.rev;
|
|
@@ -34861,6 +34878,7 @@ async function query(ctx) {
|
|
|
34861
34878
|
ctx.throw(400, err);
|
|
34862
34879
|
}
|
|
34863
34880
|
}
|
|
34881
|
+
var preSaveAction;
|
|
34864
34882
|
var init_datasource5 = __esm({
|
|
34865
34883
|
"src/api/controllers/datasource.ts"() {
|
|
34866
34884
|
init_utils9();
|
|
@@ -34870,8 +34888,15 @@ var init_datasource5 = __esm({
|
|
|
34870
34888
|
init_utils24();
|
|
34871
34889
|
init_utils18();
|
|
34872
34890
|
init_src2();
|
|
34891
|
+
init_src();
|
|
34873
34892
|
init_sdk3();
|
|
34874
34893
|
init_websockets();
|
|
34894
|
+
init_googlesheets();
|
|
34895
|
+
preSaveAction = {
|
|
34896
|
+
["GOOGLE_SHEETS" /* GOOGLE_SHEETS */]: async (datasource2) => {
|
|
34897
|
+
await setupCreationAuth(datasource2.config);
|
|
34898
|
+
}
|
|
34899
|
+
};
|
|
34875
34900
|
}
|
|
34876
34901
|
});
|
|
34877
34902
|
|