MCPcopy Create free account
hub / github.com/SplootCode/splootcode / putDependency

Method putDependency

packages/core/src/language/projects/project.ts:137–160  ·  view source on GitHub ↗
(dependency: Dependency)

Source from the content-addressed store, hash-verified

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)

Callers 1

TrayFunction · 0.80

Calls 2

saveDependencyMethod · 0.80
handleProjectMutationMethod · 0.65

Tested by

no test coverage detected