ember-m3
Advanced tools
Comparing version 5.0.2 to 5.0.3
@@ -83,2 +83,4 @@ // This lint error disables "this.attrs" everywhere. What could go wrong? | ||
const MegamorphicModelProxyHandler = class { | ||
getting = ''; | ||
get(target, key, receiver) { | ||
@@ -92,15 +94,41 @@ if (typeof key !== 'string' || key in target) { | ||
// tag. `Ember.get` is the only thing that does, actually, so we | ||
// have to use it. This is safe, because we already checked that the | ||
// property is not `in` the instance, so it will definitely call | ||
// `unknownProperty` and will not re-enter. | ||
// have to use it. However we need to be careful that we do not end | ||
// up in an infinite loop when relying on `Ember.get` calling | ||
// `.unknownProperty` | ||
// We have to use `target.get` instead of `receiver.get` because | ||
// `Ember.get` will access the property itself before calling | ||
// `unknownProperty` causing an infinite recursion | ||
// `Ember.get` is going to check whether `receiver` has the `key` | ||
// property defined, and if not, call `.unknownProperty` | ||
// The only potential downside here is that the value of `this` in our | ||
// `unknownProperty` handler will be set to the target MegamorphicModel | ||
// and not to the proxy, so we have to be careful when accessing WeakMaps | ||
// inside our `unknonwProperty` code, but there isn't a user visible impact | ||
return target.get(key); | ||
// However, the way that check is implemented differs slightly | ||
// between the DEBUG and production ember builds. | ||
// See: https://github.com/emberjs/ember.js/blob/3ce13cea235cde8a87d89473533c453523412764/packages/%40ember/-internals/metal/lib/property_get.ts#L110 | ||
// In DEBUG, Ember will have it's own debug proxies installed before this proxy, | ||
// and Ember's proxy will have stashed the `target` (in this case the m3 model) under a symbol. | ||
// See: https://github.com/emberjs/ember.js/blob/3ce13cea235cde8a87d89473533c453523412764/packages/%40ember/-internals/metal/lib/property_get.ts#L22 | ||
// To check whether it should call `unknonwnProperty`, `Ember.get` will check for property existance | ||
// on the stashed target. Because we have already checked that `key` is not `in target`, | ||
// we know the target check will return false, and we are not going re-enter and cause an infinite loop. | ||
// In production, without Ember's debug Proxies, we will go through | ||
// a more straightforward path, where `Ember.get` will do a `receiver[key]` check | ||
// to decided whether to call `.unknownProperty`. In that case, we need to make sure | ||
// that the second time this getter is called with the key, we return `undefined` | ||
// to trigger `unknownProperty`, as otherwise we will end up in an infinite loop | ||
// of repeatadly calling `receiver.get` | ||
if (this.getting === key) { | ||
return undefined; | ||
} | ||
let shouldReset = this.getting === ''; | ||
this.getting = key; | ||
try { | ||
return get(receiver, key); | ||
} finally { | ||
if (shouldReset) { | ||
this.getting = ''; | ||
} | ||
} | ||
} | ||
@@ -107,0 +135,0 @@ |
@@ -5,2 +5,12 @@ | ||
## v5.0.3 (2021-11-01) | ||
#### :bug: Bug Fix | ||
* [#1403](https://github.com/hjdivad/ember-m3/pull/1403) Fix for tracked properties updating when using m3 native properties ([@igorT](https://github.com/igorT)) | ||
#### Committers: 1 | ||
- Igor Terzic ([@igorT](https://github.com/igorT)) | ||
## v5.0.2 (2021-09-29) | ||
@@ -7,0 +17,0 @@ |
{ | ||
"name": "ember-m3", | ||
"version": "5.0.2", | ||
"version": "5.0.3", | ||
"isCanary": false, | ||
@@ -71,4 +71,4 @@ "description": "Alternative to @ember-data/model in which attributes and relationships are derived from API Payloads", | ||
"devDependencies": { | ||
"@commitlint/cli": "^13.2.0", | ||
"@commitlint/travis-cli": "^13.1.0", | ||
"@commitlint/cli": "^13.2.1", | ||
"@commitlint/travis-cli": "^13.2.1", | ||
"@ember-data/debug": "3.28.3", | ||
@@ -78,8 +78,9 @@ "@ember-data/model": "3.28.3", | ||
"@ember/optional-features": "^2.0.0", | ||
"@ember/test-helpers": "^2.4.2", | ||
"@ember/test-helpers": "^2.5.0", | ||
"@glimmer/component": "^1.0.4", | ||
"@malleatus/nyx": "^0.2.0", | ||
"@octokit/rest": "^18.11.2", | ||
"@octokit/rest": "^18.12.0", | ||
"babel-eslint": "^10.1.0", | ||
"broccoli-asset-rev": "^3.0.0", | ||
"ember-cli": "~3.28.0", | ||
"ember-cli": "~3.28.3", | ||
"ember-cli-dependency-checker": "^3.0.0", | ||
@@ -98,7 +99,7 @@ "ember-cli-htmlbars": "^5.7.1", | ||
"ember-lodash": "^4.17.5", | ||
"ember-qunit": "^5.1.4", | ||
"ember-qunit": "^5.1.5", | ||
"ember-qunit-assert-helpers": "^0.2.1", | ||
"ember-resolver": "^8.0.2", | ||
"ember-resolver": "^8.0.3", | ||
"ember-sinon": "^5.0.0", | ||
"ember-source": "^3.28.1", | ||
"ember-source": "^3.28.4", | ||
"ember-source-channel-url": "^3.0.0", | ||
@@ -110,5 +111,5 @@ "ember-try": "^1.4.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^3.4.1", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"husky": "^7.0.2", | ||
"lint-staged": "^11.1.2", | ||
"lint-staged": "^11.2.6", | ||
"loader.js": "^4.2.3", | ||
@@ -120,3 +121,3 @@ "moment": "^2.29.1", | ||
"release-it": "^14.11.6", | ||
"release-it-lerna-changelog": "^3.1.0", | ||
"release-it-lerna-changelog": "^4.0.1", | ||
"testem": "^3.5.0" | ||
@@ -160,5 +161,5 @@ }, | ||
"volta": { | ||
"node": "14.8.0", | ||
"node": "14.18.1", | ||
"yarn": "1.22.10" | ||
} | ||
} |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
233083
4932
48
13