@teamkeel/functions-runtime 0.337.0 → 0.339.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.
- package/.env.test +2 -0
- package/package.json +1 -1
- package/pnpm-lock.yaml +738 -328
- package/src/ModelAPI.js +2 -5
- package/src/ModelAPI.test.js +87 -41
- package/src/database.js +43 -12
- package/src/handleRequest.js +2 -2
- package/src/handleRequest.test.js +12 -20
- package/src/permissions.test.js +0 -3
- package/vite.config.js +7 -0
|
@@ -8,9 +8,6 @@ const { Permissions } = require("./permissions");
|
|
|
8
8
|
import { PROTO_ACTION_TYPES } from "./consts";
|
|
9
9
|
import KSUID from "ksuid";
|
|
10
10
|
|
|
11
|
-
process.env.KEEL_DB_CONN_TYPE = "pg";
|
|
12
|
-
process.env.KEEL_DB_CONN = `postgresql://postgres:postgres@localhost:5432/functions-runtime`;
|
|
13
|
-
|
|
14
11
|
test("when the custom function returns expected value", async () => {
|
|
15
12
|
const config = {
|
|
16
13
|
functions: {
|
|
@@ -211,23 +208,15 @@ describe("ModelAPI error handling", () => {
|
|
|
211
208
|
`.execute(db);
|
|
212
209
|
|
|
213
210
|
const models = {
|
|
214
|
-
post: new ModelAPI(
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
post: {
|
|
223
|
-
author: {
|
|
224
|
-
relationshipType: "belongsTo",
|
|
225
|
-
foreignKey: "author_id",
|
|
226
|
-
referencesTable: "person",
|
|
227
|
-
},
|
|
211
|
+
post: new ModelAPI("post", undefined, {
|
|
212
|
+
post: {
|
|
213
|
+
author: {
|
|
214
|
+
relationshipType: "belongsTo",
|
|
215
|
+
foreignKey: "author_id",
|
|
216
|
+
referencesTable: "person",
|
|
228
217
|
},
|
|
229
|
-
}
|
|
230
|
-
),
|
|
218
|
+
},
|
|
219
|
+
}),
|
|
231
220
|
};
|
|
232
221
|
|
|
233
222
|
functionConfig = {
|
|
@@ -240,7 +229,10 @@ describe("ModelAPI error handling", () => {
|
|
|
240
229
|
createPost: async (ctx, inputs) => {
|
|
241
230
|
new Permissions().allow();
|
|
242
231
|
|
|
243
|
-
const post = await models.post.create(
|
|
232
|
+
const post = await models.post.create({
|
|
233
|
+
id: KSUID.randomSync().string,
|
|
234
|
+
...inputs,
|
|
235
|
+
});
|
|
244
236
|
|
|
245
237
|
return post;
|
|
246
238
|
},
|
package/src/permissions.test.js
CHANGED
|
@@ -10,9 +10,6 @@ import { useDatabase } from "./database";
|
|
|
10
10
|
|
|
11
11
|
import { beforeEach, describe, expect, test } from "vitest";
|
|
12
12
|
|
|
13
|
-
process.env.KEEL_DB_CONN_TYPE = "pg";
|
|
14
|
-
process.env.KEEL_DB_CONN = `postgresql://postgres:postgres@localhost:5432/functions-runtime`;
|
|
15
|
-
|
|
16
13
|
let permissions;
|
|
17
14
|
let ctx = {};
|
|
18
15
|
let db = useDatabase();
|