MCPcopy Index your code
hub / github.com/atomicdata-dev/atomic-data-browser / set

Method set

lib/src/resource.ts:292–313  ·  view source on GitHub ↗

* Set a Property, Value combination and perform a validation. Will throw if * property is not valid for the datatype. Will fetch the datatype if it's not * available. Adds the property to the commitbuilder.

(
    prop: string,
    value: JSONValue,
    store: Store,
    /**
     * Disable validation if you don't need it. It might cause a fetch if the
     * Property is not present when set is called
     */
    validate = true,
  )

Source from the content-addressed store, hash-verified

290 * available. Adds the property to the commitbuilder.
291 */
292 async set(
293 prop: string,
294 value: JSONValue,
295 store: Store,
296 /**
297 * Disable validation if you don't need it. It might cause a fetch if the
298 * Property is not present when set is called
299 */
300 validate = true,
301 ): Promise<void> {
302 if (validate) {
303 const fullProp = await store.getProperty(prop);
304 validateDatatype(value, fullProp.datatype);
305 }
306 this.propvals.set(prop, value);
307 // Add the change to the Commit Builder, so we can commit our changes later
308 this.commitBuilder.set[prop] = value;
309 // If the property has been removed before, undo that
310 this.commitBuilder.remove = this.commitBuilder.remove.filter(
311 item => item == prop,
312 );
313 }
314
315 /**
316 * Set a Property, Value combination without performing validations or adding

Callers 15

addElementFunction · 0.95
handleNotifyFunction · 0.80
useResourcesFunction · 0.80
setAsyncFunction · 0.80
createURLStringFunction · 0.80
fetchResourceFunction · 0.80
postCommitFunction · 0.80
uploadFilesFunction · 0.80
setUnsafeMethod · 0.80
addResourceMethod · 0.80
renameSubjectMethod · 0.80
subscribeMethod · 0.80

Calls 1

getPropertyMethod · 0.80

Tested by

no test coverage detected