* Helper method for parsing a URL string into a scheme and a path. * * @param url E.g., 'localstorage://my-model' * @returns A dictionary with two fields: scheme and path. * Scheme: e.g., 'localstorage' in the example above. * Path: e.g., 'my-model' in the example above.
(url: string)
| 92 | * Path: e.g., 'my-model' in the example above. |
| 93 | */ |
| 94 | function parseURL(url: string): {scheme: string, path: string} { |
| 95 | if (url.indexOf(URL_SCHEME_SUFFIX) === -1) { |
| 96 | throw new Error( |
| 97 | `The url string provided does not contain a scheme. ` + |
| 98 | `Supported schemes are: ` + |
| 99 | `${ModelStoreManagerRegistry.getSchemes().join(',')}`); |
| 100 | } |
| 101 | return { |
| 102 | scheme: url.split(URL_SCHEME_SUFFIX)[0], |
| 103 | path: url.split(URL_SCHEME_SUFFIX)[1], |
| 104 | }; |
| 105 | } |
| 106 | |
| 107 | async function cloneModelInternal( |
| 108 | sourceURL: string, destURL: string, |
no test coverage detected
searching dependent graphs…