prisma-mock 0.11.2 → 0.12.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.
@@ -14,6 +14,8 @@ function createHandleDefault() {
14
14
  registry.set("cuid", (0, cuid_1.default)());
15
15
  registry.set("uuid", (0, uuid_1.default)());
16
16
  registry.set("now", now_1.default);
17
+ registry.set("dbgenerated", (0, uuid_1.default)());
18
+ registry.set(`dbgenerated("gen_random_uuid()")`, (0, uuid_1.default)());
17
19
  return (prop, field, ref) => {
18
20
  const key = field.default.name;
19
21
  const val = registry.get(key)?.(prop, field, ref.data);
package/lib/indexes.js CHANGED
@@ -173,7 +173,8 @@ function createIndexes(isEnabled = true) {
173
173
  array.push(item);
174
174
  }
175
175
  else {
176
- const thisIdFieldNames = idFieldNames[tableName] || [];
176
+ // Filter out this field
177
+ const thisIdFieldNames = (idFieldNames[tableName] || []).filter(f => f !== fieldName);
177
178
  let hasFound = false;
178
179
  // Try to find and update existing item by ID
179
180
  for (let i = 0; i < array.length; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prisma-mock",
3
- "version": "0.11.2",
3
+ "version": "0.12.0",
4
4
  "description": "Mock prisma for unit testing database",
5
5
  "main": "lib/index.js",
6
6
  "repository": {