@graphql-inspector/introspect-command 2.9.0 → 3.1.0

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.
@@ -81,4 +81,3 @@ const index = commands.createCommand((api) => {
81
81
 
82
82
  exports.default = index;
83
83
  exports.handler = handler;
84
- //# sourceMappingURL=index.cjs.js.map
@@ -77,4 +77,3 @@ const index = createCommand((api) => {
77
77
 
78
78
  export default index;
79
79
  export { handler };
80
- //# sourceMappingURL=index.esm.js.map
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@graphql-inspector/introspect-command",
3
- "version": "2.9.0",
3
+ "version": "3.1.0",
4
4
  "description": "Introspects GraphQL Schema",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
- "graphql": "^0.13.0 || ^14.0.0 || ^15.0.0"
7
+ "graphql": "^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
8
8
  },
9
9
  "dependencies": {
10
- "@graphql-inspector/commands": "2.9.0",
11
- "@graphql-inspector/core": "2.9.0",
12
- "@graphql-inspector/logger": "2.9.0",
10
+ "@graphql-inspector/commands": "3.1.0",
11
+ "@graphql-inspector/core": "3.1.0",
12
+ "@graphql-inspector/logger": "3.1.0",
13
13
  "tslib": "^2.0.0"
14
14
  },
15
15
  "repository": {
@@ -29,10 +29,20 @@
29
29
  "url": "https://github.com/kamilkisiela"
30
30
  },
31
31
  "license": "MIT",
32
- "main": "index.cjs.js",
33
- "module": "index.esm.js",
32
+ "main": "index.js",
33
+ "module": "index.mjs",
34
34
  "typings": "index.d.ts",
35
35
  "typescript": {
36
36
  "definition": "index.d.ts"
37
+ },
38
+ "exports": {
39
+ ".": {
40
+ "require": "./index.js",
41
+ "import": "./index.mjs"
42
+ },
43
+ "./*": {
44
+ "require": "./*.js",
45
+ "import": "./*.mjs"
46
+ }
37
47
  }
38
48
  }
package/index.cjs.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../../dist/commands/introspect/src/index.js"],"sourcesContent":["import { __awaiter } from \"tslib\";\nimport { createCommand, parseGlobalArgs, } from '@graphql-inspector/commands';\nimport { Logger } from '@graphql-inspector/logger';\nimport { writeFileSync } from 'fs';\nimport { resolve, extname } from 'path';\nimport { introspectionFromSchema, lexicographicSortSchema, printSchema } from 'graphql';\nexport function handler({ schema: unsortedSchema, output, comments, }) {\n const schema = lexicographicSortSchema(unsortedSchema);\n const introspection = introspectionFromSchema(schema);\n const filepath = resolve(process.cwd(), output);\n let content;\n switch (extname(output.toLowerCase())) {\n case '.graphql':\n case '.gql':\n case '.gqls':\n case '.graphqls':\n content = printSchema(schema, {\n commentDescriptions: comments,\n });\n break;\n case '.json':\n content = JSON.stringify(introspection, null, 2);\n break;\n default:\n throw new Error('Only .graphql, .gql and .json files are supported');\n }\n writeFileSync(output, content, {\n encoding: 'utf-8',\n });\n Logger.success(`Saved to ${filepath}`);\n}\nexport default createCommand((api) => {\n const { loaders } = api;\n return {\n command: 'introspect <schema>',\n describe: 'Introspect a schema',\n builder(yargs) {\n return yargs\n .positional('schema', {\n describe: 'Point to a schema',\n type: 'string',\n demandOption: true,\n })\n .options({\n w: {\n alias: 'write',\n describe: 'Write to a file',\n type: 'string',\n },\n comments: {\n describe: 'Use preceding comments as the description',\n type: 'boolean',\n },\n })\n .default('w', 'graphql.schema.json');\n },\n handler(args) {\n var _a;\n return __awaiter(this, void 0, void 0, function* () {\n const { headers, token } = parseGlobalArgs(args);\n const output = args.write;\n const comments = args.comments || false;\n const apolloFederation = args.federation || false;\n const aws = args.aws || false;\n const method = ((_a = args.method) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || 'POST';\n const schema = yield loaders.loadSchema(args.schema, {\n token,\n headers,\n method,\n }, apolloFederation, aws);\n return handler({ schema, output, comments });\n });\n },\n };\n});\n//# sourceMappingURL=index.js.map"],"names":["lexicographicSortSchema","introspectionFromSchema","resolve","extname","printSchema","writeFileSync","Logger","createCommand","__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AAM,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC;AACpH,gBAAgB,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE;AACrE,oBAAoB,KAAK;AACzB,oBAAoB,OAAO;AAC3B,oBAAoB,MAAM;AAC1B,iBAAiB,EAAE,gBAAgB,EAAE,GAAG,CAAC,CAAC;AAC1C,gBAAgB,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC7D,aAAa,CAAC,CAAC;AACf,SAAS;AACT,KAAK,CAAC;AACN,CAAC,CAAC;;;;;"}
package/index.esm.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../../dist/commands/introspect/src/index.js"],"sourcesContent":["import { __awaiter } from \"tslib\";\nimport { createCommand, parseGlobalArgs, } from '@graphql-inspector/commands';\nimport { Logger } from '@graphql-inspector/logger';\nimport { writeFileSync } from 'fs';\nimport { resolve, extname } from 'path';\nimport { introspectionFromSchema, lexicographicSortSchema, printSchema } from 'graphql';\nexport function handler({ schema: unsortedSchema, output, comments, }) {\n const schema = lexicographicSortSchema(unsortedSchema);\n const introspection = introspectionFromSchema(schema);\n const filepath = resolve(process.cwd(), output);\n let content;\n switch (extname(output.toLowerCase())) {\n case '.graphql':\n case '.gql':\n case '.gqls':\n case '.graphqls':\n content = printSchema(schema, {\n commentDescriptions: comments,\n });\n break;\n case '.json':\n content = JSON.stringify(introspection, null, 2);\n break;\n default:\n throw new Error('Only .graphql, .gql and .json files are supported');\n }\n writeFileSync(output, content, {\n encoding: 'utf-8',\n });\n Logger.success(`Saved to ${filepath}`);\n}\nexport default createCommand((api) => {\n const { loaders } = api;\n return {\n command: 'introspect <schema>',\n describe: 'Introspect a schema',\n builder(yargs) {\n return yargs\n .positional('schema', {\n describe: 'Point to a schema',\n type: 'string',\n demandOption: true,\n })\n .options({\n w: {\n alias: 'write',\n describe: 'Write to a file',\n type: 'string',\n },\n comments: {\n describe: 'Use preceding comments as the description',\n type: 'boolean',\n },\n })\n .default('w', 'graphql.schema.json');\n },\n handler(args) {\n var _a;\n return __awaiter(this, void 0, void 0, function* () {\n const { headers, token } = parseGlobalArgs(args);\n const output = args.write;\n const comments = args.comments || false;\n const apolloFederation = args.federation || false;\n const aws = args.aws || false;\n const method = ((_a = args.method) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || 'POST';\n const schema = yield loaders.loadSchema(args.schema, {\n token,\n headers,\n method,\n }, apolloFederation, aws);\n return handler({ schema, output, comments });\n });\n },\n };\n});\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;;;AAMO,SAAS,OAAO,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,GAAG,EAAE;AACvE,IAAI,MAAM,MAAM,GAAG,uBAAuB,CAAC,cAAc,CAAC,CAAC;AAC3D,IAAI,MAAM,aAAa,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAC;AAC1D,IAAI,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC;AACpD,IAAI,IAAI,OAAO,CAAC;AAChB,IAAI,QAAQ,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;AACzC,QAAQ,KAAK,UAAU,CAAC;AACxB,QAAQ,KAAK,MAAM,CAAC;AACpB,QAAQ,KAAK,OAAO,CAAC;AACrB,QAAQ,KAAK,WAAW;AACxB,YAAY,OAAO,GAAG,WAAW,CAAC,MAAM,EAAE;AAC1C,gBAAgB,mBAAmB,EAAE,QAAQ;AAC7C,aAAa,CAAC,CAAC;AACf,YAAY,MAAM;AAClB,QAAQ,KAAK,OAAO;AACpB,YAAY,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,C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