@projectcaluma/ember-core 11.0.0-beta.2 → 11.0.0-beta.5
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 +43 -0
- package/addon/caluma-query/models/case.js +4 -4
- package/addon/caluma-query/models/index.js +5 -5
- package/addon/caluma-query/models/work-item.js +5 -5
- package/addon/services/-scheduler.js +27 -5
- package/addon/services/caluma-options.js +0 -27
- package/addon/utils/slugify.js +1 -1
- package/blueprints/@projectcaluma/ember-core/index.js +1 -1
- package/package.json +13 -13
- package/addon/gql/queries/all-format-validators.graphql +0 -12
- package/addon/services/validator.js +0 -66
- package/app/services/validator.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
1
|
+
# [@projectcaluma/ember-core-v11.0.0-beta.5](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-core-v11.0.0-beta.4...@projectcaluma/ember-core-v11.0.0-beta.5) (2022-03-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **core:** ensure only language code of the locale is passed to slugify ([02e4506](https://github.com/projectcaluma/ember-caluma/commit/02e45064b9171de85af5b9e1a890d5207a6ec252))
|
|
7
|
+
* **core:** handle null values in raw dates ([9c73d0b](https://github.com/projectcaluma/ember-caluma/commit/9c73d0b3853b154b5edc84bcf2c1227ffb825116)), closes [#1826](https://github.com/projectcaluma/ember-caluma/issues/1826)
|
|
8
|
+
* **distribution:** fix sorting after group names in navigation ([2299d3b](https://github.com/projectcaluma/ember-caluma/commit/2299d3b0e265204ab6747dbdc6a8b64fc22f247f))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **form:** support passing component override classes ([9409c7c](https://github.com/projectcaluma/ember-caluma/commit/9409c7cb5901dcdffec1c0294046da64b74b9922))
|
|
14
|
+
|
|
15
|
+
# [@projectcaluma/ember-core-v11.0.0-beta.4](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-core-v11.0.0-beta.3...@projectcaluma/ember-core-v11.0.0-beta.4) (2022-02-07)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **core:** remove usage of moment and remove momentAttr for models ([92f3651](https://github.com/projectcaluma/ember-caluma/commit/92f365114900fe9f9ad5b49c9e9eed97b25991b5))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### BREAKING CHANGES
|
|
24
|
+
|
|
25
|
+
* **core:** The `momentAttr` decorator for models was replaced with
|
|
26
|
+
a `dateAttr` that returns a plain JS date object. Predefined date
|
|
27
|
+
attributes on models are now JS dates instead of moment objects.
|
|
28
|
+
|
|
29
|
+
# [@projectcaluma/ember-core-v11.0.0-beta.3](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-core-v11.0.0-beta.2...@projectcaluma/ember-core-v11.0.0-beta.3) (2022-02-03)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* **validation:** sync format validator validation with backend ([ee66968](https://github.com/projectcaluma/ember-caluma/commit/ee66968230b9f0e4c5a4df8bdb3f8e58b44b5b82))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### BREAKING CHANGES
|
|
38
|
+
|
|
39
|
+
* **validation:** Use the `formatValidators` property of the backend to store and read
|
|
40
|
+
format validators instead of the `meta.formatValidators` so the backend
|
|
41
|
+
validates as well. For more information on how to migrate check the
|
|
42
|
+
migration guide to v11.
|
|
43
|
+
|
|
1
44
|
# [@projectcaluma/ember-core-v11.0.0-beta.2](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-core-v11.0.0-beta.1...@projectcaluma/ember-core-v11.0.0-beta.2) (2022-01-18)
|
|
2
45
|
|
|
3
46
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { inject as service } from "@ember/service";
|
|
2
2
|
|
|
3
3
|
import CalumaQueryModel, {
|
|
4
|
-
|
|
4
|
+
dateAttr,
|
|
5
5
|
} from "@projectcaluma/ember-core/caluma-query/models/index";
|
|
6
6
|
|
|
7
7
|
export default class CaseModel extends CalumaQueryModel {
|
|
8
8
|
@service intl;
|
|
9
9
|
|
|
10
|
-
@
|
|
11
|
-
@
|
|
12
|
-
@
|
|
10
|
+
@dateAttr createdAt;
|
|
11
|
+
@dateAttr modifiedAt;
|
|
12
|
+
@dateAttr closedAt;
|
|
13
13
|
|
|
14
14
|
get status() {
|
|
15
15
|
return this.intl.t(`caluma.caluma-query.case.status.${this.raw.status}`);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import cloneDeep from "lodash.clonedeep";
|
|
2
|
-
import moment from "moment";
|
|
3
2
|
|
|
4
3
|
import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
|
|
5
4
|
|
|
@@ -11,15 +10,16 @@ export function uuidAttr(target, name) {
|
|
|
11
10
|
};
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
export function
|
|
13
|
+
export function dateAttr(target, name) {
|
|
15
14
|
return {
|
|
16
15
|
get() {
|
|
17
|
-
const
|
|
16
|
+
const raw = this.raw[name];
|
|
17
|
+
const date = raw ? new Date(raw) : null;
|
|
18
18
|
|
|
19
|
-
return date
|
|
19
|
+
return raw && !isNaN(date) ? date : null;
|
|
20
20
|
},
|
|
21
21
|
set(value) {
|
|
22
|
-
if (value
|
|
22
|
+
if (!isNaN(value)) {
|
|
23
23
|
this.raw[name] = value.toISOString();
|
|
24
24
|
}
|
|
25
25
|
},
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { inject as service } from "@ember/service";
|
|
2
2
|
|
|
3
3
|
import CalumaQueryModel, {
|
|
4
|
-
|
|
4
|
+
dateAttr,
|
|
5
5
|
} from "@projectcaluma/ember-core/caluma-query/models/index";
|
|
6
6
|
|
|
7
7
|
export default class WorkItemModel extends CalumaQueryModel {
|
|
8
8
|
@service intl;
|
|
9
9
|
|
|
10
|
-
@
|
|
11
|
-
@
|
|
12
|
-
@
|
|
13
|
-
@
|
|
10
|
+
@dateAttr createdAt;
|
|
11
|
+
@dateAttr modifiedAt;
|
|
12
|
+
@dateAttr closedAt;
|
|
13
|
+
@dateAttr deadline;
|
|
14
14
|
|
|
15
15
|
get status() {
|
|
16
16
|
return this.intl.t(
|
|
@@ -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 { tracked } from "@glimmer/tracking";
|
|
5
6
|
import { task } from "ember-concurrency";
|
|
6
7
|
import { pluralize } from "ember-inflector";
|
|
7
8
|
|
|
@@ -14,25 +15,46 @@ import { pluralize } from "ember-inflector";
|
|
|
14
15
|
*/
|
|
15
16
|
function typeResolver(type) {
|
|
16
17
|
return task(function* () {
|
|
17
|
-
const identifiers = [...this[type]
|
|
18
|
-
const callbacks = [...this[type]
|
|
18
|
+
const identifiers = [...(this[type]?.identifiers ?? [])];
|
|
19
|
+
const callbacks = [...(this[type]?.callbacks ?? [])];
|
|
19
20
|
|
|
20
21
|
this[type] = undefined;
|
|
21
22
|
|
|
22
23
|
if (!identifiers.length) return;
|
|
23
24
|
|
|
25
|
+
const cached = this[`${type}Cache`];
|
|
26
|
+
const uncachedIdentifiers = identifiers.filter(
|
|
27
|
+
(identifier) =>
|
|
28
|
+
!cached
|
|
29
|
+
.map((resolved) =>
|
|
30
|
+
String(resolved[this.calumaOptions[`${type}IdentifierProperty`]])
|
|
31
|
+
)
|
|
32
|
+
.includes(String(identifier))
|
|
33
|
+
);
|
|
34
|
+
|
|
24
35
|
const methodName = camelize(`resolve-${pluralize(type)}`);
|
|
25
|
-
const result =
|
|
36
|
+
const result = uncachedIdentifiers.length
|
|
37
|
+
? yield this.calumaOptions[methodName]?.(uncachedIdentifiers)
|
|
38
|
+
: [];
|
|
39
|
+
|
|
40
|
+
const allResults = [...cached, ...(result?.toArray?.() ?? result ?? [])];
|
|
26
41
|
|
|
27
|
-
|
|
42
|
+
if (result?.length) {
|
|
43
|
+
this[`${type}Cache`] = allResults;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
yield Promise.all(callbacks.map((callback) => callback(allResults)));
|
|
28
47
|
|
|
29
|
-
return
|
|
48
|
+
return allResults;
|
|
30
49
|
}).enqueue();
|
|
31
50
|
}
|
|
32
51
|
|
|
33
52
|
export default class PrivateSchedulerService extends Service {
|
|
34
53
|
@service calumaOptions;
|
|
35
54
|
|
|
55
|
+
@tracked groupCache = [];
|
|
56
|
+
@tracked userCache = [];
|
|
57
|
+
|
|
36
58
|
@typeResolver("group") resolveGroup;
|
|
37
59
|
@typeResolver("user") resolveUser;
|
|
38
60
|
|
|
@@ -18,33 +18,6 @@ export default class CalumaOptionsService extends Service {
|
|
|
18
18
|
|
|
19
19
|
@tracked currentGroupId;
|
|
20
20
|
|
|
21
|
-
constructor(...args) {
|
|
22
|
-
super(...args);
|
|
23
|
-
|
|
24
|
-
this.registerComponentOverride({
|
|
25
|
-
label: this.intl.t(
|
|
26
|
-
"caluma.form-builder.question.widgetOverrides.powerselect"
|
|
27
|
-
),
|
|
28
|
-
component: "cf-field/input/powerselect",
|
|
29
|
-
types: [
|
|
30
|
-
"ChoiceQuestion",
|
|
31
|
-
"MultipleChoiceQuestion",
|
|
32
|
-
"DynamicChoiceQuestion",
|
|
33
|
-
"DynamicMultipleChoiceQuestion",
|
|
34
|
-
],
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
this.registerComponentOverride({
|
|
38
|
-
label: this.intl.t("caluma.form-builder.question.widgetOverrides.hidden"),
|
|
39
|
-
component: "cf-field/input/hidden",
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
this.registerComponentOverride({
|
|
43
|
-
component: "cfb-form-editor/question/default/table",
|
|
44
|
-
types: [],
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
21
|
_namespace = null;
|
|
49
22
|
_overrides = {};
|
|
50
23
|
|
package/addon/utils/slugify.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@projectcaluma/ember-core",
|
|
3
|
-
"version": "11.0.0-beta.
|
|
3
|
+
"version": "11.0.0-beta.5",
|
|
4
4
|
"description": "Ember core addon for working with Caluma.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -14,38 +14,38 @@
|
|
|
14
14
|
"test:ember-compatibility": "ember try:each"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@apollo/client": "^3.5.
|
|
17
|
+
"@apollo/client": "^3.5.10",
|
|
18
18
|
"@glimmer/tracking": "^1.0.4",
|
|
19
19
|
"ember-apollo-client": "^3.2.0",
|
|
20
|
-
"ember-auto-import": "^2.
|
|
20
|
+
"ember-auto-import": "^2.4.0",
|
|
21
21
|
"ember-cli-babel": "^7.26.11",
|
|
22
22
|
"ember-cli-htmlbars": "^6.0.1",
|
|
23
|
-
"ember-concurrency": "^2.2.
|
|
23
|
+
"ember-concurrency": "^2.2.1",
|
|
24
24
|
"ember-fetch": "^8.1.1",
|
|
25
25
|
"ember-inflector": "^4.0.2",
|
|
26
26
|
"ember-intl": "^5.7.2",
|
|
27
|
-
"ember-resources": "^4.
|
|
27
|
+
"ember-resources": "^4.4.0",
|
|
28
28
|
"graphql": "^15.8.0",
|
|
29
29
|
"graphql-tag": "^2.12.6",
|
|
30
30
|
"jexl": "^2.3.0",
|
|
31
31
|
"lodash.clonedeep": "^4.5.0",
|
|
32
|
-
"moment": "^2.29.1",
|
|
33
32
|
"slugify": "^1.6.5"
|
|
34
33
|
},
|
|
35
34
|
"devDependencies": {
|
|
36
35
|
"@ember/optional-features": "2.0.0",
|
|
37
|
-
"@ember/render-modifiers": "2.0.
|
|
36
|
+
"@ember/render-modifiers": "2.0.4",
|
|
38
37
|
"@ember/test-helpers": "2.6.0",
|
|
39
|
-
"@embroider/test-setup": "
|
|
40
|
-
"@
|
|
38
|
+
"@embroider/test-setup": "1.5.0",
|
|
39
|
+
"@embroider/util": "^1.5.0",
|
|
40
|
+
"@faker-js/faker": "6.0.0-beta.0",
|
|
41
41
|
"@glimmer/component": "1.0.4",
|
|
42
|
-
"@projectcaluma/ember-testing": "
|
|
42
|
+
"@projectcaluma/ember-testing": "11.0.0-beta.4",
|
|
43
43
|
"broccoli-asset-rev": "3.0.0",
|
|
44
44
|
"ember-cli": "3.28.5",
|
|
45
45
|
"ember-cli-code-coverage": "1.0.3",
|
|
46
46
|
"ember-cli-dependency-checker": "3.2.0",
|
|
47
47
|
"ember-cli-inject-live-reload": "2.1.0",
|
|
48
|
-
"ember-cli-mirage": "
|
|
48
|
+
"ember-cli-mirage": "3.0.0-alpha.2",
|
|
49
49
|
"ember-cli-sri": "2.1.1",
|
|
50
50
|
"ember-cli-terser": "4.0.2",
|
|
51
51
|
"ember-disable-prototype-extensions": "1.1.3",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"ember-try": "2.0.0",
|
|
60
60
|
"loader.js": "4.7.0",
|
|
61
61
|
"npm-run-all": "4.1.5",
|
|
62
|
-
"qunit": "2.
|
|
62
|
+
"qunit": "2.18.0",
|
|
63
63
|
"qunit-dom": "2.0.0",
|
|
64
|
-
"webpack": "5.
|
|
64
|
+
"webpack": "5.70.0"
|
|
65
65
|
},
|
|
66
66
|
"engines": {
|
|
67
67
|
"node": "12.* || 14.* || >= 16"
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { assert } from "@ember/debug";
|
|
2
|
-
import Service from "@ember/service";
|
|
3
|
-
import { isEmpty } from "@ember/utils";
|
|
4
|
-
import { queryManager } from "ember-apollo-client";
|
|
5
|
-
import { enqueueTask } from "ember-concurrency";
|
|
6
|
-
|
|
7
|
-
import allFormatValidatorsQuery from "@projectcaluma/ember-core/gql/queries/all-format-validators.graphql";
|
|
8
|
-
|
|
9
|
-
export default class ValidatorService extends Service {
|
|
10
|
-
@queryManager() apollo;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Tests a value against one or multiple regular expressions.
|
|
14
|
-
*
|
|
15
|
-
* ```js
|
|
16
|
-
* await this.validator.validate("foo@example.com", ["email", "lowercase"]);
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* @param {String} value The value to be tested.
|
|
20
|
-
* @param {String[]} slugs A list of tests (via slug) to run.
|
|
21
|
-
* @return {RSVP.Promise}
|
|
22
|
-
*/
|
|
23
|
-
async validate(value, slugs) {
|
|
24
|
-
if (isEmpty(value)) {
|
|
25
|
-
// empty values should not be validated since they are handled by the
|
|
26
|
-
// requiredness validation
|
|
27
|
-
return slugs.map(() => true);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const validators =
|
|
31
|
-
this.validators.lastSuccessful?.value ||
|
|
32
|
-
(await this.validators.last)?.value ||
|
|
33
|
-
(await this.validators.perform());
|
|
34
|
-
|
|
35
|
-
return slugs.map((slug) => {
|
|
36
|
-
const validator = validators.find((validator) => validator.slug === slug);
|
|
37
|
-
|
|
38
|
-
assert(`No validator found with the slug "${slug}".`, validator);
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
validator.regex.test(value) || {
|
|
42
|
-
type: "format",
|
|
43
|
-
message: undefined,
|
|
44
|
-
context: { errorMsg: validator.errorMsg },
|
|
45
|
-
value,
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
@enqueueTask
|
|
52
|
-
*validators() {
|
|
53
|
-
const raw = yield this.apollo.watchQuery(
|
|
54
|
-
{ query: allFormatValidatorsQuery },
|
|
55
|
-
"allFormatValidators.edges"
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
return raw.map((rawValidator) => {
|
|
59
|
-
return {
|
|
60
|
-
slug: rawValidator.node.slug,
|
|
61
|
-
regex: new RegExp(rawValidator.node.regex),
|
|
62
|
-
errorMsg: rawValidator.node.errorMsg,
|
|
63
|
-
};
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "@projectcaluma/ember-core/services/validator";
|