quicktype 20.0.13 → 20.0.15
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 +2 -2
- package/dist/CompressedJSONFromStream.js +2 -2
- package/dist/GraphQLIntrospection.js +5 -2
- package/dist/index.js +4 -4
- package/package.json +11 -9
package/README.md
CHANGED
|
@@ -138,13 +138,13 @@ $ npm install quicktype-core
|
|
|
138
138
|
In general, first you create an `InputData` value with one or more JSON samples, JSON schemas, TypeScript sources, or other supported input types. Then you call `quicktype`, passing that `InputData` value and any options you want.
|
|
139
139
|
|
|
140
140
|
```javascript
|
|
141
|
-
|
|
141
|
+
import {
|
|
142
142
|
quicktype,
|
|
143
143
|
InputData,
|
|
144
144
|
jsonInputForTargetLanguage,
|
|
145
145
|
JSONSchemaInput,
|
|
146
146
|
FetchingJSONSchemaStore
|
|
147
|
-
}
|
|
147
|
+
} from "quicktype-core";
|
|
148
148
|
|
|
149
149
|
async function quicktypeJSON(targetLanguage, typeName, jsonString) {
|
|
150
150
|
const jsonInput = jsonInputForTargetLanguage(targetLanguage);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CompressedJSONFromStream = void 0;
|
|
4
4
|
const quicktype_core_1 = require("quicktype-core");
|
|
5
|
-
const
|
|
5
|
+
const stream_json_1 = require("stream-json");
|
|
6
6
|
const methodMap = {
|
|
7
7
|
startObject: "pushObjectContext",
|
|
8
8
|
endObject: "finishObject",
|
|
@@ -19,7 +19,7 @@ const methodMap = {
|
|
|
19
19
|
};
|
|
20
20
|
class CompressedJSONFromStream extends quicktype_core_1.CompressedJSON {
|
|
21
21
|
async parse(readStream) {
|
|
22
|
-
const combo = new Parser({ packKeys: true, packStrings: true });
|
|
22
|
+
const combo = new stream_json_1.Parser({ packKeys: true, packStrings: true });
|
|
23
23
|
combo.on("data", (item) => {
|
|
24
24
|
if (typeof methodMap[item.name] === "string") {
|
|
25
25
|
this[methodMap[item.name]](item.value);
|
|
@@ -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.introspectServer = void 0;
|
|
4
7
|
const quicktype_core_1 = require("quicktype-core");
|
|
5
8
|
const graphql_1 = require("graphql");
|
|
6
9
|
const ts_necessities_1 = require("@glideapps/ts-necessities");
|
|
7
|
-
const
|
|
10
|
+
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
8
11
|
// https://github.com/apollographql/apollo-codegen/blob/master/src/downloadSchema.ts
|
|
9
12
|
const defaultHeaders = {
|
|
10
13
|
Accept: "application/json",
|
|
@@ -25,7 +28,7 @@ async function introspectServer(url, method, headerStrings) {
|
|
|
25
28
|
}
|
|
26
29
|
let result;
|
|
27
30
|
try {
|
|
28
|
-
const response = await
|
|
31
|
+
const response = await (0, cross_fetch_1.default)(url, {
|
|
29
32
|
method,
|
|
30
33
|
headers: headers,
|
|
31
34
|
body: JSON.stringify({ query: graphql_1.introspectionQuery })
|
package/dist/index.js
CHANGED
|
@@ -40,8 +40,8 @@ const URLGrammar_1 = require("./URLGrammar");
|
|
|
40
40
|
const GraphQLIntrospection_1 = require("./GraphQLIntrospection");
|
|
41
41
|
const CompressedJSONFromStream_1 = require("./CompressedJSONFromStream");
|
|
42
42
|
const stringToStream = require("string-to-stream");
|
|
43
|
-
const
|
|
44
|
-
const
|
|
43
|
+
const command_line_args_1 = __importDefault(require("command-line-args"));
|
|
44
|
+
const command_line_usage_1 = __importDefault(require("command-line-usage"));
|
|
45
45
|
const chalk_1 = __importDefault(require("chalk"));
|
|
46
46
|
const wordWrap = require("wordwrap")(90);
|
|
47
47
|
const packageJSON = require("../package.json");
|
|
@@ -486,7 +486,7 @@ exports.parseCLIOptions = parseCLIOptions;
|
|
|
486
486
|
function parseOptions(definitions, argv, partial) {
|
|
487
487
|
let opts;
|
|
488
488
|
try {
|
|
489
|
-
opts =
|
|
489
|
+
opts = (0, command_line_args_1.default)(definitions, { argv, partial });
|
|
490
490
|
}
|
|
491
491
|
catch (e) {
|
|
492
492
|
(0, quicktype_core_1.assert)(!partial, "Partial option parsing should not have failed");
|
|
@@ -526,7 +526,7 @@ function usage(targetLanguages) {
|
|
|
526
526
|
});
|
|
527
527
|
}
|
|
528
528
|
const sections = _.concat(makeSectionsBeforeRenderers(targetLanguages), rendererSections, sectionsAfterRenderers);
|
|
529
|
-
console.log(
|
|
529
|
+
console.log((0, command_line_usage_1.default)(sections));
|
|
530
530
|
}
|
|
531
531
|
// Returns an array of [name, sourceURIs] pairs.
|
|
532
532
|
async function getSourceURIs(options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quicktype",
|
|
3
|
-
"version": "20.0.
|
|
3
|
+
"version": "20.0.15",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -24,27 +24,29 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@glideapps/ts-necessities": "^2.1.2",
|
|
26
26
|
"chalk": "^4.1.2",
|
|
27
|
-
"command-line-args": "^
|
|
28
|
-
"command-line-usage": "^
|
|
27
|
+
"command-line-args": "^5.2.1",
|
|
28
|
+
"command-line-usage": "^6.1.3",
|
|
29
|
+
"cross-fetch": "^3.1.5",
|
|
29
30
|
"graphql": "^0.11.7",
|
|
30
31
|
"lodash": "^4.17.21",
|
|
31
32
|
"moment": "^2.29.4",
|
|
32
|
-
"
|
|
33
|
-
"quicktype-
|
|
34
|
-
"quicktype-
|
|
35
|
-
"quicktype-typescript-input": "20.0.13",
|
|
33
|
+
"quicktype-core": "20.0.15",
|
|
34
|
+
"quicktype-graphql-input": "20.0.15",
|
|
35
|
+
"quicktype-typescript-input": "20.0.15",
|
|
36
36
|
"readable-stream": "^4.3.0",
|
|
37
|
-
"stream-json": "1.
|
|
37
|
+
"stream-json": "1.7.5",
|
|
38
38
|
"string-to-stream": "^3.0.1",
|
|
39
39
|
"typescript": "4.9.4"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@tsconfig/node18": "^1.0.1",
|
|
43
|
+
"@types/command-line-args": "^5.2.0",
|
|
44
|
+
"@types/command-line-usage": "^5.0.2",
|
|
43
45
|
"@types/graphql": "^0.11.7",
|
|
44
|
-
"@types/is-url": "^1.2.28",
|
|
45
46
|
"@types/lodash": "^4.14.108",
|
|
46
47
|
"@types/semver": "^7.3.13",
|
|
47
48
|
"@types/shelljs": "^0.7.8",
|
|
49
|
+
"@types/stream-json": "^1.7.3",
|
|
48
50
|
"@types/urijs": "^1.19.19",
|
|
49
51
|
"ajv": "^5.5.2",
|
|
50
52
|
"deep-equal": "^2.2.0",
|