@kravc/schema 2.8.0-alpha.2 → 2.8.0-alpha.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/dist/ValidationError.d.ts +7 -6
- package/dist/ValidationError.d.ts.map +1 -1
- package/dist/ValidationError.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/ValidationError.ts +8 -6
- package/src/index.ts +5 -1
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { SchemaErrorDetail } from 'z-schema';
|
|
2
2
|
import { TargetObject } from './helpers/JsonSchema';
|
|
3
|
+
export type ValidationErrorOutput = {
|
|
4
|
+
path: string;
|
|
5
|
+
code: string;
|
|
6
|
+
params: string[];
|
|
7
|
+
message: string;
|
|
8
|
+
};
|
|
3
9
|
/**
|
|
4
10
|
* Normalized validation error thrown when object validation fails against a schema.
|
|
5
11
|
*
|
|
@@ -58,12 +64,7 @@ declare class ValidationError extends Error {
|
|
|
58
64
|
object: TargetObject;
|
|
59
65
|
message: string;
|
|
60
66
|
schemaId: string;
|
|
61
|
-
validationErrors:
|
|
62
|
-
path: string;
|
|
63
|
-
code: string;
|
|
64
|
-
params: string[];
|
|
65
|
-
message: string;
|
|
66
|
-
}[];
|
|
67
|
+
validationErrors: ValidationErrorOutput[];
|
|
67
68
|
};
|
|
68
69
|
}
|
|
69
70
|
export default ValidationError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationError.d.ts","sourceRoot":"","sources":["../src/ValidationError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,cAAM,eAAgB,SAAQ,KAAK;IACjC,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"ValidationError.d.ts","sourceRoot":"","sources":["../src/ValidationError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,cAAM,eAAgB,SAAQ,KAAK;IACjC,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,iBAAiB,CAA0B;IAEnD;;;;;;;OAOG;gBACS,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE;IAgBhG;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM;;;;;;;CASP;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationError.js","sourceRoot":"","sources":["../src/ValidationError.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"ValidationError.js","sourceRoot":"","sources":["../src/ValidationError.ts"],"names":[],"mappings":";;AAWA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,eAAgB,SAAQ,KAAK;IACzB,OAAO,CAAe;IACtB,SAAS,CAAS;IAClB,iBAAiB,CAA0B;IAEnD;;;;;;;OAOG;IACH,YAAY,QAAgB,EAAE,aAA2B,EAAE,gBAAqC;QAC9F,KAAK,CAAC,IAAI,QAAQ,qBAAqB,CAAC,CAAC;QAEzC,IAAI,CAAC,OAAO,GAAG,aAAa,CAAC;QAE7B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAE1B,IAAI,CAAC,iBAAiB,GAAG,gBAAgB;aACtC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACb,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC,CAAC,CAAC;IACR,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI;YAC3B,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,SAAS;YACxB,gBAAgB,EAAE,IAAI,CAAC,iBAAiB;SACzC,CAAC;IACJ,CAAC;CACF;AAED,kBAAe,eAAe,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ import got from './helpers/got';
|
|
|
2
2
|
import Schema from './Schema';
|
|
3
3
|
import Validator from './Validator';
|
|
4
4
|
import documentLoader from './ld/documentLoader';
|
|
5
|
-
import ValidationError from './ValidationError';
|
|
6
5
|
import CredentialFactory from './CredentialFactory';
|
|
7
6
|
import createSchemasMap, { loadSync } from './helpers/createSchemasMap';
|
|
7
|
+
import ValidationError, { type ValidationErrorOutput } from './ValidationError';
|
|
8
8
|
export { got, Schema, loadSync, Validator, documentLoader, ValidationError, createSchemasMap, CredentialFactory };
|
|
9
|
+
export type { ValidationErrorOutput, };
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,eAAe,CAAC;AAChC,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,eAAe,CAAC;AAChC,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,gBAAgB,EAAE,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,eAAe,EAAE,EAAE,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAEhF,OAAO,EACL,GAAG,EACH,MAAM,EACN,QAAQ,EACR,SAAS,EACT,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EAClB,CAAC;AAEF,YAAY,EACV,qBAAqB,GACtB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -45,11 +45,11 @@ const Validator_1 = __importDefault(require("./Validator"));
|
|
|
45
45
|
exports.Validator = Validator_1.default;
|
|
46
46
|
const documentLoader_1 = __importDefault(require("./ld/documentLoader"));
|
|
47
47
|
exports.documentLoader = documentLoader_1.default;
|
|
48
|
-
const ValidationError_1 = __importDefault(require("./ValidationError"));
|
|
49
|
-
exports.ValidationError = ValidationError_1.default;
|
|
50
48
|
const CredentialFactory_1 = __importDefault(require("./CredentialFactory"));
|
|
51
49
|
exports.CredentialFactory = CredentialFactory_1.default;
|
|
52
50
|
const createSchemasMap_1 = __importStar(require("./helpers/createSchemasMap"));
|
|
53
51
|
exports.createSchemasMap = createSchemasMap_1.default;
|
|
54
52
|
Object.defineProperty(exports, "loadSync", { enumerable: true, get: function () { return createSchemasMap_1.loadSync; } });
|
|
53
|
+
const ValidationError_1 = __importDefault(require("./ValidationError"));
|
|
54
|
+
exports.ValidationError = ValidationError_1.default;
|
|
55
55
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAAgC;AAS9B,cATK,aAAG,CASL;AARL,sDAA8B;AAS5B,iBATK,gBAAM,CASL;AARR,4DAAoC;AAUlC,oBAVK,mBAAS,CAUL;AATX,yEAAiD;AAU/C,yBAVK,wBAAc,CAUL;AAThB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAAgC;AAS9B,cATK,aAAG,CASL;AARL,sDAA8B;AAS5B,iBATK,gBAAM,CASL;AARR,4DAAoC;AAUlC,oBAVK,mBAAS,CAUL;AATX,yEAAiD;AAU/C,yBAVK,wBAAc,CAUL;AAThB,4EAAoD;AAYlD,4BAZK,2BAAiB,CAYL;AAXnB,+EAAwE;AAUtE,2BAVK,0BAAgB,CAUL;AAJhB,yFANyB,2BAAQ,OAMzB;AALV,wEAAgF;AAQ9E,0BARK,yBAAe,CAQL"}
|
package/package.json
CHANGED
package/src/ValidationError.ts
CHANGED
|
@@ -2,6 +2,13 @@ import type { SchemaErrorDetail } from 'z-schema';
|
|
|
2
2
|
|
|
3
3
|
import { TargetObject } from './helpers/JsonSchema';
|
|
4
4
|
|
|
5
|
+
export type ValidationErrorOutput = {
|
|
6
|
+
path: string;
|
|
7
|
+
code: string;
|
|
8
|
+
params: string[];
|
|
9
|
+
message: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
5
12
|
/**
|
|
6
13
|
* Normalized validation error thrown when object validation fails against a schema.
|
|
7
14
|
*
|
|
@@ -26,12 +33,7 @@ import { TargetObject } from './helpers/JsonSchema';
|
|
|
26
33
|
class ValidationError extends Error {
|
|
27
34
|
private _object: TargetObject;
|
|
28
35
|
private _schemaId: string;
|
|
29
|
-
private _validationErrors:
|
|
30
|
-
path: string;
|
|
31
|
-
code: string;
|
|
32
|
-
params: string[];
|
|
33
|
-
message: string;
|
|
34
|
-
}[];
|
|
36
|
+
private _validationErrors: ValidationErrorOutput[];
|
|
35
37
|
|
|
36
38
|
/**
|
|
37
39
|
* Creates a validation error instance.
|
package/src/index.ts
CHANGED
|
@@ -2,9 +2,9 @@ import got from './helpers/got';
|
|
|
2
2
|
import Schema from './Schema';
|
|
3
3
|
import Validator from './Validator';
|
|
4
4
|
import documentLoader from './ld/documentLoader';
|
|
5
|
-
import ValidationError from './ValidationError';
|
|
6
5
|
import CredentialFactory from './CredentialFactory';
|
|
7
6
|
import createSchemasMap, { loadSync } from './helpers/createSchemasMap';
|
|
7
|
+
import ValidationError, { type ValidationErrorOutput } from './ValidationError';
|
|
8
8
|
|
|
9
9
|
export {
|
|
10
10
|
got,
|
|
@@ -16,3 +16,7 @@ export {
|
|
|
16
16
|
createSchemasMap,
|
|
17
17
|
CredentialFactory
|
|
18
18
|
};
|
|
19
|
+
|
|
20
|
+
export type {
|
|
21
|
+
ValidationErrorOutput,
|
|
22
|
+
};
|