@projectcaluma/ember-core 11.0.0-beta.6 → 11.0.0-beta.7

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 CHANGED
@@ -1,3 +1,10 @@
1
+ # [@projectcaluma/ember-core-v11.0.0-beta.7](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-core-v11.0.0-beta.6...@projectcaluma/ember-core-v11.0.0-beta.7) (2022-05-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **resources:** fix deprecations of ember-resources ([7a84c5c](https://github.com/projectcaluma/ember-caluma/commit/7a84c5c78d5b28f7b5393c64722907728dd5f42b))
7
+
1
8
  # [@projectcaluma/ember-core-v11.0.0-beta.6](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-core-v11.0.0-beta.5...@projectcaluma/ember-core-v11.0.0-beta.6) (2022-03-23)
2
9
 
3
10
 
@@ -1,44 +1,31 @@
1
1
  export default {
2
- Node: [
3
- "Workflow",
4
- "Form",
5
- "Document",
6
- "Case",
7
- "WorkItem",
8
- "Flow",
9
- "DynamicOption",
10
- "Option",
2
+ Question: [
11
3
  "TextQuestion",
12
- "StringAnswer",
13
4
  "ChoiceQuestion",
14
5
  "MultipleChoiceQuestion",
15
- "ListAnswer",
16
6
  "DynamicChoiceQuestion",
17
7
  "DynamicMultipleChoiceQuestion",
18
8
  "TextareaQuestion",
19
9
  "FloatQuestion",
20
- "FloatAnswer",
21
10
  "IntegerQuestion",
22
- "IntegerAnswer",
23
11
  "DateQuestion",
24
- "DateAnswer",
25
12
  "TableQuestion",
26
- "TableAnswer",
27
13
  "FormQuestion",
28
14
  "FileQuestion",
29
15
  "StaticQuestion",
30
- "FileAnswer",
31
- "File",
32
16
  "CalculatedFloatQuestion",
33
17
  "ActionButtonQuestion",
34
- "SimpleTask",
35
- "CompleteWorkflowFormTask",
36
- "CompleteTaskFormTask",
37
18
  ],
38
- Task: ["SimpleTask", "CompleteWorkflowFormTask", "CompleteTaskFormTask"],
39
- Question: [
19
+ Node: [
40
20
  "TextQuestion",
21
+ "Form",
22
+ "Document",
23
+ "Case",
24
+ "Workflow",
25
+ "Flow",
26
+ "WorkItem",
41
27
  "ChoiceQuestion",
28
+ "Option",
42
29
  "MultipleChoiceQuestion",
43
30
  "DynamicChoiceQuestion",
44
31
  "DynamicMultipleChoiceQuestion",
@@ -50,17 +37,33 @@ export default {
50
37
  "FormQuestion",
51
38
  "FileQuestion",
52
39
  "StaticQuestion",
40
+ "StringAnswer",
41
+ "ListAnswer",
42
+ "IntegerAnswer",
43
+ "FloatAnswer",
44
+ "DateAnswer",
45
+ "TableAnswer",
46
+ "FileAnswer",
47
+ "File",
53
48
  "CalculatedFloatQuestion",
54
49
  "ActionButtonQuestion",
50
+ "SimpleTask",
51
+ "CompleteWorkflowFormTask",
52
+ "CompleteTaskFormTask",
53
+ "AnalyticsTable",
54
+ "AvailableField",
55
+ "AnalyticsField",
56
+ "DynamicOption",
55
57
  ],
56
58
  Answer: [
57
59
  "StringAnswer",
58
60
  "ListAnswer",
59
- "FloatAnswer",
60
61
  "IntegerAnswer",
62
+ "FloatAnswer",
61
63
  "DateAnswer",
62
64
  "TableAnswer",
63
65
  "FileAnswer",
64
66
  ],
67
+ Task: ["SimpleTask", "CompleteWorkflowFormTask", "CompleteTaskFormTask"],
65
68
  DynamicQuestion: ["DynamicChoiceQuestion", "DynamicMultipleChoiceQuestion"],
66
69
  };
@@ -1,13 +1,9 @@
1
1
  import { getOwner, setOwner } from "@ember/application";
2
- import { useResource } from "ember-resources";
3
2
 
4
3
  import CalumaQueryResource from "@projectcaluma/ember-core/caluma-query/resource";
5
4
 
6
5
  export function useCalumaQuery(destroyable, query, thunk) {
7
- return useResource(destroyable, CalumaQueryResource, () => ({
8
- query,
9
- ...thunk(),
10
- }));
6
+ return CalumaQueryResource.from(destroyable, () => ({ query, ...thunk() }));
11
7
  }
12
8
 
13
9
  export default function calumaQuery({ query, options = {} }) {
@@ -1,47 +1,48 @@
1
1
  import { getOwner, setOwner } from "@ember/application";
2
- import { destroy } from "@ember/destroyable";
2
+ import { destroy, registerDestructor } from "@ember/destroyable";
3
3
  import { action } from "@ember/object";
4
4
  import { tracked } from "@glimmer/tracking";
5
- import { LifecycleResource } from "ember-resources";
5
+ import { Resource } from "ember-resources/core";
6
6
 
7
- export default class CalumaQueryResource extends LifecycleResource {
8
- @tracked query;
9
-
10
- setup() {
11
- const { query, options, queryArgs } = this._parsedArgs;
12
-
13
- this.query = query(options);
14
- setOwner(this.query, getOwner(this));
7
+ const MUTABLE_OPTIONS = [
8
+ "pageSize",
9
+ "processAll",
10
+ "processNew",
11
+ "queryOptions",
12
+ ];
15
13
 
16
- this.query.fetch(queryArgs);
17
- }
14
+ export default class CalumaQueryResource extends Resource {
15
+ @tracked query;
18
16
 
19
- update() {
20
- this._updateOptions();
17
+ didSetup = false;
21
18
 
22
- this.query.fetch(this._parsedArgs.queryArgs);
23
- }
19
+ constructor(owner, args) {
20
+ super(owner, args);
24
21
 
25
- teardown() {
26
- destroy(this.query);
22
+ registerDestructor(this, () => {
23
+ destroy(this.query);
24
+ });
27
25
  }
28
26
 
29
- get _parsedArgs() {
30
- const { query, options = {}, ...queryArgs } = this.args.named;
31
-
32
- return { query, options, queryArgs };
33
- }
27
+ modify(_, { options = {}, query, ...args }) {
28
+ if (!this.didSetup) {
29
+ // initialize the caluma query with the given options
30
+ this.query = query(options);
31
+ setOwner(this.query, getOwner(this));
34
32
 
35
- _updateOptions() {
36
- ["pageSize", "processAll", "processNew", "queryOptions"].forEach(
37
- (optionKey) => {
38
- const option = this._parsedArgs.options[optionKey];
33
+ this.didSetup = true;
34
+ } else {
35
+ // update changed options on the caluma query
36
+ MUTABLE_OPTIONS.forEach((optionKey) => {
37
+ const option = options[optionKey];
39
38
 
40
39
  if (option !== undefined && option !== this.query[optionKey]) {
41
40
  this.query[optionKey] = option;
42
41
  }
43
- }
44
- );
42
+ });
43
+ }
44
+
45
+ this.query.fetch(args);
45
46
  }
46
47
 
47
48
  @action
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-core",
3
- "version": "11.0.0-beta.6",
3
+ "version": "11.0.0-beta.7",
4
4
  "description": "Ember core addon for working with Caluma.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -14,18 +14,18 @@
14
14
  "test:ember-compatibility": "ember try:each"
15
15
  },
16
16
  "dependencies": {
17
- "@apollo/client": "^3.5.10",
17
+ "@apollo/client": "^3.6.2",
18
18
  "@ember/string": "^3.0.0",
19
- "@glimmer/tracking": "^1.0.4",
19
+ "@glimmer/tracking": "^1.1.2",
20
20
  "ember-apollo-client": "^4.0.2",
21
- "ember-auto-import": "^2.4.0",
21
+ "ember-auto-import": "^2.4.1",
22
22
  "ember-cli-babel": "^7.26.11",
23
23
  "ember-cli-htmlbars": "^6.0.1",
24
24
  "ember-concurrency": "^2.2.1",
25
25
  "ember-fetch": "^8.1.1",
26
26
  "ember-inflector": "^4.0.2",
27
27
  "ember-intl": "^5.7.2",
28
- "ember-resources": "^4.4.0",
28
+ "ember-resources": "^4.7.1",
29
29
  "graphql": "^15.8.0",
30
30
  "graphql-tag": "^2.12.6",
31
31
  "jexl": "^2.3.0",
@@ -35,18 +35,18 @@
35
35
  "devDependencies": {
36
36
  "@ember/optional-features": "2.0.0",
37
37
  "@ember/render-modifiers": "2.0.4",
38
- "@ember/test-helpers": "2.6.0",
39
- "@embroider/test-setup": "1.5.0",
40
- "@embroider/util": "^1.5.0",
41
- "@faker-js/faker": "6.0.0",
42
- "@glimmer/component": "1.0.4",
43
- "@projectcaluma/ember-testing": "11.0.0-beta.5",
38
+ "@ember/test-helpers": "2.7.0",
39
+ "@embroider/test-setup": "1.6.0",
40
+ "@embroider/util": "^1.6.0",
41
+ "@faker-js/faker": "6.3.1",
42
+ "@glimmer/component": "1.1.2",
43
+ "@projectcaluma/ember-testing": "11.0.0-beta.7",
44
44
  "broccoli-asset-rev": "3.0.0",
45
45
  "ember-cli": "3.28.5",
46
46
  "ember-cli-code-coverage": "1.0.3",
47
- "ember-cli-dependency-checker": "3.2.0",
47
+ "ember-cli-dependency-checker": "3.3.1",
48
48
  "ember-cli-inject-live-reload": "2.1.0",
49
- "ember-cli-mirage": "3.0.0-alpha.2",
49
+ "ember-cli-mirage": "3.0.0-alpha.3",
50
50
  "ember-cli-sri": "2.1.1",
51
51
  "ember-cli-terser": "4.0.2",
52
52
  "ember-disable-prototype-extensions": "1.1.3",
@@ -55,14 +55,14 @@
55
55
  "ember-maybe-import-regenerator": "1.0.0",
56
56
  "ember-qunit": "5.1.5",
57
57
  "ember-resolver": "8.0.3",
58
- "ember-source": "3.28.8",
58
+ "ember-source": "3.28.9",
59
59
  "ember-source-channel-url": "3.0.0",
60
60
  "ember-try": "2.0.0",
61
61
  "loader.js": "4.7.0",
62
62
  "npm-run-all": "4.1.5",
63
- "qunit": "2.18.0",
63
+ "qunit": "2.19.1",
64
64
  "qunit-dom": "2.0.0",
65
- "webpack": "5.70.0"
65
+ "webpack": "5.72.0"
66
66
  },
67
67
  "engines": {
68
68
  "node": "12.* || 14.* || >= 16"