@budibase/server 1.3.19-alpha.3 → 1.3.19-alpha.4

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 (168) hide show
  1. package/builder/assets/{index.c361a9cc.js → index.79081ecb.js} +1 -1
  2. package/builder/index.html +1 -1
  3. package/coverage/clover.xml +8 -5
  4. package/coverage/coverage-final.json +1 -1
  5. package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
  6. package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
  7. package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
  8. package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
  9. package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
  10. package/coverage/lcov-report/api/controllers/component.js.html +1 -1
  11. package/coverage/lcov-report/api/controllers/datasource.js.html +1 -1
  12. package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
  13. package/coverage/lcov-report/api/controllers/index.html +1 -1
  14. package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
  15. package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
  16. package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
  17. package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
  18. package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
  19. package/coverage/lcov-report/api/controllers/query/index.html +1 -1
  20. package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
  21. package/coverage/lcov-report/api/controllers/role.js.html +1 -1
  22. package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
  23. package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
  24. package/coverage/lcov-report/api/controllers/row/index.html +1 -1
  25. package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
  26. package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
  27. package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
  28. package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
  29. package/coverage/lcov-report/api/controllers/screen.js.html +1 -1
  30. package/coverage/lcov-report/api/controllers/script.js.html +1 -1
  31. package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
  32. package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
  33. package/coverage/lcov-report/api/controllers/table/index.html +1 -1
  34. package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
  35. package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
  36. package/coverage/lcov-report/api/controllers/user.js.html +1 -1
  37. package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
  38. package/coverage/lcov-report/api/controllers/view/index.html +1 -1
  39. package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
  40. package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
  41. package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
  42. package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
  43. package/coverage/lcov-report/api/index.html +1 -1
  44. package/coverage/lcov-report/api/index.js.html +1 -1
  45. package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
  46. package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
  47. package/coverage/lcov-report/api/routes/auth.js.html +1 -1
  48. package/coverage/lcov-report/api/routes/automation.js.html +1 -1
  49. package/coverage/lcov-report/api/routes/backup.js.html +1 -1
  50. package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
  51. package/coverage/lcov-report/api/routes/component.js.html +1 -1
  52. package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
  53. package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
  54. package/coverage/lcov-report/api/routes/dev.js.html +1 -1
  55. package/coverage/lcov-report/api/routes/index.html +1 -1
  56. package/coverage/lcov-report/api/routes/integration.js.html +1 -1
  57. package/coverage/lcov-report/api/routes/layout.js.html +1 -1
  58. package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
  59. package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
  60. package/coverage/lcov-report/api/routes/permission.js.html +1 -1
  61. package/coverage/lcov-report/api/routes/query.js.html +1 -1
  62. package/coverage/lcov-report/api/routes/role.js.html +1 -1
  63. package/coverage/lcov-report/api/routes/routing.js.html +1 -1
  64. package/coverage/lcov-report/api/routes/screen.js.html +1 -1
  65. package/coverage/lcov-report/api/routes/script.js.html +1 -1
  66. package/coverage/lcov-report/api/routes/table.js.html +1 -1
  67. package/coverage/lcov-report/api/routes/templates.js.html +1 -1
  68. package/coverage/lcov-report/api/routes/user.js.html +1 -1
  69. package/coverage/lcov-report/api/routes/utils/index.html +1 -1
  70. package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
  71. package/coverage/lcov-report/api/routes/view.js.html +1 -1
  72. package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
  73. package/coverage/lcov-report/automations/actions.js.html +1 -1
  74. package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
  75. package/coverage/lcov-report/automations/bullboard.js.html +1 -1
  76. package/coverage/lcov-report/automations/index.html +1 -1
  77. package/coverage/lcov-report/automations/index.js.html +1 -1
  78. package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
  79. package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
  80. package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
  81. package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
  82. package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
  83. package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
  84. package/coverage/lcov-report/automations/steps/index.html +1 -1
  85. package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
  86. package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
  87. package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
  88. package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
  89. package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
  90. package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
  91. package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
  92. package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
  93. package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
  94. package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
  95. package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
  96. package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
  97. package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
  98. package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
  99. package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
  100. package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
  101. package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
  102. package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
  103. package/coverage/lcov-report/automations/triggers.js.html +1 -1
  104. package/coverage/lcov-report/constants/index.html +1 -1
  105. package/coverage/lcov-report/constants/index.js.html +1 -1
  106. package/coverage/lcov-report/constants/layouts.js.html +1 -1
  107. package/coverage/lcov-report/constants/screens.js.html +1 -1
  108. package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
  109. package/coverage/lcov-report/db/index.html +1 -1
  110. package/coverage/lcov-report/db/index.js.html +1 -1
  111. package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
  112. package/coverage/lcov-report/db/linkedRows/index.html +1 -1
  113. package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
  114. package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
  115. package/coverage/lcov-report/db/newid.js.html +1 -1
  116. package/coverage/lcov-report/db/utils.js.html +1 -1
  117. package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
  118. package/coverage/lcov-report/events/index.html +1 -1
  119. package/coverage/lcov-report/events/index.js.html +1 -1
  120. package/coverage/lcov-report/events/utils.js.html +1 -1
  121. package/coverage/lcov-report/index.html +14 -14
  122. package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
  123. package/coverage/lcov-report/integrations/tests/index.html +1 -1
  124. package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
  125. package/coverage/lcov-report/middleware/builder.js.html +1 -1
  126. package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
  127. package/coverage/lcov-report/middleware/index.html +1 -1
  128. package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
  129. package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
  130. package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
  131. package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
  132. package/coverage/lcov-report/middleware/utils.js.html +1 -1
  133. package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
  134. package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
  135. package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
  136. package/coverage/lcov-report/utilities/global.js.html +1 -1
  137. package/coverage/lcov-report/utilities/index.html +15 -15
  138. package/coverage/lcov-report/utilities/index.js.html +1 -1
  139. package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
  140. package/coverage/lcov-report/utilities/queue/index.html +1 -1
  141. package/coverage/lcov-report/utilities/routing/index.html +1 -1
  142. package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
  143. package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
  144. package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
  145. package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
  146. package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
  147. package/coverage/lcov-report/utilities/security.js.html +1 -1
  148. package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
  149. package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
  150. package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
  151. package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
  152. package/coverage/lcov-report/utilities/users.js.html +1 -1
  153. package/coverage/lcov-report/utilities/workerRequests.js.html +32 -8
  154. package/coverage/lcov.info +8 -3
  155. package/dist/api/routes/public/rows.js +1 -82
  156. package/dist/app.js +5 -1
  157. package/dist/package.json +6 -6
  158. package/dist/tsconfig.build.tsbuildinfo +1 -1
  159. package/dist/utilities/workerRequests.js +4 -0
  160. package/package.json +7 -7
  161. package/specs/openapi.json +112 -109
  162. package/specs/openapi.yaml +93 -91
  163. package/specs/resources/misc.js +116 -0
  164. package/src/api/controllers/public/mapping/types.ts +8 -0
  165. package/src/api/routes/public/rows.ts +1 -82
  166. package/src/app.ts +11 -2
  167. package/src/definitions/openapi.ts +53 -52
  168. package/src/utilities/workerRequests.js +8 -0
@@ -143,88 +143,7 @@ read.push(new Endpoint("get", "/tables/:tableId/rows/:rowId", controller.read))
143
143
  * content:
144
144
  * application/json:
145
145
  * schema:
146
- * type: object
147
- * required:
148
- * - query
149
- * properties:
150
- * query:
151
- * type: object
152
- * properties:
153
- * allOr:
154
- * type: boolean
155
- * description: Specifies that a row should be returned if it satisfies
156
- * any of the specified options, rather than requiring it to fulfill all
157
- * the search parameters. This defaults to false, meaning AND logic will be used.
158
- * string:
159
- * type: object
160
- * example:
161
- * columnName1: value
162
- * columnName2: value
163
- * description: A map of field name to the string to search for,
164
- * this will look for rows that have a value starting with the
165
- * string value.
166
- * additionalProperties:
167
- * type: string
168
- * description: The value to search for in the column.
169
- * fuzzy:
170
- * type: object
171
- * description: A fuzzy search, only supported by internal tables.
172
- * range:
173
- * type: object
174
- * description: Searches within a range, the format of this must be
175
- * in the format of an object with a "low" and "high" property.
176
- * example:
177
- * columnName1: { low: 10, high: 20 }
178
- * equal:
179
- * type: object
180
- * description: Searches for rows that have a column value that is
181
- * exactly the value set.
182
- * notEqual:
183
- * type: object
184
- * description: Searches for any row which does not contain the specified
185
- * column value.
186
- * empty:
187
- * type: object
188
- * description: Searches for rows which do not contain the specified column.
189
- * The object should simply contain keys of the column names, these
190
- * can map to any value.
191
- * example:
192
- * columnName1: ""
193
- * notEmpty:
194
- * type: object
195
- * description: Searches for rows which have the specified column.
196
- * oneOf:
197
- * type: object
198
- * description: Searches for rows which have a column value that is any
199
- * of the specified values. The format of this must be columnName -> [value1, value2].
200
- * paginate:
201
- * type: boolean
202
- * description: Enables pagination, by default this is disabled.
203
- * bookmark:
204
- * oneOf:
205
- * - type: string
206
- * - type: integer
207
- * description: If retrieving another page, the bookmark from the previous request must be supplied.
208
- * limit:
209
- * type: integer
210
- * description: The maximum number of rows to return, useful when paginating, for internal tables this
211
- * will be limited to 1000, for SQL tables it will be 5000.
212
- * sort:
213
- * type: object
214
- * description: A set of parameters describing the sort behaviour of the search.
215
- * properties:
216
- * order:
217
- * type: string
218
- * enum: [ascending, descending]
219
- * description: The order of the sort, by default this is ascending.
220
- * column:
221
- * type: string
222
- * description: The name of the column by which the rows will be sorted.
223
- * type:
224
- * type: string
225
- * enum: [string, number]
226
- * description: Defines whether the column should be treated as a string
227
- * or as numbers when sorting.
146
+ * $ref: '#/components/schemas/rowSearch'
228
147
  * responses:
229
148
  * 200:
230
149
  * description: The response will contain an array of rows that match the search parameters.
package/src/app.ts CHANGED
@@ -30,7 +30,11 @@ const fs = require("fs")
30
30
  import redis from "./utilities/redis"
31
31
  import * as migrations from "./migrations"
32
32
  import { events, installation, tenancy } from "@budibase/backend-core"
33
- import { createAdminUser, getChecklist } from "./utilities/workerRequests"
33
+ import {
34
+ createAdminUser,
35
+ generateApiKey,
36
+ getChecklist,
37
+ } from "./utilities/workerRequests"
34
38
  import { watch } from "./watch"
35
39
  import { initialise as initialiseWebsockets } from "./websocket"
36
40
 
@@ -127,11 +131,16 @@ module.exports = server.listen(env.PORT || 0, async () => {
127
131
  if (!checklist?.adminUser?.checked) {
128
132
  try {
129
133
  const tenantId = tenancy.getTenantId()
130
- await createAdminUser(
134
+ const user = await createAdminUser(
131
135
  env.BB_ADMIN_USER_EMAIL,
132
136
  env.BB_ADMIN_USER_PASSWORD,
133
137
  tenantId
134
138
  )
139
+ // Need to set up an API key for automated integration tests
140
+ if (env.isTest()) {
141
+ await generateApiKey(user._id)
142
+ }
143
+
135
144
  console.log(
136
145
  "Admin account automatically created for",
137
146
  env.BB_ADMIN_USER_EMAIL
@@ -278,58 +278,7 @@ export interface paths {
278
278
  };
279
279
  requestBody: {
280
280
  content: {
281
- "application/json": {
282
- query: {
283
- /** @description Specifies that a row should be returned if it satisfies any of the specified options, rather than requiring it to fulfill all the search parameters. This defaults to false, meaning AND logic will be used. */
284
- allOr?: boolean;
285
- /**
286
- * @description A map of field name to the string to search for, this will look for rows that have a value starting with the string value.
287
- * @example [object Object]
288
- */
289
- string?: { [key: string]: string };
290
- /** @description A fuzzy search, only supported by internal tables. */
291
- fuzzy?: { [key: string]: unknown };
292
- /**
293
- * @description Searches within a range, the format of this must be in the format of an object with a "low" and "high" property.
294
- * @example [object Object]
295
- */
296
- range?: { [key: string]: unknown };
297
- /** @description Searches for rows that have a column value that is exactly the value set. */
298
- equal?: { [key: string]: unknown };
299
- /** @description Searches for any row which does not contain the specified column value. */
300
- notEqual?: { [key: string]: unknown };
301
- /**
302
- * @description Searches for rows which do not contain the specified column. The object should simply contain keys of the column names, these can map to any value.
303
- * @example [object Object]
304
- */
305
- empty?: { [key: string]: unknown };
306
- /** @description Searches for rows which have the specified column. */
307
- notEmpty?: { [key: string]: unknown };
308
- /** @description Searches for rows which have a column value that is any of the specified values. The format of this must be columnName -> [value1, value2]. */
309
- oneOf?: { [key: string]: unknown };
310
- };
311
- /** @description Enables pagination, by default this is disabled. */
312
- paginate?: boolean;
313
- /** @description If retrieving another page, the bookmark from the previous request must be supplied. */
314
- bookmark?: string | number;
315
- /** @description The maximum number of rows to return, useful when paginating, for internal tables this will be limited to 1000, for SQL tables it will be 5000. */
316
- limit?: number;
317
- /** @description A set of parameters describing the sort behaviour of the search. */
318
- sort?: {
319
- /**
320
- * @description The order of the sort, by default this is ascending.
321
- * @enum {string}
322
- */
323
- order?: "ascending" | "descending";
324
- /** @description The name of the column by which the rows will be sorted. */
325
- column?: string;
326
- /**
327
- * @description Defines whether the column should be treated as a string or as numbers when sorting.
328
- * @enum {string}
329
- */
330
- type?: "string" | "number";
331
- };
332
- };
281
+ "application/json": components["schemas"]["rowSearch"];
333
282
  };
334
283
  };
335
284
  };
@@ -1105,6 +1054,58 @@ export interface components {
1105
1054
  _id: string;
1106
1055
  }[];
1107
1056
  };
1057
+ rowSearch: {
1058
+ query: {
1059
+ /** @description Specifies that a row should be returned if it satisfies any of the specified options, rather than requiring it to fulfill all the search parameters. This defaults to false, meaning AND logic will be used. */
1060
+ allOr?: boolean;
1061
+ /**
1062
+ * @description A map of field name to the string to search for, this will look for rows that have a value starting with the string value.
1063
+ * @example [object Object]
1064
+ */
1065
+ string?: { [key: string]: string };
1066
+ /** @description A fuzzy search, only supported by internal tables. */
1067
+ fuzzy?: { [key: string]: unknown };
1068
+ /**
1069
+ * @description Searches within a range, the format of this must be in the format of an object with a "low" and "high" property.
1070
+ * @example [object Object]
1071
+ */
1072
+ range?: { [key: string]: unknown };
1073
+ /** @description Searches for rows that have a column value that is exactly the value set. */
1074
+ equal?: { [key: string]: unknown };
1075
+ /** @description Searches for any row which does not contain the specified column value. */
1076
+ notEqual?: { [key: string]: unknown };
1077
+ /**
1078
+ * @description Searches for rows which do not contain the specified column. The object should simply contain keys of the column names, these can map to any value.
1079
+ * @example [object Object]
1080
+ */
1081
+ empty?: { [key: string]: unknown };
1082
+ /** @description Searches for rows which have the specified column. */
1083
+ notEmpty?: { [key: string]: unknown };
1084
+ /** @description Searches for rows which have a column value that is any of the specified values. The format of this must be columnName -> [value1, value2]. */
1085
+ oneOf?: { [key: string]: unknown };
1086
+ };
1087
+ /** @description Enables pagination, by default this is disabled. */
1088
+ paginate?: boolean;
1089
+ /** @description If retrieving another page, the bookmark from the previous request must be supplied. */
1090
+ bookmark?: string | number;
1091
+ /** @description The maximum number of rows to return, useful when paginating, for internal tables this will be limited to 1000, for SQL tables it will be 5000. */
1092
+ limit?: number;
1093
+ /** @description A set of parameters describing the sort behaviour of the search. */
1094
+ sort?: {
1095
+ /**
1096
+ * @description The order of the sort, by default this is ascending.
1097
+ * @enum {string}
1098
+ */
1099
+ order?: "ascending" | "descending";
1100
+ /** @description The name of the column by which the rows will be sorted. */
1101
+ column?: string;
1102
+ /**
1103
+ * @description Defines whether the column should be treated as a string or as numbers when sorting.
1104
+ * @enum {string}
1105
+ */
1106
+ type?: "string" | "number";
1107
+ };
1108
+ };
1108
1109
  nameSearch: {
1109
1110
  /** @description The name to be used when searching - this will be used in a case insensitive starts with match. */
1110
1111
  name: string;
@@ -153,3 +153,11 @@ exports.getChecklist = async () => {
153
153
  )
154
154
  return checkResponse(response, "get checklist")
155
155
  }
156
+
157
+ exports.generateApiKey = async userId => {
158
+ const response = await fetch(
159
+ checkSlashesInUrl(env.WORKER_URL + "/api/global/self/api_key"),
160
+ request(null, { method: "POST", body: { userId } })
161
+ )
162
+ return checkResponse(response, "generate API key")
163
+ }