yuppi 1.2.4 → 1.2.5

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 CHANGED
@@ -112,31 +112,21 @@ Yuppi
112
112
  │ ├── URI
113
113
  │ └── Username
114
114
 
115
- └── type Types
116
-
117
- ├── AnyObject
118
- ├── JSONSchema
119
- ├── Schema
120
- ├── ValidateOptions
121
- ├── ValidationError
122
- └── YuppiOptions
115
+ ├── type AnyObject
116
+ ├── type JSONSchema
117
+ ├── type Schema
118
+ ├── type ValidateOptions
119
+ ├── type ValidationError
120
+ └── type YuppiOptions
123
121
  ```
124
122
 
125
123
  ### Import
126
124
 
127
125
  Briefly as follows.
128
126
 
129
- > TypeScript
130
- >
131
- > ```typescript
132
- > import { Yuppi, Patterns, type Types as YuppiTypes } from "yuppi";
133
- > ```
134
- >
135
- > JavaScript
136
- >
137
- > ```javascript
138
- > import { Yuppi, Patterns } from "yuppi";
139
- > ```
127
+ ```typescript
128
+ import { Yuppi, Patterns } from "yuppi";
129
+ ```
140
130
 
141
131
  ### Constructors
142
132
 
@@ -170,7 +160,7 @@ Validate the properties with your Yuppi schema.
170
160
  > Example:
171
161
  >
172
162
  > ```typescript
173
- > const schema: YuppiTypes.Schema = {
163
+ > const schema: Schema = {
174
164
  > display_name: {
175
165
  > type: "string",
176
166
  > min: 1,
@@ -197,7 +187,7 @@ Validate the properties with your Yuppi schema.
197
187
  > }
198
188
  > };
199
189
  >
200
- > const properties: YuppiTypes.AnyObject = {
190
+ > const properties: AnyObject = {
201
191
  > display_name: "Fırat",
202
192
  > username: "fir4tozden",
203
193
  > email: "fir4tozden@gmail.com"
@@ -212,7 +202,7 @@ Validate the properties with your Yuppi schema.
212
202
  > email: "fir4tozden@gmail.com"
213
203
  > }
214
204
  > */
215
- > } catch((error: YuppiTypes.ValidationError)) {
205
+ > } catch((error: ValidationError)) {
216
206
  > console.log(error.message); // "Field email must match the required pattern ^[a-zA-Z0-9._-]+@([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}$"
217
207
  > }
218
208
  > ```
@@ -232,7 +222,7 @@ Convert your Yuppi schema into Yup schema.
232
222
  > Example:
233
223
  >
234
224
  > ```typescript
235
- > const schema: YuppiTypes.Schema = {
225
+ > const schema: Schema = {
236
226
  > display_name: {
237
227
  > type: "string",
238
228
  > min: 1,
@@ -272,12 +262,12 @@ Convert your Yuppi schema into [JSON Schema](https://json-schema.org).
272
262
  > | --------- | ------- | -------------------------- |
273
263
  > | schema | | [Schema]<br/>Yuppi schema. |
274
264
  >
275
- > returns [AnyObject]
265
+ > returns [JSONSchema]
276
266
  >
277
267
  > Example:
278
268
  >
279
269
  > ```typescript
280
- > const schema: YuppiTypes.Schema = {
270
+ > const schema: Schema = {
281
271
  > display_name: {
282
272
  > type: "string",
283
273
  > min: 1,
@@ -1,16 +1,23 @@
1
+ import * as yup from 'yup';
1
2
  import { AnyObject } from './types/AnyObject.type.mjs';
2
3
  import { JSONSchema } from './types/JSONSchema.type.mjs';
3
4
  import { Schema } from './types/Schema.type.mjs';
4
5
  import { YuppiOptions } from './types/YuppiOptions.type.mjs';
5
- import 'yup';
6
6
  import '@sinclair/typebox';
7
7
  import './types/ValidateOptions.type.mjs';
8
8
 
9
9
  declare class Yuppi {
10
10
  private readonly options;
11
11
  constructor(options?: YuppiOptions);
12
- validate(schema: Schema, properties: AnyObject): AnyObject;
13
- convertToYup(schema: Schema): AnyObject;
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
+ }, "">;
14
21
  convertToJSONSchema(schema: Schema): JSONSchema;
15
22
  }
16
23
 
@@ -1,16 +1,23 @@
1
+ import * as yup from 'yup';
1
2
  import { AnyObject } from './types/AnyObject.type.js';
2
3
  import { JSONSchema } from './types/JSONSchema.type.js';
3
4
  import { Schema } from './types/Schema.type.js';
4
5
  import { YuppiOptions } from './types/YuppiOptions.type.js';
5
- import 'yup';
6
6
  import '@sinclair/typebox';
7
7
  import './types/ValidateOptions.type.js';
8
8
 
9
9
  declare class Yuppi {
10
10
  private readonly options;
11
11
  constructor(options?: YuppiOptions);
12
- validate(schema: Schema, properties: AnyObject): AnyObject;
13
- convertToYup(schema: Schema): AnyObject;
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
+ }, "">;
14
21
  convertToJSONSchema(schema: Schema): JSONSchema;
15
22
  }
16
23
 
package/dist/main.d.mts CHANGED
@@ -1,13 +1,12 @@
1
1
  export { Yuppi } from './Yuppi.class.mjs';
2
2
  export { P as Patterns } from './Patterns.barrel-D-k3IHDq.mjs';
3
- export { T as Types } from './Types.barrel--XGUUjIp.mjs';
4
- import './types/AnyObject.type.mjs';
3
+ export { AnyObject } from './types/AnyObject.type.mjs';
4
+ export { JSONSchema } from './types/JSONSchema.type.mjs';
5
+ export { Schema } from './types/Schema.type.mjs';
6
+ export { ValidateOptions } from './types/ValidateOptions.type.mjs';
7
+ export { ValidationError } from './types/ValidationError.type.mjs';
8
+ export { YuppiOptions } from './types/YuppiOptions.type.mjs';
5
9
  import 'yup';
6
- import './types/JSONSchema.type.mjs';
7
- import '@sinclair/typebox';
8
- import './types/Schema.type.mjs';
9
- import './types/YuppiOptions.type.mjs';
10
- import './types/ValidateOptions.type.mjs';
11
10
  import './patterns/Any.pattern.mjs';
12
11
  import './patterns/Domain.pattern.mjs';
13
12
  import './patterns/Email.pattern.mjs';
@@ -15,4 +14,4 @@ import './patterns/HTTP.pattern.mjs';
15
14
  import './patterns/PhoneNumber.pattern.mjs';
16
15
  import './patterns/URI.pattern.mjs';
17
16
  import './patterns/Username.pattern.mjs';
18
- import './types/ValidationError.type.mjs';
17
+ import '@sinclair/typebox';
package/dist/main.d.ts CHANGED
@@ -1,13 +1,12 @@
1
1
  export { Yuppi } from './Yuppi.class.js';
2
2
  export { P as Patterns } from './Patterns.barrel-JdN3lL2Q.js';
3
- export { T as Types } from './Types.barrel-wzQq8e9v.js';
4
- import './types/AnyObject.type.js';
3
+ export { AnyObject } from './types/AnyObject.type.js';
4
+ export { JSONSchema } from './types/JSONSchema.type.js';
5
+ export { Schema } from './types/Schema.type.js';
6
+ export { ValidateOptions } from './types/ValidateOptions.type.js';
7
+ export { ValidationError } from './types/ValidationError.type.js';
8
+ export { YuppiOptions } from './types/YuppiOptions.type.js';
5
9
  import 'yup';
6
- import './types/JSONSchema.type.js';
7
- import '@sinclair/typebox';
8
- import './types/Schema.type.js';
9
- import './types/YuppiOptions.type.js';
10
- import './types/ValidateOptions.type.js';
11
10
  import './patterns/Any.pattern.js';
12
11
  import './patterns/Domain.pattern.js';
13
12
  import './patterns/Email.pattern.js';
@@ -15,4 +14,4 @@ import './patterns/HTTP.pattern.js';
15
14
  import './patterns/PhoneNumber.pattern.js';
16
15
  import './patterns/URI.pattern.js';
17
16
  import './patterns/Username.pattern.js';
18
- import './types/ValidationError.type.js';
17
+ import '@sinclair/typebox';
@@ -40,8 +40,6 @@ type Array = Base & {
40
40
  items: Types;
41
41
  };
42
42
  type Types = String | Number | Boolean | Date | Object$1 | Array;
43
- type Schema = {
44
- [key: string]: Types;
45
- };
43
+ type Schema = Record<string, Types>;
46
44
 
47
45
  export type { Array, Base, Boolean, Date, Number, Object$1 as Object, Schema, String, Types };
@@ -40,8 +40,6 @@ type Array = Base & {
40
40
  items: Types;
41
41
  };
42
42
  type Types = String | Number | Boolean | Date | Object$1 | Array;
43
- type Schema = {
44
- [key: string]: Types;
45
- };
43
+ type Schema = Record<string, Types>;
46
44
 
47
45
  export type { Array, Base, Boolean, Date, Number, Object$1 as Object, Schema, String, Types };
@@ -1,9 +1,12 @@
1
- import { AnyObject } from '../types/AnyObject.type.mjs';
1
+ import * as yup from 'yup';
2
2
  import { Schema } from '../types/Schema.type.mjs';
3
3
  import { YuppiOptions } from '../types/YuppiOptions.type.mjs';
4
- import 'yup';
5
4
  import '../types/ValidateOptions.type.mjs';
6
5
 
7
- declare const convertToYup: (schema: Schema, error_messages: YuppiOptions["error_messages"]) => AnyObject;
6
+ declare const convertToYup: (schema: Schema, error_messages: YuppiOptions["error_messages"]) => yup.ObjectSchema<{
7
+ [x: string]: any;
8
+ }, yup.AnyObject, {
9
+ [x: string]: any;
10
+ }, "">;
8
11
 
9
12
  export { convertToYup };
@@ -1,9 +1,12 @@
1
- import { AnyObject } from '../types/AnyObject.type.js';
1
+ import * as yup from 'yup';
2
2
  import { Schema } from '../types/Schema.type.js';
3
3
  import { YuppiOptions } from '../types/YuppiOptions.type.js';
4
- import 'yup';
5
4
  import '../types/ValidateOptions.type.js';
6
5
 
7
- declare const convertToYup: (schema: Schema, error_messages: YuppiOptions["error_messages"]) => AnyObject;
6
+ declare const convertToYup: (schema: Schema, error_messages: YuppiOptions["error_messages"]) => yup.ObjectSchema<{
7
+ [x: string]: any;
8
+ }, yup.AnyObject, {
9
+ [x: string]: any;
10
+ }, "">;
8
11
 
9
12
  export { convertToYup };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuppi",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
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",
@@ -10,8 +10,8 @@
10
10
  "types": "./dist/main.d.ts",
11
11
  "scripts": {
12
12
  "tests": "bun run lint && bun test",
13
- "prettier": "prettier --write ./",
14
13
  "build": "tsup",
14
+ "prettier": "prettier --write ./",
15
15
  "lint": "eslint ./"
16
16
  },
17
17
  "dependencies": {
@@ -21,7 +21,7 @@
21
21
  "yup": "^1.7.0"
22
22
  },
23
23
  "devDependencies": {
24
- "neatlint": "^1.0.0",
24
+ "neatlint": "^1.1.4",
25
25
  "prettier": "^3.6.2",
26
26
  "tsup": "^8.5.0"
27
27
  },
@@ -1,18 +0,0 @@
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 };
@@ -1,18 +0,0 @@
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 };