MCPcopy
hub / github.com/Crosstalk-Solutions/project-nomad / getValue

Method getValue

admin/app/models/kv_store.ts:32–39  ·  view source on GitHub ↗

* Get a setting value by key, automatically deserializing to the correct type.

(key: K)

Source from the content-addressed store, hash-verified

30 * Get a setting value by key, automatically deserializing to the correct type.
31 */
32 static async getValue<K extends KVStoreKey>(key: K): Promise<KVStoreValue<K> | null> {
33 const setting = await this.findBy('key', key)
34 if (!setting || setting.value === undefined || setting.value === null) {
35 return null
36 }
37 const raw = String(setting.value)
38 return (KV_STORE_SCHEMA[key] === 'boolean' ? parseBoolean(raw) : raw) as KVStoreValue<K>
39 }
40
41 /**
42 * Set a setting value by key (creates if not exists), automatically serializing to string.

Callers 15

bootMethod · 0.45
bootMethod · 0.45
indexMethod · 0.45
inertiaMethod · 0.45
remoteStatusMethod · 0.45
modelsMethod · 0.45
advancedMethod · 0.45
getSettingMethod · 0.45
onCompleteMethod · 0.45
getInternetStatusMethod · 0.45
getSystemInfoMethod · 0.45

Calls 1

parseBooleanFunction · 0.85

Tested by

no test coverage detected