@graphql-inspector/introspect-command 3.4.8-alpha-20230403113909-e09091f3 → 3.4.8

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.
@@ -1,25 +1,23 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const tslib = require('tslib');
6
- const fs = require('fs');
7
- const path = require('path');
8
- const graphql = require('graphql');
9
- const commands = require('@graphql-inspector/commands');
10
- const logger = require('@graphql-inspector/logger');
11
-
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handler = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const fs_1 = require("fs");
6
+ const path_1 = require("path");
7
+ const graphql_1 = require("graphql");
8
+ const commands_1 = require("@graphql-inspector/commands");
9
+ const logger_1 = require("@graphql-inspector/logger");
12
10
  function handler({ schema: unsortedSchema, output, comments, }) {
13
- const schema = graphql.lexicographicSortSchema(unsortedSchema);
14
- const introspection = graphql.introspectionFromSchema(schema);
15
- const filepath = path.resolve(process.cwd(), output);
11
+ const schema = (0, graphql_1.lexicographicSortSchema)(unsortedSchema);
12
+ const introspection = (0, graphql_1.introspectionFromSchema)(schema);
13
+ const filepath = (0, path_1.resolve)(process.cwd(), output);
16
14
  let content;
17
- switch (path.extname(output.toLowerCase())) {
15
+ switch ((0, path_1.extname)(output.toLowerCase())) {
18
16
  case '.graphql':
19
17
  case '.gql':
20
18
  case '.gqls':
21
19
  case '.graphqls':
22
- content = graphql.printSchema(schema, {
20
+ content = graphql_1.printSchema(schema, {
23
21
  commentDescriptions: comments,
24
22
  });
25
23
  break;
@@ -29,10 +27,11 @@ function handler({ schema: unsortedSchema, output, comments, }) {
29
27
  default:
30
28
  throw new Error('Only .graphql, .gql and .json files are supported');
31
29
  }
32
- fs.writeFileSync(output, content, 'utf8');
33
- logger.Logger.success(`Saved to ${filepath}`);
30
+ (0, fs_1.writeFileSync)(output, content, 'utf8');
31
+ logger_1.Logger.success(`Saved to ${filepath}`);
34
32
  }
35
- const index = commands.createCommand(api => {
33
+ exports.handler = handler;
34
+ exports.default = (0, commands_1.createCommand)(api => {
36
35
  const { loaders } = api;
37
36
  return {
38
37
  command: 'introspect <schema>',
@@ -59,8 +58,8 @@ const index = commands.createCommand(api => {
59
58
  },
60
59
  handler(args) {
61
60
  var _a;
62
- return tslib.__awaiter(this, void 0, void 0, function* () {
63
- const { headers, token } = commands.parseGlobalArgs(args);
61
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
62
+ const { headers, token } = (0, commands_1.parseGlobalArgs)(args);
64
63
  const output = args.write;
65
64
  const comments = args.comments || false;
66
65
  const apolloFederation = args.federation || false;
@@ -76,6 +75,3 @@ const index = commands.createCommand(api => {
76
75
  },
77
76
  };
78
77
  });
79
-
80
- exports.default = index;
81
- exports.handler = handler;
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -1,11 +1,10 @@
1
- import { __awaiter } from 'tslib';
1
+ import { __awaiter } from "tslib";
2
2
  import { writeFileSync } from 'fs';
3
- import { resolve, extname } from 'path';
4
- import { lexicographicSortSchema, introspectionFromSchema, printSchema } from 'graphql';
5
- import { createCommand, parseGlobalArgs } from '@graphql-inspector/commands';
3
+ import { extname, resolve } from 'path';
4
+ import { introspectionFromSchema, lexicographicSortSchema, printSchema, } from 'graphql';
5
+ import { createCommand, parseGlobalArgs, } from '@graphql-inspector/commands';
6
6
  import { Logger } from '@graphql-inspector/logger';
7
-
8
- function handler({ schema: unsortedSchema, output, comments, }) {
7
+ export function handler({ schema: unsortedSchema, output, comments, }) {
9
8
  const schema = lexicographicSortSchema(unsortedSchema);
10
9
  const introspection = introspectionFromSchema(schema);
11
10
  const filepath = resolve(process.cwd(), output);
@@ -28,7 +27,7 @@ function handler({ schema: unsortedSchema, output, comments, }) {
28
27
  writeFileSync(output, content, 'utf8');
29
28
  Logger.success(`Saved to ${filepath}`);
30
29
  }
31
- const index = createCommand(api => {
30
+ export default createCommand(api => {
32
31
  const { loaders } = api;
33
32
  return {
34
33
  command: 'introspect <schema>',
@@ -72,6 +71,3 @@ const index = createCommand(api => {
72
71
  },
73
72
  };
74
73
  });
75
-
76
- export default index;
77
- export { handler };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-inspector/introspect-command",
3
- "version": "3.4.8-alpha-20230403113909-e09091f3",
3
+ "version": "3.4.8",
4
4
  "description": "Introspects GraphQL Schema",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
@@ -8,9 +8,9 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "tslib": "^2.0.0",
11
- "@graphql-inspector/commands": "3.4.4",
12
- "@graphql-inspector/core": "4.1.0-alpha-20230403113909-e09091f3",
13
- "@graphql-inspector/logger": "3.4.3"
11
+ "@graphql-inspector/commands": "3.4.5",
12
+ "@graphql-inspector/core": "4.0.3",
13
+ "@graphql-inspector/logger": "3.4.4"
14
14
  },
15
15
  "repository": {
16
16
  "type": "git",
@@ -29,20 +29,41 @@
29
29
  "url": "https://github.com/kamilkisiela"
30
30
  },
31
31
  "license": "MIT",
32
- "main": "index.js",
33
- "module": "index.mjs",
34
- "typings": "index.d.ts",
32
+ "main": "cjs/index.js",
33
+ "module": "esm/index.js",
34
+ "typings": "typings/index.d.ts",
35
35
  "typescript": {
36
- "definition": "index.d.ts"
36
+ "definition": "typings/index.d.ts"
37
37
  },
38
+ "type": "module",
38
39
  "exports": {
39
40
  ".": {
40
- "require": "./index.js",
41
- "import": "./index.mjs"
41
+ "require": {
42
+ "types": "./typings/index.d.cts",
43
+ "default": "./cjs/index.js"
44
+ },
45
+ "import": {
46
+ "types": "./typings/index.d.ts",
47
+ "default": "./esm/index.js"
48
+ },
49
+ "default": {
50
+ "types": "./typings/index.d.ts",
51
+ "default": "./esm/index.js"
52
+ }
42
53
  },
43
54
  "./*": {
44
- "require": "./*.js",
45
- "import": "./*.mjs"
55
+ "require": {
56
+ "types": "./typings/*.d.cts",
57
+ "default": "./cjs/*.js"
58
+ },
59
+ "import": {
60
+ "types": "./typings/*.d.ts",
61
+ "default": "./esm/*.js"
62
+ },
63
+ "default": {
64
+ "types": "./typings/*.d.ts",
65
+ "default": "./esm/*.js"
66
+ }
46
67
  },
47
68
  "./package.json": "./package.json"
48
69
  }
@@ -0,0 +1,14 @@
1
+ import { GraphQLSchema } from 'graphql';
2
+ import { CommandFactory, GlobalArgs } from '@graphql-inspector/commands';
3
+ export { CommandFactory };
4
+ export declare function handler({ schema: unsortedSchema, output, comments, }: {
5
+ schema: GraphQLSchema;
6
+ output: string;
7
+ comments: boolean;
8
+ }): void;
9
+ declare const _default: CommandFactory<{}, {
10
+ schema: string;
11
+ write?: string | undefined;
12
+ comments?: boolean | undefined;
13
+ } & GlobalArgs>;
14
+ export default _default;
File without changes