| 64 | /** Whether the organization has moved to v2. Never fails: an unavailable |
| 65 | * read answers `null`, so a WorkOS outage shows no notice. */ |
| 66 | export const v2Moved = ( |
| 67 | source: V2MovedSource, |
| 68 | organizationId: string, |
| 69 | v2Origin: URL, |
| 70 | ): Effect.Effect<V2Moved | null> => |
| 71 | source.organizationMetadata(organizationId).pipe( |
| 72 | Effect.map((metadata) => parseV2Moved(metadata, v2Origin)), |
| 73 | Effect.orElseSucceed(() => null), |
| 74 | Effect.withSpan("v2Moved.read"), |
| 75 | ); |
| 76 | |
| 77 | /** The organization's metadata, read live from WorkOS (where v2 writes it). */ |
| 78 | export const liveV2MovedSource = Effect.gen(function* () { |