@budibase/server 1.0.212-alpha.14 → 1.0.212-alpha.15

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 (166) hide show
  1. package/builder/assets/{index.1f366fcc.js → index.83448a6c.js} +1 -1
  2. package/builder/index.html +1 -1
  3. package/coverage/clover.xml +115 -97
  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 +19 -19
  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/threads/automation.js.html +1 -1
  134. package/coverage/lcov-report/threads/index.html +19 -19
  135. package/coverage/lcov-report/threads/query.js.html +147 -18
  136. package/coverage/lcov-report/threads/utils.js.html +1 -1
  137. package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
  138. package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
  139. package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
  140. package/coverage/lcov-report/utilities/global.js.html +1 -1
  141. package/coverage/lcov-report/utilities/index.html +1 -1
  142. package/coverage/lcov-report/utilities/index.js.html +1 -1
  143. package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
  144. package/coverage/lcov-report/utilities/queue/index.html +1 -1
  145. package/coverage/lcov-report/utilities/routing/index.html +1 -1
  146. package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
  147. package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
  148. package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
  149. package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
  150. package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
  151. package/coverage/lcov-report/utilities/security.js.html +1 -1
  152. package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
  153. package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
  154. package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
  155. package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
  156. package/coverage/lcov-report/utilities/users.js.html +1 -1
  157. package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
  158. package/coverage/lcov.info +188 -154
  159. package/dist/api/controllers/query/index.js +19 -0
  160. package/dist/package.json +6 -6
  161. package/dist/threads/query.js +35 -5
  162. package/dist/tsconfig.build.tsbuildinfo +1 -1
  163. package/package.json +7 -7
  164. package/src/api/controllers/query/index.ts +23 -1
  165. package/src/module.d.ts +1 -0
  166. package/src/threads/query.js +50 -7
@@ -7091,19 +7091,20 @@ BRH:20
7091
7091
  end_of_record
7092
7092
  TN:
7093
7093
  SF:src/threads/query.js
7094
- FN:14,(anonymous_0)
7095
- FN:33,(anonymous_1)
7096
- FN:42,(anonymous_2)
7097
- FN:124,(anonymous_3)
7098
- FN:125,(anonymous_4)
7099
- FN:138,(anonymous_5)
7100
- FN:154,(anonymous_6)
7101
- FN:172,(anonymous_7)
7102
- FN:187,(anonymous_8)
7103
- FN:196,(anonymous_9)
7104
- FN:218,(anonymous_10)
7105
- FN:219,(anonymous_11)
7106
- FNF:12
7094
+ FN:20,(anonymous_0)
7095
+ FN:40,(anonymous_1)
7096
+ FN:50,(anonymous_2)
7097
+ FN:142,(anonymous_3)
7098
+ FN:143,(anonymous_4)
7099
+ FN:156,(anonymous_5)
7100
+ FN:172,(anonymous_6)
7101
+ FN:197,(anonymous_7)
7102
+ FN:215,(anonymous_8)
7103
+ FN:230,(anonymous_9)
7104
+ FN:239,(anonymous_10)
7105
+ FN:261,(anonymous_11)
7106
+ FN:262,(anonymous_12)
7107
+ FNF:13
7107
7108
  FNH:10
7108
7109
  FNDA:22,(anonymous_0)
7109
7110
  FNDA:23,(anonymous_1)
@@ -7111,171 +7112,204 @@ FNDA:0,(anonymous_2)
7111
7112
  FNDA:20,(anonymous_3)
7112
7113
  FNDA:0,(anonymous_4)
7113
7114
  FNDA:5,(anonymous_5)
7114
- FNDA:6,(anonymous_6)
7115
- FNDA:21,(anonymous_7)
7116
- FNDA:6,(anonymous_8)
7115
+ FNDA:0,(anonymous_6)
7116
+ FNDA:6,(anonymous_7)
7117
+ FNDA:21,(anonymous_8)
7117
7118
  FNDA:6,(anonymous_9)
7118
- FNDA:17,(anonymous_10)
7119
+ FNDA:6,(anonymous_10)
7119
7120
  FNDA:17,(anonymous_11)
7121
+ FNDA:17,(anonymous_12)
7120
7122
  DA:1,2
7121
7123
  DA:2,2
7122
7124
  DA:3,2
7123
7125
  DA:4,2
7124
7126
  DA:5,2
7125
7127
  DA:6,2
7126
- DA:7,2
7128
+ DA:10,2
7127
7129
  DA:11,2
7128
- DA:15,22
7129
- DA:16,22
7130
- DA:17,22
7131
- DA:18,22
7132
- DA:19,22
7133
- DA:20,22
7130
+ DA:13,2
7131
+ DA:17,2
7134
7132
  DA:21,22
7135
7133
  DA:22,22
7136
7134
  DA:23,22
7135
+ DA:24,22
7137
7136
  DA:25,22
7137
+ DA:26,22
7138
+ DA:27,22
7139
+ DA:28,22
7138
7140
  DA:29,22
7139
- DA:30,22
7140
- DA:34,23
7141
- DA:35,23
7142
- DA:36,23
7143
- DA:37,2
7144
- DA:40,21
7145
- DA:41,0
7146
- DA:43,0
7141
+ DA:31,22
7142
+ DA:35,22
7143
+ DA:36,22
7144
+ DA:37,22
7145
+ DA:41,23
7146
+ DA:43,23
7147
+ DA:44,23
7148
+ DA:45,2
7147
7149
  DA:48,21
7148
- DA:51,21
7149
- DA:55,21
7150
+ DA:49,0
7151
+ DA:51,0
7150
7152
  DA:56,21
7151
7153
  DA:59,21
7152
- DA:60,1
7153
- DA:68,21
7154
- DA:69,2
7155
- DA:71,19
7156
- DA:75,21
7157
- DA:76,0
7158
- DA:79,21
7159
- DA:80,21
7160
- DA:81,21
7161
- DA:82,21
7154
+ DA:63,21
7155
+ DA:64,21
7156
+ DA:67,21
7157
+ DA:68,1
7158
+ DA:76,21
7159
+ DA:77,2
7160
+ DA:79,19
7162
7161
  DA:83,21
7163
- DA:84,21
7164
- DA:85,19
7165
- DA:86,19
7166
- DA:87,19
7167
- DA:88,19
7162
+ DA:84,0
7163
+ DA:87,21
7164
+ DA:88,21
7165
+ DA:89,21
7166
+ DA:90,21
7167
+ DA:91,21
7168
7168
  DA:92,21
7169
- DA:93,0
7170
- DA:97,0
7171
- DA:101,21
7172
- DA:107,1
7173
- DA:109,1
7169
+ DA:93,19
7170
+ DA:94,19
7171
+ DA:95,19
7172
+ DA:96,19
7173
+ DA:100,21
7174
+ DA:101,0
7175
+ DA:105,0
7176
+ DA:109,21
7174
7177
  DA:110,1
7175
- DA:114,20
7176
- DA:115,0
7177
- DA:119,20
7178
- DA:120,18
7179
- DA:124,20
7180
- DA:125,0
7181
- DA:129,20
7182
- DA:131,20
7183
- DA:132,0
7184
- DA:135,20
7185
- DA:139,5
7186
- DA:140,5
7187
- DA:141,5
7188
- DA:142,5
7189
- DA:155,6
7190
- DA:156,6
7191
- DA:157,6
7192
- DA:158,6
7193
- DA:159,6
7178
+ DA:116,0
7179
+ DA:117,0
7180
+ DA:119,0
7181
+ DA:122,0
7182
+ DA:126,1
7183
+ DA:127,1
7184
+ DA:128,1
7185
+ DA:132,20
7186
+ DA:133,0
7187
+ DA:137,20
7188
+ DA:138,18
7189
+ DA:142,20
7190
+ DA:143,0
7191
+ DA:147,20
7192
+ DA:149,20
7193
+ DA:150,0
7194
+ DA:153,20
7195
+ DA:157,5
7196
+ DA:158,5
7197
+ DA:159,5
7194
7198
  DA:160,5
7195
- DA:164,5
7196
- DA:165,5
7197
- DA:167,1
7198
- DA:169,6
7199
- DA:173,21
7200
- DA:174,21
7201
- DA:175,0
7202
- DA:177,21
7203
- DA:178,21
7204
- DA:179,21
7205
- DA:180,2
7206
- DA:181,2
7207
- DA:184,21
7208
- DA:186,16
7209
- DA:187,16
7210
- DA:189,6
7199
+ DA:173,0
7200
+ DA:174,0
7201
+ DA:176,0
7202
+ DA:177,0
7203
+ DA:178,0
7204
+ DA:181,0
7205
+ DA:189,0
7211
7206
  DA:190,0
7212
- DA:193,6
7213
- DA:194,6
7214
- DA:196,16
7215
- DA:197,16
7216
- DA:198,16
7207
+ DA:191,0
7208
+ DA:194,0
7209
+ DA:198,6
7217
7210
  DA:199,6
7218
7211
  DA:200,6
7219
- DA:211,6
7220
- DA:214,21
7221
- DA:218,2
7222
- DA:219,17
7223
- DA:220,17
7224
- DA:221,17
7225
- DA:222,17
7226
- DA:223,15
7227
- DA:225,2
7228
- LF:108
7229
- LH:98
7230
- BRDA:14,0,0,17
7231
- BRDA:36,1,0,2
7232
- BRDA:36,1,1,21
7233
- BRDA:40,2,0,0
7234
- BRDA:40,2,1,21
7235
- BRDA:59,3,0,1
7236
- BRDA:59,3,1,20
7237
- BRDA:68,4,0,2
7238
- BRDA:68,4,1,19
7239
- BRDA:75,5,0,0
7240
- BRDA:75,5,1,21
7241
- BRDA:84,6,0,19
7242
- BRDA:84,6,1,2
7243
- BRDA:92,7,0,0
7244
- BRDA:92,7,1,21
7245
- BRDA:101,8,0,1
7246
- BRDA:101,8,1,20
7247
- BRDA:102,9,0,21
7248
- BRDA:102,9,1,19
7249
- BRDA:102,9,2,1
7250
- BRDA:102,9,3,1
7251
- BRDA:114,10,0,0
7252
- BRDA:114,10,1,20
7253
- BRDA:119,11,0,18
7254
- BRDA:119,11,1,2
7255
- BRDA:124,12,0,0
7256
- BRDA:124,12,1,20
7257
- BRDA:131,13,0,0
7258
- BRDA:131,13,1,20
7259
- BRDA:159,14,0,5
7260
- BRDA:159,14,1,1
7261
- BRDA:160,15,0,0
7262
- BRDA:160,15,1,5
7263
- BRDA:174,16,0,0
7264
- BRDA:174,16,1,21
7265
- BRDA:174,17,0,21
7266
- BRDA:174,17,1,21
7267
- BRDA:177,18,0,21
7268
- BRDA:177,18,1,20
7269
- BRDA:178,19,0,21
7270
- BRDA:178,19,1,10
7271
- BRDA:180,20,0,2
7272
- BRDA:180,20,1,0
7273
- BRDA:184,21,0,16
7274
- BRDA:184,21,1,5
7275
- BRDA:189,22,0,0
7276
- BRDA:189,22,1,6
7277
- BRF:47
7278
- BRH:37
7212
+ DA:201,6
7213
+ DA:202,6
7214
+ DA:203,5
7215
+ DA:207,5
7216
+ DA:208,5
7217
+ DA:210,1
7218
+ DA:212,6
7219
+ DA:216,21
7220
+ DA:217,21
7221
+ DA:218,0
7222
+ DA:220,21
7223
+ DA:221,21
7224
+ DA:222,21
7225
+ DA:223,2
7226
+ DA:224,2
7227
+ DA:227,21
7228
+ DA:229,16
7229
+ DA:230,16
7230
+ DA:232,6
7231
+ DA:233,0
7232
+ DA:236,6
7233
+ DA:237,6
7234
+ DA:239,16
7235
+ DA:240,16
7236
+ DA:241,16
7237
+ DA:242,6
7238
+ DA:243,6
7239
+ DA:254,6
7240
+ DA:257,21
7241
+ DA:261,2
7242
+ DA:262,17
7243
+ DA:263,17
7244
+ DA:264,17
7245
+ DA:265,17
7246
+ DA:266,15
7247
+ DA:268,2
7248
+ LF:126
7249
+ LH:102
7250
+ BRDA:20,0,0,17
7251
+ BRDA:44,1,0,2
7252
+ BRDA:44,1,1,21
7253
+ BRDA:48,2,0,0
7254
+ BRDA:48,2,1,21
7255
+ BRDA:67,3,0,1
7256
+ BRDA:67,3,1,20
7257
+ BRDA:76,4,0,2
7258
+ BRDA:76,4,1,19
7259
+ BRDA:83,5,0,0
7260
+ BRDA:83,5,1,21
7261
+ BRDA:92,6,0,19
7262
+ BRDA:92,6,1,2
7263
+ BRDA:100,7,0,0
7264
+ BRDA:100,7,1,21
7265
+ BRDA:109,8,0,1
7266
+ BRDA:109,8,1,20
7267
+ BRDA:109,9,0,21
7268
+ BRDA:109,9,1,19
7269
+ BRDA:109,9,2,1
7270
+ BRDA:110,10,0,0
7271
+ BRDA:110,10,1,1
7272
+ BRDA:111,11,0,1
7273
+ BRDA:111,11,1,0
7274
+ BRDA:111,11,2,0
7275
+ BRDA:119,12,0,0
7276
+ BRDA:119,12,1,0
7277
+ BRDA:119,13,0,0
7278
+ BRDA:119,13,1,0
7279
+ BRDA:132,14,0,0
7280
+ BRDA:132,14,1,20
7281
+ BRDA:137,15,0,18
7282
+ BRDA:137,15,1,2
7283
+ BRDA:142,16,0,0
7284
+ BRDA:142,16,1,20
7285
+ BRDA:149,17,0,0
7286
+ BRDA:149,17,1,20
7287
+ BRDA:176,18,0,0
7288
+ BRDA:176,18,1,0
7289
+ BRDA:176,19,0,0
7290
+ BRDA:176,19,1,0
7291
+ BRDA:189,20,0,0
7292
+ BRDA:189,20,1,0
7293
+ BRDA:202,21,0,5
7294
+ BRDA:202,21,1,1
7295
+ BRDA:203,22,0,0
7296
+ BRDA:203,22,1,5
7297
+ BRDA:217,23,0,0
7298
+ BRDA:217,23,1,21
7299
+ BRDA:217,24,0,21
7300
+ BRDA:217,24,1,21
7301
+ BRDA:220,25,0,21
7302
+ BRDA:220,25,1,20
7303
+ BRDA:221,26,0,21
7304
+ BRDA:221,26,1,10
7305
+ BRDA:223,27,0,2
7306
+ BRDA:223,27,1,0
7307
+ BRDA:227,28,0,16
7308
+ BRDA:227,28,1,5
7309
+ BRDA:232,29,0,0
7310
+ BRDA:232,29,1,6
7311
+ BRF:61
7312
+ BRH:38
7279
7313
  end_of_record
7280
7314
  TN:
7281
7315
  SF:src/threads/utils.js
@@ -20,6 +20,8 @@ const environment_1 = require("../../../environment");
20
20
  const context_1 = require("@budibase/backend-core/context");
21
21
  const pro_1 = require("@budibase/pro");
22
22
  const backend_core_1 = require("@budibase/backend-core");
23
+ const utils_3 = require("@budibase/backend-core/utils");
24
+ const constants_2 = require("@budibase/backend-core/constants");
23
25
  const Runner = new threads_1.Thread(threads_1.ThreadType.QUERY, {
24
26
  timeoutMs: environment_1.QUERY_THREAD_TIMEOUT || 10000,
25
27
  });
@@ -111,6 +113,19 @@ function find(ctx) {
111
113
  });
112
114
  }
113
115
  exports.find = find;
116
+ //Required to discern between OIDC OAuth config entries
117
+ function getOAuthConfigCookieId(ctx) {
118
+ if (ctx.user.providerType === constants_2.Configs.OIDC) {
119
+ return (0, utils_3.getCookie)(ctx, constants_2.Cookies.OIDC_CONFIG);
120
+ }
121
+ }
122
+ function getAuthConfig(ctx) {
123
+ const authCookie = (0, utils_3.getCookie)(ctx, constants_2.Cookies.Auth);
124
+ let authConfigCtx = {};
125
+ authConfigCtx["configId"] = getOAuthConfigCookieId(ctx);
126
+ authConfigCtx["sessionId"] = authCookie ? authCookie.sessionId : null;
127
+ return authConfigCtx;
128
+ }
114
129
  function preview(ctx) {
115
130
  return __awaiter(this, void 0, void 0, function* () {
116
131
  const db = (0, context_1.getAppDB)();
@@ -119,6 +134,7 @@ function preview(ctx) {
119
134
  // preview may not have a queryId as it hasn't been saved, but if it does
120
135
  // this stops dynamic variables from calling the same query
121
136
  const { fields, parameters, queryVerb, transformer, queryId } = query;
137
+ const authConfigCtx = getAuthConfig(ctx);
122
138
  try {
123
139
  const runFn = () => Runner.run({
124
140
  appId: ctx.appId,
@@ -130,6 +146,7 @@ function preview(ctx) {
130
146
  queryId,
131
147
  ctx: {
132
148
  user: ctx.user,
149
+ auth: Object.assign({}, authConfigCtx),
133
150
  },
134
151
  });
135
152
  const { rows, keys, info, extra } = yield pro_1.quotas.addQuery(runFn);
@@ -152,6 +169,7 @@ function execute(ctx, opts = { rowsOnly: false }) {
152
169
  const db = (0, context_1.getAppDB)();
153
170
  const query = yield db.get(ctx.params.queryId);
154
171
  const datasource = yield db.get(query.datasourceId);
172
+ const authConfigCtx = getAuthConfig(ctx);
155
173
  const enrichedParameters = ctx.request.body.parameters || {};
156
174
  // make sure parameters are fully enriched with defaults
157
175
  if (query && query.parameters) {
@@ -174,6 +192,7 @@ function execute(ctx, opts = { rowsOnly: false }) {
174
192
  queryId: ctx.params.queryId,
175
193
  ctx: {
176
194
  user: ctx.user,
195
+ auth: Object.assign({}, authConfigCtx),
177
196
  },
178
197
  });
179
198
  const { rows, pagination, extra } = yield pro_1.quotas.addQuery(runFn);
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/server",
3
3
  "email": "hi@budibase.com",
4
- "version": "1.0.212-alpha.13",
4
+ "version": "1.0.212-alpha.14",
5
5
  "description": "Budibase Web Server",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -77,11 +77,11 @@
77
77
  "license": "GPL-3.0",
78
78
  "dependencies": {
79
79
  "@apidevtools/swagger-parser": "10.0.3",
80
- "@budibase/backend-core": "^1.0.212-alpha.13",
81
- "@budibase/client": "^1.0.212-alpha.13",
82
- "@budibase/pro": "1.0.212-alpha.13",
83
- "@budibase/string-templates": "^1.0.212-alpha.13",
84
- "@budibase/types": "^1.0.212-alpha.13",
80
+ "@budibase/backend-core": "^1.0.212-alpha.14",
81
+ "@budibase/client": "^1.0.212-alpha.14",
82
+ "@budibase/pro": "1.0.212-alpha.14",
83
+ "@budibase/string-templates": "^1.0.212-alpha.14",
84
+ "@budibase/types": "^1.0.212-alpha.14",
85
85
  "@bull-board/api": "3.7.0",
86
86
  "@bull-board/koa": "3.9.4",
87
87
  "@elastic/elasticsearch": "7.10.0",
@@ -14,6 +14,8 @@ const ScriptRunner = require("../utilities/scriptRunner");
14
14
  const { integrations } = require("../integrations");
15
15
  const { processStringSync } = require("@budibase/string-templates");
16
16
  const { doInAppContext, getAppDB } = require("@budibase/backend-core/context");
17
+ const { refreshOAuthToken, updateUserOAuth, } = require("@budibase/backend-core/auth");
18
+ const { getGlobalIDFromUserMetadataID } = require("../db/utils");
17
19
  const { isSQL } = require("../integrations/utils");
18
20
  const { enrichQueryFields, interpolateSQL, } = require("../integrations/queries/sql");
19
21
  class QueryRunner {
@@ -34,8 +36,10 @@ class QueryRunner {
34
36
  // it can be
35
37
  this.queryResponse = {};
36
38
  this.hasRerun = false;
39
+ this.hasRefreshedOAuth = false;
37
40
  }
38
41
  execute() {
42
+ var _a;
39
43
  return __awaiter(this, void 0, void 0, function* () {
40
44
  let { datasource, fields, queryVerb, transformer } = this;
41
45
  const Integration = integrations[datasource.source];
@@ -87,12 +91,20 @@ class QueryRunner {
87
91
  rows = runner.execute();
88
92
  }
89
93
  // if the request fails we retry once, invalidating the cached value
90
- if (info &&
91
- info.code >= 400 &&
92
- this.cachedVariables.length > 0 &&
93
- !this.hasRerun) {
94
+ if (info && info.code >= 400 && !this.hasRerun) {
95
+ if (((_a = this.ctx.user) === null || _a === void 0 ? void 0 : _a.provider) &&
96
+ info.code === 401 &&
97
+ !this.hasRefreshedOAuth) {
98
+ // Attempt to refresh the access token from the provider
99
+ this.hasRefreshedOAuth = true;
100
+ const authResponse = yield this.refreshOAuth2(this.ctx);
101
+ if (!authResponse || authResponse.err) {
102
+ // In this event the user may have oAuth issues that
103
+ // could require re-authenticating with their provider.
104
+ throw new Error("OAuth2 access token could not be refreshed");
105
+ }
106
+ }
94
107
  this.hasRerun = true;
95
- // invalidate the cache value
96
108
  yield threadUtils.invalidateDynamicVariables(this.cachedVariables);
97
109
  return this.execute();
98
110
  }
@@ -130,6 +142,24 @@ class QueryRunner {
130
142
  }, { noRecursiveQuery: true }).execute();
131
143
  });
132
144
  }
145
+ refreshOAuth2(ctx) {
146
+ return __awaiter(this, void 0, void 0, function* () {
147
+ const { oauth2, providerType, _id } = ctx.user;
148
+ const { configId } = ctx.auth;
149
+ if (!providerType || !(oauth2 === null || oauth2 === void 0 ? void 0 : oauth2.refreshToken)) {
150
+ console.error("No refresh token found for authenticated user");
151
+ return;
152
+ }
153
+ const resp = yield refreshOAuthToken(oauth2.refreshToken, providerType, configId);
154
+ // Refresh session flow. Should be in same location as refreshOAuthToken
155
+ // There are several other properties available in 'resp'
156
+ if (!resp.error) {
157
+ const globalUserId = getGlobalIDFromUserMetadataID(_id);
158
+ yield updateUserOAuth(globalUserId, resp);
159
+ }
160
+ return resp;
161
+ });
162
+ }
133
163
  getDynamicVariable(variable) {
134
164
  return __awaiter(this, void 0, void 0, function* () {
135
165
  let { parameters } = this;