(content: string)
| 230 | } |
| 231 | |
| 232 | export 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 | |
| 252 | export function serializeStoreRegistryState(state: StoreRegistryState): string { |
| 253 | const result = RegistryStateSchema.safeParse(state); |
no test coverage detected