( organizationId: string, metadata: Record<string, string>, )
| 63 | |
| 64 | /** Write WorkOS organization metadata the way v2 does: Update Organization. */ |
| 65 | const setOrgMetadata = ( |
| 66 | organizationId: string, |
| 67 | metadata: Record<string, string>, |
| 68 | ): Effect.Effect<void> => |
| 69 | Effect.promise(async () => { |
| 70 | const response = await fetch( |
| 71 | `http://127.0.0.1:${WORKOS_EMULATOR_PORT}/organizations/${organizationId}`, |
| 72 | { |
| 73 | method: "PUT", |
| 74 | headers: { "content-type": "application/json", authorization: "Bearer sk_test_emulate" }, |
| 75 | body: JSON.stringify({ metadata }), |
| 76 | }, |
| 77 | ); |
| 78 | if (!response.ok) throw new Error(`WorkOS update organization failed (${response.status})`); |
| 79 | await response.body?.cancel(); |
| 80 | }); |
| 81 | |
| 82 | const markMoved = (organizationId: string) => |
| 83 | setOrgMetadata(organizationId, { |
no test coverage detected