@wbce-d9/api 11.1.6 → 12.0.0
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.
|
@@ -2,7 +2,6 @@ import knex from 'knex';
|
|
|
2
2
|
import { dirname } from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import path from 'path';
|
|
5
|
-
import { promisify } from 'util';
|
|
6
5
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
6
|
export default function createDBConnection(client, credentials) {
|
|
8
7
|
let connection = {};
|
|
@@ -46,10 +45,9 @@ export default function createDBConnection(client, credentials) {
|
|
|
46
45
|
knexConfig.useNullAsDefault = true;
|
|
47
46
|
}
|
|
48
47
|
if (client === 'cockroachdb') {
|
|
49
|
-
knexConfig.pool.afterCreate =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
await run('SET default_int_size = 4');
|
|
48
|
+
knexConfig.pool.afterCreate = (conn, callback) => {
|
|
49
|
+
conn.query('SET serial_normalization = "sql_sequence"');
|
|
50
|
+
conn.query('SET default_int_size = 4');
|
|
53
51
|
callback(null, conn);
|
|
54
52
|
};
|
|
55
53
|
}
|
package/dist/database/index.js
CHANGED
|
@@ -6,7 +6,6 @@ import { dirname } from 'node:path';
|
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import { performance } from 'perf_hooks';
|
|
9
|
-
import { promisify } from 'util';
|
|
10
9
|
import env from '../env.js';
|
|
11
10
|
import logger from '../logger.js';
|
|
12
11
|
import { getConfigFromEnv } from '../utils/get-config-from-env.js';
|
|
@@ -77,29 +76,31 @@ export default function getDatabase() {
|
|
|
77
76
|
};
|
|
78
77
|
if (client === 'sqlite3') {
|
|
79
78
|
knexConfig.useNullAsDefault = true;
|
|
80
|
-
poolConfig.afterCreate =
|
|
79
|
+
poolConfig.afterCreate = (conn, callback) => {
|
|
81
80
|
logger.trace('Enabling SQLite Foreign Keys support...');
|
|
82
|
-
|
|
83
|
-
await run('PRAGMA foreign_keys = ON');
|
|
81
|
+
conn.run('PRAGMA foreign_keys = ON');
|
|
84
82
|
callback(null, conn);
|
|
85
83
|
};
|
|
86
84
|
}
|
|
87
85
|
if (client === 'cockroachdb') {
|
|
88
|
-
poolConfig.afterCreate =
|
|
86
|
+
poolConfig.afterCreate = (conn, callback) => {
|
|
89
87
|
logger.trace('Setting CRDB serial_normalization and default_int_size');
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
await run('SET default_int_size = 4');
|
|
88
|
+
conn.query('SET serial_normalization = "sql_sequence"');
|
|
89
|
+
conn.query('SET default_int_size = 4');
|
|
93
90
|
callback(null, conn);
|
|
94
91
|
};
|
|
95
92
|
}
|
|
96
93
|
if (client === 'mysql') {
|
|
97
|
-
poolConfig.afterCreate =
|
|
94
|
+
poolConfig.afterCreate = (conn, callback) => {
|
|
98
95
|
logger.trace('Retrieving database version');
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
conn.query('SELECT @@version AS version;', (error, results) => {
|
|
97
|
+
if (error) {
|
|
98
|
+
callback(error, null);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
databaseVersion = results[0]?.version || results[0]?.['@@version'];
|
|
102
|
+
callback(null, conn);
|
|
103
|
+
});
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
106
|
if (client === 'mssql') {
|
|
@@ -17,7 +17,7 @@ export default defineOperationApi({
|
|
|
17
17
|
jail.setSync('process', { env: environmentVariables }, { copy: true });
|
|
18
18
|
jail.setSync('module', { exports: null }, { copy: true });
|
|
19
19
|
// Adding a secure logger for the isolate
|
|
20
|
-
const createLoggerCallback = (logFn) => new ivm.Callback((...args) => logFn(args.length === 1 ? args[0] : args), { sync: true });
|
|
20
|
+
const createLoggerCallback = (logFn) => new ivm.Callback((...args) => logFn(args.length === 1 ? args[0] : args), () => { }, { sync: true });
|
|
21
21
|
jail.setSync('console', {
|
|
22
22
|
log: createLoggerCallback(() => logger.info),
|
|
23
23
|
info: createLoggerCallback(() => logger.info),
|
|
@@ -27,12 +27,12 @@ export default defineOperationApi({
|
|
|
27
27
|
trace: createLoggerCallback(() => logger.trace),
|
|
28
28
|
}, { copy: true });
|
|
29
29
|
// Executing the code within the isolate
|
|
30
|
-
await context.eval(code, { timeout: executionTimeout });
|
|
30
|
+
await context.eval(code, { timeout: executionTimeout }, () => { });
|
|
31
31
|
const dataCopy = new ivm.ExternalCopy({ data });
|
|
32
32
|
const resultReference = await context.evalClosure(`return module.exports($0.data)`, [dataCopy.copyInto()], {
|
|
33
33
|
result: { reference: true, promise: true },
|
|
34
34
|
timeout: executionTimeout,
|
|
35
|
-
});
|
|
35
|
+
}, () => { });
|
|
36
36
|
const finalResult = await resultReference.copy();
|
|
37
37
|
// Cleanup memory
|
|
38
38
|
resultReference.release();
|
package/dist/types/meta.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wbce-d9/api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "Directus is a real-time API and App dashboard for managing SQL database content",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"icc": "3.0.0",
|
|
102
102
|
"inquirer": "9.1.5",
|
|
103
103
|
"ioredis": "5.3.2",
|
|
104
|
-
"isolated-vm": "^
|
|
104
|
+
"isolated-vm": "^6.0.1",
|
|
105
105
|
"joi": "17.9.1",
|
|
106
106
|
"js-yaml": "4.1.0",
|
|
107
107
|
"js2xmlparser": "5.0.0",
|
|
@@ -143,20 +143,20 @@
|
|
|
143
143
|
"uuid": "9.0.0",
|
|
144
144
|
"uuid-validate": "0.0.3",
|
|
145
145
|
"wellknown": "0.5.0",
|
|
146
|
-
"@wbce-d9/
|
|
147
|
-
"@wbce-d9/
|
|
148
|
-
"@wbce-d9/constants": "
|
|
149
|
-
"@wbce-d9/extensions-sdk": "9.27.4",
|
|
150
|
-
"@wbce-d9/schema": "9.26.4",
|
|
146
|
+
"@wbce-d9/exceptions": "10.0.0",
|
|
147
|
+
"@wbce-d9/extensions-sdk": "10.0.0",
|
|
148
|
+
"@wbce-d9/constants": "10.0.0",
|
|
151
149
|
"@wbce-d9/specs": "9.26.5",
|
|
152
|
-
"@wbce-d9/
|
|
153
|
-
"@wbce-d9/storage-driver-azure": "
|
|
154
|
-
"@wbce-d9/storage
|
|
155
|
-
"@wbce-d9/storage-driver-
|
|
156
|
-
"@wbce-d9/
|
|
157
|
-
"@wbce-d9/storage-driver-
|
|
158
|
-
"@wbce-d9/
|
|
159
|
-
"@wbce-d9/
|
|
150
|
+
"@wbce-d9/schema": "10.0.0",
|
|
151
|
+
"@wbce-d9/storage-driver-azure": "10.0.0",
|
|
152
|
+
"@wbce-d9/storage": "10.0.0",
|
|
153
|
+
"@wbce-d9/storage-driver-cloudinary": "10.0.0",
|
|
154
|
+
"@wbce-d9/app": "9.33.7",
|
|
155
|
+
"@wbce-d9/storage-driver-gcs": "10.0.0",
|
|
156
|
+
"@wbce-d9/storage-driver-local": "10.0.0",
|
|
157
|
+
"@wbce-d9/storage-driver-s3": "10.0.0",
|
|
158
|
+
"@wbce-d9/update-check": "10.0.0",
|
|
159
|
+
"@wbce-d9/utils": "10.0.0"
|
|
160
160
|
},
|
|
161
161
|
"devDependencies": {
|
|
162
162
|
"@ngneat/falso": "6.4.0",
|
|
@@ -197,14 +197,14 @@
|
|
|
197
197
|
"@types/uuid-validate": "0.0.1",
|
|
198
198
|
"@types/wellknown": "0.5.4",
|
|
199
199
|
"@vitest/coverage-c8": "0.30.1",
|
|
200
|
-
"@wbce-d9/tsconfig": "0.0
|
|
200
|
+
"@wbce-d9/tsconfig": "2.0.0",
|
|
201
201
|
"copyfiles": "2.4.1",
|
|
202
202
|
"form-data": "4.0.4",
|
|
203
203
|
"knex-mock-client": "3.0.2",
|
|
204
204
|
"supertest": "6.3.3",
|
|
205
205
|
"typescript": "5.0.4",
|
|
206
206
|
"vitest": "0.30.1",
|
|
207
|
-
"@wbce-d9/types": "
|
|
207
|
+
"@wbce-d9/types": "10.0.0"
|
|
208
208
|
},
|
|
209
209
|
"optionalDependencies": {
|
|
210
210
|
"@keyv/redis": "2.5.7",
|
|
@@ -218,7 +218,7 @@
|
|
|
218
218
|
"tedious": "18.6.1"
|
|
219
219
|
},
|
|
220
220
|
"engines": {
|
|
221
|
-
"node": ">=
|
|
221
|
+
"node": ">=22"
|
|
222
222
|
},
|
|
223
223
|
"scripts": {
|
|
224
224
|
"build": "tsc --build && copyfiles \"src/**/*.{yaml,liquid}\" -u 1 dist",
|