@budibase/server 2.6.10 → 2.6.12

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.
@@ -8,7 +8,7 @@
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.15b5f48f.js"></script>
11
+ <script type="module" crossorigin src="/builder/assets/index.a40dcadd.js"></script>
12
12
  <link rel="stylesheet" href="/builder/assets/index.86c992bf.css">
13
13
  </head>
14
14
 
@@ -185,9 +185,12 @@ function destroy(ctx) {
185
185
  exports.destroy = destroy;
186
186
  function bulkImport(ctx) {
187
187
  return __awaiter(this, void 0, void 0, function* () {
188
+ const db = backend_core_1.context.getAppDB();
188
189
  const table = yield sdk_1.default.tables.getTable(ctx.params.tableId);
189
190
  const { rows } = ctx.request.body;
190
191
  yield (0, utils_2.handleDataImport)(ctx.user, table, rows);
192
+ // Ensure auto id and other table updates are persisted
193
+ yield db.put(table);
191
194
  return table;
192
195
  });
193
196
  }
@@ -114,15 +114,15 @@ function importToRows(data, table, user = null) {
114
114
  // the real schema of the table passed in, not the clone used for
115
115
  // incrementing auto IDs
116
116
  for (const [fieldName, schema] of Object.entries(originalTable.schema)) {
117
+ const rowVal = Array.isArray(row[fieldName])
118
+ ? row[fieldName]
119
+ : [row[fieldName]];
117
120
  if ((schema.type === constants_1.FieldTypes.OPTIONS ||
118
121
  schema.type === constants_1.FieldTypes.ARRAY) &&
119
- row[fieldName] &&
120
- (!schema.constraints.inclusion ||
121
- schema.constraints.inclusion.indexOf(row[fieldName]) === -1)) {
122
- schema.constraints.inclusion = [
123
- ...schema.constraints.inclusion,
124
- row[fieldName],
125
- ];
122
+ row[fieldName]) {
123
+ let merged = [...schema.constraints.inclusion, ...rowVal];
124
+ let superSet = new Set(merged);
125
+ schema.constraints.inclusion = Array.from(superSet);
126
126
  schema.constraints.inclusion.sort();
127
127
  }
128
128
  }