@projectcaluma/ember-core 11.0.0-beta.2 → 11.0.0-beta.3

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,18 @@
1
+ # [@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)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **validation:** sync format validator validation with backend ([ee66968](https://github.com/projectcaluma/ember-caluma/commit/ee66968230b9f0e4c5a4df8bdb3f8e58b44b5b82))
7
+
8
+
9
+ ### BREAKING CHANGES
10
+
11
+ * **validation:** Use the `formatValidators` property of the backend to store and read
12
+ format validators instead of the `meta.formatValidators` so the backend
13
+ validates as well. For more information on how to migrate check the
14
+ migration guide to v11.
15
+
1
16
  # [@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
17
 
3
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-core",
3
- "version": "11.0.0-beta.2",
3
+ "version": "11.0.0-beta.3",
4
4
  "description": "Ember core addon for working with Caluma.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -14,17 +14,17 @@
14
14
  "test:ember-compatibility": "ember try:each"
15
15
  },
16
16
  "dependencies": {
17
- "@apollo/client": "^3.5.7",
17
+ "@apollo/client": "^3.5.8",
18
18
  "@glimmer/tracking": "^1.0.4",
19
19
  "ember-apollo-client": "^3.2.0",
20
- "ember-auto-import": "^2.3.0",
20
+ "ember-auto-import": "^2.4.0",
21
21
  "ember-cli-babel": "^7.26.11",
22
22
  "ember-cli-htmlbars": "^6.0.1",
23
23
  "ember-concurrency": "^2.2.0",
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.1.3",
27
+ "ember-resources": "^4.2.0",
28
28
  "graphql": "^15.8.0",
29
29
  "graphql-tag": "^2.12.6",
30
30
  "jexl": "^2.3.0",
@@ -34,18 +34,18 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@ember/optional-features": "2.0.0",
37
- "@ember/render-modifiers": "2.0.3",
37
+ "@ember/render-modifiers": "2.0.4",
38
38
  "@ember/test-helpers": "2.6.0",
39
- "@embroider/test-setup": "0.50.2",
40
- "@faker-js/faker": "6.0.0-alpha.3",
39
+ "@embroider/test-setup": "1.0.0",
40
+ "@faker-js/faker": "6.0.0-alpha.5",
41
41
  "@glimmer/component": "1.0.4",
42
- "@projectcaluma/ember-testing": "10.2.0-beta.1",
42
+ "@projectcaluma/ember-testing": "11.0.0-beta.1",
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": "2.3.1",
48
+ "ember-cli-mirage": "2.4.0",
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",
@@ -61,7 +61,7 @@
61
61
  "npm-run-all": "4.1.5",
62
62
  "qunit": "2.17.2",
63
63
  "qunit-dom": "2.0.0",
64
- "webpack": "5.66.0"
64
+ "webpack": "5.68.0"
65
65
  },
66
66
  "engines": {
67
67
  "node": "12.* || 14.* || >= 16"
@@ -1,12 +0,0 @@
1
- query AllFormatValidators {
2
- allFormatValidators {
3
- edges {
4
- node {
5
- slug
6
- name
7
- regex
8
- errorMsg
9
- }
10
- }
11
- }
12
- }
@@ -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";