Skip to content

Commit a11be12

Browse files
authored
Merge pull request #3 from iasql/issue-1815
Issue 1815
2 parents 7d64d31 + 73afd90 commit a11be12

File tree

21 files changed

+268
-84
lines changed

21 files changed

+268
-84
lines changed

dist/lib/render-utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ const hierarchy_1 = __importDefault(require("./resources/helpers/hierarchy"));
3939
const if_is_reference_1 = __importDefault(require("./resources/helpers/if-is-reference"));
4040
const if_is_equal_1 = __importDefault(require("./resources/helpers/if-is-equal"));
4141
const if_is_table_1 = __importDefault(require("./resources/helpers/if-is-table"));
42+
const if_is_enum_1 = __importDefault(require("./resources/helpers/if-is-enum"));
43+
const render_type_1 = __importDefault(require("./resources/helpers/render-type"));
4244
const if_named_anchors_1 = __importDefault(require("./resources/helpers/if-named-anchors"));
4345
const if_show_breadcrumbs_1 = __importDefault(require("./resources/helpers/if-show-breadcrumbs"));
4446
const if_show_named_anchors_1 = __importDefault(require("./resources/helpers/if-show-named-anchors"));
@@ -84,6 +86,8 @@ function registerHelpers(theme) {
8486
(0, if_is_reference_1.default)();
8587
(0, if_is_equal_1.default)();
8688
(0, if_is_table_1.default)();
89+
(0, if_is_enum_1.default)();
90+
(0, render_type_1.default)(theme);
8791
(0, if_named_anchors_1.default)(theme);
8892
(0, if_show_breadcrumbs_1.default)(theme);
8993
(0, if_show_named_anchors_1.default)(theme);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default function (): void;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"use strict";
2+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3+
if (k2 === undefined) k2 = k;
4+
var desc = Object.getOwnPropertyDescriptor(m, k);
5+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6+
desc = { enumerable: true, get: function() { return m[k]; } };
7+
}
8+
Object.defineProperty(o, k2, desc);
9+
}) : (function(o, m, k, k2) {
10+
if (k2 === undefined) k2 = k;
11+
o[k2] = m[k];
12+
}));
13+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14+
Object.defineProperty(o, "default", { enumerable: true, value: v });
15+
}) : function(o, v) {
16+
o["default"] = v;
17+
});
18+
var __importStar = (this && this.__importStar) || function (mod) {
19+
if (mod && mod.__esModule) return mod;
20+
var result = {};
21+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22+
__setModuleDefault(result, mod);
23+
return result;
24+
};
25+
Object.defineProperty(exports, "__esModule", { value: true });
26+
const Handlebars = __importStar(require("handlebars"));
27+
function default_1() {
28+
Handlebars.registerHelper("ifIsEnum", function (arg1, options) {
29+
return arg1.kindString == "Enumeration"
30+
? options.fn(this)
31+
: options.inverse(this);
32+
});
33+
}
34+
exports.default = default_1;

dist/lib/resources/helpers/if-is-table.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
2626
const Handlebars = __importStar(require("handlebars"));
2727
function default_1() {
2828
Handlebars.registerHelper("ifIsTable", function (arg1, options) {
29-
const str = arg1.name;
30-
return !str.includes("Rpc") ? options.fn(this) : options.inverse(this);
29+
const str = arg1.name.toLowerCase();
30+
return !str.includes("rpc") &&
31+
!str.startsWith("iasql") &&
32+
arg1.kindString == "Class"
33+
? options.fn(this)
34+
: options.inverse(this);
3135
});
3236
}
3337
exports.default = default_1;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { MarkdownTheme } from "../../theme";
2+
export default function (theme: MarkdownTheme): void;
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
"use strict";
2+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3+
if (k2 === undefined) k2 = k;
4+
var desc = Object.getOwnPropertyDescriptor(m, k);
5+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6+
desc = { enumerable: true, get: function() { return m[k]; } };
7+
}
8+
Object.defineProperty(o, k2, desc);
9+
}) : (function(o, m, k, k2) {
10+
if (k2 === undefined) k2 = k;
11+
o[k2] = m[k];
12+
}));
13+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14+
Object.defineProperty(o, "default", { enumerable: true, value: v });
15+
}) : function(o, v) {
16+
o["default"] = v;
17+
});
18+
var __importStar = (this && this.__importStar) || function (mod) {
19+
if (mod && mod.__esModule) return mod;
20+
var result = {};
21+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22+
__setModuleDefault(result, mod);
23+
return result;
24+
};
25+
Object.defineProperty(exports, "__esModule", { value: true });
26+
const Handlebars = __importStar(require("handlebars"));
27+
function default_1(theme) {
28+
Handlebars.registerHelper("renderType", function () {
29+
var _a;
30+
let type, color;
31+
if (this.kindString == "Class") {
32+
if ((_a = this.url) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes("rpcs")) {
33+
type = "Function";
34+
color = "95CE3D";
35+
}
36+
else {
37+
type = "Table";
38+
color = "3D95CE";
39+
}
40+
}
41+
else if (this.kindString == "Enumeration") {
42+
type = "Enum";
43+
color = "CD3C94";
44+
}
45+
return `![${type}](https://img.shields.io/static/v1?label=&message=${type}&color=${color}&style=for-the-badge)`;
46+
});
47+
}
48+
exports.default = default_1;

dist/lib/resources/helpers/toc.js

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@ function default_1(theme) {
3535
if (!hideInPageTOC) {
3636
md.push(`## Table of contents\n\n`);
3737
}
38-
for (const child of (_b = this.children) !== null && _b !== void 0 ? _b : []) {
38+
let sortedChildren = (_b = this.children) !== null && _b !== void 0 ? _b : [];
39+
sortedChildren.sort(function (x, y) {
40+
return x.name == "iasql_functions"
41+
? -1
42+
: y.name == "iasql_functions"
43+
? 1
44+
: 0;
45+
});
46+
for (const child of sortedChildren) {
3947
if (((_c = child.parent) === null || _c === void 0 ? void 0 : _c.id) == 0 &&
4048
child.kind == 2 &&
4149
!child.name.includes("/") &&
@@ -44,16 +52,36 @@ function default_1(theme) {
4452
!child.name.includes("interfaces") &&
4553
!child.name.includes("subscribers")) {
4654
md.push(`### ${child.name}\n\n`);
47-
for (const child1 of (_d = this.children) !== null && _d !== void 0 ? _d : []) {
48-
if (child1.name.includes(child.name) &&
49-
(child1.name.includes("entity") || child1.name.includes("rpc"))) {
50-
for (const child2 of (_e = child1.children) !== null && _e !== void 0 ? _e : []) {
51-
if (!((_f = child2.url) === null || _f === void 0 ? void 0 : _f.includes("modules"))) {
52-
md.push(`[${(0, utils_1.camelToSnakeCase)(child2.name)}](${child2.url})\n\n`);
53-
}
54-
}
55+
const tables = [];
56+
const methods = [];
57+
const enums = [];
58+
const filtered = sortedChildren === null || sortedChildren === void 0 ? void 0 : sortedChildren.filter((x) => x.name.includes(child.name) &&
59+
(x.name.includes("entity") || x.name.includes("rpc")));
60+
for (const filt of filtered) {
61+
for (const item of (_d = filt.children) !== null && _d !== void 0 ? _d : []) {
62+
if (item.kindString == "Class" && !((_e = item.url) === null || _e === void 0 ? void 0 : _e.includes("rpc")))
63+
tables.push(item);
64+
if (item.kindString == "Class" && ((_f = item.url) === null || _f === void 0 ? void 0 : _f.includes("rpc")))
65+
methods.push(item);
66+
if (item.kindString == "Enumeration")
67+
enums.push(item);
5568
}
5669
}
70+
if (tables.length > 0)
71+
md.push("  **Tables**\n");
72+
for (const child2 of tables) {
73+
md.push(`      [${(0, utils_1.camelToSnakeCase)(child2.name)}](${child2.url})\n\n`);
74+
}
75+
if (methods.length > 0)
76+
md.push("  **Functions**\n");
77+
for (const child2 of methods) {
78+
md.push(`      [${(0, utils_1.camelToSnakeCase)(child2.name)}](${child2.url})\n\n`);
79+
}
80+
if (enums.length > 0)
81+
md.push("  **Enums**\n");
82+
for (const child2 of enums) {
83+
md.push(`      [${(0, utils_1.camelToSnakeCase)(child2.name)}](${child2.url})\n\n`);
84+
}
5785
}
5886
}
5987
}

dist/lib/resources/helpers/type.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ function default_1() {
8080
exports.default = default_1;
8181
function getLiteralType(model) {
8282
if (typeof model.value === "bigint") {
83-
return `\`${model.value}n\``;
83+
return `${model.value}n`;
8484
}
85-
return `\`\`${JSON.stringify(model.value)}\`\``;
85+
return `\`${JSON.stringify(model.value).replace(/"/g, "")}\``;
8686
}
8787
function getReflectionType(model, collapse) {
8888
const root = model instanceof typedoc_1.ReflectionType ? model.declaration : model;

dist/lib/resources/templates/reflection.hbs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{{> header}}
22
{{> title}}
33
{{#with model}}
4+
{{renderType}}
45
{{#if hasComment}}
56
{{> comment}}
6-
77
{{/if}}
88

99
{{/with}}
@@ -13,6 +13,10 @@
1313
{{#ifIsTable this}}
1414
## Columns
1515
{{/ifIsTable}}
16+
{{#ifIsEnum this}}
17+
## Values
18+
{{/ifIsEnum}}
19+
1620

1721
{{> main}}
1822

dist/options.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const DEFAULT_PLUGIN_OPTIONS = {
1010
fullNames: false,
1111
categoryLabel: "Reference",
1212
indexLabel: undefined,
13-
readmeLabel: "SQL",
13+
readmeLabel: "Reference",
1414
position: null,
1515
autoConfiguration: true,
1616
usedSidebar: "docs",
@@ -19,7 +19,7 @@ const DEFAULT_PLUGIN_OPTIONS = {
1919
hideBreadcrumbs: true,
2020
hidePageTitle: true,
2121
hideMembersSymbol: false,
22-
entryDocument: "sql.md",
22+
entryDocument: "index.md",
2323
plugin: ["none"],
2424
watch: false,
2525
includeExtension: true,

0 commit comments

Comments
 (0)