@budibase/server 1.0.145 → 1.0.146
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.
- package/__mocks__/@google-cloud/firestore.ts +36 -0
- package/__mocks__/pg.ts +1 -9
- package/builder/assets/{index.6b7d3283.js → index.c773a612.js} +2 -2
- package/builder/index.html +1 -1
- package/coverage/clover.xml +2 -2
- package/coverage/lcov-report/api/controllers/analytics.js.html +1 -1
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
- package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
- package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/api/controllers/component.js.html +1 -1
- package/coverage/lcov-report/api/controllers/datasource.js.html +1 -1
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +1 -1
- package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
- package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
- package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
- package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/role.js.html +1 -1
- package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/index.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/screen.js.html +1 -1
- package/coverage/lcov-report/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
- package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
- package/coverage/lcov-report/api/index.html +1 -1
- package/coverage/lcov-report/api/index.js.html +1 -1
- package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
- package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/routes/auth.js.html +1 -1
- package/coverage/lcov-report/api/routes/automation.js.html +1 -1
- package/coverage/lcov-report/api/routes/backup.js.html +1 -1
- package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
- package/coverage/lcov-report/api/routes/component.js.html +1 -1
- package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
- package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
- package/coverage/lcov-report/api/routes/dev.js.html +1 -1
- package/coverage/lcov-report/api/routes/index.html +1 -1
- package/coverage/lcov-report/api/routes/integration.js.html +1 -1
- package/coverage/lcov-report/api/routes/layout.js.html +1 -1
- package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
- package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
- package/coverage/lcov-report/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +1 -1
- package/coverage/lcov-report/api/routes/role.js.html +1 -1
- package/coverage/lcov-report/api/routes/routing.js.html +1 -1
- package/coverage/lcov-report/api/routes/screen.js.html +1 -1
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/table.js.html +1 -1
- package/coverage/lcov-report/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/api/routes/user.js.html +1 -1
- package/coverage/lcov-report/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
- package/coverage/lcov-report/api/routes/view.js.html +1 -1
- package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/actions.js.html +1 -1
- package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
- package/coverage/lcov-report/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/automations/index.html +1 -1
- package/coverage/lcov-report/automations/index.js.html +1 -1
- package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
- package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
- package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
- package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/triggers.js.html +1 -1
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/index.js.html +1 -1
- package/coverage/lcov-report/constants/layouts.js.html +1 -1
- package/coverage/lcov-report/constants/screens.js.html +1 -1
- package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
- package/coverage/lcov-report/db/index.html +1 -1
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
- package/coverage/lcov-report/db/newid.js.html +1 -1
- package/coverage/lcov-report/db/utils.js.html +1 -1
- package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/events/index.html +1 -1
- package/coverage/lcov-report/events/index.js.html +1 -1
- package/coverage/lcov-report/events/utils.js.html +1 -1
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
- package/coverage/lcov-report/middleware/builder.js.html +1 -1
- package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
- package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
- package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +1 -1
- package/coverage/lcov-report/threads/automation.js.html +1 -1
- package/coverage/lcov-report/threads/index.html +1 -1
- package/coverage/lcov-report/threads/query.js.html +1 -1
- package/coverage/lcov-report/threads/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/bcrypt.js.html +1 -1
- package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
- package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
- package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
- package/coverage/lcov-report/utilities/global.js.html +1 -1
- package/coverage/lcov-report/utilities/index.html +1 -1
- package/coverage/lcov-report/utilities/index.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/utilities/security.js.html +1 -1
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
- package/dist/api/controllers/row/ExternalRequest.js +3 -2
- package/dist/integrations/firebase.js +9 -9
- package/dist/integrations/index.js +1 -0
- package/dist/integrations/postgres.js +15 -11
- package/dist/package.json +5 -5
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/src/api/controllers/row/ExternalRequest.ts +3 -2
- package/src/integrations/firebase.ts +10 -10
- package/src/integrations/index.ts +1 -0
- package/src/integrations/postgres.ts +9 -11
- package/src/integrations/tests/firebase.spec.js +92 -0
- package/src/integrations/tests/postgres.spec.js +0 -4
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
117
117
|
Code coverage generated by
|
|
118
118
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
119
|
-
at
|
|
119
|
+
at Fri May 06 2022 15:36:48 GMT+0000 (Coordinated Universal Time)
|
|
120
120
|
</div>
|
|
121
121
|
<script src="../../prettify.js"></script>
|
|
122
122
|
<script>
|
|
@@ -1096,7 +1096,7 @@ exports.cleanupAttachments = async (table, { row, rows, oldRow, oldTable }) =>
|
|
|
1096
1096
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
1097
1097
|
Code coverage generated by
|
|
1098
1098
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
1099
|
-
at
|
|
1099
|
+
at Fri May 06 2022 15:36:48 GMT+0000 (Coordinated Universal Time)
|
|
1100
1100
|
</div>
|
|
1101
1101
|
<script src="../../prettify.js"></script>
|
|
1102
1102
|
<script>
|
|
@@ -271,7 +271,7 @@ exports.processFormulas = (
|
|
|
271
271
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
272
272
|
Code coverage generated by
|
|
273
273
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
274
|
-
at
|
|
274
|
+
at Fri May 06 2022 15:36:48 GMT+0000 (Coordinated Universal Time)
|
|
275
275
|
</div>
|
|
276
276
|
<script src="../../prettify.js"></script>
|
|
277
277
|
<script>
|
|
@@ -142,7 +142,7 @@ module.exports = ScriptRunner
|
|
|
142
142
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
143
143
|
Code coverage generated by
|
|
144
144
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
145
|
-
at
|
|
145
|
+
at Fri May 06 2022 15:36:48 GMT+0000 (Coordinated Universal Time)
|
|
146
146
|
</div>
|
|
147
147
|
<script src="../prettify.js"></script>
|
|
148
148
|
<script>
|
|
@@ -280,7 +280,7 @@ exports.CURRENTLY_SUPPORTED_LEVELS = CURRENTLY_SUPPORTED_LEVELS
|
|
|
280
280
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
281
281
|
Code coverage generated by
|
|
282
282
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
283
|
-
at
|
|
283
|
+
at Fri May 06 2022 15:36:48 GMT+0000 (Coordinated Universal Time)
|
|
284
284
|
</div>
|
|
285
285
|
<script src="../prettify.js"></script>
|
|
286
286
|
<script>
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
92
92
|
Code coverage generated by
|
|
93
93
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
94
|
-
at
|
|
94
|
+
at Fri May 06 2022 15:36:48 GMT+0000 (Coordinated Universal Time)
|
|
95
95
|
</div>
|
|
96
96
|
<script src="../prettify.js"></script>
|
|
97
97
|
<script>
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
117
117
|
Code coverage generated by
|
|
118
118
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
119
|
-
at
|
|
119
|
+
at Fri May 06 2022 15:36:48 GMT+0000 (Coordinated Universal Time)
|
|
120
120
|
</div>
|
|
121
121
|
<script src="../../prettify.js"></script>
|
|
122
122
|
<script>
|
|
@@ -307,7 +307,7 @@ exports.getUniqueRows = async appIds => {
|
|
|
307
307
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
308
308
|
Code coverage generated by
|
|
309
309
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
310
|
-
at
|
|
310
|
+
at Fri May 06 2022 15:36:48 GMT+0000 (Coordinated Universal Time)
|
|
311
311
|
</div>
|
|
312
312
|
<script src="../../prettify.js"></script>
|
|
313
313
|
<script>
|
|
@@ -124,7 +124,7 @@ function <span class="fstat-no" title="function not covered" >resetQuotasIfRequi
|
|
|
124
124
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
125
125
|
Code coverage generated by
|
|
126
126
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
127
|
-
at
|
|
127
|
+
at Fri May 06 2022 15:36:48 GMT+0000 (Coordinated Universal Time)
|
|
128
128
|
</div>
|
|
129
129
|
<script src="../../prettify.js"></script>
|
|
130
130
|
<script>
|
|
@@ -142,7 +142,7 @@ exports.getFullUser = async (ctx, userId) => {
|
|
|
142
142
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
143
143
|
Code coverage generated by
|
|
144
144
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
145
|
-
at
|
|
145
|
+
at Fri May 06 2022 15:36:48 GMT+0000 (Coordinated Universal Time)
|
|
146
146
|
</div>
|
|
147
147
|
<script src="../prettify.js"></script>
|
|
148
148
|
<script>
|
|
@@ -487,7 +487,7 @@ exports.readGlobalUser = <span class="fstat-no" title="function not covered" >as
|
|
|
487
487
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
488
488
|
Code coverage generated by
|
|
489
489
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
490
|
-
at
|
|
490
|
+
at Fri May 06 2022 15:36:48 GMT+0000 (Coordinated Universal Time)
|
|
491
491
|
</div>
|
|
492
492
|
<script src="../prettify.js"></script>
|
|
493
493
|
<script>
|
|
@@ -146,9 +146,10 @@ var External;
|
|
|
146
146
|
const thisRow = {};
|
|
147
147
|
// filter the row down to what is actually the row (not joined)
|
|
148
148
|
for (let fieldName of Object.keys(table.schema)) {
|
|
149
|
-
const
|
|
149
|
+
const pathValue = row[`${table.name}.${fieldName}`];
|
|
150
|
+
const value = pathValue != null ? pathValue : row[fieldName];
|
|
150
151
|
// all responses include "select col as table.col" so that overlaps are handled
|
|
151
|
-
if (value) {
|
|
152
|
+
if (value != null) {
|
|
152
153
|
thisRow[fieldName] = value;
|
|
153
154
|
}
|
|
154
155
|
}
|
|
@@ -92,7 +92,7 @@ var Firebase;
|
|
|
92
92
|
this.config = config;
|
|
93
93
|
if (config.serviceAccount) {
|
|
94
94
|
const serviceAccount = JSON.parse(config.serviceAccount);
|
|
95
|
-
this.
|
|
95
|
+
this.client = new firestore_1.Firestore({
|
|
96
96
|
projectId: serviceAccount.project_id,
|
|
97
97
|
credentials: {
|
|
98
98
|
client_email: serviceAccount.client_email,
|
|
@@ -101,7 +101,7 @@ var Firebase;
|
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
else {
|
|
104
|
-
this.
|
|
104
|
+
this.client = new firestore_1.Firestore({
|
|
105
105
|
projectId: config.projectId,
|
|
106
106
|
credentials: {
|
|
107
107
|
client_email: config.email,
|
|
@@ -113,7 +113,7 @@ var Firebase;
|
|
|
113
113
|
create(query) {
|
|
114
114
|
return __awaiter(this, void 0, void 0, function* () {
|
|
115
115
|
try {
|
|
116
|
-
const documentReference = this.
|
|
116
|
+
const documentReference = this.client
|
|
117
117
|
.collection(query.extra.collection)
|
|
118
118
|
.doc();
|
|
119
119
|
yield documentReference.set(Object.assign(Object.assign({}, query.json), { id: documentReference.id }));
|
|
@@ -130,7 +130,7 @@ var Firebase;
|
|
|
130
130
|
return __awaiter(this, void 0, void 0, function* () {
|
|
131
131
|
try {
|
|
132
132
|
let snapshot;
|
|
133
|
-
const collectionRef = this.
|
|
133
|
+
const collectionRef = this.client.collection(query.extra.collection);
|
|
134
134
|
if (query.extra.filterField &&
|
|
135
135
|
query.extra.filter &&
|
|
136
136
|
query.extra.filterValue) {
|
|
@@ -154,17 +154,17 @@ var Firebase;
|
|
|
154
154
|
update(query) {
|
|
155
155
|
return __awaiter(this, void 0, void 0, function* () {
|
|
156
156
|
try {
|
|
157
|
-
yield this.
|
|
157
|
+
yield this.client
|
|
158
158
|
.collection(query.extra.collection)
|
|
159
159
|
.doc(query.json.id)
|
|
160
160
|
.update(query.json);
|
|
161
|
-
return (yield this.
|
|
161
|
+
return (yield this.client
|
|
162
162
|
.collection(query.extra.collection)
|
|
163
163
|
.doc(query.json.id)
|
|
164
164
|
.get()).data();
|
|
165
165
|
}
|
|
166
166
|
catch (err) {
|
|
167
|
-
console.error("Error writing to
|
|
167
|
+
console.error("Error writing to Firestore", err);
|
|
168
168
|
throw err;
|
|
169
169
|
}
|
|
170
170
|
});
|
|
@@ -172,14 +172,14 @@ var Firebase;
|
|
|
172
172
|
delete(query) {
|
|
173
173
|
return __awaiter(this, void 0, void 0, function* () {
|
|
174
174
|
try {
|
|
175
|
-
yield this.
|
|
175
|
+
yield this.client
|
|
176
176
|
.collection(query.extra.collection)
|
|
177
177
|
.doc(query.json.id)
|
|
178
178
|
.delete();
|
|
179
179
|
return true;
|
|
180
180
|
}
|
|
181
181
|
catch (err) {
|
|
182
|
-
console.error("Error
|
|
182
|
+
console.error("Error deleting from Firestore", err);
|
|
183
183
|
throw err;
|
|
184
184
|
}
|
|
185
185
|
});
|
|
@@ -45,6 +45,7 @@ const INTEGRATIONS = {
|
|
|
45
45
|
[SourceNames.FIREBASE]: firebase.integration,
|
|
46
46
|
[SourceNames.GOOGLE_SHEETS]: googlesheets.integration,
|
|
47
47
|
[SourceNames.REDIS]: redis.integration,
|
|
48
|
+
[SourceNames.FIREBASE]: firebase.integration,
|
|
48
49
|
};
|
|
49
50
|
// optionally add oracle integration if the oracle binary can be installed
|
|
50
51
|
if (!(process.arch === "arm64" && process.platform === "darwin")) {
|
|
@@ -13,7 +13,7 @@ const datasource_1 = require("../definitions/datasource");
|
|
|
13
13
|
const utils_1 = require("./utils");
|
|
14
14
|
var PostgresModule;
|
|
15
15
|
(function (PostgresModule) {
|
|
16
|
-
const {
|
|
16
|
+
const { Client } = require("pg");
|
|
17
17
|
const Sql = require("./base/sql");
|
|
18
18
|
const { escapeDangerousCharacters } = require("../utilities");
|
|
19
19
|
const JSON_REGEX = /'{.*}'::json/s;
|
|
@@ -106,10 +106,7 @@ var PostgresModule;
|
|
|
106
106
|
ca: this.config.ca,
|
|
107
107
|
}
|
|
108
108
|
: undefined });
|
|
109
|
-
|
|
110
|
-
this.pool = new Pool(newConfig);
|
|
111
|
-
}
|
|
112
|
-
this.client = this.pool;
|
|
109
|
+
this.client = new Client(newConfig);
|
|
113
110
|
this.setSchema();
|
|
114
111
|
}
|
|
115
112
|
getBindingIdentifier() {
|
|
@@ -140,16 +137,20 @@ var PostgresModule;
|
|
|
140
137
|
// @ts-ignore
|
|
141
138
|
throw new Error(err);
|
|
142
139
|
}
|
|
140
|
+
finally {
|
|
141
|
+
yield this.client.end();
|
|
142
|
+
}
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
setSchema() {
|
|
146
|
-
|
|
147
|
-
this.
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
+
yield this.client.connect();
|
|
148
|
+
if (!this.config.schema) {
|
|
149
|
+
this.config.schema = "public";
|
|
150
|
+
}
|
|
151
|
+
this.client.query(`SET search_path TO ${this.config.schema}`);
|
|
152
|
+
this.COLUMNS_SQL = `select * from information_schema.columns where table_schema = '${this.config.schema}'`;
|
|
151
153
|
});
|
|
152
|
-
this.COLUMNS_SQL = `select * from information_schema.columns where table_schema = '${this.config.schema}'`;
|
|
153
154
|
}
|
|
154
155
|
/**
|
|
155
156
|
* Fetches the tables from the postgres table and assigns them to the datasource.
|
|
@@ -176,6 +177,9 @@ var PostgresModule;
|
|
|
176
177
|
catch (err) {
|
|
177
178
|
tableKeys = {};
|
|
178
179
|
}
|
|
180
|
+
finally {
|
|
181
|
+
yield this.client.close();
|
|
182
|
+
}
|
|
179
183
|
const columnsResponse = yield this.client.query(this.COLUMNS_SQL);
|
|
180
184
|
const tables = {};
|
|
181
185
|
for (let column of columnsResponse.rows) {
|
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.
|
|
4
|
+
"version": "1.0.145",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -68,10 +68,10 @@
|
|
|
68
68
|
"license": "GPL-3.0",
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@apidevtools/swagger-parser": "^10.0.3",
|
|
71
|
-
"@budibase/backend-core": "^1.0.
|
|
72
|
-
"@budibase/client": "^1.0.
|
|
73
|
-
"@budibase/pro": "1.0.
|
|
74
|
-
"@budibase/string-templates": "^1.0.
|
|
71
|
+
"@budibase/backend-core": "^1.0.145",
|
|
72
|
+
"@budibase/client": "^1.0.145",
|
|
73
|
+
"@budibase/pro": "1.0.145",
|
|
74
|
+
"@budibase/string-templates": "^1.0.145",
|
|
75
75
|
"@bull-board/api": "^3.7.0",
|
|
76
76
|
"@bull-board/koa": "^3.7.0",
|
|
77
77
|
"@elastic/elasticsearch": "7.10.0",
|