@rxap/schematics-ts-morph
Version:
This package provides utilities for manipulating TypeScript code using ts-morph, particularly for Angular and NestJS projects. It offers functions to add, coerce, and modify code elements like classes, methods, decorators, and imports. The package also in
30 lines • 2.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoerceTreeTableChildrenProxyRemoteMethodClass = CoerceTreeTableChildrenProxyRemoteMethodClass;
const ts_morph_1 = require("@rxap/ts-morph");
const utilities_1 = require("@rxap/utilities");
const ts_morph_2 = require("ts-morph");
const coerce_proxy_remote_method_class_1 = require("./coerce-proxy-remote-method-class");
function CoerceTreeTableChildrenProxyRemoteMethodClass(options) {
const { tsMorphTransform = utilities_1.noop, getChildrenOperationId, scope, } = options;
return (0, coerce_proxy_remote_method_class_1.CoerceProxyRemoteMethodClass)(Object.assign(Object.assign({}, options), { name: 'tree-table-children', sourceType: ts_morph_2.Writers.object({ node: 'Node<unknown>' }), targetType: `OpenApiRemoteMethodParameter<${(0, ts_morph_1.OperationIdToParameterClassName)(getChildrenOperationId)}>`, proxyMethod: (0, ts_morph_1.OperationIdToRemoteMethodClassName)(getChildrenOperationId), tsMorphTransform: (project, sourceFile, classDeclaration) => {
(0, ts_morph_1.CoerceImports)(sourceFile, {
namedImports: [(0, ts_morph_1.OperationIdToRemoteMethodClassName)(getChildrenOperationId)],
moduleSpecifier: (0, ts_morph_1.OperationIdToClassRemoteMethodImportPath)(getChildrenOperationId, scope),
});
(0, ts_morph_1.CoerceImports)(sourceFile, {
namedImports: ['Node'],
moduleSpecifier: '@rxap/data-structure-tree',
});
(0, ts_morph_1.CoerceImports)(sourceFile, {
namedImports: ['OpenApiRemoteMethodParameter'],
moduleSpecifier: '@rxap/open-api/remote-method',
});
(0, ts_morph_1.CoerceImports)(sourceFile, {
namedImports: [(0, ts_morph_1.OperationIdToParameterClassName)(getChildrenOperationId)],
moduleSpecifier: (0, ts_morph_1.OperationIdToParameterClassImportPath)(getChildrenOperationId, scope),
});
return tsMorphTransform(project, sourceFile, classDeclaration);
} }));
}
//# sourceMappingURL=coerce-tree-table-children-proxy-remote-method-class.js.map