@budibase/worker 2.3.18-alpha.9 → 2.3.18

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/coverage/clover.xml +2199 -0
  2. package/coverage/coverage-final.json +84 -0
  3. package/coverage/lcov-report/base.css +224 -0
  4. package/coverage/lcov-report/block-navigation.js +87 -0
  5. package/coverage/lcov-report/favicon.png +0 -0
  6. package/coverage/lcov-report/index.html +431 -0
  7. package/coverage/lcov-report/prettify.css +1 -0
  8. package/coverage/lcov-report/prettify.js +2 -0
  9. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  10. package/coverage/lcov-report/sorter.js +196 -0
  11. package/coverage/lcov-report/src/api/controllers/global/auth.ts.html +934 -0
  12. package/coverage/lcov-report/src/api/controllers/global/configs.ts.html +1348 -0
  13. package/coverage/lcov-report/src/api/controllers/global/email.ts.html +196 -0
  14. package/coverage/lcov-report/src/api/controllers/global/events.ts.html +136 -0
  15. package/coverage/lcov-report/src/api/controllers/global/index.html +251 -0
  16. package/coverage/lcov-report/src/api/controllers/global/license.ts.html +187 -0
  17. package/coverage/lcov-report/src/api/controllers/global/roles.ts.html +283 -0
  18. package/coverage/lcov-report/src/api/controllers/global/self.ts.html +577 -0
  19. package/coverage/lcov-report/src/api/controllers/global/templates.ts.html +316 -0
  20. package/coverage/lcov-report/src/api/controllers/global/users.ts.html +838 -0
  21. package/coverage/lcov-report/src/api/controllers/global/workspaces.ts.html +244 -0
  22. package/coverage/lcov-report/src/api/controllers/system/accounts.ts.html +148 -0
  23. package/coverage/lcov-report/src/api/controllers/system/environment.ts.html +124 -0
  24. package/coverage/lcov-report/src/api/controllers/system/index.html +191 -0
  25. package/coverage/lcov-report/src/api/controllers/system/migrations.ts.html +124 -0
  26. package/coverage/lcov-report/src/api/controllers/system/restore.ts.html +124 -0
  27. package/coverage/lcov-report/src/api/controllers/system/status.ts.html +133 -0
  28. package/coverage/lcov-report/src/api/controllers/system/tenants.ts.html +154 -0
  29. package/coverage/lcov-report/src/api/index.html +116 -0
  30. package/coverage/lcov-report/src/api/index.ts.html +595 -0
  31. package/coverage/lcov-report/src/api/routes/global/auth.ts.html +349 -0
  32. package/coverage/lcov-report/src/api/routes/global/configs.ts.html +457 -0
  33. package/coverage/lcov-report/src/api/routes/global/email.ts.html +193 -0
  34. package/coverage/lcov-report/src/api/routes/global/events.ts.html +109 -0
  35. package/coverage/lcov-report/src/api/routes/global/index.html +251 -0
  36. package/coverage/lcov-report/src/api/routes/global/license.ts.html +124 -0
  37. package/coverage/lcov-report/src/api/routes/global/roles.ts.html +133 -0
  38. package/coverage/lcov-report/src/api/routes/global/self.ts.html +139 -0
  39. package/coverage/lcov-report/src/api/routes/global/templates.ts.html +196 -0
  40. package/coverage/lcov-report/src/api/routes/global/users.ts.html +475 -0
  41. package/coverage/lcov-report/src/api/routes/global/workspaces.ts.html +196 -0
  42. package/coverage/lcov-report/src/api/routes/index.html +116 -0
  43. package/coverage/lcov-report/src/api/routes/index.ts.html +202 -0
  44. package/coverage/lcov-report/src/api/routes/system/accounts.ts.html +142 -0
  45. package/coverage/lcov-report/src/api/routes/system/environment.ts.html +109 -0
  46. package/coverage/lcov-report/src/api/routes/system/index.html +191 -0
  47. package/coverage/lcov-report/src/api/routes/system/migrations.ts.html +142 -0
  48. package/coverage/lcov-report/src/api/routes/system/restore.ts.html +109 -0
  49. package/coverage/lcov-report/src/api/routes/system/status.ts.html +109 -0
  50. package/coverage/lcov-report/src/api/routes/system/tenants.ts.html +124 -0
  51. package/coverage/lcov-report/src/api/routes/validation/index.html +131 -0
  52. package/coverage/lcov-report/src/api/routes/validation/index.ts.html +88 -0
  53. package/coverage/lcov-report/src/api/routes/validation/users.ts.html +235 -0
  54. package/coverage/lcov-report/src/constants/index.html +116 -0
  55. package/coverage/lcov-report/src/constants/index.ts.html +637 -0
  56. package/coverage/lcov-report/src/constants/templates/index.html +116 -0
  57. package/coverage/lcov-report/src/constants/templates/index.ts.html +316 -0
  58. package/coverage/lcov-report/src/db/index.html +116 -0
  59. package/coverage/lcov-report/src/db/index.ts.html +115 -0
  60. package/coverage/lcov-report/src/environment.ts.html +388 -0
  61. package/coverage/lcov-report/src/index.html +131 -0
  62. package/coverage/lcov-report/src/index.ts.html +394 -0
  63. package/coverage/lcov-report/src/middleware/cloudRestricted.ts.html +139 -0
  64. package/coverage/lcov-report/src/middleware/index.html +116 -0
  65. package/coverage/lcov-report/src/migrations/functions/globalInfoSyncUsers.ts.html +145 -0
  66. package/coverage/lcov-report/src/migrations/functions/index.html +116 -0
  67. package/coverage/lcov-report/src/migrations/index.html +116 -0
  68. package/coverage/lcov-report/src/migrations/index.ts.html +271 -0
  69. package/coverage/lcov-report/src/sdk/accounts/accounts.ts.html +262 -0
  70. package/coverage/lcov-report/src/sdk/accounts/index.html +131 -0
  71. package/coverage/lcov-report/src/sdk/accounts/index.ts.html +88 -0
  72. package/coverage/lcov-report/src/sdk/index.html +116 -0
  73. package/coverage/lcov-report/src/sdk/index.ts.html +106 -0
  74. package/coverage/lcov-report/src/sdk/users/events.ts.html +601 -0
  75. package/coverage/lcov-report/src/sdk/users/index.html +146 -0
  76. package/coverage/lcov-report/src/sdk/users/index.ts.html +88 -0
  77. package/coverage/lcov-report/src/sdk/users/users.ts.html +1999 -0
  78. package/coverage/lcov-report/src/tests/TestConfiguration.ts.html +1075 -0
  79. package/coverage/lcov-report/src/tests/api/accounts.ts.html +160 -0
  80. package/coverage/lcov-report/src/tests/api/auth.ts.html +220 -0
  81. package/coverage/lcov-report/src/tests/api/base.ts.html +133 -0
  82. package/coverage/lcov-report/src/tests/api/configs.ts.html +226 -0
  83. package/coverage/lcov-report/src/tests/api/email.ts.html +148 -0
  84. package/coverage/lcov-report/src/tests/api/environment.ts.html +130 -0
  85. package/coverage/lcov-report/src/tests/api/groups.ts.html +163 -0
  86. package/coverage/lcov-report/src/tests/api/index.html +356 -0
  87. package/coverage/lcov-report/src/tests/api/index.ts.html +238 -0
  88. package/coverage/lcov-report/src/tests/api/license.ts.html +136 -0
  89. package/coverage/lcov-report/src/tests/api/migrations.ts.html +151 -0
  90. package/coverage/lcov-report/src/tests/api/restore.ts.html +127 -0
  91. package/coverage/lcov-report/src/tests/api/roles.ts.html +181 -0
  92. package/coverage/lcov-report/src/tests/api/self.ts.html +163 -0
  93. package/coverage/lcov-report/src/tests/api/status.ts.html +121 -0
  94. package/coverage/lcov-report/src/tests/api/templates.ts.html +175 -0
  95. package/coverage/lcov-report/src/tests/api/tenants.ts.html +130 -0
  96. package/coverage/lcov-report/src/tests/api/users.ts.html +514 -0
  97. package/coverage/lcov-report/src/tests/controllers.ts.html +100 -0
  98. package/coverage/lcov-report/src/tests/index.html +146 -0
  99. package/coverage/lcov-report/src/tests/index.ts.html +103 -0
  100. package/coverage/lcov-report/src/tests/mocks/email.ts.html +115 -0
  101. package/coverage/lcov-report/src/tests/mocks/index.html +131 -0
  102. package/coverage/lcov-report/src/tests/mocks/index.ts.html +106 -0
  103. package/coverage/lcov-report/src/tests/structures/configs.ts.html +313 -0
  104. package/coverage/lcov-report/src/tests/structures/groups.ts.html +118 -0
  105. package/coverage/lcov-report/src/tests/structures/index.html +161 -0
  106. package/coverage/lcov-report/src/tests/structures/index.ts.html +151 -0
  107. package/coverage/lcov-report/src/tests/structures/users.ts.html +196 -0
  108. package/coverage/lcov-report/src/utilities/appService.ts.html +208 -0
  109. package/coverage/lcov-report/src/utilities/email.ts.html +850 -0
  110. package/coverage/lcov-report/src/utilities/fileSystem.ts.html +100 -0
  111. package/coverage/lcov-report/src/utilities/index.html +206 -0
  112. package/coverage/lcov-report/src/utilities/index.ts.html +112 -0
  113. package/coverage/lcov-report/src/utilities/redis.ts.html +424 -0
  114. package/coverage/lcov-report/src/utilities/templates.ts.html +232 -0
  115. package/coverage/lcov-report/src/utilities/users.ts.html +133 -0
  116. package/coverage/lcov.info +4187 -0
  117. package/jest.config.ts +17 -13
  118. package/package.json +8 -11
  119. package/scripts/dev/manage.js +0 -1
  120. package/src/api/controllers/global/auth.ts +70 -77
  121. package/src/api/controllers/global/self.ts +44 -28
  122. package/src/api/controllers/global/users.ts +25 -65
  123. package/src/api/controllers/system/accounts.ts +5 -7
  124. package/src/api/controllers/system/tenants.ts +8 -4
  125. package/src/api/index.ts +20 -4
  126. package/src/api/routes/global/auth.ts +7 -10
  127. package/src/api/routes/global/tests/auth.spec.ts +17 -226
  128. package/src/api/routes/global/tests/configs.spec.ts +5 -5
  129. package/src/api/routes/global/tests/roles.spec.ts +14 -20
  130. package/src/api/routes/global/tests/self.spec.ts +4 -3
  131. package/src/api/routes/global/tests/users.spec.ts +27 -24
  132. package/src/api/routes/system/tenants.ts +1 -1
  133. package/src/api/routes/system/tests/accounts.spec.ts +4 -4
  134. package/src/api/routes/system/tests/migrations.spec.ts +2 -2
  135. package/src/api/routes/system/tests/restore.spec.ts +2 -2
  136. package/src/api/routes/system/tests/status.spec.ts +5 -5
  137. package/src/environment.ts +1 -15
  138. package/src/index.ts +7 -12
  139. package/src/middleware/tests/tenancy.spec.ts +4 -4
  140. package/src/migrations/functions/globalInfoSyncUsers.ts +3 -4
  141. package/src/sdk/accounts/{metadata.ts → accounts.ts} +1 -0
  142. package/src/sdk/accounts/index.ts +1 -2
  143. package/src/sdk/users/events.ts +0 -4
  144. package/src/sdk/users/index.ts +0 -1
  145. package/src/sdk/users/users.ts +46 -53
  146. package/src/tests/TestConfiguration.ts +62 -41
  147. package/src/tests/api/auth.ts +14 -42
  148. package/src/tests/api/base.ts +1 -2
  149. package/src/tests/api/configs.ts +2 -2
  150. package/src/tests/api/restore.ts +0 -1
  151. package/src/tests/api/users.ts +2 -2
  152. package/src/tests/jestEnv.ts +1 -2
  153. package/src/tests/jestSetup.ts +6 -10
  154. package/src/tests/structures/index.ts +4 -0
  155. package/src/tests/structures/users.ts +37 -0
  156. package/src/utilities/email.ts +3 -3
  157. package/src/utilities/redis.ts +0 -2
  158. package/__mocks__/node-fetch.ts +0 -23
  159. package/jest-testcontainers-config.js +0 -8
  160. package/scripts/test.sh +0 -12
  161. package/src/ddApm.ts +0 -7
  162. package/src/elasticApm.ts +0 -10
  163. package/src/sdk/auth/auth.ts +0 -86
  164. package/src/sdk/auth/index.ts +0 -1
  165. package/src/sdk/tenants/index.ts +0 -1
  166. package/src/sdk/tenants/tenants.ts +0 -76
  167. package/src/sdk/users/tests/users.spec.ts +0 -52
  168. package/src/tests/logging.ts +0 -34
@@ -0,0 +1,196 @@
1
+ /* eslint-disable */
2
+ var addSorting = (function() {
3
+ 'use strict';
4
+ var cols,
5
+ currentSort = {
6
+ index: 0,
7
+ desc: false
8
+ };
9
+
10
+ // returns the summary table element
11
+ function getTable() {
12
+ return document.querySelector('.coverage-summary');
13
+ }
14
+ // returns the thead element of the summary table
15
+ function getTableHeader() {
16
+ return getTable().querySelector('thead tr');
17
+ }
18
+ // returns the tbody element of the summary table
19
+ function getTableBody() {
20
+ return getTable().querySelector('tbody');
21
+ }
22
+ // returns the th element for nth column
23
+ function getNthColumn(n) {
24
+ return getTableHeader().querySelectorAll('th')[n];
25
+ }
26
+
27
+ function onFilterInput() {
28
+ const searchValue = document.getElementById('fileSearch').value;
29
+ const rows = document.getElementsByTagName('tbody')[0].children;
30
+ for (let i = 0; i < rows.length; i++) {
31
+ const row = rows[i];
32
+ if (
33
+ row.textContent
34
+ .toLowerCase()
35
+ .includes(searchValue.toLowerCase())
36
+ ) {
37
+ row.style.display = '';
38
+ } else {
39
+ row.style.display = 'none';
40
+ }
41
+ }
42
+ }
43
+
44
+ // loads the search box
45
+ function addSearchBox() {
46
+ var template = document.getElementById('filterTemplate');
47
+ var templateClone = template.content.cloneNode(true);
48
+ templateClone.getElementById('fileSearch').oninput = onFilterInput;
49
+ template.parentElement.appendChild(templateClone);
50
+ }
51
+
52
+ // loads all columns
53
+ function loadColumns() {
54
+ var colNodes = getTableHeader().querySelectorAll('th'),
55
+ colNode,
56
+ cols = [],
57
+ col,
58
+ i;
59
+
60
+ for (i = 0; i < colNodes.length; i += 1) {
61
+ colNode = colNodes[i];
62
+ col = {
63
+ key: colNode.getAttribute('data-col'),
64
+ sortable: !colNode.getAttribute('data-nosort'),
65
+ type: colNode.getAttribute('data-type') || 'string'
66
+ };
67
+ cols.push(col);
68
+ if (col.sortable) {
69
+ col.defaultDescSort = col.type === 'number';
70
+ colNode.innerHTML =
71
+ colNode.innerHTML + '<span class="sorter"></span>';
72
+ }
73
+ }
74
+ return cols;
75
+ }
76
+ // attaches a data attribute to every tr element with an object
77
+ // of data values keyed by column name
78
+ function loadRowData(tableRow) {
79
+ var tableCols = tableRow.querySelectorAll('td'),
80
+ colNode,
81
+ col,
82
+ data = {},
83
+ i,
84
+ val;
85
+ for (i = 0; i < tableCols.length; i += 1) {
86
+ colNode = tableCols[i];
87
+ col = cols[i];
88
+ val = colNode.getAttribute('data-value');
89
+ if (col.type === 'number') {
90
+ val = Number(val);
91
+ }
92
+ data[col.key] = val;
93
+ }
94
+ return data;
95
+ }
96
+ // loads all row data
97
+ function loadData() {
98
+ var rows = getTableBody().querySelectorAll('tr'),
99
+ i;
100
+
101
+ for (i = 0; i < rows.length; i += 1) {
102
+ rows[i].data = loadRowData(rows[i]);
103
+ }
104
+ }
105
+ // sorts the table using the data for the ith column
106
+ function sortByIndex(index, desc) {
107
+ var key = cols[index].key,
108
+ sorter = function(a, b) {
109
+ a = a.data[key];
110
+ b = b.data[key];
111
+ return a < b ? -1 : a > b ? 1 : 0;
112
+ },
113
+ finalSorter = sorter,
114
+ tableBody = document.querySelector('.coverage-summary tbody'),
115
+ rowNodes = tableBody.querySelectorAll('tr'),
116
+ rows = [],
117
+ i;
118
+
119
+ if (desc) {
120
+ finalSorter = function(a, b) {
121
+ return -1 * sorter(a, b);
122
+ };
123
+ }
124
+
125
+ for (i = 0; i < rowNodes.length; i += 1) {
126
+ rows.push(rowNodes[i]);
127
+ tableBody.removeChild(rowNodes[i]);
128
+ }
129
+
130
+ rows.sort(finalSorter);
131
+
132
+ for (i = 0; i < rows.length; i += 1) {
133
+ tableBody.appendChild(rows[i]);
134
+ }
135
+ }
136
+ // removes sort indicators for current column being sorted
137
+ function removeSortIndicators() {
138
+ var col = getNthColumn(currentSort.index),
139
+ cls = col.className;
140
+
141
+ cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
142
+ col.className = cls;
143
+ }
144
+ // adds sort indicators for current column being sorted
145
+ function addSortIndicators() {
146
+ getNthColumn(currentSort.index).className += currentSort.desc
147
+ ? ' sorted-desc'
148
+ : ' sorted';
149
+ }
150
+ // adds event listeners for all sorter widgets
151
+ function enableUI() {
152
+ var i,
153
+ el,
154
+ ithSorter = function ithSorter(i) {
155
+ var col = cols[i];
156
+
157
+ return function() {
158
+ var desc = col.defaultDescSort;
159
+
160
+ if (currentSort.index === i) {
161
+ desc = !currentSort.desc;
162
+ }
163
+ sortByIndex(i, desc);
164
+ removeSortIndicators();
165
+ currentSort.index = i;
166
+ currentSort.desc = desc;
167
+ addSortIndicators();
168
+ };
169
+ };
170
+ for (i = 0; i < cols.length; i += 1) {
171
+ if (cols[i].sortable) {
172
+ // add the click event handler on the th so users
173
+ // dont have to click on those tiny arrows
174
+ el = getNthColumn(i).querySelector('.sorter').parentElement;
175
+ if (el.addEventListener) {
176
+ el.addEventListener('click', ithSorter(i));
177
+ } else {
178
+ el.attachEvent('onclick', ithSorter(i));
179
+ }
180
+ }
181
+ }
182
+ }
183
+ // adds sorting functionality to the UI
184
+ return function() {
185
+ if (!getTable()) {
186
+ return;
187
+ }
188
+ cols = loadColumns();
189
+ loadData();
190
+ addSearchBox();
191
+ addSortIndicators();
192
+ enableUI();
193
+ };
194
+ })();
195
+
196
+ window.addEventListener('load', addSorting);