@awsless/validate 0.0.16 → 0.0.17

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 ADDED
File without changes
package/dist/index.cjs CHANGED
@@ -40,13 +40,14 @@ module.exports = __toCommonJS(src_exports);
40
40
  __reExport(src_exports, require("valibot"), module.exports);
41
41
 
42
42
  // src/schema/json.ts
43
+ var import_json = require("@awsless/json");
43
44
  var import_valibot = require("valibot");
44
45
  var json = (schema) => {
45
46
  return (0, import_valibot.transform)(
46
47
  (0, import_valibot.string)(),
47
48
  (value) => {
48
49
  try {
49
- return JSON.parse(value);
50
+ return (0, import_json.parse)(value);
50
51
  } catch (error) {
51
52
  return null;
52
53
  }
package/dist/index.js CHANGED
@@ -2,13 +2,14 @@
2
2
  export * from "valibot";
3
3
 
4
4
  // src/schema/json.ts
5
+ import { parse } from "@awsless/json";
5
6
  import { string, transform } from "valibot";
6
7
  var json = (schema) => {
7
8
  return transform(
8
9
  string(),
9
10
  (value) => {
10
11
  try {
11
- return JSON.parse(value);
12
+ return parse(value);
12
13
  } catch (error) {
13
14
  return null;
14
15
  }
@@ -98,14 +99,14 @@ var uuid = (error) => {
98
99
 
99
100
  // src/schema/duration.ts
100
101
  import { defaultArgs as defaultArgs4, regex as regex2, string as string6, transform as transform6 } from "valibot";
101
- import { parse } from "@awsless/duration";
102
+ import { parse as parse2 } from "@awsless/duration";
102
103
  function duration(arg1, arg2) {
103
104
  const [msg, pipe] = defaultArgs4(arg1, arg2);
104
105
  const error = msg ?? "Invalid duration";
105
106
  return transform6(
106
107
  string6(error, [regex2(/^[0-9]+ (milliseconds?|seconds?|minutes?|hours?|days?)/, error)]),
107
108
  (value) => {
108
- return parse(value);
109
+ return parse2(value);
109
110
  },
110
111
  pipe
111
112
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/validate",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -24,14 +24,16 @@
24
24
  }
25
25
  },
26
26
  "peerDependencies": {
27
+ "@awsless/duration": "^0.0.1",
27
28
  "@awsless/big-float": "^0.0.4",
28
- "@awsless/dynamodb": "^0.1.1",
29
- "@awsless/duration": "^0.0.1"
29
+ "@awsless/json": "^0.0.6",
30
+ "@awsless/dynamodb": "^0.1.5"
30
31
  },
31
32
  "devDependencies": {
32
33
  "@awsless/big-float": "^0.0.4",
33
- "@awsless/dynamodb": "^0.1.1",
34
- "@awsless/duration": "^0.0.1"
34
+ "@awsless/duration": "^0.0.1",
35
+ "@awsless/dynamodb": "^0.1.5",
36
+ "@awsless/json": "^0.0.6"
35
37
  },
36
38
  "dependencies": {
37
39
  "valibot": "^0.30.0"