@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.
@@ -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
- "post",
216
- () => {
217
- return {
218
- id: KSUID.randomSync().string,
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(inputs);
232
+ const post = await models.post.create({
233
+ id: KSUID.randomSync().string,
234
+ ...inputs,
235
+ });
244
236
 
245
237
  return post;
246
238
  },
@@ -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();
package/vite.config.js ADDED
@@ -0,0 +1,7 @@
1
+ import { defineConfig, loadEnv } from "vite";
2
+
3
+ export default ({ mode }) => {
4
+ process.env = { ...process.env, ...loadEnv(mode, process.cwd(), "") };
5
+
6
+ return defineConfig({});
7
+ };