(generation: unknown)
| 895 | } |
| 896 | |
| 897 | function 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 | |
| 920 | function annotationsPortable(annotations: Schema.Annotations.Annotations | undefined) { |
| 921 | if (annotations === undefined) return true |
no outgoing calls
no test coverage detected