@graphql-markdown/printer-legacy 1.14.0 → 1.15.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/const/options.d.ts +15 -2
- package/dist/const/options.d.ts.map +1 -1
- package/dist/const/options.js +19 -6
- package/dist/directive.d.ts +3 -3
- package/dist/directive.d.ts.map +1 -1
- package/dist/directive.js +8 -4
- package/dist/events.d.ts +77 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +85 -0
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +12 -7
- package/dist/format-helpers.d.ts +9 -0
- package/dist/format-helpers.d.ts.map +1 -1
- package/dist/format-helpers.js +10 -1
- package/dist/formatter.js +1 -1
- package/dist/graphql/directive.d.ts +3 -3
- package/dist/graphql/directive.d.ts.map +1 -1
- package/dist/graphql/directive.js +3 -3
- package/dist/graphql/enum.d.ts +3 -3
- package/dist/graphql/enum.d.ts.map +1 -1
- package/dist/graphql/enum.js +2 -2
- package/dist/graphql/object.d.ts +3 -3
- package/dist/graphql/object.d.ts.map +1 -1
- package/dist/graphql/object.js +4 -4
- package/dist/graphql/operation.d.ts +6 -7
- package/dist/graphql/operation.d.ts.map +1 -1
- package/dist/graphql/operation.js +41 -8
- package/dist/graphql/scalar.d.ts +5 -5
- package/dist/graphql/scalar.d.ts.map +1 -1
- package/dist/graphql/scalar.js +7 -7
- package/dist/graphql/union.d.ts +3 -3
- package/dist/graphql/union.d.ts.map +1 -1
- package/dist/graphql/union.js +2 -2
- package/dist/group.d.ts.map +1 -1
- package/dist/group.js +7 -6
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/link.d.ts +1 -1
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +7 -6
- package/dist/mdx/index.js +2 -2
- package/dist/printer.d.ts +65 -21
- package/dist/printer.d.ts.map +1 -1
- package/dist/printer.js +268 -117
- package/dist/section.d.ts +3 -3
- package/dist/section.d.ts.map +1 -1
- package/dist/section.js +26 -11
- package/package.json +17 -6
package/dist/const/options.d.ts
CHANGED
|
@@ -8,9 +8,22 @@ export declare enum SectionLevels {
|
|
|
8
8
|
NONE = "",
|
|
9
9
|
LEVEL = "#"
|
|
10
10
|
}
|
|
11
|
-
export declare const
|
|
12
|
-
|
|
11
|
+
export declare const PRINT_TYPE_DEFAULT_DEPRECATED_OPTIONS: {
|
|
12
|
+
codeSection: true;
|
|
13
|
+
exampleSection: false;
|
|
14
|
+
relatedTypeSection: true;
|
|
15
|
+
};
|
|
16
|
+
export declare const PRINT_TYPE_DEFAULT_OPTIONS: Required<Omit<PrinterConfigPrintTypeOptions, "exampleSection">> & {
|
|
17
|
+
exampleSection: PrintTypeOptions["exampleSection"];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Clean runtime options passed through the printer.
|
|
21
|
+
*
|
|
22
|
+
* Deprecated section toggles are excluded and handled via backward-compat paths.
|
|
23
|
+
*/
|
|
24
|
+
export declare const DEFAULT_OPTIONS: Required<Omit<PrintTypeOptions, "afterDiffCheckHook" | "afterGenerateIndexMetafileHook" | "afterRenderHomepageHook" | "afterRenderRootTypesHook" | "afterRenderTypeEntitiesHook" | "afterSchemaLoadHook" | "beforeDiffCheckHook" | "beforeGenerateIndexMetafileHook" | "beforeRenderHomepageHook" | "beforeRenderRootTypesHook" | "beforeRenderTypeEntitiesHook" | "beforeSchemaLoadHook" | "collapsible" | "exampleSection" | "formatCategoryFolderName" | "groups" | "level" | "meta" | "onlyDocDirectives" | "parentType" | "schema" | "skipDocDirectives">> & {
|
|
13
25
|
collapsible: Maybe<CollapsibleOption>;
|
|
26
|
+
exampleSection: PrintTypeOptions["exampleSection"];
|
|
14
27
|
groups: Maybe<SchemaEntitiesGroupMap>;
|
|
15
28
|
level: Maybe<SectionLevelValue>;
|
|
16
29
|
onlyDocDirectives: GraphQLDirective[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/const/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/const/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAGjB,gBAAgB,EAChB,aAAa,EACb,KAAK,EACL,gBAAgB,EAChB,6BAA6B,EAC7B,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AAIjC,oBAAY,aAAa;IACvB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED,oBAAY,aAAa;IACvB,IAAI,KAAK;IACT,KAAK,MAAM;CACZ;AAED,eAAO,MAAM,qCAAqC;;;;CAOjD,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAC/C,IAAI,CAAC,6BAA6B,EAAE,gBAAgB,CAAC,CACtD,GAAG;IACF,cAAc,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CAQpD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CACpC,IAAI,CACF,gBAAgB,EACd,oBAAoB,GACpB,gCAAgC,GAChC,yBAAyB,GACzB,0BAA0B,GAC1B,6BAA6B,GAC7B,qBAAqB,GACrB,qBAAqB,GACrB,iCAAiC,GACjC,0BAA0B,GAC1B,2BAA2B,GAC3B,8BAA8B,GAC9B,sBAAsB,GACtB,aAAa,GACb,gBAAgB,GAChB,0BAA0B,GAC1B,QAAQ,GACR,OAAO,GACP,MAAM,GACN,mBAAmB,GACnB,YAAY,GACZ,QAAQ,GACR,mBAAmB,CACtB,CACF,GAAG;IACF,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACtC,cAAc,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IACnD,MAAM,EAAE,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACtC,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAChC,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAC7B,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;CAsBvC,CAAC"}
|
package/dist/const/options.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DEFAULT_OPTIONS = exports.PRINT_TYPE_DEFAULT_OPTIONS = exports.SectionLevels = exports.TypeHierarchy = void 0;
|
|
6
|
+
exports.DEFAULT_OPTIONS = exports.PRINT_TYPE_DEFAULT_OPTIONS = exports.PRINT_TYPE_DEFAULT_DEPRECATED_OPTIONS = exports.SectionLevels = exports.TypeHierarchy = void 0;
|
|
7
7
|
const mdx_1 = __importDefault(require("../mdx"));
|
|
8
8
|
var TypeHierarchy;
|
|
9
9
|
(function (TypeHierarchy) {
|
|
@@ -16,30 +16,43 @@ var SectionLevels;
|
|
|
16
16
|
SectionLevels["NONE"] = "";
|
|
17
17
|
SectionLevels["LEVEL"] = "#";
|
|
18
18
|
})(SectionLevels || (exports.SectionLevels = SectionLevels = {}));
|
|
19
|
-
exports.
|
|
19
|
+
exports.PRINT_TYPE_DEFAULT_DEPRECATED_OPTIONS = {
|
|
20
20
|
codeSection: true,
|
|
21
|
-
deprecated: "default",
|
|
22
21
|
exampleSection: false,
|
|
22
|
+
relatedTypeSection: true,
|
|
23
|
+
};
|
|
24
|
+
exports.PRINT_TYPE_DEFAULT_OPTIONS = {
|
|
25
|
+
deprecated: "default",
|
|
26
|
+
exampleSection: undefined,
|
|
23
27
|
metatags: [],
|
|
24
28
|
parentTypePrefix: true,
|
|
25
|
-
relatedTypeSection: true,
|
|
26
29
|
typeBadges: true,
|
|
27
30
|
hierarchy: { [TypeHierarchy.API]: {} },
|
|
28
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* Clean runtime options passed through the printer.
|
|
34
|
+
*
|
|
35
|
+
* Deprecated section toggles are excluded and handled via backward-compat paths.
|
|
36
|
+
*/
|
|
29
37
|
exports.DEFAULT_OPTIONS = {
|
|
30
|
-
|
|
38
|
+
deprecated: exports.PRINT_TYPE_DEFAULT_OPTIONS.deprecated,
|
|
31
39
|
basePath: "/",
|
|
32
40
|
collapsible: undefined,
|
|
33
41
|
customDirectives: {},
|
|
42
|
+
exampleSection: undefined,
|
|
34
43
|
groups: undefined,
|
|
35
44
|
frontMatter: {},
|
|
36
45
|
level: undefined,
|
|
37
|
-
metatags:
|
|
46
|
+
metatags: exports.PRINT_TYPE_DEFAULT_OPTIONS.metatags,
|
|
38
47
|
onlyDocDirectives: [],
|
|
48
|
+
operationNamespaceParts: null,
|
|
39
49
|
parentType: undefined,
|
|
50
|
+
parentTypePrefix: exports.PRINT_TYPE_DEFAULT_OPTIONS.parentTypePrefix,
|
|
40
51
|
schema: undefined,
|
|
41
52
|
skipDocDirectives: [],
|
|
53
|
+
typeBadges: exports.PRINT_TYPE_DEFAULT_OPTIONS.typeBadges,
|
|
42
54
|
withAttributes: false,
|
|
43
55
|
sectionHeaderId: true,
|
|
56
|
+
hierarchy: exports.PRINT_TYPE_DEFAULT_OPTIONS.hierarchy,
|
|
44
57
|
...mdx_1.default,
|
|
45
58
|
};
|
package/dist/directive.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Provides utilities for handling and printing GraphQL directives in Markdown format
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
-
import type { Badge, PrintTypeOptions, MDXString, CustomDirectiveMapItem, CustomDirectiveResolver, Maybe } from "@graphql-markdown/types";
|
|
5
|
+
import type { Badge, PrintTypeOptions, MDXString, CustomDirectiveMapItem, CustomDirectiveResolver, Maybe, PageSection } from "@graphql-markdown/types";
|
|
6
6
|
/**
|
|
7
7
|
* Resolves a custom directive using the provided resolver function
|
|
8
8
|
* @param resolver - The resolver function name to execute
|
|
@@ -24,9 +24,9 @@ export declare const printCustomDirective: (type: unknown, constDirectiveOption:
|
|
|
24
24
|
* Prints all custom directives for a type as a Markdown section
|
|
25
25
|
* @param type - The GraphQL type to print directives for
|
|
26
26
|
* @param options - General printing options
|
|
27
|
-
* @returns
|
|
27
|
+
* @returns A "Directives" PageSection, or undefined when no directives are printable
|
|
28
28
|
*/
|
|
29
|
-
export declare const printCustomDirectives: (type: unknown, options: PrintTypeOptions) =>
|
|
29
|
+
export declare const printCustomDirectives: (type: unknown, options: PrintTypeOptions) => Maybe<PageSection>;
|
|
30
30
|
/**
|
|
31
31
|
* Extracts custom tags from directives for a given type
|
|
32
32
|
* @param type - The GraphQL type to get tags for
|
package/dist/directive.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directive.d.ts","sourceRoot":"","sources":["../src/directive.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,KAAK,EACL,gBAAgB,EAChB,SAAS,EACT,sBAAsB,EACtB,uBAAuB,EACvB,KAAK,
|
|
1
|
+
{"version":3,"file":"directive.d.ts","sourceRoot":"","sources":["../src/directive.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,KAAK,EACL,gBAAgB,EAChB,SAAS,EACT,sBAAsB,EACtB,uBAAuB,EACvB,KAAK,EACL,WAAW,EACZ,MAAM,yBAAyB,CAAC;AASjC;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,6IAiBtC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,2GAoBhC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,kEAgCjC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,uDAwBzB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,kEAc3B,CAAC"}
|
package/dist/directive.js
CHANGED
|
@@ -49,12 +49,12 @@ exports.printCustomDirective = printCustomDirective;
|
|
|
49
49
|
* Prints all custom directives for a type as a Markdown section
|
|
50
50
|
* @param type - The GraphQL type to print directives for
|
|
51
51
|
* @param options - General printing options
|
|
52
|
-
* @returns
|
|
52
|
+
* @returns A "Directives" PageSection, or undefined when no directives are printable
|
|
53
53
|
*/
|
|
54
54
|
const printCustomDirectives = (type, options) => {
|
|
55
55
|
const constDirectiveMap = (0, graphql_1.getConstDirectiveMap)(type, options.customDirectives);
|
|
56
56
|
if (!constDirectiveMap || Object.keys(constDirectiveMap).length === 0) {
|
|
57
|
-
return
|
|
57
|
+
return undefined;
|
|
58
58
|
}
|
|
59
59
|
const directives = Object.values(constDirectiveMap)
|
|
60
60
|
.map((constDirectiveOption) => {
|
|
@@ -64,10 +64,14 @@ const printCustomDirectives = (type, options) => {
|
|
|
64
64
|
return value !== undefined;
|
|
65
65
|
});
|
|
66
66
|
if (directives.length === 0) {
|
|
67
|
-
return
|
|
67
|
+
return undefined;
|
|
68
68
|
}
|
|
69
69
|
const content = directives.join(strings_1.MARKDOWN_EOP);
|
|
70
|
-
return
|
|
70
|
+
return {
|
|
71
|
+
title: "Directives",
|
|
72
|
+
content: `${content}${strings_1.MARKDOWN_EOP}`,
|
|
73
|
+
level: 3,
|
|
74
|
+
};
|
|
71
75
|
};
|
|
72
76
|
exports.printCustomDirectives = printCustomDirectives;
|
|
73
77
|
/**
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Print type event classes.
|
|
3
|
+
*
|
|
4
|
+
* Event classes for print operations that allow handlers to modify the generated output.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
import type { IPrintCodeEvent, IPrintTypeEvent, MDXString, Maybe, ComposePageTypeEventData, PageSections, PrintCodeEventData, PrintTypeEventData } from "@graphql-markdown/types";
|
|
9
|
+
export type { ComposePageTypeEventData, PageSection, PageSections, PrintCodeEventData, PrintTypeEventData, } from "@graphql-markdown/types";
|
|
10
|
+
import type { CancellableEventOptions } from "@graphql-markdown/utils";
|
|
11
|
+
import { DataOutputEvent } from "@graphql-markdown/utils";
|
|
12
|
+
/**
|
|
13
|
+
* Event emitted around code block generation for a GraphQL type.
|
|
14
|
+
*
|
|
15
|
+
* The `output` property is mutable, allowing event handlers to modify
|
|
16
|
+
* the generated code before it's included in the documentation.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* events.on(PrintTypeEvents.AFTER_PRINT_CODE, (event: PrintCodeEvent) => {
|
|
21
|
+
* // Add a comment to all generated code
|
|
22
|
+
* event.output = `# Auto-generated\n${event.output}`;
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @category Events
|
|
27
|
+
*/
|
|
28
|
+
export declare class PrintCodeEvent extends DataOutputEvent<PrintCodeEventData, string> implements IPrintCodeEvent {
|
|
29
|
+
constructor(data: PrintCodeEventData, initialOutput: string, options?: CancellableEventOptions);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Event emitted around full documentation generation for a GraphQL type.
|
|
33
|
+
*
|
|
34
|
+
* The `output` property is mutable, allowing event handlers to modify
|
|
35
|
+
* the complete generated documentation.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* events.on(PrintTypeEvents.AFTER_PRINT_TYPE, (event: PrintTypeEvent) => {
|
|
40
|
+
* // Add a footer to all type documentation
|
|
41
|
+
* event.output = `${event.output}\n\n---\nGenerated by GraphQL-Markdown`;
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @category Events
|
|
46
|
+
*/
|
|
47
|
+
export declare class PrintTypeEvent extends DataOutputEvent<PrintTypeEventData, Maybe<MDXString>> implements IPrintTypeEvent {
|
|
48
|
+
constructor(data: PrintTypeEventData, initialOutput: Maybe<MDXString>, options?: CancellableEventOptions);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Event emitted before composing page sections for a GraphQL type.
|
|
52
|
+
*
|
|
53
|
+
* This event fires after section content is generated and before sections are joined into final output.
|
|
54
|
+
* The `output` property contains an array of content section keys that will be included in the final page,
|
|
55
|
+
* in addition to fixed header sections (`header`, `metatags`, `mdxDeclaration`) which are managed separately
|
|
56
|
+
* by the printer and always prepended. Handlers can reorder, filter, or append to this array to control the
|
|
57
|
+
* structure of the content portion of the page.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* events.on(PrintTypeEvents.BEFORE_COMPOSE_PAGE_TYPE, (event: BeforeComposePageTypeEvent) => {
|
|
62
|
+
* // Move relations section before metadata
|
|
63
|
+
* const idx = event.output.indexOf('relations');
|
|
64
|
+
* if (idx > -1) {
|
|
65
|
+
* event.output.splice(idx, 1);
|
|
66
|
+
* const metaidx = event.output.indexOf('metadata');
|
|
67
|
+
* event.output.splice(metaidx, 0, 'relations');
|
|
68
|
+
* }
|
|
69
|
+
* });
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @category Events
|
|
73
|
+
*/
|
|
74
|
+
export declare class BeforeComposePageTypeEvent extends DataOutputEvent<ComposePageTypeEventData, (keyof PageSections)[]> {
|
|
75
|
+
constructor(data: ComposePageTypeEventData, initialOutput: (keyof PageSections)[], options?: CancellableEventOptions);
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,SAAS,EACT,KAAK,EACL,wBAAwB,EACxB,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EACV,wBAAwB,EACxB,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,cACX,SAAQ,eAAe,CAAC,kBAAkB,EAAE,MAAM,CAClD,YAAW,eAAe;IAE1B,YACE,IAAI,EAAE,kBAAkB,EACxB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,uBAAuB,EAGlC;CACF;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,cACX,SAAQ,eAAe,CAAC,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,CAC5D,YAAW,eAAe;IAE1B,YACE,IAAI,EAAE,kBAAkB,EACxB,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,EAC/B,OAAO,CAAC,EAAE,uBAAuB,EAGlC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,0BAA2B,SAAQ,eAAe,CAC7D,wBAAwB,EACxB,CAAC,MAAM,YAAY,CAAC,EAAE,CACvB;IACC,YACE,IAAI,EAAE,wBAAwB,EAC9B,aAAa,EAAE,CAAC,MAAM,YAAY,CAAC,EAAE,EACrC,OAAO,CAAC,EAAE,uBAAuB,EAGlC;CACF"}
|
package/dist/events.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Print type event classes.
|
|
4
|
+
*
|
|
5
|
+
* Event classes for print operations that allow handlers to modify the generated output.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.BeforeComposePageTypeEvent = exports.PrintTypeEvent = exports.PrintCodeEvent = void 0;
|
|
11
|
+
const utils_1 = require("@graphql-markdown/utils");
|
|
12
|
+
/**
|
|
13
|
+
* Event emitted around code block generation for a GraphQL type.
|
|
14
|
+
*
|
|
15
|
+
* The `output` property is mutable, allowing event handlers to modify
|
|
16
|
+
* the generated code before it's included in the documentation.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* events.on(PrintTypeEvents.AFTER_PRINT_CODE, (event: PrintCodeEvent) => {
|
|
21
|
+
* // Add a comment to all generated code
|
|
22
|
+
* event.output = `# Auto-generated\n${event.output}`;
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @category Events
|
|
27
|
+
*/
|
|
28
|
+
class PrintCodeEvent extends utils_1.DataOutputEvent {
|
|
29
|
+
constructor(data, initialOutput, options) {
|
|
30
|
+
super(data, initialOutput, options);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.PrintCodeEvent = PrintCodeEvent;
|
|
34
|
+
/**
|
|
35
|
+
* Event emitted around full documentation generation for a GraphQL type.
|
|
36
|
+
*
|
|
37
|
+
* The `output` property is mutable, allowing event handlers to modify
|
|
38
|
+
* the complete generated documentation.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* events.on(PrintTypeEvents.AFTER_PRINT_TYPE, (event: PrintTypeEvent) => {
|
|
43
|
+
* // Add a footer to all type documentation
|
|
44
|
+
* event.output = `${event.output}\n\n---\nGenerated by GraphQL-Markdown`;
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @category Events
|
|
49
|
+
*/
|
|
50
|
+
class PrintTypeEvent extends utils_1.DataOutputEvent {
|
|
51
|
+
constructor(data, initialOutput, options) {
|
|
52
|
+
super(data, initialOutput, options);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.PrintTypeEvent = PrintTypeEvent;
|
|
56
|
+
/**
|
|
57
|
+
* Event emitted before composing page sections for a GraphQL type.
|
|
58
|
+
*
|
|
59
|
+
* This event fires after section content is generated and before sections are joined into final output.
|
|
60
|
+
* The `output` property contains an array of content section keys that will be included in the final page,
|
|
61
|
+
* in addition to fixed header sections (`header`, `metatags`, `mdxDeclaration`) which are managed separately
|
|
62
|
+
* by the printer and always prepended. Handlers can reorder, filter, or append to this array to control the
|
|
63
|
+
* structure of the content portion of the page.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* events.on(PrintTypeEvents.BEFORE_COMPOSE_PAGE_TYPE, (event: BeforeComposePageTypeEvent) => {
|
|
68
|
+
* // Move relations section before metadata
|
|
69
|
+
* const idx = event.output.indexOf('relations');
|
|
70
|
+
* if (idx > -1) {
|
|
71
|
+
* event.output.splice(idx, 1);
|
|
72
|
+
* const metaidx = event.output.indexOf('metadata');
|
|
73
|
+
* event.output.splice(metaidx, 0, 'relations');
|
|
74
|
+
* }
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @category Events
|
|
79
|
+
*/
|
|
80
|
+
class BeforeComposePageTypeEvent extends utils_1.DataOutputEvent {
|
|
81
|
+
constructor(data, initialOutput, options) {
|
|
82
|
+
super(data, initialOutput, options);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.BeforeComposePageTypeEvent = BeforeComposePageTypeEvent;
|
package/dist/example.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAIV,KAAK,EACL,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAwBjC;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,gFAgCrC,CAAC;
|
|
1
|
+
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAIV,KAAK,EACL,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAwBjC;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,gFAgCrC,CAAC;AAiKF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,6DAmBxB,CAAC"}
|
package/dist/example.js
CHANGED
|
@@ -68,11 +68,15 @@ const parseTypeFields = (type, options, mappedTypes = []) => {
|
|
|
68
68
|
const fieldType = (0, graphql_1.hasDirective)(field, [directiveExample.directive])
|
|
69
69
|
? field
|
|
70
70
|
: field.type;
|
|
71
|
+
const graphQLFieldType = fieldType;
|
|
72
|
+
// GraphQL overload resolution can include a void branch in this monorepo; runtime value is used only for list checks.
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
74
|
+
const nullableFieldType = (0, graphql_1.getNullableType)(graphQLFieldType);
|
|
71
75
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
72
|
-
const value = parseExampleDirective(
|
|
76
|
+
const value = parseExampleDirective(graphQLFieldType, options, mappedTypes);
|
|
73
77
|
let structuredValue = value;
|
|
74
|
-
if ((0, graphql_1.isListType)(
|
|
75
|
-
if (!value && (0, graphql_1.isNonNullType)(
|
|
78
|
+
if ((0, graphql_1.isListType)(nullableFieldType)) {
|
|
79
|
+
if (!value && (0, graphql_1.isNonNullType)(graphQLFieldType)) {
|
|
76
80
|
structuredValue = [];
|
|
77
81
|
}
|
|
78
82
|
else {
|
|
@@ -136,9 +140,9 @@ const parseExampleDirective = (type, options, mappedTypes = []) => {
|
|
|
136
140
|
return undefined;
|
|
137
141
|
}
|
|
138
142
|
// get type name
|
|
139
|
-
const typename = (0,
|
|
140
|
-
? (0, utils_1.toString)(namedType)
|
|
141
|
-
: (0, utils_1.toString)(namedType
|
|
143
|
+
const typename = (0, utils_1.hasStringProperty)(namedType, "name")
|
|
144
|
+
? (0, utils_1.toString)(namedType.name)
|
|
145
|
+
: (0, utils_1.toString)(namedType);
|
|
142
146
|
// recursion check
|
|
143
147
|
if (mappedTypes.includes(typename)) {
|
|
144
148
|
return undefined;
|
|
@@ -146,7 +150,8 @@ const parseExampleDirective = (type, options, mappedTypes = []) => {
|
|
|
146
150
|
mappedTypes.push(typename);
|
|
147
151
|
try {
|
|
148
152
|
const arg = (0, graphql_1.getTypeDirectiveArgValue)(directiveExample.directive, namedType, directiveExample.field);
|
|
149
|
-
|
|
153
|
+
const parsedValue = parser(arg, namedType);
|
|
154
|
+
return parsedValue;
|
|
150
155
|
}
|
|
151
156
|
catch (err) {
|
|
152
157
|
if (err instanceof graphql_1.IntrospectionError) {
|
package/dist/format-helpers.d.ts
CHANGED
|
@@ -21,6 +21,15 @@ export declare const formatMDXAdmonition: ({ text, title, type, icon }: Admoniti
|
|
|
21
21
|
export declare const formatMDXBullet: (text?: string) => MDXString;
|
|
22
22
|
/**
|
|
23
23
|
* Default details formatter.
|
|
24
|
+
*
|
|
25
|
+
* The returned string **must** contain a `\r` (carriage return) character as a
|
|
26
|
+
* delimiter between the opening part (ending after `</summary>`) and the
|
|
27
|
+
* closing part (starting before `</details>`). `printSection` calls
|
|
28
|
+
* `result.split('\r')` to obtain `[openSection, closeSection]`; without this
|
|
29
|
+
* delimiter the closing tag is lost and items are rendered outside the
|
|
30
|
+
* collapsible element.
|
|
31
|
+
*
|
|
32
|
+
* Custom implementations of `formatMDXDetails` must follow the same contract.
|
|
24
33
|
*/
|
|
25
34
|
export declare const formatMDXDetails: ({ dataOpen, }: CollapsibleOption) => MDXString;
|
|
26
35
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-helpers.d.ts","sourceRoot":"","sources":["../src/format-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EACL,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACT,MAAM,yBAAyB,CAAC;AASjC;;GAEG;AACH,eAAO,MAAM,cAAc,6BAE1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,oFAK/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,8BAE3B,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"format-helpers.d.ts","sourceRoot":"","sources":["../src/format-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EACL,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACT,MAAM,yBAAyB,CAAC;AASjC;;GAEG;AACH,eAAO,MAAM,cAAc,6BAE1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,oFAK/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,8BAE3B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,iDAI5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,8EAShC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,8BAEzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,yDAQ/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,4BAEpC,CAAC"}
|
package/dist/format-helpers.js
CHANGED
|
@@ -34,9 +34,18 @@ const formatMDXBullet = (text = "") => {
|
|
|
34
34
|
exports.formatMDXBullet = formatMDXBullet;
|
|
35
35
|
/**
|
|
36
36
|
* Default details formatter.
|
|
37
|
+
*
|
|
38
|
+
* The returned string **must** contain a `\r` (carriage return) character as a
|
|
39
|
+
* delimiter between the opening part (ending after `</summary>`) and the
|
|
40
|
+
* closing part (starting before `</details>`). `printSection` calls
|
|
41
|
+
* `result.split('\r')` to obtain `[openSection, closeSection]`; without this
|
|
42
|
+
* delimiter the closing tag is lost and items are rendered outside the
|
|
43
|
+
* collapsible element.
|
|
44
|
+
*
|
|
45
|
+
* Custom implementations of `formatMDXDetails` must follow the same contract.
|
|
37
46
|
*/
|
|
38
47
|
const formatMDXDetails = ({ dataOpen, }) => {
|
|
39
|
-
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}`;
|
|
48
|
+
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}\r${strings_1.MARKDOWN_EOL}</details>${strings_1.MARKDOWN_EOP}`;
|
|
40
49
|
};
|
|
41
50
|
exports.formatMDXDetails = formatMDXDetails;
|
|
42
51
|
/**
|
package/dist/formatter.js
CHANGED
|
@@ -39,7 +39,7 @@ const createDefaultFormatter = () => {
|
|
|
39
39
|
return `<span class="gqlmd-mdx-bullet"> ● </span>${text}`;
|
|
40
40
|
},
|
|
41
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}`;
|
|
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}\r${strings_1.MARKDOWN_EOL}</details>${strings_1.MARKDOWN_EOP}`;
|
|
43
43
|
},
|
|
44
44
|
formatMDXFrontmatter: (_props, formatted) => {
|
|
45
45
|
return formatted
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module
|
|
7
7
|
*/
|
|
8
|
-
import type { PrintDirectiveOptions, GraphQLDirective,
|
|
8
|
+
import type { PrintDirectiveOptions, GraphQLDirective, Maybe, PageSection } from "@graphql-markdown/types";
|
|
9
9
|
/**
|
|
10
10
|
* Prints metadata information for a GraphQL directive, focusing on its arguments.
|
|
11
11
|
*
|
|
12
12
|
* @param type - The GraphQL directive to process
|
|
13
13
|
* @param options - Configuration options for printing directive metadata
|
|
14
|
-
* @returns
|
|
14
|
+
* @returns An "Arguments" PageSection, or undefined when no arguments are available
|
|
15
15
|
*/
|
|
16
|
-
export declare const printDirectiveMetadata: (type: GraphQLDirective, options: PrintDirectiveOptions) =>
|
|
16
|
+
export declare const printDirectiveMetadata: (type: GraphQLDirective, options: PrintDirectiveOptions) => Maybe<PageSection>;
|
|
17
17
|
/**
|
|
18
18
|
* Generates a string representation of a complete GraphQL directive definition.
|
|
19
19
|
*
|
|
@@ -1 +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,
|
|
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,KAAK,EACL,WAAW,EACZ,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 (type.locations
|
|
21
|
+
if (type.locations.length === 0) {
|
|
22
22
|
return "";
|
|
23
23
|
}
|
|
24
24
|
let code = ` on `;
|
|
@@ -34,11 +34,11 @@ const printCodeDirectiveLocation = (type) => {
|
|
|
34
34
|
*
|
|
35
35
|
* @param type - The GraphQL directive to process
|
|
36
36
|
* @param options - Configuration options for printing directive metadata
|
|
37
|
-
* @returns
|
|
37
|
+
* @returns An "Arguments" PageSection, or undefined when no arguments are available
|
|
38
38
|
*/
|
|
39
39
|
const printDirectiveMetadata = (type, options) => {
|
|
40
40
|
if (!("args" in type)) {
|
|
41
|
-
return
|
|
41
|
+
return undefined;
|
|
42
42
|
}
|
|
43
43
|
return (0, section_1.printMetadataSection)(type, type.args, "Arguments", options);
|
|
44
44
|
};
|
package/dist/graphql/enum.d.ts
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* Provides utilities for printing GraphQL enum types to Markdown/MDX format
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { Maybe, PageSection, PrintTypeOptions } from "@graphql-markdown/types";
|
|
6
6
|
/**
|
|
7
7
|
* Prints the metadata section for a GraphQL enum type.
|
|
8
8
|
*
|
|
9
9
|
* @param type - The GraphQL enum type to process
|
|
10
10
|
* @param options - Options for printing the type
|
|
11
|
-
* @returns A
|
|
11
|
+
* @returns A "Values" PageSection, or undefined when `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) => Maybe<PageSection>;
|
|
14
14
|
/**
|
|
15
15
|
* Generates a GraphQL SDL code block for an enum type.
|
|
16
16
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../src/graphql/enum.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../src/graphql/enum.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,KAAK,EACL,WAAW,EACX,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAYjC;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,kEAS7B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,mEA0BzB,CAAC"}
|
package/dist/graphql/enum.js
CHANGED
|
@@ -14,11 +14,11 @@ const link_1 = require("../link");
|
|
|
14
14
|
*
|
|
15
15
|
* @param type - The GraphQL enum type to process
|
|
16
16
|
* @param options - Options for printing the type
|
|
17
|
-
* @returns A
|
|
17
|
+
* @returns A "Values" PageSection, or undefined when `type` is not an enum
|
|
18
18
|
*/
|
|
19
19
|
const printEnumMetadata = (type, options) => {
|
|
20
20
|
if (!(0, graphql_1.isEnumType)(type)) {
|
|
21
|
-
return
|
|
21
|
+
return undefined;
|
|
22
22
|
}
|
|
23
23
|
return (0, section_1.printMetadataSection)(type, type.getValues(), "Values", options);
|
|
24
24
|
};
|
package/dist/graphql/object.d.ts
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* GraphQL Object Type printing utilities
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
-
import type { PrintTypeOptions } from "@graphql-markdown/types";
|
|
5
|
+
import type { Maybe, PageSection, PrintTypeOptions } from "@graphql-markdown/types";
|
|
6
6
|
/**
|
|
7
7
|
* Prints the complete metadata section for a GraphQL object type
|
|
8
8
|
* @param type - The GraphQL type object to process
|
|
9
9
|
* @param options - Printing options
|
|
10
|
-
* @returns
|
|
10
|
+
* @returns Ordered metadata sections for fields and interfaces
|
|
11
11
|
*/
|
|
12
|
-
export declare const printObjectMetadata: (type: unknown, options: PrintTypeOptions) =>
|
|
12
|
+
export declare const printObjectMetadata: (type: unknown, options: PrintTypeOptions) => Maybe<PageSection[]>;
|
|
13
13
|
/**
|
|
14
14
|
* Prints the GraphQL type definition as a code block
|
|
15
15
|
* @param type - The GraphQL type object to process
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/graphql/object.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/graphql/object.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,KAAK,EACL,WAAW,EACX,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AA8BjC;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,oEAa/B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,sEAgCzB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,sDAK3B,CAAC"}
|
package/dist/graphql/object.js
CHANGED
|
@@ -13,14 +13,14 @@ const strings_1 = require("../const/strings");
|
|
|
13
13
|
* Prints the metadata section for interfaces implemented by a GraphQL type
|
|
14
14
|
* @param type - The GraphQL type object to process
|
|
15
15
|
* @param options - Printing options
|
|
16
|
-
* @returns
|
|
16
|
+
* @returns An "Interfaces" PageSection, or undefined when the type has no interfaces
|
|
17
17
|
*/
|
|
18
18
|
const printImplementedInterfaceMetadata = (type, options) => {
|
|
19
19
|
if (typeof type !== "object" ||
|
|
20
20
|
type === null ||
|
|
21
21
|
!("getInterfaces" in type) ||
|
|
22
22
|
typeof type.getInterfaces !== "function") {
|
|
23
|
-
return
|
|
23
|
+
return undefined;
|
|
24
24
|
}
|
|
25
25
|
return (0, section_1.printSection)(type.getInterfaces(), "Interfaces", options);
|
|
26
26
|
};
|
|
@@ -28,12 +28,12 @@ const printImplementedInterfaceMetadata = (type, options) => {
|
|
|
28
28
|
* Prints the complete metadata section for a GraphQL object type
|
|
29
29
|
* @param type - The GraphQL type object to process
|
|
30
30
|
* @param options - Printing options
|
|
31
|
-
* @returns
|
|
31
|
+
* @returns Ordered metadata sections for fields and interfaces
|
|
32
32
|
*/
|
|
33
33
|
const printObjectMetadata = (type, options) => {
|
|
34
34
|
const interfaceMeta = printImplementedInterfaceMetadata(type, options);
|
|
35
35
|
const metadata = (0, section_1.printMetadataSection)(type, (0, graphql_1.getFields)(type), "Fields", options);
|
|
36
|
-
return
|
|
36
|
+
return [metadata, interfaceMeta].filter(Boolean);
|
|
37
37
|
};
|
|
38
38
|
exports.printObjectMetadata = printObjectMetadata;
|
|
39
39
|
/**
|
|
@@ -3,24 +3,23 @@
|
|
|
3
3
|
* Provides utilities to print operation types, metadata, and code representations.
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import type { PrintTypeOptions, MDXString } from "@graphql-markdown/types";
|
|
6
|
+
import type { PrintTypeOptions, MDXString, Maybe, PageSection } from "@graphql-markdown/types";
|
|
7
7
|
/**
|
|
8
8
|
* Prints the operation type information.
|
|
9
9
|
* @param type - The operation type to print
|
|
10
10
|
* @param options - Print type options for customizing output
|
|
11
|
-
* @returns
|
|
11
|
+
* @returns A "Type" PageSection, or undefined when `type` is not an operation
|
|
12
12
|
*/
|
|
13
|
-
export declare const printOperationType: (type: unknown, options: PrintTypeOptions) =>
|
|
13
|
+
export declare const printOperationType: (type: unknown, options: PrintTypeOptions) => Maybe<PageSection>;
|
|
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
|
-
* @returns
|
|
18
|
+
* @returns Ordered operation metadata sections, or undefined when `type` is not an operation
|
|
19
19
|
*/
|
|
20
|
-
export declare const printOperationMetadata: (type: unknown, options: PrintTypeOptions) =>
|
|
20
|
+
export declare const printOperationMetadata: (type: unknown, options: PrintTypeOptions) => Maybe<PageSection[]>;
|
|
21
21
|
/**
|
|
22
22
|
* Prints the code representation of an operation.
|
|
23
|
-
* @see printCodeField
|
|
24
23
|
*/
|
|
25
|
-
export
|
|
24
|
+
export declare const printCodeOperation: (type: unknown, options?: PrintTypeOptions | undefined) => string | MDXString;
|
|
26
25
|
//# sourceMappingURL=operation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../src/graphql/operation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../src/graphql/operation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,SAAS,EACT,KAAK,EACL,WAAW,EACZ,MAAM,yBAAyB,CAAC;AAMjC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,kEAa9B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,oEAYlC,CAAC;AAkCF;;GAEG;AACH,eAAO,MAAM,kBAAkB,+EAc9B,CAAC"}
|