The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as Data from "effect/Data"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | |
| 4 | export class AppIdentityConflict extends Data.TaggedError("AppIdentityConflict")<{ |
| 5 | readonly message: string; |
| 6 | readonly cause?: unknown; |
| 7 | }> {} |
| 8 | |
| 9 | /** Refuse to patch an App observed under a different immutable identity. */ |
| 10 | export const ensureAppImmutableIdentity = ( |
| 11 | app: { |
| 12 | id: string; |
| 13 | projectId: string; |
| 14 | region: { id: string }; |
| 15 | }, |
| 16 | projectId: string, |
| 17 | regionId: string, |
| 18 | ) => |
| 19 | app.projectId === projectId && app.region.id === regionId |
| 20 | ? Effect.void |
| 21 | : Effect.fail( |
| 22 | new AppIdentityConflict({ |
| 23 | message: `Prisma App '${app.id}' has immutable identity project '${app.projectId}' / region '${app.region.id}', but this resource requires project '${projectId}' / region '${regionId}'. Refusing to patch or claim the mismatched App; replace it or import the correct App ID.`, |
| 24 | }), |
| 25 | ); |