@budibase/server 2.3.18-alpha.15 → 2.3.18-alpha.17

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.
@@ -10,8 +10,8 @@
10
10
  href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap"
11
11
  rel="stylesheet"
12
12
  />
13
- <script type="module" crossorigin src="/builder/assets/index.b0911233.js"></script>
14
- <link rel="stylesheet" href="/builder/assets/index.ca370ee3.css">
13
+ <script type="module" crossorigin src="/builder/assets/index.57df7f7b.js"></script>
14
+ <link rel="stylesheet" href="/builder/assets/index.dc0472d8.css">
15
15
  </head>
16
16
  <body id="app">
17
17
 
@@ -8,14 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  const types_1 = require("@budibase/types");
13
16
  const google_auth_library_1 = require("google-auth-library");
14
17
  const utils_1 = require("./utils");
15
18
  const constants_1 = require("../constants");
16
19
  const google_spreadsheet_1 = require("google-spreadsheet");
20
+ const node_fetch_1 = __importDefault(require("node-fetch"));
17
21
  const backend_core_1 = require("@budibase/backend-core");
18
- const fetch = require("node-fetch");
19
22
  const SCHEMA = {
20
23
  plus: true,
21
24
  auth: {
@@ -116,7 +119,7 @@ class GoogleSheetsIntegration {
116
119
  }
117
120
  fetchAccessToken(payload) {
118
121
  return __awaiter(this, void 0, void 0, function* () {
119
- const response = yield fetch("https://www.googleapis.com/oauth2/v4/token", {
122
+ const response = yield (0, node_fetch_1.default)("https://www.googleapis.com/oauth2/v4/token", {
120
123
  method: "POST",
121
124
  body: JSON.stringify(Object.assign(Object.assign({}, payload), { grant_type: "refresh_token" })),
122
125
  headers: {
@@ -163,7 +166,7 @@ class GoogleSheetsIntegration {
163
166
  buildSchema(datasourceId) {
164
167
  return __awaiter(this, void 0, void 0, function* () {
165
168
  yield this.connect();
166
- const sheets = yield this.client.sheetsByIndex;
169
+ const sheets = this.client.sheetsByIndex;
167
170
  const tables = {};
168
171
  for (let sheet of sheets) {
169
172
  // must fetch rows to determine schema
@@ -244,7 +247,7 @@ class GoogleSheetsIntegration {
244
247
  return __awaiter(this, void 0, void 0, function* () {
245
248
  try {
246
249
  yield this.connect();
247
- const sheet = yield this.client.sheetsByTitle[table.name];
250
+ const sheet = this.client.sheetsByTitle[table.name];
248
251
  yield sheet.loadHeaderRow();
249
252
  if (table._rename) {
250
253
  const headers = [];
@@ -259,8 +262,12 @@ class GoogleSheetsIntegration {
259
262
  yield sheet.setHeaderRow(headers);
260
263
  }
261
264
  else {
262
- let newField = Object.keys(table.schema).find(key => !sheet.headerValues.includes(key));
263
- yield sheet.setHeaderRow([...sheet.headerValues, newField]);
265
+ const updatedHeaderValues = [...sheet.headerValues];
266
+ const newField = Object.keys(table.schema).find(key => !sheet.headerValues.includes(key));
267
+ if (newField) {
268
+ updatedHeaderValues.push(newField);
269
+ }
270
+ yield sheet.setHeaderRow(updatedHeaderValues);
264
271
  }
265
272
  }
266
273
  catch (err) {
@@ -273,7 +280,7 @@ class GoogleSheetsIntegration {
273
280
  return __awaiter(this, void 0, void 0, function* () {
274
281
  try {
275
282
  yield this.connect();
276
- const sheetToDelete = yield this.client.sheetsByTitle[sheet];
283
+ const sheetToDelete = this.client.sheetsByTitle[sheet];
277
284
  return yield sheetToDelete.delete();
278
285
  }
279
286
  catch (err) {
@@ -286,7 +293,7 @@ class GoogleSheetsIntegration {
286
293
  return __awaiter(this, void 0, void 0, function* () {
287
294
  try {
288
295
  yield this.connect();
289
- const sheet = yield this.client.sheetsByTitle[query.sheet];
296
+ const sheet = this.client.sheetsByTitle[query.sheet];
290
297
  const rowToInsert = typeof query.row === "string" ? JSON.parse(query.row) : query.row;
291
298
  const row = yield sheet.addRow(rowToInsert);
292
299
  return [
@@ -303,7 +310,7 @@ class GoogleSheetsIntegration {
303
310
  return __awaiter(this, void 0, void 0, function* () {
304
311
  try {
305
312
  yield this.connect();
306
- const sheet = yield this.client.sheetsByTitle[query.sheet];
313
+ const sheet = this.client.sheetsByTitle[query.sheet];
307
314
  const rows = yield sheet.getRows();
308
315
  const headerValues = sheet.headerValues;
309
316
  const response = [];
@@ -322,7 +329,7 @@ class GoogleSheetsIntegration {
322
329
  return __awaiter(this, void 0, void 0, function* () {
323
330
  try {
324
331
  yield this.connect();
325
- const sheet = yield this.client.sheetsByTitle[query.sheet];
332
+ const sheet = this.client.sheetsByTitle[query.sheet];
326
333
  const rows = yield sheet.getRows();
327
334
  const row = rows[query.rowIndex];
328
335
  if (row) {
@@ -348,7 +355,7 @@ class GoogleSheetsIntegration {
348
355
  delete(query) {
349
356
  return __awaiter(this, void 0, void 0, function* () {
350
357
  yield this.connect();
351
- const sheet = yield this.client.sheetsByTitle[query.sheet];
358
+ const sheet = this.client.sheetsByTitle[query.sheet];
352
359
  const rows = yield sheet.getRows();
353
360
  const row = rows[query.rowIndex];
354
361
  if (row) {
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/server",
3
3
  "email": "hi@budibase.com",
4
- "version": "2.3.18-alpha.14",
4
+ "version": "2.3.18-alpha.16",
5
5
  "description": "Budibase Web Server",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -43,11 +43,11 @@
43
43
  "license": "GPL-3.0",
44
44
  "dependencies": {
45
45
  "@apidevtools/swagger-parser": "10.0.3",
46
- "@budibase/backend-core": "2.3.18-alpha.14",
47
- "@budibase/client": "2.3.18-alpha.14",
48
- "@budibase/pro": "2.3.18-alpha.14",
49
- "@budibase/string-templates": "2.3.18-alpha.14",
50
- "@budibase/types": "2.3.18-alpha.14",
46
+ "@budibase/backend-core": "2.3.18-alpha.16",
47
+ "@budibase/client": "2.3.18-alpha.16",
48
+ "@budibase/pro": "2.3.18-alpha.16",
49
+ "@budibase/string-templates": "2.3.18-alpha.16",
50
+ "@budibase/types": "2.3.18-alpha.16",
51
51
  "@bull-board/api": "3.7.0",
52
52
  "@bull-board/koa": "3.9.4",
53
53
  "@elastic/elasticsearch": "7.10.0",