@teamkeel/functions-runtime 0.375.1 → 0.377.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/package.json +1 -1
- package/src/ModelAPI.test.js +33 -0
- package/src/index.d.ts +2 -1
package/package.json
CHANGED
package/src/ModelAPI.test.js
CHANGED
|
@@ -71,6 +71,19 @@ test("ModelAPI.create", async () => {
|
|
|
71
71
|
expect(KSUID.parse(row.id).string).toEqual(row.id);
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
+
test("ModelAPI.create - non-ksuid id", async () => {
|
|
75
|
+
const row = await personAPI.create({
|
|
76
|
+
id: "not-a-ksuid",
|
|
77
|
+
name: "Jim",
|
|
78
|
+
married: false,
|
|
79
|
+
favouriteNumber: 10,
|
|
80
|
+
});
|
|
81
|
+
expect(row.name).toEqual("Jim");
|
|
82
|
+
expect(row.married).toEqual(false);
|
|
83
|
+
expect(row.favouriteNumber).toEqual(10);
|
|
84
|
+
expect(row.id).toEqual(row.id);
|
|
85
|
+
});
|
|
86
|
+
|
|
74
87
|
test("ModelAPI.create - throws if not not null constraint violation", async () => {
|
|
75
88
|
await expect(
|
|
76
89
|
authorAPI.create({
|
|
@@ -271,6 +284,26 @@ test("ModelAPI.findMany - oneOf", async () => {
|
|
|
271
284
|
expect(rows.map((x) => x.id).sort()).toEqual([billy.id, sally.id].sort());
|
|
272
285
|
});
|
|
273
286
|
|
|
287
|
+
test("ModelAPI.findMany - notEquals on id", async () => {
|
|
288
|
+
const p1 = await personAPI.create({
|
|
289
|
+
id: KSUID.randomSync().string,
|
|
290
|
+
favouriteNumber: 1,
|
|
291
|
+
});
|
|
292
|
+
const p2 = await personAPI.create({
|
|
293
|
+
id: KSUID.randomSync().string,
|
|
294
|
+
favouriteNumber: 2,
|
|
295
|
+
});
|
|
296
|
+
const rows = await personAPI.findMany({
|
|
297
|
+
where: {
|
|
298
|
+
id: {
|
|
299
|
+
notEquals: p1.id,
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
});
|
|
303
|
+
expect(rows.length).toEqual(1);
|
|
304
|
+
expect(rows[0].id).toEqual(p2.id);
|
|
305
|
+
});
|
|
306
|
+
|
|
274
307
|
test("ModelAPI.findMany - greaterThan", async () => {
|
|
275
308
|
await personAPI.create({
|
|
276
309
|
id: KSUID.randomSync().string,
|
package/src/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type IDWhereCondition = {
|
|
2
2
|
equals?: string | null;
|
|
3
|
+
notEquals?: string | null;
|
|
3
4
|
oneOf?: string[] | null;
|
|
4
5
|
};
|
|
5
6
|
|
|
@@ -8,8 +9,8 @@ export type StringWhereCondition = {
|
|
|
8
9
|
endsWith?: string | null;
|
|
9
10
|
oneOf?: string[] | null;
|
|
10
11
|
contains?: string | null;
|
|
11
|
-
notEquals?: string | null;
|
|
12
12
|
equals?: string | null;
|
|
13
|
+
notEquals?: string | null;
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
export type BooleanWhereCondition = {
|