@chain-registry/workflows 1.45.3 → 1.46.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
@@ -9,12 +9,13 @@ export class SchemaValidator {
9
9
  options;
10
10
  failures = 0;
11
11
  constructor(registry, options) {
12
- const { useStrict = false, allErrors = true, useDefaults = true, draft = '2019-09' } = options ?? {};
12
+ const { useStrict = false, allErrors = true, useDefaults = true, draft = '2019-09', logLevel = 'info' } = options ?? {};
13
13
  this.options = {
14
14
  useDefaults,
15
15
  useStrict,
16
16
  draft,
17
- allErrors
17
+ allErrors,
18
+ logLevel
18
19
  };
19
20
  switch (draft) {
20
21
  case 'draft-07':
@@ -72,7 +73,9 @@ export class SchemaValidator {
72
73
  });
73
74
  }
74
75
  catch (e) {
75
- console.error(chalk.red(`❌ Strict Validation errors for schema ${chalk.bold(title)} in file ${chalk.magenta(schema.path)}:`));
76
+ if (['info', 'error'].includes(this.options.logLevel)) {
77
+ console.error(chalk.red(`❌ Strict Validation errors for schema ${chalk.bold(title)} in file ${chalk.magenta(schema.path)}:`));
78
+ }
76
79
  throw e;
77
80
  }
78
81
  });
@@ -83,13 +86,17 @@ export class SchemaValidator {
83
86
  validateJsonSchema(data, title, validate, verbose) {
84
87
  if (!validate(data.content)) {
85
88
  this.failures++;
86
- console.error(chalk.red(`❌ Validation errors for ${chalk.bold(title)} in file ${chalk.magenta(data.path)}:`));
87
- validate.errors?.forEach(error => {
88
- console.error(chalk.red(` ➡️ ${error.instancePath} ${error.message}`));
89
- });
89
+ if (['info', 'error'].includes(this.options.logLevel)) {
90
+ console.error(chalk.red(`❌ Validation errors for ${chalk.bold(title)} in file ${chalk.magenta(data.path)}:`));
91
+ validate.errors?.forEach(error => {
92
+ console.error(chalk.red(` ➡️ ${error.instancePath} ${error.message}`));
93
+ });
94
+ }
90
95
  }
91
96
  else if (verbose) {
92
- console.log(chalk.green(`✅ Validation passed for ${chalk.bold(title)} in file ${chalk.magenta(data.path)}`));
97
+ if (['info'].includes(this.options.logLevel)) {
98
+ console.log(chalk.green(`✅ Validation passed for ${chalk.bold(title)} in file ${chalk.magenta(data.path)}`));
99
+ }
93
100
  }
94
101
  }
95
102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chain-registry/workflows",
3
- "version": "1.45.3",
3
+ "version": "1.46.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.44.3",
34
+ "@chain-registry/interfaces": "^0.45.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": "4b879365dbdb9e605f572dd5447068b70651d407"
54
+ "gitHead": "951036da94a505da123ed729b92f234bb9321705"
55
55
  }
package/validator.d.ts CHANGED
@@ -4,6 +4,7 @@ export interface SchemaValidatorOptions {
4
4
  useStrict?: boolean;
5
5
  allErrors?: boolean;
6
6
  useDefaults?: boolean;
7
+ logLevel?: 'info' | 'error' | 'none';
7
8
  }
8
9
  export declare class SchemaValidator {
9
10
  private ajv;
package/validator.js CHANGED
@@ -15,12 +15,13 @@ class SchemaValidator {
15
15
  options;
16
16
  failures = 0;
17
17
  constructor(registry, options) {
18
- const { useStrict = false, allErrors = true, useDefaults = true, draft = '2019-09' } = options ?? {};
18
+ const { useStrict = false, allErrors = true, useDefaults = true, draft = '2019-09', logLevel = 'info' } = options ?? {};
19
19
  this.options = {
20
20
  useDefaults,
21
21
  useStrict,
22
22
  draft,
23
- allErrors
23
+ allErrors,
24
+ logLevel
24
25
  };
25
26
  switch (draft) {
26
27
  case 'draft-07':
@@ -78,7 +79,9 @@ class SchemaValidator {
78
79
  });
79
80
  }
80
81
  catch (e) {
81
- console.error(chalk_1.default.red(`❌ Strict Validation errors for schema ${chalk_1.default.bold(title)} in file ${chalk_1.default.magenta(schema.path)}:`));
82
+ if (['info', 'error'].includes(this.options.logLevel)) {
83
+ console.error(chalk_1.default.red(`❌ Strict Validation errors for schema ${chalk_1.default.bold(title)} in file ${chalk_1.default.magenta(schema.path)}:`));
84
+ }
82
85
  throw e;
83
86
  }
84
87
  });
@@ -89,13 +92,17 @@ class SchemaValidator {
89
92
  validateJsonSchema(data, title, validate, verbose) {
90
93
  if (!validate(data.content)) {
91
94
  this.failures++;
92
- console.error(chalk_1.default.red(`❌ Validation errors for ${chalk_1.default.bold(title)} in file ${chalk_1.default.magenta(data.path)}:`));
93
- validate.errors?.forEach(error => {
94
- console.error(chalk_1.default.red(` ➡️ ${error.instancePath} ${error.message}`));
95
- });
95
+ if (['info', 'error'].includes(this.options.logLevel)) {
96
+ console.error(chalk_1.default.red(`❌ Validation errors for ${chalk_1.default.bold(title)} in file ${chalk_1.default.magenta(data.path)}:`));
97
+ validate.errors?.forEach(error => {
98
+ console.error(chalk_1.default.red(` ➡️ ${error.instancePath} ${error.message}`));
99
+ });
100
+ }
96
101
  }
97
102
  else if (verbose) {
98
- console.log(chalk_1.default.green(`✅ Validation passed for ${chalk_1.default.bold(title)} in file ${chalk_1.default.magenta(data.path)}`));
103
+ if (['info'].includes(this.options.logLevel)) {
104
+ console.log(chalk_1.default.green(`✅ Validation passed for ${chalk_1.default.bold(title)} in file ${chalk_1.default.magenta(data.path)}`));
105
+ }
99
106
  }
100
107
  }
101
108
  }