History

fix wasm

Rhys Sullivan committed 8 months ago

Commit cc270611 parent bcdff4d1 file · +7 −1Browse files

Unified · Split

packages/control-plane/src/runtime/source-discovery.ts+7−1
@@ -619,10 +619,12 @@ const tryDetectOpenApi = (input: { · 618 unmodified lines
619 }));619 }));
620 620
621 if (response._tag === "Left") {621 if (response._tag === "Left") {
622 console.warn(`[discovery] OpenAPI probe HTTP fetch failed for ${input.normalizedUrl}:`, response.left.message);
622 return null;623 return null;
623 }624 }
624 625
625 if (response.right.status < 200 || response.right.status >= 300) {626 if (response.right.status < 200 || response.right.status >= 300) {
627 console.warn(`[discovery] OpenAPI probe got status ${response.right.status} for ${input.normalizedUrl}`);
626 return null;628 return null;
627 }629 }
628 630
@@ -630,6 +632,7 @@ const tryDetectOpenApi = (input: { · 1 unmodified line
630 extractOpenApiManifest(input.normalizedUrl, response.right.text),632 extractOpenApiManifest(input.normalizedUrl, response.right.text),
631 );633 );
632 if (manifest._tag === "Left") {634 if (manifest._tag === "Left") {
635 console.warn(`[discovery] OpenAPI manifest extraction failed for ${input.normalizedUrl}:`, manifest.left instanceof Error ? manifest.left.message : String(manifest.left));
633 return null;636 return null;
634 }637 }
635 638
@@ -662,7 +665,10 @@ const tryDetectOpenApi = (input: { · 26 unmodified lines
662 warnings: [],665 warnings: [],
663 },666 },
664 } satisfies OpenApiProbeResult;667 } satisfies OpenApiProbeResult;
665 }).pipe(Effect.catchAll(() => Effect.succeed(null)));668 }).pipe(Effect.catchAll((error: unknown) => {
669 console.warn(`[discovery] OpenAPI detection unexpected error for ${input.normalizedUrl}:`, error instanceof Error ? error.message : String(error));
670 return Effect.succeed(null);
671 }));
666 672
667const looksLikeGraphqlEndpoint = (normalizedUrl: string): boolean =>673const looksLikeGraphqlEndpoint = (normalizedUrl: string): boolean =>
668 /graphql/i.test(new URL(normalizedUrl).pathname);674 /graphql/i.test(new URL(normalizedUrl).pathname);