@middy/validator 4.0.0-alpha.0 → 4.0.0-alpha.2

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/index.cjs CHANGED
@@ -2,19 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- transpileSchema: ()=>transpileSchema,
13
- transpileLocale: ()=>transpileLocale,
14
- default: ()=>_default
5
+ Object.defineProperty(module, "exports", {
6
+ enumerable: true,
7
+ get: ()=>_default
15
8
  });
16
9
  const _util = require("@middy/util");
17
- const _ajvCmd = require("ajv-cmd");
18
10
  const _ajvFtlI18N = _interopRequireDefault(require("ajv-ftl-i18n"));
19
11
  function _interopRequireDefault(obj) {
20
12
  return obj && obj.__esModule ? obj : {
@@ -73,21 +65,6 @@ const validatorMiddleware = (opts = {})=>{
73
65
  after: responseSchema ? validatorMiddlewareAfter : undefined
74
66
  };
75
67
  };
76
- const ajvDefaults = {
77
- strict: true,
78
- coerceTypes: 'array',
79
- allErrors: true,
80
- useDefaults: 'empty',
81
- messages: true
82
- };
83
- const transpileSchema = (schema, ajvOptions)=>{
84
- const options = {
85
- ...ajvDefaults,
86
- ...ajvOptions
87
- };
88
- return (0, _ajvCmd.compile)(schema, options);
89
- };
90
- const transpileLocale = _ajvCmd.ftl;
91
68
  const availableLanguages = Object.keys(_ajvFtlI18N.default);
92
69
  const chooseLanguage = ({ preferredLanguage }, defaultLanguage)=>{
93
70
  if (preferredLanguage) {
package/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { createError } from '@middy/util';
2
- import { compile, ftl } from 'ajv-cmd';
3
2
  import localize from 'ajv-ftl-i18n';
4
3
  const defaults = {
5
4
  eventSchema: undefined,
@@ -53,21 +52,6 @@ const validatorMiddleware = (opts = {})=>{
53
52
  after: responseSchema ? validatorMiddlewareAfter : undefined
54
53
  };
55
54
  };
56
- const ajvDefaults = {
57
- strict: true,
58
- coerceTypes: 'array',
59
- allErrors: true,
60
- useDefaults: 'empty',
61
- messages: true
62
- };
63
- export const transpileSchema = (schema, ajvOptions)=>{
64
- const options = {
65
- ...ajvDefaults,
66
- ...ajvOptions
67
- };
68
- return compile(schema, options);
69
- };
70
- export const transpileLocale = ftl;
71
55
  const availableLanguages = Object.keys(localize);
72
56
  const chooseLanguage = ({ preferredLanguage }, defaultLanguage)=>{
73
57
  if (preferredLanguage) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/validator",
3
- "version": "4.0.0-alpha.0",
3
+ "version": "4.0.0-alpha.2",
4
4
  "description": "Validator middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -22,13 +22,25 @@
22
22
  "types": "./index.d.ts",
23
23
  "default": "./index.cjs"
24
24
  }
25
+ },
26
+ "./transpile": {
27
+ "import": {
28
+ "types": "./transpile.d.ts",
29
+ "default": "./transpile.js"
30
+ },
31
+ "require": {
32
+ "types": "./transpile.d.ts",
33
+ "default": "./transpile.cjs"
34
+ }
25
35
  }
26
36
  },
27
37
  "types": "index.d.ts",
28
38
  "files": [
29
39
  "index.js",
30
40
  "index.cjs",
31
- "index.d.ts"
41
+ "index.d.ts",
42
+ "transpile.js",
43
+ "transpile.cjs"
32
44
  ],
33
45
  "scripts": {
34
46
  "test": "npm run test:unit",
@@ -61,13 +73,13 @@
61
73
  },
62
74
  "homepage": "https://middy.js.org",
63
75
  "dependencies": {
64
- "@middy/util": "4.0.0-alpha.0",
65
- "ajv-cmd": "0.1.9"
76
+ "@middy/util": "4.0.0-alpha.2",
77
+ "ajv-cmd": "0.1.10"
66
78
  },
67
79
  "devDependencies": {
68
- "@middy/core": "4.0.0-alpha.0",
80
+ "@middy/core": "4.0.0-alpha.2",
69
81
  "@types/http-errors": "^1.8.1",
70
82
  "ajv-bsontype": "^1.0.7"
71
83
  },
72
- "gitHead": "306fb9aa633d5757d11ced3dc192f046ef3c2685"
84
+ "gitHead": "c1e1b7af571a2bb14092ee2cb6e0b716828fbd2f"
73
85
  }
package/transpile.cjs ADDED
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ transpileSchema: ()=>transpileSchema,
13
+ transpileLocale: ()=>transpileLocale
14
+ });
15
+ const _ajvCmd = require("ajv-cmd");
16
+ const ajvDefaults = {
17
+ strict: true,
18
+ coerceTypes: 'array',
19
+ allErrors: true,
20
+ useDefaults: 'empty',
21
+ messages: true
22
+ };
23
+ const transpileSchema = (schema, ajvOptions)=>{
24
+ const options = {
25
+ ...ajvDefaults,
26
+ ...ajvOptions
27
+ };
28
+ return (0, _ajvCmd.compile)(schema, options);
29
+ };
30
+ const transpileLocale = _ajvCmd.ftl;
31
+
32
+
33
+ //# sourceMappingURL=transpile.cjs.map
package/transpile.js ADDED
@@ -0,0 +1,19 @@
1
+ import { compile, ftl } from 'ajv-cmd';
2
+ const ajvDefaults = {
3
+ strict: true,
4
+ coerceTypes: 'array',
5
+ allErrors: true,
6
+ useDefaults: 'empty',
7
+ messages: true
8
+ };
9
+ export const transpileSchema = (schema, ajvOptions)=>{
10
+ const options = {
11
+ ...ajvDefaults,
12
+ ...ajvOptions
13
+ };
14
+ return compile(schema, options);
15
+ };
16
+ export const transpileLocale = ftl;
17
+
18
+
19
+ //# sourceMappingURL=transpile.js.map