@rxap/schematics-xml-parser
Version:
This package provides utilities for parsing XML templates within Angular Schematics. It includes functionality to locate templates in a file system, parse them using a specified DOMParser, and register custom elements for parsing. The package also offers
37 lines • 1.77 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.OpenApiRemoteMethodElement = void 0;
const tslib_1 = require("tslib");
const xml_parser_1 = require("@rxap/xml-parser");
const core_1 = require("@angular-devkit/core");
const method_element_1 = require("./method.element");
const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
const { dasherize, classify, camelize, } = core_1.strings;
let OpenApiRemoteMethodElement = class OpenApiRemoteMethodElement {
toValue({ sourceFile, options, }) {
const openApiRemoteMethodName = classify(this.name) + 'RemoteMethod';
if (!options.openApiModule) {
throw new Error('The open api module is not defined!');
}
(0, schematics_ts_morph_1.CoerceImports)(sourceFile, {
namedImports: [openApiRemoteMethodName],
moduleSpecifier: `${options.openApiModule}/remote-methods/${dasherize(this.name)}.remote-method`,
});
return openApiRemoteMethodName;
}
};
exports.OpenApiRemoteMethodElement = OpenApiRemoteMethodElement;
tslib_1.__decorate([
(0, xml_parser_1.ElementTextContent)(),
(0, xml_parser_1.ElementRequired)(),
tslib_1.__metadata("design:type", String)
], OpenApiRemoteMethodElement.prototype, "name", void 0);
tslib_1.__decorate([
(0, xml_parser_1.ElementAttribute)(),
tslib_1.__metadata("design:type", Boolean)
], OpenApiRemoteMethodElement.prototype, "mock", void 0);
exports.OpenApiRemoteMethodElement = OpenApiRemoteMethodElement = tslib_1.__decorate([
(0, xml_parser_1.ElementExtends)(method_element_1.MethodElement),
(0, xml_parser_1.ElementDef)('open-api-remote-method')
], OpenApiRemoteMethodElement);
//# sourceMappingURL=open-api-remote-method.element.js.map