()
| 852 | } |
| 853 | |
| 854 | async function taskMaintenance() { |
| 855 | { |
| 856 | console.info(`===== BROKEN SCHEMAS =====`) |
| 857 | forEachCatalogUrl((url) => { |
| 858 | if ( |
| 859 | url.startsWith(SchemaStoreUrls[0]) || |
| 860 | url.startsWith(SchemaStoreUrls[1]) |
| 861 | ) { |
| 862 | return |
| 863 | } |
| 864 | |
| 865 | fetch(url) |
| 866 | .then(async (res) => { |
| 867 | if (res.ok) { |
| 868 | assertJsonOrYaml(url, await res.text()) |
| 869 | return |
| 870 | } |
| 871 | |
| 872 | if ( |
| 873 | [ |
| 874 | // https://github.com/SchemaStore/schemastore/pull/3926#issuecomment-2234102850 |
| 875 | 'https://deployments.allegrogroup.com/tycho/schema', |
| 876 | ].includes(url) |
| 877 | ) { |
| 878 | return |
| 879 | } |
| 880 | |
| 881 | if (res.status === 405) { |
| 882 | try { |
| 883 | const res = await fetch(url) |
| 884 | if (res.ok) { |
| 885 | assertJsonOrYaml(url, await res.text()) |
| 886 | return |
| 887 | } |
| 888 | |
| 889 | console.info( |
| 890 | `NOT OK (${res.status}/${res.statusText}): ${url} (after 405 code)`, |
| 891 | ) |
| 892 | } catch (err) { |
| 893 | console.info( |
| 894 | `NOT OK (${/** @type {FetchError} */ (err).code}): ${url} (after 405 code)`, |
| 895 | ) |
| 896 | } |
| 897 | return |
| 898 | } |
| 899 | console.info(`NOT OK (${res.status}/${res.statusText}): ${url}`) |
| 900 | }) |
| 901 | .catch((err) => { |
| 902 | console.info(`NOT OK (${err.code}): ${url}`) |
| 903 | }) |
| 904 | |
| 905 | function assertJsonOrYaml( |
| 906 | /** @type {string} */ url, |
| 907 | /** @type {string} */ str, |
| 908 | ) { |
| 909 | try { |
| 910 | JSON.parse(str) |
| 911 | return |
nothing calls this directly
no test coverage detected