@budibase/backend-core 2.22.5 → 2.22.7

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.
Files changed (62) hide show
  1. package/dist/index.js +27 -32
  2. package/dist/index.js.map +2 -2
  3. package/dist/index.js.meta.json +1 -1
  4. package/dist/package.json +4 -4
  5. package/dist/plugins.js.meta.json +1 -1
  6. package/dist/src/auth/auth.js +4 -2
  7. package/dist/src/auth/auth.js.map +1 -1
  8. package/dist/src/cache/base/index.d.ts +1 -3
  9. package/dist/src/cache/base/index.js +1 -1
  10. package/dist/src/cache/base/index.js.map +1 -1
  11. package/dist/src/cache/generic.d.ts +1 -3
  12. package/dist/src/cache/invite.js.map +1 -1
  13. package/dist/src/db/lucene.js.map +1 -1
  14. package/dist/src/db/searchIndexes/searchIndexes.js +2 -2
  15. package/dist/src/db/searchIndexes/searchIndexes.js.map +1 -1
  16. package/dist/src/docUpdates/index.js +2 -2
  17. package/dist/src/docUpdates/index.js.map +1 -1
  18. package/dist/src/events/processors/AuditLogsProcessor.d.ts +3 -3
  19. package/dist/src/events/processors/AuditLogsProcessor.js +2 -2
  20. package/dist/src/events/processors/AuditLogsProcessor.js.map +1 -1
  21. package/dist/src/events/processors/LoggingProcessor.d.ts +3 -3
  22. package/dist/src/events/processors/LoggingProcessor.js +3 -3
  23. package/dist/src/events/processors/LoggingProcessor.js.map +1 -1
  24. package/dist/src/events/processors/async/DocumentUpdateProcessor.d.ts +1 -1
  25. package/dist/src/events/processors/async/DocumentUpdateProcessor.js +1 -1
  26. package/dist/src/events/processors/async/DocumentUpdateProcessor.js.map +1 -1
  27. package/dist/src/middleware/matchers.js +1 -1
  28. package/dist/src/middleware/matchers.js.map +1 -1
  29. package/dist/src/middleware/passport/sso/sso.js +1 -1
  30. package/dist/src/middleware/passport/sso/sso.js.map +1 -1
  31. package/dist/src/migrations/migrations.js +0 -4
  32. package/dist/src/migrations/migrations.js.map +1 -1
  33. package/dist/src/queue/inMemoryQueue.d.ts +2 -2
  34. package/dist/src/queue/inMemoryQueue.js +1 -1
  35. package/dist/src/queue/inMemoryQueue.js.map +1 -1
  36. package/dist/src/queue/listeners.js +1 -1
  37. package/dist/src/queue/listeners.js.map +1 -1
  38. package/dist/src/redis/init.js +2 -0
  39. package/dist/src/redis/init.js.map +1 -1
  40. package/dist/src/security/permissions.d.ts +1 -1
  41. package/package.json +4 -4
  42. package/src/auth/auth.ts +4 -2
  43. package/src/cache/base/index.ts +1 -1
  44. package/src/cache/invite.ts +1 -1
  45. package/src/cache/writethrough.ts +1 -1
  46. package/src/db/lucene.ts +0 -4
  47. package/src/db/searchIndexes/searchIndexes.ts +2 -2
  48. package/src/docUpdates/index.ts +2 -7
  49. package/src/events/processors/AuditLogsProcessor.ts +2 -3
  50. package/src/events/processors/LoggingProcessor.ts +3 -4
  51. package/src/events/processors/async/DocumentUpdateProcessor.ts +1 -6
  52. package/src/middleware/matchers.ts +1 -1
  53. package/src/middleware/passport/datasource/google.ts +1 -1
  54. package/src/middleware/passport/sso/sso.ts +2 -5
  55. package/src/migrations/migrations.ts +0 -4
  56. package/src/objectStore/buckets/tests/app.spec.ts +3 -3
  57. package/src/platform/tests/tenants.spec.ts +1 -1
  58. package/src/queue/inMemoryQueue.ts +2 -2
  59. package/src/queue/listeners.ts +1 -1
  60. package/src/redis/init.ts +1 -0
  61. package/src/redis/tests/redis.spec.ts +1 -1
  62. package/src/users/test/utils.spec.ts +1 -1
package/dist/index.js CHANGED
@@ -54923,7 +54923,7 @@ function isAdmin(user) {
54923
54923
  function isAdminOrBuilder(user, appId) {
54924
54924
  return isBuilder(user, appId) || isAdmin(user);
54925
54925
  }
54926
- function isAdminOrGlobalBuilder(user, appId) {
54926
+ function isAdminOrGlobalBuilder(user) {
54927
54927
  return isGlobalBuilder(user) || isAdmin(user);
54928
54928
  }
54929
54929
  function hasAppBuilderPermissions(user) {
@@ -58840,6 +58840,8 @@ async function shutdown() {
58840
58840
  await passwordResetClient.finish();
58841
58841
  if (socketClient)
58842
58842
  await socketClient.finish();
58843
+ if (docWritethroughClient)
58844
+ await docWritethroughClient.finish();
58843
58845
  }
58844
58846
  process.on("exit", async () => {
58845
58847
  await shutdown();
@@ -59001,7 +59003,7 @@ var BaseCache = class {
59001
59003
  throw err;
59002
59004
  }
59003
59005
  }
59004
- async bustCache(key, opts = { client: null }) {
59006
+ async bustCache(key) {
59005
59007
  const client = await this.getClient();
59006
59008
  try {
59007
59009
  await client.delete(generateTenantKey(key));
@@ -59476,13 +59478,13 @@ function validEmail(value) {
59476
59478
  }
59477
59479
 
59478
59480
  // src/utils/Duration.ts
59479
- var DurationType = /* @__PURE__ */ ((DurationType3) => {
59480
- DurationType3["MILLISECONDS"] = "milliseconds";
59481
- DurationType3["SECONDS"] = "seconds";
59482
- DurationType3["MINUTES"] = "minutes";
59483
- DurationType3["HOURS"] = "hours";
59484
- DurationType3["DAYS"] = "days";
59485
- return DurationType3;
59481
+ var DurationType = /* @__PURE__ */ ((DurationType2) => {
59482
+ DurationType2["MILLISECONDS"] = "milliseconds";
59483
+ DurationType2["SECONDS"] = "seconds";
59484
+ DurationType2["MINUTES"] = "minutes";
59485
+ DurationType2["HOURS"] = "hours";
59486
+ DurationType2["DAYS"] = "days";
59487
+ return DurationType2;
59486
59488
  })(DurationType || {});
59487
59489
  var conversion = {
59488
59490
  milliseconds: 1,
@@ -60842,19 +60844,19 @@ var AnalyticsProcessor = class {
60842
60844
  // src/events/processors/LoggingProcessor.ts
60843
60845
  var skipLogging = environment_default.SELF_HOSTED && !environment_default.isDev();
60844
60846
  var LoggingProcessor = class {
60845
- async processEvent(event, identity, properties, timestamp) {
60847
+ async processEvent(event, identity, properties) {
60846
60848
  if (skipLogging) {
60847
60849
  return;
60848
60850
  }
60849
60851
  console.log(`[audit] [identityType=${identity.type}] ${event}`, properties);
60850
60852
  }
60851
- async identify(identity, timestamp) {
60853
+ async identify(identity) {
60852
60854
  if (skipLogging) {
60853
60855
  return;
60854
60856
  }
60855
60857
  console.log(`[audit] identified`, identity);
60856
60858
  }
60857
- async identifyGroup(group, timestamp) {
60859
+ async identifyGroup(group) {
60858
60860
  if (skipLogging) {
60859
60861
  return;
60860
60862
  }
@@ -60996,7 +60998,7 @@ var InMemoryQueue = class {
60996
60998
  async getRepeatableJobs() {
60997
60999
  return [];
60998
61000
  }
60999
- // eslint-disable-next-line no-unused-vars
61001
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
61000
61002
  async removeJobs(pattern) {
61001
61003
  }
61002
61004
  /**
@@ -61107,7 +61109,7 @@ function logging(queue, jobQueue) {
61107
61109
  if (process.env.NODE_DEBUG?.includes("bull")) {
61108
61110
  queue.on("waiting" /* WAITING */, (jobId) => {
61109
61111
  console.info(...getLogParams(eventType, "waiting" /* WAITING */, { jobId }));
61110
- }).on("active" /* ACTIVE */, async (job, jobPromise) => {
61112
+ }).on("active" /* ACTIVE */, async (job) => {
61111
61113
  await doInJobContext(job, () => {
61112
61114
  console.info(...getLogParams(eventType, "active" /* ACTIVE */, { job }));
61113
61115
  });
@@ -61260,9 +61262,9 @@ var AuditLogsProcessor = class _AuditLogsProcessor {
61260
61262
  });
61261
61263
  }
61262
61264
  }
61263
- async identify(identity, timestamp) {
61265
+ async identify() {
61264
61266
  }
61265
- async identifyGroup(group, timestamp) {
61267
+ async identifyGroup() {
61266
61268
  }
61267
61269
  shutdown() {
61268
61270
  _AuditLogsProcessor.auditLogQueue?.close();
@@ -64390,10 +64392,6 @@ var backPopulateMigrations = async (opts) => {
64390
64392
  };
64391
64393
  var runMigration = async (migration, options2 = {}) => {
64392
64394
  const migrationType = migration.type;
64393
- let tenantId;
64394
- if (migrationType !== "installation" /* INSTALLATION */) {
64395
- tenantId = getTenantId();
64396
- }
64397
64395
  const migrationName = migration.name;
64398
64396
  const silent = migration.silent;
64399
64397
  const log = (message) => {
@@ -64737,7 +64735,7 @@ __export(google_exports, {
64737
64735
 
64738
64736
  // src/middleware/passport/sso/sso.ts
64739
64737
  var import_node_fetch5 = __toESM(require("node-fetch"));
64740
- var ssoSaveUserNoOp = (user, opts) => Promise.resolve(user);
64738
+ var ssoSaveUserNoOp = (user) => Promise.resolve(user);
64741
64739
  async function authenticate2(details, requireLocalAccount = true, done, saveUserFn) {
64742
64740
  if (!saveUserFn) {
64743
64741
  throw new Error("Save user function must be provided");
@@ -65079,7 +65077,7 @@ var buildMatcherRegex = (patterns) => {
65079
65077
  });
65080
65078
  };
65081
65079
  var matches = (ctx, options2) => {
65082
- return options2.find(({ regex, method, route }) => {
65080
+ return options2.find(({ regex, method }) => {
65083
65081
  const urlMatch = regex.test(ctx.request.url);
65084
65082
  const methodMatch = method === "ALL" ? true : ctx.request.method.toLowerCase() === method.toLowerCase();
65085
65083
  return urlMatch && methodMatch;
@@ -65702,7 +65700,7 @@ async function refreshGoogleAccessToken(config, refreshToken) {
65702
65700
  }
65703
65701
  async function refreshOAuthToken(refreshToken, providerType, configId) {
65704
65702
  switch (providerType) {
65705
- case "oidc" /* OIDC */:
65703
+ case "oidc" /* OIDC */: {
65706
65704
  if (!configId) {
65707
65705
  return { err: { data: "OIDC config id not provided" } };
65708
65706
  }
@@ -65711,12 +65709,14 @@ async function refreshOAuthToken(refreshToken, providerType, configId) {
65711
65709
  return { err: { data: "OIDC configuration not found" } };
65712
65710
  }
65713
65711
  return refreshOIDCAccessToken(oidcConfig, refreshToken);
65714
- case "google" /* GOOGLE */:
65712
+ }
65713
+ case "google" /* GOOGLE */: {
65715
65714
  let googleConfig = await getGoogleConfig();
65716
65715
  if (!googleConfig) {
65717
65716
  return { err: { data: "Google configuration not found" } };
65718
65717
  }
65719
65718
  return refreshGoogleAccessToken(googleConfig, refreshToken);
65719
+ }
65720
65720
  }
65721
65721
  }
65722
65722
  async function updateUserOAuth(userId, oAuthConfig) {
@@ -65998,7 +65998,7 @@ var DocumentUpdateProcessor = class {
65998
65998
  this.processors = [];
65999
65999
  this.processors = processors2;
66000
66000
  }
66001
- async processEvent(event, identity, properties, timestamp) {
66001
+ async processEvent(event, identity, properties) {
66002
66002
  const tenantId = identity.realTenantId;
66003
66003
  const docId = getDocumentId(event, properties);
66004
66004
  if (!tenantId || !docId) {
@@ -66032,13 +66032,8 @@ function init8(processors2) {
66032
66032
  }
66033
66033
  if (!processingPromise) {
66034
66034
  processingPromise = asyncEventQueue.process(async (job) => {
66035
- const { event, identity, properties, timestamp } = job.data;
66036
- await documentProcessor.processEvent(
66037
- event,
66038
- identity,
66039
- properties,
66040
- timestamp
66041
- );
66035
+ const { event, identity, properties } = job.data;
66036
+ await documentProcessor.processEvent(event, identity, properties);
66042
66037
  });
66043
66038
  }
66044
66039
  }