@envelop/core 5.0.0 → 5.0.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.
package/README.md CHANGED
@@ -13,3 +13,4 @@ https://github.com/n1ru4l/envelop
13
13
  - [`useMaskedErrors`](./docs/use-masked-errors.md)
14
14
  - [`usePayloadFormatter`](./docs/use-payload-formatter.md)
15
15
  - [`useEngine`](./docs/use-engine.md)
16
+ - [`useValidationRule`](./docs/use-validation-rule.md)
package/cjs/index.js CHANGED
@@ -14,5 +14,6 @@ tslib_1.__exportStar(require("./plugins/use-extend-context.js"), exports);
14
14
  tslib_1.__exportStar(require("./plugins/use-payload-formatter.js"), exports);
15
15
  tslib_1.__exportStar(require("./plugins/use-masked-errors.js"), exports);
16
16
  tslib_1.__exportStar(require("./plugins/use-engine.js"), exports);
17
+ tslib_1.__exportStar(require("./plugins/use-validation-rule.js"), exports);
17
18
  var document_string_map_js_1 = require("./document-string-map.js");
18
19
  Object.defineProperty(exports, "getDocumentString", { enumerable: true, get: function () { return document_string_map_js_1.getDocumentString; } });
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useValidationRule = void 0;
4
+ const useValidationRule = (rule) => {
5
+ return {
6
+ onValidate({ addValidationRule }) {
7
+ addValidationRule(rule);
8
+ },
9
+ };
10
+ };
11
+ exports.useValidationRule = useValidationRule;
package/esm/index.js CHANGED
@@ -10,4 +10,5 @@ export * from './plugins/use-extend-context.js';
10
10
  export * from './plugins/use-payload-formatter.js';
11
11
  export * from './plugins/use-masked-errors.js';
12
12
  export * from './plugins/use-engine.js';
13
+ export * from './plugins/use-validation-rule.js';
13
14
  export { getDocumentString } from './document-string-map.js';
@@ -0,0 +1,7 @@
1
+ export const useValidationRule = (rule) => {
2
+ return {
3
+ onValidate({ addValidationRule }) {
4
+ addValidationRule(rule);
5
+ },
6
+ };
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envelop/core",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "sideEffects": false,
5
5
  "dependencies": {
6
6
  "@envelop/types": "5.0.0",
@@ -9,4 +9,5 @@ export * from './plugins/use-extend-context.cjs';
9
9
  export * from './plugins/use-payload-formatter.cjs';
10
10
  export * from './plugins/use-masked-errors.cjs';
11
11
  export * from './plugins/use-engine.cjs';
12
+ export * from './plugins/use-validation-rule.cjs';
12
13
  export { getDocumentString } from './document-string-map.cjs';
@@ -9,4 +9,5 @@ export * from './plugins/use-extend-context.js';
9
9
  export * from './plugins/use-payload-formatter.js';
10
10
  export * from './plugins/use-masked-errors.js';
11
11
  export * from './plugins/use-engine.js';
12
+ export * from './plugins/use-validation-rule.js';
12
13
  export { getDocumentString } from './document-string-map.js';
@@ -0,0 +1,2 @@
1
+ import { Plugin } from '@envelop/types';
2
+ export declare const useValidationRule: (rule: any) => Plugin;
@@ -0,0 +1,2 @@
1
+ import { Plugin } from '@envelop/types';
2
+ export declare const useValidationRule: (rule: any) => Plugin;