@awsless/validate 0.0.12 → 0.0.14

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/index.cjs CHANGED
@@ -112,9 +112,7 @@ function duration(arg1, arg2) {
112
112
  const error = msg ?? "Invalid duration";
113
113
  return (0, import_valibot5.transform)(
114
114
  (0, import_valibot5.string)(error, [(0, import_valibot5.regex)(/^[0-9]+ (milliseconds?|seconds?|minutes?|hours?|days?)/, error)]),
115
- (value, { issues }) => {
116
- if (issues)
117
- return;
115
+ (value) => {
118
116
  return (0, import_duration.parse)(value);
119
117
  },
120
118
  pipe
@@ -175,12 +173,6 @@ var snsTopic = (body) => {
175
173
 
176
174
  // src/schema/aws/dynamodb-stream.ts
177
175
  var import_valibot8 = require("valibot");
178
- var EventName = /* @__PURE__ */ ((EventName2) => {
179
- EventName2["modify"] = "MODIFY";
180
- EventName2["insert"] = "INSERT";
181
- EventName2["remove"] = "REMOVE";
182
- return EventName2;
183
- })(EventName || {});
184
176
  var dynamoDbStream = (table) => {
185
177
  const marshall = () => (0, import_valibot8.transform)((0, import_valibot8.unknown)(), (value) => table.unmarshall(value));
186
178
  return (0, import_valibot8.transform)(
@@ -188,8 +180,7 @@ var dynamoDbStream = (table) => {
188
180
  {
189
181
  Records: (0, import_valibot8.array)(
190
182
  (0, import_valibot8.object)({
191
- eventName: (0, import_valibot8.enum_)(EventName),
192
- // eventName: picklist(['MODIFY', 'INSERT', 'REMOVE']),
183
+ eventName: (0, import_valibot8.union)([(0, import_valibot8.literal)("MODIFY"), (0, import_valibot8.literal)("INSERT"), (0, import_valibot8.literal)("REMOVE")]),
193
184
  dynamodb: (0, import_valibot8.object)({
194
185
  Keys: marshall(),
195
186
  OldImage: (0, import_valibot8.optional)(marshall()),
package/dist/index.d.cts CHANGED
@@ -43,11 +43,7 @@ type SnsTopicSchema<S extends BaseSchema = UnknownSchema> = BaseSchema<Input<S>
43
43
  }, Output<S>[]>;
44
44
  declare const snsTopic: <S extends BaseSchema<any, any> = UnknownSchema<unknown>>(body?: S | undefined) => SnsTopicSchema<S>;
45
45
 
46
- declare enum EventName {
47
- modify = "MODIFY",
48
- insert = "INSERT",
49
- remove = "REMOVE"
50
- }
46
+ type EventName = 'MODIFY' | 'INSERT' | 'REMOVE';
51
47
  type DynamoDBStreamSchema<T extends TableDefinition<any, any, any, any>> = BaseSchema<{
52
48
  Records: {
53
49
  eventName: EventName;
package/dist/index.d.ts CHANGED
@@ -43,11 +43,7 @@ type SnsTopicSchema<S extends BaseSchema = UnknownSchema> = BaseSchema<Input<S>
43
43
  }, Output<S>[]>;
44
44
  declare const snsTopic: <S extends BaseSchema<any, any> = UnknownSchema<unknown>>(body?: S | undefined) => SnsTopicSchema<S>;
45
45
 
46
- declare enum EventName {
47
- modify = "MODIFY",
48
- insert = "INSERT",
49
- remove = "REMOVE"
50
- }
46
+ type EventName = 'MODIFY' | 'INSERT' | 'REMOVE';
51
47
  type DynamoDBStreamSchema<T extends TableDefinition<any, any, any, any>> = BaseSchema<{
52
48
  Records: {
53
49
  eventName: EventName;
package/dist/index.js CHANGED
@@ -85,9 +85,7 @@ function duration(arg1, arg2) {
85
85
  const error = msg ?? "Invalid duration";
86
86
  return transform5(
87
87
  string5(error, [regex(/^[0-9]+ (milliseconds?|seconds?|minutes?|hours?|days?)/, error)]),
88
- (value, { issues }) => {
89
- if (issues)
90
- return;
88
+ (value) => {
91
89
  return parse(value);
92
90
  },
93
91
  pipe
@@ -147,13 +145,7 @@ var snsTopic = (body) => {
147
145
  };
148
146
 
149
147
  // src/schema/aws/dynamodb-stream.ts
150
- import { array as array3, object as object4, optional, enum_, transform as transform8, unknown as unknown3 } from "valibot";
151
- var EventName = /* @__PURE__ */ ((EventName2) => {
152
- EventName2["modify"] = "MODIFY";
153
- EventName2["insert"] = "INSERT";
154
- EventName2["remove"] = "REMOVE";
155
- return EventName2;
156
- })(EventName || {});
148
+ import { array as array3, object as object4, optional, transform as transform8, unknown as unknown3, union as union5, literal } from "valibot";
157
149
  var dynamoDbStream = (table) => {
158
150
  const marshall = () => transform8(unknown3(), (value) => table.unmarshall(value));
159
151
  return transform8(
@@ -161,8 +153,7 @@ var dynamoDbStream = (table) => {
161
153
  {
162
154
  Records: array3(
163
155
  object4({
164
- eventName: enum_(EventName),
165
- // eventName: picklist(['MODIFY', 'INSERT', 'REMOVE']),
156
+ eventName: union5([literal("MODIFY"), literal("INSERT"), literal("REMOVE")]),
166
157
  dynamodb: object4({
167
158
  Keys: marshall(),
168
159
  OldImage: optional(marshall()),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/validate",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -34,7 +34,7 @@
34
34
  "@awsless/dynamodb": "^0.0.42"
35
35
  },
36
36
  "dependencies": {
37
- "valibot": "^0.29.0"
37
+ "valibot": "^0.30.0"
38
38
  },
39
39
  "scripts": {
40
40
  "test": "pnpm code test",