@budibase/server 2.7.7-alpha.2 → 2.7.9
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.fbee8e8b.js → index.358319af.js} +364 -364
- package/builder/assets/{index.b33e8ad5.css → index.a86e2071.css} +1 -1
- package/builder/index.html +2 -2
- package/dist/automation.js +42 -112
- package/dist/automation.js.map +3 -3
- package/dist/index.js +42 -116
- package/dist/index.js.map +3 -3
- package/dist/query.js +20 -24
- package/dist/query.js.map +3 -3
- package/package.json +8 -8
- package/src/api/controllers/datasource.ts +1 -13
- package/src/automations/steps/sendSmtpEmail.ts +4 -55
- package/src/automations/tests/sendSmtpEmail.spec.js +71 -0
- package/src/integrations/googlesheets.ts +2 -18
- package/src/sdk/app/datasources/datasources.ts +1 -1
- package/src/utilities/workerRequests.ts +9 -20
- package/src/automations/tests/sendSmtpEmail.spec.ts +0 -74
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.358319af.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
|
@@ -946,7 +946,6 @@ var init_automation2 = __esm({
|
|
|
946
946
|
AutomationIOType2["NUMBER"] = "number";
|
|
947
947
|
AutomationIOType2["ARRAY"] = "array";
|
|
948
948
|
AutomationIOType2["JSON"] = "json";
|
|
949
|
-
AutomationIOType2["DATE"] = "date";
|
|
950
949
|
return AutomationIOType2;
|
|
951
950
|
})(AutomationIOType || {});
|
|
952
951
|
AutomationCustomIOType = /* @__PURE__ */ ((AutomationCustomIOType2) => {
|
|
@@ -5358,11 +5357,11 @@ function makeCacheItem(doc, lastWrite = null) {
|
|
|
5358
5357
|
return { doc, lastWrite: lastWrite || Date.now() };
|
|
5359
5358
|
}
|
|
5360
5359
|
async function put(db2, doc, writeRateMs = DEFAULT_WRITE_RATE_MS) {
|
|
5361
|
-
const
|
|
5360
|
+
const cache2 = await getCache();
|
|
5362
5361
|
const key = doc._id;
|
|
5363
5362
|
let cacheItem;
|
|
5364
5363
|
if (key) {
|
|
5365
|
-
cacheItem = await
|
|
5364
|
+
cacheItem = await cache2.get(makeCacheKey(db2, key));
|
|
5366
5365
|
}
|
|
5367
5366
|
const updateDb = !cacheItem || cacheItem.lastWrite < Date.now() - writeRateMs;
|
|
5368
5367
|
let output = doc;
|
|
@@ -5400,30 +5399,30 @@ async function put(db2, doc, writeRateMs = DEFAULT_WRITE_RATE_MS) {
|
|
|
5400
5399
|
}
|
|
5401
5400
|
cacheItem = makeCacheItem(output, updateDb ? null : cacheItem == null ? void 0 : cacheItem.lastWrite);
|
|
5402
5401
|
if (output._id) {
|
|
5403
|
-
await
|
|
5402
|
+
await cache2.store(makeCacheKey(db2, output._id), cacheItem);
|
|
5404
5403
|
}
|
|
5405
5404
|
return { ok: true, id: output._id, rev: output._rev };
|
|
5406
5405
|
}
|
|
5407
5406
|
async function get2(db2, id) {
|
|
5408
|
-
const
|
|
5407
|
+
const cache2 = await getCache();
|
|
5409
5408
|
const cacheKey = makeCacheKey(db2, id);
|
|
5410
|
-
let cacheItem = await
|
|
5409
|
+
let cacheItem = await cache2.get(cacheKey);
|
|
5411
5410
|
if (!cacheItem) {
|
|
5412
5411
|
const doc = await db2.get(id);
|
|
5413
5412
|
cacheItem = makeCacheItem(doc);
|
|
5414
|
-
await
|
|
5413
|
+
await cache2.store(cacheKey, cacheItem);
|
|
5415
5414
|
}
|
|
5416
5415
|
return cacheItem.doc;
|
|
5417
5416
|
}
|
|
5418
5417
|
async function remove(db2, docOrId, rev) {
|
|
5419
|
-
const
|
|
5418
|
+
const cache2 = await getCache();
|
|
5420
5419
|
if (!docOrId) {
|
|
5421
5420
|
throw new Error("No ID/Rev provided.");
|
|
5422
5421
|
}
|
|
5423
5422
|
const id = typeof docOrId === "string" ? docOrId : docOrId._id;
|
|
5424
5423
|
rev = typeof docOrId === "string" ? rev : docOrId._rev;
|
|
5425
5424
|
try {
|
|
5426
|
-
await
|
|
5425
|
+
await cache2.delete(makeCacheKey(db2, id));
|
|
5427
5426
|
} finally {
|
|
5428
5427
|
await db2.remove(id, rev);
|
|
5429
5428
|
}
|
|
@@ -9782,8 +9781,8 @@ async function preAuth(passport2, ctx, next) {
|
|
|
9782
9781
|
callbackUrl,
|
|
9783
9782
|
ssoSaveUserNoOp
|
|
9784
9783
|
);
|
|
9785
|
-
if (!ctx.query.appId) {
|
|
9786
|
-
ctx.throw(400, "appId query
|
|
9784
|
+
if (!ctx.query.appId || !ctx.query.datasourceId) {
|
|
9785
|
+
ctx.throw(400, "appId and datasourceId query params not present.");
|
|
9787
9786
|
}
|
|
9788
9787
|
return passport2.authenticate(strategy, {
|
|
9789
9788
|
scope: ["profile", "email", "https://www.googleapis.com/auth/spreadsheets"],
|
|
@@ -9803,7 +9802,7 @@ async function postAuth(passport2, ctx, next) {
|
|
|
9803
9802
|
clientSecret: config.clientSecret,
|
|
9804
9803
|
callbackURL: callbackUrl
|
|
9805
9804
|
},
|
|
9806
|
-
(accessToken, refreshToken,
|
|
9805
|
+
(accessToken, refreshToken, profile, done) => {
|
|
9807
9806
|
clearCookie(ctx, "budibase:datasourceauth" /* DatasourceAuth */);
|
|
9808
9807
|
done(null, { accessToken, refreshToken });
|
|
9809
9808
|
}
|
|
@@ -9811,14 +9810,22 @@ async function postAuth(passport2, ctx, next) {
|
|
|
9811
9810
|
{ successRedirect: "/", failureRedirect: "/error" },
|
|
9812
9811
|
async (err, tokens) => {
|
|
9813
9812
|
const baseUrl = `/builder/app/${authStateCookie.appId}/data`;
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
|
|
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
|
+
}
|
|
9819
9821
|
}
|
|
9820
|
-
|
|
9821
|
-
|
|
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
|
+
});
|
|
9822
9829
|
}
|
|
9823
9830
|
)(ctx, next);
|
|
9824
9831
|
}
|
|
@@ -9827,9 +9834,9 @@ var init_google2 = __esm({
|
|
|
9827
9834
|
"../backend-core/src/middleware/passport/datasource/google.ts"() {
|
|
9828
9835
|
init_google();
|
|
9829
9836
|
init_constants2();
|
|
9830
|
-
init_configs3();
|
|
9831
|
-
init_cache();
|
|
9832
9837
|
init_utils5();
|
|
9838
|
+
init_db5();
|
|
9839
|
+
init_configs3();
|
|
9833
9840
|
init_sso2();
|
|
9834
9841
|
GoogleStrategy2 = require("passport-google-oauth").OAuth2Strategy;
|
|
9835
9842
|
}
|
|
@@ -23804,16 +23811,6 @@ var init_rest = __esm({
|
|
|
23804
23811
|
});
|
|
23805
23812
|
|
|
23806
23813
|
// src/integrations/googlesheets.ts
|
|
23807
|
-
async function setupCreationAuth(datasouce) {
|
|
23808
|
-
if (datasouce.continueSetupId) {
|
|
23809
|
-
const appId = context_exports.getAppId();
|
|
23810
|
-
const tokens = await cache_exports.get(
|
|
23811
|
-
`datasource:creation:${appId}:google:${datasouce.continueSetupId}`
|
|
23812
|
-
);
|
|
23813
|
-
datasouce.auth = tokens.tokens;
|
|
23814
|
-
delete datasouce.continueSetupId;
|
|
23815
|
-
}
|
|
23816
|
-
}
|
|
23817
23814
|
var import_google_auth_library, import_google_spreadsheet, import_node_fetch9, ALLOWED_TYPES, SCHEMA12, GoogleSheetsIntegration, googlesheets_default;
|
|
23818
23815
|
var init_googlesheets = __esm({
|
|
23819
23816
|
"src/integrations/googlesheets.ts"() {
|
|
@@ -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) {
|
|
@@ -25304,7 +25300,7 @@ function mergeConfigs(update7, old) {
|
|
|
25304
25300
|
}
|
|
25305
25301
|
if (hasAuthConfigs(update7)) {
|
|
25306
25302
|
const configs = update7.config.authConfigs;
|
|
25307
|
-
const oldConfigs = (_a = old.config) == null ? void 0 : _a.authConfigs;
|
|
25303
|
+
const oldConfigs = ((_a = old.config) == null ? void 0 : _a.authConfigs) || [];
|
|
25308
25304
|
for (let config of configs) {
|
|
25309
25305
|
if (config.type !== "basic" /* BASIC */) {
|
|
25310
25306
|
continue;
|
|
@@ -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
|
|
@@ -27376,16 +27372,7 @@ async function checkResponse(response2, errorMsg, { ctx } = {}) {
|
|
|
27376
27372
|
}
|
|
27377
27373
|
return response2.json();
|
|
27378
27374
|
}
|
|
27379
|
-
async function sendSmtpEmail({
|
|
27380
|
-
to,
|
|
27381
|
-
from,
|
|
27382
|
-
subject,
|
|
27383
|
-
contents,
|
|
27384
|
-
cc,
|
|
27385
|
-
bcc,
|
|
27386
|
-
automation,
|
|
27387
|
-
invite
|
|
27388
|
-
}) {
|
|
27375
|
+
async function sendSmtpEmail(to, from, subject, contents, cc, bcc, automation) {
|
|
27389
27376
|
const response2 = await (0, import_node_fetch10.default)(
|
|
27390
27377
|
checkSlashesInUrl2(environment_default.WORKER_URL + `/api/global/email/send`),
|
|
27391
27378
|
request(void 0, {
|
|
@@ -27398,8 +27385,7 @@ async function sendSmtpEmail({
|
|
|
27398
27385
|
cc,
|
|
27399
27386
|
bcc,
|
|
27400
27387
|
purpose: "custom",
|
|
27401
|
-
automation
|
|
27402
|
-
invite
|
|
27388
|
+
automation
|
|
27403
27389
|
}
|
|
27404
27390
|
})
|
|
27405
27391
|
);
|
|
@@ -27447,35 +27433,6 @@ var definition7 = {
|
|
|
27447
27433
|
contents: {
|
|
27448
27434
|
type: "string" /* STRING */,
|
|
27449
27435
|
title: "HTML Contents"
|
|
27450
|
-
},
|
|
27451
|
-
addInvite: {
|
|
27452
|
-
type: "boolean" /* BOOLEAN */,
|
|
27453
|
-
title: "Add calendar invite"
|
|
27454
|
-
},
|
|
27455
|
-
startTime: {
|
|
27456
|
-
type: "date" /* DATE */,
|
|
27457
|
-
title: "Start Time",
|
|
27458
|
-
dependsOn: "addInvite"
|
|
27459
|
-
},
|
|
27460
|
-
endTime: {
|
|
27461
|
-
type: "date" /* DATE */,
|
|
27462
|
-
title: "End Time",
|
|
27463
|
-
dependsOn: "addInvite"
|
|
27464
|
-
},
|
|
27465
|
-
summary: {
|
|
27466
|
-
type: "string" /* STRING */,
|
|
27467
|
-
title: "Meeting Summary",
|
|
27468
|
-
dependsOn: "addInvite"
|
|
27469
|
-
},
|
|
27470
|
-
location: {
|
|
27471
|
-
type: "string" /* STRING */,
|
|
27472
|
-
title: "Location",
|
|
27473
|
-
dependsOn: "addInvite"
|
|
27474
|
-
},
|
|
27475
|
-
url: {
|
|
27476
|
-
type: "string" /* STRING */,
|
|
27477
|
-
title: "URL",
|
|
27478
|
-
dependsOn: "addInvite"
|
|
27479
27436
|
}
|
|
27480
27437
|
},
|
|
27481
27438
|
required: ["to", "from", "subject", "contents"]
|
|
@@ -27496,41 +27453,21 @@ var definition7 = {
|
|
|
27496
27453
|
}
|
|
27497
27454
|
};
|
|
27498
27455
|
async function run3({ inputs }) {
|
|
27499
|
-
let {
|
|
27500
|
-
to,
|
|
27501
|
-
from,
|
|
27502
|
-
subject,
|
|
27503
|
-
contents,
|
|
27504
|
-
cc,
|
|
27505
|
-
bcc,
|
|
27506
|
-
addInvite,
|
|
27507
|
-
startTime,
|
|
27508
|
-
endTime,
|
|
27509
|
-
summary,
|
|
27510
|
-
location,
|
|
27511
|
-
url
|
|
27512
|
-
} = inputs;
|
|
27456
|
+
let { to, from, subject, contents, cc, bcc } = inputs;
|
|
27513
27457
|
if (!contents) {
|
|
27514
27458
|
contents = "<h1>No content</h1>";
|
|
27515
27459
|
}
|
|
27516
27460
|
to = to || void 0;
|
|
27517
27461
|
try {
|
|
27518
|
-
let response2 = await sendSmtpEmail(
|
|
27462
|
+
let response2 = await sendSmtpEmail(
|
|
27519
27463
|
to,
|
|
27520
27464
|
from,
|
|
27521
27465
|
subject,
|
|
27522
27466
|
contents,
|
|
27523
27467
|
cc,
|
|
27524
27468
|
bcc,
|
|
27525
|
-
|
|
27526
|
-
|
|
27527
|
-
startTime,
|
|
27528
|
-
endTime,
|
|
27529
|
-
summary,
|
|
27530
|
-
location,
|
|
27531
|
-
url
|
|
27532
|
-
} : void 0
|
|
27533
|
-
});
|
|
27469
|
+
true
|
|
27470
|
+
);
|
|
27534
27471
|
return {
|
|
27535
27472
|
success: true,
|
|
27536
27473
|
response: response2
|
|
@@ -30745,15 +30682,8 @@ init_constants6();
|
|
|
30745
30682
|
init_integrations2();
|
|
30746
30683
|
init_utils20();
|
|
30747
30684
|
init_src2();
|
|
30748
|
-
init_src();
|
|
30749
30685
|
init_sdk3();
|
|
30750
30686
|
init_websockets();
|
|
30751
|
-
init_googlesheets();
|
|
30752
|
-
var preSaveAction = {
|
|
30753
|
-
["GOOGLE_SHEETS" /* GOOGLE_SHEETS */]: async (datasource2) => {
|
|
30754
|
-
await setupCreationAuth(datasource2.config);
|
|
30755
|
-
}
|
|
30756
|
-
};
|
|
30757
30687
|
|
|
30758
30688
|
// src/api/controllers/query/validation.ts
|
|
30759
30689
|
init_src2();
|