yuppi 1.3.18 → 1.3.19

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
@@ -223,14 +223,14 @@ Declare your Yuppi schema for TypeScript.
223
223
  > | schema | [Schema] | | Yuppi schema. |
224
224
  > | name | [String] | | Declaration name. |
225
225
  >
226
- > returns [Void]
226
+ > returns [Promise]<[Void]>
227
227
  >
228
228
  > Example:
229
229
  >
230
230
  > ```typescript
231
231
  > import type { User } from './yuppi/types/User';
232
232
  >
233
- > Yupp.declare(schema, 'User');
233
+ > await Yupp.declare(schema, 'User');
234
234
  >
235
235
  > const user = (await Yupp.validate(schema, properties)) as User;
236
236
  > /*
package/dist/main.d.mts CHANGED
@@ -115,7 +115,7 @@ declare class Yuppi {
115
115
  [x: string]: any;
116
116
  [x: number]: any;
117
117
  }>;
118
- declare(schema: Schema, name: string): void;
118
+ declare(schema: Schema, name: string): Promise<void>;
119
119
  convertToYup(schema: Schema): yup.ObjectSchema<{
120
120
  [x: string]: any;
121
121
  }, yup.AnyObject, {
package/dist/main.d.ts CHANGED
@@ -115,7 +115,7 @@ declare class Yuppi {
115
115
  [x: string]: any;
116
116
  [x: number]: any;
117
117
  }>;
118
- declare(schema: Schema, name: string): void;
118
+ declare(schema: Schema, name: string): Promise<void>;
119
119
  convertToYup(schema: Schema): yup.ObjectSchema<{
120
120
  [x: string]: any;
121
121
  }, yup.AnyObject, {
package/dist/main.js CHANGED
@@ -244,7 +244,7 @@ var Yuppi = class {
244
244
  const yup_schema = this.convertToYup(schema);
245
245
  return yup_schema.validate(properties, this.options.validate_options);
246
246
  }
247
- declare(schema, name) {
247
+ async declare(schema, name) {
248
248
  name = pascalCase(name);
249
249
  const types_dir = import_path.default.join(this.options.folder_path ?? "./", "yuppi", "types");
250
250
  const banner_comment = `/* eslint-disable */
@@ -254,11 +254,9 @@ var Yuppi = class {
254
254
  * _DO NOT MODIFY IT BY HAND_. Instead, modify your Yuppi schema.
255
255
  * Use \`Yuppi.declare()\` to regenerate this type.
256
256
  */`;
257
- void (async () => {
258
- const type = await (0, import_json_schema_to_typescript.compile)(this.convertToJSONSchema(schema), name, { bannerComment: banner_comment });
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
- })();
257
+ const type = await (0, import_json_schema_to_typescript.compile)(this.convertToJSONSchema(schema), name, { bannerComment: banner_comment });
258
+ await import_promises.default.mkdir(types_dir, { recursive: true });
259
+ await import_promises.default.writeFile(import_path.default.join(types_dir, `${name}.d.ts`), type);
262
260
  }
263
261
  convertToYup(schema) {
264
262
  return convertToYup(schema, this.options.error_messages);
package/dist/main.mjs CHANGED
@@ -213,7 +213,7 @@ var Yuppi = class {
213
213
  const yup_schema = this.convertToYup(schema);
214
214
  return yup_schema.validate(properties, this.options.validate_options);
215
215
  }
216
- declare(schema, name) {
216
+ async declare(schema, name) {
217
217
  name = pascalCase(name);
218
218
  const types_dir = path.join(this.options.folder_path ?? "./", "yuppi", "types");
219
219
  const banner_comment = `/* eslint-disable */
@@ -223,11 +223,9 @@ var Yuppi = class {
223
223
  * _DO NOT MODIFY IT BY HAND_. Instead, modify your Yuppi schema.
224
224
  * Use \`Yuppi.declare()\` to regenerate this type.
225
225
  */`;
226
- void (async () => {
227
- const type = await compile(this.convertToJSONSchema(schema), name, { bannerComment: banner_comment });
228
- await fs.mkdir(types_dir, { recursive: true });
229
- await fs.writeFile(path.join(types_dir, `${name}.d.ts`), type);
230
- })();
226
+ const type = await compile(this.convertToJSONSchema(schema), name, { bannerComment: banner_comment });
227
+ await fs.mkdir(types_dir, { recursive: true });
228
+ await fs.writeFile(path.join(types_dir, `${name}.d.ts`), type);
231
229
  }
232
230
  convertToYup(schema) {
233
231
  return convertToYup(schema, this.options.error_messages);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuppi",
3
- "version": "1.3.18",
3
+ "version": "1.3.19",
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",