yuppi 1.3.16 → 1.3.18

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
@@ -159,7 +159,7 @@ Validate the properties with your Yuppi schema.
159
159
  > | schema | [Schema] | | Yuppi schema. |
160
160
  > | properties | [AnyObject] | | Properties to be validate. |
161
161
  >
162
- > returns [AnyObject]
162
+ > returns [Promise]<[AnyObject]>
163
163
  >
164
164
  > Example:
165
165
  >
@@ -197,7 +197,7 @@ Validate the properties with your Yuppi schema.
197
197
  > };
198
198
  >
199
199
  > try {
200
- > Yupp.validate(schema, properties);
200
+ > await Yupp.validate(schema, properties);
201
201
  > /*
202
202
  > {
203
203
  > display_name: "Fırat",
@@ -232,7 +232,7 @@ Declare your Yuppi schema for TypeScript.
232
232
  >
233
233
  > Yupp.declare(schema, 'User');
234
234
  >
235
- > const user = Yupp.validate(schema, properties) as User;
235
+ > const user = (await Yupp.validate(schema, properties)) as User;
236
236
  > /*
237
237
  > interface User {
238
238
  > display_name: string;
package/dist/main.d.mts CHANGED
@@ -111,10 +111,10 @@ type YuppiOptions = {
111
111
  declare class Yuppi {
112
112
  private readonly options;
113
113
  constructor(options?: YuppiOptions);
114
- validate(schema: Schema, properties: AnyObject): {
114
+ validate(schema: Schema, properties: AnyObject): Promise<{
115
115
  [x: string]: any;
116
116
  [x: number]: any;
117
- };
117
+ }>;
118
118
  declare(schema: Schema, name: string): void;
119
119
  convertToYup(schema: Schema): yup.ObjectSchema<{
120
120
  [x: string]: any;
package/dist/main.d.ts CHANGED
@@ -111,10 +111,10 @@ type YuppiOptions = {
111
111
  declare class Yuppi {
112
112
  private readonly options;
113
113
  constructor(options?: YuppiOptions);
114
- validate(schema: Schema, properties: AnyObject): {
114
+ validate(schema: Schema, properties: AnyObject): Promise<{
115
115
  [x: string]: any;
116
116
  [x: number]: any;
117
- };
117
+ }>;
118
118
  declare(schema: Schema, name: string): void;
119
119
  convertToYup(schema: Schema): yup.ObjectSchema<{
120
120
  [x: string]: any;
package/dist/main.js CHANGED
@@ -38,7 +38,7 @@ module.exports = __toCommonJS(main_exports);
38
38
  // src/Yuppi.class.ts
39
39
  var import_json_schema_to_typescript = require("json-schema-to-typescript");
40
40
  var import_lodash = __toESM(require("lodash.merge"));
41
- var import_fs = __toESM(require("fs"));
41
+ var import_promises = __toESM(require("fs/promises"));
42
42
  var import_path = __toESM(require("path"));
43
43
 
44
44
  // src/utils/ConvertToJSONSchema.util.ts
@@ -242,7 +242,7 @@ var Yuppi = class {
242
242
  }
243
243
  validate(schema, properties) {
244
244
  const yup_schema = this.convertToYup(schema);
245
- return yup_schema.validateSync(properties, this.options.validate_options);
245
+ return yup_schema.validate(properties, this.options.validate_options);
246
246
  }
247
247
  declare(schema, name) {
248
248
  name = pascalCase(name);
@@ -256,8 +256,8 @@ var Yuppi = class {
256
256
  */`;
257
257
  void (async () => {
258
258
  const type = await (0, import_json_schema_to_typescript.compile)(this.convertToJSONSchema(schema), name, { bannerComment: banner_comment });
259
- import_fs.default.mkdirSync(types_dir, { recursive: true });
260
- import_fs.default.writeFileSync(import_path.default.join(types_dir, `${name}.d.ts`), type);
259
+ await import_promises.default.mkdir(types_dir, { recursive: true });
260
+ await import_promises.default.writeFile(import_path.default.join(types_dir, `${name}.d.ts`), type);
261
261
  })();
262
262
  }
263
263
  convertToYup(schema) {
package/dist/main.mjs CHANGED
@@ -7,7 +7,7 @@ var __export = (target, all) => {
7
7
  // src/Yuppi.class.ts
8
8
  import { compile } from "json-schema-to-typescript";
9
9
  import merge from "lodash.merge";
10
- import fs from "fs";
10
+ import fs from "fs/promises";
11
11
  import path from "path";
12
12
 
13
13
  // src/utils/ConvertToJSONSchema.util.ts
@@ -211,7 +211,7 @@ var Yuppi = class {
211
211
  }
212
212
  validate(schema, properties) {
213
213
  const yup_schema = this.convertToYup(schema);
214
- return yup_schema.validateSync(properties, this.options.validate_options);
214
+ return yup_schema.validate(properties, this.options.validate_options);
215
215
  }
216
216
  declare(schema, name) {
217
217
  name = pascalCase(name);
@@ -225,8 +225,8 @@ var Yuppi = class {
225
225
  */`;
226
226
  void (async () => {
227
227
  const type = await compile(this.convertToJSONSchema(schema), name, { bannerComment: banner_comment });
228
- fs.mkdirSync(types_dir, { recursive: true });
229
- fs.writeFileSync(path.join(types_dir, `${name}.d.ts`), type);
228
+ await fs.mkdir(types_dir, { recursive: true });
229
+ await fs.writeFile(path.join(types_dir, `${name}.d.ts`), type);
230
230
  })();
231
231
  }
232
232
  convertToYup(schema) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuppi",
3
- "version": "1.3.16",
3
+ "version": "1.3.18",
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",
@@ -15,7 +15,7 @@
15
15
  "lint": "eslint ./"
16
16
  },
17
17
  "dependencies": {
18
- "@sinclair/typebox": "^0.34.46",
18
+ "@sinclair/typebox": "^0.34.47",
19
19
  "@types/lodash.merge": "^4.6.9",
20
20
  "json-schema-to-typescript": "^15.0.4",
21
21
  "lodash.merge": "^4.6.2",