modelmix 2.2.2 → 2.2.4
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/index.js +8 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -28,7 +28,7 @@ class ModelMix {
|
|
|
28
28
|
return this;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
create(modelKey,
|
|
31
|
+
create(modelKey, args = { config: {}, options: {} }) {
|
|
32
32
|
const modelEntry = Object.values(this.models).find(entry =>
|
|
33
33
|
entry.config.prefix.some(p => modelKey.startsWith(p))
|
|
34
34
|
);
|
|
@@ -40,10 +40,15 @@ class ModelMix {
|
|
|
40
40
|
const options = {
|
|
41
41
|
...this.defaultOptions,
|
|
42
42
|
...modelEntry.options,
|
|
43
|
-
...
|
|
43
|
+
...args.options,
|
|
44
44
|
model: modelKey
|
|
45
45
|
};
|
|
46
|
-
|
|
46
|
+
|
|
47
|
+
const config = {
|
|
48
|
+
...this.config,
|
|
49
|
+
...modelEntry.config,
|
|
50
|
+
...args.config
|
|
51
|
+
};
|
|
47
52
|
|
|
48
53
|
return new MessageHandler(this, modelEntry, options, config);
|
|
49
54
|
}
|