@graphql-markdown/printer-legacy 1.12.3 → 1.13.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.
- package/dist/badge.d.ts +5 -4
- package/dist/badge.d.ts.map +1 -0
- package/dist/badge.js +15 -13
- package/dist/code.d.ts +2 -1
- package/dist/code.d.ts.map +1 -0
- package/dist/code.js +24 -22
- package/dist/common.d.ts +7 -8
- package/dist/common.d.ts.map +1 -0
- package/dist/common.js +3 -5
- package/dist/const/options.d.ts +2 -1
- package/dist/const/options.d.ts.map +1 -0
- package/dist/const/strings.d.ts +2 -5
- package/dist/const/strings.d.ts.map +1 -0
- package/dist/const/strings.js +10 -8
- package/dist/directive.d.ts +4 -3
- package/dist/directive.d.ts.map +1 -0
- package/dist/directive.js +10 -12
- package/dist/example.d.ts +1 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/format-helpers.d.ts +42 -0
- package/dist/format-helpers.d.ts.map +1 -0
- package/dist/format-helpers.js +74 -0
- package/dist/formatter.d.ts +28 -0
- package/dist/formatter.d.ts.map +1 -0
- package/dist/formatter.js +63 -0
- package/dist/frontmatter.d.ts +1 -0
- package/dist/frontmatter.d.ts.map +1 -0
- package/dist/graphql/directive.d.ts +3 -2
- package/dist/graphql/directive.d.ts.map +1 -0
- package/dist/graphql/directive.js +1 -1
- package/dist/graphql/enum.d.ts +3 -2
- package/dist/graphql/enum.d.ts.map +1 -0
- package/dist/graphql/index.d.ts +1 -0
- package/dist/graphql/index.d.ts.map +1 -0
- package/dist/graphql/input.d.ts +2 -1
- package/dist/graphql/input.d.ts.map +1 -0
- package/dist/graphql/input.js +2 -1
- package/dist/graphql/interface.d.ts +2 -1
- package/dist/graphql/interface.d.ts.map +1 -0
- package/dist/graphql/interface.js +2 -1
- package/dist/graphql/object.d.ts +1 -0
- package/dist/graphql/object.d.ts.map +1 -0
- package/dist/graphql/operation.d.ts +4 -3
- package/dist/graphql/operation.d.ts.map +1 -0
- package/dist/graphql/operation.js +3 -3
- package/dist/graphql/scalar.d.ts +4 -3
- package/dist/graphql/scalar.d.ts.map +1 -0
- package/dist/graphql/union.d.ts +3 -2
- package/dist/graphql/union.d.ts.map +1 -0
- package/dist/group.d.ts +3 -2
- package/dist/group.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/link.d.ts +5 -7
- package/dist/link.d.ts.map +1 -0
- package/dist/link.js +12 -13
- package/dist/mdx/index.d.ts +2 -1
- package/dist/mdx/index.d.ts.map +1 -0
- package/dist/mdx/index.js +2 -2
- package/dist/printer.d.ts +47 -20
- package/dist/printer.d.ts.map +1 -0
- package/dist/printer.js +160 -36
- package/dist/relation.d.ts +8 -7
- package/dist/relation.d.ts.map +1 -0
- package/dist/relation.js +13 -14
- package/dist/section.d.ts +5 -4
- package/dist/section.d.ts.map +1 -0
- package/dist/section.js +11 -9
- package/package.json +10 -10
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Formatter factories for GraphQL documentation output.
|
|
4
|
+
*
|
|
5
|
+
* Provides factory functions to create formatters for different output targets.
|
|
6
|
+
* The default formatter produces HTML-like markup suitable for most Markdown processors.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.createDefaultFormatter = void 0;
|
|
12
|
+
const strings_1 = require("./const/strings");
|
|
13
|
+
/**
|
|
14
|
+
* Creates a default formatter for documentation output.
|
|
15
|
+
*
|
|
16
|
+
* The default formatter produces HTML-like markup with CSS classes
|
|
17
|
+
* that can be styled with custom CSS. This is suitable for most
|
|
18
|
+
* Markdown processors that support inline HTML.
|
|
19
|
+
*
|
|
20
|
+
* @returns A complete Formatter implementation
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import { createDefaultFormatter } from '@graphql-markdown/printer-legacy';
|
|
25
|
+
*
|
|
26
|
+
* const formatter = createDefaultFormatter();
|
|
27
|
+
* const badge = formatter.formatMDXBadge({ text: 'Required' });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
const createDefaultFormatter = () => {
|
|
31
|
+
return {
|
|
32
|
+
formatMDXBadge: (badge) => {
|
|
33
|
+
return `<mark class="gqlmd-mdx-badge">${badge.text}</mark>`;
|
|
34
|
+
},
|
|
35
|
+
formatMDXAdmonition: ({ text, title, type, icon }, _meta) => {
|
|
36
|
+
return `${strings_1.MARKDOWN_EOP}<fieldset class="gqlmd-mdx-admonition-fieldset">${strings_1.MARKDOWN_EOL}<legend class="gqlmd-mdx-admonition-legend"><span class="gqlmd-mdx-admonition-legend-type gqlmd-mdx-admonition-legend-type-${type.toLocaleLowerCase()}">${icon ?? type.toUpperCase()} ${title}</span></legend>${strings_1.MARKDOWN_EOL}<span>${text}</span>${strings_1.MARKDOWN_EOL}</fieldset>`;
|
|
37
|
+
},
|
|
38
|
+
formatMDXBullet: (text = "") => {
|
|
39
|
+
return `<span class="gqlmd-mdx-bullet"> ● </span>${text}`;
|
|
40
|
+
},
|
|
41
|
+
formatMDXDetails: ({ dataOpen }) => {
|
|
42
|
+
return `${strings_1.MARKDOWN_EOP}<details class="gqlmd-mdx-details">${strings_1.MARKDOWN_EOL}<summary class="gqlmd-mdx-details-summary"><span className="gqlmd-mdx-details-summary-open">${dataOpen.toUpperCase()}</span></summary>${strings_1.MARKDOWN_EOL}</details>${strings_1.MARKDOWN_EOP}`;
|
|
43
|
+
},
|
|
44
|
+
formatMDXFrontmatter: (_props, formatted) => {
|
|
45
|
+
return formatted
|
|
46
|
+
? [strings_1.FRONT_MATTER_DELIMITER, ...formatted, strings_1.FRONT_MATTER_DELIMITER].join(strings_1.MARKDOWN_EOL)
|
|
47
|
+
: "";
|
|
48
|
+
},
|
|
49
|
+
formatMDXLink: (link) => {
|
|
50
|
+
return link;
|
|
51
|
+
},
|
|
52
|
+
formatMDXNameEntity: (name, parentType) => {
|
|
53
|
+
const parentName = parentType
|
|
54
|
+
? `<code class="gqlmd-mdx-entity-parent">${parentType}</code>.`
|
|
55
|
+
: "";
|
|
56
|
+
return `<span class="gqlmd-mdx-entity">${parentName}<code class="gqlmd-mdx-entity-name">${name}</code></span>`;
|
|
57
|
+
},
|
|
58
|
+
formatMDXSpecifiedByLink: (url) => {
|
|
59
|
+
return `<span class="gqlmd-mdx-specifiedby">Specification<a class="gqlmd-mdx-specifiedby-link" target="_blank" href="${url}" title="Specified by ${url}">⎘</a></span>`;
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
exports.createDefaultFormatter = createDefaultFormatter;
|
package/dist/frontmatter.d.ts
CHANGED
|
@@ -13,3 +13,4 @@ import type { FrontMatterOptions, Maybe, PrintTypeOptions } from "@graphql-markd
|
|
|
13
13
|
* @returns Formatted frontmatter string, or empty string if formatting is disabled
|
|
14
14
|
*/
|
|
15
15
|
export declare const printFrontMatter: (title: string, props: Maybe<FrontMatterOptions>, options: PrintTypeOptions) => string;
|
|
16
|
+
//# sourceMappingURL=frontmatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../src/frontmatter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EACV,kBAAkB,EAClB,KAAK,EACL,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAGjC;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,wFAY5B,CAAC"}
|
|
@@ -13,7 +13,7 @@ import type { PrintDirectiveOptions, GraphQLDirective, MDXString } from "@graphq
|
|
|
13
13
|
* @param options - Configuration options for printing directive metadata
|
|
14
14
|
* @returns Formatted metadata string in MDX format or empty string if no arguments
|
|
15
15
|
*/
|
|
16
|
-
export declare const printDirectiveMetadata: (type: GraphQLDirective, options: PrintDirectiveOptions) =>
|
|
16
|
+
export declare const printDirectiveMetadata: (type: GraphQLDirective, options: PrintDirectiveOptions) => string | MDXString;
|
|
17
17
|
/**
|
|
18
18
|
* Generates a string representation of a complete GraphQL directive definition.
|
|
19
19
|
*
|
|
@@ -21,4 +21,5 @@ export declare const printDirectiveMetadata: (type: GraphQLDirective, options: P
|
|
|
21
21
|
* @param options - Configuration options for printing the directive (optional)
|
|
22
22
|
* @returns A formatted string containing the complete directive definition
|
|
23
23
|
*/
|
|
24
|
-
export declare const printCodeDirective: (type: GraphQLDirective, options?: PrintDirectiveOptions) => string;
|
|
24
|
+
export declare const printCodeDirective: (type: GraphQLDirective, options?: PrintDirectiveOptions | undefined) => string;
|
|
25
|
+
//# sourceMappingURL=directive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directive.d.ts","sourceRoot":"","sources":["../../src/graphql/directive.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,EACV,MAAM,yBAAyB,CAAC;AA4BjC;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,gFASlC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,iFAU9B,CAAC"}
|
|
@@ -18,7 +18,7 @@ const code_1 = require("../code");
|
|
|
18
18
|
* @returns A formatted string of directive locations or empty string if no locations defined
|
|
19
19
|
*/
|
|
20
20
|
const printCodeDirectiveLocation = (type) => {
|
|
21
|
-
if (
|
|
21
|
+
if (type.locations === undefined || type.locations.length === 0) {
|
|
22
22
|
return "";
|
|
23
23
|
}
|
|
24
24
|
let code = ` on `;
|
package/dist/graphql/enum.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { MDXString, PrintTypeOptions } from "@graphql-markdown/types";
|
|
|
10
10
|
* @param options - Options for printing the type
|
|
11
11
|
* @returns A string containing the metadata section in MDX format, or empty string if type is not an enum
|
|
12
12
|
*/
|
|
13
|
-
export declare const printEnumMetadata: (type: unknown, options: PrintTypeOptions) =>
|
|
13
|
+
export declare const printEnumMetadata: (type: unknown, options: PrintTypeOptions) => string | MDXString;
|
|
14
14
|
/**
|
|
15
15
|
* Generates a GraphQL SDL code block for an enum type.
|
|
16
16
|
*
|
|
@@ -18,4 +18,5 @@ export declare const printEnumMetadata: (type: unknown, options: PrintTypeOption
|
|
|
18
18
|
* @param options - Optional printing options that control directive handling
|
|
19
19
|
* @returns A string containing the enum type definition in GraphQL SDL, or empty string if type is not an enum
|
|
20
20
|
*/
|
|
21
|
-
export declare const printCodeEnum: (type: unknown, options?: PrintTypeOptions) => string;
|
|
21
|
+
export declare const printCodeEnum: (type: unknown, options?: PrintTypeOptions | undefined) => string;
|
|
22
|
+
//# sourceMappingURL=enum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../src/graphql/enum.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAY3E;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,kEAS7B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,mEA0BzB,CAAC"}
|
package/dist/graphql/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graphql/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|
package/dist/graphql/input.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { PrintTypeOptions } from "@graphql-markdown/types";
|
|
2
|
-
export
|
|
2
|
+
export { printObjectMetadata as printInputMetadata } from "./object";
|
|
3
3
|
export declare const printCodeInput: (type: unknown, options: PrintTypeOptions) => string;
|
|
4
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/graphql/input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAIhE,OAAO,EAAE,mBAAmB,IAAI,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAErE,eAAO,MAAM,cAAc,sDAK1B,CAAC"}
|
package/dist/graphql/input.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.printCodeInput = exports.printInputMetadata = void 0;
|
|
4
4
|
const object_1 = require("./object");
|
|
5
|
-
|
|
5
|
+
const object_2 = require("./object");
|
|
6
|
+
Object.defineProperty(exports, "printInputMetadata", { enumerable: true, get: function () { return object_2.printObjectMetadata; } });
|
|
6
7
|
const printCodeInput = (type, options) => {
|
|
7
8
|
return (0, object_1.printCodeType)(type, "input", options);
|
|
8
9
|
};
|
|
@@ -7,7 +7,7 @@ import type { PrintTypeOptions } from "@graphql-markdown/types";
|
|
|
7
7
|
* Prints metadata for a GraphQL interface type.
|
|
8
8
|
* This is an alias for {@link printObjectMetadata}.
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export { printObjectMetadata as printInterfaceMetadata } from "./object";
|
|
11
11
|
/**
|
|
12
12
|
* Generates a code block representation of a GraphQL interface type.
|
|
13
13
|
*
|
|
@@ -16,3 +16,4 @@ export declare const printInterfaceMetadata: (type: unknown, options: PrintTypeO
|
|
|
16
16
|
* @returns A string containing the Markdown code block representation
|
|
17
17
|
*/
|
|
18
18
|
export declare const printCodeInterface: (type: unknown, options: PrintTypeOptions) => string;
|
|
19
|
+
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/graphql/interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAIhE;;;GAGG;AACH,OAAO,EAAE,mBAAmB,IAAI,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEzE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,sDAK9B,CAAC"}
|
|
@@ -10,7 +10,8 @@ const object_1 = require("./object");
|
|
|
10
10
|
* Prints metadata for a GraphQL interface type.
|
|
11
11
|
* This is an alias for {@link printObjectMetadata}.
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
const object_2 = require("./object");
|
|
14
|
+
Object.defineProperty(exports, "printInterfaceMetadata", { enumerable: true, get: function () { return object_2.printObjectMetadata; } });
|
|
14
15
|
/**
|
|
15
16
|
* Generates a code block representation of a GraphQL interface type.
|
|
16
17
|
*
|
package/dist/graphql/object.d.ts
CHANGED
|
@@ -25,3 +25,4 @@ export declare const printCodeType: (type: unknown, entity: string, options: Pri
|
|
|
25
25
|
* @returns GraphQL object type definition as a code block string
|
|
26
26
|
*/
|
|
27
27
|
export declare const printCodeObject: (type: unknown, options: PrintTypeOptions) => string;
|
|
28
|
+
//# sourceMappingURL=object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/graphql/object.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AA8BhE;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,sDAa/B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,sEAgCzB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,sDAK3B,CAAC"}
|
|
@@ -10,16 +10,17 @@ import type { PrintTypeOptions, MDXString } from "@graphql-markdown/types";
|
|
|
10
10
|
* @param options - Print type options for customizing output
|
|
11
11
|
* @returns Formatted string representation of the operation type or empty string if invalid
|
|
12
12
|
*/
|
|
13
|
-
export declare const printOperationType: (type: unknown, options: PrintTypeOptions) =>
|
|
13
|
+
export declare const printOperationType: (type: unknown, options: PrintTypeOptions) => string | MDXString;
|
|
14
14
|
/**
|
|
15
15
|
* Prints the operation metadata including arguments and type information.
|
|
16
16
|
* @param type - The operation type to print metadata for
|
|
17
17
|
* @param options - Print type options for customizing output
|
|
18
18
|
* @returns Formatted string containing operation metadata or empty string if invalid
|
|
19
19
|
*/
|
|
20
|
-
export declare const printOperationMetadata: (type: unknown, options: PrintTypeOptions) =>
|
|
20
|
+
export declare const printOperationMetadata: (type: unknown, options: PrintTypeOptions) => string | MDXString;
|
|
21
21
|
/**
|
|
22
22
|
* Prints the code representation of an operation.
|
|
23
23
|
* @see printCodeField
|
|
24
24
|
*/
|
|
25
|
-
export
|
|
25
|
+
export { printCodeField as printCodeOperation } from "../code";
|
|
26
|
+
//# sourceMappingURL=operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../src/graphql/operation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAI3E;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,kEAa9B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,kEAYlC,CAAC;AAEF;;;GAGG;AACH,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -8,7 +8,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
exports.printCodeOperation = exports.printOperationMetadata = exports.printOperationType = void 0;
|
|
9
9
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
10
10
|
const section_1 = require("../section");
|
|
11
|
-
const code_1 = require("../code");
|
|
12
11
|
/**
|
|
13
12
|
* Prints the operation type information.
|
|
14
13
|
* @param type - The operation type to print
|
|
@@ -19,7 +18,7 @@ const printOperationType = (type, options) => {
|
|
|
19
18
|
if (!(0, graphql_1.isOperation)(type)) {
|
|
20
19
|
return "";
|
|
21
20
|
}
|
|
22
|
-
const queryType = (0, graphql_1.getTypeName)(type.type).
|
|
21
|
+
const queryType = (0, graphql_1.getTypeName)(type.type).replaceAll(/[![\]]*/g, "");
|
|
23
22
|
return (0, section_1.printSection)([options.schema.getType(queryType)], "Type", {
|
|
24
23
|
...options,
|
|
25
24
|
parentTypePrefix: false,
|
|
@@ -45,4 +44,5 @@ exports.printOperationMetadata = printOperationMetadata;
|
|
|
45
44
|
* Prints the code representation of an operation.
|
|
46
45
|
* @see printCodeField
|
|
47
46
|
*/
|
|
48
|
-
|
|
47
|
+
const code_1 = require("../code");
|
|
48
|
+
Object.defineProperty(exports, "printCodeOperation", { enumerable: true, get: function () { return code_1.printCodeField; } });
|
package/dist/graphql/scalar.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { PrintTypeOptions, MDXString } from "@graphql-markdown/types";
|
|
|
9
9
|
* @param options - Options for printing type information
|
|
10
10
|
* @returns Markdown string containing the specification link, or empty string if no URL exists
|
|
11
11
|
*/
|
|
12
|
-
export declare const printSpecification: (type: unknown, options: PrintTypeOptions) =>
|
|
12
|
+
export declare const printSpecification: (type: unknown, options: PrintTypeOptions) => string | MDXString;
|
|
13
13
|
/**
|
|
14
14
|
* Prints metadata information for a scalar type.
|
|
15
15
|
* Currently only includes the specification URL if available.
|
|
@@ -17,11 +17,12 @@ export declare const printSpecification: (type: unknown, options: PrintTypeOptio
|
|
|
17
17
|
* @param options - Options for printing type information
|
|
18
18
|
* @returns Markdown string containing the scalar metadata
|
|
19
19
|
*/
|
|
20
|
-
export declare const printScalarMetadata: (type: unknown, options: PrintTypeOptions) =>
|
|
20
|
+
export declare const printScalarMetadata: (type: unknown, options: PrintTypeOptions) => string | MDXString;
|
|
21
21
|
/**
|
|
22
22
|
* Generates the GraphQL SDL representation of a scalar type.
|
|
23
23
|
* @param type - The GraphQL scalar type object
|
|
24
24
|
* @param options - Options for printing type information (unused)
|
|
25
25
|
* @returns SDL string representation of the scalar type
|
|
26
26
|
*/
|
|
27
|
-
export declare const printCodeScalar: (type: unknown, options?: PrintTypeOptions) => string;
|
|
27
|
+
export declare const printCodeScalar: (type: unknown, options?: PrintTypeOptions | undefined) => string;
|
|
28
|
+
//# sourceMappingURL=scalar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalar.d.ts","sourceRoot":"","sources":["../../src/graphql/scalar.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAO3E;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,kEAiB9B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,kEAK/B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,mEAK3B,CAAC"}
|
package/dist/graphql/union.d.ts
CHANGED
|
@@ -9,11 +9,12 @@ import type { PrintTypeOptions, MDXString } from "@graphql-markdown/types";
|
|
|
9
9
|
* @param options - Configuration options for printing
|
|
10
10
|
* @returns Formatted MDX string containing the union type's possible types
|
|
11
11
|
*/
|
|
12
|
-
export declare const printUnionMetadata: (type: unknown, options: PrintTypeOptions) =>
|
|
12
|
+
export declare const printUnionMetadata: (type: unknown, options: PrintTypeOptions) => string | MDXString;
|
|
13
13
|
/**
|
|
14
14
|
* Generates GraphQL SDL code representation of a Union type.
|
|
15
15
|
* @param type - The GraphQL type to process
|
|
16
16
|
* @param options - Configuration options for printing (unused)
|
|
17
17
|
* @returns SDL string representation of the union type
|
|
18
18
|
*/
|
|
19
|
-
export declare const printCodeUnion: (type: unknown, options?: PrintTypeOptions) => string;
|
|
19
|
+
export declare const printCodeUnion: (type: unknown, options?: PrintTypeOptions | undefined) => string;
|
|
20
|
+
//# sourceMappingURL=union.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"union.d.ts","sourceRoot":"","sources":["../../src/graphql/union.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,SAAS,EAEV,MAAM,yBAAyB,CAAC;AAMjC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,kEAY9B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,mEAiB1B,CAAC"}
|
package/dist/group.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Utility module for handling GraphQL schema entity grouping.
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { SchemaEntity, Maybe } from "@graphql-markdown/types";
|
|
6
6
|
/**
|
|
7
7
|
* Retrieves the group name for a given GraphQL type based on its category and group mapping.
|
|
8
8
|
*
|
|
@@ -11,4 +11,5 @@ import type { SchemaEntitiesGroupMap, SchemaEntity, Maybe } from "@graphql-markd
|
|
|
11
11
|
* @param typeCategory - The category of the schema entity
|
|
12
12
|
* @returns The slugified group name or empty string if no group is found
|
|
13
13
|
*/
|
|
14
|
-
export declare const getGroup: (type: unknown, groups: Maybe<
|
|
14
|
+
export declare const getGroup: (type: unknown, groups: Maybe<Partial<Record<SchemaEntity, Record<string, Maybe<string>>>>>, typeCategory: Maybe<SchemaEntity>) => string;
|
|
15
|
+
//# sourceMappingURL=group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../src/group.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAEV,YAAY,EAEZ,KAAK,EACN,MAAM,yBAAyB,CAAC;AAMjC;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,2IA+BpB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Printer = void 0;
|
|
4
|
-
|
|
4
|
+
const printer_1 = require("./printer");
|
|
5
5
|
Object.defineProperty(exports, "Printer", { enumerable: true, get: function () { return printer_1.Printer; } });
|
package/dist/link.d.ts
CHANGED
|
@@ -9,13 +9,10 @@ export declare const API_GROUPS: Required<ApiGroupOverrideType>;
|
|
|
9
9
|
* Checks if a type has printable directives based on the provided options.
|
|
10
10
|
*
|
|
11
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
|
|
12
|
+
* @param options - Configuration options for directive printing (`deprecated`, `onlyDocDirectives`, `skipDocDirectives`)
|
|
16
13
|
* @returns `true` if the type should be printed, `false` otherwise
|
|
17
14
|
*/
|
|
18
|
-
export declare const hasPrintableDirective: (type: unknown, options?: Pick<PrintTypeOptions, "deprecated" | "onlyDocDirectives" | "skipDocDirectives">) => boolean;
|
|
15
|
+
export declare const hasPrintableDirective: (type: unknown, options?: Pick<PrintTypeOptions, "deprecated" | "onlyDocDirectives" | "skipDocDirectives"> | undefined) => boolean;
|
|
19
16
|
/**
|
|
20
17
|
* Gets the locale category for a given GraphQL type.
|
|
21
18
|
*
|
|
@@ -52,7 +49,7 @@ export declare const hasOptionParentType: (options: PrintLinkOptions) => boolean
|
|
|
52
49
|
* @param groups - The group options
|
|
53
50
|
* @returns The folder name for the API group
|
|
54
51
|
*/
|
|
55
|
-
export declare const getLinkApiGroupFolder: (type: unknown, groups?: Maybe<
|
|
52
|
+
export declare const getLinkApiGroupFolder: (type: unknown, groups?: Maybe<boolean | ApiGroupOverrideType>) => string;
|
|
56
53
|
/**
|
|
57
54
|
* Gets the folder name for deprecated types based on the GraphQL type and deprecation option.
|
|
58
55
|
*
|
|
@@ -103,4 +100,5 @@ export declare const printLink: (type: unknown, options: PrintLinkOptions) => st
|
|
|
103
100
|
* @param options - Configuration options for link generation
|
|
104
101
|
* @returns The formatted parent link as a string or MDX string
|
|
105
102
|
*/
|
|
106
|
-
export declare const printParentLink: (type: unknown, options: PrintLinkOptions) =>
|
|
103
|
+
export declare const printParentLink: (type: unknown, options: PrintLinkOptions) => string | MDXString;
|
|
104
|
+
//# sourceMappingURL=link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,oBAAoB,EAGpB,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,gBAAgB,EAEhB,oBAAoB,EAGpB,QAAQ,EACR,UAAU,EACX,MAAM,yBAAyB,CAAC;AA2BjC,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,oBAAoB,CAG5C,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,oIA+BjC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,sCAoB7B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,uEAuBjC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,wCAEnC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,wCAO/B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,2EASjC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,gEAKnC,CAAC;AASF;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,oGAsElB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,4FAc3B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,iDAqB/B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,sDAuBrB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,kEAc3B,CAAC"}
|
package/dist/link.js
CHANGED
|
@@ -19,10 +19,7 @@ exports.API_GROUPS = {
|
|
|
19
19
|
* Checks if a type has printable directives based on the provided options.
|
|
20
20
|
*
|
|
21
21
|
* @param type - The GraphQL type to check
|
|
22
|
-
* @param options - Configuration options for directive printing
|
|
23
|
-
* @param options.deprecated - How to handle deprecated types
|
|
24
|
-
* @param options.onlyDocDirectives - Only print types with specific directives
|
|
25
|
-
* @param options.skipDocDirectives - Skip types with specific directives
|
|
22
|
+
* @param options - Configuration options for directive printing (`deprecated`, `onlyDocDirectives`, `skipDocDirectives`)
|
|
26
23
|
* @returns `true` if the type should be printed, `false` otherwise
|
|
27
24
|
*/
|
|
28
25
|
const hasPrintableDirective = (type, options) => {
|
|
@@ -118,7 +115,7 @@ const hasOptionParentType = (options) => {
|
|
|
118
115
|
return ("parentTypePrefix" in options &&
|
|
119
116
|
options.parentTypePrefix === true &&
|
|
120
117
|
"parentType" in options &&
|
|
121
|
-
|
|
118
|
+
options.parentType !== undefined);
|
|
122
119
|
};
|
|
123
120
|
exports.hasOptionParentType = hasOptionParentType;
|
|
124
121
|
/**
|
|
@@ -148,7 +145,7 @@ const getLinkDeprecatedFolder = (type, option) => {
|
|
|
148
145
|
};
|
|
149
146
|
exports.getLinkDeprecatedFolder = getLinkDeprecatedFolder;
|
|
150
147
|
const isHierarchy = (options, hierarchy) => {
|
|
151
|
-
return
|
|
148
|
+
return options?.hierarchy?.[hierarchy] !== undefined;
|
|
152
149
|
};
|
|
153
150
|
/**
|
|
154
151
|
* Converts a GraphQL type to a link object.
|
|
@@ -164,8 +161,7 @@ const toLink = (type, name, operation, options) => {
|
|
|
164
161
|
text: name,
|
|
165
162
|
url: "#",
|
|
166
163
|
};
|
|
167
|
-
if (typeof type !== "object" ||
|
|
168
|
-
(typeof options !== "undefined" && !(0, exports.hasPrintableDirective)(type, options))) {
|
|
164
|
+
if (typeof type !== "object" || !(0, exports.hasPrintableDirective)(type, options)) {
|
|
169
165
|
return fallback;
|
|
170
166
|
}
|
|
171
167
|
const graphQLNamedType = (0, graphql_1.getNamedType)(type);
|
|
@@ -192,7 +188,12 @@ const toLink = (type, name, operation, options) => {
|
|
|
192
188
|
: "";
|
|
193
189
|
}
|
|
194
190
|
const text = graphQLNamedType.name || graphQLNamedType.toString();
|
|
195
|
-
const
|
|
191
|
+
const formatFolder = (folder) => {
|
|
192
|
+
return folder && options.formatCategoryFolderName
|
|
193
|
+
? options.formatCategoryFolderName(folder)
|
|
194
|
+
: folder;
|
|
195
|
+
};
|
|
196
|
+
const url = utils_1.pathUrl.join(options.basePath, formatFolder(deprecatedFolder), formatFolder(groupFolder), formatFolder(apiGroupFolder), formatFolder(category), `${(0, utils_1.slugify)(text)}`);
|
|
196
197
|
const link = {
|
|
197
198
|
text,
|
|
198
199
|
url,
|
|
@@ -232,9 +233,7 @@ const printLinkAttributes = (type, text = "") => {
|
|
|
232
233
|
if (typeof type !== "object" || type === null) {
|
|
233
234
|
return text ?? "";
|
|
234
235
|
}
|
|
235
|
-
if (!(0, graphql_1.isLeafType)(type) &&
|
|
236
|
-
"ofType" in type &&
|
|
237
|
-
typeof type.ofType !== "undefined") {
|
|
236
|
+
if (!(0, graphql_1.isLeafType)(type) && "ofType" in type && type.ofType !== undefined) {
|
|
238
237
|
text = (0, exports.printLinkAttributes)(type.ofType, text);
|
|
239
238
|
}
|
|
240
239
|
if ((0, graphql_1.isListType)(type)) {
|
|
@@ -258,7 +257,7 @@ const printLink = (type, options) => {
|
|
|
258
257
|
return "";
|
|
259
258
|
}
|
|
260
259
|
const link = (0, exports.toLink)(type, (0, graphql_1.getTypeName)(type, (0, utils_1.toString)(type)), undefined, options);
|
|
261
|
-
if (
|
|
260
|
+
if (!(0, exports.hasOptionWithAttributes)(options)) {
|
|
262
261
|
const textWithAttribute = options.formatMDXNameEntity(link.text, options.parentType);
|
|
263
262
|
return `[${textWithAttribute}](${link.url})`;
|
|
264
263
|
}
|
package/dist/mdx/index.d.ts
CHANGED
|
@@ -14,5 +14,6 @@
|
|
|
14
14
|
import type { MDXSupportType } from "@graphql-markdown/types";
|
|
15
15
|
export declare const mdxDeclaration = "";
|
|
16
16
|
declare const defaultModule: MDXSupportType;
|
|
17
|
-
export declare const mdxModule: (mdxPackage?: Record<string, unknown>) => Promise<Readonly<MDXSupportType>>;
|
|
17
|
+
export declare const mdxModule: (mdxPackage?: Record<string, unknown> | undefined) => Promise<Readonly<MDXSupportType>>;
|
|
18
18
|
export default defaultModule;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mdx/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAOV,cAAc,EAGf,MAAM,yBAAyB,CAAC;AA0KjC,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC,QAAA,MAAM,aAAa,gBASA,CAAC;AAEpB,eAAO,MAAM,SAAS,yFAoBrB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/dist/mdx/index.js
CHANGED
|
@@ -131,8 +131,8 @@ const formatMDXNameEntity = (name, parentType) => {
|
|
|
131
131
|
* Currently, this function returns the link as is without modification.
|
|
132
132
|
* This may serve as a placeholder for future formatting logic.
|
|
133
133
|
*
|
|
134
|
-
* @param link - The TypeLink object to format
|
|
135
|
-
* @returns The formatted TypeLink object
|
|
134
|
+
* @param link - The `TypeLink` object to format
|
|
135
|
+
* @returns The formatted `TypeLink` object
|
|
136
136
|
*/
|
|
137
137
|
const formatMDXLink = (link) => {
|
|
138
138
|
return link;
|
package/dist/printer.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module printer
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
|
-
import type { CustomDirectiveMap, GraphQLDirective, GraphQLSchema, IPrinter, MDXString,
|
|
10
|
+
import type { CustomDirectiveMap, Formatter, GraphQLDirective, GraphQLSchema, IPrinter, MDXString, Maybe, MetaInfo, PrinterEventEmitter, PrintTypeOptions, PrinterConfigPrintTypeOptions, SchemaEntitiesGroupMap, TypeDeprecatedOption } from "@graphql-markdown/types";
|
|
11
11
|
/**
|
|
12
12
|
* The Printer class implements the core functionality for generating Markdown documentation
|
|
13
13
|
* from GraphQL schema types.
|
|
@@ -29,29 +29,30 @@ import type { CustomDirectiveMap, GraphQLDirective, GraphQLSchema, IPrinter, MDX
|
|
|
29
29
|
export declare class Printer implements IPrinter {
|
|
30
30
|
/**
|
|
31
31
|
* Global printer configuration options
|
|
32
|
-
* @static
|
|
33
32
|
*/
|
|
34
33
|
static options: Readonly<Maybe<PrintTypeOptions>>;
|
|
34
|
+
/**
|
|
35
|
+
* Optional event emitter for print events.
|
|
36
|
+
* When set, the printer will emit events before/after printCode and printType,
|
|
37
|
+
* allowing external code to intercept and modify the output.
|
|
38
|
+
*/
|
|
39
|
+
static eventEmitter: Maybe<PrinterEventEmitter>;
|
|
35
40
|
/**
|
|
36
41
|
* Prints type descriptions
|
|
37
|
-
* @static
|
|
38
42
|
*/
|
|
39
|
-
static readonly printDescription: (type: unknown, options: PrintTypeOptions, noText?: string) =>
|
|
43
|
+
static readonly printDescription: (type: unknown, options: PrintTypeOptions, noText?: string | undefined) => string | MDXString;
|
|
40
44
|
/**
|
|
41
45
|
* Prints custom directives
|
|
42
|
-
* @static
|
|
43
46
|
*/
|
|
44
47
|
static readonly printCustomDirectives: (type: unknown, options: PrintTypeOptions) => string;
|
|
45
48
|
/**
|
|
46
49
|
* Prints custom tags
|
|
47
|
-
* @static
|
|
48
50
|
*/
|
|
49
|
-
static readonly printCustomTags: (type: unknown, options: PrintTypeOptions) =>
|
|
51
|
+
static readonly printCustomTags: (type: unknown, options: PrintTypeOptions) => string | MDXString;
|
|
50
52
|
/**
|
|
51
|
-
*
|
|
52
|
-
* @static
|
|
53
|
+
* Prints mdx modules import declaration
|
|
53
54
|
*/
|
|
54
|
-
static
|
|
55
|
+
static mdxDeclaration: Readonly<Maybe<string>>;
|
|
55
56
|
/**
|
|
56
57
|
* Initializes the printer with the given schema and configuration.
|
|
57
58
|
*
|
|
@@ -59,18 +60,20 @@ export declare class Printer implements IPrinter {
|
|
|
59
60
|
* @param baseURL - Base URL path for documentation, e.g. '/docs'
|
|
60
61
|
* @param linkRoot - Root path for generating links between types
|
|
61
62
|
* @param options - Configuration options for the printer
|
|
62
|
-
* @param
|
|
63
|
+
* @param formatter - Optional formatter functions for customizing output format
|
|
64
|
+
* @param mdxDeclaration - Optional MDX import declaration
|
|
65
|
+
* @param eventEmitter - Optional event emitter for print events interception
|
|
63
66
|
*/
|
|
64
|
-
static init(schema: Maybe<GraphQLSchema>, baseURL?: Maybe<string>, linkRoot?: Maybe<string>, { customDirectives, groups, meta, metatags, onlyDocDirectives, printTypeOptions, skipDocDirectives
|
|
67
|
+
static init(schema: Maybe<GraphQLSchema>, baseURL?: Maybe<string>, linkRoot?: Maybe<string>, { customDirectives, groups, meta, metatags, onlyDocDirectives, printTypeOptions, skipDocDirectives }?: {
|
|
65
68
|
customDirectives?: CustomDirectiveMap;
|
|
66
69
|
deprecated?: TypeDeprecatedOption;
|
|
67
70
|
groups?: SchemaEntitiesGroupMap;
|
|
68
|
-
meta?: Maybe<
|
|
71
|
+
meta?: Maybe<MetaInfo>;
|
|
69
72
|
metatags?: Record<string, string>[];
|
|
70
73
|
onlyDocDirectives?: GraphQLDirective[];
|
|
71
74
|
printTypeOptions?: PrinterConfigPrintTypeOptions;
|
|
72
75
|
skipDocDirectives?: GraphQLDirective[];
|
|
73
|
-
},
|
|
76
|
+
}, formatter?: Partial<Formatter>, mdxDeclaration?: Maybe<string>, eventEmitter?: Maybe<PrinterEventEmitter>): Promise<void>;
|
|
74
77
|
/**
|
|
75
78
|
* Prints the header section of a type documentation
|
|
76
79
|
*
|
|
@@ -88,6 +91,25 @@ export declare class Printer implements IPrinter {
|
|
|
88
91
|
* @returns Formatted code block string with type definition
|
|
89
92
|
*/
|
|
90
93
|
static readonly printCode: (type: unknown, options: PrintTypeOptions) => string;
|
|
94
|
+
/**
|
|
95
|
+
* Prints the GraphQL type definition as code block with event emission support.
|
|
96
|
+
*
|
|
97
|
+
* @param type - GraphQL type to print
|
|
98
|
+
* @param typeName - Name of the type being printed
|
|
99
|
+
* @param options - Printer configuration options
|
|
100
|
+
* @returns Promise resolving to formatted code block string with type definition
|
|
101
|
+
*
|
|
102
|
+
* @remarks
|
|
103
|
+
* This async version emits events before and after code generation:
|
|
104
|
+
* - `print:beforePrintCode` - Emitted before generating code (can modify inputs or prevent default)
|
|
105
|
+
* - `print:afterPrintCode` - Emitted after generating code (can modify output)
|
|
106
|
+
*
|
|
107
|
+
* Event handlers can:
|
|
108
|
+
* - Modify `event.data.options` in BEFORE to affect code generation
|
|
109
|
+
* - Call `event.preventDefault()` in BEFORE to skip default generation and provide custom output
|
|
110
|
+
* - Modify `event.output` in AFTER to change the final result
|
|
111
|
+
*/
|
|
112
|
+
static readonly printCodeAsync: (type: unknown, typeName: string, options: PrintTypeOptions) => Promise<string>;
|
|
91
113
|
/**
|
|
92
114
|
* Prints example usage of the type if available
|
|
93
115
|
*
|
|
@@ -102,9 +124,9 @@ export declare class Printer implements IPrinter {
|
|
|
102
124
|
* @param type - GraphQL type to print metadata for
|
|
103
125
|
* @param options - Printer configuration options
|
|
104
126
|
* @returns Formatted metadata string as MDX or plain string
|
|
105
|
-
* @throws
|
|
127
|
+
* @throws When type is not supported
|
|
106
128
|
*/
|
|
107
|
-
static readonly printTypeMetadata: (type: unknown, options: PrintTypeOptions) =>
|
|
129
|
+
static readonly printTypeMetadata: (type: unknown, options: PrintTypeOptions) => string | MDXString;
|
|
108
130
|
/**
|
|
109
131
|
* Prints related type information
|
|
110
132
|
*
|
|
@@ -112,7 +134,7 @@ export declare class Printer implements IPrinter {
|
|
|
112
134
|
* @param options - Printer configuration options
|
|
113
135
|
* @returns Formatted relations section as MDX or plain string
|
|
114
136
|
*/
|
|
115
|
-
static readonly printRelations: (type: unknown, options: PrintTypeOptions) =>
|
|
137
|
+
static readonly printRelations: (type: unknown, options: PrintTypeOptions) => string | MDXString;
|
|
116
138
|
/**
|
|
117
139
|
* Prints HTML meta tags for the documentation
|
|
118
140
|
*
|
|
@@ -120,7 +142,7 @@ export declare class Printer implements IPrinter {
|
|
|
120
142
|
* @param options - Printer configuration options containing metatags
|
|
121
143
|
* @returns Formatted HTML meta tags string
|
|
122
144
|
*/
|
|
123
|
-
static readonly printMetaTags: (_type: unknown, { metatags }: PrintTypeOptions) =>
|
|
145
|
+
static readonly printMetaTags: (_type: unknown, { metatags }: PrintTypeOptions) => string | MDXString;
|
|
124
146
|
/**
|
|
125
147
|
* Main method to print complete documentation for a GraphQL type
|
|
126
148
|
*
|
|
@@ -131,7 +153,7 @@ export declare class Printer implements IPrinter {
|
|
|
131
153
|
*
|
|
132
154
|
* @example
|
|
133
155
|
* ```typescript
|
|
134
|
-
* const doc = Printer.printType('User', UserType, {
|
|
156
|
+
* const doc = await Printer.printType('User', UserType, {
|
|
135
157
|
* frontMatter: true,
|
|
136
158
|
* codeSection: true
|
|
137
159
|
* });
|
|
@@ -147,6 +169,11 @@ export declare class Printer implements IPrinter {
|
|
|
147
169
|
* - Type metadata
|
|
148
170
|
* - Example usage
|
|
149
171
|
* - Related types
|
|
172
|
+
*
|
|
173
|
+
* When an event emitter is configured, emits events:
|
|
174
|
+
* - `print:beforePrintType` - Before generating documentation
|
|
175
|
+
* - `print:afterPrintType` - After generating documentation (output can be modified)
|
|
150
176
|
*/
|
|
151
|
-
static readonly printType: (name: Maybe<string>, type: unknown, options?: Maybe<Partial<PrintTypeOptions>>) => Maybe<MDXString
|
|
177
|
+
static readonly printType: (name: Maybe<string>, type: unknown, options?: Maybe<Partial<PrintTypeOptions>>) => Promise<Maybe<MDXString>>;
|
|
152
178
|
}
|
|
179
|
+
//# sourceMappingURL=printer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printer.d.ts","sourceRoot":"","sources":["../src/printer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,SAAS,EACT,gBAAgB,EAEhB,aAAa,EACb,QAAQ,EACR,SAAS,EACT,KAAK,EACL,QAAQ,EACR,mBAAmB,EACnB,gBAAgB,EAChB,6BAA6B,EAC7B,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AA0EjC;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,OAAQ,YAAW,QAAQ;IACtC;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAElD;;;;OAIG;IACH,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAEhD;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,gBAAgB,gGAAoB;IAEpD;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,qBAAqB,uDAAyB;IAE9D;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,eAAe,mEAAmB;IAElD;;OAEG;IACH,MAAM,CAAC,cAAc,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAE/C;;;;;;;;;;OAUG;IACH,OAAa,IAAI,CACf,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,EAC5B,OAAO,GAAE,KAAK,CAAC,MAAM,CAAY,EACjC,QAAQ,GAAE,KAAK,CAAC,MAAM,CAAO,EAC7B,EACE,gBAAgB,EAChB,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EAClB,GAAE;QACD,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;QACtC,UAAU,CAAC,EAAE,oBAAoB,CAAC;QAClC,MAAM,CAAC,EAAE,sBAAsB,CAAC;QAChC,IAAI,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;QACpC,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;QACvC,gBAAgB,CAAC,EAAE,6BAA6B,CAAC;QACjD,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;KACjB,EACxB,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,EAC9B,cAAc,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EAC9B,YAAY,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,GACxC,OAAO,CAAC,IAAI,CAAC,CAyCf;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,CAAC,WAAW,mEAYzB;IAEF;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,SAAS,uDAwCvB;IAEF;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,kFA8C5B;IAEF;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,YAAY,uDAmB1B;IAEF;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,CAAC,iBAAiB,mEA2B/B;IAEF;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,mEAQ5B;IAEF;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,aAAa,yEAiB3B;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,MAAM,CAAC,QAAQ,CAAC,SAAS,gHA4GvB;CACH"}
|