@awsless/validate 0.0.13 → 0.0.15
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 +71 -55
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +44 -29
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -22,6 +22,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
22
22
|
var src_exports = {};
|
|
23
23
|
__export(src_exports, {
|
|
24
24
|
bigfloat: () => bigfloat,
|
|
25
|
+
bigint: () => bigint2,
|
|
25
26
|
date: () => date,
|
|
26
27
|
duration: () => duration,
|
|
27
28
|
dynamoDbStream: () => dynamoDbStream,
|
|
@@ -79,19 +80,38 @@ function bigfloat(arg1, arg2) {
|
|
|
79
80
|
);
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
// src/schema/
|
|
83
|
+
// src/schema/bigint.ts
|
|
83
84
|
var import_valibot3 = require("valibot");
|
|
84
|
-
function
|
|
85
|
+
function bigint2(arg1, arg2) {
|
|
85
86
|
const [error, pipe] = (0, import_valibot3.defaultArgs)(arg1, arg2);
|
|
86
87
|
return (0, import_valibot3.union)(
|
|
87
88
|
[
|
|
88
|
-
(0, import_valibot3.
|
|
89
|
+
(0, import_valibot3.bigint)(pipe),
|
|
89
90
|
(0, import_valibot3.transform)(
|
|
90
|
-
(0, import_valibot3.string)(),
|
|
91
|
+
(0, import_valibot3.string)([(0, import_valibot3.regex)(/^-?[0-9]+$/)]),
|
|
92
|
+
(input) => {
|
|
93
|
+
return BigInt(input);
|
|
94
|
+
},
|
|
95
|
+
(0, import_valibot3.bigint)(pipe)
|
|
96
|
+
)
|
|
97
|
+
],
|
|
98
|
+
error ?? "Invalid BigInt"
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// src/schema/date.ts
|
|
103
|
+
var import_valibot4 = require("valibot");
|
|
104
|
+
function date(arg1, arg2) {
|
|
105
|
+
const [error, pipe] = (0, import_valibot4.defaultArgs)(arg1, arg2);
|
|
106
|
+
return (0, import_valibot4.union)(
|
|
107
|
+
[
|
|
108
|
+
(0, import_valibot4.date)(pipe),
|
|
109
|
+
(0, import_valibot4.transform)(
|
|
110
|
+
(0, import_valibot4.string)(),
|
|
91
111
|
(input) => {
|
|
92
112
|
return new Date(input);
|
|
93
113
|
},
|
|
94
|
-
(0,
|
|
114
|
+
(0, import_valibot4.date)(pipe)
|
|
95
115
|
)
|
|
96
116
|
],
|
|
97
117
|
error ?? "Invalid date"
|
|
@@ -99,19 +119,19 @@ function date(arg1, arg2) {
|
|
|
99
119
|
}
|
|
100
120
|
|
|
101
121
|
// src/schema/uuid.ts
|
|
102
|
-
var
|
|
122
|
+
var import_valibot5 = require("valibot");
|
|
103
123
|
var uuid = (error) => {
|
|
104
|
-
return (0,
|
|
124
|
+
return (0, import_valibot5.transform)((0, import_valibot5.string)(error ?? "Invalid UUID", [(0, import_valibot5.uuid)()]), (v) => v);
|
|
105
125
|
};
|
|
106
126
|
|
|
107
127
|
// src/schema/duration.ts
|
|
108
|
-
var
|
|
128
|
+
var import_valibot6 = require("valibot");
|
|
109
129
|
var import_duration = require("@awsless/duration");
|
|
110
130
|
function duration(arg1, arg2) {
|
|
111
|
-
const [msg, pipe] = (0,
|
|
131
|
+
const [msg, pipe] = (0, import_valibot6.defaultArgs)(arg1, arg2);
|
|
112
132
|
const error = msg ?? "Invalid duration";
|
|
113
|
-
return (0,
|
|
114
|
-
(0,
|
|
133
|
+
return (0, import_valibot6.transform)(
|
|
134
|
+
(0, import_valibot6.string)(error, [(0, import_valibot6.regex)(/^[0-9]+ (milliseconds?|seconds?|minutes?|hours?|days?)/, error)]),
|
|
115
135
|
(value) => {
|
|
116
136
|
return (0, import_duration.parse)(value);
|
|
117
137
|
},
|
|
@@ -120,17 +140,17 @@ function duration(arg1, arg2) {
|
|
|
120
140
|
}
|
|
121
141
|
|
|
122
142
|
// src/schema/aws/sqs-queue.ts
|
|
123
|
-
var
|
|
143
|
+
var import_valibot7 = require("valibot");
|
|
124
144
|
var sqsQueue = (body) => {
|
|
125
|
-
const schema = body ?? (0,
|
|
126
|
-
return (0,
|
|
145
|
+
const schema = body ?? (0, import_valibot7.unknown)();
|
|
146
|
+
return (0, import_valibot7.union)(
|
|
127
147
|
[
|
|
128
|
-
(0,
|
|
129
|
-
(0,
|
|
130
|
-
(0,
|
|
131
|
-
(0,
|
|
132
|
-
Records: (0,
|
|
133
|
-
(0,
|
|
148
|
+
(0, import_valibot7.transform)(schema, (input) => [input]),
|
|
149
|
+
(0, import_valibot7.array)(schema),
|
|
150
|
+
(0, import_valibot7.transform)(
|
|
151
|
+
(0, import_valibot7.object)({
|
|
152
|
+
Records: (0, import_valibot7.array)(
|
|
153
|
+
(0, import_valibot7.object)({
|
|
134
154
|
body: json(schema)
|
|
135
155
|
})
|
|
136
156
|
)
|
|
@@ -145,18 +165,18 @@ var sqsQueue = (body) => {
|
|
|
145
165
|
};
|
|
146
166
|
|
|
147
167
|
// src/schema/aws/sns-topic.ts
|
|
148
|
-
var
|
|
168
|
+
var import_valibot8 = require("valibot");
|
|
149
169
|
var snsTopic = (body) => {
|
|
150
|
-
const schema = body ?? (0,
|
|
151
|
-
return (0,
|
|
170
|
+
const schema = body ?? (0, import_valibot8.unknown)();
|
|
171
|
+
return (0, import_valibot8.union)(
|
|
152
172
|
[
|
|
153
|
-
(0,
|
|
154
|
-
(0,
|
|
155
|
-
(0,
|
|
156
|
-
(0,
|
|
157
|
-
Records: (0,
|
|
158
|
-
(0,
|
|
159
|
-
Sns: (0,
|
|
173
|
+
(0, import_valibot8.transform)(schema, (input) => [input]),
|
|
174
|
+
(0, import_valibot8.array)(schema),
|
|
175
|
+
(0, import_valibot8.transform)(
|
|
176
|
+
(0, import_valibot8.object)({
|
|
177
|
+
Records: (0, import_valibot8.array)(
|
|
178
|
+
(0, import_valibot8.object)({
|
|
179
|
+
Sns: (0, import_valibot8.object)({
|
|
160
180
|
Message: json(schema)
|
|
161
181
|
})
|
|
162
182
|
})
|
|
@@ -172,26 +192,21 @@ var snsTopic = (body) => {
|
|
|
172
192
|
};
|
|
173
193
|
|
|
174
194
|
// src/schema/aws/dynamodb-stream.ts
|
|
175
|
-
var
|
|
176
|
-
var EventName = /* @__PURE__ */ ((EventName2) => {
|
|
177
|
-
EventName2["modify"] = "MODIFY";
|
|
178
|
-
EventName2["insert"] = "INSERT";
|
|
179
|
-
EventName2["remove"] = "REMOVE";
|
|
180
|
-
return EventName2;
|
|
181
|
-
})(EventName || {});
|
|
195
|
+
var import_valibot9 = require("valibot");
|
|
182
196
|
var dynamoDbStream = (table) => {
|
|
183
|
-
const marshall = () => (0,
|
|
184
|
-
return (0,
|
|
185
|
-
(0,
|
|
197
|
+
const marshall = () => (0, import_valibot9.transform)((0, import_valibot9.unknown)(), (value) => table.unmarshall(value));
|
|
198
|
+
return (0, import_valibot9.transform)(
|
|
199
|
+
(0, import_valibot9.object)(
|
|
186
200
|
{
|
|
187
|
-
Records: (0,
|
|
188
|
-
(0,
|
|
189
|
-
|
|
201
|
+
Records: (0, import_valibot9.array)(
|
|
202
|
+
(0, import_valibot9.object)({
|
|
203
|
+
// For some reason picklist fails to build.
|
|
190
204
|
// eventName: picklist(['MODIFY', 'INSERT', 'REMOVE']),
|
|
191
|
-
|
|
205
|
+
eventName: (0, import_valibot9.union)([(0, import_valibot9.literal)("MODIFY"), (0, import_valibot9.literal)("INSERT"), (0, import_valibot9.literal)("REMOVE")]),
|
|
206
|
+
dynamodb: (0, import_valibot9.object)({
|
|
192
207
|
Keys: marshall(),
|
|
193
|
-
OldImage: (0,
|
|
194
|
-
NewImage: (0,
|
|
208
|
+
OldImage: (0, import_valibot9.optional)(marshall()),
|
|
209
|
+
NewImage: (0, import_valibot9.optional)(marshall())
|
|
195
210
|
})
|
|
196
211
|
})
|
|
197
212
|
)
|
|
@@ -214,25 +229,25 @@ var dynamoDbStream = (table) => {
|
|
|
214
229
|
|
|
215
230
|
// src/validation/positive.ts
|
|
216
231
|
var import_big_float2 = require("@awsless/big-float");
|
|
217
|
-
var
|
|
232
|
+
var import_valibot10 = require("valibot");
|
|
218
233
|
function positive(error) {
|
|
219
|
-
return (0,
|
|
234
|
+
return (0, import_valibot10.custom)((input) => (0, import_big_float2.gt)(input, import_big_float2.ZERO), error ?? "Invalid positive number");
|
|
220
235
|
}
|
|
221
236
|
|
|
222
237
|
// src/validation/precision.ts
|
|
223
238
|
var import_big_float3 = require("@awsless/big-float");
|
|
224
|
-
var
|
|
239
|
+
var import_valibot11 = require("valibot");
|
|
225
240
|
function precision(decimals, error) {
|
|
226
|
-
return (0,
|
|
241
|
+
return (0, import_valibot11.custom)((input) => {
|
|
227
242
|
const big = new import_big_float3.BigFloat(input.toString());
|
|
228
243
|
return -big.exponent <= decimals;
|
|
229
244
|
}, error ?? `Invalid ${decimals} precision number`);
|
|
230
245
|
}
|
|
231
246
|
|
|
232
247
|
// src/validation/unique.ts
|
|
233
|
-
var
|
|
248
|
+
var import_valibot12 = require("valibot");
|
|
234
249
|
function unique(compare = (a, b) => a === b, error) {
|
|
235
|
-
return (0,
|
|
250
|
+
return (0, import_valibot12.custom)((input) => {
|
|
236
251
|
for (const x in input) {
|
|
237
252
|
for (const y in input) {
|
|
238
253
|
if (x !== y && compare(input[x], input[y])) {
|
|
@@ -245,16 +260,17 @@ function unique(compare = (a, b) => a === b, error) {
|
|
|
245
260
|
}
|
|
246
261
|
|
|
247
262
|
// src/validation/duration.ts
|
|
248
|
-
var
|
|
263
|
+
var import_valibot13 = require("valibot");
|
|
249
264
|
function minDuration(min, error) {
|
|
250
|
-
return (0,
|
|
265
|
+
return (0, import_valibot13.custom)((input) => input.value >= min.value, error ?? "Invalid duration");
|
|
251
266
|
}
|
|
252
267
|
function maxDuration(max, error) {
|
|
253
|
-
return (0,
|
|
268
|
+
return (0, import_valibot13.custom)((input) => input.value <= max.value, error ?? "Invalid duration");
|
|
254
269
|
}
|
|
255
270
|
// Annotate the CommonJS export names for ESM import in node:
|
|
256
271
|
0 && (module.exports = {
|
|
257
272
|
bigfloat,
|
|
273
|
+
bigint,
|
|
258
274
|
date,
|
|
259
275
|
duration,
|
|
260
276
|
dynamoDbStream,
|
package/dist/index.d.cts
CHANGED
|
@@ -16,6 +16,10 @@ type BigFloatSchema = BaseSchema<string | number | BigFloat | {
|
|
|
16
16
|
declare function bigfloat(pipe?: Pipe<BigFloat>): BigFloatSchema;
|
|
17
17
|
declare function bigfloat(error?: ErrorMessage, pipe?: Pipe<BigFloat>): BigFloatSchema;
|
|
18
18
|
|
|
19
|
+
type BigIntSchema = BaseSchema<string | bigint, bigint>;
|
|
20
|
+
declare function bigint(pipe?: Pipe<bigint>): BigIntSchema;
|
|
21
|
+
declare function bigint(error?: ErrorMessage, pipe?: Pipe<bigint>): BigIntSchema;
|
|
22
|
+
|
|
19
23
|
type DateSchema = BaseSchema<string | Date, Date>;
|
|
20
24
|
declare function date(pipe?: Pipe<Date>): DateSchema;
|
|
21
25
|
declare function date(error?: ErrorMessage, pipe?: Pipe<Date>): DateSchema;
|
|
@@ -43,11 +47,7 @@ type SnsTopicSchema<S extends BaseSchema = UnknownSchema> = BaseSchema<Input<S>
|
|
|
43
47
|
}, Output<S>[]>;
|
|
44
48
|
declare const snsTopic: <S extends BaseSchema<any, any> = UnknownSchema<unknown>>(body?: S | undefined) => SnsTopicSchema<S>;
|
|
45
49
|
|
|
46
|
-
|
|
47
|
-
modify = "MODIFY",
|
|
48
|
-
insert = "INSERT",
|
|
49
|
-
remove = "REMOVE"
|
|
50
|
-
}
|
|
50
|
+
type EventName = 'MODIFY' | 'INSERT' | 'REMOVE';
|
|
51
51
|
type DynamoDBStreamSchema<T extends TableDefinition<any, any, any, any>> = BaseSchema<{
|
|
52
52
|
Records: {
|
|
53
53
|
eventName: EventName;
|
|
@@ -74,4 +74,4 @@ declare function unique<T extends any[]>(compare?: (a: T[number], b: T[number])
|
|
|
74
74
|
declare function minDuration<T extends Duration>(min: Duration, error?: ErrorMessage): valibot.CustomValidation<T>;
|
|
75
75
|
declare function maxDuration<T extends Duration>(max: Duration, error?: ErrorMessage): valibot.CustomValidation<T>;
|
|
76
76
|
|
|
77
|
-
export { BigFloatSchema, DateSchema, DurationSchema, DynamoDBStreamSchema, JsonSchema, SnsTopicSchema, SqsQueueSchema, UuidSchema, bigfloat, date, duration, dynamoDbStream, json, maxDuration, minDuration, positive, precision, snsTopic, sqsQueue, unique, uuid };
|
|
77
|
+
export { BigFloatSchema, BigIntSchema, DateSchema, DurationSchema, DynamoDBStreamSchema, JsonSchema, SnsTopicSchema, SqsQueueSchema, UuidSchema, bigfloat, bigint, date, duration, dynamoDbStream, json, maxDuration, minDuration, positive, precision, snsTopic, sqsQueue, unique, uuid };
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,10 @@ type BigFloatSchema = BaseSchema<string | number | BigFloat | {
|
|
|
16
16
|
declare function bigfloat(pipe?: Pipe<BigFloat>): BigFloatSchema;
|
|
17
17
|
declare function bigfloat(error?: ErrorMessage, pipe?: Pipe<BigFloat>): BigFloatSchema;
|
|
18
18
|
|
|
19
|
+
type BigIntSchema = BaseSchema<string | bigint, bigint>;
|
|
20
|
+
declare function bigint(pipe?: Pipe<bigint>): BigIntSchema;
|
|
21
|
+
declare function bigint(error?: ErrorMessage, pipe?: Pipe<bigint>): BigIntSchema;
|
|
22
|
+
|
|
19
23
|
type DateSchema = BaseSchema<string | Date, Date>;
|
|
20
24
|
declare function date(pipe?: Pipe<Date>): DateSchema;
|
|
21
25
|
declare function date(error?: ErrorMessage, pipe?: Pipe<Date>): DateSchema;
|
|
@@ -43,11 +47,7 @@ type SnsTopicSchema<S extends BaseSchema = UnknownSchema> = BaseSchema<Input<S>
|
|
|
43
47
|
}, Output<S>[]>;
|
|
44
48
|
declare const snsTopic: <S extends BaseSchema<any, any> = UnknownSchema<unknown>>(body?: S | undefined) => SnsTopicSchema<S>;
|
|
45
49
|
|
|
46
|
-
|
|
47
|
-
modify = "MODIFY",
|
|
48
|
-
insert = "INSERT",
|
|
49
|
-
remove = "REMOVE"
|
|
50
|
-
}
|
|
50
|
+
type EventName = 'MODIFY' | 'INSERT' | 'REMOVE';
|
|
51
51
|
type DynamoDBStreamSchema<T extends TableDefinition<any, any, any, any>> = BaseSchema<{
|
|
52
52
|
Records: {
|
|
53
53
|
eventName: EventName;
|
|
@@ -74,4 +74,4 @@ declare function unique<T extends any[]>(compare?: (a: T[number], b: T[number])
|
|
|
74
74
|
declare function minDuration<T extends Duration>(min: Duration, error?: ErrorMessage): valibot.CustomValidation<T>;
|
|
75
75
|
declare function maxDuration<T extends Duration>(max: Duration, error?: ErrorMessage): valibot.CustomValidation<T>;
|
|
76
76
|
|
|
77
|
-
export { BigFloatSchema, DateSchema, DurationSchema, DynamoDBStreamSchema, JsonSchema, SnsTopicSchema, SqsQueueSchema, UuidSchema, bigfloat, date, duration, dynamoDbStream, json, maxDuration, minDuration, positive, precision, snsTopic, sqsQueue, unique, uuid };
|
|
77
|
+
export { BigFloatSchema, BigIntSchema, DateSchema, DurationSchema, DynamoDBStreamSchema, JsonSchema, SnsTopicSchema, SqsQueueSchema, UuidSchema, bigfloat, bigint, date, duration, dynamoDbStream, json, maxDuration, minDuration, positive, precision, snsTopic, sqsQueue, unique, uuid };
|
package/dist/index.js
CHANGED
|
@@ -52,39 +52,58 @@ function bigfloat(arg1, arg2) {
|
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
// src/schema/
|
|
56
|
-
import {
|
|
57
|
-
function
|
|
55
|
+
// src/schema/bigint.ts
|
|
56
|
+
import { bigint as base, defaultArgs as defaultArgs2, regex, string as string3, transform as transform3, union as union2 } from "valibot";
|
|
57
|
+
function bigint2(arg1, arg2) {
|
|
58
58
|
const [error, pipe] = defaultArgs2(arg1, arg2);
|
|
59
59
|
return union2(
|
|
60
60
|
[
|
|
61
61
|
base(pipe),
|
|
62
62
|
transform3(
|
|
63
|
-
string3(),
|
|
63
|
+
string3([regex(/^-?[0-9]+$/)]),
|
|
64
64
|
(input) => {
|
|
65
|
-
return
|
|
65
|
+
return BigInt(input);
|
|
66
66
|
},
|
|
67
67
|
base(pipe)
|
|
68
68
|
)
|
|
69
69
|
],
|
|
70
|
+
error ?? "Invalid BigInt"
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// src/schema/date.ts
|
|
75
|
+
import { defaultArgs as defaultArgs3, date as base2, string as string4, union as union3, transform as transform4 } from "valibot";
|
|
76
|
+
function date(arg1, arg2) {
|
|
77
|
+
const [error, pipe] = defaultArgs3(arg1, arg2);
|
|
78
|
+
return union3(
|
|
79
|
+
[
|
|
80
|
+
base2(pipe),
|
|
81
|
+
transform4(
|
|
82
|
+
string4(),
|
|
83
|
+
(input) => {
|
|
84
|
+
return new Date(input);
|
|
85
|
+
},
|
|
86
|
+
base2(pipe)
|
|
87
|
+
)
|
|
88
|
+
],
|
|
70
89
|
error ?? "Invalid date"
|
|
71
90
|
);
|
|
72
91
|
}
|
|
73
92
|
|
|
74
93
|
// src/schema/uuid.ts
|
|
75
|
-
import { string as
|
|
94
|
+
import { string as string5, uuid as base3, transform as transform5 } from "valibot";
|
|
76
95
|
var uuid = (error) => {
|
|
77
|
-
return
|
|
96
|
+
return transform5(string5(error ?? "Invalid UUID", [base3()]), (v) => v);
|
|
78
97
|
};
|
|
79
98
|
|
|
80
99
|
// src/schema/duration.ts
|
|
81
|
-
import { defaultArgs as
|
|
100
|
+
import { defaultArgs as defaultArgs4, regex as regex2, string as string6, transform as transform6 } from "valibot";
|
|
82
101
|
import { parse } from "@awsless/duration";
|
|
83
102
|
function duration(arg1, arg2) {
|
|
84
|
-
const [msg, pipe] =
|
|
103
|
+
const [msg, pipe] = defaultArgs4(arg1, arg2);
|
|
85
104
|
const error = msg ?? "Invalid duration";
|
|
86
|
-
return
|
|
87
|
-
|
|
105
|
+
return transform6(
|
|
106
|
+
string6(error, [regex2(/^[0-9]+ (milliseconds?|seconds?|minutes?|hours?|days?)/, error)]),
|
|
88
107
|
(value) => {
|
|
89
108
|
return parse(value);
|
|
90
109
|
},
|
|
@@ -93,14 +112,14 @@ function duration(arg1, arg2) {
|
|
|
93
112
|
}
|
|
94
113
|
|
|
95
114
|
// src/schema/aws/sqs-queue.ts
|
|
96
|
-
import { array, object as object2, transform as
|
|
115
|
+
import { array, object as object2, transform as transform7, union as union4, unknown } from "valibot";
|
|
97
116
|
var sqsQueue = (body) => {
|
|
98
117
|
const schema = body ?? unknown();
|
|
99
|
-
return
|
|
118
|
+
return union4(
|
|
100
119
|
[
|
|
101
|
-
|
|
120
|
+
transform7(schema, (input) => [input]),
|
|
102
121
|
array(schema),
|
|
103
|
-
|
|
122
|
+
transform7(
|
|
104
123
|
object2({
|
|
105
124
|
Records: array(
|
|
106
125
|
object2({
|
|
@@ -118,14 +137,14 @@ var sqsQueue = (body) => {
|
|
|
118
137
|
};
|
|
119
138
|
|
|
120
139
|
// src/schema/aws/sns-topic.ts
|
|
121
|
-
import { array as array2, object as object3, transform as
|
|
140
|
+
import { array as array2, object as object3, transform as transform8, union as union5, unknown as unknown2 } from "valibot";
|
|
122
141
|
var snsTopic = (body) => {
|
|
123
142
|
const schema = body ?? unknown2();
|
|
124
|
-
return
|
|
143
|
+
return union5(
|
|
125
144
|
[
|
|
126
|
-
|
|
145
|
+
transform8(schema, (input) => [input]),
|
|
127
146
|
array2(schema),
|
|
128
|
-
|
|
147
|
+
transform8(
|
|
129
148
|
object3({
|
|
130
149
|
Records: array2(
|
|
131
150
|
object3({
|
|
@@ -145,22 +164,17 @@ var snsTopic = (body) => {
|
|
|
145
164
|
};
|
|
146
165
|
|
|
147
166
|
// src/schema/aws/dynamodb-stream.ts
|
|
148
|
-
import { array as array3, object as object4, optional,
|
|
149
|
-
var EventName = /* @__PURE__ */ ((EventName2) => {
|
|
150
|
-
EventName2["modify"] = "MODIFY";
|
|
151
|
-
EventName2["insert"] = "INSERT";
|
|
152
|
-
EventName2["remove"] = "REMOVE";
|
|
153
|
-
return EventName2;
|
|
154
|
-
})(EventName || {});
|
|
167
|
+
import { array as array3, literal, object as object4, optional, transform as transform9, union as union6, unknown as unknown3 } from "valibot";
|
|
155
168
|
var dynamoDbStream = (table) => {
|
|
156
|
-
const marshall = () =>
|
|
157
|
-
return
|
|
169
|
+
const marshall = () => transform9(unknown3(), (value) => table.unmarshall(value));
|
|
170
|
+
return transform9(
|
|
158
171
|
object4(
|
|
159
172
|
{
|
|
160
173
|
Records: array3(
|
|
161
174
|
object4({
|
|
162
|
-
|
|
175
|
+
// For some reason picklist fails to build.
|
|
163
176
|
// eventName: picklist(['MODIFY', 'INSERT', 'REMOVE']),
|
|
177
|
+
eventName: union6([literal("MODIFY"), literal("INSERT"), literal("REMOVE")]),
|
|
164
178
|
dynamodb: object4({
|
|
165
179
|
Keys: marshall(),
|
|
166
180
|
OldImage: optional(marshall()),
|
|
@@ -227,6 +241,7 @@ function maxDuration(max, error) {
|
|
|
227
241
|
}
|
|
228
242
|
export {
|
|
229
243
|
bigfloat,
|
|
244
|
+
bigint2 as bigint,
|
|
230
245
|
date,
|
|
231
246
|
duration,
|
|
232
247
|
dynamoDbStream,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/validate",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@awsless/big-float": "^0.0.4",
|
|
28
28
|
"@awsless/duration": "^0.0.1",
|
|
29
|
-
"@awsless/dynamodb": "^0.0.
|
|
29
|
+
"@awsless/dynamodb": "^0.0.49"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@awsless/big-float": "^0.0.4",
|
|
33
|
-
"@awsless/
|
|
34
|
-
"@awsless/
|
|
33
|
+
"@awsless/dynamodb": "^0.0.49",
|
|
34
|
+
"@awsless/duration": "^0.0.1"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"valibot": "^0.
|
|
37
|
+
"valibot": "^0.30.0"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"test": "pnpm code test",
|