MCPcopy Index your code
hub / github.com/anomalyco/opencode / generationPortable

Function generationPortable

packages/httpapi-codegen/src/index.ts:897–918  ·  view source on GitHub ↗
(generation: unknown)

Source from the content-addressed store, hash-verified

895}
896
897function generationPortable(generation: unknown): boolean {
898 if (typeof generation !== "object" || generation === null) return false
899 const value = generation as {
900 readonly runtime?: unknown
901 readonly Type?: unknown
902 readonly importDeclaration?: unknown
903 }
904 if (typeof value.runtime !== "string" || typeof value.Type !== "string") return false
905 if (value.importDeclaration !== undefined) {
906 if (
907 typeof value.importDeclaration !== "string" ||
908 !/from ["']effect(?:\/[^"']+)?["']$/.test(value.importDeclaration)
909 ) {
910 return false
911 }
912 }
913 const namespace =
914 typeof value.importDeclaration === "string"
915 ? /import(?: type)? \* as ([A-Za-z_$][\w$]*)/.exec(value.importDeclaration)?.[1]
916 : undefined
917 return value.runtime.startsWith("Schema.") || (namespace !== undefined && value.runtime.startsWith(`${namespace}.`))
918}
919
920function annotationsPortable(annotations: Schema.Annotations.Annotations | undefined) {
921 if (annotations === undefined) return true

Callers 2

visitCurrentFunction · 0.85
annotationsPortableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected