quicktype-core 23.2.4 → 23.2.6

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.
@@ -67,7 +67,7 @@ class BooleanOption extends Option {
67
67
  super({
68
68
  name,
69
69
  kind,
70
- type: Boolean,
70
+ optionType: "boolean",
71
71
  description,
72
72
  defaultValue,
73
73
  });
@@ -110,29 +110,28 @@ class BooleanOption extends Option {
110
110
  exports.BooleanOption = BooleanOption;
111
111
  class StringOption extends Option {
112
112
  constructor(name, description, typeLabel, defaultValue, kind = "primary") {
113
- const definition = {
113
+ super({
114
114
  name,
115
115
  kind,
116
- type: String,
116
+ optionType: "string",
117
117
  description,
118
118
  typeLabel,
119
119
  defaultValue,
120
- };
121
- super(definition);
120
+ });
122
121
  }
123
122
  }
124
123
  exports.StringOption = StringOption;
125
124
  class EnumOption extends Option {
126
125
  constructor(name, description, values, defaultValue, kind = "primary") {
127
- const definition = {
126
+ super({
128
127
  name,
129
128
  kind,
130
- type: String,
129
+ optionType: "enum",
131
130
  description,
132
131
  typeLabel: Object.keys(values).join("|"),
133
132
  defaultValue,
134
- };
135
- super(definition);
133
+ values,
134
+ });
136
135
  this._values = values;
137
136
  }
138
137
  getEnumValue(name) {
@@ -1,19 +1,27 @@
1
1
  import type { EnumOption, Option } from "./index";
2
+ import type { OptionDefinition as CommandLineArgsOptionDefinition } from "command-line-args";
2
3
  /**
3
4
  * Primary options show up in the web UI in the "Language" settings tab,
4
5
  * Secondary options in "Other".
5
6
  * CLI is only for cli
6
7
  */
7
8
  export type OptionKind = "primary" | "secondary" | "cli";
8
- export interface OptionDefinition<Name extends string = string, T = unknown> {
9
- alias?: string;
10
- defaultOption?: boolean;
11
- defaultValue?: T;
9
+ export type OptionType = "string" | "boolean" | "enum";
10
+ export interface OptionDefinition<Name extends string = string, T = unknown> extends CommandLineArgsOptionDefinition {
11
+ /** Option Name */
12
+ name: Name;
13
+ /** Option Description */
12
14
  description: string;
15
+ /** Category of Option */
16
+ optionType: OptionType;
17
+ /** Default Value for Option */
18
+ defaultValue?: T;
19
+ /** Enum only, map of possible keys and values */
20
+ values?: Record<string, unknown>;
21
+ /** Primary, Secondary, or CLI */
13
22
  kind?: OptionKind;
23
+ /** Whether multiple CLI inputs are allowed for this option */
14
24
  multiple?: boolean;
15
- name: Name;
16
- type: StringConstructor | BooleanConstructor;
17
25
  typeLabel?: string;
18
26
  }
19
27
  export type OptionName<O> = O extends Option<infer Name, unknown> ? Name : never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quicktype-core",
3
- "version": "23.2.4",
3
+ "version": "23.2.6",
4
4
  "description": "The quicktype engine as a library",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",
@@ -36,6 +36,7 @@
36
36
  "@types/unicode-properties": "^1.3.0",
37
37
  "@types/urijs": "^1.19.25",
38
38
  "@types/wordwrap": "^1.0.3",
39
+ "command-line-args": "^5.2.1",
39
40
  "typescript": "~5.8.3"
40
41
  },
41
42
  "overrides": {