( apiKey: typeof OrgApiKey.Type, organizationId: string, )
| 224 | // workspace-wide, so a response naming a different org than the one requested |
| 225 | // must not be surfaced as that org's key. |
| 226 | const summaryFromOrgApiKey = ( |
| 227 | apiKey: typeof OrgApiKey.Type, |
| 228 | organizationId: string, |
| 229 | ): ApiKeySummary | null => { |
| 230 | if (apiKey.owner.id !== organizationId) return null; |
| 231 | return { |
| 232 | id: apiKey.id, |
| 233 | name: apiKey.name ?? "API key", |
| 234 | obfuscatedValue: apiKey.obfuscatedValue ?? apiKey.obfuscated_value ?? "", |
| 235 | createdAt: apiKey.createdAt ?? apiKey.created_at ?? "", |
| 236 | updatedAt: apiKey.updatedAt ?? apiKey.updated_at ?? "", |
| 237 | lastUsedAt: apiKey.lastUsedAt ?? apiKey.last_used_at ?? null, |
| 238 | }; |
| 239 | }; |
| 240 | |
| 241 | const orgListFromResponse = (value: unknown, organizationId: string): readonly ApiKeySummary[] => |
| 242 | Option.match(decodeListOrgApiKeysResponse(value), { |
no outgoing calls
no test coverage detected