@chain-registry/workflows 1.44.0 → 1.45.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/esm/validator.js CHANGED
@@ -7,6 +7,7 @@ export class SchemaValidator {
7
7
  ajv;
8
8
  registry;
9
9
  options;
10
+ failures = 0;
10
11
  constructor(registry, options) {
11
12
  const { useStrict = false, allErrors = true, useDefaults = true, draft = '2019-09' } = options ?? {};
12
13
  this.options = {
@@ -75,9 +76,13 @@ export class SchemaValidator {
75
76
  throw e;
76
77
  }
77
78
  });
79
+ if (this.options.allErrors && this.failures > 0) {
80
+ throw new Error('❌ Validation Failed.');
81
+ }
78
82
  }
79
83
  validateJsonSchema(data, title, validate, verbose) {
80
84
  if (!validate(data.content)) {
85
+ this.failures++;
81
86
  console.error(chalk.red(`❌ Validation errors for ${chalk.bold(title)} in file ${chalk.magenta(data.path)}:`));
82
87
  validate.errors?.forEach(error => {
83
88
  console.error(chalk.red(` ➡️ ${error.instancePath} ${error.message}`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chain-registry/workflows",
3
- "version": "1.44.0",
3
+ "version": "1.45.0",
4
4
  "description": "Chain Registry Workflows",
5
5
  "author": "Dan Lynch <pyramation@gmail.com>",
6
6
  "homepage": "https://github.com/cosmology-tech/chain-registry",
@@ -31,7 +31,7 @@
31
31
  "@types/sha.js": "^2.4.0"
32
32
  },
33
33
  "dependencies": {
34
- "@chain-registry/interfaces": "^0.43.0",
34
+ "@chain-registry/interfaces": "^0.44.0",
35
35
  "ajv": "^8.12.0",
36
36
  "ajv-formats": "^3.0.1",
37
37
  "bignumber.js": "9.1.2",
@@ -51,5 +51,5 @@
51
51
  "cosmos",
52
52
  "interchain"
53
53
  ],
54
- "gitHead": "b171e31c9d099235ad33d2a78b8d9d8c137cb3ca"
54
+ "gitHead": "0b1edce93eb7fd8f8181e922fd5652675397e309"
55
55
  }
package/validator.d.ts CHANGED
@@ -9,6 +9,7 @@ export declare class SchemaValidator {
9
9
  private ajv;
10
10
  private registry;
11
11
  private options;
12
+ private failures;
12
13
  constructor(registry: Registry, options?: SchemaValidatorOptions);
13
14
  validateAllData(verbose?: boolean): void;
14
15
  private validateJsonSchema;
package/validator.js CHANGED
@@ -13,6 +13,7 @@ class SchemaValidator {
13
13
  ajv;
14
14
  registry;
15
15
  options;
16
+ failures = 0;
16
17
  constructor(registry, options) {
17
18
  const { useStrict = false, allErrors = true, useDefaults = true, draft = '2019-09' } = options ?? {};
18
19
  this.options = {
@@ -81,9 +82,13 @@ class SchemaValidator {
81
82
  throw e;
82
83
  }
83
84
  });
85
+ if (this.options.allErrors && this.failures > 0) {
86
+ throw new Error('❌ Validation Failed.');
87
+ }
84
88
  }
85
89
  validateJsonSchema(data, title, validate, verbose) {
86
90
  if (!validate(data.content)) {
91
+ this.failures++;
87
92
  console.error(chalk_1.default.red(`❌ Validation errors for ${chalk_1.default.bold(title)} in file ${chalk_1.default.magenta(data.path)}:`));
88
93
  validate.errors?.forEach(error => {
89
94
  console.error(chalk_1.default.red(` ➡️ ${error.instancePath} ${error.message}`));