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.
- package/lib/defaults/index.js +2 -0
- package/lib/indexes.js +2 -1
- package/package.json +1 -1
package/lib/defaults/index.js
CHANGED
|
@@ -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
|
-
|
|
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++) {
|