@aws-sdk/service-client-documentation-generator
Advanced tools
Comparing version 3.183.0 to 3.186.0
@@ -6,2 +6,10 @@ # Change Log | ||
# [3.186.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.185.0...v3.186.0) (2022-10-06) | ||
**Note:** Version bump only for package @aws-sdk/service-client-documentation-generator | ||
# [3.183.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.182.0...v3.183.0) (2022-10-03) | ||
@@ -8,0 +16,0 @@ |
@@ -6,3 +6,3 @@ import { SdkClientCommentUpdatePlugin } from "./sdk-client-comment-update"; | ||
module.exports = function load(pluginHost) { | ||
const application = pluginHost.owner; | ||
var application = pluginHost.owner; | ||
application.converter.addComponent("SdkClientCommentUpdatePlugin", new SdkClientCommentUpdatePlugin(application.converter)); | ||
@@ -9,0 +9,0 @@ application.renderer.addComponent("SdkClientTocPlugin", new SdkClientTocPlugin(application.renderer)); |
@@ -1,32 +0,38 @@ | ||
import { __decorate } from "tslib"; | ||
import { __decorate, __extends } from "tslib"; | ||
import { Converter } from "typedoc/dist/lib/converter"; | ||
import { Component, ConverterComponent } from "typedoc/dist/lib/converter/components"; | ||
import { getRawComment, parseComment } from "typedoc/dist/lib/converter/factories/comment"; | ||
let SdkClientCommentUpdatePlugin = class SdkClientCommentUpdatePlugin extends ConverterComponent { | ||
initialize() { | ||
this.listenTo(this.owner, { | ||
[Converter.EVENT_CREATE_DECLARATION]: this.onDeclaration, | ||
}); | ||
var SdkClientCommentUpdatePlugin = (function (_super) { | ||
__extends(SdkClientCommentUpdatePlugin, _super); | ||
function SdkClientCommentUpdatePlugin() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
onDeclaration(context, reflection, node) { | ||
SdkClientCommentUpdatePlugin.prototype.initialize = function () { | ||
var _a; | ||
this.listenTo(this.owner, (_a = {}, | ||
_a[Converter.EVENT_CREATE_DECLARATION] = this.onDeclaration, | ||
_a)); | ||
}; | ||
SdkClientCommentUpdatePlugin.prototype.onDeclaration = function (context, reflection, node) { | ||
if (!node) | ||
return; | ||
const rawComment = getRawComment(node); | ||
var rawComment = getRawComment(node); | ||
if (!rawComment) | ||
return; | ||
const comment = parseComment(this.cleanEmptyCommentLines(rawComment)); | ||
var comment = parseComment(this.cleanEmptyCommentLines(rawComment)); | ||
reflection.comment = comment; | ||
} | ||
cleanEmptyCommentLines(comment) { | ||
}; | ||
SdkClientCommentUpdatePlugin.prototype.cleanEmptyCommentLines = function (comment) { | ||
return comment.startsWith("/*") && comment.endsWith("*/") | ||
? comment | ||
.split("\n") | ||
.filter((line) => line.slice(line.indexOf("*") + 1).trim().length !== 0) | ||
.filter(function (line) { return line.slice(line.indexOf("*") + 1).trim().length !== 0; }) | ||
.join("\n") | ||
: comment; | ||
} | ||
}; | ||
SdkClientCommentUpdatePlugin = __decorate([ | ||
Component({ name: "SdkClientCommentUpdatePlugin" }) | ||
], SdkClientCommentUpdatePlugin); | ||
}; | ||
SdkClientCommentUpdatePlugin = __decorate([ | ||
Component({ name: "SdkClientCommentUpdatePlugin" }) | ||
], SdkClientCommentUpdatePlugin); | ||
return SdkClientCommentUpdatePlugin; | ||
}(ConverterComponent)); | ||
export { SdkClientCommentUpdatePlugin }; |
@@ -1,13 +0,18 @@ | ||
import { __decorate } from "tslib"; | ||
import { __decorate, __extends } from "tslib"; | ||
import { Component, RendererComponent } from "typedoc/dist/lib/output/components"; | ||
import { RendererEvent } from "typedoc/dist/lib/output/events"; | ||
let SdkClientRemoveNavigatorPlugin = class SdkClientRemoveNavigatorPlugin extends RendererComponent { | ||
initialize() { | ||
var SdkClientRemoveNavigatorPlugin = (function (_super) { | ||
__extends(SdkClientRemoveNavigatorPlugin, _super); | ||
function SdkClientRemoveNavigatorPlugin() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
SdkClientRemoveNavigatorPlugin.prototype.initialize = function () { | ||
var _a; | ||
this.navigationPlugin = this.owner.application.renderer.getComponent("navigation"); | ||
this.listenTo(this.owner, { | ||
[RendererEvent.BEGIN]: this.onRenderedBegin, | ||
}); | ||
} | ||
onRenderedBegin(event) { | ||
const navigationItem = this.navigationPlugin.navigation; | ||
this.listenTo(this.owner, (_a = {}, | ||
_a[RendererEvent.BEGIN] = this.onRenderedBegin, | ||
_a)); | ||
}; | ||
SdkClientRemoveNavigatorPlugin.prototype.onRenderedBegin = function (event) { | ||
var navigationItem = this.navigationPlugin.navigation; | ||
if (!navigationItem) { | ||
@@ -17,7 +22,8 @@ return; | ||
navigationItem.children = []; | ||
} | ||
}; | ||
SdkClientRemoveNavigatorPlugin = __decorate([ | ||
Component({ name: "SdkClientRemoveNavigator" }) | ||
], SdkClientRemoveNavigatorPlugin); | ||
}; | ||
SdkClientRemoveNavigatorPlugin = __decorate([ | ||
Component({ name: "SdkClientRemoveNavigator" }) | ||
], SdkClientRemoveNavigatorPlugin); | ||
return SdkClientRemoveNavigatorPlugin; | ||
}(RendererComponent)); | ||
export { SdkClientRemoveNavigatorPlugin }; |
@@ -1,2 +0,2 @@ | ||
import { __decorate } from "tslib"; | ||
import { __decorate, __extends } from "tslib"; | ||
import { readFileSync } from "fs"; | ||
@@ -6,30 +6,35 @@ import { Component, RendererComponent } from "typedoc/dist/lib/output/components"; | ||
import { getCurrentClientDirectory } from "./utils"; | ||
let SdkClientRenameProjectPlugin = class SdkClientRenameProjectPlugin extends RendererComponent { | ||
constructor() { | ||
super(...arguments); | ||
this.projectName = undefined; | ||
var SdkClientRenameProjectPlugin = (function (_super) { | ||
__extends(SdkClientRenameProjectPlugin, _super); | ||
function SdkClientRenameProjectPlugin() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.projectName = undefined; | ||
return _this; | ||
} | ||
initialize() { | ||
this.listenTo(this.owner, { | ||
[RendererEvent.BEGIN]: this.onRenderedBegin, | ||
}); | ||
} | ||
onRenderedBegin(event) { | ||
SdkClientRenameProjectPlugin.prototype.initialize = function () { | ||
var _a; | ||
this.listenTo(this.owner, (_a = {}, | ||
_a[RendererEvent.BEGIN] = this.onRenderedBegin, | ||
_a)); | ||
}; | ||
SdkClientRenameProjectPlugin.prototype.onRenderedBegin = function (event) { | ||
var _a, _b, _c, _d, _e; | ||
if (!this.projectName) { | ||
const clientDirectory = getCurrentClientDirectory(event); | ||
const metadataDir = clientDirectory.files.filter((sourceFile) => sourceFile.fileName.endsWith("/package.json"))?.[0]?.fullFileName; | ||
const { name } = metadataDir || JSON.parse(readFileSync(metadataDir).toString()); | ||
const serviceIdReflection = clientDirectory.directories.src.files | ||
?.filter((sourceFile) => sourceFile.fileName.endsWith("/runtimeConfig.shared.ts"))?.[0] | ||
.reflections.filter((reflection) => reflection.name === "serviceId")?.[0]; | ||
var clientDirectory = getCurrentClientDirectory(event); | ||
var metadataDir = (_b = (_a = clientDirectory.files.filter(function (sourceFile) { | ||
return sourceFile.fileName.endsWith("/package.json"); | ||
})) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.fullFileName; | ||
var name_1 = (metadataDir || JSON.parse(readFileSync(metadataDir).toString())).name; | ||
var serviceIdReflection = (_e = (_d = (_c = clientDirectory.directories.src.files) === null || _c === void 0 ? void 0 : _c.filter(function (sourceFile) { return sourceFile.fileName.endsWith("/runtimeConfig.shared.ts"); })) === null || _d === void 0 ? void 0 : _d[0].reflections.filter(function (reflection) { return reflection.name === "serviceId"; })) === null || _e === void 0 ? void 0 : _e[0]; | ||
this.projectName = serviceIdReflection | ||
? `${serviceIdReflection.defaultValue.match(/"(.*)"/)[1]} Client - AWS SDK for JavaScript v3` | ||
: name; | ||
? "".concat(serviceIdReflection.defaultValue.match(/"(.*)"/)[1], " Client - AWS SDK for JavaScript v3") | ||
: name_1; | ||
} | ||
event.project.name = this.projectName; | ||
} | ||
}; | ||
SdkClientRenameProjectPlugin = __decorate([ | ||
Component({ name: "SdkClientRenameProject" }) | ||
], SdkClientRenameProjectPlugin); | ||
}; | ||
SdkClientRenameProjectPlugin = __decorate([ | ||
Component({ name: "SdkClientRenameProject" }) | ||
], SdkClientRenameProjectPlugin); | ||
return SdkClientRenameProjectPlugin; | ||
}(RendererComponent)); | ||
export { SdkClientRenameProjectPlugin }; |
@@ -1,2 +0,2 @@ | ||
import { __decorate } from "tslib"; | ||
import { __decorate, __extends } from "tslib"; | ||
import { dirname } from "path"; | ||
@@ -8,16 +8,21 @@ import { ReflectionKind, } from "typedoc/dist/lib/models/reflections"; | ||
import { getCurrentClientDirectory } from "./utils"; | ||
let SdkClientTocPlugin = class SdkClientTocPlugin extends RendererComponent { | ||
initialize() { | ||
const tocPlugin = this.owner.application.renderer.getComponent("toc"); | ||
var SdkClientTocPlugin = (function (_super) { | ||
__extends(SdkClientTocPlugin, _super); | ||
function SdkClientTocPlugin() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
SdkClientTocPlugin.prototype.initialize = function () { | ||
var _a; | ||
var tocPlugin = this.owner.application.renderer.getComponent("toc"); | ||
this.owner.off(PageEvent.BEGIN, tocPlugin.onRendererBeginPage); | ||
this.listenTo(this.owner, { | ||
[PageEvent.BEGIN]: this.onRendererBeginPage, | ||
}); | ||
} | ||
onRendererBeginPage(page) { | ||
let model = page.model; | ||
this.listenTo(this.owner, (_a = {}, | ||
_a[PageEvent.BEGIN] = this.onRendererBeginPage, | ||
_a)); | ||
}; | ||
SdkClientTocPlugin.prototype.onRendererBeginPage = function (page) { | ||
var model = page.model; | ||
if (!model.constructor.name.endsWith("Reflection")) { | ||
return; | ||
} | ||
const trail = []; | ||
var trail = []; | ||
while (model.constructor.name !== "ProjectReflection" && !model.kindOf(ReflectionKind.SomeModule)) { | ||
@@ -27,3 +32,3 @@ trail.unshift(model); | ||
} | ||
const tocRestriction = this.owner.toc; | ||
var tocRestriction = this.owner.toc; | ||
page.toc = new NavigationItem(model.name); | ||
@@ -37,38 +42,41 @@ if (!model.parent && !trail.length) { | ||
this.buildToc(model, trail, page.toc, tocRestriction); | ||
} | ||
belongsToClientPackage(model) { | ||
return this.clientDir && model.sources?.[0].file?.fullFileName.indexOf(this.clientDir) === 0; | ||
} | ||
isClient(model) { | ||
const { extendedTypes = [] } = model; | ||
}; | ||
SdkClientTocPlugin.prototype.belongsToClientPackage = function (model) { | ||
var _a, _b; | ||
return this.clientDir && ((_b = (_a = model.sources) === null || _a === void 0 ? void 0 : _a[0].file) === null || _b === void 0 ? void 0 : _b.fullFileName.indexOf(this.clientDir)) === 0; | ||
}; | ||
SdkClientTocPlugin.prototype.isClient = function (model) { | ||
var _a = model.extendedTypes, extendedTypes = _a === void 0 ? [] : _a; | ||
return (model.kindOf(ReflectionKind.Class) && | ||
model.getFullName() !== "Client" && | ||
(model.name.endsWith("Client") || | ||
extendedTypes.filter((reference) => reference.name === `${model.name}Client`).length > 0) && | ||
extendedTypes.filter(function (reference) { return reference.name === "".concat(model.name, "Client"); }).length > 0) && | ||
this.belongsToClientPackage(model)); | ||
} | ||
isCommand(model) { | ||
}; | ||
SdkClientTocPlugin.prototype.isCommand = function (model) { | ||
return (model.kindOf(ReflectionKind.Class) && | ||
model.name.endsWith("Command") && | ||
this.belongsToClientPackage(model)); | ||
} | ||
isPaginator(model) { | ||
}; | ||
SdkClientTocPlugin.prototype.isPaginator = function (model) { | ||
return (model.name.startsWith("paginate") && model.kindOf(ReflectionKind.Function) && this.belongsToClientPackage(model)); | ||
} | ||
isInputOrOutput(model) { | ||
}; | ||
SdkClientTocPlugin.prototype.isInputOrOutput = function (model) { | ||
return (model.kindOf(ReflectionKind.Interface) && | ||
(model.name.endsWith("CommandInput") || model.name.endsWith("CommandOutput")) && | ||
this.belongsToClientPackage(model)); | ||
} | ||
isWaiter(model) { | ||
}; | ||
SdkClientTocPlugin.prototype.isWaiter = function (model) { | ||
return (model.name.startsWith("waitFor") && model.kindOf(ReflectionKind.Function) && this.belongsToClientPackage(model)); | ||
} | ||
buildToc(model, trail, parent, restriction) { | ||
const index = trail.indexOf(model); | ||
const children = model["children"] || []; | ||
}; | ||
SdkClientTocPlugin.prototype.buildToc = function (model, trail, parent, restriction) { | ||
var _this = this; | ||
var _a; | ||
var index = trail.indexOf(model); | ||
var children = model["children"] || []; | ||
if (!this.clientDir) | ||
this.clientDir = this.loadClientDir(model); | ||
if (index < trail.length - 1 && children.length > 40) { | ||
const child = trail[index + 1]; | ||
const item = NavigationItem.create(child, parent, true); | ||
var child = trail[index + 1]; | ||
var item = NavigationItem.create(child, parent, true); | ||
item.isInPath = true; | ||
@@ -79,3 +87,3 @@ item.isCurrent = false; | ||
else { | ||
children.forEach((child) => { | ||
children.forEach(function (child) { | ||
if (restriction && restriction.length > 0 && !restriction.includes(child.name)) { | ||
@@ -87,41 +95,42 @@ return; | ||
} | ||
if (this.isClient(child)) { | ||
NavigationItem.create(child, this.clientsNavigationItem, true); | ||
if (_this.isClient(child)) { | ||
NavigationItem.create(child, _this.clientsNavigationItem, true); | ||
} | ||
else if (this.isCommand(child)) { | ||
NavigationItem.create(child, this.commandsNavigationItem, true); | ||
else if (_this.isCommand(child)) { | ||
NavigationItem.create(child, _this.commandsNavigationItem, true); | ||
} | ||
else if (this.isPaginator(child)) { | ||
NavigationItem.create(child, this.paginatorsNavigationItem, true); | ||
else if (_this.isPaginator(child)) { | ||
NavigationItem.create(child, _this.paginatorsNavigationItem, true); | ||
} | ||
else if (this.isInputOrOutput(child)) { | ||
NavigationItem.create(child, this.commandsNavigationItem, true); | ||
else if (_this.isInputOrOutput(child)) { | ||
NavigationItem.create(child, _this.commandsNavigationItem, true); | ||
} | ||
else if (this.isWaiter(child)) { | ||
NavigationItem.create(child, this.waitersNavigationItem, true); | ||
else if (_this.isWaiter(child)) { | ||
NavigationItem.create(child, _this.waitersNavigationItem, true); | ||
} | ||
else { | ||
const item = NavigationItem.create(child, parent, true); | ||
var item = NavigationItem.create(child, parent, true); | ||
if (trail.includes(child)) { | ||
item.isInPath = true; | ||
item.isCurrent = trail[trail.length - 1] === child; | ||
this.buildToc(child, trail, item); | ||
_this.buildToc(child, trail, item); | ||
} | ||
} | ||
}); | ||
this.commandsNavigationItem?.children.sort((childA, childB) => childA.title.localeCompare(childB.title)); | ||
(_a = this.commandsNavigationItem) === null || _a === void 0 ? void 0 : _a.children.sort(function (childA, childB) { return childA.title.localeCompare(childB.title); }); | ||
} | ||
} | ||
loadClientDir(model) { | ||
let projectModel = model; | ||
}; | ||
SdkClientTocPlugin.prototype.loadClientDir = function (model) { | ||
var projectModel = model; | ||
while (projectModel.constructor.name !== "ProjectReflection" && !projectModel.kindOf(ReflectionKind.SomeModule)) { | ||
projectModel = projectModel.parent; | ||
} | ||
const clientsDirectory = getCurrentClientDirectory({ project: projectModel }); | ||
return dirname(dirname(clientsDirectory?.directories.src.files.find((file) => file.name.endsWith("Client.ts")).fullFileName)); | ||
} | ||
}; | ||
SdkClientTocPlugin = __decorate([ | ||
Component({ name: "SdkClientTocPlugin" }) | ||
], SdkClientTocPlugin); | ||
var clientsDirectory = getCurrentClientDirectory({ project: projectModel }); | ||
return dirname(dirname(clientsDirectory === null || clientsDirectory === void 0 ? void 0 : clientsDirectory.directories.src.files.find(function (file) { return file.name.endsWith("Client.ts"); }).fullFileName)); | ||
}; | ||
SdkClientTocPlugin = __decorate([ | ||
Component({ name: "SdkClientTocPlugin" }) | ||
], SdkClientTocPlugin); | ||
return SdkClientTocPlugin; | ||
}(RendererComponent)); | ||
export { SdkClientTocPlugin }; |
@@ -1,4 +0,4 @@ | ||
export const getCurrentClientDirectory = (event) => { | ||
const clientsDirectory = event.project.directory.directories["clients"].directories; | ||
return Object.values(clientsDirectory).filter((directory) => directory?.directories?.src)[0]; | ||
export var getCurrentClientDirectory = function (event) { | ||
var clientsDirectory = event.project.directory.directories["clients"].directories; | ||
return Object.values(clientsDirectory).filter(function (directory) { var _a; return (_a = directory === null || directory === void 0 ? void 0 : directory.directories) === null || _a === void 0 ? void 0 : _a.src; })[0]; | ||
}; |
{ | ||
"name": "@aws-sdk/service-client-documentation-generator", | ||
"version": "3.183.0", | ||
"version": "3.186.0", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", |
63368
616