MCPcopy Index your code
hub / github.com/DeepNotesApp/DeepNotes / hget

Method hget

apps/client/src/code/realtime/client.ts:139–186  ·  view source on GitHub ↗
(
        prefix: DataPrefix_,
        suffix: string,
        field: DataField,
        params?: { subscribe?: boolean; ctx?: RealtimeContext },
      )

Source from the content-addressed store, hash-verified

137 );
138 }
139 async hget<
140 DataPrefix_ extends DataPrefix,
141 DataField extends Extract<
142 keyof (typeof dataHashes)[DataPrefix_]['fields'],
143 string
144 > = Extract<keyof (typeof dataHashes)[DataPrefix_]['fields'], string>,
145 >(
146 prefix: DataPrefix_,
147 suffix: string,
148 field: DataField,
149 params?: { subscribe?: boolean; ctx?: RealtimeContext },
150 ) {
151 if (params?.subscribe) {
152 return await (params.ctx ?? this.globalCtx).hgetAsync(
153 prefix,
154 suffix,
155 field,
156 );
157 }
158
159 // Try to get subscribed value
160
161 const fullKey = getFullKey(prefix, suffix, field);
162
163 if (this.isSynced(prefix, suffix, field)) {
164 return this.values[fullKey];
165 }
166
167 // Add request to buffer
168
169 this.pushCommand({
170 type: RealtimeCommandType.HGET,
171 args: [prefix, suffix, field],
172 });
173
174 // Wait for response
175
176 const resolvable = new Resolvable<any>();
177 this._responsePromises.set(
178 this._nextCommandId + this.commandBuffer.length - 1,
179 resolvable,
180 );
181 const response = await resolvable;
182
183 this._logger.sub('hget response').info(`${fullKey} (${response})`);
184
185 return response;
186 }
187
188 // Set commands
189

Callers 15

setupMethod · 0.45
_handleMessageMethod · 0.45
bumpRecentItemFunction · 0.45
assertUserSubscribedFunction · 0.45
assertNonDemoAccountFunction · 0.45
addPageBacklinkFunction · 0.45
getUserIdFromEventFunction · 0.45
acceptStep1Function · 0.45
rejectStep1Function · 0.45

Calls 6

getFullKeyFunction · 0.90
hgetAsyncMethod · 0.80
isSyncedMethod · 0.80
pushCommandMethod · 0.80
subMethod · 0.80
setMethod · 0.65

Tested by

no test coverage detected