@rxap/schematics-ts-morph 16.0.0-dev.4 → 16.0.0-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +1 -1
- package/package.json +20 -6
- package/src/index.d.ts +140 -4
- package/src/index.js +150 -4
- package/src/index.js.map +1 -1
- package/src/lib/add-dir.js.map +1 -1
- package/src/lib/add-fake-provider.js +3 -3
- package/src/lib/add-fake-provider.js.map +1 -1
- package/src/lib/add-method-class.d.ts +1 -0
- package/src/lib/add-method-class.js +12 -4
- package/src/lib/add-method-class.js.map +1 -1
- package/src/lib/add-variable-provider.js +3 -3
- package/src/lib/add-variable-provider.js.map +1 -1
- package/src/lib/{add-component-animations.js → angular/add-component-animations.js} +3 -3
- package/src/lib/angular/add-component-animations.js.map +1 -0
- package/src/lib/{add-component-fake-provider.d.ts → angular/add-component-fake-provider.d.ts} +1 -1
- package/src/lib/{add-component-fake-provider.js → angular/add-component-fake-provider.js} +1 -1
- package/src/lib/angular/add-component-fake-provider.js.map +1 -0
- package/src/lib/angular/add-component-import.d.ts +2 -0
- package/src/lib/angular/add-component-import.js +21 -0
- package/src/lib/angular/add-component-import.js.map +1 -0
- package/src/lib/{add-component-input.js → angular/add-component-input.js} +4 -4
- package/src/lib/angular/add-component-input.js.map +1 -0
- package/src/lib/{add-component-provider.d.ts → angular/add-component-provider.d.ts} +1 -1
- package/src/lib/{add-component-provider.js → angular/add-component-provider.js} +4 -4
- package/src/lib/angular/add-component-provider.js.map +1 -0
- package/src/lib/angular/add-control-validator.js.map +1 -0
- package/src/lib/{add-dependency-injection.js → angular/add-dependency-injection.js} +5 -5
- package/src/lib/angular/add-dependency-injection.js.map +1 -0
- package/src/lib/angular/add-ng-module-export.d.ts +2 -0
- package/src/lib/angular/add-ng-module-export.js +21 -0
- package/src/lib/angular/add-ng-module-export.js.map +1 -0
- package/src/lib/{add-ng-module-import.js → angular/add-ng-module-import.js} +3 -3
- package/src/lib/angular/add-ng-module-import.js.map +1 -0
- package/src/lib/{add-ng-module-provider.d.ts → angular/add-ng-module-provider.d.ts} +1 -1
- package/src/lib/{add-ng-module-provider.js → angular/add-ng-module-provider.js} +4 -4
- package/src/lib/angular/add-ng-module-provider.js.map +1 -0
- package/src/lib/angular/build-angular-base-path.d.ts +2 -2
- package/src/lib/angular/build-angular-base-path.js +6 -1
- package/src/lib/angular/build-angular-base-path.js.map +1 -1
- package/src/lib/angular/coerce-accordion-component.d.ts +1 -1
- package/src/lib/angular/coerce-accordion-component.js +3 -3
- package/src/lib/angular/coerce-accordion-component.js.map +1 -1
- package/src/lib/angular/coerce-component-class.d.ts +1 -1
- package/src/lib/angular/coerce-component-class.js +7 -8
- package/src/lib/angular/coerce-component-class.js.map +1 -1
- package/src/lib/angular/coerce-component.d.ts +9 -9
- package/src/lib/angular/coerce-component.js +57 -18
- package/src/lib/angular/coerce-component.js.map +1 -1
- package/src/lib/angular/coerce-data-source-class.d.ts +17 -6
- package/src/lib/angular/coerce-data-source-class.js +51 -15
- package/src/lib/angular/coerce-data-source-class.js.map +1 -1
- package/src/lib/angular/coerce-dialog-component.d.ts +14 -0
- package/src/lib/angular/coerce-dialog-component.js +84 -0
- package/src/lib/angular/coerce-dialog-component.js.map +1 -0
- package/src/lib/angular/coerce-dialog-table-action-component.d.ts +8 -0
- package/src/lib/angular/coerce-dialog-table-action-component.js +102 -0
- package/src/lib/angular/coerce-dialog-table-action-component.js.map +1 -0
- package/src/lib/angular/coerce-dialog-table-action.d.ts +3 -0
- package/src/lib/angular/coerce-dialog-table-action.js +39 -0
- package/src/lib/angular/coerce-dialog-table-action.js.map +1 -0
- package/src/lib/angular/coerce-form-builder-provider.d.ts +2 -2
- package/src/lib/angular/coerce-form-builder-provider.js +4 -4
- package/src/lib/angular/coerce-form-builder-provider.js.map +1 -1
- package/src/lib/angular/coerce-form-component-provider.d.ts +2 -2
- package/src/lib/angular/coerce-form-component-provider.js +4 -4
- package/src/lib/angular/coerce-form-component-provider.js.map +1 -1
- package/src/lib/angular/coerce-form-definition-control.d.ts +20 -0
- package/src/lib/angular/coerce-form-definition-control.js +141 -0
- package/src/lib/angular/coerce-form-definition-control.js.map +1 -0
- package/src/lib/angular/coerce-form-definition-type.d.ts +10 -0
- package/src/lib/angular/coerce-form-definition-type.js +30 -0
- package/src/lib/angular/coerce-form-definition-type.js.map +1 -0
- package/src/lib/angular/coerce-form-definition.d.ts +4 -10
- package/src/lib/angular/coerce-form-definition.js +58 -76
- package/src/lib/angular/coerce-form-definition.js.map +1 -1
- package/src/lib/angular/coerce-form-provider.d.ts +2 -2
- package/src/lib/angular/coerce-form-provider.js +4 -4
- package/src/lib/angular/coerce-form-provider.js.map +1 -1
- package/src/lib/angular/coerce-form-providers-file.d.ts +2 -2
- package/src/lib/angular/coerce-form-providers-file.js +7 -7
- package/src/lib/angular/coerce-form-providers-file.js.map +1 -1
- package/src/lib/angular/coerce-form-table-action.d.ts +1 -0
- package/src/lib/angular/coerce-form-table-action.js +11 -11
- package/src/lib/angular/coerce-form-table-action.js.map +1 -1
- package/src/lib/angular/coerce-method-class.d.ts +4 -6
- package/src/lib/angular/coerce-method-class.js +12 -17
- package/src/lib/angular/coerce-method-class.js.map +1 -1
- package/src/lib/angular/coerce-navigation-table-action.d.ts +1 -1
- package/src/lib/angular/coerce-navigation-table-action.js +4 -4
- package/src/lib/angular/coerce-navigation-table-action.js.map +1 -1
- package/src/lib/angular/coerce-operation-table-action.d.ts +1 -0
- package/src/lib/angular/coerce-operation-table-action.js +8 -8
- package/src/lib/angular/coerce-operation-table-action.js.map +1 -1
- package/src/lib/angular/coerce-options-data-source.d.ts +6 -0
- package/src/lib/angular/coerce-options-data-source.js +47 -0
- package/src/lib/angular/coerce-options-data-source.js.map +1 -0
- package/src/lib/angular/coerce-project-feature.d.ts +2 -4
- package/src/lib/angular/coerce-project-feature.js +20 -6
- package/src/lib/angular/coerce-project-feature.js.map +1 -1
- package/src/lib/angular/coerce-proxy-remote-method-class.d.ts +3 -5
- package/src/lib/angular/coerce-proxy-remote-method-class.js +10 -7
- package/src/lib/angular/coerce-proxy-remote-method-class.js.map +1 -1
- package/src/lib/angular/coerce-table-action-index-provider.js +4 -6
- package/src/lib/angular/coerce-table-action-index-provider.js.map +1 -1
- package/src/lib/angular/coerce-table-action-index.js +2 -2
- package/src/lib/angular/coerce-table-action-index.js.map +1 -1
- package/src/lib/angular/coerce-table-action-provider.d.ts +3 -3
- package/src/lib/angular/coerce-table-action-provider.js +8 -8
- package/src/lib/angular/coerce-table-action-provider.js.map +1 -1
- package/src/lib/angular/coerce-table-action.d.ts +6 -6
- package/src/lib/angular/coerce-table-action.js +8 -7
- package/src/lib/angular/coerce-table-action.js.map +1 -1
- package/src/lib/angular/coerce-table-data-source.d.ts +9 -0
- package/src/lib/angular/coerce-table-data-source.js +50 -0
- package/src/lib/angular/coerce-table-data-source.js.map +1 -0
- package/src/lib/angular/coerce-table-parameters-from-route.js +5 -5
- package/src/lib/angular/coerce-table-parameters-from-route.js.map +1 -1
- package/src/lib/angular/coerce-table-select-resolve-value-method.d.ts +6 -0
- package/src/lib/angular/coerce-table-select-resolve-value-method.js +31 -0
- package/src/lib/angular/coerce-table-select-resolve-value-method.js.map +1 -0
- package/src/lib/angular/coerce-tree-table-children-proxy-remote-method-class.d.ts +1 -0
- package/src/lib/angular/coerce-tree-table-children-proxy-remote-method-class.js +6 -6
- package/src/lib/angular/coerce-tree-table-children-proxy-remote-method-class.js.map +1 -1
- package/src/lib/angular/coerce-tree-table-root-proxy-remote-method-class.d.ts +1 -0
- package/src/lib/angular/coerce-tree-table-root-proxy-remote-method-class.js +6 -6
- package/src/lib/angular/coerce-tree-table-root-proxy-remote-method-class.js.map +1 -1
- package/src/lib/angular/enforce-use-form-control-order.d.ts +5 -0
- package/src/lib/angular/enforce-use-form-control-order.js +33 -0
- package/src/lib/angular/enforce-use-form-control-order.js.map +1 -0
- package/src/lib/angular/find-component-module-source-file.js.map +1 -0
- package/src/lib/angular/find-component-source-file.js.map +1 -0
- package/src/lib/angular/find-routing-module.js.map +1 -0
- package/src/lib/angular/form-definition-utilities.d.ts +13 -0
- package/src/lib/angular/form-definition-utilities.js +29 -0
- package/src/lib/angular/form-definition-utilities.js.map +1 -0
- package/src/lib/angular/get-component-class.js.map +1 -0
- package/src/lib/angular/get-component-options-object.js.map +1 -0
- package/src/lib/angular/get-ng-module-options-object.js.map +1 -0
- package/src/lib/{handle-component-module.d.ts → angular/handle-component-module.d.ts} +1 -1
- package/src/lib/angular/handle-component-module.js.map +1 -0
- package/src/lib/{handle-component.d.ts → angular/handle-component.d.ts} +1 -1
- package/src/lib/angular/handle-component.js.map +1 -0
- package/src/lib/angular/has-accordion-component.d.ts +4 -3
- package/src/lib/angular/has-accordion-component.js +6 -1
- package/src/lib/angular/has-accordion-component.js.map +1 -1
- package/src/lib/angular/has-component.d.ts +2 -2
- package/src/lib/angular/has-component.js +2 -2
- package/src/lib/angular/has-component.js.map +1 -1
- package/src/lib/angular/has-dialog-component.d.ts +5 -0
- package/src/lib/angular/has-dialog-component.js +17 -0
- package/src/lib/angular/has-dialog-component.js.map +1 -0
- package/src/lib/angular/has-project-feature.d.ts +4 -3
- package/src/lib/angular/has-project-feature.js +5 -1
- package/src/lib/angular/has-project-feature.js.map +1 -1
- package/src/lib/angular/has-table-component.d.ts +2 -5
- package/src/lib/angular/has-table-component.js +5 -2
- package/src/lib/angular/has-table-component.js.map +1 -1
- package/src/lib/coerce-variable-declaration.d.ts +2 -2
- package/src/lib/coerce-variable-declaration.js +6 -3
- package/src/lib/coerce-variable-declaration.js.map +1 -1
- package/src/lib/get-form-providers-source-file.js +2 -2
- package/src/lib/get-form-providers-source-file.js.map +1 -1
- package/src/lib/nest/add-nest-controller.js +2 -2
- package/src/lib/nest/add-nest-controller.js.map +1 -1
- package/src/lib/nest/add-nest-module-controller.js +2 -2
- package/src/lib/nest/add-nest-module-controller.js.map +1 -1
- package/src/lib/nest/add-nest-module-import.js +2 -2
- package/src/lib/nest/add-nest-module-import.js.map +1 -1
- package/src/lib/nest/add-nest-module-provider.js +2 -2
- package/src/lib/nest/add-nest-module-provider.js.map +1 -1
- package/src/lib/nest/add-nest-module-to-app-module.d.ts +3 -4
- package/src/lib/nest/add-nest-module-to-app-module.js +15 -5
- package/src/lib/nest/add-nest-module-to-app-module.js.map +1 -1
- package/src/lib/{add-operation-to-controller.d.ts → nest/add-operation-to-controller.d.ts} +6 -2
- package/src/lib/{add-operation-to-controller.js → nest/add-operation-to-controller.js} +30 -11
- package/src/lib/nest/add-operation-to-controller.js.map +1 -0
- package/src/lib/nest/assert-nest-project.d.ts +7 -0
- package/src/lib/nest/assert-nest-project.js +15 -0
- package/src/lib/nest/assert-nest-project.js.map +1 -0
- package/src/lib/nest/build-nest-base-path.d.ts +2 -2
- package/src/lib/nest/build-nest-controller-name.d.ts +0 -3
- package/src/lib/nest/build-nest-controller-name.js +4 -7
- package/src/lib/nest/build-nest-controller-name.js.map +1 -1
- package/src/lib/nest/coerce-dto-class.d.ts +17 -3
- package/src/lib/nest/coerce-dto-class.js +72 -77
- package/src/lib/nest/coerce-dto-class.js.map +1 -1
- package/src/lib/nest/coerce-form-submit-operation.d.ts +2 -1
- package/src/lib/nest/coerce-form-submit-operation.js +11 -6
- package/src/lib/nest/coerce-form-submit-operation.js.map +1 -1
- package/src/lib/nest/coerce-get-by-id-operation.d.ts +3 -13
- package/src/lib/nest/coerce-get-by-id-operation.js +10 -14
- package/src/lib/nest/coerce-get-by-id-operation.js.map +1 -1
- package/src/lib/nest/coerce-get-children-operation.js +27 -32
- package/src/lib/nest/coerce-get-children-operation.js.map +1 -1
- package/src/lib/nest/coerce-get-data-grid-operation.d.ts +1 -1
- package/src/lib/nest/coerce-get-data-grid-operation.js +10 -14
- package/src/lib/nest/coerce-get-data-grid-operation.js.map +1 -1
- package/src/lib/nest/coerce-get-page-operation.d.ts +34 -5
- package/src/lib/nest/coerce-get-page-operation.js +140 -47
- package/src/lib/nest/coerce-get-page-operation.js.map +1 -1
- package/src/lib/nest/coerce-get-root-operation.js +27 -31
- package/src/lib/nest/coerce-get-root-operation.js.map +1 -1
- package/src/lib/nest/coerce-nest-controller.d.ts +8 -5
- package/src/lib/nest/coerce-nest-controller.js +63 -22
- package/src/lib/nest/coerce-nest-controller.js.map +1 -1
- package/src/lib/nest/coerce-nest-module.d.ts +4 -4
- package/src/lib/nest/coerce-nest-module.js +44 -18
- package/src/lib/nest/coerce-nest-module.js.map +1 -1
- package/src/lib/nest/coerce-nest-service-project.d.ts +4 -1
- package/src/lib/nest/coerce-nest-service-project.js +8 -5
- package/src/lib/nest/coerce-nest-service-project.js.map +1 -1
- package/src/lib/nest/coerce-operation.d.ts +11 -15
- package/src/lib/nest/coerce-operation.js +47 -32
- package/src/lib/nest/coerce-operation.js.map +1 -1
- package/src/lib/nest/coerce-options-operation.d.ts +8 -0
- package/src/lib/nest/coerce-options-operation.js +52 -0
- package/src/lib/nest/coerce-options-operation.js.map +1 -0
- package/src/lib/nest/coerce-page-dto-class.d.ts +1 -1
- package/src/lib/nest/coerce-page-dto-class.js +9 -3
- package/src/lib/nest/coerce-page-dto-class.js.map +1 -1
- package/src/lib/nest/coerce-row-dto-class.d.ts +7 -8
- package/src/lib/nest/coerce-row-dto-class.js +11 -12
- package/src/lib/nest/coerce-row-dto-class.js.map +1 -1
- package/src/lib/nest/coerce-submit-data-grid-operation.js +2 -10
- package/src/lib/nest/coerce-submit-data-grid-operation.js.map +1 -1
- package/src/lib/nest/coerce-table-select-operation.d.ts +6 -0
- package/src/lib/nest/coerce-table-select-operation.js +24 -0
- package/src/lib/nest/coerce-table-select-operation.js.map +1 -0
- package/src/lib/nest/coerce-table-select-value-resolve-operation.d.ts +8 -0
- package/src/lib/nest/coerce-table-select-value-resolve-operation.js +40 -0
- package/src/lib/nest/coerce-table-select-value-resolve-operation.js.map +1 -0
- package/src/lib/nest/coerce-tree-operation.d.ts +6 -0
- package/src/lib/nest/coerce-tree-operation.js +56 -0
- package/src/lib/nest/coerce-tree-operation.js.map +1 -0
- package/src/lib/{create-dto-class.d.ts → nest/create-dto-class.d.ts} +9 -0
- package/src/lib/{create-dto-class.js → nest/create-dto-class.js} +18 -14
- package/src/lib/nest/create-dto-class.js.map +1 -0
- package/src/lib/nest/has-nest-controller.d.ts +2 -3
- package/src/lib/nest/has-nest-controller.js +1 -2
- package/src/lib/nest/has-nest-controller.js.map +1 -1
- package/src/lib/nest/has-nest-module.d.ts +1 -1
- package/src/lib/{operation-id-utilities.d.ts → nest/operation-id-utilities.d.ts} +8 -6
- package/src/lib/nest/operation-id-utilities.js +104 -0
- package/src/lib/nest/operation-id-utilities.js.map +1 -0
- package/src/lib/nest/project-utilities.d.ts +8 -6
- package/src/lib/nest/project-utilities.js.map +1 -1
- package/src/lib/nest/remove-nest-module-provider.d.ts +3 -0
- package/src/lib/nest/remove-nest-module-provider.js +13 -0
- package/src/lib/nest/remove-nest-module-provider.js.map +1 -0
- package/src/lib/nest/remove-nest-provider-to-array.d.ts +3 -0
- package/src/lib/nest/remove-nest-provider-to-array.js +29 -0
- package/src/lib/nest/remove-nest-provider-to-array.js.map +1 -0
- package/src/lib/ts-morph/apply-ts-morph-project.d.ts +1 -1
- package/src/lib/ts-morph/apply-ts-morph-project.js +5 -67
- package/src/lib/ts-morph/apply-ts-morph-project.js.map +1 -1
- package/src/lib/ts-morph/coerce-interface.d.ts +9 -2
- package/src/lib/ts-morph/coerce-interface.js +20 -5
- package/src/lib/ts-morph/coerce-interface.js.map +1 -1
- package/src/lib/ts-morph/coerce-type-alias.d.ts +4 -0
- package/src/lib/ts-morph/coerce-type-alias.js +12 -0
- package/src/lib/ts-morph/coerce-type-alias.js.map +1 -0
- package/src/lib/ts-morph/write-type.d.ts +5 -0
- package/src/lib/ts-morph/write-type.js +34 -0
- package/src/lib/ts-morph/write-type.js.map +1 -0
- package/src/lib/ts-morph-transform.d.ts +27 -14
- package/src/lib/ts-morph-transform.js +11 -40
- package/src/lib/ts-morph-transform.js.map +1 -1
- package/src/lib/types/form-definition-control.d.ts +9 -0
- package/src/lib/types/form-definition-control.js +3 -0
- package/src/lib/types/form-definition-control.js.map +1 -0
- package/src/lib/add-component-animations.js.map +0 -1
- package/src/lib/add-component-fake-provider.js.map +0 -1
- package/src/lib/add-component-input.js.map +0 -1
- package/src/lib/add-component-provider.js.map +0 -1
- package/src/lib/add-control-validator.js.map +0 -1
- package/src/lib/add-dependency-injection.js.map +0 -1
- package/src/lib/add-ng-module-import.js.map +0 -1
- package/src/lib/add-ng-module-provider.js.map +0 -1
- package/src/lib/add-operation-to-controller.js.map +0 -1
- package/src/lib/create-dto-class.js.map +0 -1
- package/src/lib/find-component-module-source-file.js.map +0 -1
- package/src/lib/find-component-source-file.js.map +0 -1
- package/src/lib/find-routing-module.js.map +0 -1
- package/src/lib/get-component-class.js.map +0 -1
- package/src/lib/get-component-options-object.js.map +0 -1
- package/src/lib/get-ng-module-options-object.js.map +0 -1
- package/src/lib/handle-component-module.js.map +0 -1
- package/src/lib/handle-component.js.map +0 -1
- package/src/lib/index.d.ts +0 -48
- package/src/lib/index.js +0 -52
- package/src/lib/index.js.map +0 -1
- package/src/lib/nest/index.d.ts +0 -31
- package/src/lib/nest/index.js +0 -35
- package/src/lib/nest/index.js.map +0 -1
- package/src/lib/operation-id-utilities.js +0 -59
- package/src/lib/operation-id-utilities.js.map +0 -1
- package/src/lib/ts-morph/index.d.ts +0 -10
- package/src/lib/ts-morph/index.js +0 -14
- package/src/lib/ts-morph/index.js.map +0 -1
- /package/src/lib/{add-component-animations.d.ts → angular/add-component-animations.d.ts} +0 -0
- /package/src/lib/{add-component-input.d.ts → angular/add-component-input.d.ts} +0 -0
- /package/src/lib/{add-control-validator.d.ts → angular/add-control-validator.d.ts} +0 -0
- /package/src/lib/{add-control-validator.js → angular/add-control-validator.js} +0 -0
- /package/src/lib/{add-dependency-injection.d.ts → angular/add-dependency-injection.d.ts} +0 -0
- /package/src/lib/{add-ng-module-import.d.ts → angular/add-ng-module-import.d.ts} +0 -0
- /package/src/lib/{find-component-module-source-file.d.ts → angular/find-component-module-source-file.d.ts} +0 -0
- /package/src/lib/{find-component-module-source-file.js → angular/find-component-module-source-file.js} +0 -0
- /package/src/lib/{find-component-source-file.d.ts → angular/find-component-source-file.d.ts} +0 -0
- /package/src/lib/{find-component-source-file.js → angular/find-component-source-file.js} +0 -0
- /package/src/lib/{find-routing-module.d.ts → angular/find-routing-module.d.ts} +0 -0
- /package/src/lib/{find-routing-module.js → angular/find-routing-module.js} +0 -0
- /package/src/lib/{get-component-class.d.ts → angular/get-component-class.d.ts} +0 -0
- /package/src/lib/{get-component-class.js → angular/get-component-class.js} +0 -0
- /package/src/lib/{get-component-options-object.d.ts → angular/get-component-options-object.d.ts} +0 -0
- /package/src/lib/{get-component-options-object.js → angular/get-component-options-object.js} +0 -0
- /package/src/lib/{get-ng-module-options-object.d.ts → angular/get-ng-module-options-object.d.ts} +0 -0
- /package/src/lib/{get-ng-module-options-object.js → angular/get-ng-module-options-object.js} +0 -0
- /package/src/lib/{handle-component-module.js → angular/handle-component-module.js} +0 -0
- /package/src/lib/{handle-component.js → angular/handle-component.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-nest-module-to-app-module.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/add-nest-module-to-app-module.ts"],"names":[],"mappings":";;;AACA,qEAAsD;AACtD,
|
|
1
|
+
{"version":3,"file":"add-nest-module-to-app-module.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/add-nest-module-to-app-module.ts"],"names":[],"mappings":";;;AACA,qEAAsD;AACtD,+BAIc;AACd,8DAG+B;AAC/B,qEAA+D;AAO/D,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AAErD,SAAgB,wBAAwB,CAAC,OAAwC;IAC/E,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAC9D,IAAI,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAChC,aAAa,aAAb,aAAa,cAAb,aAAa,IAAb,aAAa,GAAK,uBAAuB,EAAC;IAC1C,OAAO,IAAA,oDAA+B,EACpC;QACE,OAAO;QACP,OAAO;QACP,MAAM;KACP,EACD,CAAC,OAAO,EAAE,CAAE,UAAU,CAAE,EAAE,EAAE;QAE1B,MAAM,kBAAkB,GAAG,IAAA,cAAO,EAAC,aAAc,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;QACtE,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,EAAE,IAAI,GAAG,SAAS,CAAC,CAAC;QAC3D,MAAM,YAAY,GAAG,IAAA,eAAQ,EAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;QAE9D,IAAA,4CAAmB,EAAC,UAAU,EAAE,IAAA,+BAAQ,EAAC,IAAI,CAAC,GAAG,QAAQ,EAAE;YACzD;gBACE,YAAY,EAAE,CAAE,IAAA,+BAAQ,EAAC,IAAI,CAAC,GAAG,QAAQ,CAAE;gBAC3C,eAAe,EAAE,YAAY;aAC9B;SACF,CAAC,CAAC;IAEL,CAAC,EACD,CAAE,aAAa,CAAE,CAClB,CAAC;AACJ,CAAC;AA1BD,4DA0BC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClassDeclaration, DecoratorStructure,
|
|
1
|
+
import { ClassDeclaration, DecoratorStructure, MethodDeclaration, OptionalKind, SourceFile, StatementStructures, WriterFunction } from 'ts-morph';
|
|
2
2
|
export interface OperationParameter {
|
|
3
3
|
name: string;
|
|
4
4
|
type?: string | WriterFunction;
|
|
@@ -6,6 +6,9 @@ export interface OperationParameter {
|
|
|
6
6
|
defaultValue?: string | WriterFunction;
|
|
7
7
|
required?: boolean;
|
|
8
8
|
isArray?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* (optional) the method parameter name. If not defined the name property will be used
|
|
11
|
+
*/
|
|
9
12
|
alias?: string;
|
|
10
13
|
/**
|
|
11
14
|
* true - the parameter is a parent parameter.
|
|
@@ -29,5 +32,6 @@ export interface OperationOptions {
|
|
|
29
32
|
body?: string | WriterFunction;
|
|
30
33
|
statements?: (string | WriterFunction | StatementStructures)[] | string | WriterFunction;
|
|
31
34
|
decorators?: OptionalKind<DecoratorStructure>[];
|
|
35
|
+
tsMorphTransform?: (sourceFile: SourceFile, classDeclaration: ClassDeclaration, methodDeclaration: MethodDeclaration, options: OperationOptions) => void;
|
|
32
36
|
}
|
|
33
|
-
export declare function AddOperationToController(classDeclaration: ClassDeclaration, name: string,
|
|
37
|
+
export declare function AddOperationToController(sourceFile: SourceFile, classDeclaration: ClassDeclaration, name: string, options: OperationOptions): void;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AddOperationToController = void 0;
|
|
4
|
-
const ts_morph_1 = require("ts-morph");
|
|
5
4
|
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const ts_morph_1 = require("ts-morph");
|
|
6
|
+
const coerce_class_method_1 = require("../coerce-class-method");
|
|
7
|
+
const coerce_decorator_1 = require("../ts-morph/coerce-decorator");
|
|
8
|
+
const coerce_imports_1 = require("../ts-morph/coerce-imports");
|
|
9
|
+
const coerce_statements_1 = require("../ts-morph/coerce-statements");
|
|
8
10
|
function buildMethodQueryParameters(queryList, importStructures) {
|
|
9
11
|
if (queryList.length) {
|
|
10
12
|
return queryList.map(query => {
|
|
@@ -89,10 +91,13 @@ function buildMethodBodyParameters(body) {
|
|
|
89
91
|
}
|
|
90
92
|
return [];
|
|
91
93
|
}
|
|
92
|
-
function AddOperationToController(classDeclaration, name,
|
|
94
|
+
function AddOperationToController(sourceFile, classDeclaration, name, options) {
|
|
95
|
+
let { method, path, returnType, isAsync, paramList, queryList, body, statements, decorators, tsMorphTransform, } = options;
|
|
93
96
|
queryList !== null && queryList !== void 0 ? queryList : (queryList = []);
|
|
94
97
|
paramList !== null && paramList !== void 0 ? paramList : (paramList = []);
|
|
95
98
|
decorators !== null && decorators !== void 0 ? decorators : (decorators = []);
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
100
|
+
tsMorphTransform !== null && tsMorphTransform !== void 0 ? tsMorphTransform : (tsMorphTransform = () => { });
|
|
96
101
|
method !== null && method !== void 0 ? method : (method = 'get');
|
|
97
102
|
method = (0, schematics_utilities_1.capitalize)(method.toLowerCase());
|
|
98
103
|
queryList.forEach(query => {
|
|
@@ -144,6 +149,17 @@ function AddOperationToController(classDeclaration, name, { method, path, return
|
|
|
144
149
|
path = paramList.filter(param => !param.fromParent).map(param => `:${param.name}`).join('/');
|
|
145
150
|
}
|
|
146
151
|
}
|
|
152
|
+
else {
|
|
153
|
+
const match = path.match(/:(\w+)/g);
|
|
154
|
+
for (const param of match !== null && match !== void 0 ? match : []) {
|
|
155
|
+
if (!paramList.find(p => p.name === param.substr(1))) {
|
|
156
|
+
paramList.push({
|
|
157
|
+
name: param.substr(1),
|
|
158
|
+
type: 'string',
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
147
163
|
// TODO : check that all defined param in the paramList are present in the path
|
|
148
164
|
returnType !== null && returnType !== void 0 ? returnType : (returnType = 'void');
|
|
149
165
|
const methodDeclaration = (0, coerce_class_method_1.CoerceClassMethod)(classDeclaration, (0, schematics_utilities_1.camelize)(name), {
|
|
@@ -159,7 +175,7 @@ function AddOperationToController(classDeclaration, name, { method, path, return
|
|
|
159
175
|
}
|
|
160
176
|
return a.hasQuestionToken ? 1 : -1;
|
|
161
177
|
}),
|
|
162
|
-
returnType: !isAsync ? returnType : returnType ? w => {
|
|
178
|
+
returnType: !isAsync ? returnType : returnType ? (w) => {
|
|
163
179
|
w.write('Promise<');
|
|
164
180
|
if (typeof returnType === 'string') {
|
|
165
181
|
w.write(returnType);
|
|
@@ -174,17 +190,18 @@ function AddOperationToController(classDeclaration, name, { method, path, return
|
|
|
174
190
|
} : undefined,
|
|
175
191
|
});
|
|
176
192
|
decorators.forEach(decorator => {
|
|
177
|
-
(0,
|
|
193
|
+
(0, coerce_decorator_1.CoerceDecorator)(methodDeclaration, decorator.name, decorator);
|
|
178
194
|
});
|
|
179
|
-
(0,
|
|
195
|
+
(0, coerce_decorator_1.CoerceDecorator)(methodDeclaration, method, { arguments: path ? [w => w.quote(path)] : [] });
|
|
180
196
|
coerceApiQueryDecorators(queryList, methodDeclaration);
|
|
181
|
-
(0,
|
|
182
|
-
|
|
197
|
+
(0, coerce_statements_1.CoerceStatements)(methodDeclaration, statements !== null && statements !== void 0 ? statements : ['throw new NotImplementedException();']);
|
|
198
|
+
(0, coerce_imports_1.CoerceImports)(sourceFile, importStructures);
|
|
199
|
+
tsMorphTransform(sourceFile, classDeclaration, methodDeclaration, options);
|
|
183
200
|
}
|
|
184
201
|
exports.AddOperationToController = AddOperationToController;
|
|
185
202
|
function coerceApiQueryDecorators(queryList, methodDeclaration) {
|
|
186
203
|
for (const query of queryList) {
|
|
187
|
-
(0,
|
|
204
|
+
(0, coerce_decorator_1.CoerceDecorator)(methodDeclaration, 'ApiQuery', {
|
|
188
205
|
arguments: [
|
|
189
206
|
ts_morph_1.Writers.object({
|
|
190
207
|
name: w => w.quote(query.name),
|
|
@@ -193,12 +210,14 @@ function coerceApiQueryDecorators(queryList, methodDeclaration) {
|
|
|
193
210
|
}),
|
|
194
211
|
],
|
|
195
212
|
}, () => decorator => {
|
|
213
|
+
var _a;
|
|
196
214
|
if (decorator.getArguments().length) {
|
|
197
215
|
const [objectLiteralExpression] = decorator.getArguments();
|
|
198
216
|
if (objectLiteralExpression instanceof ts_morph_1.ObjectLiteralExpression) {
|
|
199
217
|
const namePropertyElement = objectLiteralExpression.getProperty('name');
|
|
200
218
|
if (namePropertyElement instanceof ts_morph_1.PropertyAssignment) {
|
|
201
|
-
|
|
219
|
+
const name = (_a = namePropertyElement.getInitializer()) === null || _a === void 0 ? void 0 : _a.getText().trim().replace(/^'/, '').replace(/'$/, '');
|
|
220
|
+
return name === query.name;
|
|
202
221
|
}
|
|
203
222
|
}
|
|
204
223
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-operation-to-controller.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/add-operation-to-controller.ts"],"names":[],"mappings":";;;AAAA,qEAGoC;AACpC,uCAckB;AAClB,gEAA2D;AAC3D,mEAA+D;AAC/D,+DAA2D;AAC3D,qEAAiE;AA+CjE,SAAS,0BAA0B,CACjC,SAA+B,EAC/B,gBAAiE;IAEjE,IAAI,SAAS,CAAC,MAAM,EAAE;QACpB,OAAO,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;;YAC3B,IAAI,KAAK,CAAC,YAAY;gBACpB,SAAS,EAAE;gBACX,OAAO,KAAK,CAAC;aACd;YACD,gBAAgB,CAAC,IAAI,CAAC;gBACpB,YAAY,EAAE,CAAE,kBAAkB,CAAE;gBACpC,eAAe,EAAE,gBAAgB;aAClC,CAAC,CAAC;YACH,MAAM,QAAQ,GAAG,MAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,KAAK,EAAE,mCAAI,EAAE,CAAC;YAC/C,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;gBAChB,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;gBACjC,IAAI,OAAO,KAAK,CAAC,YAAY,KAAK,QAAQ,EAAE;oBAC1C,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;iBAC7B;qBAAM,IAAI,OAAO,KAAK,CAAC,YAAY,KAAK,UAAU,EAAE;oBACnD,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;iBACvB;qBAAM;oBACL,MAA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0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const project_utilities_1 = require("./project-utilities");
|
|
6
|
+
function AssertNestProject(options) {
|
|
7
|
+
const { project, feature, shared } = options;
|
|
8
|
+
return tree => {
|
|
9
|
+
if (!(0, project_utilities_1.HasNestServiceProject)(tree, { project, feature, shared })) {
|
|
10
|
+
throw new schematics_1.SchematicsException(`The project ${(0, project_utilities_1.buildNestProjectName)({ project, feature, shared })} does not exists!`);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
exports.AssertNestProject = AssertNestProject;
|
|
15
|
+
//# sourceMappingURL=assert-nest-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assert-nest-project.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/assert-nest-project.ts"],"names":[],"mappings":";;;AAAA,2DAGoC;AACpC,2DAG6B;AAQ7B,SAAgB,iBAAiB,CAAC,OAAiC;IACjE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC7C,OAAO,IAAI,CAAC,EAAE;QACZ,IAAI,CAAC,IAAA,yCAAqB,EAAC,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE;YAC9D,MAAM,IAAI,gCAAmB,CAAC,eAAgB,IAAA,wCAAoB,EAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAE,mBAAmB,CAAC,CAAC;SACvH;IACH,CAAC,CAAC;AACJ,CAAC;AAPD,8CAOC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Tree } from '@angular-devkit/schematics';
|
|
2
2
|
export interface BuildNestBasePathOptions {
|
|
3
3
|
project: string;
|
|
4
|
-
feature?: string;
|
|
5
|
-
directory?: string;
|
|
4
|
+
feature?: string | null;
|
|
5
|
+
directory?: string | null;
|
|
6
6
|
shared?: boolean;
|
|
7
7
|
}
|
|
8
8
|
export declare function BuildNestBasePath(host: Tree, options: BuildNestBasePathOptions): string;
|
|
@@ -4,19 +4,16 @@ exports.BuildNestControllerName = void 0;
|
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
5
|
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
6
6
|
function BuildNestControllerName(options) {
|
|
7
|
-
let {
|
|
8
|
-
nestModule !== null && nestModule !== void 0 ? nestModule : (nestModule = module);
|
|
9
|
-
controllerName !== null && controllerName !== void 0 ? controllerName : (controllerName = nestController);
|
|
10
|
-
controllerName !== null && controllerName !== void 0 ? controllerName : (controllerName = name);
|
|
11
|
-
if (!controllerName) {
|
|
12
|
-
throw new schematics_1.SchematicsException('Could not determine the controller name');
|
|
13
|
-
}
|
|
7
|
+
let { controllerName, controllerNameSuffix, nestModule, } = options;
|
|
14
8
|
if (nestModule && nestModule !== controllerName) {
|
|
15
9
|
controllerName = [nestModule, controllerName].join('-');
|
|
16
10
|
}
|
|
17
11
|
if (controllerNameSuffix) {
|
|
18
12
|
controllerName = (0, schematics_utilities_1.CoerceSuffix)(controllerName, '-' + controllerNameSuffix);
|
|
19
13
|
}
|
|
14
|
+
if (!controllerName) {
|
|
15
|
+
throw new schematics_1.SchematicsException('Could not determine the controller name');
|
|
16
|
+
}
|
|
20
17
|
return controllerName;
|
|
21
18
|
}
|
|
22
19
|
exports.BuildNestControllerName = BuildNestControllerName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-nest-controller-name.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/build-nest-controller-name.ts"],"names":[],"mappings":";;;AAAA,2DAAiE;AACjE,qEAA0D;
|
|
1
|
+
{"version":3,"file":"build-nest-controller-name.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/build-nest-controller-name.ts"],"names":[],"mappings":";;;AAAA,2DAAiE;AACjE,qEAA0D;AAQ1D,SAAgB,uBAAuB,CAAC,OAAuC;IAC7E,IAAI,EACF,cAAc,EACd,oBAAoB,EACpB,UAAU,GACX,GAAG,OAAO,CAAC;IAEZ,IAAI,UAAU,IAAI,UAAU,KAAK,cAAc,EAAE;QAC/C,cAAc,GAAG,CAAE,UAAU,EAAE,cAAc,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAC3D;IAED,IAAI,oBAAoB,EAAE;QACxB,cAAc,GAAG,IAAA,mCAAY,EAAC,cAAe,EAAE,GAAG,GAAG,oBAAoB,CAAC,CAAC;KAC5E;IAED,IAAI,CAAC,cAAc,EAAE;QACnB,MAAM,IAAI,gCAAmB,CAAC,yCAAyC,CAAC,CAAC;KAC1E;IAED,OAAO,cAAc,CAAC;AAExB,CAAC;AArBD,0DAqBC"}
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
import { ClassDeclarationStructure, ClassLikeDeclarationBase, ImportDeclarationStructure, OptionalKind, Project, PropertyDeclaration, PropertyDeclarationStructure, PropertySignature, TypeElementMemberedNode } from 'ts-morph';
|
|
2
|
-
import { DtoClassProperty } from '
|
|
1
|
+
import { ClassDeclaration, ClassDeclarationStructure, ClassLikeDeclarationBase, ImportDeclarationStructure, OptionalKind, Project, PropertyDeclaration, PropertyDeclarationStructure, PropertySignature, SourceFile, TypeElementMemberedNode } from 'ts-morph';
|
|
2
|
+
import { DtoClassProperty } from './create-dto-class';
|
|
3
3
|
export interface CoerceDtoClassOutput {
|
|
4
4
|
className: string;
|
|
5
5
|
filePath: string;
|
|
6
6
|
}
|
|
7
7
|
export declare function CoercePropertyDeclaration(typeElementMemberedNode: TypeElementMemberedNode, name: string, structure?: Partial<PropertyDeclarationStructure>): PropertySignature;
|
|
8
8
|
export declare function CoercePropertyDeclaration(classLikeDeclarationBase: ClassLikeDeclarationBase, name: string, structure?: Partial<PropertyDeclarationStructure>): PropertyDeclaration;
|
|
9
|
-
export
|
|
9
|
+
export interface CoerceDtoClassOptions {
|
|
10
|
+
project: Project;
|
|
11
|
+
name: string;
|
|
12
|
+
propertyList?: DtoClassProperty[] | null;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated use the tsMorphTransform to adapt the class
|
|
15
|
+
*/
|
|
16
|
+
classStructure?: Omit<OptionalKind<ClassDeclarationStructure>, 'name'>;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated use the tsMorphTransform to add imports
|
|
19
|
+
*/
|
|
20
|
+
importStructureList?: Array<OptionalKind<ImportDeclarationStructure>>;
|
|
21
|
+
tsMorphTransform?: (project: Project, sourceFile: SourceFile, classDeclaration: ClassDeclaration) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare function CoerceDtoClass(options: CoerceDtoClassOptions): CoerceDtoClassOutput;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoerceDtoClass = exports.CoercePropertyDeclaration = void 0;
|
|
4
|
-
const ts_morph_1 = require("ts-morph");
|
|
5
|
-
const path_1 = require("path");
|
|
6
4
|
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const ts_morph_1 = require("ts-morph");
|
|
7
|
+
const coerce_class_1 = require("../coerce-class");
|
|
8
|
+
const coerce_source_file_1 = require("../coerce-source-file");
|
|
7
9
|
const coerce_decorator_1 = require("../ts-morph/coerce-decorator");
|
|
8
10
|
const coerce_imports_1 = require("../ts-morph/coerce-imports");
|
|
9
|
-
const
|
|
10
|
-
const coerce_class_1 = require("../coerce-class");
|
|
11
|
+
const write_type_1 = require("../ts-morph/write-type");
|
|
11
12
|
function CoercePropertyDeclaration(node, name, structure = {}) {
|
|
12
13
|
let property = node.getProperty(name);
|
|
13
14
|
if (!property) {
|
|
@@ -17,15 +18,21 @@ function CoercePropertyDeclaration(node, name, structure = {}) {
|
|
|
17
18
|
return property;
|
|
18
19
|
}
|
|
19
20
|
exports.CoercePropertyDeclaration = CoercePropertyDeclaration;
|
|
20
|
-
function CoerceDtoClass(
|
|
21
|
+
function CoerceDtoClass(options) {
|
|
22
|
+
const { project, } = options;
|
|
23
|
+
let { propertyList, tsMorphTransform, classStructure, importStructureList, name, } = options;
|
|
24
|
+
propertyList !== null && propertyList !== void 0 ? propertyList : (propertyList = []);
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
26
|
+
tsMorphTransform !== null && tsMorphTransform !== void 0 ? tsMorphTransform : (tsMorphTransform = () => { });
|
|
27
|
+
classStructure !== null && classStructure !== void 0 ? classStructure : (classStructure = {});
|
|
28
|
+
importStructureList !== null && importStructureList !== void 0 ? importStructureList : (importStructureList = []);
|
|
21
29
|
name = (0, schematics_utilities_1.dasherize)(name);
|
|
22
30
|
const className = (0, schematics_utilities_1.CoerceSuffix)((0, schematics_utilities_1.classify)(name), 'Dto');
|
|
23
31
|
const fileName = (0, schematics_utilities_1.CoerceSuffix)(name, '.dto');
|
|
24
32
|
const sourceFile = (0, coerce_source_file_1.CoerceSourceFile)(project, (0, path_1.join)('dtos', fileName + '.ts'));
|
|
25
33
|
const classDeclaration = (0, coerce_class_1.CoerceClass)(sourceFile, className);
|
|
26
34
|
classDeclaration.setIsExported(true);
|
|
27
|
-
classDeclaration.set(classStructure
|
|
28
|
-
importStructureList !== null && importStructureList !== void 0 ? importStructureList : (importStructureList = []);
|
|
35
|
+
classDeclaration.set(classStructure);
|
|
29
36
|
for (const property of propertyList) {
|
|
30
37
|
let propertyName = (0, schematics_utilities_1.camelize)(property.name);
|
|
31
38
|
const prefixMatch = property.name.match(/^(_+)/);
|
|
@@ -33,27 +40,12 @@ function CoerceDtoClass(project, name, propertyList, classStructure, importStruc
|
|
|
33
40
|
propertyName = (0, schematics_utilities_1.camelize)(property.name.replace(/^_+/, ''));
|
|
34
41
|
propertyName = prefixMatch[0] + propertyName;
|
|
35
42
|
}
|
|
36
|
-
const propertyDeclaration = CoercePropertyDeclaration(classDeclaration, propertyName
|
|
37
|
-
type:
|
|
38
|
-
w.write('Array<');
|
|
39
|
-
if (typeof property.type === 'string') {
|
|
40
|
-
if (property.type === 'date') {
|
|
41
|
-
w.write('Date');
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
w.write(property.type);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
property.type(w);
|
|
49
|
-
}
|
|
50
|
-
w.write('>');
|
|
51
|
-
},
|
|
43
|
+
const propertyDeclaration = CoercePropertyDeclaration(classDeclaration, propertyName).set({
|
|
44
|
+
type: (0, write_type_1.WriteType)(property),
|
|
52
45
|
hasQuestionToken: property.isOptional,
|
|
53
46
|
hasExclamationToken: !property.isOptional,
|
|
54
47
|
});
|
|
55
|
-
(0, coerce_decorator_1.CoerceDecorator)(propertyDeclaration, {
|
|
56
|
-
name: 'Expose',
|
|
48
|
+
(0, coerce_decorator_1.CoerceDecorator)(propertyDeclaration, 'Expose', {
|
|
57
49
|
arguments: [],
|
|
58
50
|
});
|
|
59
51
|
importStructureList.push({
|
|
@@ -61,8 +53,7 @@ function CoerceDtoClass(project, name, propertyList, classStructure, importStruc
|
|
|
61
53
|
moduleSpecifier: 'class-transformer',
|
|
62
54
|
});
|
|
63
55
|
if (property.isArray) {
|
|
64
|
-
(0, coerce_decorator_1.CoerceDecorator)(propertyDeclaration, {
|
|
65
|
-
name: 'IsArray',
|
|
56
|
+
(0, coerce_decorator_1.CoerceDecorator)(propertyDeclaration, 'IsArray', {
|
|
66
57
|
arguments: [],
|
|
67
58
|
});
|
|
68
59
|
importStructureList.push({
|
|
@@ -71,18 +62,12 @@ function CoerceDtoClass(project, name, propertyList, classStructure, importStruc
|
|
|
71
62
|
});
|
|
72
63
|
}
|
|
73
64
|
if (property.isType) {
|
|
74
|
-
(0, coerce_decorator_1.CoerceDecorator)(propertyDeclaration, {
|
|
75
|
-
name: 'Type',
|
|
65
|
+
(0, coerce_decorator_1.CoerceDecorator)(propertyDeclaration, 'Type', {
|
|
76
66
|
arguments: [
|
|
77
67
|
w => {
|
|
78
68
|
w.write('() => ');
|
|
79
69
|
if (typeof property.type === 'string') {
|
|
80
|
-
|
|
81
|
-
w.write('Date');
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
w.write(property.type);
|
|
85
|
-
}
|
|
70
|
+
w.write(property.type);
|
|
86
71
|
}
|
|
87
72
|
else {
|
|
88
73
|
property.type(w);
|
|
@@ -94,17 +79,11 @@ function CoerceDtoClass(project, name, propertyList, classStructure, importStruc
|
|
|
94
79
|
namedImports: ['Type'],
|
|
95
80
|
moduleSpecifier: 'class-transformer',
|
|
96
81
|
});
|
|
97
|
-
(0, coerce_decorator_1.CoerceDecorator)(propertyDeclaration, {
|
|
98
|
-
name: 'IsInstance',
|
|
82
|
+
(0, coerce_decorator_1.CoerceDecorator)(propertyDeclaration, 'IsInstance', {
|
|
99
83
|
arguments: [
|
|
100
84
|
w => {
|
|
101
85
|
if (typeof property.type === 'string') {
|
|
102
|
-
|
|
103
|
-
w.write('Date');
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
w.write(property.type);
|
|
107
|
-
}
|
|
86
|
+
w.write(property.type);
|
|
108
87
|
}
|
|
109
88
|
else {
|
|
110
89
|
property.type(w);
|
|
@@ -123,8 +102,7 @@ function CoerceDtoClass(project, name, propertyList, classStructure, importStruc
|
|
|
123
102
|
});
|
|
124
103
|
}
|
|
125
104
|
if (property.isOptional) {
|
|
126
|
-
(0, coerce_decorator_1.CoerceDecorator)(propertyDeclaration, {
|
|
127
|
-
name: 'IsOptional',
|
|
105
|
+
(0, coerce_decorator_1.CoerceDecorator)(propertyDeclaration, 'IsInstance', {
|
|
128
106
|
arguments: [],
|
|
129
107
|
});
|
|
130
108
|
importStructureList.push({
|
|
@@ -132,53 +110,70 @@ function CoerceDtoClass(project, name, propertyList, classStructure, importStruc
|
|
|
132
110
|
moduleSpecifier: 'class-validator',
|
|
133
111
|
});
|
|
134
112
|
}
|
|
135
|
-
|
|
136
|
-
|
|
113
|
+
switch (property.type) {
|
|
114
|
+
case 'date':
|
|
115
|
+
(0, coerce_decorator_1.CoerceDecorator)(propertyDeclaration, 'IsDate', {
|
|
116
|
+
arguments: [],
|
|
117
|
+
});
|
|
137
118
|
importStructureList.push({
|
|
138
|
-
namedImports: ['
|
|
119
|
+
namedImports: ['IsDate'],
|
|
139
120
|
moduleSpecifier: 'class-validator',
|
|
140
121
|
});
|
|
141
|
-
|
|
142
|
-
|
|
122
|
+
break;
|
|
123
|
+
case 'number':
|
|
124
|
+
(0, coerce_decorator_1.CoerceDecorator)(propertyDeclaration, 'IsNumber', {
|
|
143
125
|
arguments: [],
|
|
144
126
|
});
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
127
|
importStructureList.push({
|
|
148
|
-
namedImports: ['
|
|
128
|
+
namedImports: ['IsNumber'],
|
|
149
129
|
moduleSpecifier: 'class-validator',
|
|
150
130
|
});
|
|
151
|
-
|
|
152
|
-
|
|
131
|
+
break;
|
|
132
|
+
case 'string':
|
|
133
|
+
if (property.name === 'uuid') {
|
|
134
|
+
importStructureList.push({
|
|
135
|
+
namedImports: ['IsUUID'],
|
|
136
|
+
moduleSpecifier: 'class-validator',
|
|
137
|
+
});
|
|
138
|
+
(0, coerce_decorator_1.CoerceDecorator)(propertyDeclaration, 'IsNumber', {
|
|
139
|
+
arguments: [],
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
importStructureList.push({
|
|
144
|
+
namedImports: ['IsString'],
|
|
145
|
+
moduleSpecifier: 'class-validator',
|
|
146
|
+
});
|
|
147
|
+
(0, coerce_decorator_1.CoerceDecorator)(propertyDeclaration, 'IsNumber', {
|
|
148
|
+
arguments: [],
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
break;
|
|
152
|
+
case 'uuid':
|
|
153
|
+
(0, coerce_decorator_1.CoerceDecorator)(propertyDeclaration, 'IsNumber', {
|
|
153
154
|
arguments: [],
|
|
154
155
|
});
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
namedImports: ['IsBoolean'],
|
|
170
|
-
moduleSpecifier: 'class-validator',
|
|
171
|
-
});
|
|
172
|
-
(0, coerce_decorator_1.CoerceDecorator)(propertyDeclaration, {
|
|
173
|
-
name: 'IsBoolean',
|
|
174
|
-
arguments: [],
|
|
175
|
-
});
|
|
156
|
+
importStructureList.push({
|
|
157
|
+
namedImports: ['IsUUID'],
|
|
158
|
+
moduleSpecifier: 'class-validator',
|
|
159
|
+
});
|
|
160
|
+
break;
|
|
161
|
+
case 'boolean':
|
|
162
|
+
(0, coerce_decorator_1.CoerceDecorator)(propertyDeclaration, 'IsNumber', {
|
|
163
|
+
arguments: [],
|
|
164
|
+
});
|
|
165
|
+
importStructureList.push({
|
|
166
|
+
namedImports: ['IsBoolean'],
|
|
167
|
+
moduleSpecifier: 'class-validator',
|
|
168
|
+
});
|
|
169
|
+
break;
|
|
176
170
|
}
|
|
177
171
|
}
|
|
178
172
|
(0, coerce_imports_1.CoerceImports)(sourceFile, importStructureList);
|
|
173
|
+
tsMorphTransform(project, sourceFile, classDeclaration);
|
|
179
174
|
return {
|
|
180
175
|
className,
|
|
181
|
-
filePath: (0, path_1.join)(sourceFile.getDirectoryPath(), sourceFile.getBaseNameWithoutExtension()),
|
|
176
|
+
filePath: '.' + (0, path_1.join)(sourceFile.getDirectoryPath(), sourceFile.getBaseNameWithoutExtension()),
|
|
182
177
|
};
|
|
183
178
|
}
|
|
184
179
|
exports.CoerceDtoClass = CoerceDtoClass;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-dto-class.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/coerce-dto-class.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"coerce-dto-class.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/coerce-dto-class.ts"],"names":[],"mappings":";;;AAAA,qEAKoC;AACpC,+BAA4B;AAC5B,uCAckB;AAClB,kDAA8C;AAC9C,8DAAyD;AACzD,mEAA+D;AAC/D,+DAA2D;AAC3D,uDAAmD;AAkBnD,SAAgB,yBAAyB,CACvC,IAAwD,EACxD,IAAY,EACZ,YAA+H,EAAE;IAEjI,IAAI,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,CAAC,QAAQ,EAAE;QACb,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QACtC,QAAQ,CAAC,GAAG,CAAC,SAAgB,CAAC,CAAC;KAChC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAXD,8DAWC;AAiBD,SAAgB,cAAc,CAAC,OAA8B;IAC3D,MAAM,EACJ,OAAO,GACR,GAAG,OAAO,CAAC;IACZ,IAAI,EACF,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,IAAI,GACL,GAAG,OAAO,CAAC;IAEZ,YAAY,aAAZ,YAAY,cAAZ,YAAY,IAAZ,YAAY,GAAK,EAAE,EAAC;IACpB,gEAAgE;IAChE,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,IAAhB,gBAAgB,GAAK,GAAG,EAAE,GAAE,CAAC,EAAC;IAC9B,cAAc,aAAd,cAAc,cAAd,cAAc,IAAd,cAAc,GAAK,EAAE,EAAC;IACtB,mBAAmB,aAAnB,mBAAmB,cAAnB,mBAAmB,IAAnB,mBAAmB,GAAK,EAAE,EAAC;IAC3B,IAAI,GAAG,IAAA,gCAAS,EAAC,IAAI,CAAC,CAAC;IAEvB,MAAM,SAAS,GAAG,IAAA,mCAAY,EAAC,IAAA,+BAAQ,EAAC,IAAI,C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oBACL,mBAAmB,CAAC,IAAI,CAAC;wBACvB,YAAY,EAAE,CAAE,UAAU,CAAE;wBAC5B,eAAe,EAAE,iBAAiB;qBACnC,CAAC,CAAC;oBACH,IAAA,kCAAe,EACb,mBAAmB,EACnB,UAAU,EACV;wBACE,SAAS,EAAE,EAAE;qBACd,CACF,CAAC;iBACH;gBACD,MAAM;YACR,KAAK,MAAM;gBACT,IAAA,kCAAe,EACb,mBAAmB,EACnB,UAAU,EACV;oBACE,SAAS,EAAE,EAAE;iBACd,CACF,CAAC;gBACF,mBAAmB,CAAC,IAAI,CAAC;oBACvB,YAAY,EAAE,CAAE,QAAQ,CAAE;oBAC1B,eAAe,EAAE,iBAAiB;iBACnC,CAAC,CAAC;gBACH,MAAM;YACR,KAAK,SAAS;gBACZ,IAAA,kCAAe,EACb,mBAAmB,EACnB,UAAU,EACV;oBACE,SAAS,EAAE,EAAE;iBACd,CACF,CAAC;gBACF,mBAAmB,CAAC,IAAI,CAAC;oBACvB,YAAY,EAAE,CAAE,WAAW,CAAE;oBAC7B,eAAe,EAAE,iBAAiB;iBACnC,CAAC,CAAC;gBACH,MAAM;SACT;KAEF;IAED,IAAA,8BAAa,EAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC;IAE/C,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC;IAExD,OAAO;QACL,SAAS;QACT,QAAQ,EAAE,GAAG,GAAG,IAAA,WAAI,EAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE,UAAU,CAAC,2BAA2B,EAAE,CAAC;KAC9F,CAAC;AAEJ,CAAC;AAvND,wCAuNC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CoerceOperationOptions } from './coerce-operation';
|
|
2
|
-
import { DtoClassProperty } from '
|
|
2
|
+
import { DtoClassProperty } from './create-dto-class';
|
|
3
3
|
export interface CoerceFormSubmitOperationOptions extends Omit<CoerceOperationOptions, 'operationName'> {
|
|
4
4
|
propertyList?: DtoClassProperty[] | null;
|
|
5
|
+
bodyDtoName?: string;
|
|
5
6
|
}
|
|
6
7
|
export declare function CoerceFormSubmitOperation(options: CoerceFormSubmitOperationOptions): import("@angular-devkit/schematics").Rule;
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoerceFormSubmitOperation = void 0;
|
|
4
|
+
const utilities_1 = require("@rxap/utilities");
|
|
5
|
+
const coerce_imports_1 = require("../ts-morph/coerce-imports");
|
|
4
6
|
const coerce_dto_class_1 = require("./coerce-dto-class");
|
|
5
7
|
const coerce_operation_1 = require("./coerce-operation");
|
|
6
|
-
const coerce_imports_1 = require("../ts-morph/coerce-imports");
|
|
7
8
|
function CoerceFormSubmitOperation(options) {
|
|
8
|
-
let { tsMorphTransform,
|
|
9
|
+
let { tsMorphTransform, controllerName, propertyList, bodyDtoName, context, } = options;
|
|
9
10
|
tsMorphTransform !== null && tsMorphTransform !== void 0 ? tsMorphTransform : (tsMorphTransform = () => ({}));
|
|
10
|
-
paramList !== null && paramList !== void 0 ? paramList : (paramList = []);
|
|
11
11
|
propertyList !== null && propertyList !== void 0 ? propertyList : (propertyList = []);
|
|
12
|
+
bodyDtoName !== null && bodyDtoName !== void 0 ? bodyDtoName : (bodyDtoName = (0, utilities_1.joinWithDash)([context, controllerName]));
|
|
12
13
|
return (0, coerce_operation_1.CoerceOperation)(Object.assign(Object.assign({}, options), { operationName: 'submit', tsMorphTransform: (project, sourceFile, classDeclaration, controllerName) => {
|
|
13
|
-
const { className: dtoClassName, filePath: dtoFilePath, } = (0, coerce_dto_class_1.CoerceDtoClass)(
|
|
14
|
+
const { className: dtoClassName, filePath: dtoFilePath, } = (0, coerce_dto_class_1.CoerceDtoClass)({
|
|
15
|
+
project,
|
|
16
|
+
name: bodyDtoName,
|
|
17
|
+
propertyList,
|
|
18
|
+
});
|
|
14
19
|
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
15
20
|
namedImports: [dtoClassName],
|
|
16
|
-
moduleSpecifier:
|
|
21
|
+
moduleSpecifier: dtoFilePath,
|
|
17
22
|
});
|
|
18
|
-
return Object.assign({ body: dtoClassName, method: 'post'
|
|
23
|
+
return Object.assign({ body: dtoClassName, method: 'post' }, tsMorphTransform(project, sourceFile, classDeclaration, controllerName));
|
|
19
24
|
} }));
|
|
20
25
|
}
|
|
21
26
|
exports.CoerceFormSubmitOperation = CoerceFormSubmitOperation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-form-submit-operation.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/coerce-form-submit-operation.ts"],"names":[],"mappings":";;;AAAA,yDAAoD;AACpD,yDAG4B;
|
|
1
|
+
{"version":3,"file":"coerce-form-submit-operation.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/coerce-form-submit-operation.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,+DAA2D;AAC3D,yDAAoD;AACpD,yDAG4B;AAQ5B,SAAgB,yBAAyB,CAAC,OAAyC;IACjF,IAAI,EACF,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,WAAW,EACX,OAAO,GACR,GAAG,OAAO,CAAC;IACZ,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,IAAhB,gBAAgB,GAAK,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAC;IAEhC,YAAY,aAAZ,YAAY,cAAZ,YAAY,IAAZ,YAAY,GAAK,EAAE,EAAC;IACpB,WAAW,aAAX,WAAW,cAAX,WAAW,IAAX,WAAW,GAAK,IAAA,wBAAY,EAAC,CAAE,OAAO,EAAE,cAAc,CAAE,CAAC,EAAC;IAE1D,OAAO,IAAA,kCAAe,kCACjB,OAAO,KACV,aAAa,EAAE,QAAQ,EACvB,gBAAgB,EAAE,CAChB,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,EAAE;YAEF,MAAM,EACJ,SAAS,EAAE,YAAY,EACvB,QAAQ,EAAE,WAAW,GACtB,GAAG,IAAA,iCAAc,EAAC;gBACjB,OAAO;gBACP,IAAI,EAAE,WAAY;gBAClB,YAAY;aACb,CAAC,CAAC;YAEH,IAAA,8BAAa,EAAC,UAAU,EAAE;gBACxB,YAAY,EAAE,CAAE,YAAY,CAAE;gBAC9B,eAAe,EAAE,WAAW;aAC7B,CAAC,CAAC;YAEH,uBACE,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,MAAM,IACX,gBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,cAAc,CAAC,EAC3E;QAEJ,CAAC,IACD,CAAC;AAEL,CAAC;AA9CD,8DA8CC"}
|
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DtoClassProperty } from '
|
|
3
|
-
export interface CoerceGetByIdControllerOptions {
|
|
4
|
-
name?: string;
|
|
5
|
-
controllerName?: string;
|
|
6
|
-
nestController?: string;
|
|
7
|
-
project: string;
|
|
8
|
-
feature: string;
|
|
9
|
-
shared: boolean;
|
|
10
|
-
module?: string;
|
|
11
|
-
nestModule?: string;
|
|
12
|
-
paramList?: OperationParameter[];
|
|
1
|
+
import { CoerceOperationOptions } from './coerce-operation';
|
|
2
|
+
import { DtoClassProperty } from './create-dto-class';
|
|
3
|
+
export interface CoerceGetByIdControllerOptions extends Omit<CoerceOperationOptions, 'operationName'> {
|
|
13
4
|
propertyList?: DtoClassProperty[];
|
|
14
|
-
skipCoerce?: boolean;
|
|
15
5
|
isArray?: boolean;
|
|
16
6
|
}
|
|
17
7
|
export declare function CoerceGetByIdOperation(options: CoerceGetByIdControllerOptions): import("@angular-devkit/schematics").Rule;
|