@teamkeel/functions-runtime 0.405.3 → 0.406.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.
- package/package.json +4 -3
- package/src/File.js +10 -12
- package/src/applyJoins.js +3 -1
- package/src/applyWhereConditions.js +2 -3
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamkeel/functions-runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.406.4",
|
|
4
4
|
"description": "Internal package used by @teamkeel/sdk",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "vitest run --reporter verbose --threads
|
|
7
|
+
"test": "vitest run --reporter verbose --pool=threads --poolOptions.threads.singleThread",
|
|
8
8
|
"format": "npx prettier --write src/**/*.js"
|
|
9
9
|
},
|
|
10
10
|
"keywords": [],
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"prettier": "3.1.1",
|
|
19
|
-
"vitest": "^0.
|
|
19
|
+
"vitest": "^3.0.7"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@aws-sdk/client-s3": "~3.722.0",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"pg": "^8.13.1",
|
|
36
36
|
"postgres-interval": "^4.0.2",
|
|
37
37
|
"traceparent": "^1.0.0",
|
|
38
|
+
"vite": "^6.2.0",
|
|
38
39
|
"ws": "^8.18.0"
|
|
39
40
|
},
|
|
40
41
|
"packageManager": "pnpm@9.12.3+sha512.cce0f9de9c5a7c95bef944169cc5dfe8741abfb145078c0d508b868056848a87c81e626246cb60967cbd7fd29a6c062ef73ff840d96b3c86c40ac92cf4a813ee"
|
package/src/File.js
CHANGED
|
@@ -14,7 +14,11 @@ const s3Client = (() => {
|
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
// Set in integration tests to send all AWS API calls to a test server
|
|
18
|
+
// for mocking
|
|
19
|
+
const endpoint = process.env.TEST_AWS_ENDPOINT;
|
|
20
|
+
|
|
21
|
+
if (!endpoint) {
|
|
18
22
|
// If no test endpoint is provided then use the env's configuration
|
|
19
23
|
return new S3Client({
|
|
20
24
|
region: process.env.KEEL_REGION,
|
|
@@ -22,20 +26,14 @@ const s3Client = (() => {
|
|
|
22
26
|
});
|
|
23
27
|
}
|
|
24
28
|
|
|
25
|
-
// Set in integration tests to send all AWS API calls to a test server
|
|
26
|
-
// for mocking
|
|
27
|
-
const endpoint = process.env.TEST_AWS_ENDPOINT;
|
|
28
|
-
|
|
29
29
|
return new S3Client({
|
|
30
30
|
region: process.env.KEEL_REGION,
|
|
31
31
|
|
|
32
|
-
// If a test endpoint is provided then use some test credentials
|
|
33
|
-
credentials:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
: fromEnv(),
|
|
32
|
+
// If a test endpoint is provided then use some test credentials
|
|
33
|
+
credentials: {
|
|
34
|
+
accessKeyId: "test",
|
|
35
|
+
secretAccessKey: "test",
|
|
36
|
+
},
|
|
39
37
|
|
|
40
38
|
// If a custom endpoint is set we need to use a custom resolver. Just setting the base endpoint isn't enough for S3 as it
|
|
41
39
|
// as the default resolver uses the bucket name as a sub-domain, which likely won't work with the custom endpoint.
|
package/src/applyJoins.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const { snakeCase } = require("./casing");
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Adds the joins required by the where conditions to the given
|
|
3
5
|
* Kysely instance and returns the resulting new Kysely instance.
|
|
@@ -15,7 +17,7 @@ function applyJoins(context, qb, where) {
|
|
|
15
17
|
const srcTable = context.tableAlias();
|
|
16
18
|
|
|
17
19
|
for (const key of Object.keys(where)) {
|
|
18
|
-
const rel = conf[key];
|
|
20
|
+
const rel = conf[snakeCase(key)];
|
|
19
21
|
if (!rel) {
|
|
20
22
|
continue;
|
|
21
23
|
}
|
|
@@ -71,13 +71,12 @@ const opMapping = {
|
|
|
71
71
|
*/
|
|
72
72
|
function applyWhereConditions(context, qb, where = {}) {
|
|
73
73
|
const conf = context.tableConfig();
|
|
74
|
-
|
|
75
74
|
for (const key of Object.keys(where)) {
|
|
76
75
|
const v = where[key];
|
|
77
76
|
|
|
78
77
|
// Handle nested where conditions e.g. using a join table
|
|
79
|
-
if (conf && conf[key]) {
|
|
80
|
-
const rel = conf[key];
|
|
78
|
+
if (conf && conf[snakeCase(key)]) {
|
|
79
|
+
const rel = conf[snakeCase(key)];
|
|
81
80
|
context.withJoin(rel.referencesTable, () => {
|
|
82
81
|
qb = applyWhereConditions(context, qb, v);
|
|
83
82
|
});
|