pema 0.8.0 → 0.8.1

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.
@@ -8,6 +8,7 @@ declare function too_large(input: unknown, message: string, path?: JSONPointer):
8
8
  declare function out_of_range(input: unknown, message: string, path?: JSONPointer): ParseError;
9
9
  declare function duplicate(input: unknown, message: string, path?: JSONPointer): ParseError;
10
10
  declare function not_in_set(input: unknown, message: string, path?: JSONPointer): ParseError;
11
+ declare function field(path: JSONPointer, message: string): ParseError;
11
12
  declare const _default: {
12
13
  invalid_type: typeof invalid_type;
13
14
  invalid_format: typeof invalid_format;
@@ -16,6 +17,7 @@ declare const _default: {
16
17
  out_of_range: typeof out_of_range;
17
18
  duplicate: typeof duplicate;
18
19
  not_in_set: typeof not_in_set;
20
+ field: typeof field;
19
21
  };
20
22
  export default _default;
21
23
  //# sourceMappingURL=errors.d.ts.map
@@ -40,6 +40,14 @@ function duplicate(input, message, path = "") {
40
40
  function not_in_set(input, message, path = "") {
41
41
  return new ParseError([{ type: "not_in_set", input, message, path }]);
42
42
  }
43
+ function field(path, message) {
44
+ return new ParseError([{
45
+ type: "invalid_format",
46
+ input: undefined,
47
+ message,
48
+ path: `/${path}`,
49
+ }]);
50
+ }
43
51
  export default {
44
52
  invalid_type,
45
53
  invalid_format,
@@ -48,5 +56,6 @@ export default {
48
56
  out_of_range,
49
57
  duplicate,
50
58
  not_in_set,
59
+ field,
51
60
  };
52
61
  //# sourceMappingURL=errors.js.map
@@ -187,6 +187,9 @@ declare namespace schema {
187
187
  declare namespace schema {
188
188
  var uuid: import("#UUIDType").default;
189
189
  }
190
+ declare namespace schema {
191
+ var error: (path: import("@rcompat/type").JSONPointer, message: string) => import("./ParseError.js").default;
192
+ }
190
193
  declare namespace schema {
191
194
  var loose: {
192
195
  <const S extends Schema>(s: S): NormalizeSchema<S>;
@@ -1,3 +1,4 @@
1
+ import E from "#errors";
1
2
  import array from "#array";
2
3
  import bigint from "#bigint";
3
4
  import biguint from "#biguint";
@@ -102,6 +103,7 @@ schema.union = union.vanilla;
102
103
  schema.unknown = unknown.vanilla;
103
104
  schema.url = url.vanilla;
104
105
  schema.uuid = uuid.vanilla;
106
+ schema.error = E.field;
105
107
  loose.array = array.loose;
106
108
  loose.bigint = bigint.loose;
107
109
  loose.biguint = biguint.loose;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pema",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Primate schema validation",
5
5
  "homepage": "https://primate.run/docs/validation",
6
6
  "bugs": "https://github.com/primate-run/primate/issues",