(type: string)
| 160 | }; |
| 161 | |
| 162 | export const runtimeInputTypeToConnectionType = (type: string): ConnectionType => { |
| 163 | const normalized = type.toLowerCase(); |
| 164 | |
| 165 | if (normalized === 'credential') { |
| 166 | return { kind: 'contract', name: '__runtime.credential__', credential: true }; |
| 167 | } |
| 168 | |
| 169 | if (normalized.startsWith('credential:')) { |
| 170 | const contractName = type.slice(type.indexOf(':') + 1).trim() || '__runtime.credential__'; |
| 171 | return { kind: 'contract', name: contractName, credential: true }; |
| 172 | } |
| 173 | |
| 174 | if (normalized.startsWith('contract:')) { |
| 175 | const contractName = type.slice(type.indexOf(':') + 1).trim() || '__runtime.contract__'; |
| 176 | return { kind: 'contract', name: contractName }; |
| 177 | } |
| 178 | |
| 179 | switch (normalized) { |
| 180 | case 'any': |
| 181 | return { kind: 'any' }; |
| 182 | case 'text': |
| 183 | case 'string': |
| 184 | return { kind: 'primitive', name: 'text' }; |
| 185 | case 'number': |
| 186 | return { kind: 'primitive', name: 'number' }; |
| 187 | case 'boolean': |
| 188 | return { kind: 'primitive', name: 'boolean' }; |
| 189 | case 'secret': |
| 190 | return { kind: 'primitive', name: 'secret' }; |
| 191 | case 'file': |
| 192 | return { kind: 'primitive', name: 'file' }; |
| 193 | case 'json': |
| 194 | return { kind: 'primitive', name: 'json' }; |
| 195 | case 'array': |
| 196 | return { kind: 'list', element: { kind: 'primitive', name: 'text' } }; |
| 197 | default: |
| 198 | return { kind: 'primitive', name: 'text' }; |
| 199 | } |
| 200 | }; |
no outgoing calls
no test coverage detected