@budibase/server 2.6.24-alpha.2 → 2.6.27
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.edf18bd3.js → index.4ca5529d.js} +326 -326
- package/builder/assets/{index.b33e8ad5.css → index.a86e2071.css} +1 -1
- package/builder/index.html +2 -2
- package/dist/automation.js +44 -46
- package/dist/automation.js.map +3 -3
- package/dist/index.js +45 -50
- package/dist/index.js.map +3 -3
- package/dist/query.js +29 -23
- 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/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 cache2 = await getCache();
|
|
5399
5401
|
const key = doc._id;
|
|
5400
5402
|
let cacheItem;
|
|
5401
5403
|
if (key) {
|
|
5402
|
-
cacheItem = await
|
|
5404
|
+
cacheItem = await cache2.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 cache2.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 cache2 = await getCache();
|
|
5446
5448
|
const cacheKey = makeCacheKey(db2, id);
|
|
5447
|
-
let cacheItem = await
|
|
5449
|
+
let cacheItem = await cache2.get(cacheKey);
|
|
5448
5450
|
if (!cacheItem) {
|
|
5449
5451
|
const doc = await db2.get(id);
|
|
5450
5452
|
cacheItem = makeCacheItem(doc);
|
|
5451
|
-
await
|
|
5453
|
+
await cache2.store(cacheKey, cacheItem);
|
|
5452
5454
|
}
|
|
5453
5455
|
return cacheItem.doc;
|
|
5454
5456
|
}
|
|
5455
5457
|
async function remove(db2, docOrId, rev) {
|
|
5456
|
-
const
|
|
5458
|
+
const cache2 = 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 cache2.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 query
|
|
10063
|
+
if (!ctx.query.appId || !ctx.query.datasourceId) {
|
|
10064
|
+
ctx.throw(400, "appId and datasourceId query params 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,14 +10089,22 @@ 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
|
-
|
|
10092
|
+
await doWithDB(authStateCookie.appId, async (db2) => {
|
|
10093
|
+
let datasource2;
|
|
10094
|
+
try {
|
|
10095
|
+
datasource2 = await db2.get(authStateCookie.datasourceId);
|
|
10096
|
+
} catch (err2) {
|
|
10097
|
+
if (err2.status === 404) {
|
|
10098
|
+
ctx.redirect(baseUrl);
|
|
10099
|
+
}
|
|
10088
10100
|
}
|
|
10089
|
-
|
|
10090
|
-
|
|
10101
|
+
if (!datasource2.config) {
|
|
10102
|
+
datasource2.config = {};
|
|
10103
|
+
}
|
|
10104
|
+
datasource2.config.auth = { type: "google", ...tokens };
|
|
10105
|
+
await db2.put(datasource2);
|
|
10106
|
+
ctx.redirect(`${baseUrl}/datasource/${authStateCookie.datasourceId}`);
|
|
10107
|
+
});
|
|
10091
10108
|
}
|
|
10092
10109
|
)(ctx, next);
|
|
10093
10110
|
}
|
|
@@ -10097,9 +10114,9 @@ var init_google2 = __esm({
|
|
|
10097
10114
|
init_google();
|
|
10098
10115
|
init_constants2();
|
|
10099
10116
|
init_utils5();
|
|
10117
|
+
init_db5();
|
|
10100
10118
|
init_configs3();
|
|
10101
10119
|
init_sso2();
|
|
10102
|
-
init_src2();
|
|
10103
10120
|
GoogleStrategy2 = require("passport-google-oauth").OAuth2Strategy;
|
|
10104
10121
|
}
|
|
10105
10122
|
});
|
|
@@ -24830,22 +24847,22 @@ function threadSetup() {
|
|
|
24830
24847
|
init10();
|
|
24831
24848
|
}
|
|
24832
24849
|
async function checkCacheForDynamicVariable(queryId, variable) {
|
|
24833
|
-
const
|
|
24834
|
-
return
|
|
24850
|
+
const cache2 = await getClient3();
|
|
24851
|
+
return cache2.get(makeVariableKey(queryId, variable));
|
|
24835
24852
|
}
|
|
24836
24853
|
async function invalidateDynamicVariables(cachedVars) {
|
|
24837
|
-
const
|
|
24854
|
+
const cache2 = await getClient3();
|
|
24838
24855
|
let promises = [];
|
|
24839
24856
|
for (let variable of cachedVars) {
|
|
24840
24857
|
promises.push(
|
|
24841
|
-
|
|
24858
|
+
cache2.delete(makeVariableKey(variable.queryId, variable.name))
|
|
24842
24859
|
);
|
|
24843
24860
|
}
|
|
24844
24861
|
await Promise.all(promises);
|
|
24845
24862
|
}
|
|
24846
24863
|
async function storeDynamicVariable(queryId, variable, value) {
|
|
24847
|
-
const
|
|
24848
|
-
await
|
|
24864
|
+
const cache2 = await getClient3();
|
|
24865
|
+
await cache2.store(
|
|
24849
24866
|
makeVariableKey(queryId, variable),
|
|
24850
24867
|
value,
|
|
24851
24868
|
VARIABLE_TTL_SECONDS
|
|
@@ -29021,20 +29038,9 @@ var init_rest = __esm({
|
|
|
29021
29038
|
});
|
|
29022
29039
|
|
|
29023
29040
|
// src/integrations/googlesheets.ts
|
|
29024
|
-
async function setupCreationAuth(datasouce) {
|
|
29025
|
-
if (datasouce.continueSetupId) {
|
|
29026
|
-
const appId = context_exports.getAppId();
|
|
29027
|
-
const tokens = await cache_exports.get(
|
|
29028
|
-
`datasource:creation:${appId}:google:${datasouce.continueSetupId}`
|
|
29029
|
-
);
|
|
29030
|
-
datasouce.auth = tokens.tokens;
|
|
29031
|
-
delete datasouce.continueSetupId;
|
|
29032
|
-
}
|
|
29033
|
-
}
|
|
29034
29041
|
var import_google_auth_library, import_google_spreadsheet, import_node_fetch10, ALLOWED_TYPES, SCHEMA12, GoogleSheetsIntegration, googlesheets_default;
|
|
29035
29042
|
var init_googlesheets = __esm({
|
|
29036
29043
|
"src/integrations/googlesheets.ts"() {
|
|
29037
|
-
"use strict";
|
|
29038
29044
|
init_src();
|
|
29039
29045
|
import_google_auth_library = require("google-auth-library");
|
|
29040
29046
|
init_utils19();
|
|
@@ -29069,7 +29075,7 @@ var init_googlesheets = __esm({
|
|
|
29069
29075
|
},
|
|
29070
29076
|
datasource: {
|
|
29071
29077
|
spreadsheetId: {
|
|
29072
|
-
display: "
|
|
29078
|
+
display: "Google Sheet URL",
|
|
29073
29079
|
type: "string" /* STRING */,
|
|
29074
29080
|
required: true
|
|
29075
29081
|
}
|
|
@@ -29139,7 +29145,6 @@ var init_googlesheets = __esm({
|
|
|
29139
29145
|
}
|
|
29140
29146
|
async testConnection() {
|
|
29141
29147
|
try {
|
|
29142
|
-
await setupCreationAuth(this.config);
|
|
29143
29148
|
await this.connect();
|
|
29144
29149
|
return { connected: true };
|
|
29145
29150
|
} catch (e) {
|
|
@@ -31751,6 +31756,7 @@ var init_builder2 = __esm({
|
|
|
31751
31756
|
await this.joinRoom(socket, appId);
|
|
31752
31757
|
const sessions = await this.getRoomSessions(appId);
|
|
31753
31758
|
callback({ users: sessions });
|
|
31759
|
+
await events_exports.user.dataCollaboration(sessions.length);
|
|
31754
31760
|
});
|
|
31755
31761
|
}
|
|
31756
31762
|
async onDisconnect(socket) {
|
|
@@ -34787,9 +34793,6 @@ async function save13(ctx) {
|
|
|
34787
34793
|
datasource2.entities = tables;
|
|
34788
34794
|
setDefaultDisplayColumns(datasource2);
|
|
34789
34795
|
}
|
|
34790
|
-
if (preSaveAction[datasource2.source]) {
|
|
34791
|
-
await preSaveAction[datasource2.source](datasource2);
|
|
34792
|
-
}
|
|
34793
34796
|
const dbResp = await db2.put(datasource2);
|
|
34794
34797
|
await events_exports.datasource.created(datasource2);
|
|
34795
34798
|
datasource2._rev = dbResp.rev;
|
|
@@ -34868,7 +34871,6 @@ async function query(ctx) {
|
|
|
34868
34871
|
ctx.throw(400, err);
|
|
34869
34872
|
}
|
|
34870
34873
|
}
|
|
34871
|
-
var preSaveAction;
|
|
34872
34874
|
var init_datasource5 = __esm({
|
|
34873
34875
|
"src/api/controllers/datasource.ts"() {
|
|
34874
34876
|
init_utils9();
|
|
@@ -34878,15 +34880,8 @@ var init_datasource5 = __esm({
|
|
|
34878
34880
|
init_utils24();
|
|
34879
34881
|
init_utils18();
|
|
34880
34882
|
init_src2();
|
|
34881
|
-
init_src();
|
|
34882
34883
|
init_sdk3();
|
|
34883
34884
|
init_websockets();
|
|
34884
|
-
init_googlesheets();
|
|
34885
|
-
preSaveAction = {
|
|
34886
|
-
["GOOGLE_SHEETS" /* GOOGLE_SHEETS */]: async (datasource2) => {
|
|
34887
|
-
await setupCreationAuth(datasource2.config);
|
|
34888
|
-
}
|
|
34889
|
-
};
|
|
34890
34885
|
}
|
|
34891
34886
|
});
|
|
34892
34887
|
|