UNPKG

@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

47 lines 1.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CoerceTreeOperationRule = CoerceTreeOperationRule; const ts_morph_1 = require("@rxap/ts-morph"); const utilities_1 = require("@rxap/utilities"); const coerce_operation_1 = require("./coerce-operation"); function CoerceTreeOperationRule(options) { const { operationName = 'tree', fullTree = false, path = 'true', propertyList = [], dtoClassNameSuffix = '-tree-node', isArray = true, } = options; (0, utilities_1.CoerceArrayItems)(propertyList, [ { name: 'id', type: 'string', }, { name: 'name', type: 'string', }, { name: 'type', type: 'string', }, { name: 'icon', type: { name: 'IconDto', moduleSpecifier: '@rxap/nest-dto' }, isType: true, }, { name: 'children', isOptional: true, isArray: true, isType: true, type: ts_morph_1.TypeNames.Self, }, ], (a, b) => a.name === b.name); if (!fullTree) { throw new Error('non full tree not implemented yet'); } return (0, coerce_operation_1.CoerceOperation)(Object.assign(Object.assign({}, options), { path, operationName, dtoClassNameSuffix, propertyList, isArray })); } //# sourceMappingURL=coerce-tree-operation.js.map