yuppi 1.2.5 → 1.2.7
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 +16 -16
- package/dist/main.d.mts +139 -17
- package/dist/main.d.ts +139 -17
- package/package.json +2 -2
- package/dist/Patterns.barrel-D-k3IHDq.d.mts +0 -20
- package/dist/Patterns.barrel-JdN3lL2Q.d.ts +0 -20
- package/dist/Yuppi.class.d.mts +0 -24
- package/dist/Yuppi.class.d.ts +0 -24
- package/dist/Yuppi.class.js +0 -244
- package/dist/Yuppi.class.mjs +0 -209
- package/dist/barrels/Patterns.barrel.d.mts +0 -7
- package/dist/barrels/Patterns.barrel.d.ts +0 -7
- package/dist/barrels/Patterns.barrel.js +0 -62
- package/dist/barrels/Patterns.barrel.mjs +0 -29
- package/dist/barrels/Types.barrel.d.mts +0 -8
- package/dist/barrels/Types.barrel.d.ts +0 -8
- package/dist/barrels/Types.barrel.js +0 -18
- package/dist/barrels/Types.barrel.mjs +0 -0
- package/dist/defaults/YuppiOptions.default.d.mts +0 -7
- package/dist/defaults/YuppiOptions.default.d.ts +0 -7
- package/dist/defaults/YuppiOptions.default.js +0 -73
- package/dist/defaults/YuppiOptions.default.mjs +0 -48
- package/dist/patterns/Any.pattern.d.mts +0 -3
- package/dist/patterns/Any.pattern.d.ts +0 -3
- package/dist/patterns/Any.pattern.js +0 -30
- package/dist/patterns/Any.pattern.mjs +0 -5
- package/dist/patterns/Domain.pattern.d.mts +0 -3
- package/dist/patterns/Domain.pattern.d.ts +0 -3
- package/dist/patterns/Domain.pattern.js +0 -30
- package/dist/patterns/Domain.pattern.mjs +0 -5
- package/dist/patterns/Email.pattern.d.mts +0 -3
- package/dist/patterns/Email.pattern.d.ts +0 -3
- package/dist/patterns/Email.pattern.js +0 -30
- package/dist/patterns/Email.pattern.mjs +0 -5
- package/dist/patterns/HTTP.pattern.d.mts +0 -3
- package/dist/patterns/HTTP.pattern.d.ts +0 -3
- package/dist/patterns/HTTP.pattern.js +0 -30
- package/dist/patterns/HTTP.pattern.mjs +0 -5
- package/dist/patterns/PhoneNumber.pattern.d.mts +0 -3
- package/dist/patterns/PhoneNumber.pattern.d.ts +0 -3
- package/dist/patterns/PhoneNumber.pattern.js +0 -30
- package/dist/patterns/PhoneNumber.pattern.mjs +0 -5
- package/dist/patterns/URI.pattern.d.mts +0 -3
- package/dist/patterns/URI.pattern.d.ts +0 -3
- package/dist/patterns/URI.pattern.js +0 -30
- package/dist/patterns/URI.pattern.mjs +0 -5
- package/dist/patterns/Username.pattern.d.mts +0 -3
- package/dist/patterns/Username.pattern.d.ts +0 -3
- package/dist/patterns/Username.pattern.js +0 -30
- package/dist/patterns/Username.pattern.mjs +0 -5
- package/dist/types/AnyObject.type.d.mts +0 -5
- package/dist/types/AnyObject.type.d.ts +0 -5
- package/dist/types/AnyObject.type.js +0 -18
- package/dist/types/AnyObject.type.mjs +0 -0
- package/dist/types/JSONSchema.type.d.mts +0 -5
- package/dist/types/JSONSchema.type.d.ts +0 -5
- package/dist/types/JSONSchema.type.js +0 -18
- package/dist/types/JSONSchema.type.mjs +0 -0
- package/dist/types/Schema.type.d.mts +0 -45
- package/dist/types/Schema.type.d.ts +0 -45
- package/dist/types/Schema.type.js +0 -18
- package/dist/types/Schema.type.mjs +0 -0
- package/dist/types/ValidateOptions.type.d.mts +0 -5
- package/dist/types/ValidateOptions.type.d.ts +0 -5
- package/dist/types/ValidateOptions.type.js +0 -18
- package/dist/types/ValidateOptions.type.mjs +0 -0
- package/dist/types/ValidationError.type.d.mts +0 -5
- package/dist/types/ValidationError.type.d.ts +0 -5
- package/dist/types/ValidationError.type.js +0 -18
- package/dist/types/ValidationError.type.mjs +0 -0
- package/dist/types/YuppiOptions.type.d.mts +0 -46
- package/dist/types/YuppiOptions.type.d.ts +0 -46
- package/dist/types/YuppiOptions.type.js +0 -18
- package/dist/types/YuppiOptions.type.mjs +0 -0
- package/dist/utils/ConvertToJSONSchema.util.d.mts +0 -6
- package/dist/utils/ConvertToJSONSchema.util.d.ts +0 -6
- package/dist/utils/ConvertToJSONSchema.util.js +0 -69
- package/dist/utils/ConvertToJSONSchema.util.mjs +0 -44
- package/dist/utils/ConvertToYup.util.d.mts +0 -12
- package/dist/utils/ConvertToYup.util.d.ts +0 -12
- package/dist/utils/ConvertToYup.util.js +0 -140
- package/dist/utils/ConvertToYup.util.mjs +0 -105
package/README.md
CHANGED
|
@@ -125,7 +125,7 @@ Yuppi
|
|
|
125
125
|
Briefly as follows.
|
|
126
126
|
|
|
127
127
|
```typescript
|
|
128
|
-
import { Yuppi, Patterns } from
|
|
128
|
+
import { Yuppi, Patterns } from 'yuppi';
|
|
129
129
|
```
|
|
130
130
|
|
|
131
131
|
### Constructors
|
|
@@ -141,7 +141,7 @@ Yuppi schema builder.
|
|
|
141
141
|
> Example:
|
|
142
142
|
>
|
|
143
143
|
> ```typescript
|
|
144
|
-
> const Yupp
|
|
144
|
+
> const Yupp = new Yuppi();
|
|
145
145
|
> ```
|
|
146
146
|
|
|
147
147
|
### Methods
|
|
@@ -162,7 +162,7 @@ Validate the properties with your Yuppi schema.
|
|
|
162
162
|
> ```typescript
|
|
163
163
|
> const schema: Schema = {
|
|
164
164
|
> display_name: {
|
|
165
|
-
> type:
|
|
165
|
+
> type: 'string',
|
|
166
166
|
> min: 1,
|
|
167
167
|
> max: 32,
|
|
168
168
|
> nullable: false,
|
|
@@ -170,7 +170,7 @@ Validate the properties with your Yuppi schema.
|
|
|
170
170
|
> },
|
|
171
171
|
>
|
|
172
172
|
> username: {
|
|
173
|
-
> type:
|
|
173
|
+
> type: 'string',
|
|
174
174
|
> min: 3,
|
|
175
175
|
> max: 16,
|
|
176
176
|
> pattern: Patterns.Username,
|
|
@@ -179,7 +179,7 @@ Validate the properties with your Yuppi schema.
|
|
|
179
179
|
> },
|
|
180
180
|
>
|
|
181
181
|
> email: {
|
|
182
|
-
> type:
|
|
182
|
+
> type: 'string',
|
|
183
183
|
> pattern: Patterns.Email,
|
|
184
184
|
> lowercase: true,
|
|
185
185
|
> nullable: false,
|
|
@@ -187,10 +187,10 @@ Validate the properties with your Yuppi schema.
|
|
|
187
187
|
> }
|
|
188
188
|
> };
|
|
189
189
|
>
|
|
190
|
-
> const properties
|
|
191
|
-
> display_name:
|
|
192
|
-
> username:
|
|
193
|
-
> email:
|
|
190
|
+
> const properties = {
|
|
191
|
+
> display_name: 'Fırat',
|
|
192
|
+
> username: 'fir4tozden',
|
|
193
|
+
> email: 'fir4tozden@gmail.com'
|
|
194
194
|
> };
|
|
195
195
|
>
|
|
196
196
|
> try {
|
|
@@ -202,7 +202,7 @@ Validate the properties with your Yuppi schema.
|
|
|
202
202
|
> email: "fir4tozden@gmail.com"
|
|
203
203
|
> }
|
|
204
204
|
> */
|
|
205
|
-
> } catch(
|
|
205
|
+
> } catch (error) {
|
|
206
206
|
> console.log(error.message); // "Field email must match the required pattern ^[a-zA-Z0-9._-]+@([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}$"
|
|
207
207
|
> }
|
|
208
208
|
> ```
|
|
@@ -224,7 +224,7 @@ Convert your Yuppi schema into Yup schema.
|
|
|
224
224
|
> ```typescript
|
|
225
225
|
> const schema: Schema = {
|
|
226
226
|
> display_name: {
|
|
227
|
-
> type:
|
|
227
|
+
> type: 'string',
|
|
228
228
|
> min: 1,
|
|
229
229
|
> max: 32,
|
|
230
230
|
> nullable: false,
|
|
@@ -232,7 +232,7 @@ Convert your Yuppi schema into Yup schema.
|
|
|
232
232
|
> },
|
|
233
233
|
>
|
|
234
234
|
> username: {
|
|
235
|
-
> type:
|
|
235
|
+
> type: 'string',
|
|
236
236
|
> min: 3,
|
|
237
237
|
> max: 16,
|
|
238
238
|
> pattern: Patterns.Username,
|
|
@@ -241,7 +241,7 @@ Convert your Yuppi schema into Yup schema.
|
|
|
241
241
|
> },
|
|
242
242
|
>
|
|
243
243
|
> email: {
|
|
244
|
-
> type:
|
|
244
|
+
> type: 'string',
|
|
245
245
|
> pattern: Patterns.Email,
|
|
246
246
|
> lowercase: true,
|
|
247
247
|
> nullable: false,
|
|
@@ -269,7 +269,7 @@ Convert your Yuppi schema into [JSON Schema](https://json-schema.org).
|
|
|
269
269
|
> ```typescript
|
|
270
270
|
> const schema: Schema = {
|
|
271
271
|
> display_name: {
|
|
272
|
-
> type:
|
|
272
|
+
> type: 'string',
|
|
273
273
|
> min: 1,
|
|
274
274
|
> max: 32,
|
|
275
275
|
> nullable: false,
|
|
@@ -277,7 +277,7 @@ Convert your Yuppi schema into [JSON Schema](https://json-schema.org).
|
|
|
277
277
|
> },
|
|
278
278
|
>
|
|
279
279
|
> username: {
|
|
280
|
-
> type:
|
|
280
|
+
> type: 'string',
|
|
281
281
|
> min: 3,
|
|
282
282
|
> max: 16,
|
|
283
283
|
> pattern: Patterns.Username,
|
|
@@ -286,7 +286,7 @@ Convert your Yuppi schema into [JSON Schema](https://json-schema.org).
|
|
|
286
286
|
> },
|
|
287
287
|
>
|
|
288
288
|
> email: {
|
|
289
|
-
> type:
|
|
289
|
+
> type: 'string',
|
|
290
290
|
> pattern: Patterns.Email,
|
|
291
291
|
> lowercase: true,
|
|
292
292
|
> nullable: false,
|
package/dist/main.d.mts
CHANGED
|
@@ -1,17 +1,139 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
import { AnyObject as AnyObject$1, ValidateOptions as ValidateOptions$1, ValidationError as ValidationError$1 } from 'yup';
|
|
3
|
+
import { TObject } from '@sinclair/typebox';
|
|
4
|
+
|
|
5
|
+
type AnyObject = AnyObject$1;
|
|
6
|
+
|
|
7
|
+
type JSONSchema = TObject;
|
|
8
|
+
|
|
9
|
+
type Base = {
|
|
10
|
+
pattern?: string;
|
|
11
|
+
default?: unknown;
|
|
12
|
+
nullable: boolean;
|
|
13
|
+
required: boolean;
|
|
14
|
+
};
|
|
15
|
+
type String = Base & {
|
|
16
|
+
type: 'string';
|
|
17
|
+
enum?: string[];
|
|
18
|
+
min?: number;
|
|
19
|
+
max?: number;
|
|
20
|
+
lowercase?: boolean;
|
|
21
|
+
uppercase?: boolean;
|
|
22
|
+
};
|
|
23
|
+
type Number = Base & {
|
|
24
|
+
type: 'number';
|
|
25
|
+
enum?: number[];
|
|
26
|
+
min?: number;
|
|
27
|
+
max?: number;
|
|
28
|
+
integer?: boolean;
|
|
29
|
+
positive?: boolean;
|
|
30
|
+
negative?: boolean;
|
|
31
|
+
};
|
|
32
|
+
type Boolean = Base & {
|
|
33
|
+
type: 'boolean';
|
|
34
|
+
};
|
|
35
|
+
type Date = Base & {
|
|
36
|
+
type: 'date';
|
|
37
|
+
min?: string;
|
|
38
|
+
max?: string;
|
|
39
|
+
};
|
|
40
|
+
type Object$1 = Base & {
|
|
41
|
+
type: 'object';
|
|
42
|
+
properties: Schema;
|
|
43
|
+
};
|
|
44
|
+
type Array = Base & {
|
|
45
|
+
type: 'array';
|
|
46
|
+
min?: number;
|
|
47
|
+
max?: number;
|
|
48
|
+
items: Types;
|
|
49
|
+
};
|
|
50
|
+
type Types = String | Number | Boolean | Date | Object$1 | Array;
|
|
51
|
+
type Schema = Record<string, Types>;
|
|
52
|
+
|
|
53
|
+
type ValidateOptions = ValidateOptions$1;
|
|
54
|
+
|
|
55
|
+
type YuppiOptions = {
|
|
56
|
+
error_messages?: {
|
|
57
|
+
base?: {
|
|
58
|
+
pattern?: string;
|
|
59
|
+
nullable?: string;
|
|
60
|
+
required?: string;
|
|
61
|
+
};
|
|
62
|
+
string?: {
|
|
63
|
+
type?: string;
|
|
64
|
+
enum?: string;
|
|
65
|
+
min?: string;
|
|
66
|
+
max?: string;
|
|
67
|
+
};
|
|
68
|
+
number?: {
|
|
69
|
+
type?: string;
|
|
70
|
+
enum?: string;
|
|
71
|
+
min?: string;
|
|
72
|
+
max?: string;
|
|
73
|
+
integer?: string;
|
|
74
|
+
positive?: string;
|
|
75
|
+
negative?: string;
|
|
76
|
+
};
|
|
77
|
+
boolean?: {
|
|
78
|
+
type?: string;
|
|
79
|
+
};
|
|
80
|
+
date?: {
|
|
81
|
+
type?: string;
|
|
82
|
+
min?: string;
|
|
83
|
+
max?: string;
|
|
84
|
+
};
|
|
85
|
+
object?: {
|
|
86
|
+
type?: string;
|
|
87
|
+
};
|
|
88
|
+
array?: {
|
|
89
|
+
type?: string;
|
|
90
|
+
min?: string;
|
|
91
|
+
max?: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
validate_options?: ValidateOptions;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
declare class Yuppi {
|
|
98
|
+
private readonly options;
|
|
99
|
+
constructor(options?: YuppiOptions);
|
|
100
|
+
validate(schema: Schema, properties: AnyObject): {
|
|
101
|
+
[x: string]: any;
|
|
102
|
+
[x: number]: any;
|
|
103
|
+
};
|
|
104
|
+
convertToYup(schema: Schema): yup.ObjectSchema<{
|
|
105
|
+
[x: string]: any;
|
|
106
|
+
}, yup.AnyObject, {
|
|
107
|
+
[x: string]: any;
|
|
108
|
+
}, "">;
|
|
109
|
+
convertToJSONSchema(schema: Schema): JSONSchema;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
declare const Any = "[\\s\\S]*";
|
|
113
|
+
|
|
114
|
+
declare const Domain = "^([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}$";
|
|
115
|
+
|
|
116
|
+
declare const Email = "^[a-zA-Z0-9._-]+@([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}$";
|
|
117
|
+
|
|
118
|
+
declare const HTTP = "^(https?:\\/\\/)([a-zA-Z0-9._%+-]+(:[a-zA-Z0-9._%+-]+)?@)?([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}(:\\d+)?(\\/[a-zA-Z0-9._-~%!$&'()*+,;=:@/]*)?(\\?[a-zA-Z0-9._~%!$&'()*+,;=:@/?-]*)?$";
|
|
119
|
+
|
|
120
|
+
declare const PhoneNumber = "^\\d{4}-\\d{7,12}$";
|
|
121
|
+
|
|
122
|
+
declare const URI = "^([a-zA-Z][a-zA-Z0-9+\\-.]*:\\/\\/)([a-zA-Z0-9._%+-]+(:[a-zA-Z0-9._%+-]+)?@)?([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}(:\\d+)?(\\/[a-zA-Z0-9._-~%!$&'()*+,;=:@/]*)?(\\?[a-zA-Z0-9._~%!$&'()*+,;=:@/?-]*)?$";
|
|
123
|
+
|
|
124
|
+
declare const Username = "^(?=.*[a-zA-Z])[a-zA-Z0-9][a-zA-Z0-9_]*$";
|
|
125
|
+
|
|
126
|
+
declare const Patterns_barrel_Any: typeof Any;
|
|
127
|
+
declare const Patterns_barrel_Domain: typeof Domain;
|
|
128
|
+
declare const Patterns_barrel_Email: typeof Email;
|
|
129
|
+
declare const Patterns_barrel_HTTP: typeof HTTP;
|
|
130
|
+
declare const Patterns_barrel_PhoneNumber: typeof PhoneNumber;
|
|
131
|
+
declare const Patterns_barrel_URI: typeof URI;
|
|
132
|
+
declare const Patterns_barrel_Username: typeof Username;
|
|
133
|
+
declare namespace Patterns_barrel {
|
|
134
|
+
export { Patterns_barrel_Any as Any, Patterns_barrel_Domain as Domain, Patterns_barrel_Email as Email, Patterns_barrel_HTTP as HTTP, Patterns_barrel_PhoneNumber as PhoneNumber, Patterns_barrel_URI as URI, Patterns_barrel_Username as Username };
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
type ValidationError = ValidationError$1;
|
|
138
|
+
|
|
139
|
+
export { type AnyObject, type JSONSchema, Patterns_barrel as Patterns, type Schema, type ValidateOptions, type ValidationError, Yuppi, type YuppiOptions };
|
package/dist/main.d.ts
CHANGED
|
@@ -1,17 +1,139 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
import { AnyObject as AnyObject$1, ValidateOptions as ValidateOptions$1, ValidationError as ValidationError$1 } from 'yup';
|
|
3
|
+
import { TObject } from '@sinclair/typebox';
|
|
4
|
+
|
|
5
|
+
type AnyObject = AnyObject$1;
|
|
6
|
+
|
|
7
|
+
type JSONSchema = TObject;
|
|
8
|
+
|
|
9
|
+
type Base = {
|
|
10
|
+
pattern?: string;
|
|
11
|
+
default?: unknown;
|
|
12
|
+
nullable: boolean;
|
|
13
|
+
required: boolean;
|
|
14
|
+
};
|
|
15
|
+
type String = Base & {
|
|
16
|
+
type: 'string';
|
|
17
|
+
enum?: string[];
|
|
18
|
+
min?: number;
|
|
19
|
+
max?: number;
|
|
20
|
+
lowercase?: boolean;
|
|
21
|
+
uppercase?: boolean;
|
|
22
|
+
};
|
|
23
|
+
type Number = Base & {
|
|
24
|
+
type: 'number';
|
|
25
|
+
enum?: number[];
|
|
26
|
+
min?: number;
|
|
27
|
+
max?: number;
|
|
28
|
+
integer?: boolean;
|
|
29
|
+
positive?: boolean;
|
|
30
|
+
negative?: boolean;
|
|
31
|
+
};
|
|
32
|
+
type Boolean = Base & {
|
|
33
|
+
type: 'boolean';
|
|
34
|
+
};
|
|
35
|
+
type Date = Base & {
|
|
36
|
+
type: 'date';
|
|
37
|
+
min?: string;
|
|
38
|
+
max?: string;
|
|
39
|
+
};
|
|
40
|
+
type Object$1 = Base & {
|
|
41
|
+
type: 'object';
|
|
42
|
+
properties: Schema;
|
|
43
|
+
};
|
|
44
|
+
type Array = Base & {
|
|
45
|
+
type: 'array';
|
|
46
|
+
min?: number;
|
|
47
|
+
max?: number;
|
|
48
|
+
items: Types;
|
|
49
|
+
};
|
|
50
|
+
type Types = String | Number | Boolean | Date | Object$1 | Array;
|
|
51
|
+
type Schema = Record<string, Types>;
|
|
52
|
+
|
|
53
|
+
type ValidateOptions = ValidateOptions$1;
|
|
54
|
+
|
|
55
|
+
type YuppiOptions = {
|
|
56
|
+
error_messages?: {
|
|
57
|
+
base?: {
|
|
58
|
+
pattern?: string;
|
|
59
|
+
nullable?: string;
|
|
60
|
+
required?: string;
|
|
61
|
+
};
|
|
62
|
+
string?: {
|
|
63
|
+
type?: string;
|
|
64
|
+
enum?: string;
|
|
65
|
+
min?: string;
|
|
66
|
+
max?: string;
|
|
67
|
+
};
|
|
68
|
+
number?: {
|
|
69
|
+
type?: string;
|
|
70
|
+
enum?: string;
|
|
71
|
+
min?: string;
|
|
72
|
+
max?: string;
|
|
73
|
+
integer?: string;
|
|
74
|
+
positive?: string;
|
|
75
|
+
negative?: string;
|
|
76
|
+
};
|
|
77
|
+
boolean?: {
|
|
78
|
+
type?: string;
|
|
79
|
+
};
|
|
80
|
+
date?: {
|
|
81
|
+
type?: string;
|
|
82
|
+
min?: string;
|
|
83
|
+
max?: string;
|
|
84
|
+
};
|
|
85
|
+
object?: {
|
|
86
|
+
type?: string;
|
|
87
|
+
};
|
|
88
|
+
array?: {
|
|
89
|
+
type?: string;
|
|
90
|
+
min?: string;
|
|
91
|
+
max?: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
validate_options?: ValidateOptions;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
declare class Yuppi {
|
|
98
|
+
private readonly options;
|
|
99
|
+
constructor(options?: YuppiOptions);
|
|
100
|
+
validate(schema: Schema, properties: AnyObject): {
|
|
101
|
+
[x: string]: any;
|
|
102
|
+
[x: number]: any;
|
|
103
|
+
};
|
|
104
|
+
convertToYup(schema: Schema): yup.ObjectSchema<{
|
|
105
|
+
[x: string]: any;
|
|
106
|
+
}, yup.AnyObject, {
|
|
107
|
+
[x: string]: any;
|
|
108
|
+
}, "">;
|
|
109
|
+
convertToJSONSchema(schema: Schema): JSONSchema;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
declare const Any = "[\\s\\S]*";
|
|
113
|
+
|
|
114
|
+
declare const Domain = "^([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}$";
|
|
115
|
+
|
|
116
|
+
declare const Email = "^[a-zA-Z0-9._-]+@([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}$";
|
|
117
|
+
|
|
118
|
+
declare const HTTP = "^(https?:\\/\\/)([a-zA-Z0-9._%+-]+(:[a-zA-Z0-9._%+-]+)?@)?([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}(:\\d+)?(\\/[a-zA-Z0-9._-~%!$&'()*+,;=:@/]*)?(\\?[a-zA-Z0-9._~%!$&'()*+,;=:@/?-]*)?$";
|
|
119
|
+
|
|
120
|
+
declare const PhoneNumber = "^\\d{4}-\\d{7,12}$";
|
|
121
|
+
|
|
122
|
+
declare const URI = "^([a-zA-Z][a-zA-Z0-9+\\-.]*:\\/\\/)([a-zA-Z0-9._%+-]+(:[a-zA-Z0-9._%+-]+)?@)?([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}(:\\d+)?(\\/[a-zA-Z0-9._-~%!$&'()*+,;=:@/]*)?(\\?[a-zA-Z0-9._~%!$&'()*+,;=:@/?-]*)?$";
|
|
123
|
+
|
|
124
|
+
declare const Username = "^(?=.*[a-zA-Z])[a-zA-Z0-9][a-zA-Z0-9_]*$";
|
|
125
|
+
|
|
126
|
+
declare const Patterns_barrel_Any: typeof Any;
|
|
127
|
+
declare const Patterns_barrel_Domain: typeof Domain;
|
|
128
|
+
declare const Patterns_barrel_Email: typeof Email;
|
|
129
|
+
declare const Patterns_barrel_HTTP: typeof HTTP;
|
|
130
|
+
declare const Patterns_barrel_PhoneNumber: typeof PhoneNumber;
|
|
131
|
+
declare const Patterns_barrel_URI: typeof URI;
|
|
132
|
+
declare const Patterns_barrel_Username: typeof Username;
|
|
133
|
+
declare namespace Patterns_barrel {
|
|
134
|
+
export { Patterns_barrel_Any as Any, Patterns_barrel_Domain as Domain, Patterns_barrel_Email as Email, Patterns_barrel_HTTP as HTTP, Patterns_barrel_PhoneNumber as PhoneNumber, Patterns_barrel_URI as URI, Patterns_barrel_Username as Username };
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
type ValidationError = ValidationError$1;
|
|
138
|
+
|
|
139
|
+
export { type AnyObject, type JSONSchema, Patterns_barrel as Patterns, type Schema, type ValidateOptions, type ValidationError, Yuppi, type YuppiOptions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yuppi",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "Schemas that can be converted to Yup and JSON Schema.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/keift/yuppi",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"yup": "^1.7.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"neatlint": "^1.1.
|
|
24
|
+
"neatlint": "^1.1.8",
|
|
25
25
|
"prettier": "^3.6.2",
|
|
26
26
|
"tsup": "^8.5.0"
|
|
27
27
|
},
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Any } from './patterns/Any.pattern.mjs';
|
|
2
|
-
import { Domain } from './patterns/Domain.pattern.mjs';
|
|
3
|
-
import { Email } from './patterns/Email.pattern.mjs';
|
|
4
|
-
import { HTTP } from './patterns/HTTP.pattern.mjs';
|
|
5
|
-
import { PhoneNumber } from './patterns/PhoneNumber.pattern.mjs';
|
|
6
|
-
import { URI } from './patterns/URI.pattern.mjs';
|
|
7
|
-
import { Username } from './patterns/Username.pattern.mjs';
|
|
8
|
-
|
|
9
|
-
declare const Patterns_barrel_Any: typeof Any;
|
|
10
|
-
declare const Patterns_barrel_Domain: typeof Domain;
|
|
11
|
-
declare const Patterns_barrel_Email: typeof Email;
|
|
12
|
-
declare const Patterns_barrel_HTTP: typeof HTTP;
|
|
13
|
-
declare const Patterns_barrel_PhoneNumber: typeof PhoneNumber;
|
|
14
|
-
declare const Patterns_barrel_URI: typeof URI;
|
|
15
|
-
declare const Patterns_barrel_Username: typeof Username;
|
|
16
|
-
declare namespace Patterns_barrel {
|
|
17
|
-
export { Patterns_barrel_Any as Any, Patterns_barrel_Domain as Domain, Patterns_barrel_Email as Email, Patterns_barrel_HTTP as HTTP, Patterns_barrel_PhoneNumber as PhoneNumber, Patterns_barrel_URI as URI, Patterns_barrel_Username as Username };
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { Patterns_barrel as P };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Any } from './patterns/Any.pattern.js';
|
|
2
|
-
import { Domain } from './patterns/Domain.pattern.js';
|
|
3
|
-
import { Email } from './patterns/Email.pattern.js';
|
|
4
|
-
import { HTTP } from './patterns/HTTP.pattern.js';
|
|
5
|
-
import { PhoneNumber } from './patterns/PhoneNumber.pattern.js';
|
|
6
|
-
import { URI } from './patterns/URI.pattern.js';
|
|
7
|
-
import { Username } from './patterns/Username.pattern.js';
|
|
8
|
-
|
|
9
|
-
declare const Patterns_barrel_Any: typeof Any;
|
|
10
|
-
declare const Patterns_barrel_Domain: typeof Domain;
|
|
11
|
-
declare const Patterns_barrel_Email: typeof Email;
|
|
12
|
-
declare const Patterns_barrel_HTTP: typeof HTTP;
|
|
13
|
-
declare const Patterns_barrel_PhoneNumber: typeof PhoneNumber;
|
|
14
|
-
declare const Patterns_barrel_URI: typeof URI;
|
|
15
|
-
declare const Patterns_barrel_Username: typeof Username;
|
|
16
|
-
declare namespace Patterns_barrel {
|
|
17
|
-
export { Patterns_barrel_Any as Any, Patterns_barrel_Domain as Domain, Patterns_barrel_Email as Email, Patterns_barrel_HTTP as HTTP, Patterns_barrel_PhoneNumber as PhoneNumber, Patterns_barrel_URI as URI, Patterns_barrel_Username as Username };
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { Patterns_barrel as P };
|
package/dist/Yuppi.class.d.mts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as yup from 'yup';
|
|
2
|
-
import { AnyObject } from './types/AnyObject.type.mjs';
|
|
3
|
-
import { JSONSchema } from './types/JSONSchema.type.mjs';
|
|
4
|
-
import { Schema } from './types/Schema.type.mjs';
|
|
5
|
-
import { YuppiOptions } from './types/YuppiOptions.type.mjs';
|
|
6
|
-
import '@sinclair/typebox';
|
|
7
|
-
import './types/ValidateOptions.type.mjs';
|
|
8
|
-
|
|
9
|
-
declare class Yuppi {
|
|
10
|
-
private readonly options;
|
|
11
|
-
constructor(options?: YuppiOptions);
|
|
12
|
-
validate(schema: Schema, properties: AnyObject): {
|
|
13
|
-
[x: string]: any;
|
|
14
|
-
[x: number]: any;
|
|
15
|
-
};
|
|
16
|
-
convertToYup(schema: Schema): yup.ObjectSchema<{
|
|
17
|
-
[x: string]: any;
|
|
18
|
-
}, yup.AnyObject, {
|
|
19
|
-
[x: string]: any;
|
|
20
|
-
}, "">;
|
|
21
|
-
convertToJSONSchema(schema: Schema): JSONSchema;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { Yuppi };
|
package/dist/Yuppi.class.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as yup from 'yup';
|
|
2
|
-
import { AnyObject } from './types/AnyObject.type.js';
|
|
3
|
-
import { JSONSchema } from './types/JSONSchema.type.js';
|
|
4
|
-
import { Schema } from './types/Schema.type.js';
|
|
5
|
-
import { YuppiOptions } from './types/YuppiOptions.type.js';
|
|
6
|
-
import '@sinclair/typebox';
|
|
7
|
-
import './types/ValidateOptions.type.js';
|
|
8
|
-
|
|
9
|
-
declare class Yuppi {
|
|
10
|
-
private readonly options;
|
|
11
|
-
constructor(options?: YuppiOptions);
|
|
12
|
-
validate(schema: Schema, properties: AnyObject): {
|
|
13
|
-
[x: string]: any;
|
|
14
|
-
[x: number]: any;
|
|
15
|
-
};
|
|
16
|
-
convertToYup(schema: Schema): yup.ObjectSchema<{
|
|
17
|
-
[x: string]: any;
|
|
18
|
-
}, yup.AnyObject, {
|
|
19
|
-
[x: string]: any;
|
|
20
|
-
}, "">;
|
|
21
|
-
convertToJSONSchema(schema: Schema): JSONSchema;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { Yuppi };
|