@graphql-markdown/printer-legacy 1.11.0 → 1.12.1
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/badge.d.ts +29 -1
- package/dist/badge.js +42 -10
- package/dist/code.d.ts +38 -0
- package/dist/code.js +38 -0
- package/dist/common.d.ts +39 -0
- package/dist/common.js +39 -0
- package/dist/const/options.d.ts +1 -4
- package/dist/const/options.js +1 -3
- package/dist/const/strings.d.ts +1 -0
- package/dist/const/strings.js +2 -1
- package/dist/directive.d.ts +37 -0
- package/dist/directive.js +39 -2
- package/dist/example.d.ts +26 -0
- package/dist/example.js +52 -0
- package/dist/frontmatter.d.ts +15 -3
- package/dist/frontmatter.js +14 -59
- package/dist/graphql/directive.d.ts +21 -0
- package/dist/graphql/directive.js +27 -0
- package/dist/graphql/enum.d.ts +18 -0
- package/dist/graphql/enum.js +18 -0
- package/dist/graphql/interface.d.ts +15 -0
- package/dist/graphql/interface.js +15 -0
- package/dist/graphql/object.d.ts +23 -0
- package/dist/graphql/object.js +29 -0
- package/dist/graphql/operation.d.ts +21 -0
- package/dist/graphql/operation.js +21 -0
- package/dist/graphql/scalar.d.ts +23 -0
- package/dist/graphql/scalar.js +20 -1
- package/dist/graphql/union.d.ts +16 -0
- package/dist/graphql/union.js +16 -0
- package/dist/group.d.ts +12 -0
- package/dist/group.js +8 -0
- package/dist/link.d.ts +92 -0
- package/dist/link.js +92 -0
- package/dist/mdx/index.d.ts +15 -2
- package/dist/mdx/index.js +151 -60
- package/dist/printer.d.ts +129 -2
- package/dist/printer.js +134 -5
- package/dist/relation.d.ts +39 -0
- package/dist/relation.js +41 -2
- package/dist/section.d.ts +46 -2
- package/dist/section.js +54 -23
- package/package.json +4 -5
package/dist/frontmatter.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Module for handling frontmatter generation in Markdown documents.
|
|
3
|
+
* Provides utilities for formatting and printing frontmatter content.
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import type { FrontMatterOptions, Maybe, PrintTypeOptions } from "@graphql-markdown/types";
|
|
7
|
+
/**
|
|
8
|
+
* Generates a formatted frontmatter string for Markdown/MDX documents.
|
|
9
|
+
*
|
|
10
|
+
* @param title - The title to be included in the frontmatter
|
|
11
|
+
* @param props - Additional frontmatter properties to be included
|
|
12
|
+
* @param options - Configuration options for printing
|
|
13
|
+
* @returns Formatted frontmatter string, or empty string if formatting is disabled
|
|
14
|
+
*/
|
|
15
|
+
export declare const printFrontMatter: (title: string, props: Maybe<FrontMatterOptions>, options: PrintTypeOptions) => string;
|
package/dist/frontmatter.js
CHANGED
|
@@ -1,65 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.printFrontMatter =
|
|
3
|
+
exports.printFrontMatter = void 0;
|
|
4
4
|
const utils_1 = require("@graphql-markdown/utils");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
...(0, exports.formatFrontMatterProp)({ [key]: value }, indentation + 1, prefix));
|
|
18
|
-
prefix = " ".repeat(prefix?.length ?? 0);
|
|
19
|
-
}
|
|
20
|
-
return frontMatter;
|
|
21
|
-
};
|
|
22
|
-
const formatFrontMatterList = (prop, indentation = 0, prefix = "- ") => {
|
|
23
|
-
const frontMatter = [];
|
|
24
|
-
if (!Array.isArray(prop)) {
|
|
25
|
-
return frontMatter;
|
|
5
|
+
/**
|
|
6
|
+
* Generates a formatted frontmatter string for Markdown/MDX documents.
|
|
7
|
+
*
|
|
8
|
+
* @param title - The title to be included in the frontmatter
|
|
9
|
+
* @param props - Additional frontmatter properties to be included
|
|
10
|
+
* @param options - Configuration options for printing
|
|
11
|
+
* @returns Formatted frontmatter string, or empty string if formatting is disabled
|
|
12
|
+
*/
|
|
13
|
+
const printFrontMatter = (title, props, options) => {
|
|
14
|
+
const frontMatter = (0, utils_1.formatFrontMatterObject)({ ...props, title }, -1);
|
|
15
|
+
if (!options.formatMDXFrontmatter) {
|
|
16
|
+
return "";
|
|
26
17
|
}
|
|
27
|
-
|
|
28
|
-
if (typeof entry === "object") {
|
|
29
|
-
frontMatter.push(...formatFrontMatterObject(entry, -1, prefix).map((item) => {
|
|
30
|
-
return `${tabs(indentation)}${item}`;
|
|
31
|
-
}));
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
frontMatter.push(`${tabs(indentation)}- ${(0, utils_1.toString)(entry)}`);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
return frontMatter;
|
|
38
|
-
};
|
|
39
|
-
const formatFrontMatterProp = (prop, indentation = 0, prefix) => {
|
|
40
|
-
if (typeof prop === "undefined" || prop === null) {
|
|
41
|
-
return [];
|
|
42
|
-
}
|
|
43
|
-
const tabs = strings_1.MARKDOWN_CODE_INDENTATION.repeat(indentation);
|
|
44
|
-
const [key, value] = Object.entries(prop)[0];
|
|
45
|
-
const index = `${tabs}${prefix ?? ""}${key}:`;
|
|
46
|
-
switch (true) {
|
|
47
|
-
case typeof value !== "string" && Array.isArray(value):
|
|
48
|
-
return [index, ...formatFrontMatterList(value, indentation + 1, prefix)];
|
|
49
|
-
case typeof value === "object" && value !== null:
|
|
50
|
-
return [index, ...formatFrontMatterObject(value, indentation, prefix)];
|
|
51
|
-
default:
|
|
52
|
-
return [`${index} ${value}`];
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
exports.formatFrontMatterProp = formatFrontMatterProp;
|
|
56
|
-
const printFrontMatter = (id, title, props) => {
|
|
57
|
-
const frontMatter = formatFrontMatterObject({ ...props, id, title }, -1);
|
|
58
|
-
const header = [
|
|
59
|
-
strings_1.FRONT_MATTER_DELIMITER,
|
|
60
|
-
...frontMatter,
|
|
61
|
-
strings_1.FRONT_MATTER_DELIMITER,
|
|
62
|
-
];
|
|
63
|
-
return header.join(strings_1.MARKDOWN_EOL);
|
|
18
|
+
return options.formatMDXFrontmatter(props, frontMatter);
|
|
64
19
|
};
|
|
65
20
|
exports.printFrontMatter = printFrontMatter;
|
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module for handling GraphQL directive printing and formatting.
|
|
3
|
+
* Provides utilities to generate string representations of GraphQL directives
|
|
4
|
+
* including their metadata, arguments, and locations.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
1
8
|
import type { PrintDirectiveOptions, GraphQLDirective, MDXString } from "@graphql-markdown/types";
|
|
9
|
+
/**
|
|
10
|
+
* Prints metadata information for a GraphQL directive, focusing on its arguments.
|
|
11
|
+
*
|
|
12
|
+
* @param type - The GraphQL directive to process
|
|
13
|
+
* @param options - Configuration options for printing directive metadata
|
|
14
|
+
* @returns Formatted metadata string in MDX format or empty string if no arguments
|
|
15
|
+
*/
|
|
2
16
|
export declare const printDirectiveMetadata: (type: GraphQLDirective, options: PrintDirectiveOptions) => MDXString | string;
|
|
17
|
+
/**
|
|
18
|
+
* Generates a string representation of a complete GraphQL directive definition.
|
|
19
|
+
*
|
|
20
|
+
* @param type - The GraphQL directive to process
|
|
21
|
+
* @param options - Configuration options for printing the directive (optional)
|
|
22
|
+
* @returns A formatted string containing the complete directive definition
|
|
23
|
+
*/
|
|
3
24
|
export declare const printCodeDirective: (type: GraphQLDirective, options?: PrintDirectiveOptions) => string;
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Module for handling GraphQL directive printing and formatting.
|
|
4
|
+
* Provides utilities to generate string representations of GraphQL directives
|
|
5
|
+
* including their metadata, arguments, and locations.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
2
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
10
|
exports.printCodeDirective = exports.printDirectiveMetadata = void 0;
|
|
4
11
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
5
12
|
const section_1 = require("../section");
|
|
6
13
|
const code_1 = require("../code");
|
|
14
|
+
/**
|
|
15
|
+
* Generates a string representation of directive locations.
|
|
16
|
+
*
|
|
17
|
+
* @param type - The GraphQL directive to process
|
|
18
|
+
* @returns A formatted string of directive locations or empty string if no locations defined
|
|
19
|
+
*/
|
|
7
20
|
const printCodeDirectiveLocation = (type) => {
|
|
8
21
|
if (typeof type.locations === "undefined" || type.locations.length === 0) {
|
|
9
22
|
return "";
|
|
@@ -16,6 +29,13 @@ const printCodeDirectiveLocation = (type) => {
|
|
|
16
29
|
code += type.locations.join(separator).trim();
|
|
17
30
|
return code;
|
|
18
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* Prints metadata information for a GraphQL directive, focusing on its arguments.
|
|
34
|
+
*
|
|
35
|
+
* @param type - The GraphQL directive to process
|
|
36
|
+
* @param options - Configuration options for printing directive metadata
|
|
37
|
+
* @returns Formatted metadata string in MDX format or empty string if no arguments
|
|
38
|
+
*/
|
|
19
39
|
const printDirectiveMetadata = (type, options) => {
|
|
20
40
|
if (!("args" in type)) {
|
|
21
41
|
return "";
|
|
@@ -23,6 +43,13 @@ const printDirectiveMetadata = (type, options) => {
|
|
|
23
43
|
return (0, section_1.printMetadataSection)(type, type.args, "Arguments", options);
|
|
24
44
|
};
|
|
25
45
|
exports.printDirectiveMetadata = printDirectiveMetadata;
|
|
46
|
+
/**
|
|
47
|
+
* Generates a string representation of a complete GraphQL directive definition.
|
|
48
|
+
*
|
|
49
|
+
* @param type - The GraphQL directive to process
|
|
50
|
+
* @param options - Configuration options for printing the directive (optional)
|
|
51
|
+
* @returns A formatted string containing the complete directive definition
|
|
52
|
+
*/
|
|
26
53
|
const printCodeDirective = (type,
|
|
27
54
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
28
55
|
options) => {
|
package/dist/graphql/enum.d.ts
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provides utilities for printing GraphQL enum types to Markdown/MDX format
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
1
5
|
import type { MDXString, PrintTypeOptions } from "@graphql-markdown/types";
|
|
6
|
+
/**
|
|
7
|
+
* Prints the metadata section for a GraphQL enum type.
|
|
8
|
+
*
|
|
9
|
+
* @param type - The GraphQL enum type to process
|
|
10
|
+
* @param options - Options for printing the type
|
|
11
|
+
* @returns A string containing the metadata section in MDX format, or empty string if type is not an enum
|
|
12
|
+
*/
|
|
2
13
|
export declare const printEnumMetadata: (type: unknown, options: PrintTypeOptions) => MDXString | string;
|
|
14
|
+
/**
|
|
15
|
+
* Generates a GraphQL SDL code block for an enum type.
|
|
16
|
+
*
|
|
17
|
+
* @param type - The GraphQL enum type to process
|
|
18
|
+
* @param options - Optional printing options that control directive handling
|
|
19
|
+
* @returns A string containing the enum type definition in GraphQL SDL, or empty string if type is not an enum
|
|
20
|
+
*/
|
|
3
21
|
export declare const printCodeEnum: (type: unknown, options?: PrintTypeOptions) => string;
|
package/dist/graphql/enum.js
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Provides utilities for printing GraphQL enum types to Markdown/MDX format
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
2
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
7
|
exports.printCodeEnum = exports.printEnumMetadata = void 0;
|
|
4
8
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
5
9
|
const strings_1 = require("../const/strings");
|
|
6
10
|
const section_1 = require("../section");
|
|
7
11
|
const link_1 = require("../link");
|
|
12
|
+
/**
|
|
13
|
+
* Prints the metadata section for a GraphQL enum type.
|
|
14
|
+
*
|
|
15
|
+
* @param type - The GraphQL enum type to process
|
|
16
|
+
* @param options - Options for printing the type
|
|
17
|
+
* @returns A string containing the metadata section in MDX format, or empty string if type is not an enum
|
|
18
|
+
*/
|
|
8
19
|
const printEnumMetadata = (type, options) => {
|
|
9
20
|
if (!(0, graphql_1.isEnumType)(type)) {
|
|
10
21
|
return "";
|
|
@@ -12,6 +23,13 @@ const printEnumMetadata = (type, options) => {
|
|
|
12
23
|
return (0, section_1.printMetadataSection)(type, type.getValues(), "Values", options);
|
|
13
24
|
};
|
|
14
25
|
exports.printEnumMetadata = printEnumMetadata;
|
|
26
|
+
/**
|
|
27
|
+
* Generates a GraphQL SDL code block for an enum type.
|
|
28
|
+
*
|
|
29
|
+
* @param type - The GraphQL enum type to process
|
|
30
|
+
* @param options - Optional printing options that control directive handling
|
|
31
|
+
* @returns A string containing the enum type definition in GraphQL SDL, or empty string if type is not an enum
|
|
32
|
+
*/
|
|
15
33
|
const printCodeEnum = (type, options) => {
|
|
16
34
|
if (!(0, graphql_1.isEnumType)(type)) {
|
|
17
35
|
return "";
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contains utilities for printing GraphQL interface types as Markdown documentation.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
1
5
|
import type { PrintTypeOptions } from "@graphql-markdown/types";
|
|
6
|
+
/**
|
|
7
|
+
* Prints metadata for a GraphQL interface type.
|
|
8
|
+
* This is an alias for {@link printObjectMetadata}.
|
|
9
|
+
*/
|
|
2
10
|
export declare const printInterfaceMetadata: (type: unknown, options: PrintTypeOptions) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Generates a code block representation of a GraphQL interface type.
|
|
13
|
+
*
|
|
14
|
+
* @param type - The GraphQL interface type to print
|
|
15
|
+
* @param options - Configuration options for printing the type
|
|
16
|
+
* @returns A string containing the Markdown code block representation
|
|
17
|
+
*/
|
|
3
18
|
export declare const printCodeInterface: (type: unknown, options: PrintTypeOptions) => string;
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Contains utilities for printing GraphQL interface types as Markdown documentation.
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
2
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
7
|
exports.printCodeInterface = exports.printInterfaceMetadata = void 0;
|
|
4
8
|
const object_1 = require("./object");
|
|
9
|
+
/**
|
|
10
|
+
* Prints metadata for a GraphQL interface type.
|
|
11
|
+
* This is an alias for {@link printObjectMetadata}.
|
|
12
|
+
*/
|
|
5
13
|
exports.printInterfaceMetadata = object_1.printObjectMetadata;
|
|
14
|
+
/**
|
|
15
|
+
* Generates a code block representation of a GraphQL interface type.
|
|
16
|
+
*
|
|
17
|
+
* @param type - The GraphQL interface type to print
|
|
18
|
+
* @param options - Configuration options for printing the type
|
|
19
|
+
* @returns A string containing the Markdown code block representation
|
|
20
|
+
*/
|
|
6
21
|
const printCodeInterface = (type, options) => {
|
|
7
22
|
return (0, object_1.printCodeType)(type, "interface", options);
|
|
8
23
|
};
|
package/dist/graphql/object.d.ts
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphQL Object Type printing utilities
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
1
5
|
import type { PrintTypeOptions } from "@graphql-markdown/types";
|
|
6
|
+
/**
|
|
7
|
+
* Prints the complete metadata section for a GraphQL object type
|
|
8
|
+
* @param type - The GraphQL type object to process
|
|
9
|
+
* @param options - Printing options
|
|
10
|
+
* @returns Markdown formatted string containing fields and interfaces metadata
|
|
11
|
+
*/
|
|
2
12
|
export declare const printObjectMetadata: (type: unknown, options: PrintTypeOptions) => string;
|
|
13
|
+
/**
|
|
14
|
+
* Prints the GraphQL type definition as a code block
|
|
15
|
+
* @param type - The GraphQL type object to process
|
|
16
|
+
* @param entity - The entity type identifier (e.g., "type", "interface")
|
|
17
|
+
* @param options - Printing options
|
|
18
|
+
* @returns GraphQL type definition as a code block string
|
|
19
|
+
*/
|
|
3
20
|
export declare const printCodeType: (type: unknown, entity: string, options: PrintTypeOptions) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Prints a GraphQL object type definition as a code block
|
|
23
|
+
* @param type - The GraphQL type object to process
|
|
24
|
+
* @param options - Printing options
|
|
25
|
+
* @returns GraphQL object type definition as a code block string
|
|
26
|
+
*/
|
|
4
27
|
export declare const printCodeObject: (type: unknown, options: PrintTypeOptions) => string;
|
package/dist/graphql/object.js
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* GraphQL Object Type printing utilities
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
2
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
7
|
exports.printCodeObject = exports.printCodeType = exports.printObjectMetadata = void 0;
|
|
4
8
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
5
9
|
const section_1 = require("../section");
|
|
6
10
|
const code_1 = require("../code");
|
|
7
11
|
const strings_1 = require("../const/strings");
|
|
12
|
+
/**
|
|
13
|
+
* Prints the metadata section for interfaces implemented by a GraphQL type
|
|
14
|
+
* @param type - The GraphQL type object to process
|
|
15
|
+
* @param options - Printing options
|
|
16
|
+
* @returns Markdown formatted string of implemented interfaces
|
|
17
|
+
*/
|
|
8
18
|
const printImplementedInterfaceMetadata = (type, options) => {
|
|
9
19
|
if (typeof type !== "object" ||
|
|
10
20
|
type === null ||
|
|
@@ -14,12 +24,25 @@ const printImplementedInterfaceMetadata = (type, options) => {
|
|
|
14
24
|
}
|
|
15
25
|
return (0, section_1.printSection)(type.getInterfaces(), "Interfaces", options);
|
|
16
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Prints the complete metadata section for a GraphQL object type
|
|
29
|
+
* @param type - The GraphQL type object to process
|
|
30
|
+
* @param options - Printing options
|
|
31
|
+
* @returns Markdown formatted string containing fields and interfaces metadata
|
|
32
|
+
*/
|
|
17
33
|
const printObjectMetadata = (type, options) => {
|
|
18
34
|
const interfaceMeta = printImplementedInterfaceMetadata(type, options);
|
|
19
35
|
const metadata = (0, section_1.printMetadataSection)(type, (0, graphql_1.getFields)(type), "Fields", options);
|
|
20
36
|
return `${metadata}${interfaceMeta}`;
|
|
21
37
|
};
|
|
22
38
|
exports.printObjectMetadata = printObjectMetadata;
|
|
39
|
+
/**
|
|
40
|
+
* Prints the GraphQL type definition as a code block
|
|
41
|
+
* @param type - The GraphQL type object to process
|
|
42
|
+
* @param entity - The entity type identifier (e.g., "type", "interface")
|
|
43
|
+
* @param options - Printing options
|
|
44
|
+
* @returns GraphQL type definition as a code block string
|
|
45
|
+
*/
|
|
23
46
|
const printCodeType = (type, entity, options) => {
|
|
24
47
|
if (typeof type !== "object" || type === null) {
|
|
25
48
|
return "";
|
|
@@ -47,6 +70,12 @@ const printCodeType = (type, entity, options) => {
|
|
|
47
70
|
return `${entity} ${name}${extendsInterface} {${strings_1.MARKDOWN_EOL}${typeFields}}`;
|
|
48
71
|
};
|
|
49
72
|
exports.printCodeType = printCodeType;
|
|
73
|
+
/**
|
|
74
|
+
* Prints a GraphQL object type definition as a code block
|
|
75
|
+
* @param type - The GraphQL type object to process
|
|
76
|
+
* @param options - Printing options
|
|
77
|
+
* @returns GraphQL object type definition as a code block string
|
|
78
|
+
*/
|
|
50
79
|
const printCodeObject = (type, options) => {
|
|
51
80
|
return (0, exports.printCodeType)(type, "type", options);
|
|
52
81
|
};
|
|
@@ -1,4 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module for handling GraphQL operation printing functionality.
|
|
3
|
+
* Provides utilities to print operation types, metadata, and code representations.
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
1
6
|
import type { PrintTypeOptions, MDXString } from "@graphql-markdown/types";
|
|
7
|
+
/**
|
|
8
|
+
* Prints the operation type information.
|
|
9
|
+
* @param type - The operation type to print
|
|
10
|
+
* @param options - Print type options for customizing output
|
|
11
|
+
* @returns Formatted string representation of the operation type or empty string if invalid
|
|
12
|
+
*/
|
|
2
13
|
export declare const printOperationType: (type: unknown, options: PrintTypeOptions) => MDXString | string;
|
|
14
|
+
/**
|
|
15
|
+
* Prints the operation metadata including arguments and type information.
|
|
16
|
+
* @param type - The operation type to print metadata for
|
|
17
|
+
* @param options - Print type options for customizing output
|
|
18
|
+
* @returns Formatted string containing operation metadata or empty string if invalid
|
|
19
|
+
*/
|
|
3
20
|
export declare const printOperationMetadata: (type: unknown, options: PrintTypeOptions) => MDXString | string;
|
|
21
|
+
/**
|
|
22
|
+
* Prints the code representation of an operation.
|
|
23
|
+
* @see printCodeField
|
|
24
|
+
*/
|
|
4
25
|
export declare const printCodeOperation: (type: unknown, options?: PrintTypeOptions, indentationLevel?: number) => MDXString | string;
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Module for handling GraphQL operation printing functionality.
|
|
4
|
+
* Provides utilities to print operation types, metadata, and code representations.
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.printCodeOperation = exports.printOperationMetadata = exports.printOperationType = void 0;
|
|
4
9
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
5
10
|
const section_1 = require("../section");
|
|
6
11
|
const code_1 = require("../code");
|
|
12
|
+
/**
|
|
13
|
+
* Prints the operation type information.
|
|
14
|
+
* @param type - The operation type to print
|
|
15
|
+
* @param options - Print type options for customizing output
|
|
16
|
+
* @returns Formatted string representation of the operation type or empty string if invalid
|
|
17
|
+
*/
|
|
7
18
|
const printOperationType = (type, options) => {
|
|
8
19
|
if (!(0, graphql_1.isOperation)(type)) {
|
|
9
20
|
return "";
|
|
@@ -15,6 +26,12 @@ const printOperationType = (type, options) => {
|
|
|
15
26
|
});
|
|
16
27
|
};
|
|
17
28
|
exports.printOperationType = printOperationType;
|
|
29
|
+
/**
|
|
30
|
+
* Prints the operation metadata including arguments and type information.
|
|
31
|
+
* @param type - The operation type to print metadata for
|
|
32
|
+
* @param options - Print type options for customizing output
|
|
33
|
+
* @returns Formatted string containing operation metadata or empty string if invalid
|
|
34
|
+
*/
|
|
18
35
|
const printOperationMetadata = (type, options) => {
|
|
19
36
|
if (!(0, graphql_1.isOperation)(type)) {
|
|
20
37
|
return "";
|
|
@@ -24,4 +41,8 @@ const printOperationMetadata = (type, options) => {
|
|
|
24
41
|
return `${metadata}${response}`;
|
|
25
42
|
};
|
|
26
43
|
exports.printOperationMetadata = printOperationMetadata;
|
|
44
|
+
/**
|
|
45
|
+
* Prints the code representation of an operation.
|
|
46
|
+
* @see printCodeField
|
|
47
|
+
*/
|
|
27
48
|
exports.printCodeOperation = code_1.printCodeField;
|
package/dist/graphql/scalar.d.ts
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provides utility functions for handling GraphQL scalar types in markdown generation.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
1
5
|
import type { PrintTypeOptions, MDXString } from "@graphql-markdown/types";
|
|
6
|
+
/**
|
|
7
|
+
* Generates markdown documentation for a scalar type's specification URL.
|
|
8
|
+
* @param type - The GraphQL scalar type object
|
|
9
|
+
* @param options - Options for printing type information
|
|
10
|
+
* @returns Markdown string containing the specification link, or empty string if no URL exists
|
|
11
|
+
*/
|
|
2
12
|
export declare const printSpecification: (type: unknown, options: PrintTypeOptions) => MDXString | string;
|
|
13
|
+
/**
|
|
14
|
+
* Prints metadata information for a scalar type.
|
|
15
|
+
* Currently only includes the specification URL if available.
|
|
16
|
+
* @param type - The GraphQL scalar type object
|
|
17
|
+
* @param options - Options for printing type information
|
|
18
|
+
* @returns Markdown string containing the scalar metadata
|
|
19
|
+
*/
|
|
3
20
|
export declare const printScalarMetadata: (type: unknown, options: PrintTypeOptions) => MDXString | string;
|
|
21
|
+
/**
|
|
22
|
+
* Generates the GraphQL SDL representation of a scalar type.
|
|
23
|
+
* @param type - The GraphQL scalar type object
|
|
24
|
+
* @param options - Options for printing type information (unused)
|
|
25
|
+
* @returns SDL string representation of the scalar type
|
|
26
|
+
*/
|
|
4
27
|
export declare const printCodeScalar: (type: unknown, options?: PrintTypeOptions) => string;
|
package/dist/graphql/scalar.js
CHANGED
|
@@ -4,6 +4,12 @@ exports.printCodeScalar = exports.printScalarMetadata = exports.printSpecificati
|
|
|
4
4
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
5
5
|
const strings_1 = require("../const/strings");
|
|
6
6
|
const options_1 = require("../const/options");
|
|
7
|
+
/**
|
|
8
|
+
* Generates markdown documentation for a scalar type's specification URL.
|
|
9
|
+
* @param type - The GraphQL scalar type object
|
|
10
|
+
* @param options - Options for printing type information
|
|
11
|
+
* @returns Markdown string containing the specification link, or empty string if no URL exists
|
|
12
|
+
*/
|
|
7
13
|
const printSpecification = (type, options) => {
|
|
8
14
|
if (typeof type !== "object" ||
|
|
9
15
|
type === null ||
|
|
@@ -13,13 +19,26 @@ const printSpecification = (type, options) => {
|
|
|
13
19
|
}
|
|
14
20
|
const url = type.specifiedByURL;
|
|
15
21
|
// Needs newline between "export const specifiedByLinkCss" and markdown header to prevent compilation error in docusaurus
|
|
16
|
-
return `${options_1.SectionLevels.
|
|
22
|
+
return `${options_1.SectionLevels.LEVEL.repeat(3)} ${options.formatMDXSpecifiedByLink(url)}${strings_1.MARKDOWN_EOP}`;
|
|
17
23
|
};
|
|
18
24
|
exports.printSpecification = printSpecification;
|
|
25
|
+
/**
|
|
26
|
+
* Prints metadata information for a scalar type.
|
|
27
|
+
* Currently only includes the specification URL if available.
|
|
28
|
+
* @param type - The GraphQL scalar type object
|
|
29
|
+
* @param options - Options for printing type information
|
|
30
|
+
* @returns Markdown string containing the scalar metadata
|
|
31
|
+
*/
|
|
19
32
|
const printScalarMetadata = (type, options) => {
|
|
20
33
|
return (0, exports.printSpecification)(type, options);
|
|
21
34
|
};
|
|
22
35
|
exports.printScalarMetadata = printScalarMetadata;
|
|
36
|
+
/**
|
|
37
|
+
* Generates the GraphQL SDL representation of a scalar type.
|
|
38
|
+
* @param type - The GraphQL scalar type object
|
|
39
|
+
* @param options - Options for printing type information (unused)
|
|
40
|
+
* @returns SDL string representation of the scalar type
|
|
41
|
+
*/
|
|
23
42
|
const printCodeScalar = (type, options) => {
|
|
24
43
|
return `scalar ${(0, graphql_1.getTypeName)(type)}`;
|
|
25
44
|
};
|
package/dist/graphql/union.d.ts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module for handling GraphQL Union type printing operations.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
1
5
|
import type { PrintTypeOptions, MDXString } from "@graphql-markdown/types";
|
|
6
|
+
/**
|
|
7
|
+
* Generates metadata documentation for a GraphQL Union type.
|
|
8
|
+
* @param type - The GraphQL type to process
|
|
9
|
+
* @param options - Configuration options for printing
|
|
10
|
+
* @returns Formatted MDX string containing the union type's possible types
|
|
11
|
+
*/
|
|
2
12
|
export declare const printUnionMetadata: (type: unknown, options: PrintTypeOptions) => MDXString | string;
|
|
13
|
+
/**
|
|
14
|
+
* Generates GraphQL SDL code representation of a Union type.
|
|
15
|
+
* @param type - The GraphQL type to process
|
|
16
|
+
* @param options - Configuration options for printing (unused)
|
|
17
|
+
* @returns SDL string representation of the union type
|
|
18
|
+
*/
|
|
3
19
|
export declare const printCodeUnion: (type: unknown, options?: PrintTypeOptions) => string;
|
package/dist/graphql/union.js
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Module for handling GraphQL Union type printing operations.
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
2
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
7
|
exports.printCodeUnion = exports.printUnionMetadata = void 0;
|
|
4
8
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
5
9
|
const section_1 = require("../section");
|
|
10
|
+
/**
|
|
11
|
+
* Generates metadata documentation for a GraphQL Union type.
|
|
12
|
+
* @param type - The GraphQL type to process
|
|
13
|
+
* @param options - Configuration options for printing
|
|
14
|
+
* @returns Formatted MDX string containing the union type's possible types
|
|
15
|
+
*/
|
|
6
16
|
const printUnionMetadata = (type, options) => {
|
|
7
17
|
if (!(0, graphql_1.isUnionType)(type)) {
|
|
8
18
|
return "";
|
|
@@ -13,6 +23,12 @@ const printUnionMetadata = (type, options) => {
|
|
|
13
23
|
});
|
|
14
24
|
};
|
|
15
25
|
exports.printUnionMetadata = printUnionMetadata;
|
|
26
|
+
/**
|
|
27
|
+
* Generates GraphQL SDL code representation of a Union type.
|
|
28
|
+
* @param type - The GraphQL type to process
|
|
29
|
+
* @param options - Configuration options for printing (unused)
|
|
30
|
+
* @returns SDL string representation of the union type
|
|
31
|
+
*/
|
|
16
32
|
const printCodeUnion = (type, options) => {
|
|
17
33
|
if (!(0, graphql_1.isUnionType)(type)) {
|
|
18
34
|
return "";
|
package/dist/group.d.ts
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility module for handling GraphQL schema entity grouping.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
1
5
|
import type { SchemaEntitiesGroupMap, SchemaEntity, Maybe } from "@graphql-markdown/types";
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves the group name for a given GraphQL type based on its category and group mapping.
|
|
8
|
+
*
|
|
9
|
+
* @param type - The GraphQL type to get the group for
|
|
10
|
+
* @param groups - Mapping of schema entities to their group names
|
|
11
|
+
* @param typeCategory - The category of the schema entity
|
|
12
|
+
* @returns The slugified group name or empty string if no group is found
|
|
13
|
+
*/
|
|
2
14
|
export declare const getGroup: (type: unknown, groups: Maybe<SchemaEntitiesGroupMap>, typeCategory: Maybe<SchemaEntity>) => string;
|
package/dist/group.js
CHANGED
|
@@ -3,6 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getGroup = void 0;
|
|
4
4
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
5
5
|
const utils_1 = require("@graphql-markdown/utils");
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves the group name for a given GraphQL type based on its category and group mapping.
|
|
8
|
+
*
|
|
9
|
+
* @param type - The GraphQL type to get the group for
|
|
10
|
+
* @param groups - Mapping of schema entities to their group names
|
|
11
|
+
* @param typeCategory - The category of the schema entity
|
|
12
|
+
* @returns The slugified group name or empty string if no group is found
|
|
13
|
+
*/
|
|
6
14
|
const getGroup = (type, groups, typeCategory) => {
|
|
7
15
|
if (typeof type !== "object" ||
|
|
8
16
|
type === null ||
|