@budibase/server 2.6.19-alpha.37 → 2.6.19-alpha.39

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/dist/index.js CHANGED
@@ -763,6 +763,12 @@ var init_cli = __esm({
763
763
  }
764
764
  });
765
765
 
766
+ // ../types/src/sdk/websocket.ts
767
+ var init_websocket = __esm({
768
+ "../types/src/sdk/websocket.ts"() {
769
+ }
770
+ });
771
+
766
772
  // ../types/src/sdk/index.ts
767
773
  var init_sdk = __esm({
768
774
  "../types/src/sdk/index.ts"() {
@@ -785,6 +791,7 @@ var init_sdk = __esm({
785
791
  init_sso();
786
792
  init_user2();
787
793
  init_cli();
794
+ init_websocket();
788
795
  }
789
796
  });
790
797
 
@@ -2649,7 +2656,7 @@ var init_utils2 = __esm({
2649
2656
  })(Databases || {});
2650
2657
  SelectableDatabase = /* @__PURE__ */ ((SelectableDatabase2) => {
2651
2658
  SelectableDatabase2[SelectableDatabase2["DEFAULT"] = 0] = "DEFAULT";
2652
- SelectableDatabase2[SelectableDatabase2["WRITE_THROUGH"] = 1] = "WRITE_THROUGH";
2659
+ SelectableDatabase2[SelectableDatabase2["SOCKET_IO"] = 1] = "SOCKET_IO";
2653
2660
  SelectableDatabase2[SelectableDatabase2["UNUSED_1"] = 2] = "UNUSED_1";
2654
2661
  SelectableDatabase2[SelectableDatabase2["UNUSED_2"] = 3] = "UNUSED_2";
2655
2662
  SelectableDatabase2[SelectableDatabase2["UNUSED_3"] = 4] = "UNUSED_3";
@@ -2846,6 +2853,9 @@ var init_redis = __esm({
2846
2853
  CLOSED = false;
2847
2854
  init2(this._select);
2848
2855
  await waitForConnection(this._select);
2856
+ if (this._select && !environment_default.isTest()) {
2857
+ this.getClient().select(this._select);
2858
+ }
2849
2859
  return this;
2850
2860
  }
2851
2861
  async finish() {
@@ -2868,6 +2878,10 @@ var init_redis = __esm({
2868
2878
  const db2 = this._db;
2869
2879
  return this.getClient().keys(addDbPrefix(db2, pattern));
2870
2880
  }
2881
+ async exists(key) {
2882
+ const db2 = this._db;
2883
+ return await this.getClient().exists(addDbPrefix(db2, key));
2884
+ }
2871
2885
  async get(key) {
2872
2886
  const db2 = this._db;
2873
2887
  let response2 = await this.getClient().get(addDbPrefix(db2, key));
@@ -2948,6 +2962,7 @@ __export(init_exports, {
2948
2962
  getCacheClient: () => getCacheClient,
2949
2963
  getLockClient: () => getLockClient,
2950
2964
  getSessionClient: () => getSessionClient,
2965
+ getSocketClient: () => getSocketClient,
2951
2966
  getUserClient: () => getUserClient,
2952
2967
  getWritethroughClient: () => getWritethroughClient,
2953
2968
  shutdown: () => shutdown
@@ -2958,9 +2973,10 @@ async function init3() {
2958
2973
  appClient = await new redis_default("appMetadata" /* APP_METADATA */).init();
2959
2974
  cacheClient = await new redis_default("data_cache" /* GENERIC_CACHE */).init();
2960
2975
  lockClient = await new redis_default("locks" /* LOCKS */).init();
2961
- writethroughClient = await new redis_default(
2962
- "writeThrough" /* WRITE_THROUGH */,
2963
- 1 /* WRITE_THROUGH */
2976
+ writethroughClient = await new redis_default("writeThrough" /* WRITE_THROUGH */).init();
2977
+ socketClient = await new redis_default(
2978
+ "socket_io" /* SOCKET_IO */,
2979
+ 1 /* SOCKET_IO */
2964
2980
  ).init();
2965
2981
  }
2966
2982
  async function shutdown() {
@@ -2976,6 +2992,8 @@ async function shutdown() {
2976
2992
  await writethroughClient.finish();
2977
2993
  if (lockClient)
2978
2994
  await lockClient.finish();
2995
+ if (socketClient)
2996
+ await socketClient.finish();
2979
2997
  }
2980
2998
  async function getUserClient() {
2981
2999
  if (!userClient) {
@@ -3013,7 +3031,13 @@ async function getLockClient() {
3013
3031
  }
3014
3032
  return lockClient;
3015
3033
  }
3016
- var userClient, sessionClient, appClient, cacheClient, writethroughClient, lockClient;
3034
+ async function getSocketClient() {
3035
+ if (!socketClient) {
3036
+ await init3();
3037
+ }
3038
+ return socketClient;
3039
+ }
3040
+ var userClient, sessionClient, appClient, cacheClient, writethroughClient, lockClient, socketClient;
3017
3041
  var init_init = __esm({
3018
3042
  "../backend-core/src/redis/init.ts"() {
3019
3043
  init_redis();
@@ -19578,7 +19602,7 @@ var init_users9 = __esm({
19578
19602
  });
19579
19603
 
19580
19604
  // ../shared-core/src/constants.ts
19581
- var OperatorOptions, SqlNumberTypeRangeMap;
19605
+ var OperatorOptions, SqlNumberTypeRangeMap, SocketSessionTTL;
19582
19606
  var init_constants6 = __esm({
19583
19607
  "../shared-core/src/constants.ts"() {
19584
19608
  OperatorOptions = {
@@ -19649,6 +19673,7 @@ var init_constants6 = __esm({
19649
19673
  min: -8388608
19650
19674
  }
19651
19675
  };
19676
+ SocketSessionTTL = 60;
19652
19677
  }
19653
19678
  });
19654
19679
 
@@ -21783,22 +21808,20 @@ async function init17() {
21783
21808
  devAppClient = new redis_exports.Client(redis_exports.utils.Databases.DEV_LOCKS);
21784
21809
  debounceClient = new redis_exports.Client(redis_exports.utils.Databases.DEBOUNCE);
21785
21810
  flagClient = new redis_exports.Client(redis_exports.utils.Databases.FLAGS);
21786
- socketClient = new redis_exports.Client(redis_exports.utils.Databases.SOCKET_IO);
21787
21811
  await devAppClient.init();
21788
21812
  await debounceClient.init();
21789
21813
  await flagClient.init();
21790
- await socketClient.init();
21791
- socketSubClient = socketClient.getClient().duplicate();
21814
+ socketClient2 = await redis_exports.clients.getSocketClient();
21815
+ socketSubClient = socketClient2.getClient().duplicate();
21792
21816
  }
21793
21817
  async function shutdown6() {
21818
+ console.log("REDIS SHUTDOWN");
21794
21819
  if (devAppClient)
21795
21820
  await devAppClient.finish();
21796
21821
  if (debounceClient)
21797
21822
  await debounceClient.finish();
21798
21823
  if (flagClient)
21799
21824
  await flagClient.finish();
21800
- if (socketClient)
21801
- await socketClient.finish();
21802
21825
  if (socketSubClient)
21803
21826
  socketSubClient.disconnect();
21804
21827
  await redis_exports.clients.shutdown();
@@ -21855,11 +21878,11 @@ async function clearTestFlag(id) {
21855
21878
  }
21856
21879
  function getSocketPubSubClients() {
21857
21880
  return {
21858
- pub: socketClient.getClient(),
21881
+ pub: socketClient2.getClient(),
21859
21882
  sub: socketSubClient
21860
21883
  };
21861
21884
  }
21862
- var APP_DEV_LOCK_SECONDS, AUTOMATION_TEST_FLAG_SECONDS, devAppClient, debounceClient, flagClient, socketClient, socketSubClient;
21885
+ var APP_DEV_LOCK_SECONDS, AUTOMATION_TEST_FLAG_SECONDS, devAppClient, debounceClient, flagClient, socketClient2, socketSubClient;
21863
21886
  var init_redis4 = __esm({
21864
21887
  "src/utilities/redis.ts"() {
21865
21888
  init_src2();
@@ -31046,8 +31069,8 @@ var init_file = __esm({
31046
31069
  });
31047
31070
 
31048
31071
  // src/websockets/websocket.ts
31049
- var import_socket, import_http, import_cookies, import_koa_useragent, import_redis_adapter, import_uuid4, Socket;
31050
- var init_websocket = __esm({
31072
+ var import_socket, import_http, import_cookies, import_koa_useragent, import_redis_adapter, BaseSocket;
31073
+ var init_websocket2 = __esm({
31051
31074
  "src/websockets/websocket.ts"() {
31052
31075
  import_socket = require("socket.io");
31053
31076
  import_http = __toESM(require("http"));
@@ -31057,9 +31080,10 @@ var init_websocket = __esm({
31057
31080
  init_currentapp();
31058
31081
  import_redis_adapter = require("@socket.io/redis-adapter");
31059
31082
  init_redis4();
31060
- import_uuid4 = __toESM(require("uuid"));
31061
- Socket = class {
31083
+ init_src3();
31084
+ BaseSocket = class {
31062
31085
  constructor(app2, server2, path5 = "/", additionalMiddlewares) {
31086
+ this.path = path5;
31063
31087
  this.io = new import_socket.Server(server2, {
31064
31088
  path: path5
31065
31089
  });
@@ -31095,14 +31119,13 @@ var init_websocket = __esm({
31095
31119
  await middleware2(ctx, () => {
31096
31120
  if (idx === middlewares.length - 1) {
31097
31121
  const { _id, email, firstName, lastName } = ctx.user;
31098
- socket.data.user = {
31122
+ socket.data = {
31099
31123
  _id,
31100
31124
  email,
31101
31125
  firstName,
31102
31126
  lastName,
31103
- sessionId: import_uuid4.default.v4()
31127
+ sessionId: socket.id
31104
31128
  };
31105
- socket.data.appId = ctx.appId;
31106
31129
  next();
31107
31130
  }
31108
31131
  });
@@ -31111,9 +31134,141 @@ var init_websocket = __esm({
31111
31134
  next(error2);
31112
31135
  }
31113
31136
  });
31137
+ this.initialise().then(() => {
31138
+ this.io.on("connection", async (socket) => {
31139
+ socket.on("Heartbeat" /* Heartbeat */, async () => {
31140
+ console.log(socket.data.email, "heartbeat received");
31141
+ await this.extendSessionTTL(socket.data.sessionId);
31142
+ });
31143
+ socket.on("disconnect", async () => {
31144
+ await this.onDisconnect(socket);
31145
+ await this.leaveRoom(socket);
31146
+ });
31147
+ await this.onConnect(socket);
31148
+ });
31149
+ });
31150
+ }
31151
+ async initialise() {
31114
31152
  const { pub, sub } = getSocketPubSubClients();
31115
- const opts = { key: `socket.io-${path5}` };
31153
+ const opts = {
31154
+ key: `${redis_exports.utils.Databases.SOCKET_IO}-${this.path}-pubsub`
31155
+ };
31116
31156
  this.io.adapter((0, import_redis_adapter.createAdapter)(pub, sub, opts));
31157
+ this.redisClient = await redis_exports.clients.getSocketClient();
31158
+ }
31159
+ // Gets the redis key for a certain session ID
31160
+ getSessionKey(sessionId) {
31161
+ return `${this.path}-session:${sessionId}`;
31162
+ }
31163
+ // Gets the redis key for certain room name
31164
+ getRoomKey(room) {
31165
+ return `${this.path}-room:${room}`;
31166
+ }
31167
+ async extendSessionTTL(sessionId) {
31168
+ var _a2;
31169
+ const key = this.getSessionKey(sessionId);
31170
+ await ((_a2 = this.redisClient) == null ? void 0 : _a2.setExpiry(key, SocketSessionTTL));
31171
+ }
31172
+ // Gets an array of all redis keys of users inside a certain room
31173
+ async getRoomSessionIds(room) {
31174
+ var _a2;
31175
+ const keys2 = await ((_a2 = this.redisClient) == null ? void 0 : _a2.get(this.getRoomKey(room)));
31176
+ return keys2 || [];
31177
+ }
31178
+ // Sets the list of redis keys for users inside a certain room.
31179
+ // There is no TTL on the actual room key map itself.
31180
+ async setRoomSessionIds(room, ids) {
31181
+ var _a2;
31182
+ await ((_a2 = this.redisClient) == null ? void 0 : _a2.store(this.getRoomKey(room), ids));
31183
+ }
31184
+ // Gets a list of all users inside a certain room
31185
+ async getRoomSessions(room) {
31186
+ var _a2;
31187
+ if (room) {
31188
+ const sessionIds = await this.getRoomSessionIds(room);
31189
+ const keys2 = sessionIds.map(this.getSessionKey.bind(this));
31190
+ const sessions = await ((_a2 = this.redisClient) == null ? void 0 : _a2.bulkGet(keys2));
31191
+ return Object.values(sessions || {});
31192
+ } else {
31193
+ return [];
31194
+ }
31195
+ }
31196
+ // Detects keys which have been pruned from redis due to TTL expiry in a certain
31197
+ // room and broadcasts disconnection messages to ensure clients are aware
31198
+ async pruneRoom(room) {
31199
+ const sessionIds = await this.getRoomSessionIds(room);
31200
+ const sessionsExist = await Promise.all(
31201
+ sessionIds.map((id) => {
31202
+ var _a2;
31203
+ return (_a2 = this.redisClient) == null ? void 0 : _a2.exists(this.getSessionKey(id));
31204
+ })
31205
+ );
31206
+ const prunedSessionIds = sessionIds.filter((id, idx) => {
31207
+ if (!sessionsExist[idx]) {
31208
+ this.io.to(room).emit("UserDisconnect" /* UserDisconnect */, sessionIds[idx]);
31209
+ return false;
31210
+ }
31211
+ return true;
31212
+ });
31213
+ await this.setRoomSessionIds(room, prunedSessionIds);
31214
+ }
31215
+ // Adds a user to a certain room
31216
+ async joinRoom(socket, room) {
31217
+ var _a2;
31218
+ if (!room) {
31219
+ return;
31220
+ }
31221
+ await this.pruneRoom(room);
31222
+ const oldRoom = socket.data.room;
31223
+ if (oldRoom && oldRoom !== room) {
31224
+ await this.leaveRoom(socket);
31225
+ }
31226
+ if (!oldRoom || oldRoom !== room) {
31227
+ socket.join(room);
31228
+ socket.data.room = room;
31229
+ }
31230
+ let user2 = socket.data;
31231
+ const { sessionId } = user2;
31232
+ const key = this.getSessionKey(sessionId);
31233
+ await ((_a2 = this.redisClient) == null ? void 0 : _a2.store(key, user2, SocketSessionTTL));
31234
+ const sessionIds = await this.getRoomSessionIds(room);
31235
+ if (!sessionIds.includes(sessionId)) {
31236
+ await this.setRoomSessionIds(room, [...sessionIds, sessionId]);
31237
+ }
31238
+ socket.to(room).emit("UserUpdate" /* UserUpdate */, user2);
31239
+ }
31240
+ // Disconnects a socket from its current room
31241
+ async leaveRoom(socket) {
31242
+ var _a2;
31243
+ let user2 = socket.data;
31244
+ const { room, sessionId } = user2;
31245
+ if (!room) {
31246
+ return;
31247
+ }
31248
+ socket.leave(room);
31249
+ socket.data.room = void 0;
31250
+ const key = this.getSessionKey(sessionId);
31251
+ await ((_a2 = this.redisClient) == null ? void 0 : _a2.delete(key));
31252
+ const sessionIds = await this.getRoomSessionIds(room);
31253
+ await this.setRoomSessionIds(
31254
+ room,
31255
+ sessionIds.filter((id) => id !== sessionId)
31256
+ );
31257
+ socket.to(room).emit("UserDisconnect" /* UserDisconnect */, sessionId);
31258
+ }
31259
+ // Updates a connected user's metadata, assuming a room change is not required.
31260
+ async updateUser(socket, patch4) {
31261
+ socket.data = {
31262
+ ...socket.data,
31263
+ ...patch4
31264
+ };
31265
+ if (socket.data.room) {
31266
+ await this.joinRoom(socket, socket.data.room);
31267
+ }
31268
+ }
31269
+ async onConnect(socket) {
31270
+ }
31271
+ async onDisconnect(socket) {
31117
31272
  }
31118
31273
  // Emit an event to all sockets
31119
31274
  emit(event, payload) {
@@ -31127,10 +31282,10 @@ var init_websocket = __esm({
31127
31282
  var ClientAppWebsocket;
31128
31283
  var init_client2 = __esm({
31129
31284
  "src/websockets/client.ts"() {
31130
- init_websocket();
31285
+ init_websocket2();
31131
31286
  init_authorized();
31132
31287
  init_src2();
31133
- ClientAppWebsocket = class extends Socket {
31288
+ ClientAppWebsocket = class extends BaseSocket {
31134
31289
  constructor(app2, server2) {
31135
31290
  super(app2, server2, "/socket/client", [authorized_default(permissions_exports.BUILDER)]);
31136
31291
  }
@@ -31447,54 +31602,37 @@ var GridSocket;
31447
31602
  var init_grid = __esm({
31448
31603
  "src/websockets/grid.ts"() {
31449
31604
  init_authorized();
31450
- init_websocket();
31605
+ init_websocket2();
31451
31606
  init_src2();
31452
31607
  init_utils24();
31453
- GridSocket = class extends Socket {
31608
+ init_src3();
31609
+ GridSocket = class extends BaseSocket {
31454
31610
  constructor(app2, server2) {
31455
31611
  super(app2, server2, "/socket/grid", [authorized_default(permissions_exports.BUILDER)]);
31456
- this.io.on("connection", (socket) => {
31457
- const user2 = socket.data.user;
31458
- let currentRoom;
31459
- socket.on("select-table", async (tableId, callback) => {
31460
- if (currentRoom) {
31461
- socket.to(currentRoom).emit("user-disconnect", user2);
31462
- socket.leave(currentRoom);
31463
- }
31464
- currentRoom = tableId;
31465
- socket.join(currentRoom);
31466
- socket.to(currentRoom).emit("user-update", user2);
31467
- const sockets = await this.io.in(currentRoom).fetchSockets();
31468
- callback({
31469
- users: sockets.map((socket2) => socket2.data.user)
31470
- });
31471
- });
31472
- socket.on("select-cell", (cellId) => {
31473
- socket.data.user.focusedCellId = cellId;
31474
- if (currentRoom) {
31475
- socket.to(currentRoom).emit("user-update", user2);
31476
- }
31477
- });
31478
- socket.on("disconnect", () => {
31479
- if (currentRoom) {
31480
- socket.to(currentRoom).emit("user-disconnect", user2);
31481
- }
31482
- });
31612
+ }
31613
+ async onConnect(socket) {
31614
+ socket.on("SelectTable" /* SelectTable */, async (tableId, callback) => {
31615
+ await this.joinRoom(socket, tableId);
31616
+ const sessions = await this.getRoomSessions(tableId);
31617
+ callback({ users: sessions });
31618
+ });
31619
+ socket.on("SelectCell" /* SelectCell */, (cellId) => {
31620
+ this.updateUser(socket, { focusedCellId: cellId });
31483
31621
  });
31484
31622
  }
31485
31623
  emitRowUpdate(ctx, row2) {
31486
31624
  const tableId = getTableId(ctx);
31487
- this.io.in(tableId).emit("row-change", { id: row2._id, row: row2 });
31625
+ this.io.in(tableId).emit("RowChange" /* RowChange */, { id: row2._id, row: row2 });
31488
31626
  }
31489
31627
  emitRowDeletion(ctx, id) {
31490
31628
  const tableId = getTableId(ctx);
31491
- this.io.in(tableId).emit("row-change", { id, row: null });
31629
+ this.io.in(tableId).emit("RowChange" /* RowChange */, { id, row: null });
31492
31630
  }
31493
31631
  emitTableUpdate(table2) {
31494
- this.io.in(table2._id).emit("table-change", { id: table2._id, table: table2 });
31632
+ this.io.in(table2._id).emit("TableChange" /* TableChange */, { id: table2._id, table: table2 });
31495
31633
  }
31496
31634
  emitTableDeletion(id) {
31497
- this.io.in(id).emit("table-change", { id, table: null });
31635
+ this.io.in(id).emit("TableChange" /* TableChange */, { id, table: null });
31498
31636
  }
31499
31637
  };
31500
31638
  }
@@ -31505,53 +31643,53 @@ var BuilderSocket;
31505
31643
  var init_builder2 = __esm({
31506
31644
  "src/websockets/builder.ts"() {
31507
31645
  init_authorized();
31508
- init_websocket();
31646
+ init_websocket2();
31509
31647
  init_src2();
31510
31648
  init_websockets();
31511
31649
  init_redis4();
31512
- BuilderSocket = class extends Socket {
31650
+ init_src3();
31651
+ BuilderSocket = class extends BaseSocket {
31513
31652
  constructor(app2, server2) {
31514
31653
  super(app2, server2, "/socket/builder", [authorized_default(permissions_exports.BUILDER)]);
31515
- this.io.on("connection", (socket) => {
31516
- const user2 = socket.data.user;
31517
- const appId = socket.data.appId;
31518
- socket.join(appId);
31519
- socket.to(appId).emit("user-update", user2);
31520
- socket.on("get-users", async (payload, callback) => {
31521
- const sockets = await this.io.in(appId).fetchSockets();
31522
- callback({
31523
- users: sockets.map((socket2) => socket2.data.user)
31524
- });
31525
- });
31526
- socket.on("disconnect", async () => {
31527
- socket.to(appId).emit("user-disconnect", user2);
31528
- try {
31529
- const sockets = await this.io.in(appId).fetchSockets();
31530
- const hasOtherConnection = sockets.some((socket2) => {
31531
- const { _id, sessionId } = socket2.data.user;
31532
- return _id === user2._id && sessionId !== user2.sessionId;
31533
- });
31534
- if (!hasOtherConnection) {
31535
- await clearLock(appId, user2);
31536
- }
31537
- } catch (e) {
31538
- }
31539
- });
31654
+ }
31655
+ async onConnect(socket) {
31656
+ socket.on("SelectApp" /* SelectApp */, async (appId, callback) => {
31657
+ await this.joinRoom(socket, appId);
31658
+ const sessions = await this.getRoomSessions(appId);
31659
+ callback({ users: sessions });
31540
31660
  });
31541
31661
  }
31662
+ async onDisconnect(socket) {
31663
+ try {
31664
+ const session = socket.data;
31665
+ const { _id, sessionId, room } = session;
31666
+ const sessions = await this.getRoomSessions(room);
31667
+ const hasOtherSession = sessions.some((otherSession) => {
31668
+ return _id === otherSession._id && sessionId !== otherSession.sessionId;
31669
+ });
31670
+ if (!hasOtherSession && room) {
31671
+ const user2 = { _id: socket.data._id };
31672
+ await clearLock(room, user2);
31673
+ }
31674
+ } catch (e) {
31675
+ }
31676
+ }
31542
31677
  emitTableUpdate(ctx, table2) {
31543
- this.io.in(ctx.appId).emit("table-change", { id: table2._id, table: table2 });
31678
+ this.io.in(ctx.appId).emit("TableChange" /* TableChange */, { id: table2._id, table: table2 });
31544
31679
  gridSocket.emitTableUpdate(table2);
31545
31680
  }
31546
31681
  emitTableDeletion(ctx, id) {
31547
- this.io.in(ctx.appId).emit("table-change", { id, table: null });
31682
+ this.io.in(ctx.appId).emit("TableChange" /* TableChange */, { id, table: null });
31548
31683
  gridSocket.emitTableDeletion(id);
31549
31684
  }
31550
31685
  emitDatasourceUpdate(ctx, datasource2) {
31551
- this.io.in(ctx.appId).emit("datasource-change", { id: datasource2._id, datasource: datasource2 });
31686
+ this.io.in(ctx.appId).emit("DatasourceChange" /* DatasourceChange */, {
31687
+ id: datasource2._id,
31688
+ datasource: datasource2
31689
+ });
31552
31690
  }
31553
31691
  emitDatasourceDeletion(ctx, id) {
31554
- this.io.in(ctx.appId).emit("datasource-change", { id, datasource: null });
31692
+ this.io.in(ctx.appId).emit("DatasourceChange" /* DatasourceChange */, { id, datasource: null });
31555
31693
  }
31556
31694
  };
31557
31695
  }
@@ -42981,7 +43119,7 @@ async function prepareUpload({ s3Key, bucket, metadata, file }) {
42981
43119
  key: response2.Key
42982
43120
  };
42983
43121
  }
42984
- var import_string_templates10, import_aws_sdk4, import_fs15, uuid6, send2, toggleBetaUiFeature, serveBuilder, uploadFile, deleteObjects, serveApp, serveBuilderPreview, serveClientLibrary, getSignedUploadURL;
43122
+ var import_string_templates10, import_aws_sdk4, import_fs15, uuid5, send2, toggleBetaUiFeature, serveBuilder, uploadFile, deleteObjects, serveApp, serveBuilderPreview, serveClientLibrary, getSignedUploadURL;
42985
43123
  var init_static = __esm({
42986
43124
  "src/api/controllers/static/index.ts"() {
42987
43125
  init_centralPath();
@@ -42996,7 +43134,7 @@ var init_static = __esm({
42996
43134
  init_sdk3();
42997
43135
  init_src4();
42998
43136
  require("svelte/register");
42999
- uuid6 = require("uuid");
43137
+ uuid5 = require("uuid");
43000
43138
  send2 = require("koa-send");
43001
43139
  toggleBetaUiFeature = async function(ctx) {
43002
43140
  const cookieName = `beta:${ctx.params.feature}`;
@@ -43028,7 +43166,7 @@ var init_static = __esm({
43028
43166
  let files = ctx.request.files.file.length > 1 ? Array.from(ctx.request.files.file) : [ctx.request.files.file];
43029
43167
  const uploads = files.map(async (file) => {
43030
43168
  const fileExtension = [...file.name.split(".")].pop();
43031
- const processedFileName = `${uuid6.v4()}.${fileExtension}`;
43169
+ const processedFileName = `${uuid5.v4()}.${fileExtension}`;
43032
43170
  return prepareUpload({
43033
43171
  file,
43034
43172
  s3Key: `${context_exports.getProdAppId()}/attachments/${processedFileName}`,