@graphql-markdown/printer-legacy 1.12.0 → 1.12.2
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 +24 -0
- package/dist/badge.js +24 -0
- 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/directive.d.ts +37 -0
- package/dist/directive.js +37 -0
- package/dist/example.d.ts +26 -0
- package/dist/example.js +52 -0
- package/dist/frontmatter.d.ts +13 -0
- package/dist/frontmatter.js +8 -0
- 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 +19 -0
- 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 +13 -0
- package/dist/mdx/index.js +128 -2
- package/dist/printer.d.ts +127 -0
- package/dist/printer.js +127 -0
- package/dist/relation.d.ts +39 -0
- package/dist/relation.js +39 -0
- package/dist/section.d.ts +45 -0
- package/dist/section.js +45 -0
- package/package.json +4 -4
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 ||
|
|
@@ -16,10 +22,23 @@ const printSpecification = (type, options) => {
|
|
|
16
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 ||
|
package/dist/link.d.ts
CHANGED
|
@@ -1,14 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module for handling links and link-related operations in GraphQL Markdown printer.
|
|
3
|
+
* Provides utilities for creating, formatting, and managing links to GraphQL types and operations.
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
1
6
|
import type { ApiGroupOverrideType, MDXString, Maybe, PrintLinkOptions, PrintTypeOptions, TypeDeprecatedOption, TypeLink, TypeLocale } from "@graphql-markdown/types";
|
|
2
7
|
export declare const API_GROUPS: Required<ApiGroupOverrideType>;
|
|
8
|
+
/**
|
|
9
|
+
* Checks if a type has printable directives based on the provided options.
|
|
10
|
+
*
|
|
11
|
+
* @param type - The GraphQL type to check
|
|
12
|
+
* @param options - Configuration options for directive printing
|
|
13
|
+
* @param options.deprecated - How to handle deprecated types
|
|
14
|
+
* @param options.onlyDocDirectives - Only print types with specific directives
|
|
15
|
+
* @param options.skipDocDirectives - Skip types with specific directives
|
|
16
|
+
* @returns `true` if the type should be printed, `false` otherwise
|
|
17
|
+
*/
|
|
3
18
|
export declare const hasPrintableDirective: (type: unknown, options?: Pick<PrintTypeOptions, "deprecated" | "onlyDocDirectives" | "skipDocDirectives">) => boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Gets the locale category for a given GraphQL type.
|
|
21
|
+
*
|
|
22
|
+
* @param type - The GraphQL type to get the category for
|
|
23
|
+
* @returns The locale category for the type, or `undefined` if not found
|
|
24
|
+
*/
|
|
4
25
|
export declare const getCategoryLocale: (type: unknown) => Maybe<TypeLocale>;
|
|
26
|
+
/**
|
|
27
|
+
* Gets the folder name for a link category based on the GraphQL type and operation locale.
|
|
28
|
+
*
|
|
29
|
+
* @param type - The GraphQL type to get the folder name for
|
|
30
|
+
* @param operationLocale - The locale of the operation
|
|
31
|
+
* @returns The folder name for the link category, or `undefined` if not found
|
|
32
|
+
*/
|
|
5
33
|
export declare const getLinkCategoryFolder: (type: unknown, operationLocale?: Maybe<TypeLocale>) => Maybe<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Checks if the options include the `withAttributes` attribute.
|
|
36
|
+
*
|
|
37
|
+
* @param options - The options to check
|
|
38
|
+
* @returns `true` if the options include `withAttributes`, `false` otherwise
|
|
39
|
+
*/
|
|
6
40
|
export declare const hasOptionWithAttributes: (options: PrintLinkOptions) => boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Checks if the options include the `parentTypePrefix` attribute.
|
|
43
|
+
*
|
|
44
|
+
* @param options - The options to check
|
|
45
|
+
* @returns `true` if the options include `parentTypePrefix`, `false` otherwise
|
|
46
|
+
*/
|
|
7
47
|
export declare const hasOptionParentType: (options: PrintLinkOptions) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Gets the folder name for an API group based on the GraphQL type and group options.
|
|
50
|
+
*
|
|
51
|
+
* @param type - The GraphQL type to get the folder name for
|
|
52
|
+
* @param groups - The group options
|
|
53
|
+
* @returns The folder name for the API group
|
|
54
|
+
*/
|
|
8
55
|
export declare const getLinkApiGroupFolder: (type: unknown, groups?: Maybe<ApiGroupOverrideType | boolean>) => string;
|
|
56
|
+
/**
|
|
57
|
+
* Gets the folder name for deprecated types based on the GraphQL type and deprecation option.
|
|
58
|
+
*
|
|
59
|
+
* @param type - The GraphQL type to get the folder name for
|
|
60
|
+
* @param option - The deprecation option
|
|
61
|
+
* @returns The folder name for deprecated types
|
|
62
|
+
*/
|
|
9
63
|
export declare const getLinkDeprecatedFolder: (type: unknown, option: Maybe<TypeDeprecatedOption>) => string;
|
|
64
|
+
/**
|
|
65
|
+
* Converts a GraphQL type to a link object.
|
|
66
|
+
*
|
|
67
|
+
* @param type - The GraphQL type to convert
|
|
68
|
+
* @param name - The name of the type
|
|
69
|
+
* @param operation - The locale of the operation
|
|
70
|
+
* @param options - Configuration options for link generation
|
|
71
|
+
* @returns The link object for the type
|
|
72
|
+
*/
|
|
10
73
|
export declare const toLink: (type: unknown, name: string, operation: Maybe<TypeLocale>, options: PrintLinkOptions) => TypeLink;
|
|
74
|
+
/**
|
|
75
|
+
* Gets the link for a relation based on the category, type, and options.
|
|
76
|
+
*
|
|
77
|
+
* @param category - The locale category of the relation
|
|
78
|
+
* @param type - The GraphQL type of the relation
|
|
79
|
+
* @param options - Configuration options for link generation
|
|
80
|
+
* @returns The link object for the relation, or `undefined` if not found
|
|
81
|
+
*/
|
|
11
82
|
export declare const getRelationLink: (category: Maybe<TypeLocale>, type: unknown, options: PrintLinkOptions) => Maybe<TypeLink>;
|
|
83
|
+
/**
|
|
84
|
+
* Prints the attributes of a link based on the GraphQL type.
|
|
85
|
+
*
|
|
86
|
+
* @param type - The GraphQL type to print attributes for
|
|
87
|
+
* @param text - The text to append attributes to
|
|
88
|
+
* @returns The text with appended attributes
|
|
89
|
+
*/
|
|
12
90
|
export declare const printLinkAttributes: (type: unknown, text?: Maybe<string>) => string;
|
|
91
|
+
/**
|
|
92
|
+
* Prints a link for a GraphQL type based on the provided options.
|
|
93
|
+
*
|
|
94
|
+
* @param type - The GraphQL type to print a link for
|
|
95
|
+
* @param options - Configuration options for link generation
|
|
96
|
+
* @returns The formatted link as a string
|
|
97
|
+
*/
|
|
13
98
|
export declare const printLink: (type: unknown, options: PrintLinkOptions) => string;
|
|
99
|
+
/**
|
|
100
|
+
* Prints a parent link for a GraphQL type based on the provided options.
|
|
101
|
+
*
|
|
102
|
+
* @param type - The GraphQL type to print a parent link for
|
|
103
|
+
* @param options - Configuration options for link generation
|
|
104
|
+
* @returns The formatted parent link as a string or MDX string
|
|
105
|
+
*/
|
|
14
106
|
export declare const printParentLink: (type: unknown, options: PrintLinkOptions) => MDXString | string;
|