@awsless/validate 0.1.0 → 0.1.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/dist/index.d.cts +17 -27
- package/dist/index.d.ts +17 -27
- package/dist/index.js +9 -1
- package/package.json +6 -6
package/dist/index.d.cts
CHANGED
|
@@ -1,47 +1,38 @@
|
|
|
1
1
|
import * as valibot from 'valibot';
|
|
2
|
-
import {
|
|
2
|
+
import { GenericSchema, ErrorMessage, GenericIssue, BaseSchema, InferOutput, InferInput, CheckIssue } from 'valibot';
|
|
3
3
|
export * from 'valibot';
|
|
4
4
|
import { BigFloat } from '@awsless/big-float';
|
|
5
5
|
import { UUID } from 'crypto';
|
|
6
6
|
import { Duration } from '@awsless/duration';
|
|
7
7
|
import { AnyTable, PrimaryKey, Infer } from '@awsless/dynamodb';
|
|
8
8
|
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
type JsonSchema<T extends Schema$2> = BaseSchema<string, InferOutput<T>, JsonIssue>;
|
|
12
|
-
declare const json: <T extends Schema$2>(schema: T, message?: ErrorMessage<JsonIssue>) => JsonSchema<T>;
|
|
9
|
+
type JsonSchema<T extends GenericSchema> = BaseSchema<string, InferOutput<T>, GenericIssue>;
|
|
10
|
+
declare const json: <T extends GenericSchema>(schema: T, message?: ErrorMessage<GenericIssue>) => JsonSchema<T>;
|
|
13
11
|
|
|
14
|
-
type
|
|
15
|
-
|
|
16
|
-
declare function bigfloat(message?: ErrorMessage<BigFloatIssue>): BigFloatSchema;
|
|
12
|
+
type BigFloatSchema = BaseSchema<BigFloat | string | bigint | number, BigFloat, GenericIssue>;
|
|
13
|
+
declare function bigfloat(message?: ErrorMessage<GenericIssue>): BigFloatSchema;
|
|
17
14
|
|
|
18
|
-
type
|
|
19
|
-
|
|
20
|
-
declare const uuid: (message?: ErrorMessage<UuidIssue>) => UuidSchema;
|
|
15
|
+
type UuidSchema = BaseSchema<UUID, UUID, GenericIssue>;
|
|
16
|
+
declare const uuid: (message?: ErrorMessage<GenericIssue>) => UuidSchema;
|
|
21
17
|
|
|
22
|
-
type
|
|
23
|
-
|
|
24
|
-
declare function duration(message?: ErrorMessage<DurationIssue>): DurationSchema;
|
|
18
|
+
type DurationSchema = BaseSchema<Duration, Duration, GenericIssue>;
|
|
19
|
+
declare function duration(message?: ErrorMessage<GenericIssue>): DurationSchema;
|
|
25
20
|
|
|
26
|
-
type
|
|
27
|
-
type SqsQueueIssue = BaseIssue<unknown>;
|
|
28
|
-
type SqsQueueSchema<S extends Schema$1> = BaseSchema<InferInput<S> | InferInput<S>[] | {
|
|
21
|
+
type SqsQueueSchema<S extends GenericSchema> = BaseSchema<InferInput<S> | InferInput<S>[] | {
|
|
29
22
|
Records: {
|
|
30
23
|
body: string | InferInput<S>;
|
|
31
24
|
}[];
|
|
32
|
-
}, InferOutput<S>[],
|
|
33
|
-
declare const sqsQueue: <S extends
|
|
25
|
+
}, InferOutput<S>[], GenericIssue>;
|
|
26
|
+
declare const sqsQueue: <S extends GenericSchema>(schema: S, message?: ErrorMessage<GenericIssue>) => SqsQueueSchema<S>;
|
|
34
27
|
|
|
35
|
-
type
|
|
36
|
-
type SnsTopicIssue = BaseIssue<unknown>;
|
|
37
|
-
type SnsTopicSchema<S extends Schema> = BaseSchema<InferInput<S> | InferInput<S>[] | {
|
|
28
|
+
type SnsTopicSchema<S extends GenericSchema> = BaseSchema<InferInput<S> | InferInput<S>[] | {
|
|
38
29
|
Records: {
|
|
39
30
|
Sns: {
|
|
40
31
|
Message: string | InferInput<S>;
|
|
41
32
|
};
|
|
42
33
|
}[];
|
|
43
|
-
}, InferOutput<S>[],
|
|
44
|
-
declare const snsTopic: <S extends
|
|
34
|
+
}, InferOutput<S>[], GenericIssue>;
|
|
35
|
+
declare const snsTopic: <S extends GenericSchema>(schema: S, message?: ErrorMessage<GenericIssue>) => SnsTopicSchema<S>;
|
|
45
36
|
|
|
46
37
|
type DynamoDBStreamInputRecord = {
|
|
47
38
|
eventName: 'MODIFY';
|
|
@@ -77,11 +68,10 @@ type DynamoDBStreamOutputRecord<T extends AnyTable> = {
|
|
|
77
68
|
keys: PrimaryKey<T>;
|
|
78
69
|
old: Infer<T>;
|
|
79
70
|
};
|
|
80
|
-
type DynamoDBStreamIssue = BaseIssue<unknown>;
|
|
81
71
|
type DynamoDBStreamSchema<T extends AnyTable> = BaseSchema<{
|
|
82
72
|
Records: DynamoDBStreamInputRecord[];
|
|
83
|
-
}, DynamoDBStreamOutputRecord<T>[],
|
|
84
|
-
declare const dynamoDbStream: <T extends AnyTable>(table: T, message?: ErrorMessage<
|
|
73
|
+
}, DynamoDBStreamOutputRecord<T>[], GenericIssue>;
|
|
74
|
+
declare const dynamoDbStream: <T extends AnyTable>(table: T, message?: ErrorMessage<GenericIssue>) => DynamoDBStreamSchema<T>;
|
|
85
75
|
|
|
86
76
|
declare function positive<T extends BigFloat | number>(message?: ErrorMessage<CheckIssue<T>>): valibot.CheckAction<T, ErrorMessage<CheckIssue<T>>>;
|
|
87
77
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,47 +1,38 @@
|
|
|
1
1
|
import * as valibot from 'valibot';
|
|
2
|
-
import {
|
|
2
|
+
import { GenericSchema, ErrorMessage, GenericIssue, BaseSchema, InferOutput, InferInput, CheckIssue } from 'valibot';
|
|
3
3
|
export * from 'valibot';
|
|
4
4
|
import { BigFloat } from '@awsless/big-float';
|
|
5
5
|
import { UUID } from 'crypto';
|
|
6
6
|
import { Duration } from '@awsless/duration';
|
|
7
7
|
import { AnyTable, PrimaryKey, Infer } from '@awsless/dynamodb';
|
|
8
8
|
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
type JsonSchema<T extends Schema$2> = BaseSchema<string, InferOutput<T>, JsonIssue>;
|
|
12
|
-
declare const json: <T extends Schema$2>(schema: T, message?: ErrorMessage<JsonIssue>) => JsonSchema<T>;
|
|
9
|
+
type JsonSchema<T extends GenericSchema> = BaseSchema<string, InferOutput<T>, GenericIssue>;
|
|
10
|
+
declare const json: <T extends GenericSchema>(schema: T, message?: ErrorMessage<GenericIssue>) => JsonSchema<T>;
|
|
13
11
|
|
|
14
|
-
type
|
|
15
|
-
|
|
16
|
-
declare function bigfloat(message?: ErrorMessage<BigFloatIssue>): BigFloatSchema;
|
|
12
|
+
type BigFloatSchema = BaseSchema<BigFloat | string | bigint | number, BigFloat, GenericIssue>;
|
|
13
|
+
declare function bigfloat(message?: ErrorMessage<GenericIssue>): BigFloatSchema;
|
|
17
14
|
|
|
18
|
-
type
|
|
19
|
-
|
|
20
|
-
declare const uuid: (message?: ErrorMessage<UuidIssue>) => UuidSchema;
|
|
15
|
+
type UuidSchema = BaseSchema<UUID, UUID, GenericIssue>;
|
|
16
|
+
declare const uuid: (message?: ErrorMessage<GenericIssue>) => UuidSchema;
|
|
21
17
|
|
|
22
|
-
type
|
|
23
|
-
|
|
24
|
-
declare function duration(message?: ErrorMessage<DurationIssue>): DurationSchema;
|
|
18
|
+
type DurationSchema = BaseSchema<Duration, Duration, GenericIssue>;
|
|
19
|
+
declare function duration(message?: ErrorMessage<GenericIssue>): DurationSchema;
|
|
25
20
|
|
|
26
|
-
type
|
|
27
|
-
type SqsQueueIssue = BaseIssue<unknown>;
|
|
28
|
-
type SqsQueueSchema<S extends Schema$1> = BaseSchema<InferInput<S> | InferInput<S>[] | {
|
|
21
|
+
type SqsQueueSchema<S extends GenericSchema> = BaseSchema<InferInput<S> | InferInput<S>[] | {
|
|
29
22
|
Records: {
|
|
30
23
|
body: string | InferInput<S>;
|
|
31
24
|
}[];
|
|
32
|
-
}, InferOutput<S>[],
|
|
33
|
-
declare const sqsQueue: <S extends
|
|
25
|
+
}, InferOutput<S>[], GenericIssue>;
|
|
26
|
+
declare const sqsQueue: <S extends GenericSchema>(schema: S, message?: ErrorMessage<GenericIssue>) => SqsQueueSchema<S>;
|
|
34
27
|
|
|
35
|
-
type
|
|
36
|
-
type SnsTopicIssue = BaseIssue<unknown>;
|
|
37
|
-
type SnsTopicSchema<S extends Schema> = BaseSchema<InferInput<S> | InferInput<S>[] | {
|
|
28
|
+
type SnsTopicSchema<S extends GenericSchema> = BaseSchema<InferInput<S> | InferInput<S>[] | {
|
|
38
29
|
Records: {
|
|
39
30
|
Sns: {
|
|
40
31
|
Message: string | InferInput<S>;
|
|
41
32
|
};
|
|
42
33
|
}[];
|
|
43
|
-
}, InferOutput<S>[],
|
|
44
|
-
declare const snsTopic: <S extends
|
|
34
|
+
}, InferOutput<S>[], GenericIssue>;
|
|
35
|
+
declare const snsTopic: <S extends GenericSchema>(schema: S, message?: ErrorMessage<GenericIssue>) => SnsTopicSchema<S>;
|
|
45
36
|
|
|
46
37
|
type DynamoDBStreamInputRecord = {
|
|
47
38
|
eventName: 'MODIFY';
|
|
@@ -77,11 +68,10 @@ type DynamoDBStreamOutputRecord<T extends AnyTable> = {
|
|
|
77
68
|
keys: PrimaryKey<T>;
|
|
78
69
|
old: Infer<T>;
|
|
79
70
|
};
|
|
80
|
-
type DynamoDBStreamIssue = BaseIssue<unknown>;
|
|
81
71
|
type DynamoDBStreamSchema<T extends AnyTable> = BaseSchema<{
|
|
82
72
|
Records: DynamoDBStreamInputRecord[];
|
|
83
|
-
}, DynamoDBStreamOutputRecord<T>[],
|
|
84
|
-
declare const dynamoDbStream: <T extends AnyTable>(table: T, message?: ErrorMessage<
|
|
73
|
+
}, DynamoDBStreamOutputRecord<T>[], GenericIssue>;
|
|
74
|
+
declare const dynamoDbStream: <T extends AnyTable>(table: T, message?: ErrorMessage<GenericIssue>) => DynamoDBStreamSchema<T>;
|
|
85
75
|
|
|
86
76
|
declare function positive<T extends BigFloat | number>(message?: ErrorMessage<CheckIssue<T>>): valibot.CheckAction<T, ErrorMessage<CheckIssue<T>>>;
|
|
87
77
|
|
package/dist/index.js
CHANGED
|
@@ -137,7 +137,15 @@ var snsTopic = (schema, message = "Invalid SNS Topic payload") => {
|
|
|
137
137
|
};
|
|
138
138
|
|
|
139
139
|
// src/schema/aws/dynamodb-stream.ts
|
|
140
|
-
import {
|
|
140
|
+
import {
|
|
141
|
+
array as array3,
|
|
142
|
+
literal,
|
|
143
|
+
object as object3,
|
|
144
|
+
pipe as pipe6,
|
|
145
|
+
transform as transform4,
|
|
146
|
+
unknown,
|
|
147
|
+
variant
|
|
148
|
+
} from "valibot";
|
|
141
149
|
var dynamoDbStream = (table, message = "Invalid DynamoDB Stream payload") => {
|
|
142
150
|
const unmarshall = () => pipe6(
|
|
143
151
|
unknown(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/validate",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -24,16 +24,16 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@awsless/duration": "^0.0.4",
|
|
28
|
-
"@awsless/json": "^0.0.10",
|
|
29
27
|
"@awsless/dynamodb": "^0.3.2",
|
|
30
|
-
"@awsless/big-float": "^0.1.5"
|
|
28
|
+
"@awsless/big-float": "^0.1.5",
|
|
29
|
+
"@awsless/json": "^0.0.10",
|
|
30
|
+
"@awsless/duration": "^0.0.4"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@awsless/big-float": "^0.1.5",
|
|
34
34
|
"@awsless/dynamodb": "^0.3.2",
|
|
35
|
-
"@awsless/
|
|
36
|
-
"@awsless/
|
|
35
|
+
"@awsless/json": "^0.0.10",
|
|
36
|
+
"@awsless/duration": "^0.0.4"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"valibot": "^1.2.0"
|