yuppi 1.0.0
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/LICENSE.md +9 -0
- package/README.md +368 -0
- package/dist/Patterns.barrel-KU6hZBXs.d.mts +14 -0
- package/dist/Patterns.barrel-UKU2yPZ6.d.ts +14 -0
- package/dist/Types.barrel--XGUUjIp.d.mts +18 -0
- package/dist/Types.barrel-wzQq8e9v.d.ts +18 -0
- package/dist/Yuppi.class.d.mts +17 -0
- package/dist/Yuppi.class.d.ts +17 -0
- package/dist/Yuppi.class.js +212 -0
- package/dist/Yuppi.class.mjs +177 -0
- package/dist/barrels/Patterns.barrel.d.mts +5 -0
- package/dist/barrels/Patterns.barrel.d.ts +5 -0
- package/dist/barrels/Patterns.barrel.js +47 -0
- package/dist/barrels/Patterns.barrel.mjs +17 -0
- package/dist/barrels/Types.barrel.d.mts +8 -0
- package/dist/barrels/Types.barrel.d.ts +8 -0
- package/dist/barrels/Types.barrel.js +18 -0
- package/dist/barrels/Types.barrel.mjs +0 -0
- package/dist/defaults/YuppiOptions.default.d.mts +7 -0
- package/dist/defaults/YuppiOptions.default.d.ts +7 -0
- package/dist/defaults/YuppiOptions.default.js +71 -0
- package/dist/defaults/YuppiOptions.default.mjs +46 -0
- package/dist/main.d.mts +15 -0
- package/dist/main.d.ts +15 -0
- package/dist/main.js +237 -0
- package/dist/main.mjs +205 -0
- package/dist/patterns/Email.pattern.d.mts +5 -0
- package/dist/patterns/Email.pattern.d.ts +5 -0
- package/dist/patterns/Email.pattern.js +30 -0
- package/dist/patterns/Email.pattern.mjs +5 -0
- package/dist/patterns/PhoneNumber.pattern.d.mts +5 -0
- package/dist/patterns/PhoneNumber.pattern.d.ts +5 -0
- package/dist/patterns/PhoneNumber.pattern.js +30 -0
- package/dist/patterns/PhoneNumber.pattern.mjs +5 -0
- package/dist/patterns/URL.pattern.d.mts +5 -0
- package/dist/patterns/URL.pattern.d.ts +5 -0
- package/dist/patterns/URL.pattern.js +30 -0
- package/dist/patterns/URL.pattern.mjs +5 -0
- package/dist/patterns/Username.pattern.d.mts +5 -0
- package/dist/patterns/Username.pattern.d.ts +5 -0
- package/dist/patterns/Username.pattern.js +30 -0
- package/dist/patterns/Username.pattern.mjs +5 -0
- package/dist/types/AnyObject.type.d.mts +5 -0
- package/dist/types/AnyObject.type.d.ts +5 -0
- package/dist/types/AnyObject.type.js +18 -0
- package/dist/types/AnyObject.type.mjs +0 -0
- package/dist/types/JSONSchema.type.d.mts +5 -0
- package/dist/types/JSONSchema.type.d.ts +5 -0
- package/dist/types/JSONSchema.type.js +18 -0
- package/dist/types/JSONSchema.type.mjs +0 -0
- package/dist/types/Schema.type.d.mts +45 -0
- package/dist/types/Schema.type.d.ts +45 -0
- package/dist/types/Schema.type.js +18 -0
- package/dist/types/Schema.type.mjs +0 -0
- package/dist/types/ValidateOptions.type.d.mts +5 -0
- package/dist/types/ValidateOptions.type.d.ts +5 -0
- package/dist/types/ValidateOptions.type.js +18 -0
- package/dist/types/ValidateOptions.type.mjs +0 -0
- package/dist/types/ValidationError.type.d.mts +5 -0
- package/dist/types/ValidationError.type.d.ts +5 -0
- package/dist/types/ValidationError.type.js +18 -0
- package/dist/types/ValidationError.type.mjs +0 -0
- package/dist/types/YuppiOptions.type.d.mts +44 -0
- package/dist/types/YuppiOptions.type.d.ts +44 -0
- package/dist/types/YuppiOptions.type.js +18 -0
- package/dist/types/YuppiOptions.type.mjs +0 -0
- package/dist/utils/ConvertToJSONSchema.util.d.mts +6 -0
- package/dist/utils/ConvertToJSONSchema.util.d.ts +6 -0
- package/dist/utils/ConvertToJSONSchema.util.js +64 -0
- package/dist/utils/ConvertToJSONSchema.util.mjs +39 -0
- package/dist/utils/ConvertToYup.util.d.mts +9 -0
- package/dist/utils/ConvertToYup.util.d.ts +9 -0
- package/dist/utils/ConvertToYup.util.js +110 -0
- package/dist/utils/ConvertToYup.util.mjs +75 -0
- package/package.json +42 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Keift
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
[String]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
2
|
+
[Number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
3
|
+
[Date]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
|
|
4
|
+
[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
5
|
+
[Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
6
|
+
[Boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
7
|
+
[Buffer]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
|
|
8
|
+
[Function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function
|
|
9
|
+
[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
10
|
+
[Void]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined
|
|
11
|
+
[Email]: ./src/patterns/Email.pattern.ts
|
|
12
|
+
[PhoneNumber]: ./src/patterns/PhoneNumber.pattern.ts
|
|
13
|
+
[URL]: ./src/patterns/URL.pattern.ts
|
|
14
|
+
[Username]: ./src/patterns/Username.pattern.ts
|
|
15
|
+
[YuppiOptionsDefault]: ./src/defaults/YuppiOptions.default.ts
|
|
16
|
+
[AnyObject]: https://github.com/jquense/yup/blob/master/src/util/objectTypes.ts#L7
|
|
17
|
+
[JSONSchema]: https://github.com/sinclairzx81/typebox/blob/master/src/type/object/object.ts#L78
|
|
18
|
+
[Schema]: ./src/types/Schema.type.ts
|
|
19
|
+
[ValidateOptions]: https://github.com/jquense/yup/blob/master/src/types.ts#L47
|
|
20
|
+
[ValidationError]: https://github.com/jquense/yup/blob/master/src/ValidationError.ts#L53
|
|
21
|
+
[YuppiOptions]: ./src/types/YuppiOptions.type.ts
|
|
22
|
+
|
|
23
|
+
<div align="center">
|
|
24
|
+
<br/>
|
|
25
|
+
<img src="https://i.ibb.co/B5bQXHSM/unknown.png" width="350px"/>
|
|
26
|
+
<br/>
|
|
27
|
+
<br/>
|
|
28
|
+
<img src="https://img.shields.io/npm/v/yuppi?label=version&color=%23633BFF"/>
|
|
29
|
+
<img src="https://img.shields.io/npm/l/yuppi?label=license&color=%23633BFF"/>
|
|
30
|
+
<img src="https://img.shields.io/npm/dt/yuppi?label=downloads&color=%2300927F"/>
|
|
31
|
+
<img src="https://img.shields.io/npm/unpacked-size/yuppi?label=size&color=%2300927F"/>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
## Contents
|
|
35
|
+
|
|
36
|
+
- [About](#about)
|
|
37
|
+
- [Features](#features)
|
|
38
|
+
- [Installation](#installation)
|
|
39
|
+
- [Documentation](#documentation)
|
|
40
|
+
- [Tree](#tree)
|
|
41
|
+
- [Import](#import)
|
|
42
|
+
- [Constructors](#constructors)
|
|
43
|
+
- [Methods](#methods)
|
|
44
|
+
- [Patterns](#patterns)
|
|
45
|
+
- [Types](#types)
|
|
46
|
+
- [Links](#links)
|
|
47
|
+
- [Discord](https://discord.gg/keift)
|
|
48
|
+
- [Telegram](https://t.me/keiftt)
|
|
49
|
+
- [Twitter](https://x.com/keiftttt)
|
|
50
|
+
- [GitHub](https://github.com/keift)
|
|
51
|
+
- [License](#license)
|
|
52
|
+
|
|
53
|
+
## About
|
|
54
|
+
|
|
55
|
+
Schemas that can be converted to Yup and JSON Schema.
|
|
56
|
+
|
|
57
|
+
## Features
|
|
58
|
+
|
|
59
|
+
- Easy and understandable schema
|
|
60
|
+
- Works with Yup, stable and secure
|
|
61
|
+
- Targeted for API endpoints
|
|
62
|
+
- It is strict and therefore does not accept more than one type
|
|
63
|
+
- Error messages are ready to be understood but can be edited if desired
|
|
64
|
+
- Can be converted to Yup and [JSON Schema](https://json-schema.org). JSON Schema is OpenAPI compatible
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
|
|
68
|
+
You can install it as follows.
|
|
69
|
+
|
|
70
|
+
```shell
|
|
71
|
+
// NPM
|
|
72
|
+
npm install yuppi
|
|
73
|
+
|
|
74
|
+
// PNPM
|
|
75
|
+
pnpm install yuppi
|
|
76
|
+
|
|
77
|
+
// Yarn
|
|
78
|
+
yarn add yuppi
|
|
79
|
+
|
|
80
|
+
// Bun
|
|
81
|
+
bun add yuppi
|
|
82
|
+
|
|
83
|
+
// Deno
|
|
84
|
+
deno install npm:yuppi
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Documentation
|
|
88
|
+
|
|
89
|
+
### Tree
|
|
90
|
+
|
|
91
|
+
Briefly as follows.
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
Yuppi
|
|
95
|
+
│
|
|
96
|
+
├── new Yuppi(options?)
|
|
97
|
+
│ │
|
|
98
|
+
│ ├── validate(schema, properties)
|
|
99
|
+
│ ├── convertToYup(schema)
|
|
100
|
+
│ └── convertToJSONSchema(schema)
|
|
101
|
+
│
|
|
102
|
+
├── Patterns
|
|
103
|
+
│ ├── Email
|
|
104
|
+
│ ├── PhoneNumber
|
|
105
|
+
│ ├── URL
|
|
106
|
+
│ └── Username
|
|
107
|
+
│
|
|
108
|
+
└── type Types
|
|
109
|
+
│
|
|
110
|
+
├── AnyObject
|
|
111
|
+
├── JSONSchema
|
|
112
|
+
├── Schema
|
|
113
|
+
├── ValidateOptions
|
|
114
|
+
├── ValidationError
|
|
115
|
+
└── YuppiOptions
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Import
|
|
119
|
+
|
|
120
|
+
Briefly as follows.
|
|
121
|
+
|
|
122
|
+
> TypeScript
|
|
123
|
+
>
|
|
124
|
+
> ```typescript
|
|
125
|
+
> import { Yuppi, Patterns, type Types as YuppiTypes } from "yuppi";
|
|
126
|
+
> ```
|
|
127
|
+
>
|
|
128
|
+
> JavaScript
|
|
129
|
+
>
|
|
130
|
+
> ```javascript
|
|
131
|
+
> import { Yuppi, Patterns } from "yuppi";
|
|
132
|
+
> ```
|
|
133
|
+
|
|
134
|
+
### Constructors
|
|
135
|
+
|
|
136
|
+
`new Yuppi(options?)`
|
|
137
|
+
|
|
138
|
+
Yuppi schema builder.
|
|
139
|
+
|
|
140
|
+
> | Parameter | Default | Description |
|
|
141
|
+
> | --------- | --------------------- | ---------------------------------------------------- |
|
|
142
|
+
> | options | [YuppiOptionsDefault] | [YuppiOptions] (optional)<br/>Constructor's options. |
|
|
143
|
+
>
|
|
144
|
+
> Example:
|
|
145
|
+
>
|
|
146
|
+
> ```typescript
|
|
147
|
+
> const Yupp: Yuppi = new Yuppi();
|
|
148
|
+
> ```
|
|
149
|
+
|
|
150
|
+
### Methods
|
|
151
|
+
|
|
152
|
+
`Yuppi.validate(schema, properties)`
|
|
153
|
+
|
|
154
|
+
Validate the properties with your Yuppi schema.
|
|
155
|
+
|
|
156
|
+
> | Parameter | Description |
|
|
157
|
+
> | ---------- | ------------------------------------------ |
|
|
158
|
+
> | schema | [Schema]<br/>Yuppi schema. |
|
|
159
|
+
> | properties | [AnyObject]<br/>Properties to be validate. |
|
|
160
|
+
>
|
|
161
|
+
> returns [Promise]<[AnyObject]>
|
|
162
|
+
>
|
|
163
|
+
> Example:
|
|
164
|
+
>
|
|
165
|
+
> ```typescript
|
|
166
|
+
> const schema: YuppiTypes.Schema = {
|
|
167
|
+
> display_name: {
|
|
168
|
+
> type: "string",
|
|
169
|
+
> min: 1,
|
|
170
|
+
> max: 32,
|
|
171
|
+
> nullable: false,
|
|
172
|
+
> required: true
|
|
173
|
+
> },
|
|
174
|
+
>
|
|
175
|
+
> username: {
|
|
176
|
+
> type: "string",
|
|
177
|
+
> min: 3,
|
|
178
|
+
> max: 16,
|
|
179
|
+
> pattern: Patterns.Username,
|
|
180
|
+
> nullable: false,
|
|
181
|
+
> required: true
|
|
182
|
+
> },
|
|
183
|
+
>
|
|
184
|
+
> email: {
|
|
185
|
+
> type: "string",
|
|
186
|
+
> pattern: Patterns.Email,
|
|
187
|
+
> nullable: false,
|
|
188
|
+
> required: true
|
|
189
|
+
> }
|
|
190
|
+
> };
|
|
191
|
+
>
|
|
192
|
+
> const properties: YuppiTypes.AnyObject = {
|
|
193
|
+
> display_name: "Fırat",
|
|
194
|
+
> username: "fir4tozden",
|
|
195
|
+
> email: "fir4tozden@gmail.com"
|
|
196
|
+
> };
|
|
197
|
+
>
|
|
198
|
+
> Yupp.validate(schema, properties)
|
|
199
|
+
> .then((properties: YuppiTypes.AnyObject) => {
|
|
200
|
+
> console.log(properties);
|
|
201
|
+
> /*
|
|
202
|
+
> {
|
|
203
|
+
> display_name: "Fırat",
|
|
204
|
+
> username: "fir4tozden",
|
|
205
|
+
> email: "fir4tozden@gmail.com"
|
|
206
|
+
> }
|
|
207
|
+
> */
|
|
208
|
+
> })
|
|
209
|
+
> .catch((error: YuppiTypes.ValidationError) => {
|
|
210
|
+
> console.log(properties); // "Field email must match the required pattern ^[\w-\.]+@[\w-]+\.[a-z]{2,}$"
|
|
211
|
+
> });
|
|
212
|
+
> ```
|
|
213
|
+
|
|
214
|
+
<br/>
|
|
215
|
+
|
|
216
|
+
`Yuppi.convertToYup(schema)`
|
|
217
|
+
|
|
218
|
+
Convert your Yuppi schema into Yup schema.
|
|
219
|
+
|
|
220
|
+
> | Parameter | Description |
|
|
221
|
+
> | --------- | -------------------------- |
|
|
222
|
+
> | schema | [Schema]<br/>Yuppi schema. |
|
|
223
|
+
>
|
|
224
|
+
> returns [AnyObject]
|
|
225
|
+
>
|
|
226
|
+
> Example:
|
|
227
|
+
>
|
|
228
|
+
> ```typescript
|
|
229
|
+
> const schema: YuppiTypes.Schema = {
|
|
230
|
+
> display_name: {
|
|
231
|
+
> type: "string",
|
|
232
|
+
> min: 1,
|
|
233
|
+
> max: 32,
|
|
234
|
+
> nullable: false,
|
|
235
|
+
> required: true
|
|
236
|
+
> },
|
|
237
|
+
>
|
|
238
|
+
> username: {
|
|
239
|
+
> type: "string",
|
|
240
|
+
> min: 3,
|
|
241
|
+
> max: 16,
|
|
242
|
+
> pattern: Patterns.Username,
|
|
243
|
+
> nullable: false,
|
|
244
|
+
> required: true
|
|
245
|
+
> },
|
|
246
|
+
>
|
|
247
|
+
> email: {
|
|
248
|
+
> type: "string",
|
|
249
|
+
> pattern: Patterns.Email,
|
|
250
|
+
> lowercase: true,
|
|
251
|
+
> nullable: false,
|
|
252
|
+
> required: true
|
|
253
|
+
> }
|
|
254
|
+
> };
|
|
255
|
+
>
|
|
256
|
+
> Yupp.convertToYup(schema);
|
|
257
|
+
> ```
|
|
258
|
+
|
|
259
|
+
<br/>
|
|
260
|
+
|
|
261
|
+
`Yuppi.convertToJSONSchema(schema)`
|
|
262
|
+
|
|
263
|
+
Convert your Yuppi schema into [JSON Schema](https://json-schema.org).
|
|
264
|
+
|
|
265
|
+
> | Parameter | Description |
|
|
266
|
+
> | --------- | -------------------------- |
|
|
267
|
+
> | schema | [Schema]<br/>Yuppi schema. |
|
|
268
|
+
>
|
|
269
|
+
> returns [AnyObject]
|
|
270
|
+
>
|
|
271
|
+
> Example:
|
|
272
|
+
>
|
|
273
|
+
> ```typescript
|
|
274
|
+
> const schema: YuppiTypes.Schema = {
|
|
275
|
+
> display_name: {
|
|
276
|
+
> type: "string",
|
|
277
|
+
> min: 1,
|
|
278
|
+
> max: 32,
|
|
279
|
+
> nullable: false,
|
|
280
|
+
> required: true
|
|
281
|
+
> },
|
|
282
|
+
>
|
|
283
|
+
> username: {
|
|
284
|
+
> type: "string",
|
|
285
|
+
> min: 3,
|
|
286
|
+
> max: 16,
|
|
287
|
+
> pattern: Patterns.Username,
|
|
288
|
+
> nullable: false,
|
|
289
|
+
> required: true
|
|
290
|
+
> },
|
|
291
|
+
>
|
|
292
|
+
> email: {
|
|
293
|
+
> type: "string",
|
|
294
|
+
> pattern: Patterns.Email,
|
|
295
|
+
> nullable: false,
|
|
296
|
+
> required: true
|
|
297
|
+
> }
|
|
298
|
+
> };
|
|
299
|
+
>
|
|
300
|
+
> Yupp.convertToJSONSchema(schema);
|
|
301
|
+
> /*
|
|
302
|
+
> {
|
|
303
|
+
> type: "object",
|
|
304
|
+
> properties: {
|
|
305
|
+
> display_name: {
|
|
306
|
+
> type: "string",
|
|
307
|
+
> minLength: 1,
|
|
308
|
+
> maxLength: 32,
|
|
309
|
+
> pattern: "[\\s\\S]*"
|
|
310
|
+
> },
|
|
311
|
+
> username": {
|
|
312
|
+
> type: "string",
|
|
313
|
+
> minLength: 3,
|
|
314
|
+
> maxLength: 16,
|
|
315
|
+
> pattern: "^(?=.*[a-zA-Z])[a-zA-Z0-9][a-zA-Z0-9_]*$"
|
|
316
|
+
> },
|
|
317
|
+
> email: {
|
|
318
|
+
> type: "string",
|
|
319
|
+
> pattern: "^[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$",
|
|
320
|
+
> }
|
|
321
|
+
> },
|
|
322
|
+
> required: [
|
|
323
|
+
> "display_name",
|
|
324
|
+
> "username",
|
|
325
|
+
> "email"
|
|
326
|
+
> ]
|
|
327
|
+
> }
|
|
328
|
+
> */
|
|
329
|
+
> ```
|
|
330
|
+
|
|
331
|
+
### Patterns
|
|
332
|
+
|
|
333
|
+
| Pattern |
|
|
334
|
+
| ------------- |
|
|
335
|
+
| [Email] |
|
|
336
|
+
| [PhoneNumber] |
|
|
337
|
+
| [URL] |
|
|
338
|
+
| [Username] |
|
|
339
|
+
|
|
340
|
+
### Types
|
|
341
|
+
|
|
342
|
+
| Type |
|
|
343
|
+
| ----------------- |
|
|
344
|
+
| [AnyObject] |
|
|
345
|
+
| [JSONSchema] |
|
|
346
|
+
| [Schema] |
|
|
347
|
+
| [ValidateOptions] |
|
|
348
|
+
| [ValidationError] |
|
|
349
|
+
| [YuppiOptions] |
|
|
350
|
+
|
|
351
|
+
## Links
|
|
352
|
+
|
|
353
|
+
- [Discord](https://discord.gg/keift)
|
|
354
|
+
- [Telegram](https://t.me/keiftt)
|
|
355
|
+
- [Twitter](https://x.com/keiftttt)
|
|
356
|
+
- [GitHub](https://github.com/keift)
|
|
357
|
+
|
|
358
|
+
## License
|
|
359
|
+
|
|
360
|
+
MIT License
|
|
361
|
+
|
|
362
|
+
Copyright (c) 2025 Keift
|
|
363
|
+
|
|
364
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
365
|
+
|
|
366
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
367
|
+
|
|
368
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Email } from './patterns/Email.pattern.mjs';
|
|
2
|
+
import { PhoneNumber } from './patterns/PhoneNumber.pattern.mjs';
|
|
3
|
+
import { URL } from './patterns/URL.pattern.mjs';
|
|
4
|
+
import { Username } from './patterns/Username.pattern.mjs';
|
|
5
|
+
|
|
6
|
+
declare const Patterns_barrel_Email: typeof Email;
|
|
7
|
+
declare const Patterns_barrel_PhoneNumber: typeof PhoneNumber;
|
|
8
|
+
declare const Patterns_barrel_URL: typeof URL;
|
|
9
|
+
declare const Patterns_barrel_Username: typeof Username;
|
|
10
|
+
declare namespace Patterns_barrel {
|
|
11
|
+
export { Patterns_barrel_Email as Email, Patterns_barrel_PhoneNumber as PhoneNumber, Patterns_barrel_URL as URL, Patterns_barrel_Username as Username };
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { Patterns_barrel as P };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Email } from './patterns/Email.pattern.js';
|
|
2
|
+
import { PhoneNumber } from './patterns/PhoneNumber.pattern.js';
|
|
3
|
+
import { URL } from './patterns/URL.pattern.js';
|
|
4
|
+
import { Username } from './patterns/Username.pattern.js';
|
|
5
|
+
|
|
6
|
+
declare const Patterns_barrel_Email: typeof Email;
|
|
7
|
+
declare const Patterns_barrel_PhoneNumber: typeof PhoneNumber;
|
|
8
|
+
declare const Patterns_barrel_URL: typeof URL;
|
|
9
|
+
declare const Patterns_barrel_Username: typeof Username;
|
|
10
|
+
declare namespace Patterns_barrel {
|
|
11
|
+
export { Patterns_barrel_Email as Email, Patterns_barrel_PhoneNumber as PhoneNumber, Patterns_barrel_URL as URL, Patterns_barrel_Username as Username };
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { Patterns_barrel as P };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AnyObject } from './types/AnyObject.type.mjs';
|
|
2
|
+
import { JSONSchema } from './types/JSONSchema.type.mjs';
|
|
3
|
+
import { Schema } from './types/Schema.type.mjs';
|
|
4
|
+
import { ValidateOptions } from './types/ValidateOptions.type.mjs';
|
|
5
|
+
import { ValidationError } from './types/ValidationError.type.mjs';
|
|
6
|
+
import { YuppiOptions } from './types/YuppiOptions.type.mjs';
|
|
7
|
+
|
|
8
|
+
declare const Types_barrel_AnyObject: typeof AnyObject;
|
|
9
|
+
declare const Types_barrel_JSONSchema: typeof JSONSchema;
|
|
10
|
+
declare const Types_barrel_Schema: typeof Schema;
|
|
11
|
+
declare const Types_barrel_ValidateOptions: typeof ValidateOptions;
|
|
12
|
+
declare const Types_barrel_ValidationError: typeof ValidationError;
|
|
13
|
+
declare const Types_barrel_YuppiOptions: typeof YuppiOptions;
|
|
14
|
+
declare namespace Types_barrel {
|
|
15
|
+
export { Types_barrel_AnyObject as AnyObject, Types_barrel_JSONSchema as JSONSchema, Types_barrel_Schema as Schema, Types_barrel_ValidateOptions as ValidateOptions, Types_barrel_ValidationError as ValidationError, Types_barrel_YuppiOptions as YuppiOptions };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { Types_barrel as T };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AnyObject } from './types/AnyObject.type.js';
|
|
2
|
+
import { JSONSchema } from './types/JSONSchema.type.js';
|
|
3
|
+
import { Schema } from './types/Schema.type.js';
|
|
4
|
+
import { ValidateOptions } from './types/ValidateOptions.type.js';
|
|
5
|
+
import { ValidationError } from './types/ValidationError.type.js';
|
|
6
|
+
import { YuppiOptions } from './types/YuppiOptions.type.js';
|
|
7
|
+
|
|
8
|
+
declare const Types_barrel_AnyObject: typeof AnyObject;
|
|
9
|
+
declare const Types_barrel_JSONSchema: typeof JSONSchema;
|
|
10
|
+
declare const Types_barrel_Schema: typeof Schema;
|
|
11
|
+
declare const Types_barrel_ValidateOptions: typeof ValidateOptions;
|
|
12
|
+
declare const Types_barrel_ValidationError: typeof ValidationError;
|
|
13
|
+
declare const Types_barrel_YuppiOptions: typeof YuppiOptions;
|
|
14
|
+
declare namespace Types_barrel {
|
|
15
|
+
export { Types_barrel_AnyObject as AnyObject, Types_barrel_JSONSchema as JSONSchema, Types_barrel_Schema as Schema, Types_barrel_ValidateOptions as ValidateOptions, Types_barrel_ValidationError as ValidationError, Types_barrel_YuppiOptions as YuppiOptions };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { Types_barrel as T };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AnyObject } from './types/AnyObject.type.mjs';
|
|
2
|
+
import { JSONSchema } from './types/JSONSchema.type.mjs';
|
|
3
|
+
import { Schema } from './types/Schema.type.mjs';
|
|
4
|
+
import { YuppiOptions } from './types/YuppiOptions.type.mjs';
|
|
5
|
+
import 'yup';
|
|
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): Promise<AnyObject>;
|
|
13
|
+
convertToYup(schema: Schema): AnyObject;
|
|
14
|
+
convertToJSONSchema(schema: Schema): JSONSchema;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { Yuppi };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AnyObject } from './types/AnyObject.type.js';
|
|
2
|
+
import { JSONSchema } from './types/JSONSchema.type.js';
|
|
3
|
+
import { Schema } from './types/Schema.type.js';
|
|
4
|
+
import { YuppiOptions } from './types/YuppiOptions.type.js';
|
|
5
|
+
import 'yup';
|
|
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): Promise<AnyObject>;
|
|
13
|
+
convertToYup(schema: Schema): AnyObject;
|
|
14
|
+
convertToJSONSchema(schema: Schema): JSONSchema;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { Yuppi };
|