quicktype-core 20.0.12 → 20.0.14

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/dist/Run.d.ts CHANGED
@@ -34,7 +34,7 @@ export declare const inferenceFlagsObject: {
34
34
  description: string;
35
35
  negationDescription: string;
36
36
  explanation: string;
37
- stringType: "date" | "time" | "date-time" | "uuid" | "uri" | "integer-string" | "bool-string";
37
+ stringType: "time" | "date" | "date-time" | "uuid" | "uri" | "integer-string" | "bool-string";
38
38
  order: number;
39
39
  };
40
40
  /** Whether to assume that JSON strings that look like dates are dates */
@@ -42,7 +42,7 @@ export declare const inferenceFlagsObject: {
42
42
  description: string;
43
43
  negationDescription: string;
44
44
  explanation: string;
45
- stringType: "date" | "time" | "date-time" | "uuid" | "uri" | "integer-string" | "bool-string";
45
+ stringType: "time" | "date" | "date-time" | "uuid" | "uri" | "integer-string" | "bool-string";
46
46
  order: number;
47
47
  };
48
48
  /** Whether to convert stringified integers to integers */
@@ -50,7 +50,7 @@ export declare const inferenceFlagsObject: {
50
50
  description: string;
51
51
  negationDescription: string;
52
52
  explanation: string;
53
- stringType: "date" | "time" | "date-time" | "uuid" | "uri" | "integer-string" | "bool-string";
53
+ stringType: "time" | "date" | "date-time" | "uuid" | "uri" | "integer-string" | "bool-string";
54
54
  order: number;
55
55
  };
56
56
  /** Whether to convert stringified booleans to boolean values */
@@ -58,7 +58,7 @@ export declare const inferenceFlagsObject: {
58
58
  description: string;
59
59
  negationDescription: string;
60
60
  explanation: string;
61
- stringType: "date" | "time" | "date-time" | "uuid" | "uri" | "integer-string" | "bool-string";
61
+ stringType: "time" | "date" | "date-time" | "uuid" | "uri" | "integer-string" | "bool-string";
62
62
  order: number;
63
63
  };
64
64
  /** Combine similar classes. This doesn't apply to classes from a schema, only from inference. */
package/dist/Type.d.ts CHANGED
@@ -55,7 +55,7 @@ export type PrimitiveTypeKind = PrimitiveNonStringTypeKind | PrimitiveStringType
55
55
  export type NamedTypeKind = "class" | "enum" | "union";
56
56
  export type TypeKind = PrimitiveTypeKind | NamedTypeKind | "array" | "object" | "map" | "intersection";
57
57
  export type ObjectTypeKind = "object" | "map" | "class";
58
- export declare const transformedStringTypeKinds: ReadonlySet<"date" | "time" | "date-time" | "uuid" | "uri" | "integer-string" | "bool-string">;
58
+ export declare const transformedStringTypeKinds: ReadonlySet<"time" | "date" | "date-time" | "uuid" | "uri" | "integer-string" | "bool-string">;
59
59
  export declare function isPrimitiveStringTypeKind(kind: string): kind is PrimitiveStringTypeKind;
60
60
  export declare function targetTypeKindForTransformedStringTypeKind(kind: PrimitiveStringTypeKind): PrimitiveNonStringTypeKind | undefined;
61
61
  export declare function isNumberTypeKind(kind: TypeKind): kind is "integer" | "double";
@@ -31,6 +31,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
31
31
  step((generator = generator.apply(thisArg, _arguments || [])).next());
32
32
  });
33
33
  };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
34
37
  Object.defineProperty(exports, "__esModule", { value: true });
35
38
  exports.readFromFileOrURL = exports.readableFromFileOrURL = void 0;
36
39
  const fs = __importStar(require("fs"));
@@ -38,9 +41,8 @@ const browser_or_node_1 = require("browser-or-node");
38
41
  const get_stream_1 = require("./get-stream");
39
42
  const ts_necessities_1 = require("@glideapps/ts-necessities");
40
43
  const index_1 = require("../../index");
41
- // The typings for this module are screwy
42
44
  const isURL = require("is-url");
43
- const fetch = require("isomorphic-fetch");
45
+ const cross_fetch_1 = __importDefault(require("cross-fetch"));
44
46
  function parseHeaders(httpHeaders) {
45
47
  if (!Array.isArray(httpHeaders)) {
46
48
  return {};
@@ -62,10 +64,10 @@ function readableFromFileOrURL(fileOrURL, httpHeaders) {
62
64
  return __awaiter(this, void 0, void 0, function* () {
63
65
  try {
64
66
  if (isURL(fileOrURL)) {
65
- const response = yield fetch(fileOrURL, {
67
+ const response = yield (0, cross_fetch_1.default)(fileOrURL, {
66
68
  headers: parseHeaders(httpHeaders)
67
69
  });
68
- return response.body;
70
+ return (0, ts_necessities_1.defined)(response.body);
69
71
  }
70
72
  else if (browser_or_node_1.isNode) {
71
73
  if (fileOrURL === "-") {
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.SystemTextJsonCSharpRenderer = exports.systemTextJsonCSharpOptions = exports.NewtonsoftCSharpRenderer = exports.newtonsoftCSharpOptions = exports.CSharpRenderer = exports.CSharpTargetLanguage = exports.cSharpOptions = exports.AccessModifier = exports.Framework = void 0;
4
7
  const collection_utils_1 = require("collection-utils");
@@ -14,12 +17,12 @@ const RendererOptions_1 = require("../RendererOptions");
14
17
  const Annotation_1 = require("../Annotation");
15
18
  const Transformers_1 = require("../Transformers");
16
19
  const Constraints_1 = require("../attributes/Constraints");
20
+ const unicode_properties_1 = __importDefault(require("unicode-properties"));
17
21
  var Framework;
18
22
  (function (Framework) {
19
23
  Framework[Framework["Newtonsoft"] = 0] = "Newtonsoft";
20
24
  Framework[Framework["SystemTextJson"] = 1] = "SystemTextJson";
21
25
  })(Framework = exports.Framework || (exports.Framework = {}));
22
- const unicode = require("unicode-properties");
23
26
  var AccessModifier;
24
27
  (function (AccessModifier) {
25
28
  AccessModifier[AccessModifier["None"] = 0] = "None";
@@ -177,13 +180,13 @@ const denseJsonPropertyName = "J";
177
180
  const denseRequiredEnumName = "R";
178
181
  const denseNullValueHandlingEnumName = "N";
179
182
  function isStartCharacter(utf16Unit) {
180
- if (unicode.isAlphabetic(utf16Unit)) {
183
+ if (unicode_properties_1.default.isAlphabetic(utf16Unit)) {
181
184
  return true;
182
185
  }
183
186
  return utf16Unit === 0x5f; // underscore
184
187
  }
185
188
  function isPartCharacter(utf16Unit) {
186
- const category = unicode.getCategory(utf16Unit);
189
+ const category = unicode_properties_1.default.getCategory(utf16Unit);
187
190
  if (["Nd", "Pc", "Mn", "Mc"].indexOf(category) >= 0) {
188
191
  return true;
189
192
  }
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.ObjectiveCRenderer = exports.ObjectiveCTargetLanguage = exports.objcOptions = void 0;
4
7
  const collection_utils_1 = require("collection-utils");
@@ -11,7 +14,7 @@ const Strings_1 = require("../support/Strings");
11
14
  const ConvenienceRenderer_1 = require("../ConvenienceRenderer");
12
15
  const RendererOptions_1 = require("../RendererOptions");
13
16
  const Support_1 = require("../support/Support");
14
- const unicode = require("unicode-properties");
17
+ const unicode_properties_1 = __importDefault(require("unicode-properties"));
15
18
  const DEBUG = false;
16
19
  const DEFAULT_CLASS_PREFIX = "QT";
17
20
  exports.objcOptions = {
@@ -151,10 +154,10 @@ const booleanPrefixes = [
151
154
  "need"
152
155
  ];
153
156
  function isStartCharacter(utf16Unit) {
154
- return unicode.isAlphabetic(utf16Unit) || utf16Unit === 0x5f; // underscore
157
+ return unicode_properties_1.default.isAlphabetic(utf16Unit) || utf16Unit === 0x5f; // underscore
155
158
  }
156
159
  function isPartCharacter(utf16Unit) {
157
- const category = unicode.getCategory(utf16Unit);
160
+ const category = unicode_properties_1.default.getCategory(utf16Unit);
158
161
  return ["Nd", "Pc", "Mn", "Mc"].indexOf(category) >= 0 || isStartCharacter(utf16Unit);
159
162
  }
160
163
  const legalizeName = (0, Strings_1.utf16LegalizeCharacters)(isPartCharacter);
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.JSONPythonRenderer = exports.PythonRenderer = exports.PythonTargetLanguage = exports.pythonOptions = void 0;
4
7
  const TargetLanguage_1 = require("../TargetLanguage");
@@ -12,7 +15,7 @@ const Source_1 = require("../Source");
12
15
  const TypeUtils_1 = require("../TypeUtils");
13
16
  const Transformers_1 = require("../Transformers");
14
17
  const collection_utils_1 = require("collection-utils");
15
- const unicode = require("unicode-properties");
18
+ const unicode_properties_1 = __importDefault(require("unicode-properties"));
16
19
  const forbiddenTypeNames = [
17
20
  "Any",
18
21
  "True",
@@ -120,14 +123,14 @@ class PythonTargetLanguage extends TargetLanguage_1.TargetLanguage {
120
123
  exports.PythonTargetLanguage = PythonTargetLanguage;
121
124
  function isNormalizedStartCharacter3(utf16Unit) {
122
125
  // FIXME: add Other_ID_Start - https://docs.python.org/3/reference/lexical_analysis.html#identifiers
123
- const category = unicode.getCategory(utf16Unit);
126
+ const category = unicode_properties_1.default.getCategory(utf16Unit);
124
127
  return ["Lu", "Ll", "Lt", "Lm", "Lo", "Nl"].indexOf(category) >= 0;
125
128
  }
126
129
  function isNormalizedPartCharacter3(utf16Unit) {
127
130
  // FIXME: add Other_ID_Continue - https://docs.python.org/3/reference/lexical_analysis.html#identifiers
128
131
  if (isNormalizedStartCharacter3(utf16Unit))
129
132
  return true;
130
- const category = unicode.getCategory(utf16Unit);
133
+ const category = unicode_properties_1.default.getCategory(utf16Unit);
131
134
  return ["Mn", "Mc", "Nd", "Pc"].indexOf(category) >= 0;
132
135
  }
133
136
  function isStartCharacter3(utf16Unit) {
@@ -22,9 +22,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
29
  exports.RubyRenderer = exports.RubyTargetLanguage = exports.rubyOptions = exports.Strictness = void 0;
27
- const unicode = require("unicode-properties");
30
+ const unicode_properties_1 = __importDefault(require("unicode-properties"));
28
31
  const Source_1 = require("../../Source");
29
32
  const Naming_1 = require("../../Naming");
30
33
  const ConvenienceRenderer_1 = require("../../ConvenienceRenderer");
@@ -74,7 +77,7 @@ class RubyTargetLanguage extends TargetLanguage_1.TargetLanguage {
74
77
  exports.RubyTargetLanguage = RubyTargetLanguage;
75
78
  const isStartCharacter = Strings_1.isLetterOrUnderscore;
76
79
  function isPartCharacter(utf16Unit) {
77
- const category = unicode.getCategory(utf16Unit);
80
+ const category = unicode_properties_1.default.getCategory(utf16Unit);
78
81
  return ["Nd", "Pc", "Mn", "Mc"].indexOf(category) >= 0 || isStartCharacter(utf16Unit);
79
82
  }
80
83
  const legalizeName = (0, Strings_1.legalizeCharacters)(isPartCharacter);
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.makeNameStyle = exports.addPrefixIfNecessary = exports.combineWords = exports.allLowerWordStyle = exports.originalWord = exports.allUpperWordStyle = exports.firstUpperWordStyle = exports.splitIntoWords = exports.fastIsUpperCase = exports.startWithLetter = exports.snakeCase = exports.camelCase = exports.pascalCase = exports.decapitalize = exports.capitalize = exports.trimEnd = exports.isWordCharacter = exports.isLetterOrUnderscoreOrDigit = exports.isLetterOrUnderscore = exports.isLetterOrDigit = exports.isNumeric = exports.isDigit = exports.isLetter = exports.isAscii = exports.isPrintable = exports.stringEscape = exports.utf16StringEscape = exports.escapeNonPrintableMapper = exports.standardUnicodeHexEscape = exports.intToHex = exports.repeatString = exports.legalizeCharacters = exports.utf16LegalizeCharacters = exports.utf32ConcatMap = exports.utf16ConcatMap = void 0;
4
7
  const Support_1 = require("./Support");
5
8
  const Acronyms_1 = require("./Acronyms");
6
9
  const Messages_1 = require("../Messages");
7
- const unicode = require("unicode-properties");
10
+ const unicode_properties_1 = __importDefault(require("unicode-properties"));
8
11
  function computeAsciiMap(mapper) {
9
12
  const charStringMap = [];
10
13
  const charNoEscapeMap = [];
@@ -174,7 +177,7 @@ exports.stringEscape = utf32ConcatMap(escapeNonPrintableMapper(isPrintable, stan
174
177
  function isPrintable(codePoint) {
175
178
  if (codePoint > 0xffff)
176
179
  return false;
177
- const category = unicode.getCategory(codePoint);
180
+ const category = unicode_properties_1.default.getCategory(codePoint);
178
181
  return ([
179
182
  "Mc",
180
183
  "No",
@@ -207,18 +210,18 @@ function isAscii(codePoint) {
207
210
  }
208
211
  exports.isAscii = isAscii;
209
212
  function isLetter(codePoint) {
210
- const category = unicode.getCategory(codePoint);
213
+ const category = unicode_properties_1.default.getCategory(codePoint);
211
214
  // FIXME: Include Letter, modifier (Lm)?
212
215
  return ["Lu", "Ll", "Lt", "Lo"].indexOf(category) >= 0;
213
216
  }
214
217
  exports.isLetter = isLetter;
215
218
  function isDigit(codePoint) {
216
- const category = unicode.getCategory(codePoint);
219
+ const category = unicode_properties_1.default.getCategory(codePoint);
217
220
  return ["Nd"].indexOf(category) >= 0;
218
221
  }
219
222
  exports.isDigit = isDigit;
220
223
  function isNumeric(codePoint) {
221
- const category = unicode.getCategory(codePoint);
224
+ const category = unicode_properties_1.default.getCategory(codePoint);
222
225
  return ["No", "Nd", "Nl"].indexOf(category) >= 0;
223
226
  }
224
227
  exports.isNumeric = isNumeric;
@@ -242,7 +245,7 @@ function trimEnd(str) {
242
245
  const l = str.length;
243
246
  let firstWS = l;
244
247
  for (let i = l - 1; i >= 0; i--) {
245
- if (!unicode.isWhiteSpace(str.charCodeAt(i)))
248
+ if (!unicode_properties_1.default.isWhiteSpace(str.charCodeAt(i)))
246
249
  break;
247
250
  firstWS = i;
248
251
  }
@@ -292,9 +295,9 @@ exports.startWithLetter = startWithLetter;
292
295
  const knownAcronyms = new Set(Acronyms_1.acronyms);
293
296
  const fastIsWordCharacter = precomputedCodePointPredicate(isWordCharacter);
294
297
  const fastIsNonWordCharacter = precomputedCodePointPredicate(cp => !isWordCharacter(cp));
295
- const fastIsLowerCase = precomputedCodePointPredicate(cp => unicode.isLowerCase(cp));
296
- exports.fastIsUpperCase = precomputedCodePointPredicate(cp => unicode.isUpperCase(cp));
297
- const fastNonLetter = precomputedCodePointPredicate(cp => !unicode.isLowerCase(cp) && !unicode.isUpperCase(cp));
298
+ const fastIsLowerCase = precomputedCodePointPredicate(cp => unicode_properties_1.default.isLowerCase(cp));
299
+ exports.fastIsUpperCase = precomputedCodePointPredicate(cp => unicode_properties_1.default.isUpperCase(cp));
300
+ const fastNonLetter = precomputedCodePointPredicate(cp => !unicode_properties_1.default.isLowerCase(cp) && !unicode_properties_1.default.isUpperCase(cp));
298
301
  const fastIsDigit = precomputedCodePointPredicate(isDigit);
299
302
  function splitIntoWords(s) {
300
303
  // [start, end, allUpper]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quicktype-core",
3
- "version": "20.0.12",
3
+ "version": "20.0.14",
4
4
  "description": "The quicktype engine as a library",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",
@@ -14,30 +14,31 @@
14
14
  "dependencies": {
15
15
  "@glideapps/ts-necessities": "2.1.2",
16
16
  "@types/urijs": "^1.19.19",
17
- "unicode-properties": "^1.4.1",
18
17
  "browser-or-node": "^1.2.1",
19
18
  "collection-utils": "^1.0.1",
20
19
  "is-url": "^1.2.4",
21
- "isomorphic-fetch": "^2.2.1",
20
+ "cross-fetch": "^3.1.5",
22
21
  "js-base64": "^2.4.3",
22
+ "lodash": "^4.17.21",
23
23
  "pako": "^1.0.6",
24
24
  "pluralize": "^7.0.0",
25
25
  "readable-stream": "4.3.0",
26
+ "unicode-properties": "^1.4.1",
26
27
  "urijs": "^1.19.1",
27
28
  "wordwrap": "^1.0.0",
28
- "lodash": "^4.17.21",
29
29
  "yaml": "^2.2.1"
30
30
  },
31
31
  "devDependencies": {
32
+ "@types/browser-or-node": "^1.2.0",
32
33
  "@types/js-base64": "^2.3.1",
33
34
  "@types/node": "18.11.18",
34
35
  "@types/pako": "^1.0.0",
35
36
  "@types/pluralize": "0.0.28",
37
+ "@types/readable-stream": "2.3.15",
38
+ "@types/unicode-properties": "^1.3.0",
36
39
  "@types/yaml": "^1.9.7",
37
- "typescript": "4.9.4",
38
40
  "tslint": "^5.11.0",
39
- "@types/readable-stream": "2.3.15",
40
- "@types/browser-or-node": "^1.2.0"
41
+ "typescript": "4.9.4"
41
42
  },
42
43
  "files": [
43
44
  "dist"