| 207 | |
| 208 | catalogIntegrityError(changes) { |
| 209 | if (!this.validateWrites) return null; |
| 210 | |
| 211 | try { |
| 212 | assertCatalogIntegrity([...this.loops.values()], changes); |
| 213 | return null; |
| 214 | } catch (error) { |
| 215 | return Response.json( |
| 216 | { |
| 217 | error: error instanceof Error ? error.message : "Invalid catalog graph", |
| 218 | code: "invalid_catalog_graph", |
| 219 | }, |
| 220 | { status: 409 }, |
| 221 | ); |
| 222 | } |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | function makeEnv(options = {}) { |
| 227 | return { |
| 228 | LOOP_CATALOG: new MemoryLoopCatalogNamespace(options.active ?? true, { |
| 229 | validateWrites: options.validateCatalog === true, |
| 230 | seedLoops: options.seedLoops, |
| 231 | }), |
| 232 | LOOP_PUBLISH_TOKEN: "test-publish-token", |
| 233 | BOOTSTRAP_CATALOG_DIGEST: options.bootstrapDigest || "test-bootstrap-digest", |
| 234 | BOOTSTRAP_LOOP_COUNT: String(options.bootstrapLoopCount ?? 50), |
| 235 | PUBLIC_ORIGIN_URL: "https://calm-mortar-jtek.here.now/", |
| 236 | PUBLIC_SHELL_URL: "https://calm-mortar-jtek.here.now/index.html", |
| 237 | PUBLIC_SITE_HOSTNAME: "signals.forwardfuture.com", |
| 238 | PUBLIC_SITE_PATH: "/loop-library", |
| 239 | }; |
| 240 | } |
| 241 | |