(row: ConnectionRow)
| 1122 | }; |
| 1123 | |
| 1124 | const rowToConnection = (row: ConnectionRow): Connection => { |
| 1125 | const owner = row.owner as Owner; |
| 1126 | const integration = IntegrationSlug.make(row.integration); |
| 1127 | const name = ConnectionName.make(row.name); |
| 1128 | return { |
| 1129 | owner, |
| 1130 | name, |
| 1131 | integration, |
| 1132 | template: AuthTemplateSlug.make(row.template), |
| 1133 | provider: ProviderKey.make(row.provider), |
| 1134 | address: connectionAddress(owner, integration, name), |
| 1135 | identityLabel: row.identity_label ?? null, |
| 1136 | description: row.description ?? null, |
| 1137 | expiresAt: row.expires_at == null ? null : Number(row.expires_at), |
| 1138 | oauthClient: row.oauth_client == null ? null : OAuthClientSlug.make(String(row.oauth_client)), |
| 1139 | oauthClientOwner: |
| 1140 | row.oauth_client_owner == null ? null : (String(row.oauth_client_owner) as Owner), |
| 1141 | oauthScope: row.oauth_scope == null ? null : String(row.oauth_scope), |
| 1142 | missingOAuthScopes: missingOAuthScopesFromProviderState(row.provider_state), |
| 1143 | lastHealth: presentedLastHealth(row), |
| 1144 | }; |
| 1145 | }; |
| 1146 | |
| 1147 | /** Parse a connection row's `oauth_scope` (space-delimited, as echoed by the |
| 1148 | * token endpoint) into the credential's `grantedScopes`. Undefined when the |
no test coverage detected