( apiSchema: InstantAPIPlatformSchema, )
| 444 | } |
| 445 | |
| 446 | export function apiSchemaToInstantSchemaDef( |
| 447 | apiSchema: InstantAPIPlatformSchema, |
| 448 | ): InstantSchemaDef<EntitiesDef, LinksDef<EntitiesDef>, RoomsDef> { |
| 449 | const entities: EntitiesDef = {}; |
| 450 | for (const [etype, attrs] of sortedEntries(apiSchema.blobs)) { |
| 451 | entities[etype] = apiSchemaBlobToEntityDef(attrs); |
| 452 | } |
| 453 | const links: LinksDef<EntitiesDef> = {}; |
| 454 | for (const [_name, attr] of sortedEntries(apiSchema.refs)) { |
| 455 | const link = apiSchemaAttrToLinkDef(attr); |
| 456 | const linkName = apiSchemaAttrToLinkName(attr); |
| 457 | links[linkName] = link; |
| 458 | } |
| 459 | |
| 460 | return i.schema({ entities, links }); |
| 461 | } |
| 462 | |
| 463 | function coerceApp<Opts extends AppDataOpts>( |
| 464 | app: AppResponseJSON<Opts>, |
no test coverage detected