pinia-orm-edge 1.8.1-28575925.676e9a0 → 1.8.1-28575932.f109405

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/dist/index.cjs CHANGED
@@ -2295,7 +2295,9 @@ class HasMany extends Relation {
2295
2295
  match(relation, models, query) {
2296
2296
  const dictionary = this.buildDictionary(query.get(false));
2297
2297
  models.forEach((model) => {
2298
- const key = model[this.getKey(this.localKey)];
2298
+ const key = this.getKey(
2299
+ Utils.isArray(this.localKey) ? this.localKey.map((key2) => model[key2]) : model[this.localKey]
2300
+ );
2299
2301
  dictionary[key] ? model.$setRelation(relation, dictionary[key]) : model.$setRelation(relation, []);
2300
2302
  });
2301
2303
  }
@@ -2304,8 +2306,10 @@ class HasMany extends Relation {
2304
2306
  */
2305
2307
  buildDictionary(results) {
2306
2308
  return this.mapToDictionary(results, (result) => {
2307
- const key = this.getKey(this.foreignKey);
2308
- return [result[key], result];
2309
+ const key = this.getKey(
2310
+ Utils.isArray(this.foreignKey) ? this.foreignKey.map((key2) => result[key2]) : result[this.foreignKey]
2311
+ );
2312
+ return [key, result];
2309
2313
  });
2310
2314
  }
2311
2315
  /**
package/dist/index.mjs CHANGED
@@ -2293,7 +2293,9 @@ class HasMany extends Relation {
2293
2293
  match(relation, models, query) {
2294
2294
  const dictionary = this.buildDictionary(query.get(false));
2295
2295
  models.forEach((model) => {
2296
- const key = model[this.getKey(this.localKey)];
2296
+ const key = this.getKey(
2297
+ isArray(this.localKey) ? this.localKey.map((key2) => model[key2]) : model[this.localKey]
2298
+ );
2297
2299
  dictionary[key] ? model.$setRelation(relation, dictionary[key]) : model.$setRelation(relation, []);
2298
2300
  });
2299
2301
  }
@@ -2302,8 +2304,10 @@ class HasMany extends Relation {
2302
2304
  */
2303
2305
  buildDictionary(results) {
2304
2306
  return this.mapToDictionary(results, (result) => {
2305
- const key = this.getKey(this.foreignKey);
2306
- return [result[key], result];
2307
+ const key = this.getKey(
2308
+ isArray(this.foreignKey) ? this.foreignKey.map((key2) => result[key2]) : result[this.foreignKey]
2309
+ );
2310
+ return [key, result];
2307
2311
  });
2308
2312
  }
2309
2313
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinia-orm-edge",
3
- "version": "1.8.1-28575925.676e9a0",
3
+ "version": "1.8.1-28575932.f109405",
4
4
  "description": "The Pinia plugin to enable Object-Relational Mapping access to the Pinia Store.",
5
5
  "keywords": [
6
6
  "vue",
@@ -46,7 +46,7 @@
46
46
  "pinia": "^2.1.6"
47
47
  },
48
48
  "dependencies": {
49
- "@pinia-orm/normalizr": "npm:@pinia-orm/normalizr-edge@1.8.1-28575925.676e9a0"
49
+ "@pinia-orm/normalizr": "npm:@pinia-orm/normalizr-edge@1.8.1-28575932.f109405"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@nuxtjs/eslint-config-typescript": "^12.1.0",