@graphql-markdown/printer-legacy 1.19.1 → 1.19.3
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/README.md +2 -1
- package/dist/badge.js +9 -9
- package/dist/code.js +8 -8
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +10 -10
- package/dist/const/strings.d.ts +2 -2
- package/dist/const/strings.d.ts.map +1 -1
- package/dist/decorator.js +13 -13
- package/dist/example.js +3 -3
- package/dist/graphql/directive.js +4 -4
- package/dist/graphql/enum.js +9 -9
- package/dist/graphql/index.d.ts +8 -8
- package/dist/graphql/index.d.ts.map +1 -1
- package/dist/graphql/index.js +8 -8
- package/dist/graphql/input.d.ts +1 -1
- package/dist/graphql/input.d.ts.map +1 -1
- package/dist/graphql/input.js +4 -4
- package/dist/graphql/interface.d.ts +1 -1
- package/dist/graphql/interface.d.ts.map +1 -1
- package/dist/graphql/interface.js +4 -4
- package/dist/graphql/object.js +8 -8
- package/dist/graphql/operation.js +9 -9
- package/dist/graphql/union.js +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -9
- package/dist/link.js +16 -16
- package/dist/printer.d.ts +2 -2
- package/dist/printer.d.ts.map +1 -1
- package/dist/printer.js +56 -56
- package/dist/relation.js +10 -10
- package/dist/section.js +24 -24
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# @graphql-markdown/printer-legacy
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@graphql-markdown/printer-legacy)
|
|
4
|
+
[](https://jsr.io/@graphql-markdown/printer-legacy)
|
|
4
5
|
[](https://raw.githubusercontent.com/graphql-markdown/graphql-markdown/main/LICENSE)
|
|
5
6
|
[](https://sonarcloud.io/summary/new_code?id=graphql-markdown_printer-legacy)
|
|
6
7
|
[](https://sonarcloud.io/summary/new_code?id=graphql-markdown_printer-legacy)
|
|
@@ -21,7 +22,7 @@ npm install @graphql-markdown/printer-legacy
|
|
|
21
22
|
```ts
|
|
22
23
|
import { Printer } from "@graphql-markdown/printer-legacy";
|
|
23
24
|
|
|
24
|
-
await Printer.init(schema, baseURL, options);
|
|
25
|
+
await Printer.init(schema, baseURL, linkRoot, options);
|
|
25
26
|
const page = await Printer.printType("query", queryType, options);
|
|
26
27
|
```
|
|
27
28
|
|
package/dist/badge.js
CHANGED
|
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.printBadges = exports.formatBadges = exports.printBadge = exports.getTypeBadges = exports.CSS_BADGE_CLASSNAME = void 0;
|
|
10
10
|
const utils_1 = require("@graphql-markdown/utils");
|
|
11
11
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
12
|
+
const link_ts_1 = require("./link.js");
|
|
13
|
+
const group_ts_1 = require("./group.js");
|
|
14
|
+
const formatter_ts_1 = require("./formatter.js");
|
|
15
|
+
const strings_ts_1 = require("./const/strings.js");
|
|
16
16
|
exports.CSS_BADGE_CLASSNAME = {
|
|
17
17
|
DEPRECATED: "DEPRECATED",
|
|
18
18
|
RELATION: "RELATION",
|
|
@@ -33,26 +33,26 @@ const getTypeBadges = (type, groups) => {
|
|
|
33
33
|
const rootType = ("type" in type ? type.type : type);
|
|
34
34
|
if ((0, graphql_1.isDeprecated)(type)) {
|
|
35
35
|
badges.push({
|
|
36
|
-
text:
|
|
36
|
+
text: strings_ts_1.DEPRECATED,
|
|
37
37
|
classname: exports.CSS_BADGE_CLASSNAME.DEPRECATED,
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
if ((0, graphql_1.isNonNullType)(rootType)) {
|
|
41
41
|
badges.push({
|
|
42
|
-
text:
|
|
42
|
+
text: strings_ts_1.NON_NULL,
|
|
43
43
|
classname: exports.CSS_BADGE_CLASSNAME.NON_NULL,
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
if ((0, graphql_1.isListType)(rootType)) {
|
|
47
47
|
badges.push({ text: "list" });
|
|
48
48
|
}
|
|
49
|
-
const category = (0,
|
|
49
|
+
const category = (0, link_ts_1.getCategoryLocale)((0, graphql_1.getNamedType)(rootType));
|
|
50
50
|
if (category) {
|
|
51
51
|
badges.push({ text: category });
|
|
52
52
|
}
|
|
53
53
|
if (groups) {
|
|
54
54
|
const typeCategory = (typeof category === "string" ? category : category?.plural);
|
|
55
|
-
const group = (0,
|
|
55
|
+
const group = (0, group_ts_1.getGroup)(rootType, groups, typeCategory);
|
|
56
56
|
if (group && group !== "") {
|
|
57
57
|
badges.push({ text: group });
|
|
58
58
|
}
|
|
@@ -74,7 +74,7 @@ const printBadge = ({ text, classname }, options) => {
|
|
|
74
74
|
return options.formatMDXBadge(badge);
|
|
75
75
|
}
|
|
76
76
|
// Fallback to default formatter (should not happen if Printer.init was called)
|
|
77
|
-
return (0,
|
|
77
|
+
return (0, formatter_ts_1.createDefaultFormatter)().formatMDXBadge(badge);
|
|
78
78
|
};
|
|
79
79
|
exports.printBadge = printBadge;
|
|
80
80
|
/**
|
package/dist/code.js
CHANGED
|
@@ -10,8 +10,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.printCodeField = exports.printCodeArguments = void 0;
|
|
11
11
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
12
12
|
const utils_1 = require("@graphql-markdown/utils");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
13
|
+
const strings_ts_1 = require("./const/strings.js");
|
|
14
|
+
const link_ts_1 = require("./link.js");
|
|
15
15
|
/**
|
|
16
16
|
* Generates a string representation of GraphQL arguments with proper formatting and indentation.
|
|
17
17
|
*
|
|
@@ -31,8 +31,8 @@ const printCodeArguments = (type, indentationLevel = 1) => {
|
|
|
31
31
|
if (!(0, utils_1.hasNonEmptyArrayProperty)(type, "args")) {
|
|
32
32
|
return "";
|
|
33
33
|
}
|
|
34
|
-
const argIndentation =
|
|
35
|
-
const parentIndentation = indentationLevel === 1 ? "" :
|
|
34
|
+
const argIndentation = strings_ts_1.MARKDOWN_CODE_INDENTATION.repeat(indentationLevel);
|
|
35
|
+
const parentIndentation = indentationLevel === 1 ? "" : strings_ts_1.MARKDOWN_CODE_INDENTATION;
|
|
36
36
|
const argLines = type.args.map((v) => {
|
|
37
37
|
if (!(0, utils_1.hasProperty)(v, "type") || !(0, utils_1.hasProperty)(v, "name")) {
|
|
38
38
|
return "";
|
|
@@ -47,7 +47,7 @@ const printCodeArguments = (type, indentationLevel = 1) => {
|
|
|
47
47
|
const propName = String(v.name);
|
|
48
48
|
return `${argIndentation}${propName}: ${propType}${printedDefault}`;
|
|
49
49
|
});
|
|
50
|
-
return [`(`, ...argLines, `${parentIndentation})`].join(
|
|
50
|
+
return [`(`, ...argLines, `${parentIndentation})`].join(strings_ts_1.MARKDOWN_EOL);
|
|
51
51
|
};
|
|
52
52
|
exports.printCodeArguments = printCodeArguments;
|
|
53
53
|
/**
|
|
@@ -70,7 +70,7 @@ const printCodeField = (type, options, indentationLevel = 0) => {
|
|
|
70
70
|
if (!(0, utils_1.hasProperty)(type, "type")) {
|
|
71
71
|
return "";
|
|
72
72
|
}
|
|
73
|
-
if (!(0,
|
|
73
|
+
if (!(0, link_ts_1.hasPrintableDirective)(type, options)) {
|
|
74
74
|
return "";
|
|
75
75
|
}
|
|
76
76
|
const parts = [
|
|
@@ -79,8 +79,8 @@ const printCodeField = (type, options, indentationLevel = 0) => {
|
|
|
79
79
|
`: ${(0, graphql_1.getTypeName)(type.type)}`,
|
|
80
80
|
];
|
|
81
81
|
if ((0, graphql_1.isDeprecated)(type)) {
|
|
82
|
-
parts.push(` @${
|
|
82
|
+
parts.push(` @${strings_ts_1.DEPRECATED}`);
|
|
83
83
|
}
|
|
84
|
-
return parts.join("") +
|
|
84
|
+
return parts.join("") + strings_ts_1.MARKDOWN_EOL;
|
|
85
85
|
};
|
|
86
86
|
exports.printCodeField = printCodeField;
|
package/dist/common.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAEV,SAAS,EACT,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAEV,SAAS,EACT,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAsCjC;;;;;GAKG;AAEH,eAAO,MAAM,YAAY,oBACN;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,WACzC,gBAAgB,KACxB,MAUF,CAAC;AAEF;;;;;GAKG;AAEH,eAAO,MAAM,gBAAgB,SACrB,OAAO,WACJ,gBAAgB,KACxB,MAcF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,SACrB,OAAO,WACJ,gBAAgB,WAChB,MAAM,KACd,SAAS,GAAG,MAYd,CAAC"}
|
package/dist/common.js
CHANGED
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.printDescription = exports.printDeprecation = exports.printWarning = void 0;
|
|
8
8
|
const utils_1 = require("@graphql-markdown/utils");
|
|
9
9
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const strings_ts_1 = require("./const/strings.js");
|
|
11
|
+
const decorator_ts_1 = require("./decorator.js");
|
|
12
12
|
/**
|
|
13
13
|
* Formats a GraphQL type description or falls back to a default message.
|
|
14
14
|
*
|
|
@@ -16,14 +16,14 @@ const decorator_1 = require("./decorator");
|
|
|
16
16
|
* @param replacement - Optional fallback text if no description exists
|
|
17
17
|
* @returns Formatted description string or MDX content
|
|
18
18
|
*/
|
|
19
|
-
const formatDescription = (type, replacement =
|
|
19
|
+
const formatDescription = (type, replacement = strings_ts_1.NO_DESCRIPTION_TEXT) => {
|
|
20
20
|
if (!(0, utils_1.isTypeObject)(type)) {
|
|
21
|
-
return `${
|
|
21
|
+
return `${strings_ts_1.MARKDOWN_EOP}${(0, utils_1.escapeMDX)(replacement)}`;
|
|
22
22
|
}
|
|
23
23
|
const description = (0, utils_1.hasStringProperty)(type, "description")
|
|
24
24
|
? type.description
|
|
25
25
|
: replacement;
|
|
26
|
-
return `${
|
|
26
|
+
return `${strings_ts_1.MARKDOWN_EOP}${(0, utils_1.escapeMDX)(description)}`;
|
|
27
27
|
};
|
|
28
28
|
/**
|
|
29
29
|
* Generates a warning message block in MDX format.
|
|
@@ -34,8 +34,8 @@ const formatDescription = (type, replacement = strings_1.NO_DESCRIPTION_TEXT) =>
|
|
|
34
34
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
35
35
|
const printWarning = ({ text, title }, options) => {
|
|
36
36
|
const formattedText = typeof text !== "string" || text.trim() === ""
|
|
37
|
-
?
|
|
38
|
-
: `${
|
|
37
|
+
? strings_ts_1.MARKDOWN_EOP
|
|
38
|
+
: `${strings_ts_1.MARKDOWN_EOP}${text}${strings_ts_1.MARKDOWN_EOP}`;
|
|
39
39
|
return options.formatMDXAdmonition({ text: formattedText, type: "warning", icon: "⚠️", title }, options.meta);
|
|
40
40
|
};
|
|
41
41
|
exports.printWarning = printWarning;
|
|
@@ -53,7 +53,7 @@ const printDeprecation = (type, options) => {
|
|
|
53
53
|
const reason = "deprecationReason" in type && typeof type.deprecationReason === "string"
|
|
54
54
|
? (0, utils_1.escapeMDX)(type.deprecationReason)
|
|
55
55
|
: "";
|
|
56
|
-
return (0, exports.printWarning)({ text: reason, title:
|
|
56
|
+
return (0, exports.printWarning)({ text: reason, title: strings_ts_1.DEPRECATED.toUpperCase() }, options);
|
|
57
57
|
};
|
|
58
58
|
exports.printDeprecation = printDeprecation;
|
|
59
59
|
/**
|
|
@@ -69,9 +69,9 @@ const printDescription = (type, options, noText) => {
|
|
|
69
69
|
// `customDirective`'s `descriptor` handlers reach this line via the
|
|
70
70
|
// decorators pipeline (`printSlotDecorators`), not a dedicated call — see
|
|
71
71
|
// `buildCustomDirectiveDecorators` in `./decorator`.
|
|
72
|
-
const decoratorContent = (0,
|
|
72
|
+
const decoratorContent = (0, decorator_ts_1.printSlotDecorators)("description", type, options);
|
|
73
73
|
const decorators = decoratorContent.length > 0
|
|
74
|
-
? `${
|
|
74
|
+
? `${strings_ts_1.MARKDOWN_EOP}${decoratorContent.join(strings_ts_1.MARKDOWN_EOP)}`
|
|
75
75
|
: "";
|
|
76
76
|
return `${deprecation}${description}${decorators}`;
|
|
77
77
|
};
|
package/dist/const/strings.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare const NON_NULL: "non-null";
|
|
|
17
17
|
/** Default placeholder when no schema description is provided. */
|
|
18
18
|
export declare const NO_DESCRIPTION_TEXT: "No description";
|
|
19
19
|
/** Helper for inserting the code-block end delimiter in generated Markdown. */
|
|
20
|
-
export declare const MARKDOWN_EOC:
|
|
20
|
+
export declare const MARKDOWN_EOC: string;
|
|
21
21
|
/** Helper for inserting the code-block start delimiter targeting GraphQL syntax. */
|
|
22
|
-
export declare const MARKDOWN_SOC:
|
|
22
|
+
export declare const MARKDOWN_SOC: string;
|
|
23
23
|
//# sourceMappingURL=strings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/const/strings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EACL,yBAAyB,EACzB,YAAY,EACZ,YAAY,GACb,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,cAYrB,CAAC;AAEX,iEAAiE;AACjE,eAAO,MAAM,UAAU,EAAG,YAAqB,CAAC;AAEhD,4DAA4D;AAC5D,eAAO,MAAM,QAAQ,EAAG,UAAmB,CAAC;AAK5C,kEAAkE;AAClE,eAAO,MAAM,mBAAmB,EAAG,gBAAyB,CAAC;AAE7D,+EAA+E;AAC/E,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/const/strings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EACL,yBAAyB,EACzB,YAAY,EACZ,YAAY,GACb,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,cAYrB,CAAC;AAEX,iEAAiE;AACjE,eAAO,MAAM,UAAU,EAAG,YAAqB,CAAC;AAEhD,4DAA4D;AAC5D,eAAO,MAAM,QAAQ,EAAG,UAAmB,CAAC;AAK5C,kEAAkE;AAClE,eAAO,MAAM,mBAAmB,EAAG,gBAAyB,CAAC;AAE7D,+EAA+E;AAC/E,eAAO,MAAM,YAAY,EAAE,MACwC,CAAC;AAEpE,oFAAoF;AACpF,eAAO,MAAM,YAAY,EAAE,MACkD,CAAC"}
|
package/dist/decorator.js
CHANGED
|
@@ -30,11 +30,11 @@ exports.getDecoratorsOrder = exports.printSlotDecorators = exports.printDecorato
|
|
|
30
30
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
31
31
|
Object.defineProperty(exports, "getSchemaEntity", { enumerable: true, get: function () { return graphql_1.getSchemaEntity; } });
|
|
32
32
|
const utils_1 = require("@graphql-markdown/utils");
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
33
|
+
const badge_ts_1 = require("./badge.js");
|
|
34
|
+
const example_ts_1 = require("./example.js");
|
|
35
|
+
const link_ts_1 = require("./link.js");
|
|
36
|
+
const strings_ts_1 = require("./const/strings.js");
|
|
37
|
+
const options_ts_1 = require("./const/options.js");
|
|
38
38
|
/**
|
|
39
39
|
* Section/decorator keys owned by the printer, which a decorator cannot claim.
|
|
40
40
|
*
|
|
@@ -101,7 +101,7 @@ const getCustomDirectiveResolver = (resolver, type, constDirectiveOption, fallba
|
|
|
101
101
|
* @internal
|
|
102
102
|
*/
|
|
103
103
|
const printCustomDirective = (type, constDirectiveOption, options) => {
|
|
104
|
-
const typeNameLink = (0,
|
|
104
|
+
const typeNameLink = (0, link_ts_1.printLink)(constDirectiveOption.type, {
|
|
105
105
|
...options,
|
|
106
106
|
withAttributes: false,
|
|
107
107
|
});
|
|
@@ -109,7 +109,7 @@ const printCustomDirective = (type, constDirectiveOption, options) => {
|
|
|
109
109
|
if (typeof description !== "string") {
|
|
110
110
|
return undefined;
|
|
111
111
|
}
|
|
112
|
-
return `${
|
|
112
|
+
return `${options_ts_1.SectionLevels.LEVEL.repeat(4)} ${typeNameLink}${strings_ts_1.MARKDOWN_EOL} ${description}${strings_ts_1.MARKDOWN_EOL} `;
|
|
113
113
|
};
|
|
114
114
|
/**
|
|
115
115
|
* Converts the deprecated `customDirective` option's schema-resolved
|
|
@@ -173,7 +173,7 @@ const buildCustomDirectiveDecorators = (customDirectives) => {
|
|
|
173
173
|
return value !== undefined;
|
|
174
174
|
});
|
|
175
175
|
return directives.length > 0
|
|
176
|
-
? directives.join(
|
|
176
|
+
? directives.join(strings_ts_1.MARKDOWN_EOP)
|
|
177
177
|
: undefined;
|
|
178
178
|
},
|
|
179
179
|
},
|
|
@@ -192,7 +192,7 @@ const buildCustomDirectiveDecorators = (customDirectives) => {
|
|
|
192
192
|
.map((text) => {
|
|
193
193
|
return (0, utils_1.escapeMDX)(text);
|
|
194
194
|
});
|
|
195
|
-
return parts.length > 0 ? parts.join(
|
|
195
|
+
return parts.length > 0 ? parts.join(strings_ts_1.MARKDOWN_EOP) : undefined;
|
|
196
196
|
},
|
|
197
197
|
},
|
|
198
198
|
"customDirective:tags": {
|
|
@@ -208,7 +208,7 @@ const buildCustomDirectiveDecorators = (customDirectives) => {
|
|
|
208
208
|
return value !== undefined;
|
|
209
209
|
});
|
|
210
210
|
return badges.length > 0
|
|
211
|
-
? (0,
|
|
211
|
+
? (0, badge_ts_1.formatBadges)(badges, options)
|
|
212
212
|
: undefined;
|
|
213
213
|
},
|
|
214
214
|
},
|
|
@@ -244,11 +244,11 @@ const getExampleSectionDefinition = () => {
|
|
|
244
244
|
id: "example",
|
|
245
245
|
title: "Example",
|
|
246
246
|
resolve: (type, printOptions) => {
|
|
247
|
-
const example = (0,
|
|
247
|
+
const example = (0, example_ts_1.printExample)(type, printOptions);
|
|
248
248
|
return example ? [{ example }] : [];
|
|
249
249
|
},
|
|
250
250
|
render: (values) => {
|
|
251
|
-
return `${
|
|
251
|
+
return `${strings_ts_1.MARKDOWN_SOC}${values[0].example}${strings_ts_1.MARKDOWN_EOC}`;
|
|
252
252
|
},
|
|
253
253
|
};
|
|
254
254
|
};
|
|
@@ -344,7 +344,7 @@ const printDecorator = (type, decorator, options) => {
|
|
|
344
344
|
title: decorator.title ?? undefined,
|
|
345
345
|
// The render callback owns its Markdown: trimming here would alter content
|
|
346
346
|
// whose leading whitespace is significant, such as an indented code block.
|
|
347
|
-
content: `${content}${
|
|
347
|
+
content: `${content}${strings_ts_1.MARKDOWN_EOP}`,
|
|
348
348
|
level: decorator.level ?? 3,
|
|
349
349
|
};
|
|
350
350
|
};
|
package/dist/example.js
CHANGED
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
exports.printExample = exports.getDirectiveExampleOption = void 0;
|
|
9
9
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
10
10
|
const utils_1 = require("@graphql-markdown/utils");
|
|
11
|
-
const
|
|
11
|
+
const link_ts_1 = require("./link.js");
|
|
12
12
|
/**
|
|
13
13
|
* Retrieves directive example options from the provided print type options.
|
|
14
14
|
*
|
|
@@ -63,7 +63,7 @@ const parseTypeFields = (type, options, mappedTypes = []) => {
|
|
|
63
63
|
let example = {};
|
|
64
64
|
fields
|
|
65
65
|
.filter((field) => {
|
|
66
|
-
return (0,
|
|
66
|
+
return (0, link_ts_1.hasPrintableDirective)(field, options);
|
|
67
67
|
})
|
|
68
68
|
.forEach((field) => {
|
|
69
69
|
const fieldType = (0, graphql_1.hasDirective)(field, [directiveExample.directive])
|
|
@@ -129,7 +129,7 @@ const parseExampleValue = (value, type) => {
|
|
|
129
129
|
*/
|
|
130
130
|
const parseExampleDirective = (type, options, mappedTypes = []) => {
|
|
131
131
|
const directiveExample = (0, exports.getDirectiveExampleOption)(options);
|
|
132
|
-
if (!directiveExample || !(0,
|
|
132
|
+
if (!directiveExample || !(0, link_ts_1.hasPrintableDirective)(type, options)) {
|
|
133
133
|
return undefined;
|
|
134
134
|
}
|
|
135
135
|
const parser = typeof directiveExample.parser === "function"
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.printCodeDirective = exports.printDirectiveMetadata = void 0;
|
|
11
11
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
12
|
+
const section_ts_1 = require("../section.js");
|
|
13
|
+
const code_ts_1 = require("../code.js");
|
|
14
14
|
/**
|
|
15
15
|
* Generates a string representation of directive locations.
|
|
16
16
|
*
|
|
@@ -40,7 +40,7 @@ const printDirectiveMetadata = (type, options) => {
|
|
|
40
40
|
if (!("args" in type)) {
|
|
41
41
|
return undefined;
|
|
42
42
|
}
|
|
43
|
-
return (0,
|
|
43
|
+
return (0, section_ts_1.printMetadataSection)(type, type.args, "Arguments", options);
|
|
44
44
|
};
|
|
45
45
|
exports.printDirectiveMetadata = printDirectiveMetadata;
|
|
46
46
|
/**
|
|
@@ -54,7 +54,7 @@ const printCodeDirective = (type,
|
|
|
54
54
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
55
55
|
options) => {
|
|
56
56
|
let code = `directive @${(0, graphql_1.getTypeName)(type)}`;
|
|
57
|
-
code += (0,
|
|
57
|
+
code += (0, code_ts_1.printCodeArguments)(type);
|
|
58
58
|
code += printCodeDirectiveLocation(type);
|
|
59
59
|
return code;
|
|
60
60
|
};
|
package/dist/graphql/enum.js
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.printCodeEnum = exports.printEnumMetadata = void 0;
|
|
8
8
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
9
|
+
const strings_ts_1 = require("../const/strings.js");
|
|
10
|
+
const section_ts_1 = require("../section.js");
|
|
11
|
+
const link_ts_1 = require("../link.js");
|
|
12
12
|
/**
|
|
13
13
|
* Prints the metadata section for a GraphQL enum type.
|
|
14
14
|
*
|
|
@@ -20,7 +20,7 @@ const printEnumMetadata = (type, options) => {
|
|
|
20
20
|
if (!(0, graphql_1.isEnumType)(type)) {
|
|
21
21
|
return undefined;
|
|
22
22
|
}
|
|
23
|
-
return (0,
|
|
23
|
+
return (0, section_ts_1.printMetadataSection)(type, type.getValues(), "Values", options);
|
|
24
24
|
};
|
|
25
25
|
exports.printEnumMetadata = printEnumMetadata;
|
|
26
26
|
/**
|
|
@@ -34,22 +34,22 @@ const printCodeEnum = (type, options) => {
|
|
|
34
34
|
if (!(0, graphql_1.isEnumType)(type)) {
|
|
35
35
|
return "";
|
|
36
36
|
}
|
|
37
|
-
let code = `enum ${(0, graphql_1.getTypeName)(type)} {${
|
|
37
|
+
let code = `enum ${(0, graphql_1.getTypeName)(type)} {${strings_ts_1.MARKDOWN_EOL}`;
|
|
38
38
|
code += type
|
|
39
39
|
.getValues()
|
|
40
40
|
.map((value) => {
|
|
41
|
-
if (!(0,
|
|
41
|
+
if (!(0, link_ts_1.hasPrintableDirective)(value, options)) {
|
|
42
42
|
return "";
|
|
43
43
|
}
|
|
44
44
|
const v = (0, graphql_1.getTypeName)(value);
|
|
45
|
-
const d = (0, graphql_1.isDeprecated)(value) ? ` @${
|
|
45
|
+
const d = (0, graphql_1.isDeprecated)(value) ? ` @${strings_ts_1.DEPRECATED}` : "";
|
|
46
46
|
return ` ${v}${d}`;
|
|
47
47
|
})
|
|
48
48
|
.filter((value) => {
|
|
49
49
|
return value.length > 0;
|
|
50
50
|
})
|
|
51
|
-
.join(
|
|
52
|
-
code += `${
|
|
51
|
+
.join(strings_ts_1.MARKDOWN_EOL);
|
|
52
|
+
code += `${strings_ts_1.MARKDOWN_EOL}}`;
|
|
53
53
|
return code;
|
|
54
54
|
};
|
|
55
55
|
exports.printCodeEnum = printCodeEnum;
|
package/dist/graphql/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from "./directive";
|
|
2
|
-
export * from "./enum";
|
|
3
|
-
export * from "./input";
|
|
4
|
-
export * from "./interface";
|
|
5
|
-
export * from "./object";
|
|
6
|
-
export * from "./operation";
|
|
7
|
-
export * from "./scalar";
|
|
8
|
-
export * from "./union";
|
|
1
|
+
export * from "./directive.ts";
|
|
2
|
+
export * from "./enum.ts";
|
|
3
|
+
export * from "./input.ts";
|
|
4
|
+
export * from "./interface.ts";
|
|
5
|
+
export * from "./object.ts";
|
|
6
|
+
export * from "./operation.ts";
|
|
7
|
+
export * from "./scalar.ts";
|
|
8
|
+
export * from "./union.ts";
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graphql/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graphql/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
package/dist/graphql/index.js
CHANGED
|
@@ -14,11 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./directive"), exports);
|
|
18
|
-
__exportStar(require("./enum"), exports);
|
|
19
|
-
__exportStar(require("./input"), exports);
|
|
20
|
-
__exportStar(require("./interface"), exports);
|
|
21
|
-
__exportStar(require("./object"), exports);
|
|
22
|
-
__exportStar(require("./operation"), exports);
|
|
23
|
-
__exportStar(require("./scalar"), exports);
|
|
24
|
-
__exportStar(require("./union"), exports);
|
|
17
|
+
__exportStar(require("./directive.js"), exports);
|
|
18
|
+
__exportStar(require("./enum.js"), exports);
|
|
19
|
+
__exportStar(require("./input.js"), exports);
|
|
20
|
+
__exportStar(require("./interface.js"), exports);
|
|
21
|
+
__exportStar(require("./object.js"), exports);
|
|
22
|
+
__exportStar(require("./operation.js"), exports);
|
|
23
|
+
__exportStar(require("./scalar.js"), exports);
|
|
24
|
+
__exportStar(require("./union.js"), exports);
|
package/dist/graphql/input.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
6
|
import type { PrintTypeOptions } from "@graphql-markdown/types";
|
|
7
|
-
export { printObjectMetadata as printInputMetadata } from "./object";
|
|
7
|
+
export { printObjectMetadata as printInputMetadata } from "./object.ts";
|
|
8
8
|
/**
|
|
9
9
|
* Renders the Markdown code snippet for a GraphQL `input` type by delegating
|
|
10
10
|
* to the generic object printer while forcing the `input` kind.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/graphql/input.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAIhE,OAAO,EAAE,mBAAmB,IAAI,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/graphql/input.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAIhE,OAAO,EAAE,mBAAmB,IAAI,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAExE;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,SACnB,OAAO,WACJ,gBAAgB,KACxB,MAEF,CAAC"}
|
package/dist/graphql/input.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.printCodeInput = exports.printInputMetadata = void 0;
|
|
4
|
-
const
|
|
5
|
-
var
|
|
6
|
-
Object.defineProperty(exports, "printInputMetadata", { enumerable: true, get: function () { return
|
|
4
|
+
const object_ts_1 = require("./object.js");
|
|
5
|
+
var object_ts_2 = require("./object.js");
|
|
6
|
+
Object.defineProperty(exports, "printInputMetadata", { enumerable: true, get: function () { return object_ts_2.printObjectMetadata; } });
|
|
7
7
|
/**
|
|
8
8
|
* Renders the Markdown code snippet for a GraphQL `input` type by delegating
|
|
9
9
|
* to the generic object printer while forcing the `input` kind.
|
|
@@ -13,6 +13,6 @@ Object.defineProperty(exports, "printInputMetadata", { enumerable: true, get: fu
|
|
|
13
13
|
* @returns Markdown code block representing the input signature.
|
|
14
14
|
*/
|
|
15
15
|
const printCodeInput = (type, options) => {
|
|
16
|
-
return (0,
|
|
16
|
+
return (0, object_ts_1.printCodeType)(type, "input", options);
|
|
17
17
|
};
|
|
18
18
|
exports.printCodeInput = printCodeInput;
|
|
@@ -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 { printObjectMetadata as printInterfaceMetadata } from "./object";
|
|
10
|
+
export { printObjectMetadata as printInterfaceMetadata } from "./object.ts";
|
|
11
11
|
/**
|
|
12
12
|
* Generates a code block representation of a GraphQL interface type.
|
|
13
13
|
*
|
|
@@ -1 +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,
|
|
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,aAAa,CAAC;AAE5E;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,SACvB,OAAO,WACJ,gBAAgB,KACxB,MAEF,CAAC"}
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.printCodeInterface = exports.printInterfaceMetadata = void 0;
|
|
8
|
-
const
|
|
8
|
+
const object_ts_1 = require("./object.js");
|
|
9
9
|
/**
|
|
10
10
|
* Prints metadata for a GraphQL interface type.
|
|
11
11
|
* This is an alias for {@link printObjectMetadata}.
|
|
12
12
|
*/
|
|
13
|
-
var
|
|
14
|
-
Object.defineProperty(exports, "printInterfaceMetadata", { enumerable: true, get: function () { return
|
|
13
|
+
var object_ts_2 = require("./object.js");
|
|
14
|
+
Object.defineProperty(exports, "printInterfaceMetadata", { enumerable: true, get: function () { return object_ts_2.printObjectMetadata; } });
|
|
15
15
|
/**
|
|
16
16
|
* Generates a code block representation of a GraphQL interface type.
|
|
17
17
|
*
|
|
@@ -20,6 +20,6 @@ Object.defineProperty(exports, "printInterfaceMetadata", { enumerable: true, get
|
|
|
20
20
|
* @returns A string containing the Markdown code block representation
|
|
21
21
|
*/
|
|
22
22
|
const printCodeInterface = (type, options) => {
|
|
23
|
-
return (0,
|
|
23
|
+
return (0, object_ts_1.printCodeType)(type, "interface", options);
|
|
24
24
|
};
|
|
25
25
|
exports.printCodeInterface = printCodeInterface;
|
package/dist/graphql/object.js
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.printCodeObject = exports.printCodeType = exports.printObjectMetadata = void 0;
|
|
8
8
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
9
|
+
const section_ts_1 = require("../section.js");
|
|
10
|
+
const code_ts_1 = require("../code.js");
|
|
11
|
+
const strings_ts_1 = require("../const/strings.js");
|
|
12
12
|
/**
|
|
13
13
|
* Prints the metadata section for interfaces implemented by a GraphQL type
|
|
14
14
|
* @param type - The GraphQL type object to process
|
|
@@ -22,7 +22,7 @@ const printImplementedInterfaceMetadata = (type, options) => {
|
|
|
22
22
|
typeof type.getInterfaces !== "function") {
|
|
23
23
|
return undefined;
|
|
24
24
|
}
|
|
25
|
-
return (0,
|
|
25
|
+
return (0, section_ts_1.printSection)(type.getInterfaces(), "Interfaces", options);
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
28
|
* Prints the complete metadata section for a GraphQL object type
|
|
@@ -32,7 +32,7 @@ const printImplementedInterfaceMetadata = (type, options) => {
|
|
|
32
32
|
*/
|
|
33
33
|
const printObjectMetadata = (type, options) => {
|
|
34
34
|
const interfaceMeta = printImplementedInterfaceMetadata(type, options);
|
|
35
|
-
const metadata = (0,
|
|
35
|
+
const metadata = (0, section_ts_1.printMetadataSection)(type, (0, graphql_1.getFields)(type), "Fields", options);
|
|
36
36
|
return [metadata, interfaceMeta].filter(Boolean);
|
|
37
37
|
};
|
|
38
38
|
exports.printObjectMetadata = printObjectMetadata;
|
|
@@ -60,14 +60,14 @@ const printCodeType = (type, entity, options) => {
|
|
|
60
60
|
: "";
|
|
61
61
|
const typeFields = (0, graphql_1.getFields)(type)
|
|
62
62
|
.map((field) => {
|
|
63
|
-
const f = (0,
|
|
64
|
-
return f.length > 0 ? `${
|
|
63
|
+
const f = (0, code_ts_1.printCodeField)(field, options, 1);
|
|
64
|
+
return f.length > 0 ? `${strings_ts_1.MARKDOWN_CODE_INDENTATION}${f}` : "";
|
|
65
65
|
})
|
|
66
66
|
.filter((field) => {
|
|
67
67
|
return field.length > 0;
|
|
68
68
|
})
|
|
69
69
|
.join("");
|
|
70
|
-
return `${entity} ${name}${extendsInterface} {${
|
|
70
|
+
return `${entity} ${name}${extendsInterface} {${strings_ts_1.MARKDOWN_EOL}${typeFields}}`;
|
|
71
71
|
};
|
|
72
72
|
exports.printCodeType = printCodeType;
|
|
73
73
|
/**
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.printCodeOperation = exports.printOperationMetadata = void 0;
|
|
9
9
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
10
|
+
const strings_ts_1 = require("../const/strings.js");
|
|
11
|
+
const code_ts_1 = require("../code.js");
|
|
12
|
+
const section_ts_1 = require("../section.js");
|
|
13
13
|
/**
|
|
14
14
|
* Prints the operation type information.
|
|
15
15
|
* @param type - The operation type to print
|
|
@@ -21,7 +21,7 @@ const printOperationType = (type, options) => {
|
|
|
21
21
|
return undefined;
|
|
22
22
|
}
|
|
23
23
|
const queryType = (0, graphql_1.getTypeName)(type.type).replaceAll(/[![\]]*/g, "");
|
|
24
|
-
return (0,
|
|
24
|
+
return (0, section_ts_1.printSection)([options.schema.getType(queryType)], "Type", {
|
|
25
25
|
...options,
|
|
26
26
|
parentTypePrefix: false,
|
|
27
27
|
});
|
|
@@ -37,7 +37,7 @@ const printOperationMetadata = (type, options) => {
|
|
|
37
37
|
return undefined;
|
|
38
38
|
}
|
|
39
39
|
const response = printOperationType(type, options);
|
|
40
|
-
const metadata = (0,
|
|
40
|
+
const metadata = (0, section_ts_1.printMetadataSection)(type, type.args, "Arguments", options);
|
|
41
41
|
return [metadata, response].filter(Boolean);
|
|
42
42
|
};
|
|
43
43
|
exports.printOperationMetadata = printOperationMetadata;
|
|
@@ -50,7 +50,7 @@ const wrapOperationCodeWithNamespaces = (operationCode, operationNamespaceParts)
|
|
|
50
50
|
}
|
|
51
51
|
let lines = operationCode
|
|
52
52
|
.trimEnd()
|
|
53
|
-
.split(
|
|
53
|
+
.split(strings_ts_1.MARKDOWN_EOL)
|
|
54
54
|
.filter((line) => {
|
|
55
55
|
return line.length > 0;
|
|
56
56
|
});
|
|
@@ -59,18 +59,18 @@ const wrapOperationCodeWithNamespaces = (operationCode, operationNamespaceParts)
|
|
|
59
59
|
lines = [
|
|
60
60
|
`${namespace} {`,
|
|
61
61
|
...lines.map((line) => {
|
|
62
|
-
return `${
|
|
62
|
+
return `${strings_ts_1.MARKDOWN_CODE_INDENTATION}${line}`;
|
|
63
63
|
}),
|
|
64
64
|
`}`,
|
|
65
65
|
];
|
|
66
66
|
}
|
|
67
|
-
return `${lines.join(
|
|
67
|
+
return `${lines.join(strings_ts_1.MARKDOWN_EOL)}${strings_ts_1.MARKDOWN_EOL}`;
|
|
68
68
|
};
|
|
69
69
|
/**
|
|
70
70
|
* Prints the code representation of an operation.
|
|
71
71
|
*/
|
|
72
72
|
const printCodeOperation = (type, options) => {
|
|
73
|
-
const code = (0,
|
|
73
|
+
const code = (0, code_ts_1.printCodeField)(type, options);
|
|
74
74
|
if (!Array.isArray(options?.operationNamespaceParts) ||
|
|
75
75
|
options.operationNamespaceParts.length === 0) {
|
|
76
76
|
return code;
|