(dependency: Dependency)
| 135 | } |
| 136 | |
| 137 | async putDependency(dependency: Dependency): Promise<Dependency> { |
| 138 | const savedDependency = await this.projectLoader.saveDependency(this, dependency) |
| 139 | |
| 140 | let found = false |
| 141 | const newDependencies = this.dependencies.map((d) => { |
| 142 | if (d.id === savedDependency.id) { |
| 143 | found = true |
| 144 | return savedDependency |
| 145 | } |
| 146 | return d |
| 147 | }) |
| 148 | |
| 149 | if (!found) { |
| 150 | newDependencies.push(savedDependency) |
| 151 | } |
| 152 | |
| 153 | this.dependencies = newDependencies |
| 154 | globalMutationDispatcher.handleProjectMutation({ |
| 155 | type: ProjectMutationType.UPDATE_DEPENDENCIES, |
| 156 | newDependencies: newDependencies, |
| 157 | }) |
| 158 | |
| 159 | return savedDependency |
| 160 | } |
| 161 | |
| 162 | async deleteDependency(dependencyID: number): Promise<void> { |
| 163 | await this.projectLoader.deleteDependency(this, dependencyID) |
no test coverage detected