MCPcopy
hub / github.com/Fission-AI/OpenSpec / parseStoreMetadataState

Function parseStoreMetadataState

src/core/store/foundation.ts:232–250  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

230}
231
232export function parseStoreMetadataState(content: string): StoreMetadataState {
233 const raw = parseYamlObject(content, 'store metadata state');
234 const result = MetadataStateSchema.safeParse(raw);
235
236 if (!result.success) {
237 throw invalidStoreStateError(
238 'store metadata state',
239 formatZodIssues(result.error)
240 );
241 }
242
243 validateStoreId(result.data.id);
244
245 return {
246 version: 1,
247 id: result.data.id,
248 ...(result.data.remote !== undefined ? { remote: result.data.remote } : {}),
249 };
250}
251
252export function serializeStoreRegistryState(state: StoreRegistryState): string {
253 const result = RegistryStateSchema.safeParse(state);

Callers 3

foundation.test.tsFile · 0.85
readStoreMetadataStateFunction · 0.85

Calls 4

parseYamlObjectFunction · 0.85
invalidStoreStateErrorFunction · 0.85
formatZodIssuesFunction · 0.85
validateStoreIdFunction · 0.85

Tested by

no test coverage detected