@projectcaluma/ember-core 9.2.0 → 10.0.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/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # [@projectcaluma/ember-core-v10.0.0](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-core-v9.2.0...@projectcaluma/ember-core-v10.0.0) (2021-11-25)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **resolver:** fix concurrency issues with resolver helper ([7f09834](https://github.com/projectcaluma/ember-caluma/commit/7f09834b07437ecd91c548601b81360176717481))
7
+
8
+
9
+ ### chore
10
+
11
+ * **deps:** update dependencies and drop support for node 10 ([51d6dee](https://github.com/projectcaluma/ember-caluma/commit/51d6deeda9811518622ba0cefd8d3876651dab4f))
12
+
13
+
14
+ ### BREAKING CHANGES
15
+
16
+ * **deps:** Remove support for node v10
@@ -8,7 +8,7 @@ import {
8
8
  restartableTask,
9
9
  task,
10
10
  } from "ember-concurrency-decorators";
11
- import gql from "graphql-tag";
11
+ import { gql } from "graphql-tag";
12
12
 
13
13
  export default class BaseQuery {
14
14
  @queryManager apollo;
@@ -20,6 +20,8 @@ export default class PrivateResolver extends Helper {
20
20
  ? identifiers[0]
21
21
  : identifiers;
22
22
 
23
+ if (!identifier) return null;
24
+
23
25
  // The parameter for the helper changed so we need to recompute and store
24
26
  // the new parameter to remember it at the next computation
25
27
  if (identifier !== this._identifier) {
@@ -2,6 +2,7 @@ import { assert } from "@ember/debug";
2
2
  import { once } from "@ember/runloop";
3
3
  import Service, { inject as service } from "@ember/service";
4
4
  import { camelize } from "@ember/string";
5
+ import { task } from "ember-concurrency";
5
6
  import { pluralize } from "ember-inflector";
6
7
 
7
8
  /**
@@ -9,23 +10,22 @@ import { pluralize } from "ember-inflector";
9
10
  *
10
11
  * @function typeResolver
11
12
  * @param {"group"|"user"} type The type of the objects to resolve
12
- * @returns {Function} The decorator function that returns a method descriptor to resolve the requested objects
13
+ * @returns {Function} The decorator function that returns an enqueued task to resolve the requested objects
13
14
  */
14
15
  function typeResolver(type) {
15
- return function () {
16
- return {
17
- async value() {
18
- const methodName = camelize(`resolve-${pluralize(type)}`);
19
- const result = await this.calumaOptions[methodName]?.([
20
- ...this[type].identifiers,
21
- ]);
16
+ return task(function* () {
17
+ const identifiers = [...this[type].identifiers];
18
+ const callbacks = [...this[type].callbacks];
22
19
 
23
- this[type].callbacks.forEach((callback) => callback(result));
20
+ this[type] = undefined;
24
21
 
25
- this[type] = undefined;
26
- },
27
- };
28
- };
22
+ if (!identifiers.length) return;
23
+
24
+ const methodName = camelize(`resolve-${pluralize(type)}`);
25
+ const result = yield this.calumaOptions[methodName]?.(identifiers);
26
+
27
+ callbacks.forEach((callback) => callback(result));
28
+ }).enqueue();
29
29
  }
30
30
 
31
31
  export default class PrivateSchedulerService extends Service {
@@ -72,6 +72,6 @@ export default class PrivateSchedulerService extends Service {
72
72
  typeResolverName in this
73
73
  );
74
74
 
75
- once(this, typeResolverName);
75
+ once(this[typeResolverName], "perform");
76
76
  }
77
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-core",
3
- "version": "9.2.0",
3
+ "version": "10.0.0",
4
4
  "description": "Ember core addon for working with Caluma.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -40,9 +40,9 @@
40
40
  "@ember/test-helpers": "2.6.0",
41
41
  "@embroider/test-setup": "0.47.2",
42
42
  "@glimmer/component": "1.0.4",
43
- "@projectcaluma/ember-testing": "9.0.0",
43
+ "@projectcaluma/ember-testing": "9.1.0",
44
44
  "broccoli-asset-rev": "3.0.0",
45
- "ember-cli": "3.28.3",
45
+ "ember-cli": "3.28.4",
46
46
  "ember-cli-code-coverage": "1.0.3",
47
47
  "ember-cli-dependency-checker": "3.2.0",
48
48
  "ember-cli-inject-live-reload": "2.1.0",
@@ -63,10 +63,10 @@
63
63
  "npm-run-all": "4.1.5",
64
64
  "qunit": "2.17.2",
65
65
  "qunit-dom": "2.0.0",
66
- "webpack": "5.64.0"
66
+ "webpack": "5.64.1"
67
67
  },
68
68
  "engines": {
69
- "node": "10.* || >= 12"
69
+ "node": "12.* || 14.* || >= 16"
70
70
  },
71
71
  "ember": {
72
72
  "edition": "octane"