Upload folder using huggingface_hub
Browse files- 6.1.1/client/package-lock.json +2093 -0
- 6.1.1/client/package.json +46 -0
- 6.1.1/client/src/client.ts +539 -0
- 6.1.1/client/src/constants.ts +41 -0
- 6.1.1/client/src/globals.d.ts +12 -0
- 6.1.1/client/src/helpers/api_info.ts +477 -0
- 6.1.1/client/src/helpers/data.ts +221 -0
- 6.1.1/client/src/helpers/init_helpers.ts +247 -0
- 6.1.1/client/src/helpers/spaces.ts +252 -0
- 6.1.1/client/src/index.ts +26 -0
- 6.1.1/client/src/test/handlers.ts +693 -0
- 6.1.1/client/src/test/mock_eventsource.ts +13 -0
- 6.1.1/client/src/test/server.ts +6 -0
- 6.1.1/client/src/test/test_data.ts +562 -0
- 6.1.1/client/src/types.ts +426 -0
- 6.1.1/client/src/upload.ts +109 -0
- 6.1.1/client/src/utils/duplicate.ts +126 -0
- 6.1.1/client/src/utils/filesize.ts +41 -0
- 6.1.1/client/src/utils/handle_blob.ts +142 -0
- 6.1.1/client/src/utils/post_data.ts +38 -0
- 6.1.1/client/src/utils/predict.ts +51 -0
- 6.1.1/client/src/utils/stream.ts +229 -0
- 6.1.1/client/src/utils/submit.ts +744 -0
- 6.1.1/client/src/utils/upload_files.ts +52 -0
- 6.1.1/client/src/utils/view_api.ts +57 -0
- 6.1.1/client/src/vite-env.d.ts +3 -0
- 6.1.1/client/tsconfig.json +28 -0
6.1.1/client/package-lock.json
ADDED
|
@@ -0,0 +1,2093 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
| 1 |
+
{
|
| 2 |
+
"name": "@gradio/client",
|
| 3 |
+
"version": "1.19.1",
|
| 4 |
+
"lockfileVersion": 3,
|
| 5 |
+
"requires": true,
|
| 6 |
+
"packages": {
|
| 7 |
+
"": {
|
| 8 |
+
"name": "@gradio/client",
|
| 9 |
+
"version": "1.19.1",
|
| 10 |
+
"license": "ISC",
|
| 11 |
+
"dependencies": {
|
| 12 |
+
"@types/eventsource": "^1.1.15",
|
| 13 |
+
"bufferutil": "^4.0.7",
|
| 14 |
+
"eventsource": "^2.0.2",
|
| 15 |
+
"fetch-event-stream": "^0.1.5",
|
| 16 |
+
"msw": "^2.2.1",
|
| 17 |
+
"semiver": "^1.1.0",
|
| 18 |
+
"textlinestream": "^1.1.1",
|
| 19 |
+
"typescript": "^5.0.0",
|
| 20 |
+
"vi": "^1.0.0",
|
| 21 |
+
"vite": "^6.4.1",
|
| 22 |
+
"ws": "^8.13.0"
|
| 23 |
+
},
|
| 24 |
+
"devDependencies": {
|
| 25 |
+
"@types/ws": "^8.5.10",
|
| 26 |
+
"esbuild": "^0.21.0"
|
| 27 |
+
},
|
| 28 |
+
"engines": {
|
| 29 |
+
"node": ">=18.0.0"
|
| 30 |
+
}
|
| 31 |
+
},
|
| 32 |
+
"node_modules/@esbuild/aix-ppc64": {
|
| 33 |
+
"version": "0.21.5",
|
| 34 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz",
|
| 35 |
+
"integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==",
|
| 36 |
+
"cpu": [
|
| 37 |
+
"ppc64"
|
| 38 |
+
],
|
| 39 |
+
"dev": true,
|
| 40 |
+
"license": "MIT",
|
| 41 |
+
"optional": true,
|
| 42 |
+
"os": [
|
| 43 |
+
"aix"
|
| 44 |
+
],
|
| 45 |
+
"engines": {
|
| 46 |
+
"node": ">=12"
|
| 47 |
+
}
|
| 48 |
+
},
|
| 49 |
+
"node_modules/@esbuild/android-arm": {
|
| 50 |
+
"version": "0.21.5",
|
| 51 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/android-arm/-/android-arm-0.21.5.tgz",
|
| 52 |
+
"integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==",
|
| 53 |
+
"cpu": [
|
| 54 |
+
"arm"
|
| 55 |
+
],
|
| 56 |
+
"dev": true,
|
| 57 |
+
"license": "MIT",
|
| 58 |
+
"optional": true,
|
| 59 |
+
"os": [
|
| 60 |
+
"android"
|
| 61 |
+
],
|
| 62 |
+
"engines": {
|
| 63 |
+
"node": ">=12"
|
| 64 |
+
}
|
| 65 |
+
},
|
| 66 |
+
"node_modules/@esbuild/android-arm64": {
|
| 67 |
+
"version": "0.21.5",
|
| 68 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz",
|
| 69 |
+
"integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==",
|
| 70 |
+
"cpu": [
|
| 71 |
+
"arm64"
|
| 72 |
+
],
|
| 73 |
+
"dev": true,
|
| 74 |
+
"license": "MIT",
|
| 75 |
+
"optional": true,
|
| 76 |
+
"os": [
|
| 77 |
+
"android"
|
| 78 |
+
],
|
| 79 |
+
"engines": {
|
| 80 |
+
"node": ">=12"
|
| 81 |
+
}
|
| 82 |
+
},
|
| 83 |
+
"node_modules/@esbuild/android-x64": {
|
| 84 |
+
"version": "0.21.5",
|
| 85 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/android-x64/-/android-x64-0.21.5.tgz",
|
| 86 |
+
"integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==",
|
| 87 |
+
"cpu": [
|
| 88 |
+
"x64"
|
| 89 |
+
],
|
| 90 |
+
"dev": true,
|
| 91 |
+
"license": "MIT",
|
| 92 |
+
"optional": true,
|
| 93 |
+
"os": [
|
| 94 |
+
"android"
|
| 95 |
+
],
|
| 96 |
+
"engines": {
|
| 97 |
+
"node": ">=12"
|
| 98 |
+
}
|
| 99 |
+
},
|
| 100 |
+
"node_modules/@esbuild/darwin-arm64": {
|
| 101 |
+
"version": "0.21.5",
|
| 102 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz",
|
| 103 |
+
"integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==",
|
| 104 |
+
"cpu": [
|
| 105 |
+
"arm64"
|
| 106 |
+
],
|
| 107 |
+
"dev": true,
|
| 108 |
+
"license": "MIT",
|
| 109 |
+
"optional": true,
|
| 110 |
+
"os": [
|
| 111 |
+
"darwin"
|
| 112 |
+
],
|
| 113 |
+
"engines": {
|
| 114 |
+
"node": ">=12"
|
| 115 |
+
}
|
| 116 |
+
},
|
| 117 |
+
"node_modules/@esbuild/darwin-x64": {
|
| 118 |
+
"version": "0.21.5",
|
| 119 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz",
|
| 120 |
+
"integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==",
|
| 121 |
+
"cpu": [
|
| 122 |
+
"x64"
|
| 123 |
+
],
|
| 124 |
+
"dev": true,
|
| 125 |
+
"license": "MIT",
|
| 126 |
+
"optional": true,
|
| 127 |
+
"os": [
|
| 128 |
+
"darwin"
|
| 129 |
+
],
|
| 130 |
+
"engines": {
|
| 131 |
+
"node": ">=12"
|
| 132 |
+
}
|
| 133 |
+
},
|
| 134 |
+
"node_modules/@esbuild/freebsd-arm64": {
|
| 135 |
+
"version": "0.21.5",
|
| 136 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz",
|
| 137 |
+
"integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==",
|
| 138 |
+
"cpu": [
|
| 139 |
+
"arm64"
|
| 140 |
+
],
|
| 141 |
+
"dev": true,
|
| 142 |
+
"license": "MIT",
|
| 143 |
+
"optional": true,
|
| 144 |
+
"os": [
|
| 145 |
+
"freebsd"
|
| 146 |
+
],
|
| 147 |
+
"engines": {
|
| 148 |
+
"node": ">=12"
|
| 149 |
+
}
|
| 150 |
+
},
|
| 151 |
+
"node_modules/@esbuild/freebsd-x64": {
|
| 152 |
+
"version": "0.21.5",
|
| 153 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz",
|
| 154 |
+
"integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==",
|
| 155 |
+
"cpu": [
|
| 156 |
+
"x64"
|
| 157 |
+
],
|
| 158 |
+
"dev": true,
|
| 159 |
+
"license": "MIT",
|
| 160 |
+
"optional": true,
|
| 161 |
+
"os": [
|
| 162 |
+
"freebsd"
|
| 163 |
+
],
|
| 164 |
+
"engines": {
|
| 165 |
+
"node": ">=12"
|
| 166 |
+
}
|
| 167 |
+
},
|
| 168 |
+
"node_modules/@esbuild/linux-arm": {
|
| 169 |
+
"version": "0.21.5",
|
| 170 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz",
|
| 171 |
+
"integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==",
|
| 172 |
+
"cpu": [
|
| 173 |
+
"arm"
|
| 174 |
+
],
|
| 175 |
+
"dev": true,
|
| 176 |
+
"license": "MIT",
|
| 177 |
+
"optional": true,
|
| 178 |
+
"os": [
|
| 179 |
+
"linux"
|
| 180 |
+
],
|
| 181 |
+
"engines": {
|
| 182 |
+
"node": ">=12"
|
| 183 |
+
}
|
| 184 |
+
},
|
| 185 |
+
"node_modules/@esbuild/linux-arm64": {
|
| 186 |
+
"version": "0.21.5",
|
| 187 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz",
|
| 188 |
+
"integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==",
|
| 189 |
+
"cpu": [
|
| 190 |
+
"arm64"
|
| 191 |
+
],
|
| 192 |
+
"dev": true,
|
| 193 |
+
"license": "MIT",
|
| 194 |
+
"optional": true,
|
| 195 |
+
"os": [
|
| 196 |
+
"linux"
|
| 197 |
+
],
|
| 198 |
+
"engines": {
|
| 199 |
+
"node": ">=12"
|
| 200 |
+
}
|
| 201 |
+
},
|
| 202 |
+
"node_modules/@esbuild/linux-ia32": {
|
| 203 |
+
"version": "0.21.5",
|
| 204 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz",
|
| 205 |
+
"integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==",
|
| 206 |
+
"cpu": [
|
| 207 |
+
"ia32"
|
| 208 |
+
],
|
| 209 |
+
"dev": true,
|
| 210 |
+
"license": "MIT",
|
| 211 |
+
"optional": true,
|
| 212 |
+
"os": [
|
| 213 |
+
"linux"
|
| 214 |
+
],
|
| 215 |
+
"engines": {
|
| 216 |
+
"node": ">=12"
|
| 217 |
+
}
|
| 218 |
+
},
|
| 219 |
+
"node_modules/@esbuild/linux-loong64": {
|
| 220 |
+
"version": "0.21.5",
|
| 221 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz",
|
| 222 |
+
"integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==",
|
| 223 |
+
"cpu": [
|
| 224 |
+
"loong64"
|
| 225 |
+
],
|
| 226 |
+
"dev": true,
|
| 227 |
+
"license": "MIT",
|
| 228 |
+
"optional": true,
|
| 229 |
+
"os": [
|
| 230 |
+
"linux"
|
| 231 |
+
],
|
| 232 |
+
"engines": {
|
| 233 |
+
"node": ">=12"
|
| 234 |
+
}
|
| 235 |
+
},
|
| 236 |
+
"node_modules/@esbuild/linux-mips64el": {
|
| 237 |
+
"version": "0.21.5",
|
| 238 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz",
|
| 239 |
+
"integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==",
|
| 240 |
+
"cpu": [
|
| 241 |
+
"mips64el"
|
| 242 |
+
],
|
| 243 |
+
"dev": true,
|
| 244 |
+
"license": "MIT",
|
| 245 |
+
"optional": true,
|
| 246 |
+
"os": [
|
| 247 |
+
"linux"
|
| 248 |
+
],
|
| 249 |
+
"engines": {
|
| 250 |
+
"node": ">=12"
|
| 251 |
+
}
|
| 252 |
+
},
|
| 253 |
+
"node_modules/@esbuild/linux-ppc64": {
|
| 254 |
+
"version": "0.21.5",
|
| 255 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz",
|
| 256 |
+
"integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==",
|
| 257 |
+
"cpu": [
|
| 258 |
+
"ppc64"
|
| 259 |
+
],
|
| 260 |
+
"dev": true,
|
| 261 |
+
"license": "MIT",
|
| 262 |
+
"optional": true,
|
| 263 |
+
"os": [
|
| 264 |
+
"linux"
|
| 265 |
+
],
|
| 266 |
+
"engines": {
|
| 267 |
+
"node": ">=12"
|
| 268 |
+
}
|
| 269 |
+
},
|
| 270 |
+
"node_modules/@esbuild/linux-riscv64": {
|
| 271 |
+
"version": "0.21.5",
|
| 272 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz",
|
| 273 |
+
"integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==",
|
| 274 |
+
"cpu": [
|
| 275 |
+
"riscv64"
|
| 276 |
+
],
|
| 277 |
+
"dev": true,
|
| 278 |
+
"license": "MIT",
|
| 279 |
+
"optional": true,
|
| 280 |
+
"os": [
|
| 281 |
+
"linux"
|
| 282 |
+
],
|
| 283 |
+
"engines": {
|
| 284 |
+
"node": ">=12"
|
| 285 |
+
}
|
| 286 |
+
},
|
| 287 |
+
"node_modules/@esbuild/linux-s390x": {
|
| 288 |
+
"version": "0.21.5",
|
| 289 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz",
|
| 290 |
+
"integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==",
|
| 291 |
+
"cpu": [
|
| 292 |
+
"s390x"
|
| 293 |
+
],
|
| 294 |
+
"dev": true,
|
| 295 |
+
"license": "MIT",
|
| 296 |
+
"optional": true,
|
| 297 |
+
"os": [
|
| 298 |
+
"linux"
|
| 299 |
+
],
|
| 300 |
+
"engines": {
|
| 301 |
+
"node": ">=12"
|
| 302 |
+
}
|
| 303 |
+
},
|
| 304 |
+
"node_modules/@esbuild/linux-x64": {
|
| 305 |
+
"version": "0.21.5",
|
| 306 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz",
|
| 307 |
+
"integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==",
|
| 308 |
+
"cpu": [
|
| 309 |
+
"x64"
|
| 310 |
+
],
|
| 311 |
+
"dev": true,
|
| 312 |
+
"license": "MIT",
|
| 313 |
+
"optional": true,
|
| 314 |
+
"os": [
|
| 315 |
+
"linux"
|
| 316 |
+
],
|
| 317 |
+
"engines": {
|
| 318 |
+
"node": ">=12"
|
| 319 |
+
}
|
| 320 |
+
},
|
| 321 |
+
"node_modules/@esbuild/netbsd-arm64": {
|
| 322 |
+
"version": "0.25.11",
|
| 323 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.11.tgz",
|
| 324 |
+
"integrity": "sha512-hr9Oxj1Fa4r04dNpWr3P8QKVVsjQhqrMSUzZzf+LZcYjZNqhA3IAfPQdEh1FLVUJSiu6sgAwp3OmwBfbFgG2Xg==",
|
| 325 |
+
"cpu": [
|
| 326 |
+
"arm64"
|
| 327 |
+
],
|
| 328 |
+
"license": "MIT",
|
| 329 |
+
"optional": true,
|
| 330 |
+
"os": [
|
| 331 |
+
"netbsd"
|
| 332 |
+
],
|
| 333 |
+
"engines": {
|
| 334 |
+
"node": ">=18"
|
| 335 |
+
}
|
| 336 |
+
},
|
| 337 |
+
"node_modules/@esbuild/netbsd-x64": {
|
| 338 |
+
"version": "0.21.5",
|
| 339 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz",
|
| 340 |
+
"integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==",
|
| 341 |
+
"cpu": [
|
| 342 |
+
"x64"
|
| 343 |
+
],
|
| 344 |
+
"dev": true,
|
| 345 |
+
"license": "MIT",
|
| 346 |
+
"optional": true,
|
| 347 |
+
"os": [
|
| 348 |
+
"netbsd"
|
| 349 |
+
],
|
| 350 |
+
"engines": {
|
| 351 |
+
"node": ">=12"
|
| 352 |
+
}
|
| 353 |
+
},
|
| 354 |
+
"node_modules/@esbuild/openbsd-arm64": {
|
| 355 |
+
"version": "0.25.11",
|
| 356 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.11.tgz",
|
| 357 |
+
"integrity": "sha512-Qq6YHhayieor3DxFOoYM1q0q1uMFYb7cSpLD2qzDSvK1NAvqFi8Xgivv0cFC6J+hWVw2teCYltyy9/m/14ryHg==",
|
| 358 |
+
"cpu": [
|
| 359 |
+
"arm64"
|
| 360 |
+
],
|
| 361 |
+
"license": "MIT",
|
| 362 |
+
"optional": true,
|
| 363 |
+
"os": [
|
| 364 |
+
"openbsd"
|
| 365 |
+
],
|
| 366 |
+
"engines": {
|
| 367 |
+
"node": ">=18"
|
| 368 |
+
}
|
| 369 |
+
},
|
| 370 |
+
"node_modules/@esbuild/openbsd-x64": {
|
| 371 |
+
"version": "0.21.5",
|
| 372 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz",
|
| 373 |
+
"integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==",
|
| 374 |
+
"cpu": [
|
| 375 |
+
"x64"
|
| 376 |
+
],
|
| 377 |
+
"dev": true,
|
| 378 |
+
"license": "MIT",
|
| 379 |
+
"optional": true,
|
| 380 |
+
"os": [
|
| 381 |
+
"openbsd"
|
| 382 |
+
],
|
| 383 |
+
"engines": {
|
| 384 |
+
"node": ">=12"
|
| 385 |
+
}
|
| 386 |
+
},
|
| 387 |
+
"node_modules/@esbuild/openharmony-arm64": {
|
| 388 |
+
"version": "0.25.11",
|
| 389 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.11.tgz",
|
| 390 |
+
"integrity": "sha512-rOREuNIQgaiR+9QuNkbkxubbp8MSO9rONmwP5nKncnWJ9v5jQ4JxFnLu4zDSRPf3x4u+2VN4pM4RdyIzDty/wQ==",
|
| 391 |
+
"cpu": [
|
| 392 |
+
"arm64"
|
| 393 |
+
],
|
| 394 |
+
"license": "MIT",
|
| 395 |
+
"optional": true,
|
| 396 |
+
"os": [
|
| 397 |
+
"openharmony"
|
| 398 |
+
],
|
| 399 |
+
"engines": {
|
| 400 |
+
"node": ">=18"
|
| 401 |
+
}
|
| 402 |
+
},
|
| 403 |
+
"node_modules/@esbuild/sunos-x64": {
|
| 404 |
+
"version": "0.21.5",
|
| 405 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz",
|
| 406 |
+
"integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==",
|
| 407 |
+
"cpu": [
|
| 408 |
+
"x64"
|
| 409 |
+
],
|
| 410 |
+
"dev": true,
|
| 411 |
+
"license": "MIT",
|
| 412 |
+
"optional": true,
|
| 413 |
+
"os": [
|
| 414 |
+
"sunos"
|
| 415 |
+
],
|
| 416 |
+
"engines": {
|
| 417 |
+
"node": ">=12"
|
| 418 |
+
}
|
| 419 |
+
},
|
| 420 |
+
"node_modules/@esbuild/win32-arm64": {
|
| 421 |
+
"version": "0.21.5",
|
| 422 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz",
|
| 423 |
+
"integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==",
|
| 424 |
+
"cpu": [
|
| 425 |
+
"arm64"
|
| 426 |
+
],
|
| 427 |
+
"dev": true,
|
| 428 |
+
"license": "MIT",
|
| 429 |
+
"optional": true,
|
| 430 |
+
"os": [
|
| 431 |
+
"win32"
|
| 432 |
+
],
|
| 433 |
+
"engines": {
|
| 434 |
+
"node": ">=12"
|
| 435 |
+
}
|
| 436 |
+
},
|
| 437 |
+
"node_modules/@esbuild/win32-ia32": {
|
| 438 |
+
"version": "0.21.5",
|
| 439 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz",
|
| 440 |
+
"integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==",
|
| 441 |
+
"cpu": [
|
| 442 |
+
"ia32"
|
| 443 |
+
],
|
| 444 |
+
"dev": true,
|
| 445 |
+
"license": "MIT",
|
| 446 |
+
"optional": true,
|
| 447 |
+
"os": [
|
| 448 |
+
"win32"
|
| 449 |
+
],
|
| 450 |
+
"engines": {
|
| 451 |
+
"node": ">=12"
|
| 452 |
+
}
|
| 453 |
+
},
|
| 454 |
+
"node_modules/@esbuild/win32-x64": {
|
| 455 |
+
"version": "0.21.5",
|
| 456 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz",
|
| 457 |
+
"integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==",
|
| 458 |
+
"cpu": [
|
| 459 |
+
"x64"
|
| 460 |
+
],
|
| 461 |
+
"dev": true,
|
| 462 |
+
"license": "MIT",
|
| 463 |
+
"optional": true,
|
| 464 |
+
"os": [
|
| 465 |
+
"win32"
|
| 466 |
+
],
|
| 467 |
+
"engines": {
|
| 468 |
+
"node": ">=12"
|
| 469 |
+
}
|
| 470 |
+
},
|
| 471 |
+
"node_modules/@inquirer/ansi": {
|
| 472 |
+
"version": "1.0.1",
|
| 473 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@inquirer/ansi/-/ansi-1.0.1.tgz",
|
| 474 |
+
"integrity": "sha512-yqq0aJW/5XPhi5xOAL1xRCpe1eh8UFVgYFpFsjEqmIR8rKLyP+HINvFXwUaxYICflJrVlxnp7lLN6As735kVpw==",
|
| 475 |
+
"license": "MIT",
|
| 476 |
+
"engines": {
|
| 477 |
+
"node": ">=18"
|
| 478 |
+
}
|
| 479 |
+
},
|
| 480 |
+
"node_modules/@inquirer/confirm": {
|
| 481 |
+
"version": "5.1.19",
|
| 482 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@inquirer/confirm/-/confirm-5.1.19.tgz",
|
| 483 |
+
"integrity": "sha512-wQNz9cfcxrtEnUyG5PndC8g3gZ7lGDBzmWiXZkX8ot3vfZ+/BLjR8EvyGX4YzQLeVqtAlY/YScZpW7CW8qMoDQ==",
|
| 484 |
+
"license": "MIT",
|
| 485 |
+
"dependencies": {
|
| 486 |
+
"@inquirer/core": "^10.3.0",
|
| 487 |
+
"@inquirer/type": "^3.0.9"
|
| 488 |
+
},
|
| 489 |
+
"engines": {
|
| 490 |
+
"node": ">=18"
|
| 491 |
+
},
|
| 492 |
+
"peerDependencies": {
|
| 493 |
+
"@types/node": ">=18"
|
| 494 |
+
},
|
| 495 |
+
"peerDependenciesMeta": {
|
| 496 |
+
"@types/node": {
|
| 497 |
+
"optional": true
|
| 498 |
+
}
|
| 499 |
+
}
|
| 500 |
+
},
|
| 501 |
+
"node_modules/@inquirer/core": {
|
| 502 |
+
"version": "10.3.0",
|
| 503 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@inquirer/core/-/core-10.3.0.tgz",
|
| 504 |
+
"integrity": "sha512-Uv2aPPPSK5jeCplQmQ9xadnFx2Zhj9b5Dj7bU6ZeCdDNNY11nhYy4btcSdtDguHqCT2h5oNeQTcUNSGGLA7NTA==",
|
| 505 |
+
"license": "MIT",
|
| 506 |
+
"dependencies": {
|
| 507 |
+
"@inquirer/ansi": "^1.0.1",
|
| 508 |
+
"@inquirer/figures": "^1.0.14",
|
| 509 |
+
"@inquirer/type": "^3.0.9",
|
| 510 |
+
"cli-width": "^4.1.0",
|
| 511 |
+
"mute-stream": "^2.0.0",
|
| 512 |
+
"signal-exit": "^4.1.0",
|
| 513 |
+
"wrap-ansi": "^6.2.0",
|
| 514 |
+
"yoctocolors-cjs": "^2.1.2"
|
| 515 |
+
},
|
| 516 |
+
"engines": {
|
| 517 |
+
"node": ">=18"
|
| 518 |
+
},
|
| 519 |
+
"peerDependencies": {
|
| 520 |
+
"@types/node": ">=18"
|
| 521 |
+
},
|
| 522 |
+
"peerDependenciesMeta": {
|
| 523 |
+
"@types/node": {
|
| 524 |
+
"optional": true
|
| 525 |
+
}
|
| 526 |
+
}
|
| 527 |
+
},
|
| 528 |
+
"node_modules/@inquirer/figures": {
|
| 529 |
+
"version": "1.0.14",
|
| 530 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@inquirer/figures/-/figures-1.0.14.tgz",
|
| 531 |
+
"integrity": "sha512-DbFgdt+9/OZYFM+19dbpXOSeAstPy884FPy1KjDu4anWwymZeOYhMY1mdFri172htv6mvc/uvIAAi7b7tvjJBQ==",
|
| 532 |
+
"license": "MIT",
|
| 533 |
+
"engines": {
|
| 534 |
+
"node": ">=18"
|
| 535 |
+
}
|
| 536 |
+
},
|
| 537 |
+
"node_modules/@inquirer/type": {
|
| 538 |
+
"version": "3.0.9",
|
| 539 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@inquirer/type/-/type-3.0.9.tgz",
|
| 540 |
+
"integrity": "sha512-QPaNt/nmE2bLGQa9b7wwyRJoLZ7pN6rcyXvzU0YCmivmJyq1BVo94G98tStRWkoD1RgDX5C+dPlhhHzNdu/W/w==",
|
| 541 |
+
"license": "MIT",
|
| 542 |
+
"engines": {
|
| 543 |
+
"node": ">=18"
|
| 544 |
+
},
|
| 545 |
+
"peerDependencies": {
|
| 546 |
+
"@types/node": ">=18"
|
| 547 |
+
},
|
| 548 |
+
"peerDependenciesMeta": {
|
| 549 |
+
"@types/node": {
|
| 550 |
+
"optional": true
|
| 551 |
+
}
|
| 552 |
+
}
|
| 553 |
+
},
|
| 554 |
+
"node_modules/@mswjs/interceptors": {
|
| 555 |
+
"version": "0.40.0",
|
| 556 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@mswjs/interceptors/-/interceptors-0.40.0.tgz",
|
| 557 |
+
"integrity": "sha512-EFd6cVbHsgLa6wa4RljGj6Wk75qoHxUSyc5asLyyPSyuhIcdS2Q3Phw6ImS1q+CkALthJRShiYfKANcQMuMqsQ==",
|
| 558 |
+
"license": "MIT",
|
| 559 |
+
"dependencies": {
|
| 560 |
+
"@open-draft/deferred-promise": "^2.2.0",
|
| 561 |
+
"@open-draft/logger": "^0.3.0",
|
| 562 |
+
"@open-draft/until": "^2.0.0",
|
| 563 |
+
"is-node-process": "^1.2.0",
|
| 564 |
+
"outvariant": "^1.4.3",
|
| 565 |
+
"strict-event-emitter": "^0.5.1"
|
| 566 |
+
},
|
| 567 |
+
"engines": {
|
| 568 |
+
"node": ">=18"
|
| 569 |
+
}
|
| 570 |
+
},
|
| 571 |
+
"node_modules/@open-draft/deferred-promise": {
|
| 572 |
+
"version": "2.2.0",
|
| 573 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@open-draft/deferred-promise/-/deferred-promise-2.2.0.tgz",
|
| 574 |
+
"integrity": "sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA==",
|
| 575 |
+
"license": "MIT"
|
| 576 |
+
},
|
| 577 |
+
"node_modules/@open-draft/logger": {
|
| 578 |
+
"version": "0.3.0",
|
| 579 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@open-draft/logger/-/logger-0.3.0.tgz",
|
| 580 |
+
"integrity": "sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ==",
|
| 581 |
+
"license": "MIT",
|
| 582 |
+
"dependencies": {
|
| 583 |
+
"is-node-process": "^1.2.0",
|
| 584 |
+
"outvariant": "^1.4.0"
|
| 585 |
+
}
|
| 586 |
+
},
|
| 587 |
+
"node_modules/@open-draft/until": {
|
| 588 |
+
"version": "2.1.0",
|
| 589 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@open-draft/until/-/until-2.1.0.tgz",
|
| 590 |
+
"integrity": "sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==",
|
| 591 |
+
"license": "MIT"
|
| 592 |
+
},
|
| 593 |
+
"node_modules/@rollup/rollup-android-arm-eabi": {
|
| 594 |
+
"version": "4.52.5",
|
| 595 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.52.5.tgz",
|
| 596 |
+
"integrity": "sha512-8c1vW4ocv3UOMp9K+gToY5zL2XiiVw3k7f1ksf4yO1FlDFQ1C2u72iACFnSOceJFsWskc2WZNqeRhFRPzv+wtQ==",
|
| 597 |
+
"cpu": [
|
| 598 |
+
"arm"
|
| 599 |
+
],
|
| 600 |
+
"license": "MIT",
|
| 601 |
+
"optional": true,
|
| 602 |
+
"os": [
|
| 603 |
+
"android"
|
| 604 |
+
]
|
| 605 |
+
},
|
| 606 |
+
"node_modules/@rollup/rollup-android-arm64": {
|
| 607 |
+
"version": "4.52.5",
|
| 608 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.52.5.tgz",
|
| 609 |
+
"integrity": "sha512-mQGfsIEFcu21mvqkEKKu2dYmtuSZOBMmAl5CFlPGLY94Vlcm+zWApK7F/eocsNzp8tKmbeBP8yXyAbx0XHsFNA==",
|
| 610 |
+
"cpu": [
|
| 611 |
+
"arm64"
|
| 612 |
+
],
|
| 613 |
+
"license": "MIT",
|
| 614 |
+
"optional": true,
|
| 615 |
+
"os": [
|
| 616 |
+
"android"
|
| 617 |
+
]
|
| 618 |
+
},
|
| 619 |
+
"node_modules/@rollup/rollup-darwin-arm64": {
|
| 620 |
+
"version": "4.52.5",
|
| 621 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.52.5.tgz",
|
| 622 |
+
"integrity": "sha512-takF3CR71mCAGA+v794QUZ0b6ZSrgJkArC+gUiG6LB6TQty9T0Mqh3m2ImRBOxS2IeYBo4lKWIieSvnEk2OQWA==",
|
| 623 |
+
"cpu": [
|
| 624 |
+
"arm64"
|
| 625 |
+
],
|
| 626 |
+
"license": "MIT",
|
| 627 |
+
"optional": true,
|
| 628 |
+
"os": [
|
| 629 |
+
"darwin"
|
| 630 |
+
]
|
| 631 |
+
},
|
| 632 |
+
"node_modules/@rollup/rollup-darwin-x64": {
|
| 633 |
+
"version": "4.52.5",
|
| 634 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.52.5.tgz",
|
| 635 |
+
"integrity": "sha512-W901Pla8Ya95WpxDn//VF9K9u2JbocwV/v75TE0YIHNTbhqUTv9w4VuQ9MaWlNOkkEfFwkdNhXgcLqPSmHy0fA==",
|
| 636 |
+
"cpu": [
|
| 637 |
+
"x64"
|
| 638 |
+
],
|
| 639 |
+
"license": "MIT",
|
| 640 |
+
"optional": true,
|
| 641 |
+
"os": [
|
| 642 |
+
"darwin"
|
| 643 |
+
]
|
| 644 |
+
},
|
| 645 |
+
"node_modules/@rollup/rollup-freebsd-arm64": {
|
| 646 |
+
"version": "4.52.5",
|
| 647 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.52.5.tgz",
|
| 648 |
+
"integrity": "sha512-QofO7i7JycsYOWxe0GFqhLmF6l1TqBswJMvICnRUjqCx8b47MTo46W8AoeQwiokAx3zVryVnxtBMcGcnX12LvA==",
|
| 649 |
+
"cpu": [
|
| 650 |
+
"arm64"
|
| 651 |
+
],
|
| 652 |
+
"license": "MIT",
|
| 653 |
+
"optional": true,
|
| 654 |
+
"os": [
|
| 655 |
+
"freebsd"
|
| 656 |
+
]
|
| 657 |
+
},
|
| 658 |
+
"node_modules/@rollup/rollup-freebsd-x64": {
|
| 659 |
+
"version": "4.52.5",
|
| 660 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.52.5.tgz",
|
| 661 |
+
"integrity": "sha512-jr21b/99ew8ujZubPo9skbrItHEIE50WdV86cdSoRkKtmWa+DDr6fu2c/xyRT0F/WazZpam6kk7IHBerSL7LDQ==",
|
| 662 |
+
"cpu": [
|
| 663 |
+
"x64"
|
| 664 |
+
],
|
| 665 |
+
"license": "MIT",
|
| 666 |
+
"optional": true,
|
| 667 |
+
"os": [
|
| 668 |
+
"freebsd"
|
| 669 |
+
]
|
| 670 |
+
},
|
| 671 |
+
"node_modules/@rollup/rollup-linux-arm-gnueabihf": {
|
| 672 |
+
"version": "4.52.5",
|
| 673 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.52.5.tgz",
|
| 674 |
+
"integrity": "sha512-PsNAbcyv9CcecAUagQefwX8fQn9LQ4nZkpDboBOttmyffnInRy8R8dSg6hxxl2Re5QhHBf6FYIDhIj5v982ATQ==",
|
| 675 |
+
"cpu": [
|
| 676 |
+
"arm"
|
| 677 |
+
],
|
| 678 |
+
"license": "MIT",
|
| 679 |
+
"optional": true,
|
| 680 |
+
"os": [
|
| 681 |
+
"linux"
|
| 682 |
+
]
|
| 683 |
+
},
|
| 684 |
+
"node_modules/@rollup/rollup-linux-arm-musleabihf": {
|
| 685 |
+
"version": "4.52.5",
|
| 686 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.52.5.tgz",
|
| 687 |
+
"integrity": "sha512-Fw4tysRutyQc/wwkmcyoqFtJhh0u31K+Q6jYjeicsGJJ7bbEq8LwPWV/w0cnzOqR2m694/Af6hpFayLJZkG2VQ==",
|
| 688 |
+
"cpu": [
|
| 689 |
+
"arm"
|
| 690 |
+
],
|
| 691 |
+
"license": "MIT",
|
| 692 |
+
"optional": true,
|
| 693 |
+
"os": [
|
| 694 |
+
"linux"
|
| 695 |
+
]
|
| 696 |
+
},
|
| 697 |
+
"node_modules/@rollup/rollup-linux-arm64-gnu": {
|
| 698 |
+
"version": "4.52.5",
|
| 699 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.52.5.tgz",
|
| 700 |
+
"integrity": "sha512-a+3wVnAYdQClOTlyapKmyI6BLPAFYs0JM8HRpgYZQO02rMR09ZcV9LbQB+NL6sljzG38869YqThrRnfPMCDtZg==",
|
| 701 |
+
"cpu": [
|
| 702 |
+
"arm64"
|
| 703 |
+
],
|
| 704 |
+
"license": "MIT",
|
| 705 |
+
"optional": true,
|
| 706 |
+
"os": [
|
| 707 |
+
"linux"
|
| 708 |
+
]
|
| 709 |
+
},
|
| 710 |
+
"node_modules/@rollup/rollup-linux-arm64-musl": {
|
| 711 |
+
"version": "4.52.5",
|
| 712 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.52.5.tgz",
|
| 713 |
+
"integrity": "sha512-AvttBOMwO9Pcuuf7m9PkC1PUIKsfaAJ4AYhy944qeTJgQOqJYJ9oVl2nYgY7Rk0mkbsuOpCAYSs6wLYB2Xiw0Q==",
|
| 714 |
+
"cpu": [
|
| 715 |
+
"arm64"
|
| 716 |
+
],
|
| 717 |
+
"license": "MIT",
|
| 718 |
+
"optional": true,
|
| 719 |
+
"os": [
|
| 720 |
+
"linux"
|
| 721 |
+
]
|
| 722 |
+
},
|
| 723 |
+
"node_modules/@rollup/rollup-linux-loong64-gnu": {
|
| 724 |
+
"version": "4.52.5",
|
| 725 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.52.5.tgz",
|
| 726 |
+
"integrity": "sha512-DkDk8pmXQV2wVrF6oq5tONK6UHLz/XcEVow4JTTerdeV1uqPeHxwcg7aFsfnSm9L+OO8WJsWotKM2JJPMWrQtA==",
|
| 727 |
+
"cpu": [
|
| 728 |
+
"loong64"
|
| 729 |
+
],
|
| 730 |
+
"license": "MIT",
|
| 731 |
+
"optional": true,
|
| 732 |
+
"os": [
|
| 733 |
+
"linux"
|
| 734 |
+
]
|
| 735 |
+
},
|
| 736 |
+
"node_modules/@rollup/rollup-linux-ppc64-gnu": {
|
| 737 |
+
"version": "4.52.5",
|
| 738 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.52.5.tgz",
|
| 739 |
+
"integrity": "sha512-W/b9ZN/U9+hPQVvlGwjzi+Wy4xdoH2I8EjaCkMvzpI7wJUs8sWJ03Rq96jRnHkSrcHTpQe8h5Tg3ZzUPGauvAw==",
|
| 740 |
+
"cpu": [
|
| 741 |
+
"ppc64"
|
| 742 |
+
],
|
| 743 |
+
"license": "MIT",
|
| 744 |
+
"optional": true,
|
| 745 |
+
"os": [
|
| 746 |
+
"linux"
|
| 747 |
+
]
|
| 748 |
+
},
|
| 749 |
+
"node_modules/@rollup/rollup-linux-riscv64-gnu": {
|
| 750 |
+
"version": "4.52.5",
|
| 751 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.52.5.tgz",
|
| 752 |
+
"integrity": "sha512-sjQLr9BW7R/ZiXnQiWPkErNfLMkkWIoCz7YMn27HldKsADEKa5WYdobaa1hmN6slu9oWQbB6/jFpJ+P2IkVrmw==",
|
| 753 |
+
"cpu": [
|
| 754 |
+
"riscv64"
|
| 755 |
+
],
|
| 756 |
+
"license": "MIT",
|
| 757 |
+
"optional": true,
|
| 758 |
+
"os": [
|
| 759 |
+
"linux"
|
| 760 |
+
]
|
| 761 |
+
},
|
| 762 |
+
"node_modules/@rollup/rollup-linux-riscv64-musl": {
|
| 763 |
+
"version": "4.52.5",
|
| 764 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.52.5.tgz",
|
| 765 |
+
"integrity": "sha512-hq3jU/kGyjXWTvAh2awn8oHroCbrPm8JqM7RUpKjalIRWWXE01CQOf/tUNWNHjmbMHg/hmNCwc/Pz3k1T/j/Lg==",
|
| 766 |
+
"cpu": [
|
| 767 |
+
"riscv64"
|
| 768 |
+
],
|
| 769 |
+
"license": "MIT",
|
| 770 |
+
"optional": true,
|
| 771 |
+
"os": [
|
| 772 |
+
"linux"
|
| 773 |
+
]
|
| 774 |
+
},
|
| 775 |
+
"node_modules/@rollup/rollup-linux-s390x-gnu": {
|
| 776 |
+
"version": "4.52.5",
|
| 777 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.52.5.tgz",
|
| 778 |
+
"integrity": "sha512-gn8kHOrku8D4NGHMK1Y7NA7INQTRdVOntt1OCYypZPRt6skGbddska44K8iocdpxHTMMNui5oH4elPH4QOLrFQ==",
|
| 779 |
+
"cpu": [
|
| 780 |
+
"s390x"
|
| 781 |
+
],
|
| 782 |
+
"license": "MIT",
|
| 783 |
+
"optional": true,
|
| 784 |
+
"os": [
|
| 785 |
+
"linux"
|
| 786 |
+
]
|
| 787 |
+
},
|
| 788 |
+
"node_modules/@rollup/rollup-linux-x64-gnu": {
|
| 789 |
+
"version": "4.52.5",
|
| 790 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.52.5.tgz",
|
| 791 |
+
"integrity": "sha512-hXGLYpdhiNElzN770+H2nlx+jRog8TyynpTVzdlc6bndktjKWyZyiCsuDAlpd+j+W+WNqfcyAWz9HxxIGfZm1Q==",
|
| 792 |
+
"cpu": [
|
| 793 |
+
"x64"
|
| 794 |
+
],
|
| 795 |
+
"license": "MIT",
|
| 796 |
+
"optional": true,
|
| 797 |
+
"os": [
|
| 798 |
+
"linux"
|
| 799 |
+
]
|
| 800 |
+
},
|
| 801 |
+
"node_modules/@rollup/rollup-linux-x64-musl": {
|
| 802 |
+
"version": "4.52.5",
|
| 803 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.52.5.tgz",
|
| 804 |
+
"integrity": "sha512-arCGIcuNKjBoKAXD+y7XomR9gY6Mw7HnFBv5Rw7wQRvwYLR7gBAgV7Mb2QTyjXfTveBNFAtPt46/36vV9STLNg==",
|
| 805 |
+
"cpu": [
|
| 806 |
+
"x64"
|
| 807 |
+
],
|
| 808 |
+
"license": "MIT",
|
| 809 |
+
"optional": true,
|
| 810 |
+
"os": [
|
| 811 |
+
"linux"
|
| 812 |
+
]
|
| 813 |
+
},
|
| 814 |
+
"node_modules/@rollup/rollup-openharmony-arm64": {
|
| 815 |
+
"version": "4.52.5",
|
| 816 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.52.5.tgz",
|
| 817 |
+
"integrity": "sha512-QoFqB6+/9Rly/RiPjaomPLmR/13cgkIGfA40LHly9zcH1S0bN2HVFYk3a1eAyHQyjs3ZJYlXvIGtcCs5tko9Cw==",
|
| 818 |
+
"cpu": [
|
| 819 |
+
"arm64"
|
| 820 |
+
],
|
| 821 |
+
"license": "MIT",
|
| 822 |
+
"optional": true,
|
| 823 |
+
"os": [
|
| 824 |
+
"openharmony"
|
| 825 |
+
]
|
| 826 |
+
},
|
| 827 |
+
"node_modules/@rollup/rollup-win32-arm64-msvc": {
|
| 828 |
+
"version": "4.52.5",
|
| 829 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.52.5.tgz",
|
| 830 |
+
"integrity": "sha512-w0cDWVR6MlTstla1cIfOGyl8+qb93FlAVutcor14Gf5Md5ap5ySfQ7R9S/NjNaMLSFdUnKGEasmVnu3lCMqB7w==",
|
| 831 |
+
"cpu": [
|
| 832 |
+
"arm64"
|
| 833 |
+
],
|
| 834 |
+
"license": "MIT",
|
| 835 |
+
"optional": true,
|
| 836 |
+
"os": [
|
| 837 |
+
"win32"
|
| 838 |
+
]
|
| 839 |
+
},
|
| 840 |
+
"node_modules/@rollup/rollup-win32-ia32-msvc": {
|
| 841 |
+
"version": "4.52.5",
|
| 842 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.52.5.tgz",
|
| 843 |
+
"integrity": "sha512-Aufdpzp7DpOTULJCuvzqcItSGDH73pF3ko/f+ckJhxQyHtp67rHw3HMNxoIdDMUITJESNE6a8uh4Lo4SLouOUg==",
|
| 844 |
+
"cpu": [
|
| 845 |
+
"ia32"
|
| 846 |
+
],
|
| 847 |
+
"license": "MIT",
|
| 848 |
+
"optional": true,
|
| 849 |
+
"os": [
|
| 850 |
+
"win32"
|
| 851 |
+
]
|
| 852 |
+
},
|
| 853 |
+
"node_modules/@rollup/rollup-win32-x64-gnu": {
|
| 854 |
+
"version": "4.52.5",
|
| 855 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.52.5.tgz",
|
| 856 |
+
"integrity": "sha512-UGBUGPFp1vkj6p8wCRraqNhqwX/4kNQPS57BCFc8wYh0g94iVIW33wJtQAx3G7vrjjNtRaxiMUylM0ktp/TRSQ==",
|
| 857 |
+
"cpu": [
|
| 858 |
+
"x64"
|
| 859 |
+
],
|
| 860 |
+
"license": "MIT",
|
| 861 |
+
"optional": true,
|
| 862 |
+
"os": [
|
| 863 |
+
"win32"
|
| 864 |
+
]
|
| 865 |
+
},
|
| 866 |
+
"node_modules/@rollup/rollup-win32-x64-msvc": {
|
| 867 |
+
"version": "4.52.5",
|
| 868 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.52.5.tgz",
|
| 869 |
+
"integrity": "sha512-TAcgQh2sSkykPRWLrdyy2AiceMckNf5loITqXxFI5VuQjS5tSuw3WlwdN8qv8vzjLAUTvYaH/mVjSFpbkFbpTg==",
|
| 870 |
+
"cpu": [
|
| 871 |
+
"x64"
|
| 872 |
+
],
|
| 873 |
+
"license": "MIT",
|
| 874 |
+
"optional": true,
|
| 875 |
+
"os": [
|
| 876 |
+
"win32"
|
| 877 |
+
]
|
| 878 |
+
},
|
| 879 |
+
"node_modules/@types/estree": {
|
| 880 |
+
"version": "1.0.8",
|
| 881 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@types/estree/-/estree-1.0.8.tgz",
|
| 882 |
+
"integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
|
| 883 |
+
"license": "MIT"
|
| 884 |
+
},
|
| 885 |
+
"node_modules/@types/eventsource": {
|
| 886 |
+
"version": "1.1.15",
|
| 887 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@types/eventsource/-/eventsource-1.1.15.tgz",
|
| 888 |
+
"integrity": "sha512-XQmGcbnxUNa06HR3VBVkc9+A2Vpi9ZyLJcdS5dwaQQ/4ZMWFO+5c90FnMUpbtMZwB/FChoYHwuVg8TvkECacTA==",
|
| 889 |
+
"license": "MIT"
|
| 890 |
+
},
|
| 891 |
+
"node_modules/@types/node": {
|
| 892 |
+
"version": "24.8.1",
|
| 893 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@types/node/-/node-24.8.1.tgz",
|
| 894 |
+
"integrity": "sha512-alv65KGRadQVfVcG69MuB4IzdYVpRwMG/mq8KWOaoOdyY617P5ivaDiMCGOFDWD2sAn5Q0mR3mRtUOgm99hL9Q==",
|
| 895 |
+
"devOptional": true,
|
| 896 |
+
"license": "MIT",
|
| 897 |
+
"dependencies": {
|
| 898 |
+
"undici-types": "~7.14.0"
|
| 899 |
+
}
|
| 900 |
+
},
|
| 901 |
+
"node_modules/@types/statuses": {
|
| 902 |
+
"version": "2.0.6",
|
| 903 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@types/statuses/-/statuses-2.0.6.tgz",
|
| 904 |
+
"integrity": "sha512-xMAgYwceFhRA2zY+XbEA7mxYbA093wdiW8Vu6gZPGWy9cmOyU9XesH1tNcEWsKFd5Vzrqx5T3D38PWx1FIIXkA==",
|
| 905 |
+
"license": "MIT"
|
| 906 |
+
},
|
| 907 |
+
"node_modules/@types/ws": {
|
| 908 |
+
"version": "8.18.1",
|
| 909 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@types/ws/-/ws-8.18.1.tgz",
|
| 910 |
+
"integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==",
|
| 911 |
+
"dev": true,
|
| 912 |
+
"license": "MIT",
|
| 913 |
+
"dependencies": {
|
| 914 |
+
"@types/node": "*"
|
| 915 |
+
}
|
| 916 |
+
},
|
| 917 |
+
"node_modules/ansi-regex": {
|
| 918 |
+
"version": "5.0.1",
|
| 919 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
| 920 |
+
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
| 921 |
+
"license": "MIT",
|
| 922 |
+
"engines": {
|
| 923 |
+
"node": ">=8"
|
| 924 |
+
}
|
| 925 |
+
},
|
| 926 |
+
"node_modules/ansi-styles": {
|
| 927 |
+
"version": "4.3.0",
|
| 928 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
| 929 |
+
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
| 930 |
+
"license": "MIT",
|
| 931 |
+
"dependencies": {
|
| 932 |
+
"color-convert": "^2.0.1"
|
| 933 |
+
},
|
| 934 |
+
"engines": {
|
| 935 |
+
"node": ">=8"
|
| 936 |
+
},
|
| 937 |
+
"funding": {
|
| 938 |
+
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
| 939 |
+
}
|
| 940 |
+
},
|
| 941 |
+
"node_modules/bufferutil": {
|
| 942 |
+
"version": "4.0.9",
|
| 943 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/bufferutil/-/bufferutil-4.0.9.tgz",
|
| 944 |
+
"integrity": "sha512-WDtdLmJvAuNNPzByAYpRo2rF1Mmradw6gvWsQKf63476DDXmomT9zUiGypLcG4ibIM67vhAj8jJRdbmEws2Aqw==",
|
| 945 |
+
"hasInstallScript": true,
|
| 946 |
+
"license": "MIT",
|
| 947 |
+
"dependencies": {
|
| 948 |
+
"node-gyp-build": "^4.3.0"
|
| 949 |
+
},
|
| 950 |
+
"engines": {
|
| 951 |
+
"node": ">=6.14.2"
|
| 952 |
+
}
|
| 953 |
+
},
|
| 954 |
+
"node_modules/cli-width": {
|
| 955 |
+
"version": "4.1.0",
|
| 956 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/cli-width/-/cli-width-4.1.0.tgz",
|
| 957 |
+
"integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==",
|
| 958 |
+
"license": "ISC",
|
| 959 |
+
"engines": {
|
| 960 |
+
"node": ">= 12"
|
| 961 |
+
}
|
| 962 |
+
},
|
| 963 |
+
"node_modules/cliui": {
|
| 964 |
+
"version": "8.0.1",
|
| 965 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/cliui/-/cliui-8.0.1.tgz",
|
| 966 |
+
"integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
|
| 967 |
+
"license": "ISC",
|
| 968 |
+
"dependencies": {
|
| 969 |
+
"string-width": "^4.2.0",
|
| 970 |
+
"strip-ansi": "^6.0.1",
|
| 971 |
+
"wrap-ansi": "^7.0.0"
|
| 972 |
+
},
|
| 973 |
+
"engines": {
|
| 974 |
+
"node": ">=12"
|
| 975 |
+
}
|
| 976 |
+
},
|
| 977 |
+
"node_modules/cliui/node_modules/wrap-ansi": {
|
| 978 |
+
"version": "7.0.0",
|
| 979 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
|
| 980 |
+
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
|
| 981 |
+
"license": "MIT",
|
| 982 |
+
"dependencies": {
|
| 983 |
+
"ansi-styles": "^4.0.0",
|
| 984 |
+
"string-width": "^4.1.0",
|
| 985 |
+
"strip-ansi": "^6.0.0"
|
| 986 |
+
},
|
| 987 |
+
"engines": {
|
| 988 |
+
"node": ">=10"
|
| 989 |
+
},
|
| 990 |
+
"funding": {
|
| 991 |
+
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
| 992 |
+
}
|
| 993 |
+
},
|
| 994 |
+
"node_modules/color-convert": {
|
| 995 |
+
"version": "2.0.1",
|
| 996 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/color-convert/-/color-convert-2.0.1.tgz",
|
| 997 |
+
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
| 998 |
+
"license": "MIT",
|
| 999 |
+
"dependencies": {
|
| 1000 |
+
"color-name": "~1.1.4"
|
| 1001 |
+
},
|
| 1002 |
+
"engines": {
|
| 1003 |
+
"node": ">=7.0.0"
|
| 1004 |
+
}
|
| 1005 |
+
},
|
| 1006 |
+
"node_modules/color-name": {
|
| 1007 |
+
"version": "1.1.4",
|
| 1008 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/color-name/-/color-name-1.1.4.tgz",
|
| 1009 |
+
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
| 1010 |
+
"license": "MIT"
|
| 1011 |
+
},
|
| 1012 |
+
"node_modules/cookie": {
|
| 1013 |
+
"version": "1.0.2",
|
| 1014 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/cookie/-/cookie-1.0.2.tgz",
|
| 1015 |
+
"integrity": "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==",
|
| 1016 |
+
"license": "MIT",
|
| 1017 |
+
"engines": {
|
| 1018 |
+
"node": ">=18"
|
| 1019 |
+
}
|
| 1020 |
+
},
|
| 1021 |
+
"node_modules/emoji-regex": {
|
| 1022 |
+
"version": "8.0.0",
|
| 1023 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
| 1024 |
+
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
| 1025 |
+
"license": "MIT"
|
| 1026 |
+
},
|
| 1027 |
+
"node_modules/esbuild": {
|
| 1028 |
+
"version": "0.21.5",
|
| 1029 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/esbuild/-/esbuild-0.21.5.tgz",
|
| 1030 |
+
"integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==",
|
| 1031 |
+
"dev": true,
|
| 1032 |
+
"hasInstallScript": true,
|
| 1033 |
+
"license": "MIT",
|
| 1034 |
+
"bin": {
|
| 1035 |
+
"esbuild": "bin/esbuild"
|
| 1036 |
+
},
|
| 1037 |
+
"engines": {
|
| 1038 |
+
"node": ">=12"
|
| 1039 |
+
},
|
| 1040 |
+
"optionalDependencies": {
|
| 1041 |
+
"@esbuild/aix-ppc64": "0.21.5",
|
| 1042 |
+
"@esbuild/android-arm": "0.21.5",
|
| 1043 |
+
"@esbuild/android-arm64": "0.21.5",
|
| 1044 |
+
"@esbuild/android-x64": "0.21.5",
|
| 1045 |
+
"@esbuild/darwin-arm64": "0.21.5",
|
| 1046 |
+
"@esbuild/darwin-x64": "0.21.5",
|
| 1047 |
+
"@esbuild/freebsd-arm64": "0.21.5",
|
| 1048 |
+
"@esbuild/freebsd-x64": "0.21.5",
|
| 1049 |
+
"@esbuild/linux-arm": "0.21.5",
|
| 1050 |
+
"@esbuild/linux-arm64": "0.21.5",
|
| 1051 |
+
"@esbuild/linux-ia32": "0.21.5",
|
| 1052 |
+
"@esbuild/linux-loong64": "0.21.5",
|
| 1053 |
+
"@esbuild/linux-mips64el": "0.21.5",
|
| 1054 |
+
"@esbuild/linux-ppc64": "0.21.5",
|
| 1055 |
+
"@esbuild/linux-riscv64": "0.21.5",
|
| 1056 |
+
"@esbuild/linux-s390x": "0.21.5",
|
| 1057 |
+
"@esbuild/linux-x64": "0.21.5",
|
| 1058 |
+
"@esbuild/netbsd-x64": "0.21.5",
|
| 1059 |
+
"@esbuild/openbsd-x64": "0.21.5",
|
| 1060 |
+
"@esbuild/sunos-x64": "0.21.5",
|
| 1061 |
+
"@esbuild/win32-arm64": "0.21.5",
|
| 1062 |
+
"@esbuild/win32-ia32": "0.21.5",
|
| 1063 |
+
"@esbuild/win32-x64": "0.21.5"
|
| 1064 |
+
}
|
| 1065 |
+
},
|
| 1066 |
+
"node_modules/escalade": {
|
| 1067 |
+
"version": "3.2.0",
|
| 1068 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/escalade/-/escalade-3.2.0.tgz",
|
| 1069 |
+
"integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
|
| 1070 |
+
"license": "MIT",
|
| 1071 |
+
"engines": {
|
| 1072 |
+
"node": ">=6"
|
| 1073 |
+
}
|
| 1074 |
+
},
|
| 1075 |
+
"node_modules/eventsource": {
|
| 1076 |
+
"version": "2.0.2",
|
| 1077 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/eventsource/-/eventsource-2.0.2.tgz",
|
| 1078 |
+
"integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==",
|
| 1079 |
+
"license": "MIT",
|
| 1080 |
+
"engines": {
|
| 1081 |
+
"node": ">=12.0.0"
|
| 1082 |
+
}
|
| 1083 |
+
},
|
| 1084 |
+
"node_modules/fdir": {
|
| 1085 |
+
"version": "6.5.0",
|
| 1086 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/fdir/-/fdir-6.5.0.tgz",
|
| 1087 |
+
"integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
|
| 1088 |
+
"license": "MIT",
|
| 1089 |
+
"engines": {
|
| 1090 |
+
"node": ">=12.0.0"
|
| 1091 |
+
},
|
| 1092 |
+
"peerDependencies": {
|
| 1093 |
+
"picomatch": "^3 || ^4"
|
| 1094 |
+
},
|
| 1095 |
+
"peerDependenciesMeta": {
|
| 1096 |
+
"picomatch": {
|
| 1097 |
+
"optional": true
|
| 1098 |
+
}
|
| 1099 |
+
}
|
| 1100 |
+
},
|
| 1101 |
+
"node_modules/fetch-event-stream": {
|
| 1102 |
+
"version": "0.1.5",
|
| 1103 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/fetch-event-stream/-/fetch-event-stream-0.1.5.tgz",
|
| 1104 |
+
"integrity": "sha512-V1PWovkspxQfssq/NnxoEyQo1DV+MRK/laPuPblIZmSjMN8P5u46OhlFQznSr9p/t0Sp8Uc6SbM3yCMfr0KU8g==",
|
| 1105 |
+
"license": "MIT"
|
| 1106 |
+
},
|
| 1107 |
+
"node_modules/fsevents": {
|
| 1108 |
+
"version": "2.3.3",
|
| 1109 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/fsevents/-/fsevents-2.3.3.tgz",
|
| 1110 |
+
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
| 1111 |
+
"hasInstallScript": true,
|
| 1112 |
+
"license": "MIT",
|
| 1113 |
+
"optional": true,
|
| 1114 |
+
"os": [
|
| 1115 |
+
"darwin"
|
| 1116 |
+
],
|
| 1117 |
+
"engines": {
|
| 1118 |
+
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
| 1119 |
+
}
|
| 1120 |
+
},
|
| 1121 |
+
"node_modules/get-caller-file": {
|
| 1122 |
+
"version": "2.0.5",
|
| 1123 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
| 1124 |
+
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
| 1125 |
+
"license": "ISC",
|
| 1126 |
+
"engines": {
|
| 1127 |
+
"node": "6.* || 8.* || >= 10.*"
|
| 1128 |
+
}
|
| 1129 |
+
},
|
| 1130 |
+
"node_modules/graphql": {
|
| 1131 |
+
"version": "16.11.0",
|
| 1132 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/graphql/-/graphql-16.11.0.tgz",
|
| 1133 |
+
"integrity": "sha512-mS1lbMsxgQj6hge1XZ6p7GPhbrtFwUFYi3wRzXAC/FmYnyXMTvvI3td3rjmQ2u8ewXueaSvRPWaEcgVVOT9Jnw==",
|
| 1134 |
+
"license": "MIT",
|
| 1135 |
+
"engines": {
|
| 1136 |
+
"node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0"
|
| 1137 |
+
}
|
| 1138 |
+
},
|
| 1139 |
+
"node_modules/headers-polyfill": {
|
| 1140 |
+
"version": "4.0.3",
|
| 1141 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/headers-polyfill/-/headers-polyfill-4.0.3.tgz",
|
| 1142 |
+
"integrity": "sha512-IScLbePpkvO846sIwOtOTDjutRMWdXdJmXdMvk6gCBHxFO8d+QKOQedyZSxFTTFYRSmlgSTDtXqqq4pcenBXLQ==",
|
| 1143 |
+
"license": "MIT"
|
| 1144 |
+
},
|
| 1145 |
+
"node_modules/is-fullwidth-code-point": {
|
| 1146 |
+
"version": "3.0.0",
|
| 1147 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
| 1148 |
+
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
| 1149 |
+
"license": "MIT",
|
| 1150 |
+
"engines": {
|
| 1151 |
+
"node": ">=8"
|
| 1152 |
+
}
|
| 1153 |
+
},
|
| 1154 |
+
"node_modules/is-node-process": {
|
| 1155 |
+
"version": "1.2.0",
|
| 1156 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/is-node-process/-/is-node-process-1.2.0.tgz",
|
| 1157 |
+
"integrity": "sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==",
|
| 1158 |
+
"license": "MIT"
|
| 1159 |
+
},
|
| 1160 |
+
"node_modules/msw": {
|
| 1161 |
+
"version": "2.11.6",
|
| 1162 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/msw/-/msw-2.11.6.tgz",
|
| 1163 |
+
"integrity": "sha512-MCYMykvmiYScyUm7I6y0VCxpNq1rgd5v7kG8ks5dKtvmxRUUPjribX6mUoUNBbM5/3PhUyoelEWiKXGOz84c+w==",
|
| 1164 |
+
"hasInstallScript": true,
|
| 1165 |
+
"license": "MIT",
|
| 1166 |
+
"dependencies": {
|
| 1167 |
+
"@inquirer/confirm": "^5.0.0",
|
| 1168 |
+
"@mswjs/interceptors": "^0.40.0",
|
| 1169 |
+
"@open-draft/deferred-promise": "^2.2.0",
|
| 1170 |
+
"@types/statuses": "^2.0.4",
|
| 1171 |
+
"cookie": "^1.0.2",
|
| 1172 |
+
"graphql": "^16.8.1",
|
| 1173 |
+
"headers-polyfill": "^4.0.2",
|
| 1174 |
+
"is-node-process": "^1.2.0",
|
| 1175 |
+
"outvariant": "^1.4.3",
|
| 1176 |
+
"path-to-regexp": "^6.3.0",
|
| 1177 |
+
"picocolors": "^1.1.1",
|
| 1178 |
+
"rettime": "^0.7.0",
|
| 1179 |
+
"statuses": "^2.0.2",
|
| 1180 |
+
"strict-event-emitter": "^0.5.1",
|
| 1181 |
+
"tough-cookie": "^6.0.0",
|
| 1182 |
+
"type-fest": "^4.26.1",
|
| 1183 |
+
"until-async": "^3.0.2",
|
| 1184 |
+
"yargs": "^17.7.2"
|
| 1185 |
+
},
|
| 1186 |
+
"bin": {
|
| 1187 |
+
"msw": "cli/index.js"
|
| 1188 |
+
},
|
| 1189 |
+
"engines": {
|
| 1190 |
+
"node": ">=18"
|
| 1191 |
+
},
|
| 1192 |
+
"funding": {
|
| 1193 |
+
"url": "https://github.com/sponsors/mswjs"
|
| 1194 |
+
},
|
| 1195 |
+
"peerDependencies": {
|
| 1196 |
+
"typescript": ">= 4.8.x"
|
| 1197 |
+
},
|
| 1198 |
+
"peerDependenciesMeta": {
|
| 1199 |
+
"typescript": {
|
| 1200 |
+
"optional": true
|
| 1201 |
+
}
|
| 1202 |
+
}
|
| 1203 |
+
},
|
| 1204 |
+
"node_modules/mute-stream": {
|
| 1205 |
+
"version": "2.0.0",
|
| 1206 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/mute-stream/-/mute-stream-2.0.0.tgz",
|
| 1207 |
+
"integrity": "sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==",
|
| 1208 |
+
"license": "ISC",
|
| 1209 |
+
"engines": {
|
| 1210 |
+
"node": "^18.17.0 || >=20.5.0"
|
| 1211 |
+
}
|
| 1212 |
+
},
|
| 1213 |
+
"node_modules/nanoid": {
|
| 1214 |
+
"version": "3.3.11",
|
| 1215 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/nanoid/-/nanoid-3.3.11.tgz",
|
| 1216 |
+
"integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
|
| 1217 |
+
"funding": [
|
| 1218 |
+
{
|
| 1219 |
+
"type": "github",
|
| 1220 |
+
"url": "https://github.com/sponsors/ai"
|
| 1221 |
+
}
|
| 1222 |
+
],
|
| 1223 |
+
"license": "MIT",
|
| 1224 |
+
"bin": {
|
| 1225 |
+
"nanoid": "bin/nanoid.cjs"
|
| 1226 |
+
},
|
| 1227 |
+
"engines": {
|
| 1228 |
+
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
| 1229 |
+
}
|
| 1230 |
+
},
|
| 1231 |
+
"node_modules/node-gyp-build": {
|
| 1232 |
+
"version": "4.8.4",
|
| 1233 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/node-gyp-build/-/node-gyp-build-4.8.4.tgz",
|
| 1234 |
+
"integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==",
|
| 1235 |
+
"license": "MIT",
|
| 1236 |
+
"bin": {
|
| 1237 |
+
"node-gyp-build": "bin.js",
|
| 1238 |
+
"node-gyp-build-optional": "optional.js",
|
| 1239 |
+
"node-gyp-build-test": "build-test.js"
|
| 1240 |
+
}
|
| 1241 |
+
},
|
| 1242 |
+
"node_modules/outvariant": {
|
| 1243 |
+
"version": "1.4.3",
|
| 1244 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/outvariant/-/outvariant-1.4.3.tgz",
|
| 1245 |
+
"integrity": "sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA==",
|
| 1246 |
+
"license": "MIT"
|
| 1247 |
+
},
|
| 1248 |
+
"node_modules/path-to-regexp": {
|
| 1249 |
+
"version": "6.3.0",
|
| 1250 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/path-to-regexp/-/path-to-regexp-6.3.0.tgz",
|
| 1251 |
+
"integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==",
|
| 1252 |
+
"license": "MIT"
|
| 1253 |
+
},
|
| 1254 |
+
"node_modules/picocolors": {
|
| 1255 |
+
"version": "1.1.1",
|
| 1256 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/picocolors/-/picocolors-1.1.1.tgz",
|
| 1257 |
+
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
| 1258 |
+
"license": "ISC"
|
| 1259 |
+
},
|
| 1260 |
+
"node_modules/picomatch": {
|
| 1261 |
+
"version": "4.0.3",
|
| 1262 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/picomatch/-/picomatch-4.0.3.tgz",
|
| 1263 |
+
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
| 1264 |
+
"license": "MIT",
|
| 1265 |
+
"engines": {
|
| 1266 |
+
"node": ">=12"
|
| 1267 |
+
},
|
| 1268 |
+
"funding": {
|
| 1269 |
+
"url": "https://github.com/sponsors/jonschlinkert"
|
| 1270 |
+
}
|
| 1271 |
+
},
|
| 1272 |
+
"node_modules/postcss": {
|
| 1273 |
+
"version": "8.5.6",
|
| 1274 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/postcss/-/postcss-8.5.6.tgz",
|
| 1275 |
+
"integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==",
|
| 1276 |
+
"funding": [
|
| 1277 |
+
{
|
| 1278 |
+
"type": "opencollective",
|
| 1279 |
+
"url": "https://opencollective.com/postcss/"
|
| 1280 |
+
},
|
| 1281 |
+
{
|
| 1282 |
+
"type": "tidelift",
|
| 1283 |
+
"url": "https://tidelift.com/funding/github/npm/postcss"
|
| 1284 |
+
},
|
| 1285 |
+
{
|
| 1286 |
+
"type": "github",
|
| 1287 |
+
"url": "https://github.com/sponsors/ai"
|
| 1288 |
+
}
|
| 1289 |
+
],
|
| 1290 |
+
"license": "MIT",
|
| 1291 |
+
"dependencies": {
|
| 1292 |
+
"nanoid": "^3.3.11",
|
| 1293 |
+
"picocolors": "^1.1.1",
|
| 1294 |
+
"source-map-js": "^1.2.1"
|
| 1295 |
+
},
|
| 1296 |
+
"engines": {
|
| 1297 |
+
"node": "^10 || ^12 || >=14"
|
| 1298 |
+
}
|
| 1299 |
+
},
|
| 1300 |
+
"node_modules/require-directory": {
|
| 1301 |
+
"version": "2.1.1",
|
| 1302 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/require-directory/-/require-directory-2.1.1.tgz",
|
| 1303 |
+
"integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
|
| 1304 |
+
"license": "MIT",
|
| 1305 |
+
"engines": {
|
| 1306 |
+
"node": ">=0.10.0"
|
| 1307 |
+
}
|
| 1308 |
+
},
|
| 1309 |
+
"node_modules/rettime": {
|
| 1310 |
+
"version": "0.7.0",
|
| 1311 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/rettime/-/rettime-0.7.0.tgz",
|
| 1312 |
+
"integrity": "sha512-LPRKoHnLKd/r3dVxcwO7vhCW+orkOGj9ViueosEBK6ie89CijnfRlhaDhHq/3Hxu4CkWQtxwlBG0mzTQY6uQjw==",
|
| 1313 |
+
"license": "MIT"
|
| 1314 |
+
},
|
| 1315 |
+
"node_modules/rollup": {
|
| 1316 |
+
"version": "4.52.5",
|
| 1317 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/rollup/-/rollup-4.52.5.tgz",
|
| 1318 |
+
"integrity": "sha512-3GuObel8h7Kqdjt0gxkEzaifHTqLVW56Y/bjN7PSQtkKr0w3V/QYSdt6QWYtd7A1xUtYQigtdUfgj1RvWVtorw==",
|
| 1319 |
+
"license": "MIT",
|
| 1320 |
+
"dependencies": {
|
| 1321 |
+
"@types/estree": "1.0.8"
|
| 1322 |
+
},
|
| 1323 |
+
"bin": {
|
| 1324 |
+
"rollup": "dist/bin/rollup"
|
| 1325 |
+
},
|
| 1326 |
+
"engines": {
|
| 1327 |
+
"node": ">=18.0.0",
|
| 1328 |
+
"npm": ">=8.0.0"
|
| 1329 |
+
},
|
| 1330 |
+
"optionalDependencies": {
|
| 1331 |
+
"@rollup/rollup-android-arm-eabi": "4.52.5",
|
| 1332 |
+
"@rollup/rollup-android-arm64": "4.52.5",
|
| 1333 |
+
"@rollup/rollup-darwin-arm64": "4.52.5",
|
| 1334 |
+
"@rollup/rollup-darwin-x64": "4.52.5",
|
| 1335 |
+
"@rollup/rollup-freebsd-arm64": "4.52.5",
|
| 1336 |
+
"@rollup/rollup-freebsd-x64": "4.52.5",
|
| 1337 |
+
"@rollup/rollup-linux-arm-gnueabihf": "4.52.5",
|
| 1338 |
+
"@rollup/rollup-linux-arm-musleabihf": "4.52.5",
|
| 1339 |
+
"@rollup/rollup-linux-arm64-gnu": "4.52.5",
|
| 1340 |
+
"@rollup/rollup-linux-arm64-musl": "4.52.5",
|
| 1341 |
+
"@rollup/rollup-linux-loong64-gnu": "4.52.5",
|
| 1342 |
+
"@rollup/rollup-linux-ppc64-gnu": "4.52.5",
|
| 1343 |
+
"@rollup/rollup-linux-riscv64-gnu": "4.52.5",
|
| 1344 |
+
"@rollup/rollup-linux-riscv64-musl": "4.52.5",
|
| 1345 |
+
"@rollup/rollup-linux-s390x-gnu": "4.52.5",
|
| 1346 |
+
"@rollup/rollup-linux-x64-gnu": "4.52.5",
|
| 1347 |
+
"@rollup/rollup-linux-x64-musl": "4.52.5",
|
| 1348 |
+
"@rollup/rollup-openharmony-arm64": "4.52.5",
|
| 1349 |
+
"@rollup/rollup-win32-arm64-msvc": "4.52.5",
|
| 1350 |
+
"@rollup/rollup-win32-ia32-msvc": "4.52.5",
|
| 1351 |
+
"@rollup/rollup-win32-x64-gnu": "4.52.5",
|
| 1352 |
+
"@rollup/rollup-win32-x64-msvc": "4.52.5",
|
| 1353 |
+
"fsevents": "~2.3.2"
|
| 1354 |
+
}
|
| 1355 |
+
},
|
| 1356 |
+
"node_modules/semiver": {
|
| 1357 |
+
"version": "1.1.0",
|
| 1358 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/semiver/-/semiver-1.1.0.tgz",
|
| 1359 |
+
"integrity": "sha512-QNI2ChmuioGC1/xjyYwyZYADILWyW6AmS1UH6gDj/SFUUUS4MBAWs/7mxnkRPc/F4iHezDP+O8t0dO8WHiEOdg==",
|
| 1360 |
+
"license": "MIT",
|
| 1361 |
+
"engines": {
|
| 1362 |
+
"node": ">=6"
|
| 1363 |
+
}
|
| 1364 |
+
},
|
| 1365 |
+
"node_modules/signal-exit": {
|
| 1366 |
+
"version": "4.1.0",
|
| 1367 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/signal-exit/-/signal-exit-4.1.0.tgz",
|
| 1368 |
+
"integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
|
| 1369 |
+
"license": "ISC",
|
| 1370 |
+
"engines": {
|
| 1371 |
+
"node": ">=14"
|
| 1372 |
+
},
|
| 1373 |
+
"funding": {
|
| 1374 |
+
"url": "https://github.com/sponsors/isaacs"
|
| 1375 |
+
}
|
| 1376 |
+
},
|
| 1377 |
+
"node_modules/source-map-js": {
|
| 1378 |
+
"version": "1.2.1",
|
| 1379 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/source-map-js/-/source-map-js-1.2.1.tgz",
|
| 1380 |
+
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
|
| 1381 |
+
"license": "BSD-3-Clause",
|
| 1382 |
+
"engines": {
|
| 1383 |
+
"node": ">=0.10.0"
|
| 1384 |
+
}
|
| 1385 |
+
},
|
| 1386 |
+
"node_modules/statuses": {
|
| 1387 |
+
"version": "2.0.2",
|
| 1388 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/statuses/-/statuses-2.0.2.tgz",
|
| 1389 |
+
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
|
| 1390 |
+
"license": "MIT",
|
| 1391 |
+
"engines": {
|
| 1392 |
+
"node": ">= 0.8"
|
| 1393 |
+
}
|
| 1394 |
+
},
|
| 1395 |
+
"node_modules/strict-event-emitter": {
|
| 1396 |
+
"version": "0.5.1",
|
| 1397 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/strict-event-emitter/-/strict-event-emitter-0.5.1.tgz",
|
| 1398 |
+
"integrity": "sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ==",
|
| 1399 |
+
"license": "MIT"
|
| 1400 |
+
},
|
| 1401 |
+
"node_modules/string-width": {
|
| 1402 |
+
"version": "4.2.3",
|
| 1403 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/string-width/-/string-width-4.2.3.tgz",
|
| 1404 |
+
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
| 1405 |
+
"license": "MIT",
|
| 1406 |
+
"dependencies": {
|
| 1407 |
+
"emoji-regex": "^8.0.0",
|
| 1408 |
+
"is-fullwidth-code-point": "^3.0.0",
|
| 1409 |
+
"strip-ansi": "^6.0.1"
|
| 1410 |
+
},
|
| 1411 |
+
"engines": {
|
| 1412 |
+
"node": ">=8"
|
| 1413 |
+
}
|
| 1414 |
+
},
|
| 1415 |
+
"node_modules/strip-ansi": {
|
| 1416 |
+
"version": "6.0.1",
|
| 1417 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
| 1418 |
+
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
| 1419 |
+
"license": "MIT",
|
| 1420 |
+
"dependencies": {
|
| 1421 |
+
"ansi-regex": "^5.0.1"
|
| 1422 |
+
},
|
| 1423 |
+
"engines": {
|
| 1424 |
+
"node": ">=8"
|
| 1425 |
+
}
|
| 1426 |
+
},
|
| 1427 |
+
"node_modules/textlinestream": {
|
| 1428 |
+
"version": "1.1.1",
|
| 1429 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/textlinestream/-/textlinestream-1.1.1.tgz",
|
| 1430 |
+
"integrity": "sha512-iBHbi7BQxrFmwZUQJsT0SjNzlLLsXhvW/kg7EyOMVMBIrlnj/qYofwo1LVLZi+3GbUEo96Iu2eqToI2+lZoAEQ==",
|
| 1431 |
+
"license": "MIT"
|
| 1432 |
+
},
|
| 1433 |
+
"node_modules/tinyglobby": {
|
| 1434 |
+
"version": "0.2.15",
|
| 1435 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/tinyglobby/-/tinyglobby-0.2.15.tgz",
|
| 1436 |
+
"integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==",
|
| 1437 |
+
"license": "MIT",
|
| 1438 |
+
"dependencies": {
|
| 1439 |
+
"fdir": "^6.5.0",
|
| 1440 |
+
"picomatch": "^4.0.3"
|
| 1441 |
+
},
|
| 1442 |
+
"engines": {
|
| 1443 |
+
"node": ">=12.0.0"
|
| 1444 |
+
},
|
| 1445 |
+
"funding": {
|
| 1446 |
+
"url": "https://github.com/sponsors/SuperchupuDev"
|
| 1447 |
+
}
|
| 1448 |
+
},
|
| 1449 |
+
"node_modules/tldts": {
|
| 1450 |
+
"version": "7.0.17",
|
| 1451 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/tldts/-/tldts-7.0.17.tgz",
|
| 1452 |
+
"integrity": "sha512-Y1KQBgDd/NUc+LfOtKS6mNsC9CCaH+m2P1RoIZy7RAPo3C3/t8X45+zgut31cRZtZ3xKPjfn3TkGTrctC2TQIQ==",
|
| 1453 |
+
"license": "MIT",
|
| 1454 |
+
"dependencies": {
|
| 1455 |
+
"tldts-core": "^7.0.17"
|
| 1456 |
+
},
|
| 1457 |
+
"bin": {
|
| 1458 |
+
"tldts": "bin/cli.js"
|
| 1459 |
+
}
|
| 1460 |
+
},
|
| 1461 |
+
"node_modules/tldts-core": {
|
| 1462 |
+
"version": "7.0.17",
|
| 1463 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/tldts-core/-/tldts-core-7.0.17.tgz",
|
| 1464 |
+
"integrity": "sha512-DieYoGrP78PWKsrXr8MZwtQ7GLCUeLxihtjC1jZsW1DnvSMdKPitJSe8OSYDM2u5H6g3kWJZpePqkp43TfLh0g==",
|
| 1465 |
+
"license": "MIT"
|
| 1466 |
+
},
|
| 1467 |
+
"node_modules/tough-cookie": {
|
| 1468 |
+
"version": "6.0.0",
|
| 1469 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/tough-cookie/-/tough-cookie-6.0.0.tgz",
|
| 1470 |
+
"integrity": "sha512-kXuRi1mtaKMrsLUxz3sQYvVl37B0Ns6MzfrtV5DvJceE9bPyspOqk9xxv7XbZWcfLWbFmm997vl83qUWVJA64w==",
|
| 1471 |
+
"license": "BSD-3-Clause",
|
| 1472 |
+
"dependencies": {
|
| 1473 |
+
"tldts": "^7.0.5"
|
| 1474 |
+
},
|
| 1475 |
+
"engines": {
|
| 1476 |
+
"node": ">=16"
|
| 1477 |
+
}
|
| 1478 |
+
},
|
| 1479 |
+
"node_modules/type-fest": {
|
| 1480 |
+
"version": "4.41.0",
|
| 1481 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/type-fest/-/type-fest-4.41.0.tgz",
|
| 1482 |
+
"integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==",
|
| 1483 |
+
"license": "(MIT OR CC0-1.0)",
|
| 1484 |
+
"engines": {
|
| 1485 |
+
"node": ">=16"
|
| 1486 |
+
},
|
| 1487 |
+
"funding": {
|
| 1488 |
+
"url": "https://github.com/sponsors/sindresorhus"
|
| 1489 |
+
}
|
| 1490 |
+
},
|
| 1491 |
+
"node_modules/typescript": {
|
| 1492 |
+
"version": "5.9.3",
|
| 1493 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/typescript/-/typescript-5.9.3.tgz",
|
| 1494 |
+
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
| 1495 |
+
"license": "Apache-2.0",
|
| 1496 |
+
"bin": {
|
| 1497 |
+
"tsc": "bin/tsc",
|
| 1498 |
+
"tsserver": "bin/tsserver"
|
| 1499 |
+
},
|
| 1500 |
+
"engines": {
|
| 1501 |
+
"node": ">=14.17"
|
| 1502 |
+
}
|
| 1503 |
+
},
|
| 1504 |
+
"node_modules/undici-types": {
|
| 1505 |
+
"version": "7.14.0",
|
| 1506 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/undici-types/-/undici-types-7.14.0.tgz",
|
| 1507 |
+
"integrity": "sha512-QQiYxHuyZ9gQUIrmPo3IA+hUl4KYk8uSA7cHrcKd/l3p1OTpZcM0Tbp9x7FAtXdAYhlasd60ncPpgu6ihG6TOA==",
|
| 1508 |
+
"devOptional": true,
|
| 1509 |
+
"license": "MIT"
|
| 1510 |
+
},
|
| 1511 |
+
"node_modules/until-async": {
|
| 1512 |
+
"version": "3.0.2",
|
| 1513 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/until-async/-/until-async-3.0.2.tgz",
|
| 1514 |
+
"integrity": "sha512-IiSk4HlzAMqTUseHHe3VhIGyuFmN90zMTpD3Z3y8jeQbzLIq500MVM7Jq2vUAnTKAFPJrqwkzr6PoTcPhGcOiw==",
|
| 1515 |
+
"license": "MIT",
|
| 1516 |
+
"funding": {
|
| 1517 |
+
"url": "https://github.com/sponsors/kettanaito"
|
| 1518 |
+
}
|
| 1519 |
+
},
|
| 1520 |
+
"node_modules/vi": {
|
| 1521 |
+
"version": "1.0.0",
|
| 1522 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/vi/-/vi-1.0.0.tgz",
|
| 1523 |
+
"integrity": "sha512-fLpBeQzBddayFzoNMfCzvkcomwRYHx05qRo8lVCjMmR8ggs36Auw5A6/yH/UU8e2UAsGvh0qmXlNoR1DIdfWUw==",
|
| 1524 |
+
"license": "ISC"
|
| 1525 |
+
},
|
| 1526 |
+
"node_modules/vite": {
|
| 1527 |
+
"version": "6.4.1",
|
| 1528 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/vite/-/vite-6.4.1.tgz",
|
| 1529 |
+
"integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==",
|
| 1530 |
+
"license": "MIT",
|
| 1531 |
+
"dependencies": {
|
| 1532 |
+
"esbuild": "^0.25.0",
|
| 1533 |
+
"fdir": "^6.4.4",
|
| 1534 |
+
"picomatch": "^4.0.2",
|
| 1535 |
+
"postcss": "^8.5.3",
|
| 1536 |
+
"rollup": "^4.34.9",
|
| 1537 |
+
"tinyglobby": "^0.2.13"
|
| 1538 |
+
},
|
| 1539 |
+
"bin": {
|
| 1540 |
+
"vite": "bin/vite.js"
|
| 1541 |
+
},
|
| 1542 |
+
"engines": {
|
| 1543 |
+
"node": "^18.0.0 || ^20.0.0 || >=22.0.0"
|
| 1544 |
+
},
|
| 1545 |
+
"funding": {
|
| 1546 |
+
"url": "https://github.com/vitejs/vite?sponsor=1"
|
| 1547 |
+
},
|
| 1548 |
+
"optionalDependencies": {
|
| 1549 |
+
"fsevents": "~2.3.3"
|
| 1550 |
+
},
|
| 1551 |
+
"peerDependencies": {
|
| 1552 |
+
"@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
|
| 1553 |
+
"jiti": ">=1.21.0",
|
| 1554 |
+
"less": "*",
|
| 1555 |
+
"lightningcss": "^1.21.0",
|
| 1556 |
+
"sass": "*",
|
| 1557 |
+
"sass-embedded": "*",
|
| 1558 |
+
"stylus": "*",
|
| 1559 |
+
"sugarss": "*",
|
| 1560 |
+
"terser": "^5.16.0",
|
| 1561 |
+
"tsx": "^4.8.1",
|
| 1562 |
+
"yaml": "^2.4.2"
|
| 1563 |
+
},
|
| 1564 |
+
"peerDependenciesMeta": {
|
| 1565 |
+
"@types/node": {
|
| 1566 |
+
"optional": true
|
| 1567 |
+
},
|
| 1568 |
+
"jiti": {
|
| 1569 |
+
"optional": true
|
| 1570 |
+
},
|
| 1571 |
+
"less": {
|
| 1572 |
+
"optional": true
|
| 1573 |
+
},
|
| 1574 |
+
"lightningcss": {
|
| 1575 |
+
"optional": true
|
| 1576 |
+
},
|
| 1577 |
+
"sass": {
|
| 1578 |
+
"optional": true
|
| 1579 |
+
},
|
| 1580 |
+
"sass-embedded": {
|
| 1581 |
+
"optional": true
|
| 1582 |
+
},
|
| 1583 |
+
"stylus": {
|
| 1584 |
+
"optional": true
|
| 1585 |
+
},
|
| 1586 |
+
"sugarss": {
|
| 1587 |
+
"optional": true
|
| 1588 |
+
},
|
| 1589 |
+
"terser": {
|
| 1590 |
+
"optional": true
|
| 1591 |
+
},
|
| 1592 |
+
"tsx": {
|
| 1593 |
+
"optional": true
|
| 1594 |
+
},
|
| 1595 |
+
"yaml": {
|
| 1596 |
+
"optional": true
|
| 1597 |
+
}
|
| 1598 |
+
}
|
| 1599 |
+
},
|
| 1600 |
+
"node_modules/vite/node_modules/@esbuild/aix-ppc64": {
|
| 1601 |
+
"version": "0.25.11",
|
| 1602 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/aix-ppc64/-/aix-ppc64-0.25.11.tgz",
|
| 1603 |
+
"integrity": "sha512-Xt1dOL13m8u0WE8iplx9Ibbm+hFAO0GsU2P34UNoDGvZYkY8ifSiy6Zuc1lYxfG7svWE2fzqCUmFp5HCn51gJg==",
|
| 1604 |
+
"cpu": [
|
| 1605 |
+
"ppc64"
|
| 1606 |
+
],
|
| 1607 |
+
"license": "MIT",
|
| 1608 |
+
"optional": true,
|
| 1609 |
+
"os": [
|
| 1610 |
+
"aix"
|
| 1611 |
+
],
|
| 1612 |
+
"engines": {
|
| 1613 |
+
"node": ">=18"
|
| 1614 |
+
}
|
| 1615 |
+
},
|
| 1616 |
+
"node_modules/vite/node_modules/@esbuild/android-arm": {
|
| 1617 |
+
"version": "0.25.11",
|
| 1618 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/android-arm/-/android-arm-0.25.11.tgz",
|
| 1619 |
+
"integrity": "sha512-uoa7dU+Dt3HYsethkJ1k6Z9YdcHjTrSb5NUy66ZfZaSV8hEYGD5ZHbEMXnqLFlbBflLsl89Zke7CAdDJ4JI+Gg==",
|
| 1620 |
+
"cpu": [
|
| 1621 |
+
"arm"
|
| 1622 |
+
],
|
| 1623 |
+
"license": "MIT",
|
| 1624 |
+
"optional": true,
|
| 1625 |
+
"os": [
|
| 1626 |
+
"android"
|
| 1627 |
+
],
|
| 1628 |
+
"engines": {
|
| 1629 |
+
"node": ">=18"
|
| 1630 |
+
}
|
| 1631 |
+
},
|
| 1632 |
+
"node_modules/vite/node_modules/@esbuild/android-arm64": {
|
| 1633 |
+
"version": "0.25.11",
|
| 1634 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/android-arm64/-/android-arm64-0.25.11.tgz",
|
| 1635 |
+
"integrity": "sha512-9slpyFBc4FPPz48+f6jyiXOx/Y4v34TUeDDXJpZqAWQn/08lKGeD8aDp9TMn9jDz2CiEuHwfhRmGBvpnd/PWIQ==",
|
| 1636 |
+
"cpu": [
|
| 1637 |
+
"arm64"
|
| 1638 |
+
],
|
| 1639 |
+
"license": "MIT",
|
| 1640 |
+
"optional": true,
|
| 1641 |
+
"os": [
|
| 1642 |
+
"android"
|
| 1643 |
+
],
|
| 1644 |
+
"engines": {
|
| 1645 |
+
"node": ">=18"
|
| 1646 |
+
}
|
| 1647 |
+
},
|
| 1648 |
+
"node_modules/vite/node_modules/@esbuild/android-x64": {
|
| 1649 |
+
"version": "0.25.11",
|
| 1650 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/android-x64/-/android-x64-0.25.11.tgz",
|
| 1651 |
+
"integrity": "sha512-Sgiab4xBjPU1QoPEIqS3Xx+R2lezu0LKIEcYe6pftr56PqPygbB7+szVnzoShbx64MUupqoE0KyRlN7gezbl8g==",
|
| 1652 |
+
"cpu": [
|
| 1653 |
+
"x64"
|
| 1654 |
+
],
|
| 1655 |
+
"license": "MIT",
|
| 1656 |
+
"optional": true,
|
| 1657 |
+
"os": [
|
| 1658 |
+
"android"
|
| 1659 |
+
],
|
| 1660 |
+
"engines": {
|
| 1661 |
+
"node": ">=18"
|
| 1662 |
+
}
|
| 1663 |
+
},
|
| 1664 |
+
"node_modules/vite/node_modules/@esbuild/darwin-arm64": {
|
| 1665 |
+
"version": "0.25.11",
|
| 1666 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/darwin-arm64/-/darwin-arm64-0.25.11.tgz",
|
| 1667 |
+
"integrity": "sha512-VekY0PBCukppoQrycFxUqkCojnTQhdec0vevUL/EDOCnXd9LKWqD/bHwMPzigIJXPhC59Vd1WFIL57SKs2mg4w==",
|
| 1668 |
+
"cpu": [
|
| 1669 |
+
"arm64"
|
| 1670 |
+
],
|
| 1671 |
+
"license": "MIT",
|
| 1672 |
+
"optional": true,
|
| 1673 |
+
"os": [
|
| 1674 |
+
"darwin"
|
| 1675 |
+
],
|
| 1676 |
+
"engines": {
|
| 1677 |
+
"node": ">=18"
|
| 1678 |
+
}
|
| 1679 |
+
},
|
| 1680 |
+
"node_modules/vite/node_modules/@esbuild/darwin-x64": {
|
| 1681 |
+
"version": "0.25.11",
|
| 1682 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/darwin-x64/-/darwin-x64-0.25.11.tgz",
|
| 1683 |
+
"integrity": "sha512-+hfp3yfBalNEpTGp9loYgbknjR695HkqtY3d3/JjSRUyPg/xd6q+mQqIb5qdywnDxRZykIHs3axEqU6l1+oWEQ==",
|
| 1684 |
+
"cpu": [
|
| 1685 |
+
"x64"
|
| 1686 |
+
],
|
| 1687 |
+
"license": "MIT",
|
| 1688 |
+
"optional": true,
|
| 1689 |
+
"os": [
|
| 1690 |
+
"darwin"
|
| 1691 |
+
],
|
| 1692 |
+
"engines": {
|
| 1693 |
+
"node": ">=18"
|
| 1694 |
+
}
|
| 1695 |
+
},
|
| 1696 |
+
"node_modules/vite/node_modules/@esbuild/freebsd-arm64": {
|
| 1697 |
+
"version": "0.25.11",
|
| 1698 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.11.tgz",
|
| 1699 |
+
"integrity": "sha512-CmKjrnayyTJF2eVuO//uSjl/K3KsMIeYeyN7FyDBjsR3lnSJHaXlVoAK8DZa7lXWChbuOk7NjAc7ygAwrnPBhA==",
|
| 1700 |
+
"cpu": [
|
| 1701 |
+
"arm64"
|
| 1702 |
+
],
|
| 1703 |
+
"license": "MIT",
|
| 1704 |
+
"optional": true,
|
| 1705 |
+
"os": [
|
| 1706 |
+
"freebsd"
|
| 1707 |
+
],
|
| 1708 |
+
"engines": {
|
| 1709 |
+
"node": ">=18"
|
| 1710 |
+
}
|
| 1711 |
+
},
|
| 1712 |
+
"node_modules/vite/node_modules/@esbuild/freebsd-x64": {
|
| 1713 |
+
"version": "0.25.11",
|
| 1714 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/freebsd-x64/-/freebsd-x64-0.25.11.tgz",
|
| 1715 |
+
"integrity": "sha512-Dyq+5oscTJvMaYPvW3x3FLpi2+gSZTCE/1ffdwuM6G1ARang/mb3jvjxs0mw6n3Lsw84ocfo9CrNMqc5lTfGOw==",
|
| 1716 |
+
"cpu": [
|
| 1717 |
+
"x64"
|
| 1718 |
+
],
|
| 1719 |
+
"license": "MIT",
|
| 1720 |
+
"optional": true,
|
| 1721 |
+
"os": [
|
| 1722 |
+
"freebsd"
|
| 1723 |
+
],
|
| 1724 |
+
"engines": {
|
| 1725 |
+
"node": ">=18"
|
| 1726 |
+
}
|
| 1727 |
+
},
|
| 1728 |
+
"node_modules/vite/node_modules/@esbuild/linux-arm": {
|
| 1729 |
+
"version": "0.25.11",
|
| 1730 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/linux-arm/-/linux-arm-0.25.11.tgz",
|
| 1731 |
+
"integrity": "sha512-TBMv6B4kCfrGJ8cUPo7vd6NECZH/8hPpBHHlYI3qzoYFvWu2AdTvZNuU/7hsbKWqu/COU7NIK12dHAAqBLLXgw==",
|
| 1732 |
+
"cpu": [
|
| 1733 |
+
"arm"
|
| 1734 |
+
],
|
| 1735 |
+
"license": "MIT",
|
| 1736 |
+
"optional": true,
|
| 1737 |
+
"os": [
|
| 1738 |
+
"linux"
|
| 1739 |
+
],
|
| 1740 |
+
"engines": {
|
| 1741 |
+
"node": ">=18"
|
| 1742 |
+
}
|
| 1743 |
+
},
|
| 1744 |
+
"node_modules/vite/node_modules/@esbuild/linux-arm64": {
|
| 1745 |
+
"version": "0.25.11",
|
| 1746 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/linux-arm64/-/linux-arm64-0.25.11.tgz",
|
| 1747 |
+
"integrity": "sha512-Qr8AzcplUhGvdyUF08A1kHU3Vr2O88xxP0Tm8GcdVOUm25XYcMPp2YqSVHbLuXzYQMf9Bh/iKx7YPqECs6ffLA==",
|
| 1748 |
+
"cpu": [
|
| 1749 |
+
"arm64"
|
| 1750 |
+
],
|
| 1751 |
+
"license": "MIT",
|
| 1752 |
+
"optional": true,
|
| 1753 |
+
"os": [
|
| 1754 |
+
"linux"
|
| 1755 |
+
],
|
| 1756 |
+
"engines": {
|
| 1757 |
+
"node": ">=18"
|
| 1758 |
+
}
|
| 1759 |
+
},
|
| 1760 |
+
"node_modules/vite/node_modules/@esbuild/linux-ia32": {
|
| 1761 |
+
"version": "0.25.11",
|
| 1762 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/linux-ia32/-/linux-ia32-0.25.11.tgz",
|
| 1763 |
+
"integrity": "sha512-TmnJg8BMGPehs5JKrCLqyWTVAvielc615jbkOirATQvWWB1NMXY77oLMzsUjRLa0+ngecEmDGqt5jiDC6bfvOw==",
|
| 1764 |
+
"cpu": [
|
| 1765 |
+
"ia32"
|
| 1766 |
+
],
|
| 1767 |
+
"license": "MIT",
|
| 1768 |
+
"optional": true,
|
| 1769 |
+
"os": [
|
| 1770 |
+
"linux"
|
| 1771 |
+
],
|
| 1772 |
+
"engines": {
|
| 1773 |
+
"node": ">=18"
|
| 1774 |
+
}
|
| 1775 |
+
},
|
| 1776 |
+
"node_modules/vite/node_modules/@esbuild/linux-loong64": {
|
| 1777 |
+
"version": "0.25.11",
|
| 1778 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/linux-loong64/-/linux-loong64-0.25.11.tgz",
|
| 1779 |
+
"integrity": "sha512-DIGXL2+gvDaXlaq8xruNXUJdT5tF+SBbJQKbWy/0J7OhU8gOHOzKmGIlfTTl6nHaCOoipxQbuJi7O++ldrxgMw==",
|
| 1780 |
+
"cpu": [
|
| 1781 |
+
"loong64"
|
| 1782 |
+
],
|
| 1783 |
+
"license": "MIT",
|
| 1784 |
+
"optional": true,
|
| 1785 |
+
"os": [
|
| 1786 |
+
"linux"
|
| 1787 |
+
],
|
| 1788 |
+
"engines": {
|
| 1789 |
+
"node": ">=18"
|
| 1790 |
+
}
|
| 1791 |
+
},
|
| 1792 |
+
"node_modules/vite/node_modules/@esbuild/linux-mips64el": {
|
| 1793 |
+
"version": "0.25.11",
|
| 1794 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/linux-mips64el/-/linux-mips64el-0.25.11.tgz",
|
| 1795 |
+
"integrity": "sha512-Osx1nALUJu4pU43o9OyjSCXokFkFbyzjXb6VhGIJZQ5JZi8ylCQ9/LFagolPsHtgw6himDSyb5ETSfmp4rpiKQ==",
|
| 1796 |
+
"cpu": [
|
| 1797 |
+
"mips64el"
|
| 1798 |
+
],
|
| 1799 |
+
"license": "MIT",
|
| 1800 |
+
"optional": true,
|
| 1801 |
+
"os": [
|
| 1802 |
+
"linux"
|
| 1803 |
+
],
|
| 1804 |
+
"engines": {
|
| 1805 |
+
"node": ">=18"
|
| 1806 |
+
}
|
| 1807 |
+
},
|
| 1808 |
+
"node_modules/vite/node_modules/@esbuild/linux-ppc64": {
|
| 1809 |
+
"version": "0.25.11",
|
| 1810 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/linux-ppc64/-/linux-ppc64-0.25.11.tgz",
|
| 1811 |
+
"integrity": "sha512-nbLFgsQQEsBa8XSgSTSlrnBSrpoWh7ioFDUmwo158gIm5NNP+17IYmNWzaIzWmgCxq56vfr34xGkOcZ7jX6CPw==",
|
| 1812 |
+
"cpu": [
|
| 1813 |
+
"ppc64"
|
| 1814 |
+
],
|
| 1815 |
+
"license": "MIT",
|
| 1816 |
+
"optional": true,
|
| 1817 |
+
"os": [
|
| 1818 |
+
"linux"
|
| 1819 |
+
],
|
| 1820 |
+
"engines": {
|
| 1821 |
+
"node": ">=18"
|
| 1822 |
+
}
|
| 1823 |
+
},
|
| 1824 |
+
"node_modules/vite/node_modules/@esbuild/linux-riscv64": {
|
| 1825 |
+
"version": "0.25.11",
|
| 1826 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/linux-riscv64/-/linux-riscv64-0.25.11.tgz",
|
| 1827 |
+
"integrity": "sha512-HfyAmqZi9uBAbgKYP1yGuI7tSREXwIb438q0nqvlpxAOs3XnZ8RsisRfmVsgV486NdjD7Mw2UrFSw51lzUk1ww==",
|
| 1828 |
+
"cpu": [
|
| 1829 |
+
"riscv64"
|
| 1830 |
+
],
|
| 1831 |
+
"license": "MIT",
|
| 1832 |
+
"optional": true,
|
| 1833 |
+
"os": [
|
| 1834 |
+
"linux"
|
| 1835 |
+
],
|
| 1836 |
+
"engines": {
|
| 1837 |
+
"node": ">=18"
|
| 1838 |
+
}
|
| 1839 |
+
},
|
| 1840 |
+
"node_modules/vite/node_modules/@esbuild/linux-s390x": {
|
| 1841 |
+
"version": "0.25.11",
|
| 1842 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/linux-s390x/-/linux-s390x-0.25.11.tgz",
|
| 1843 |
+
"integrity": "sha512-HjLqVgSSYnVXRisyfmzsH6mXqyvj0SA7pG5g+9W7ESgwA70AXYNpfKBqh1KbTxmQVaYxpzA/SvlB9oclGPbApw==",
|
| 1844 |
+
"cpu": [
|
| 1845 |
+
"s390x"
|
| 1846 |
+
],
|
| 1847 |
+
"license": "MIT",
|
| 1848 |
+
"optional": true,
|
| 1849 |
+
"os": [
|
| 1850 |
+
"linux"
|
| 1851 |
+
],
|
| 1852 |
+
"engines": {
|
| 1853 |
+
"node": ">=18"
|
| 1854 |
+
}
|
| 1855 |
+
},
|
| 1856 |
+
"node_modules/vite/node_modules/@esbuild/linux-x64": {
|
| 1857 |
+
"version": "0.25.11",
|
| 1858 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/linux-x64/-/linux-x64-0.25.11.tgz",
|
| 1859 |
+
"integrity": "sha512-HSFAT4+WYjIhrHxKBwGmOOSpphjYkcswF449j6EjsjbinTZbp8PJtjsVK1XFJStdzXdy/jaddAep2FGY+wyFAQ==",
|
| 1860 |
+
"cpu": [
|
| 1861 |
+
"x64"
|
| 1862 |
+
],
|
| 1863 |
+
"license": "MIT",
|
| 1864 |
+
"optional": true,
|
| 1865 |
+
"os": [
|
| 1866 |
+
"linux"
|
| 1867 |
+
],
|
| 1868 |
+
"engines": {
|
| 1869 |
+
"node": ">=18"
|
| 1870 |
+
}
|
| 1871 |
+
},
|
| 1872 |
+
"node_modules/vite/node_modules/@esbuild/netbsd-x64": {
|
| 1873 |
+
"version": "0.25.11",
|
| 1874 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/netbsd-x64/-/netbsd-x64-0.25.11.tgz",
|
| 1875 |
+
"integrity": "sha512-u7tKA+qbzBydyj0vgpu+5h5AeudxOAGncb8N6C9Kh1N4n7wU1Xw1JDApsRjpShRpXRQlJLb9wY28ELpwdPcZ7A==",
|
| 1876 |
+
"cpu": [
|
| 1877 |
+
"x64"
|
| 1878 |
+
],
|
| 1879 |
+
"license": "MIT",
|
| 1880 |
+
"optional": true,
|
| 1881 |
+
"os": [
|
| 1882 |
+
"netbsd"
|
| 1883 |
+
],
|
| 1884 |
+
"engines": {
|
| 1885 |
+
"node": ">=18"
|
| 1886 |
+
}
|
| 1887 |
+
},
|
| 1888 |
+
"node_modules/vite/node_modules/@esbuild/openbsd-x64": {
|
| 1889 |
+
"version": "0.25.11",
|
| 1890 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/openbsd-x64/-/openbsd-x64-0.25.11.tgz",
|
| 1891 |
+
"integrity": "sha512-CN+7c++kkbrckTOz5hrehxWN7uIhFFlmS/hqziSFVWpAzpWrQoAG4chH+nN3Be+Kzv/uuo7zhX716x3Sn2Jduw==",
|
| 1892 |
+
"cpu": [
|
| 1893 |
+
"x64"
|
| 1894 |
+
],
|
| 1895 |
+
"license": "MIT",
|
| 1896 |
+
"optional": true,
|
| 1897 |
+
"os": [
|
| 1898 |
+
"openbsd"
|
| 1899 |
+
],
|
| 1900 |
+
"engines": {
|
| 1901 |
+
"node": ">=18"
|
| 1902 |
+
}
|
| 1903 |
+
},
|
| 1904 |
+
"node_modules/vite/node_modules/@esbuild/sunos-x64": {
|
| 1905 |
+
"version": "0.25.11",
|
| 1906 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/sunos-x64/-/sunos-x64-0.25.11.tgz",
|
| 1907 |
+
"integrity": "sha512-nq2xdYaWxyg9DcIyXkZhcYulC6pQ2FuCgem3LI92IwMgIZ69KHeY8T4Y88pcwoLIjbed8n36CyKoYRDygNSGhA==",
|
| 1908 |
+
"cpu": [
|
| 1909 |
+
"x64"
|
| 1910 |
+
],
|
| 1911 |
+
"license": "MIT",
|
| 1912 |
+
"optional": true,
|
| 1913 |
+
"os": [
|
| 1914 |
+
"sunos"
|
| 1915 |
+
],
|
| 1916 |
+
"engines": {
|
| 1917 |
+
"node": ">=18"
|
| 1918 |
+
}
|
| 1919 |
+
},
|
| 1920 |
+
"node_modules/vite/node_modules/@esbuild/win32-arm64": {
|
| 1921 |
+
"version": "0.25.11",
|
| 1922 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/win32-arm64/-/win32-arm64-0.25.11.tgz",
|
| 1923 |
+
"integrity": "sha512-3XxECOWJq1qMZ3MN8srCJ/QfoLpL+VaxD/WfNRm1O3B4+AZ/BnLVgFbUV3eiRYDMXetciH16dwPbbHqwe1uU0Q==",
|
| 1924 |
+
"cpu": [
|
| 1925 |
+
"arm64"
|
| 1926 |
+
],
|
| 1927 |
+
"license": "MIT",
|
| 1928 |
+
"optional": true,
|
| 1929 |
+
"os": [
|
| 1930 |
+
"win32"
|
| 1931 |
+
],
|
| 1932 |
+
"engines": {
|
| 1933 |
+
"node": ">=18"
|
| 1934 |
+
}
|
| 1935 |
+
},
|
| 1936 |
+
"node_modules/vite/node_modules/@esbuild/win32-ia32": {
|
| 1937 |
+
"version": "0.25.11",
|
| 1938 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/win32-ia32/-/win32-ia32-0.25.11.tgz",
|
| 1939 |
+
"integrity": "sha512-3ukss6gb9XZ8TlRyJlgLn17ecsK4NSQTmdIXRASVsiS2sQ6zPPZklNJT5GR5tE/MUarymmy8kCEf5xPCNCqVOA==",
|
| 1940 |
+
"cpu": [
|
| 1941 |
+
"ia32"
|
| 1942 |
+
],
|
| 1943 |
+
"license": "MIT",
|
| 1944 |
+
"optional": true,
|
| 1945 |
+
"os": [
|
| 1946 |
+
"win32"
|
| 1947 |
+
],
|
| 1948 |
+
"engines": {
|
| 1949 |
+
"node": ">=18"
|
| 1950 |
+
}
|
| 1951 |
+
},
|
| 1952 |
+
"node_modules/vite/node_modules/@esbuild/win32-x64": {
|
| 1953 |
+
"version": "0.25.11",
|
| 1954 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/@esbuild/win32-x64/-/win32-x64-0.25.11.tgz",
|
| 1955 |
+
"integrity": "sha512-D7Hpz6A2L4hzsRpPaCYkQnGOotdUpDzSGRIv9I+1ITdHROSFUWW95ZPZWQmGka1Fg7W3zFJowyn9WGwMJ0+KPA==",
|
| 1956 |
+
"cpu": [
|
| 1957 |
+
"x64"
|
| 1958 |
+
],
|
| 1959 |
+
"license": "MIT",
|
| 1960 |
+
"optional": true,
|
| 1961 |
+
"os": [
|
| 1962 |
+
"win32"
|
| 1963 |
+
],
|
| 1964 |
+
"engines": {
|
| 1965 |
+
"node": ">=18"
|
| 1966 |
+
}
|
| 1967 |
+
},
|
| 1968 |
+
"node_modules/vite/node_modules/esbuild": {
|
| 1969 |
+
"version": "0.25.11",
|
| 1970 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/esbuild/-/esbuild-0.25.11.tgz",
|
| 1971 |
+
"integrity": "sha512-KohQwyzrKTQmhXDW1PjCv3Tyspn9n5GcY2RTDqeORIdIJY8yKIF7sTSopFmn/wpMPW4rdPXI0UE5LJLuq3bx0Q==",
|
| 1972 |
+
"hasInstallScript": true,
|
| 1973 |
+
"license": "MIT",
|
| 1974 |
+
"bin": {
|
| 1975 |
+
"esbuild": "bin/esbuild"
|
| 1976 |
+
},
|
| 1977 |
+
"engines": {
|
| 1978 |
+
"node": ">=18"
|
| 1979 |
+
},
|
| 1980 |
+
"optionalDependencies": {
|
| 1981 |
+
"@esbuild/aix-ppc64": "0.25.11",
|
| 1982 |
+
"@esbuild/android-arm": "0.25.11",
|
| 1983 |
+
"@esbuild/android-arm64": "0.25.11",
|
| 1984 |
+
"@esbuild/android-x64": "0.25.11",
|
| 1985 |
+
"@esbuild/darwin-arm64": "0.25.11",
|
| 1986 |
+
"@esbuild/darwin-x64": "0.25.11",
|
| 1987 |
+
"@esbuild/freebsd-arm64": "0.25.11",
|
| 1988 |
+
"@esbuild/freebsd-x64": "0.25.11",
|
| 1989 |
+
"@esbuild/linux-arm": "0.25.11",
|
| 1990 |
+
"@esbuild/linux-arm64": "0.25.11",
|
| 1991 |
+
"@esbuild/linux-ia32": "0.25.11",
|
| 1992 |
+
"@esbuild/linux-loong64": "0.25.11",
|
| 1993 |
+
"@esbuild/linux-mips64el": "0.25.11",
|
| 1994 |
+
"@esbuild/linux-ppc64": "0.25.11",
|
| 1995 |
+
"@esbuild/linux-riscv64": "0.25.11",
|
| 1996 |
+
"@esbuild/linux-s390x": "0.25.11",
|
| 1997 |
+
"@esbuild/linux-x64": "0.25.11",
|
| 1998 |
+
"@esbuild/netbsd-arm64": "0.25.11",
|
| 1999 |
+
"@esbuild/netbsd-x64": "0.25.11",
|
| 2000 |
+
"@esbuild/openbsd-arm64": "0.25.11",
|
| 2001 |
+
"@esbuild/openbsd-x64": "0.25.11",
|
| 2002 |
+
"@esbuild/openharmony-arm64": "0.25.11",
|
| 2003 |
+
"@esbuild/sunos-x64": "0.25.11",
|
| 2004 |
+
"@esbuild/win32-arm64": "0.25.11",
|
| 2005 |
+
"@esbuild/win32-ia32": "0.25.11",
|
| 2006 |
+
"@esbuild/win32-x64": "0.25.11"
|
| 2007 |
+
}
|
| 2008 |
+
},
|
| 2009 |
+
"node_modules/wrap-ansi": {
|
| 2010 |
+
"version": "6.2.0",
|
| 2011 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
|
| 2012 |
+
"integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
|
| 2013 |
+
"license": "MIT",
|
| 2014 |
+
"dependencies": {
|
| 2015 |
+
"ansi-styles": "^4.0.0",
|
| 2016 |
+
"string-width": "^4.1.0",
|
| 2017 |
+
"strip-ansi": "^6.0.0"
|
| 2018 |
+
},
|
| 2019 |
+
"engines": {
|
| 2020 |
+
"node": ">=8"
|
| 2021 |
+
}
|
| 2022 |
+
},
|
| 2023 |
+
"node_modules/ws": {
|
| 2024 |
+
"version": "8.18.3",
|
| 2025 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/ws/-/ws-8.18.3.tgz",
|
| 2026 |
+
"integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==",
|
| 2027 |
+
"license": "MIT",
|
| 2028 |
+
"engines": {
|
| 2029 |
+
"node": ">=10.0.0"
|
| 2030 |
+
},
|
| 2031 |
+
"peerDependencies": {
|
| 2032 |
+
"bufferutil": "^4.0.1",
|
| 2033 |
+
"utf-8-validate": ">=5.0.2"
|
| 2034 |
+
},
|
| 2035 |
+
"peerDependenciesMeta": {
|
| 2036 |
+
"bufferutil": {
|
| 2037 |
+
"optional": true
|
| 2038 |
+
},
|
| 2039 |
+
"utf-8-validate": {
|
| 2040 |
+
"optional": true
|
| 2041 |
+
}
|
| 2042 |
+
}
|
| 2043 |
+
},
|
| 2044 |
+
"node_modules/y18n": {
|
| 2045 |
+
"version": "5.0.8",
|
| 2046 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/y18n/-/y18n-5.0.8.tgz",
|
| 2047 |
+
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
|
| 2048 |
+
"license": "ISC",
|
| 2049 |
+
"engines": {
|
| 2050 |
+
"node": ">=10"
|
| 2051 |
+
}
|
| 2052 |
+
},
|
| 2053 |
+
"node_modules/yargs": {
|
| 2054 |
+
"version": "17.7.2",
|
| 2055 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/yargs/-/yargs-17.7.2.tgz",
|
| 2056 |
+
"integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
|
| 2057 |
+
"license": "MIT",
|
| 2058 |
+
"dependencies": {
|
| 2059 |
+
"cliui": "^8.0.1",
|
| 2060 |
+
"escalade": "^3.1.1",
|
| 2061 |
+
"get-caller-file": "^2.0.5",
|
| 2062 |
+
"require-directory": "^2.1.1",
|
| 2063 |
+
"string-width": "^4.2.3",
|
| 2064 |
+
"y18n": "^5.0.5",
|
| 2065 |
+
"yargs-parser": "^21.1.1"
|
| 2066 |
+
},
|
| 2067 |
+
"engines": {
|
| 2068 |
+
"node": ">=12"
|
| 2069 |
+
}
|
| 2070 |
+
},
|
| 2071 |
+
"node_modules/yargs-parser": {
|
| 2072 |
+
"version": "21.1.1",
|
| 2073 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/yargs-parser/-/yargs-parser-21.1.1.tgz",
|
| 2074 |
+
"integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
|
| 2075 |
+
"license": "ISC",
|
| 2076 |
+
"engines": {
|
| 2077 |
+
"node": ">=12"
|
| 2078 |
+
}
|
| 2079 |
+
},
|
| 2080 |
+
"node_modules/yoctocolors-cjs": {
|
| 2081 |
+
"version": "2.1.3",
|
| 2082 |
+
"resolved": "https://repos.verz.local/artifactory/api/npm/npm/yoctocolors-cjs/-/yoctocolors-cjs-2.1.3.tgz",
|
| 2083 |
+
"integrity": "sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw==",
|
| 2084 |
+
"license": "MIT",
|
| 2085 |
+
"engines": {
|
| 2086 |
+
"node": ">=18"
|
| 2087 |
+
},
|
| 2088 |
+
"funding": {
|
| 2089 |
+
"url": "https://github.com/sponsors/sindresorhus"
|
| 2090 |
+
}
|
| 2091 |
+
}
|
| 2092 |
+
}
|
| 2093 |
+
}
|
6.1.1/client/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@gradio/client",
|
| 3 |
+
"version": "2.0.0",
|
| 4 |
+
"description": "Gradio API client",
|
| 5 |
+
"type": "module",
|
| 6 |
+
"main": "dist/index.js",
|
| 7 |
+
"author": "",
|
| 8 |
+
"license": "ISC",
|
| 9 |
+
"exports": {
|
| 10 |
+
".": {
|
| 11 |
+
"gradio": "./src/index.ts",
|
| 12 |
+
"browser": "./dist/browser.js",
|
| 13 |
+
"import": "./dist/index.js",
|
| 14 |
+
"default": "./dist/index.js"
|
| 15 |
+
},
|
| 16 |
+
"./package.json": "./package.json",
|
| 17 |
+
"./browser.js": "./dist/browser.js"
|
| 18 |
+
},
|
| 19 |
+
"dependencies": {
|
| 20 |
+
"fetch-event-stream": "^0.1.5"
|
| 21 |
+
},
|
| 22 |
+
"devDependencies": {
|
| 23 |
+
"msw": "^2.11.3",
|
| 24 |
+
"typescript": "^5.9.3"
|
| 25 |
+
},
|
| 26 |
+
"scripts": {
|
| 27 |
+
"bundle": "vite build --ssr",
|
| 28 |
+
"bundle:browser": "BROWSER_BUILD=true vite build",
|
| 29 |
+
"generate_types": "tsc",
|
| 30 |
+
"clean": "rm -rf dist",
|
| 31 |
+
"build": "pnpm clean && pnpm bundle && pnpm bundle:browser && pnpm generate_types",
|
| 32 |
+
"test": "pnpm test:client && pnpm test:client:node",
|
| 33 |
+
"test:client": "vitest run -c vite.config.js",
|
| 34 |
+
"test:client:node": "TEST_MODE=node vitest run -c vite.config.js",
|
| 35 |
+
"preview:browser": "vite dev --mode=preview"
|
| 36 |
+
},
|
| 37 |
+
"engines": {
|
| 38 |
+
"node": ">=18.0.0"
|
| 39 |
+
},
|
| 40 |
+
"main_changeset": true,
|
| 41 |
+
"repository": {
|
| 42 |
+
"type": "git",
|
| 43 |
+
"url": "git+https://github.com/gradio-app/gradio.git",
|
| 44 |
+
"directory": "client/js"
|
| 45 |
+
}
|
| 46 |
+
}
|
6.1.1/client/src/client.ts
ADDED
|
@@ -0,0 +1,539 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
UploadResponse,
|
| 13 |
+
client_return,
|
| 14 |
+
SubmitIterable,
|
| 15 |
+
GradioEvent
|
| 16 |
+
} from "./types";
|
| 17 |
+
import { view_api } from "./utils/view_api";
|
| 18 |
+
import { upload_files } from "./utils/upload_files";
|
| 19 |
+
import { upload, FileData } from "./upload";
|
| 20 |
+
import { handle_blob } from "./utils/handle_blob";
|
| 21 |
+
import { post_data } from "./utils/post_data";
|
| 22 |
+
import { predict } from "./utils/predict";
|
| 23 |
+
import { duplicate } from "./utils/duplicate";
|
| 24 |
+
import { submit } from "./utils/submit";
|
| 25 |
+
import { RE_SPACE_NAME, process_endpoint } from "./helpers/api_info";
|
| 26 |
+
import {
|
| 27 |
+
map_names_to_ids,
|
| 28 |
+
resolve_cookies,
|
| 29 |
+
resolve_config,
|
| 30 |
+
get_jwt,
|
| 31 |
+
parse_and_set_cookies
|
| 32 |
+
} from "./helpers/init_helpers";
|
| 33 |
+
import { check_and_wake_space, check_space_status } from "./helpers/spaces";
|
| 34 |
+
import { open_stream, readable_stream, close_stream } from "./utils/stream";
|
| 35 |
+
import {
|
| 36 |
+
API_INFO_ERROR_MSG,
|
| 37 |
+
APP_ID_URL,
|
| 38 |
+
CONFIG_ERROR_MSG,
|
| 39 |
+
HEARTBEAT_URL,
|
| 40 |
+
COMPONENT_SERVER_URL
|
| 41 |
+
} from "./constants";
|
| 42 |
+
declare const BROWSER_BUILD: boolean;
|
| 43 |
+
|
| 44 |
+
export class Client {
|
| 45 |
+
app_reference: string;
|
| 46 |
+
options: ClientOptions;
|
| 47 |
+
deep_link: string | null = null;
|
| 48 |
+
|
| 49 |
+
config: Config | undefined;
|
| 50 |
+
api_prefix = "";
|
| 51 |
+
api_info: ApiInfo<JsApiData> | undefined;
|
| 52 |
+
api_map: Record<string, number> = {};
|
| 53 |
+
session_hash: string = Math.random().toString(36).substring(2);
|
| 54 |
+
jwt: string | false = false;
|
| 55 |
+
last_status: Record<string, Status["stage"]> = {};
|
| 56 |
+
|
| 57 |
+
private cookies: string | null = null;
|
| 58 |
+
|
| 59 |
+
// streaming
|
| 60 |
+
stream_status = { open: false };
|
| 61 |
+
closed = false;
|
| 62 |
+
pending_stream_messages: Record<string, any[][]> = {};
|
| 63 |
+
pending_diff_streams: Record<string, any[][]> = {};
|
| 64 |
+
event_callbacks: Record<string, (data?: unknown) => Promise<void>> = {};
|
| 65 |
+
unclosed_events: Set<string> = new Set();
|
| 66 |
+
heartbeat_event: EventSource | null = null;
|
| 67 |
+
abort_controller: AbortController | null = null;
|
| 68 |
+
stream_instance: EventSource | null = null;
|
| 69 |
+
current_payload: any;
|
| 70 |
+
|
| 71 |
+
get_url_config(url: string | null = null): Config {
|
| 72 |
+
if (!this.config) {
|
| 73 |
+
throw new Error(CONFIG_ERROR_MSG);
|
| 74 |
+
}
|
| 75 |
+
if (url === null) {
|
| 76 |
+
url = window.location.href;
|
| 77 |
+
}
|
| 78 |
+
const stripSlashes = (str: string): string => str.replace(/^\/+|\/+$/g, "");
|
| 79 |
+
let root_path = stripSlashes(new URL(this.config.root).pathname);
|
| 80 |
+
let url_path = stripSlashes(new URL(url).pathname);
|
| 81 |
+
let page: string;
|
| 82 |
+
if (!url_path.startsWith(root_path)) {
|
| 83 |
+
page = "";
|
| 84 |
+
} else {
|
| 85 |
+
page = stripSlashes(url_path.substring(root_path.length));
|
| 86 |
+
}
|
| 87 |
+
return this.get_page_config(page);
|
| 88 |
+
}
|
| 89 |
+
get_page_config(page: string): Config {
|
| 90 |
+
if (!this.config) {
|
| 91 |
+
throw new Error(CONFIG_ERROR_MSG);
|
| 92 |
+
}
|
| 93 |
+
let config = this.config;
|
| 94 |
+
if (!(page in config.page)) {
|
| 95 |
+
page = "";
|
| 96 |
+
}
|
| 97 |
+
return {
|
| 98 |
+
...config,
|
| 99 |
+
current_page: page,
|
| 100 |
+
layout: config.page[page].layout,
|
| 101 |
+
components: config.components.filter((c) =>
|
| 102 |
+
config.page[page].components.includes(c.id)
|
| 103 |
+
),
|
| 104 |
+
dependencies: this.config.dependencies.filter((d) =>
|
| 105 |
+
config.page[page].dependencies.includes(d.id)
|
| 106 |
+
)
|
| 107 |
+
};
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response> {
|
| 111 |
+
const headers = new Headers(init?.headers || {});
|
| 112 |
+
if (this && this.cookies) {
|
| 113 |
+
headers.append("Cookie", this.cookies);
|
| 114 |
+
}
|
| 115 |
+
if (this && this.options.headers) {
|
| 116 |
+
for (const name in this.options.headers) {
|
| 117 |
+
headers.append(name, this.options.headers[name]);
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
return fetch(input, { ...init, headers });
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
stream(url: URL): EventSource {
|
| 125 |
+
const headers = new Headers();
|
| 126 |
+
if (this && this.cookies) {
|
| 127 |
+
headers.append("Cookie", this.cookies);
|
| 128 |
+
}
|
| 129 |
+
if (this && this.options.headers) {
|
| 130 |
+
for (const name in this.options.headers) {
|
| 131 |
+
headers.append(name, this.options.headers[name]);
|
| 132 |
+
}
|
| 133 |
+
}
|
| 134 |
+
if (this && this.options.token) {
|
| 135 |
+
headers.append("Authorization", `Bearer ${this.options.token}`);
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
this.abort_controller = new AbortController();
|
| 139 |
+
|
| 140 |
+
this.stream_instance = readable_stream(url.toString(), {
|
| 141 |
+
credentials: "include",
|
| 142 |
+
headers: headers,
|
| 143 |
+
signal: this.abort_controller.signal
|
| 144 |
+
});
|
| 145 |
+
|
| 146 |
+
return this.stream_instance;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
view_api: () => Promise<ApiInfo<JsApiData>>;
|
| 150 |
+
upload_files: (
|
| 151 |
+
root_url: string,
|
| 152 |
+
files: (Blob | File)[],
|
| 153 |
+
upload_id?: string
|
| 154 |
+
) => Promise<UploadResponse>;
|
| 155 |
+
upload: (
|
| 156 |
+
file_data: FileData[],
|
| 157 |
+
root_url: string,
|
| 158 |
+
upload_id?: string,
|
| 159 |
+
max_file_size?: number
|
| 160 |
+
) => Promise<(FileData | null)[] | null>;
|
| 161 |
+
handle_blob: (
|
| 162 |
+
endpoint: string,
|
| 163 |
+
data: unknown[],
|
| 164 |
+
endpoint_info: EndpointInfo<ApiData | JsApiData>
|
| 165 |
+
) => Promise<unknown[]>;
|
| 166 |
+
post_data: (
|
| 167 |
+
url: string,
|
| 168 |
+
body: unknown,
|
| 169 |
+
additional_headers?: any
|
| 170 |
+
) => Promise<unknown[]>;
|
| 171 |
+
submit: (
|
| 172 |
+
endpoint: string | number,
|
| 173 |
+
data: unknown[] | Record<string, unknown> | undefined,
|
| 174 |
+
event_data?: unknown,
|
| 175 |
+
trigger_id?: number | null,
|
| 176 |
+
all_events?: boolean
|
| 177 |
+
) => SubmitIterable<GradioEvent>;
|
| 178 |
+
predict: (
|
| 179 |
+
endpoint: string | number,
|
| 180 |
+
data: unknown[] | Record<string, unknown> | undefined,
|
| 181 |
+
event_data?: unknown
|
| 182 |
+
) => Promise<PredictReturn>;
|
| 183 |
+
open_stream: () => Promise<void>;
|
| 184 |
+
private resolve_config: (endpoint: string) => Promise<Config | undefined>;
|
| 185 |
+
private resolve_cookies: () => Promise<void>;
|
| 186 |
+
constructor(
|
| 187 |
+
app_reference: string,
|
| 188 |
+
options: ClientOptions = { events: ["data"] }
|
| 189 |
+
) {
|
| 190 |
+
this.app_reference = app_reference;
|
| 191 |
+
this.deep_link = options.query_params?.deep_link || null;
|
| 192 |
+
if (!options.events) {
|
| 193 |
+
options.events = ["data"];
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
this.options = options;
|
| 197 |
+
this.current_payload = {};
|
| 198 |
+
this.view_api = view_api.bind(this);
|
| 199 |
+
this.upload_files = upload_files.bind(this);
|
| 200 |
+
this.handle_blob = handle_blob.bind(this);
|
| 201 |
+
this.post_data = post_data.bind(this);
|
| 202 |
+
this.submit = submit.bind(this);
|
| 203 |
+
this.predict = predict.bind(this);
|
| 204 |
+
this.open_stream = open_stream.bind(this);
|
| 205 |
+
this.resolve_config = resolve_config.bind(this);
|
| 206 |
+
this.resolve_cookies = resolve_cookies.bind(this);
|
| 207 |
+
this.upload = upload.bind(this);
|
| 208 |
+
this.fetch = this.fetch.bind(this);
|
| 209 |
+
this.handle_space_success = this.handle_space_success.bind(this);
|
| 210 |
+
this.stream = this.stream.bind(this);
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
private async init(): Promise<void> {
|
| 214 |
+
if (this.options.auth) {
|
| 215 |
+
await this.resolve_cookies();
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
await this._resolve_config().then(({ config }) =>
|
| 219 |
+
this._resolve_heartbeat(config)
|
| 220 |
+
);
|
| 221 |
+
|
| 222 |
+
this.api_info = await this.view_api();
|
| 223 |
+
this.api_map = map_names_to_ids(this.config?.dependencies || []);
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
async _resolve_heartbeat(_config: Config): Promise<void> {
|
| 227 |
+
if (_config) {
|
| 228 |
+
this.config = _config;
|
| 229 |
+
this.api_prefix = _config.api_prefix || "";
|
| 230 |
+
|
| 231 |
+
if (this.config && this.config.connect_heartbeat) {
|
| 232 |
+
if (this.config.space_id && this.options.token) {
|
| 233 |
+
this.jwt = await get_jwt(
|
| 234 |
+
this.config.space_id,
|
| 235 |
+
this.options.token,
|
| 236 |
+
this.cookies
|
| 237 |
+
);
|
| 238 |
+
}
|
| 239 |
+
}
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
if (_config.space_id && this.options.token) {
|
| 243 |
+
this.jwt = await get_jwt(_config.space_id, this.options.token);
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
if (this.config && this.config.connect_heartbeat) {
|
| 247 |
+
// connect to the heartbeat endpoint via GET request
|
| 248 |
+
const heartbeat_url = new URL(
|
| 249 |
+
`${this.config.root}${this.api_prefix}/${HEARTBEAT_URL}/${this.session_hash}`
|
| 250 |
+
);
|
| 251 |
+
|
| 252 |
+
// if the jwt is available, add it to the query params
|
| 253 |
+
if (this.jwt) {
|
| 254 |
+
heartbeat_url.searchParams.set("__sign", this.jwt);
|
| 255 |
+
}
|
| 256 |
+
|
| 257 |
+
// Just connect to the endpoint without parsing the response. Ref: https://github.com/gradio-app/gradio/pull/7974#discussion_r1557717540
|
| 258 |
+
if (!this.heartbeat_event) {
|
| 259 |
+
this.heartbeat_event = this.stream(heartbeat_url);
|
| 260 |
+
}
|
| 261 |
+
}
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
static async connect(
|
| 265 |
+
app_reference: string,
|
| 266 |
+
options: ClientOptions = {
|
| 267 |
+
events: ["data"]
|
| 268 |
+
}
|
| 269 |
+
): Promise<Client> {
|
| 270 |
+
const client = new this(app_reference, options); // this refers to the class itself, not the instance
|
| 271 |
+
if (options.session_hash) {
|
| 272 |
+
client.session_hash = options.session_hash;
|
| 273 |
+
}
|
| 274 |
+
await client.init();
|
| 275 |
+
return client;
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
async reconnect(): Promise<"connected" | "broken" | "changed"> {
|
| 279 |
+
const app_id_url = new URL(
|
| 280 |
+
`${this.config!.root}${this.api_prefix}/${APP_ID_URL}`
|
| 281 |
+
);
|
| 282 |
+
let app_id: string;
|
| 283 |
+
try {
|
| 284 |
+
const response = await this.fetch(app_id_url);
|
| 285 |
+
if (!response.ok) {
|
| 286 |
+
throw new Error();
|
| 287 |
+
}
|
| 288 |
+
app_id = ((await response.json()) as any).app_id;
|
| 289 |
+
} catch (e) {
|
| 290 |
+
return "broken";
|
| 291 |
+
}
|
| 292 |
+
if (app_id !== this.config!.app_id) {
|
| 293 |
+
return "changed";
|
| 294 |
+
}
|
| 295 |
+
return "connected";
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
close(): void {
|
| 299 |
+
this.closed = true;
|
| 300 |
+
close_stream(this.stream_status, this.abort_controller);
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
set_current_payload(payload: any): void {
|
| 304 |
+
this.current_payload = payload;
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
static async duplicate(
|
| 308 |
+
app_reference: string,
|
| 309 |
+
options: DuplicateOptions = {
|
| 310 |
+
events: ["data"]
|
| 311 |
+
}
|
| 312 |
+
): Promise<Client> {
|
| 313 |
+
return duplicate(app_reference, options);
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
private async _resolve_config(): Promise<any> {
|
| 317 |
+
const { http_protocol, host, space_id } = await process_endpoint(
|
| 318 |
+
this.app_reference,
|
| 319 |
+
this.options.token
|
| 320 |
+
);
|
| 321 |
+
|
| 322 |
+
const { status_callback } = this.options;
|
| 323 |
+
|
| 324 |
+
if (space_id && status_callback) {
|
| 325 |
+
await check_and_wake_space(space_id, status_callback);
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
let config: Config | undefined;
|
| 329 |
+
|
| 330 |
+
try {
|
| 331 |
+
// Create base URL
|
| 332 |
+
let configUrl = `${http_protocol}//${host}`;
|
| 333 |
+
config = await this.resolve_config(configUrl);
|
| 334 |
+
|
| 335 |
+
if (!config) {
|
| 336 |
+
throw new Error(CONFIG_ERROR_MSG);
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
return this.config_success(config);
|
| 340 |
+
} catch (e: any) {
|
| 341 |
+
if (space_id && status_callback) {
|
| 342 |
+
check_space_status(
|
| 343 |
+
space_id,
|
| 344 |
+
RE_SPACE_NAME.test(space_id) ? "space_name" : "subdomain",
|
| 345 |
+
this.handle_space_success
|
| 346 |
+
);
|
| 347 |
+
} else {
|
| 348 |
+
if (status_callback)
|
| 349 |
+
status_callback({
|
| 350 |
+
status: "error",
|
| 351 |
+
message: "Could not load this space.",
|
| 352 |
+
load_status: "error",
|
| 353 |
+
detail: "NOT_FOUND"
|
| 354 |
+
});
|
| 355 |
+
throw Error(e);
|
| 356 |
+
}
|
| 357 |
+
}
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
private async config_success(
|
| 361 |
+
_config: Config
|
| 362 |
+
): Promise<Config | client_return> {
|
| 363 |
+
this.config = _config;
|
| 364 |
+
this.api_prefix = _config.api_prefix || "";
|
| 365 |
+
|
| 366 |
+
if (this.config.auth_required) {
|
| 367 |
+
return this.prepare_return_obj();
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
try {
|
| 371 |
+
this.api_info = await this.view_api();
|
| 372 |
+
} catch (e) {
|
| 373 |
+
console.error(API_INFO_ERROR_MSG + (e as Error).message);
|
| 374 |
+
}
|
| 375 |
+
|
| 376 |
+
return this.prepare_return_obj();
|
| 377 |
+
}
|
| 378 |
+
|
| 379 |
+
async handle_space_success(status: SpaceStatus): Promise<Config | void> {
|
| 380 |
+
if (!this) {
|
| 381 |
+
throw new Error(CONFIG_ERROR_MSG);
|
| 382 |
+
}
|
| 383 |
+
const { status_callback } = this.options;
|
| 384 |
+
if (status_callback) status_callback(status);
|
| 385 |
+
if (status.status === "running") {
|
| 386 |
+
try {
|
| 387 |
+
this.config = await this._resolve_config();
|
| 388 |
+
this.api_prefix = this?.config?.api_prefix || "";
|
| 389 |
+
|
| 390 |
+
if (!this.config) {
|
| 391 |
+
throw new Error(CONFIG_ERROR_MSG);
|
| 392 |
+
}
|
| 393 |
+
|
| 394 |
+
const _config = await this.config_success(this.config);
|
| 395 |
+
|
| 396 |
+
return _config as Config;
|
| 397 |
+
} catch (e) {
|
| 398 |
+
if (status_callback) {
|
| 399 |
+
status_callback({
|
| 400 |
+
status: "error",
|
| 401 |
+
message: "Could not load this space.",
|
| 402 |
+
load_status: "error",
|
| 403 |
+
detail: "NOT_FOUND"
|
| 404 |
+
});
|
| 405 |
+
}
|
| 406 |
+
throw e;
|
| 407 |
+
}
|
| 408 |
+
}
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
public async component_server(
|
| 412 |
+
component_id: number,
|
| 413 |
+
fn_name: string,
|
| 414 |
+
data: unknown[] | { binary: boolean; data: Record<string, any> }
|
| 415 |
+
): Promise<unknown> {
|
| 416 |
+
if (!this.config) {
|
| 417 |
+
throw new Error(CONFIG_ERROR_MSG);
|
| 418 |
+
}
|
| 419 |
+
|
| 420 |
+
const headers: {
|
| 421 |
+
Authorization?: string;
|
| 422 |
+
"Content-Type"?: "application/json";
|
| 423 |
+
} = {};
|
| 424 |
+
|
| 425 |
+
const { token } = this.options;
|
| 426 |
+
const { session_hash } = this;
|
| 427 |
+
|
| 428 |
+
if (token) {
|
| 429 |
+
headers.Authorization = `Bearer ${this.options.token}`;
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
let root_url: string;
|
| 433 |
+
let component = this.config.components.find(
|
| 434 |
+
(comp) => comp.id === component_id
|
| 435 |
+
);
|
| 436 |
+
if (component?.props?.root_url) {
|
| 437 |
+
root_url = component.props.root_url;
|
| 438 |
+
} else {
|
| 439 |
+
root_url = this.config.root;
|
| 440 |
+
}
|
| 441 |
+
|
| 442 |
+
let body: FormData | string;
|
| 443 |
+
|
| 444 |
+
if ("binary" in data) {
|
| 445 |
+
body = new FormData();
|
| 446 |
+
for (const key in data.data) {
|
| 447 |
+
if (key === "binary") continue;
|
| 448 |
+
body.append(key, data.data[key]);
|
| 449 |
+
}
|
| 450 |
+
body.set("component_id", component_id.toString());
|
| 451 |
+
body.set("fn_name", fn_name);
|
| 452 |
+
body.set("session_hash", session_hash);
|
| 453 |
+
} else {
|
| 454 |
+
body = JSON.stringify({
|
| 455 |
+
data: data,
|
| 456 |
+
component_id,
|
| 457 |
+
fn_name,
|
| 458 |
+
session_hash
|
| 459 |
+
});
|
| 460 |
+
|
| 461 |
+
headers["Content-Type"] = "application/json";
|
| 462 |
+
}
|
| 463 |
+
|
| 464 |
+
if (token) {
|
| 465 |
+
headers.Authorization = `Bearer ${token}`;
|
| 466 |
+
}
|
| 467 |
+
|
| 468 |
+
try {
|
| 469 |
+
const response = await this.fetch(
|
| 470 |
+
`${root_url}${this.api_prefix}/${COMPONENT_SERVER_URL}/`,
|
| 471 |
+
{
|
| 472 |
+
method: "POST",
|
| 473 |
+
body: body,
|
| 474 |
+
headers,
|
| 475 |
+
credentials: "include"
|
| 476 |
+
}
|
| 477 |
+
);
|
| 478 |
+
|
| 479 |
+
if (!response.ok) {
|
| 480 |
+
throw new Error(
|
| 481 |
+
"Could not connect to component server: " + response.statusText
|
| 482 |
+
);
|
| 483 |
+
}
|
| 484 |
+
|
| 485 |
+
const output = await response.json();
|
| 486 |
+
return output;
|
| 487 |
+
} catch (e) {
|
| 488 |
+
console.warn(e);
|
| 489 |
+
}
|
| 490 |
+
}
|
| 491 |
+
|
| 492 |
+
public set_cookies(raw_cookies: string): void {
|
| 493 |
+
this.cookies = parse_and_set_cookies(raw_cookies).join("; ");
|
| 494 |
+
}
|
| 495 |
+
|
| 496 |
+
private prepare_return_obj(): client_return {
|
| 497 |
+
return {
|
| 498 |
+
config: this.config,
|
| 499 |
+
predict: this.predict,
|
| 500 |
+
submit: this.submit,
|
| 501 |
+
view_api: this.view_api,
|
| 502 |
+
component_server: this.component_server
|
| 503 |
+
};
|
| 504 |
+
}
|
| 505 |
+
}
|
| 506 |
+
|
| 507 |
+
/**
|
| 508 |
+
* @deprecated This method will be removed in v1.0. Use `Client.connect()` instead.
|
| 509 |
+
* Creates a client instance for interacting with Gradio apps.
|
| 510 |
+
*
|
| 511 |
+
* @param {string} app_reference - The reference or URL to a Gradio space or app.
|
| 512 |
+
* @param {ClientOptions} options - Configuration options for the client.
|
| 513 |
+
* @returns {Promise<Client>} A promise that resolves to a `Client` instance.
|
| 514 |
+
*/
|
| 515 |
+
export async function client(
|
| 516 |
+
app_reference: string,
|
| 517 |
+
options: ClientOptions = {
|
| 518 |
+
events: ["data"]
|
| 519 |
+
}
|
| 520 |
+
): Promise<Client> {
|
| 521 |
+
return await Client.connect(app_reference, options);
|
| 522 |
+
}
|
| 523 |
+
|
| 524 |
+
/**
|
| 525 |
+
* @deprecated This method will be removed in v1.0. Use `Client.duplicate()` instead.
|
| 526 |
+
* Creates a duplicate of a space and returns a client instance for the duplicated space.
|
| 527 |
+
*
|
| 528 |
+
* @param {string} app_reference - The reference or URL to a Gradio space or app to duplicate.
|
| 529 |
+
* @param {DuplicateOptions} options - Configuration options for the client.
|
| 530 |
+
* @returns {Promise<Client>} A promise that resolves to a `Client` instance.
|
| 531 |
+
*/
|
| 532 |
+
export async function duplicate_space(
|
| 533 |
+
app_reference: string,
|
| 534 |
+
options: DuplicateOptions
|
| 535 |
+
): Promise<Client> {
|
| 536 |
+
return await Client.duplicate(app_reference, options);
|
| 537 |
+
}
|
| 538 |
+
|
| 539 |
+
export type ClientInstance = Client;
|
6.1.1/client/src/constants.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// endpoints
|
| 2 |
+
export const HOST_URL = `host`;
|
| 3 |
+
export const API_URL = `predict/`;
|
| 4 |
+
export const SSE_URL_V0 = `queue/join`;
|
| 5 |
+
export const SSE_DATA_URL_V0 = `queue/data`;
|
| 6 |
+
export const SSE_URL = `queue/data`;
|
| 7 |
+
export const SSE_DATA_URL = `queue/join`;
|
| 8 |
+
export const UPLOAD_URL = `upload`;
|
| 9 |
+
export const LOGIN_URL = `login`;
|
| 10 |
+
export const CONFIG_URL = `config`;
|
| 11 |
+
export const API_INFO_URL = `info`;
|
| 12 |
+
export const RUNTIME_URL = `runtime`;
|
| 13 |
+
export const SLEEPTIME_URL = `sleeptime`;
|
| 14 |
+
export const HEARTBEAT_URL = `heartbeat`;
|
| 15 |
+
export const COMPONENT_SERVER_URL = `component_server`;
|
| 16 |
+
export const RESET_URL = `reset`;
|
| 17 |
+
export const CANCEL_URL = `cancel`;
|
| 18 |
+
export const APP_ID_URL = `app_id`;
|
| 19 |
+
|
| 20 |
+
export const RAW_API_INFO_URL = `info?serialize=False`;
|
| 21 |
+
export const SPACE_FETCHER_URL =
|
| 22 |
+
"https://gradio-space-api-fetcher-v2.hf.space/api";
|
| 23 |
+
export const SPACE_URL = "https://hf.space/{}";
|
| 24 |
+
|
| 25 |
+
// messages
|
| 26 |
+
export const QUEUE_FULL_MSG =
|
| 27 |
+
"This application is currently busy. Please try again. ";
|
| 28 |
+
export const BROKEN_CONNECTION_MSG = "Connection errored out. ";
|
| 29 |
+
export const CONFIG_ERROR_MSG = "Could not resolve app config. ";
|
| 30 |
+
export const SPACE_STATUS_ERROR_MSG = "Could not get space status. ";
|
| 31 |
+
export const API_INFO_ERROR_MSG = "Could not get API info. ";
|
| 32 |
+
export const SPACE_METADATA_ERROR_MSG = "Space metadata could not be loaded. ";
|
| 33 |
+
export const INVALID_URL_MSG = "Invalid URL. A full URL path is required.";
|
| 34 |
+
export const UNAUTHORIZED_MSG = "Not authorized to access this space. ";
|
| 35 |
+
export const INVALID_CREDENTIALS_MSG = "Invalid credentials. Could not login. ";
|
| 36 |
+
export const MISSING_CREDENTIALS_MSG =
|
| 37 |
+
"Login credentials are required to access this space.";
|
| 38 |
+
export const NODEJS_FS_ERROR_MSG =
|
| 39 |
+
"File system access is only available in Node.js environments";
|
| 40 |
+
export const ROOT_URL_ERROR_MSG = "Root URL not found in client config";
|
| 41 |
+
export const FILE_PROCESSING_ERROR_MSG = "Error uploading file";
|
6.1.1/client/src/globals.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { ApiData, ApiInfo, Config } from "./types";
|
| 2 |
+
|
| 3 |
+
declare global {
|
| 4 |
+
interface Window {
|
| 5 |
+
__gradio_mode__: "app" | "website";
|
| 6 |
+
gradio_config: Config;
|
| 7 |
+
gradio_api_info: ApiInfo<ApiData> | { api: ApiInfo<ApiData> };
|
| 8 |
+
__is_colab__: boolean;
|
| 9 |
+
__gradio_space__: string | null;
|
| 10 |
+
supports_zerogpu_headers?: boolean;
|
| 11 |
+
}
|
| 12 |
+
}
|
6.1.1/client/src/helpers/api_info.ts
ADDED
|
@@ -0,0 +1,477 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {
|
| 2 |
+
HOST_URL,
|
| 3 |
+
INVALID_URL_MSG,
|
| 4 |
+
QUEUE_FULL_MSG,
|
| 5 |
+
SPACE_METADATA_ERROR_MSG
|
| 6 |
+
} from "../constants";
|
| 7 |
+
import type {
|
| 8 |
+
ApiData,
|
| 9 |
+
ApiInfo,
|
| 10 |
+
Config,
|
| 11 |
+
JsApiData,
|
| 12 |
+
EndpointInfo,
|
| 13 |
+
Status
|
| 14 |
+
} from "../types";
|
| 15 |
+
import { determine_protocol } from "./init_helpers";
|
| 16 |
+
|
| 17 |
+
export const RE_SPACE_NAME = /^[a-zA-Z0-9_\-\.]+\/[a-zA-Z0-9_\-\.]+$/;
|
| 18 |
+
export const RE_SPACE_DOMAIN = /.*hf\.space\/{0,1}.*$/;
|
| 19 |
+
|
| 20 |
+
export async function process_endpoint(
|
| 21 |
+
app_reference: string,
|
| 22 |
+
token?: `hf_${string}`
|
| 23 |
+
): Promise<{
|
| 24 |
+
space_id: string | false;
|
| 25 |
+
host: string;
|
| 26 |
+
ws_protocol: "ws" | "wss";
|
| 27 |
+
http_protocol: "http:" | "https:";
|
| 28 |
+
}> {
|
| 29 |
+
const headers: { Authorization?: string } = {};
|
| 30 |
+
if (token) {
|
| 31 |
+
headers.Authorization = `Bearer ${token}`;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
const _app_reference = app_reference.trim().replace(/\/$/, "");
|
| 35 |
+
|
| 36 |
+
if (RE_SPACE_NAME.test(_app_reference)) {
|
| 37 |
+
// app_reference is a HF space name
|
| 38 |
+
try {
|
| 39 |
+
const res = await fetch(
|
| 40 |
+
`https://huggingface.co/api/spaces/${_app_reference}/${HOST_URL}`,
|
| 41 |
+
{ headers }
|
| 42 |
+
);
|
| 43 |
+
|
| 44 |
+
const _host = (await res.json()).host;
|
| 45 |
+
|
| 46 |
+
return {
|
| 47 |
+
space_id: app_reference,
|
| 48 |
+
...determine_protocol(_host)
|
| 49 |
+
};
|
| 50 |
+
} catch (e) {
|
| 51 |
+
throw new Error(SPACE_METADATA_ERROR_MSG);
|
| 52 |
+
}
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
if (RE_SPACE_DOMAIN.test(_app_reference)) {
|
| 56 |
+
// app_reference is a direct HF space domain
|
| 57 |
+
const { ws_protocol, http_protocol, host } =
|
| 58 |
+
determine_protocol(_app_reference);
|
| 59 |
+
|
| 60 |
+
return {
|
| 61 |
+
space_id: host.split("/")[0].replace(".hf.space", ""),
|
| 62 |
+
ws_protocol,
|
| 63 |
+
http_protocol,
|
| 64 |
+
host
|
| 65 |
+
};
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
return {
|
| 69 |
+
space_id: false,
|
| 70 |
+
...determine_protocol(_app_reference)
|
| 71 |
+
};
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
export const join_urls = (...urls: string[]): string => {
|
| 75 |
+
try {
|
| 76 |
+
return urls.reduce((base_url: string, part: string) => {
|
| 77 |
+
base_url = base_url.replace(/\/+$/, "");
|
| 78 |
+
part = part.replace(/^\/+/, "");
|
| 79 |
+
return new URL(part, base_url + "/").toString();
|
| 80 |
+
});
|
| 81 |
+
} catch (e) {
|
| 82 |
+
throw new Error(INVALID_URL_MSG);
|
| 83 |
+
}
|
| 84 |
+
};
|
| 85 |
+
|
| 86 |
+
export function transform_api_info(
|
| 87 |
+
api_info: ApiInfo<ApiData>,
|
| 88 |
+
config: Config,
|
| 89 |
+
api_map: Record<string, number>
|
| 90 |
+
): ApiInfo<JsApiData> {
|
| 91 |
+
const transformed_info: ApiInfo<JsApiData> = {
|
| 92 |
+
named_endpoints: {},
|
| 93 |
+
unnamed_endpoints: {}
|
| 94 |
+
};
|
| 95 |
+
|
| 96 |
+
Object.keys(api_info).forEach((category) => {
|
| 97 |
+
if (category === "named_endpoints" || category === "unnamed_endpoints") {
|
| 98 |
+
transformed_info[category] = {};
|
| 99 |
+
|
| 100 |
+
Object.entries(api_info[category]).forEach(
|
| 101 |
+
([endpoint, { parameters, returns }]) => {
|
| 102 |
+
const dependencyIndex =
|
| 103 |
+
config.dependencies.find(
|
| 104 |
+
(dep) =>
|
| 105 |
+
dep.api_name === endpoint ||
|
| 106 |
+
dep.api_name === endpoint.replace("/", "")
|
| 107 |
+
)?.id ||
|
| 108 |
+
api_map[endpoint.replace("/", "")] ||
|
| 109 |
+
-1;
|
| 110 |
+
|
| 111 |
+
const dependencyTypes =
|
| 112 |
+
dependencyIndex !== -1
|
| 113 |
+
? config.dependencies.find((dep) => dep.id == dependencyIndex)
|
| 114 |
+
?.types
|
| 115 |
+
: { generator: false, cancel: false };
|
| 116 |
+
|
| 117 |
+
if (
|
| 118 |
+
dependencyIndex !== -1 &&
|
| 119 |
+
config.dependencies.find((dep) => dep.id == dependencyIndex)?.inputs
|
| 120 |
+
?.length !== parameters.length
|
| 121 |
+
) {
|
| 122 |
+
const components = config.dependencies
|
| 123 |
+
.find((dep) => dep.id == dependencyIndex)!
|
| 124 |
+
.inputs.map(
|
| 125 |
+
(input) => config.components.find((c) => c.id === input)?.type
|
| 126 |
+
);
|
| 127 |
+
|
| 128 |
+
try {
|
| 129 |
+
components.forEach((comp, idx) => {
|
| 130 |
+
if (comp === "state") {
|
| 131 |
+
const new_param = {
|
| 132 |
+
component: "state",
|
| 133 |
+
example: null,
|
| 134 |
+
parameter_default: null,
|
| 135 |
+
parameter_has_default: true,
|
| 136 |
+
parameter_name: null,
|
| 137 |
+
hidden: true
|
| 138 |
+
};
|
| 139 |
+
|
| 140 |
+
// @ts-ignore
|
| 141 |
+
parameters.splice(idx, 0, new_param);
|
| 142 |
+
}
|
| 143 |
+
});
|
| 144 |
+
} catch (e) {
|
| 145 |
+
console.error(e);
|
| 146 |
+
}
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
const transform_type = (
|
| 150 |
+
data: ApiData,
|
| 151 |
+
component: string,
|
| 152 |
+
serializer: string,
|
| 153 |
+
signature_type: "return" | "parameter"
|
| 154 |
+
): JsApiData => ({
|
| 155 |
+
...data,
|
| 156 |
+
description: get_description(data?.type, serializer),
|
| 157 |
+
type:
|
| 158 |
+
get_type(data?.type, component, serializer, signature_type) || ""
|
| 159 |
+
});
|
| 160 |
+
|
| 161 |
+
transformed_info[category][endpoint] = {
|
| 162 |
+
parameters: parameters.map((p: ApiData) =>
|
| 163 |
+
transform_type(p, p?.component, p?.serializer, "parameter")
|
| 164 |
+
),
|
| 165 |
+
returns: returns.map((r: ApiData) =>
|
| 166 |
+
transform_type(r, r?.component, r?.serializer, "return")
|
| 167 |
+
),
|
| 168 |
+
type: dependencyTypes
|
| 169 |
+
};
|
| 170 |
+
}
|
| 171 |
+
);
|
| 172 |
+
}
|
| 173 |
+
});
|
| 174 |
+
|
| 175 |
+
return transformed_info;
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
export function get_type(
|
| 179 |
+
type: { type: any; description: string },
|
| 180 |
+
component: string,
|
| 181 |
+
serializer: string,
|
| 182 |
+
signature_type: "return" | "parameter"
|
| 183 |
+
): string | undefined {
|
| 184 |
+
if (component === "Api") return type.type;
|
| 185 |
+
switch (type?.type) {
|
| 186 |
+
case "string":
|
| 187 |
+
return "string";
|
| 188 |
+
case "boolean":
|
| 189 |
+
return "boolean";
|
| 190 |
+
case "number":
|
| 191 |
+
return "number";
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
if (
|
| 195 |
+
serializer === "JSONSerializable" ||
|
| 196 |
+
serializer === "StringSerializable"
|
| 197 |
+
) {
|
| 198 |
+
return "any";
|
| 199 |
+
} else if (serializer === "ListStringSerializable") {
|
| 200 |
+
return "string[]";
|
| 201 |
+
} else if (component === "Image") {
|
| 202 |
+
return signature_type === "parameter" ? "Blob | File | Buffer" : "string";
|
| 203 |
+
} else if (serializer === "FileSerializable") {
|
| 204 |
+
if (type?.type === "array") {
|
| 205 |
+
return signature_type === "parameter"
|
| 206 |
+
? "(Blob | File | Buffer)[]"
|
| 207 |
+
: `{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}[]`;
|
| 208 |
+
}
|
| 209 |
+
return signature_type === "parameter"
|
| 210 |
+
? "Blob | File | Buffer"
|
| 211 |
+
: `{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}`;
|
| 212 |
+
} else if (serializer === "GallerySerializable") {
|
| 213 |
+
return signature_type === "parameter"
|
| 214 |
+
? "[(Blob | File | Buffer), (string | null)][]"
|
| 215 |
+
: `[{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}, (string | null))][]`;
|
| 216 |
+
}
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
export function get_description(
|
| 220 |
+
type: { type: any; description: string },
|
| 221 |
+
serializer: string
|
| 222 |
+
): string {
|
| 223 |
+
if (serializer === "GallerySerializable") {
|
| 224 |
+
return "array of [file, label] tuples";
|
| 225 |
+
} else if (serializer === "ListStringSerializable") {
|
| 226 |
+
return "array of strings";
|
| 227 |
+
} else if (serializer === "FileSerializable") {
|
| 228 |
+
return "array of files or single file";
|
| 229 |
+
}
|
| 230 |
+
return type?.description;
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
/* eslint-disable complexity */
|
| 234 |
+
export function handle_message(
|
| 235 |
+
data: any,
|
| 236 |
+
last_status: Status["stage"]
|
| 237 |
+
): {
|
| 238 |
+
type:
|
| 239 |
+
| "hash"
|
| 240 |
+
| "data"
|
| 241 |
+
| "update"
|
| 242 |
+
| "complete"
|
| 243 |
+
| "generating"
|
| 244 |
+
| "log"
|
| 245 |
+
| "none"
|
| 246 |
+
| "heartbeat"
|
| 247 |
+
| "streaming"
|
| 248 |
+
| "broken_connection"
|
| 249 |
+
| "unexpected_error";
|
| 250 |
+
data?: any;
|
| 251 |
+
status?: Status;
|
| 252 |
+
original_msg?: string;
|
| 253 |
+
} {
|
| 254 |
+
const queue = true;
|
| 255 |
+
switch (data.msg) {
|
| 256 |
+
case "send_data":
|
| 257 |
+
return { type: "data" };
|
| 258 |
+
case "send_hash":
|
| 259 |
+
return { type: "hash" };
|
| 260 |
+
case "queue_full":
|
| 261 |
+
return {
|
| 262 |
+
type: "update",
|
| 263 |
+
status: {
|
| 264 |
+
queue,
|
| 265 |
+
message: QUEUE_FULL_MSG,
|
| 266 |
+
stage: "error",
|
| 267 |
+
code: data.code,
|
| 268 |
+
success: data.success
|
| 269 |
+
}
|
| 270 |
+
};
|
| 271 |
+
case "heartbeat":
|
| 272 |
+
return {
|
| 273 |
+
type: "heartbeat"
|
| 274 |
+
};
|
| 275 |
+
case "unexpected_error":
|
| 276 |
+
return {
|
| 277 |
+
type: "unexpected_error",
|
| 278 |
+
status: {
|
| 279 |
+
queue,
|
| 280 |
+
message: data.message,
|
| 281 |
+
session_not_found: data.session_not_found,
|
| 282 |
+
stage: "error",
|
| 283 |
+
success: false
|
| 284 |
+
}
|
| 285 |
+
};
|
| 286 |
+
case "broken_connection":
|
| 287 |
+
return {
|
| 288 |
+
type: "broken_connection",
|
| 289 |
+
status: {
|
| 290 |
+
queue,
|
| 291 |
+
message: data.message,
|
| 292 |
+
stage: "error",
|
| 293 |
+
success: false
|
| 294 |
+
}
|
| 295 |
+
};
|
| 296 |
+
case "estimation":
|
| 297 |
+
return {
|
| 298 |
+
type: "update",
|
| 299 |
+
status: {
|
| 300 |
+
queue,
|
| 301 |
+
stage: last_status || "pending",
|
| 302 |
+
code: data.code,
|
| 303 |
+
size: data.queue_size,
|
| 304 |
+
position: data.rank,
|
| 305 |
+
eta: data.rank_eta,
|
| 306 |
+
success: data.success
|
| 307 |
+
}
|
| 308 |
+
};
|
| 309 |
+
case "progress":
|
| 310 |
+
return {
|
| 311 |
+
type: "update",
|
| 312 |
+
status: {
|
| 313 |
+
queue,
|
| 314 |
+
stage: "pending",
|
| 315 |
+
code: data.code,
|
| 316 |
+
progress_data: data.progress_data,
|
| 317 |
+
success: data.success
|
| 318 |
+
}
|
| 319 |
+
};
|
| 320 |
+
case "log":
|
| 321 |
+
return { type: "log", data: data };
|
| 322 |
+
case "process_generating":
|
| 323 |
+
return {
|
| 324 |
+
type: "generating",
|
| 325 |
+
status: {
|
| 326 |
+
queue,
|
| 327 |
+
message: !data.success ? data.output.error : null,
|
| 328 |
+
stage: data.success ? "generating" : "error",
|
| 329 |
+
code: data.code,
|
| 330 |
+
progress_data: data.progress_data,
|
| 331 |
+
eta: data.average_duration,
|
| 332 |
+
changed_state_ids: data.success
|
| 333 |
+
? data.output.changed_state_ids
|
| 334 |
+
: undefined
|
| 335 |
+
},
|
| 336 |
+
data: data.success ? data.output : null
|
| 337 |
+
};
|
| 338 |
+
case "process_streaming":
|
| 339 |
+
return {
|
| 340 |
+
type: "streaming",
|
| 341 |
+
status: {
|
| 342 |
+
queue,
|
| 343 |
+
message: data.output.error,
|
| 344 |
+
stage: "streaming",
|
| 345 |
+
time_limit: data.time_limit,
|
| 346 |
+
code: data.code,
|
| 347 |
+
progress_data: data.progress_data,
|
| 348 |
+
eta: data.eta
|
| 349 |
+
},
|
| 350 |
+
data: data.output
|
| 351 |
+
};
|
| 352 |
+
case "process_completed":
|
| 353 |
+
if ("error" in data.output) {
|
| 354 |
+
return {
|
| 355 |
+
type: "update",
|
| 356 |
+
status: {
|
| 357 |
+
queue,
|
| 358 |
+
title: (data.output.title as string | null) ?? "Error",
|
| 359 |
+
message:
|
| 360 |
+
(data.output.error as string | null) ?? "An error occurred",
|
| 361 |
+
visible: data.output.visible as boolean,
|
| 362 |
+
duration: data.output.duration as number,
|
| 363 |
+
stage: "error",
|
| 364 |
+
code: data.code,
|
| 365 |
+
success: data.success
|
| 366 |
+
}
|
| 367 |
+
};
|
| 368 |
+
}
|
| 369 |
+
return {
|
| 370 |
+
type: "complete",
|
| 371 |
+
status: {
|
| 372 |
+
queue,
|
| 373 |
+
message: !data.success ? data.output.error : undefined,
|
| 374 |
+
stage: data.success ? "complete" : "error",
|
| 375 |
+
code: data.code,
|
| 376 |
+
progress_data: data.progress_data,
|
| 377 |
+
changed_state_ids: data.success
|
| 378 |
+
? data.output.changed_state_ids
|
| 379 |
+
: undefined
|
| 380 |
+
},
|
| 381 |
+
data: data.success ? data.output : null
|
| 382 |
+
};
|
| 383 |
+
|
| 384 |
+
case "process_starts":
|
| 385 |
+
return {
|
| 386 |
+
type: "update",
|
| 387 |
+
status: {
|
| 388 |
+
queue,
|
| 389 |
+
stage: "pending",
|
| 390 |
+
code: data.code,
|
| 391 |
+
size: data.rank,
|
| 392 |
+
position: 0,
|
| 393 |
+
success: data.success,
|
| 394 |
+
eta: data.eta
|
| 395 |
+
},
|
| 396 |
+
original_msg: "process_starts"
|
| 397 |
+
};
|
| 398 |
+
}
|
| 399 |
+
|
| 400 |
+
return { type: "none", status: { stage: "error", queue } };
|
| 401 |
+
}
|
| 402 |
+
/* eslint-enable complexity */
|
| 403 |
+
|
| 404 |
+
/**
|
| 405 |
+
* Maps the provided `data` to the parameters defined by the `/info` endpoint response.
|
| 406 |
+
* This allows us to support both positional and keyword arguments passed to the client
|
| 407 |
+
* and ensures that all parameters are either directly provided or have default values assigned.
|
| 408 |
+
*
|
| 409 |
+
* @param {unknown[] | Record<string, unknown>} data - The input data for the function,
|
| 410 |
+
* which can be either an array of values for positional arguments or an object
|
| 411 |
+
* with key-value pairs for keyword arguments.
|
| 412 |
+
* @param {JsApiData[]} parameters - Array of parameter descriptions retrieved from the
|
| 413 |
+
* `/info` endpoint.
|
| 414 |
+
*
|
| 415 |
+
* @returns {unknown[]} - Returns an array of resolved data where each element corresponds
|
| 416 |
+
* to the expected parameter from the API. The `parameter_default` value is used where
|
| 417 |
+
* a value is not provided for a parameter, and optional parameters without defaults are
|
| 418 |
+
* set to `undefined`.
|
| 419 |
+
*
|
| 420 |
+
* @throws {Error} - Throws an error:
|
| 421 |
+
* - If more arguments are provided than are defined in the parameters.
|
| 422 |
+
* * - If no parameter value is provided for a required parameter and no default value is defined.
|
| 423 |
+
* - If an argument is provided that does not match any defined parameter.
|
| 424 |
+
*/
|
| 425 |
+
|
| 426 |
+
export const map_data_to_params = (
|
| 427 |
+
data: unknown[] | Record<string, unknown> = [],
|
| 428 |
+
endpoint_info: EndpointInfo<JsApiData | ApiData>
|
| 429 |
+
): unknown[] => {
|
| 430 |
+
// Workaround for the case where the endpoint_info is undefined
|
| 431 |
+
// See https://github.com/gradio-app/gradio/pull/8820#issuecomment-2237381761
|
| 432 |
+
const parameters = endpoint_info ? endpoint_info.parameters : [];
|
| 433 |
+
|
| 434 |
+
if (Array.isArray(data)) {
|
| 435 |
+
if (
|
| 436 |
+
endpoint_info &&
|
| 437 |
+
parameters.length > 0 &&
|
| 438 |
+
data.length > parameters.length
|
| 439 |
+
) {
|
| 440 |
+
console.warn("Too many arguments provided for the endpoint.");
|
| 441 |
+
}
|
| 442 |
+
return data;
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
const resolved_data: unknown[] = [];
|
| 446 |
+
const provided_keys = Object.keys(data);
|
| 447 |
+
|
| 448 |
+
parameters.forEach((param, index) => {
|
| 449 |
+
if (data.hasOwnProperty(param.parameter_name)) {
|
| 450 |
+
resolved_data[index] = data[param.parameter_name];
|
| 451 |
+
} else if (param.parameter_has_default) {
|
| 452 |
+
resolved_data[index] = param.parameter_default;
|
| 453 |
+
} else {
|
| 454 |
+
throw new Error(
|
| 455 |
+
`No value provided for required parameter: ${param.parameter_name}`
|
| 456 |
+
);
|
| 457 |
+
}
|
| 458 |
+
});
|
| 459 |
+
|
| 460 |
+
provided_keys.forEach((key) => {
|
| 461 |
+
if (!parameters.some((param) => param.parameter_name === key)) {
|
| 462 |
+
throw new Error(
|
| 463 |
+
`Parameter \`${key}\` is not a valid keyword argument. Please refer to the API for usage.`
|
| 464 |
+
);
|
| 465 |
+
}
|
| 466 |
+
});
|
| 467 |
+
|
| 468 |
+
resolved_data.forEach((value, idx) => {
|
| 469 |
+
if (value === undefined && !parameters[idx].parameter_has_default) {
|
| 470 |
+
throw new Error(
|
| 471 |
+
`No value provided for required parameter: ${parameters[idx].parame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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {
|
| 2 |
+
type ApiData,
|
| 3 |
+
type BlobRef,
|
| 4 |
+
type Config,
|
| 5 |
+
type EndpointInfo,
|
| 6 |
+
type JsApiData,
|
| 7 |
+
type DataType,
|
| 8 |
+
Command,
|
| 9 |
+
type Dependency,
|
| 10 |
+
type ComponentMeta
|
| 11 |
+
} from "../types";
|
| 12 |
+
import { FileData } from "../upload";
|
| 13 |
+
|
| 14 |
+
const is_node =
|
| 15 |
+
typeof process !== "undefined" && process.versions && process.versions.node;
|
| 16 |
+
|
| 17 |
+
export function update_object(
|
| 18 |
+
object: { [x: string]: any },
|
| 19 |
+
newValue: any,
|
| 20 |
+
stack: (string | number)[]
|
| 21 |
+
): void {
|
| 22 |
+
while (stack.length > 1) {
|
| 23 |
+
const key = stack.shift();
|
| 24 |
+
if (typeof key === "string" || typeof key === "number") {
|
| 25 |
+
object = object[key];
|
| 26 |
+
} else {
|
| 27 |
+
throw new Error("Invalid key type");
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
const key = stack.shift();
|
| 32 |
+
if (typeof key === "string" || typeof key === "number") {
|
| 33 |
+
object[key] = newValue;
|
| 34 |
+
} else {
|
| 35 |
+
throw new Error("Invalid key type");
|
| 36 |
+
}
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
export async function walk_and_store_blobs(
|
| 40 |
+
data: DataType,
|
| 41 |
+
type: string | undefined = undefined,
|
| 42 |
+
path: string[] = [],
|
| 43 |
+
root = false,
|
| 44 |
+
endpoint_info: EndpointInfo<ApiData | JsApiData> | undefined = undefined
|
| 45 |
+
): Promise<BlobRef[]> {
|
| 46 |
+
if (Array.isArray(data)) {
|
| 47 |
+
let blob_refs: BlobRef[] = [];
|
| 48 |
+
|
| 49 |
+
await Promise.all(
|
| 50 |
+
data.map(async (_, index) => {
|
| 51 |
+
let new_path = path.slice();
|
| 52 |
+
new_path.push(String(index));
|
| 53 |
+
|
| 54 |
+
const array_refs = await walk_and_store_blobs(
|
| 55 |
+
data[index],
|
| 56 |
+
root
|
| 57 |
+
? endpoint_info?.parameters[index]?.component || undefined
|
| 58 |
+
: type,
|
| 59 |
+
new_path,
|
| 60 |
+
false,
|
| 61 |
+
endpoint_info
|
| 62 |
+
);
|
| 63 |
+
|
| 64 |
+
blob_refs = blob_refs.concat(array_refs);
|
| 65 |
+
})
|
| 66 |
+
);
|
| 67 |
+
|
| 68 |
+
return blob_refs;
|
| 69 |
+
} else if (
|
| 70 |
+
(globalThis.Buffer && data instanceof globalThis.Buffer) ||
|
| 71 |
+
data instanceof Blob
|
| 72 |
+
) {
|
| 73 |
+
return [
|
| 74 |
+
{
|
| 75 |
+
path: path,
|
| 76 |
+
blob: new Blob([data as any]),
|
| 77 |
+
type
|
| 78 |
+
}
|
| 79 |
+
];
|
| 80 |
+
} else if (typeof data === "object" && data !== null) {
|
| 81 |
+
let blob_refs: BlobRef[] = [];
|
| 82 |
+
for (const key of Object.keys(data) as (keyof typeof data)[]) {
|
| 83 |
+
const new_path = [...path, key];
|
| 84 |
+
const value = data[key];
|
| 85 |
+
|
| 86 |
+
blob_refs = blob_refs.concat(
|
| 87 |
+
await walk_and_store_blobs(
|
| 88 |
+
value,
|
| 89 |
+
undefined,
|
| 90 |
+
new_path,
|
| 91 |
+
false,
|
| 92 |
+
endpoint_info
|
| 93 |
+
)
|
| 94 |
+
);
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
return blob_refs;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
return [];
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
export function skip_queue(id: number, config: Config): boolean {
|
| 104 |
+
let fn_queue = config?.dependencies?.find((dep) => dep.id == id)?.queue;
|
| 105 |
+
if (fn_queue != null) {
|
| 106 |
+
return !fn_queue;
|
| 107 |
+
}
|
| 108 |
+
return !config.enable_queue;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
// todo: add jsdoc for this function
|
| 112 |
+
|
| 113 |
+
export function post_message<Res = any>(
|
| 114 |
+
message: any,
|
| 115 |
+
origin: string
|
| 116 |
+
): Promise<Res> {
|
| 117 |
+
return new Promise((res, _rej) => {
|
| 118 |
+
const channel = new MessageChannel();
|
| 119 |
+
channel.port1.onmessage = (({ data }) => {
|
| 120 |
+
channel.port1.close();
|
| 121 |
+
res(data);
|
| 122 |
+
}) as (ev: MessageEvent<Res>) => void;
|
| 123 |
+
window.parent.postMessage(message, origin, [channel.port2]);
|
| 124 |
+
});
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
export function handle_file(
|
| 128 |
+
file_or_url: File | string | Blob | Buffer
|
| 129 |
+
): FileData | Blob | Command {
|
| 130 |
+
if (typeof file_or_url === "string") {
|
| 131 |
+
if (
|
| 132 |
+
file_or_url.startsWith("http://") ||
|
| 133 |
+
file_or_url.startsWith("https://")
|
| 134 |
+
) {
|
| 135 |
+
return {
|
| 136 |
+
path: file_or_url,
|
| 137 |
+
url: file_or_url,
|
| 138 |
+
orig_name: file_or_url.split("/").pop() ?? "unknown",
|
| 139 |
+
meta: { _type: "gradio.FileData" }
|
| 140 |
+
};
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
if (is_node) {
|
| 144 |
+
// Handle local file paths
|
| 145 |
+
return new Command("upload_file", {
|
| 146 |
+
path: file_or_url,
|
| 147 |
+
name: file_or_url,
|
| 148 |
+
orig_path: file_or_url
|
| 149 |
+
});
|
| 150 |
+
}
|
| 151 |
+
} else if (typeof File !== "undefined" && file_or_url instanceof File) {
|
| 152 |
+
return new Blob([file_or_url]);
|
| 153 |
+
} else if (file_or_url instanceof Buffer) {
|
| 154 |
+
return new Blob([file_or_url as any]);
|
| 155 |
+
} else if (file_or_url instanceof Blob) {
|
| 156 |
+
return file_or_url;
|
| 157 |
+
}
|
| 158 |
+
throw new Error(
|
| 159 |
+
"Invalid input: must be a URL, File, Blob, or Buffer object."
|
| 160 |
+
);
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
/**
|
| 164 |
+
* Handles the payload by filtering out state inputs and returning an array of resolved payload values.
|
| 165 |
+
* We send null values for state inputs to the server, but we don't want to include them in the resolved payload.
|
| 166 |
+
*
|
| 167 |
+
* @param resolved_payload - The resolved payload values received from the client or the server
|
| 168 |
+
* @param dependency - The dependency object.
|
| 169 |
+
* @param components - The array of component metadata.
|
| 170 |
+
* @param with_null_state - Optional. Specifies whether to include null values for state inputs. Default is false.
|
| 171 |
+
* @returns An array of resolved payload values, filtered based on the dependency and component metadata.
|
| 172 |
+
*/
|
| 173 |
+
export function handle_payload(
|
| 174 |
+
resolved_payload: unknown[],
|
| 175 |
+
dependency: Dependency,
|
| 176 |
+
components: ComponentMeta[],
|
| 177 |
+
type: "input" | "output",
|
| 178 |
+
with_null_state = false
|
| 179 |
+
): unknown[] {
|
| 180 |
+
if (type === "input" && !with_null_state) {
|
| 181 |
+
throw new Error("Invalid code path. Cannot skip state inputs for input.");
|
| 182 |
+
}
|
| 183 |
+
// data comes from the server with null state values so we skip
|
| 184 |
+
if (type === "output" && with_null_state) {
|
| 185 |
+
return resolved_payload;
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
let updated_payload: unknown[] = [];
|
| 189 |
+
let payload_index = 0;
|
| 190 |
+
const deps = type === "input" ? dependency.inputs : dependency.outputs;
|
| 191 |
+
for (let i = 0; i < deps.length; i++) {
|
| 192 |
+
const input_id = deps[i];
|
| 193 |
+
const component = components.find((c) => c.id === input_id);
|
| 194 |
+
|
| 195 |
+
if (component?.type === "state") {
|
| 196 |
+
// input + with_null_state needs us to fill state with null values
|
| 197 |
+
if (with_null_state) {
|
| 198 |
+
if (resolved_payload.length === deps.length) {
|
| 199 |
+
const value = resolved_payload[payload_index];
|
| 200 |
+
updated_payload.push(value);
|
| 201 |
+
payload_index++;
|
| 202 |
+
} else {
|
| 203 |
+
updated_payload.push(null);
|
| 204 |
+
}
|
| 205 |
+
} else {
|
| 206 |
+
// this is output & !with_null_state, we skip state inputs
|
| 207 |
+
// the server payload always comes with null state values so we move along the payload index
|
| 208 |
+
payload_index++;
|
| 209 |
+
continue;
|
| 210 |
+
}
|
| 211 |
+
// input & !with_null_state isn't a case we care about, server needs null
|
| 212 |
+
continue;
|
| 213 |
+
} else {
|
| 214 |
+
const value = resolved_payload[payload_index];
|
| 215 |
+
updated_payload.push(value);
|
| 216 |
+
payload_index++;
|
| 217 |
+
}
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
return updated_payload;
|
| 221 |
+
}
|
6.1.1/client/src/helpers/init_helpers.ts
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { Config } from "../types";
|
| 2 |
+
import {
|
| 3 |
+
CONFIG_ERROR_MSG,
|
| 4 |
+
CONFIG_URL,
|
| 5 |
+
INVALID_CREDENTIALS_MSG,
|
| 6 |
+
LOGIN_URL,
|
| 7 |
+
MISSING_CREDENTIALS_MSG,
|
| 8 |
+
SPACE_METADATA_ERROR_MSG,
|
| 9 |
+
UNAUTHORIZED_MSG
|
| 10 |
+
} from "../constants";
|
| 11 |
+
import { Client } from "..";
|
| 12 |
+
import { join_urls, process_endpoint } from "./api_info";
|
| 13 |
+
|
| 14 |
+
/**
|
| 15 |
+
* This function is used to resolve the URL for making requests when the app has a root path.
|
| 16 |
+
* The root path could be a path suffix like "/app" which is appended to the end of the base URL. Or
|
| 17 |
+
* it could be a full URL like "https://abidlabs-test-client-replica--gqf2x.hf.space" which is used when hosting
|
| 18 |
+
* Gradio apps on Hugging Face Spaces.
|
| 19 |
+
* @param {string} base_url The base URL at which the Gradio server is hosted
|
| 20 |
+
* @param {string} root_path The root path, which could be a path suffix (e.g. mounted in FastAPI app) or a full URL (e.g. hosted on Hugging Face Spaces)
|
| 21 |
+
* @param {boolean} prioritize_base Whether to prioritize the base URL over the root path. This is used when both the base path and root paths are full URLs. For example, for fetching files the root path should be prioritized, but for making requests, the base URL should be prioritized.
|
| 22 |
+
* @returns {string} the resolved URL
|
| 23 |
+
*/
|
| 24 |
+
export function resolve_root(
|
| 25 |
+
base_url: string,
|
| 26 |
+
root_path: string,
|
| 27 |
+
prioritize_base: boolean
|
| 28 |
+
): string {
|
| 29 |
+
if (root_path.startsWith("http://") || root_path.startsWith("https://")) {
|
| 30 |
+
return prioritize_base ? base_url : root_path;
|
| 31 |
+
}
|
| 32 |
+
return base_url + root_path;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
export async function get_jwt(
|
| 36 |
+
space: string,
|
| 37 |
+
token: `hf_${string}`,
|
| 38 |
+
cookies?: string | null
|
| 39 |
+
): Promise<string | false> {
|
| 40 |
+
try {
|
| 41 |
+
const r = await fetch(`https://huggingface.co/api/spaces/${space}/jwt`, {
|
| 42 |
+
headers: {
|
| 43 |
+
Authorization: `Bearer ${token}`,
|
| 44 |
+
...(cookies ? { Cookie: cookies } : {})
|
| 45 |
+
}
|
| 46 |
+
});
|
| 47 |
+
|
| 48 |
+
const jwt = (await r.json()).token;
|
| 49 |
+
|
| 50 |
+
return jwt || false;
|
| 51 |
+
} catch (e) {
|
| 52 |
+
return false;
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
export function map_names_to_ids(
|
| 57 |
+
fns: Config["dependencies"]
|
| 58 |
+
): Record<string, number> {
|
| 59 |
+
let apis: Record<string, number> = {};
|
| 60 |
+
|
| 61 |
+
fns.forEach(({ api_name, id }) => {
|
| 62 |
+
if (api_name) apis[api_name] = id;
|
| 63 |
+
});
|
| 64 |
+
return apis;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
export async function resolve_config(
|
| 68 |
+
this: Client,
|
| 69 |
+
endpoint: string
|
| 70 |
+
): Promise<Config | undefined> {
|
| 71 |
+
const headers: Record<string, string> = this.options.token
|
| 72 |
+
? { Authorization: `Bearer ${this.options.token}` }
|
| 73 |
+
: {};
|
| 74 |
+
|
| 75 |
+
headers["Content-Type"] = "application/json";
|
| 76 |
+
|
| 77 |
+
if (
|
| 78 |
+
typeof window !== "undefined" &&
|
| 79 |
+
window.gradio_config &&
|
| 80 |
+
location.origin !== "http://localhost:9876"
|
| 81 |
+
) {
|
| 82 |
+
if (window.gradio_config.current_page) {
|
| 83 |
+
endpoint = endpoint.substring(0, endpoint.lastIndexOf("/"));
|
| 84 |
+
}
|
| 85 |
+
if (window.gradio_config.dev_mode) {
|
| 86 |
+
let config_url = join_urls(
|
| 87 |
+
endpoint,
|
| 88 |
+
this.deep_link
|
| 89 |
+
? CONFIG_URL + "?deep_link=" + this.deep_link
|
| 90 |
+
: CONFIG_URL
|
| 91 |
+
);
|
| 92 |
+
const response = await this.fetch(config_url, {
|
| 93 |
+
headers,
|
| 94 |
+
credentials: "include"
|
| 95 |
+
});
|
| 96 |
+
const config = await handleConfigResponse(
|
| 97 |
+
response,
|
| 98 |
+
endpoint,
|
| 99 |
+
!!this.options.auth
|
| 100 |
+
);
|
| 101 |
+
// @ts-ignore
|
| 102 |
+
window.gradio_config = {
|
| 103 |
+
...config,
|
| 104 |
+
current_page: window.gradio_config.current_page
|
| 105 |
+
};
|
| 106 |
+
}
|
| 107 |
+
window.gradio_config.root = endpoint;
|
| 108 |
+
// @ts-ignore
|
| 109 |
+
return { ...window.gradio_config } as Config;
|
| 110 |
+
} else if (endpoint) {
|
| 111 |
+
let config_url = join_urls(
|
| 112 |
+
endpoint,
|
| 113 |
+
this.deep_link ? CONFIG_URL + "?deep_link=" + this.deep_link : CONFIG_URL
|
| 114 |
+
);
|
| 115 |
+
|
| 116 |
+
const response = await this.fetch(config_url, {
|
| 117 |
+
headers,
|
| 118 |
+
credentials: "include"
|
| 119 |
+
});
|
| 120 |
+
|
| 121 |
+
return handleConfigResponse(response, endpoint, !!this.options.auth);
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
throw new Error(CONFIG_ERROR_MSG);
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
async function handleConfigResponse(
|
| 128 |
+
response: Response,
|
| 129 |
+
endpoint: string,
|
| 130 |
+
authorized: boolean
|
| 131 |
+
): Promise<Config> {
|
| 132 |
+
if (response?.status === 401 && !authorized) {
|
| 133 |
+
const error_data = await response.json();
|
| 134 |
+
const auth_message = error_data?.detail?.auth_message;
|
| 135 |
+
throw new Error(auth_message || MISSING_CREDENTIALS_MSG);
|
| 136 |
+
} else if (response?.status === 401 && authorized) {
|
| 137 |
+
throw new Error(INVALID_CREDENTIALS_MSG);
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
if (response?.status === 200) {
|
| 141 |
+
let config = await response.json();
|
| 142 |
+
config.root = endpoint;
|
| 143 |
+
config.dependencies?.forEach((dep: any, i: number) => {
|
| 144 |
+
if (dep.id === undefined) {
|
| 145 |
+
dep.id = i;
|
| 146 |
+
}
|
| 147 |
+
});
|
| 148 |
+
return config;
|
| 149 |
+
} else if (response?.status === 401) {
|
| 150 |
+
throw new Error(UNAUTHORIZED_MSG);
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
throw new Error(CONFIG_ERROR_MSG);
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
export async function resolve_cookies(this: Client): Promise<void> {
|
| 157 |
+
const { http_protocol, host } = await process_endpoint(
|
| 158 |
+
this.app_reference,
|
| 159 |
+
this.options.token
|
| 160 |
+
);
|
| 161 |
+
|
| 162 |
+
try {
|
| 163 |
+
if (this.options.auth) {
|
| 164 |
+
const cookie_header = await get_cookie_header(
|
| 165 |
+
http_protocol,
|
| 166 |
+
host,
|
| 167 |
+
this.options.auth,
|
| 168 |
+
this.fetch,
|
| 169 |
+
this.options.token
|
| 170 |
+
);
|
| 171 |
+
|
| 172 |
+
if (cookie_header) this.set_cookies(cookie_header);
|
| 173 |
+
}
|
| 174 |
+
} catch (e: unknown) {
|
| 175 |
+
throw Error((e as Error).message);
|
| 176 |
+
}
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
// separating this from client-bound resolve_cookies so that it can be used in duplicate
|
| 180 |
+
export async function get_cookie_header(
|
| 181 |
+
http_protocol: string,
|
| 182 |
+
host: string,
|
| 183 |
+
auth: [string, string],
|
| 184 |
+
_fetch: typeof fetch,
|
| 185 |
+
token?: `hf_${string}`
|
| 186 |
+
): Promise<string | null> {
|
| 187 |
+
const formData = new FormData();
|
| 188 |
+
formData.append("username", auth?.[0]);
|
| 189 |
+
formData.append("password", auth?.[1]);
|
| 190 |
+
|
| 191 |
+
let headers: { Authorization?: string } = {};
|
| 192 |
+
|
| 193 |
+
if (token) {
|
| 194 |
+
headers.Authorization = `Bearer ${token}`;
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
const res = await _fetch(`${http_protocol}//${host}/${LOGIN_URL}`, {
|
| 198 |
+
headers,
|
| 199 |
+
method: "POST",
|
| 200 |
+
body: formData,
|
| 201 |
+
credentials: "include"
|
| 202 |
+
});
|
| 203 |
+
|
| 204 |
+
if (res.status === 200) {
|
| 205 |
+
return res.headers.get("set-cookie");
|
| 206 |
+
} else if (res.status === 401) {
|
| 207 |
+
throw new Error(INVALID_CREDENTIALS_MSG);
|
| 208 |
+
} else {
|
| 209 |
+
throw new Error(SPACE_METADATA_ERROR_MSG);
|
| 210 |
+
}
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
export function determine_protocol(endpoint: string): {
|
| 214 |
+
ws_protocol: "ws" | "wss";
|
| 215 |
+
http_protocol: "http:" | "https:";
|
| 216 |
+
host: string;
|
| 217 |
+
} {
|
| 218 |
+
if (endpoint.startsWith("http")) {
|
| 219 |
+
const { protocol, host, pathname } = new URL(endpoint);
|
| 220 |
+
|
| 221 |
+
return {
|
| 222 |
+
ws_protocol: protocol === "https:" ? "wss" : "ws",
|
| 223 |
+
http_protocol: protocol as "http:" | "https:",
|
| 224 |
+
host: host + (pathname !== "/" ? pathname : "")
|
| 225 |
+
};
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
// default to secure if no protocol is provided
|
| 229 |
+
|
| 230 |
+
return {
|
| 231 |
+
ws_protocol: "wss",
|
| 232 |
+
http_protocol: "https:",
|
| 233 |
+
host: new URL(endpoint).host
|
| 234 |
+
};
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
export const parse_and_set_cookies = (cookie_header: string): string[] => {
|
| 238 |
+
let cookies: string[] = [];
|
| 239 |
+
const parts = cookie_header.split(/,(?=\s*[^\s=;]+=[^\s=;]+)/);
|
| 240 |
+
parts.forEach((cookie) => {
|
| 241 |
+
const [cookie_name, cookie_value] = cookie.split(";")[0].split("=");
|
| 242 |
+
if (cookie_name && cookie_value) {
|
| 243 |
+
cookies.push(`${cookie_name.trim()}=${cookie_value.trim()}`);
|
| 244 |
+
}
|
| 245 |
+
});
|
| 246 |
+
return cookies;
|
| 247 |
+
};
|
6.1.1/client/src/helpers/spaces.ts
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {
|
| 2 |
+
RUNTIME_URL,
|
| 3 |
+
SLEEPTIME_URL,
|
| 4 |
+
SPACE_STATUS_ERROR_MSG
|
| 5 |
+
} from "../constants";
|
| 6 |
+
import { RE_SPACE_NAME } from "./api_info";
|
| 7 |
+
import type { SpaceStatusCallback } from "../types";
|
| 8 |
+
|
| 9 |
+
export async function check_space_status(
|
| 10 |
+
id: string,
|
| 11 |
+
type: "subdomain" | "space_name",
|
| 12 |
+
status_callback: SpaceStatusCallback
|
| 13 |
+
): Promise<void> {
|
| 14 |
+
let endpoint =
|
| 15 |
+
type === "subdomain"
|
| 16 |
+
? `https://huggingface.co/api/spaces/by-subdomain/${id}`
|
| 17 |
+
: `https://huggingface.co/api/spaces/${id}`;
|
| 18 |
+
let response;
|
| 19 |
+
let _status;
|
| 20 |
+
try {
|
| 21 |
+
response = await fetch(endpoint);
|
| 22 |
+
_status = response.status;
|
| 23 |
+
if (_status !== 200) {
|
| 24 |
+
throw new Error();
|
| 25 |
+
}
|
| 26 |
+
response = await response.json();
|
| 27 |
+
} catch (e) {
|
| 28 |
+
status_callback({
|
| 29 |
+
status: "error",
|
| 30 |
+
load_status: "error",
|
| 31 |
+
message: SPACE_STATUS_ERROR_MSG,
|
| 32 |
+
detail: "NOT_FOUND"
|
| 33 |
+
});
|
| 34 |
+
return;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
if (!response || _status !== 200) return;
|
| 38 |
+
const {
|
| 39 |
+
runtime: { stage },
|
| 40 |
+
id: space_name
|
| 41 |
+
} = response;
|
| 42 |
+
|
| 43 |
+
switch (stage) {
|
| 44 |
+
case "STOPPED":
|
| 45 |
+
case "SLEEPING":
|
| 46 |
+
status_callback({
|
| 47 |
+
status: "sleeping",
|
| 48 |
+
load_status: "pending",
|
| 49 |
+
message: "Space is asleep. Waking it up...",
|
| 50 |
+
detail: stage
|
| 51 |
+
});
|
| 52 |
+
|
| 53 |
+
setTimeout(() => {
|
| 54 |
+
check_space_status(id, type, status_callback);
|
| 55 |
+
}, 1000); // poll for status
|
| 56 |
+
break;
|
| 57 |
+
case "PAUSED":
|
| 58 |
+
status_callback({
|
| 59 |
+
status: "paused",
|
| 60 |
+
load_status: "error",
|
| 61 |
+
message:
|
| 62 |
+
"This space has been paused by the author. If you would like to try this demo, consider duplicating the space.",
|
| 63 |
+
detail: stage,
|
| 64 |
+
discussions_enabled: await discussions_enabled(space_name)
|
| 65 |
+
});
|
| 66 |
+
break;
|
| 67 |
+
case "RUNNING":
|
| 68 |
+
case "RUNNING_BUILDING":
|
| 69 |
+
status_callback({
|
| 70 |
+
status: "running",
|
| 71 |
+
load_status: "complete",
|
| 72 |
+
message: "Space is running.",
|
| 73 |
+
detail: stage
|
| 74 |
+
});
|
| 75 |
+
break;
|
| 76 |
+
case "BUILDING":
|
| 77 |
+
status_callback({
|
| 78 |
+
status: "building",
|
| 79 |
+
load_status: "pending",
|
| 80 |
+
message: "Space is building...",
|
| 81 |
+
detail: stage
|
| 82 |
+
});
|
| 83 |
+
|
| 84 |
+
setTimeout(() => {
|
| 85 |
+
check_space_status(id, type, status_callback);
|
| 86 |
+
}, 1000);
|
| 87 |
+
break;
|
| 88 |
+
case "APP_STARTING":
|
| 89 |
+
status_callback({
|
| 90 |
+
status: "starting",
|
| 91 |
+
load_status: "pending",
|
| 92 |
+
message: "Space is starting...",
|
| 93 |
+
detail: stage
|
| 94 |
+
});
|
| 95 |
+
|
| 96 |
+
setTimeout(() => {
|
| 97 |
+
check_space_status(id, type, status_callback);
|
| 98 |
+
}, 1000);
|
| 99 |
+
break;
|
| 100 |
+
default:
|
| 101 |
+
status_callback({
|
| 102 |
+
status: "space_error",
|
| 103 |
+
load_status: "error",
|
| 104 |
+
message: "This space is experiencing an issue.",
|
| 105 |
+
detail: stage,
|
| 106 |
+
discussions_enabled: await discussions_enabled(space_name)
|
| 107 |
+
});
|
| 108 |
+
break;
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
export const check_and_wake_space = async (
|
| 113 |
+
space_id: string,
|
| 114 |
+
status_callback: SpaceStatusCallback
|
| 115 |
+
): Promise<void> => {
|
| 116 |
+
let retries = 0;
|
| 117 |
+
const max_retries = 12;
|
| 118 |
+
const check_interval = 5000;
|
| 119 |
+
|
| 120 |
+
return new Promise((resolve) => {
|
| 121 |
+
check_space_status(
|
| 122 |
+
space_id,
|
| 123 |
+
RE_SPACE_NAME.test(space_id) ? "space_name" : "subdomain",
|
| 124 |
+
(status) => {
|
| 125 |
+
status_callback(status);
|
| 126 |
+
|
| 127 |
+
if (status.status === "running") {
|
| 128 |
+
resolve();
|
| 129 |
+
} else if (
|
| 130 |
+
status.status === "error" ||
|
| 131 |
+
status.status === "paused" ||
|
| 132 |
+
status.status === "space_error"
|
| 133 |
+
) {
|
| 134 |
+
resolve();
|
| 135 |
+
} else if (
|
| 136 |
+
status.status === "sleeping" ||
|
| 137 |
+
status.status === "building"
|
| 138 |
+
) {
|
| 139 |
+
if (retries < max_retries) {
|
| 140 |
+
retries++;
|
| 141 |
+
setTimeout(() => {
|
| 142 |
+
check_and_wake_space(space_id, status_callback).then(resolve);
|
| 143 |
+
}, check_interval);
|
| 144 |
+
} else {
|
| 145 |
+
resolve();
|
| 146 |
+
}
|
| 147 |
+
}
|
| 148 |
+
}
|
| 149 |
+
);
|
| 150 |
+
});
|
| 151 |
+
};
|
| 152 |
+
|
| 153 |
+
const RE_DISABLED_DISCUSSION =
|
| 154 |
+
/^(?=[^]*\b[dD]iscussions{0,1}\b)(?=[^]*\b[dD]isabled\b)[^]*$/;
|
| 155 |
+
export async function discussions_enabled(space_id: string): Promise<boolean> {
|
| 156 |
+
try {
|
| 157 |
+
const r = await fetch(
|
| 158 |
+
`https://huggingface.co/api/spaces/${space_id}/discussions`,
|
| 159 |
+
{
|
| 160 |
+
method: "HEAD"
|
| 161 |
+
}
|
| 162 |
+
);
|
| 163 |
+
|
| 164 |
+
const error = r.headers.get("x-error-message");
|
| 165 |
+
|
| 166 |
+
if (!r.ok || (error && RE_DISABLED_DISCUSSION.test(error))) return false;
|
| 167 |
+
return true;
|
| 168 |
+
} catch (e) {
|
| 169 |
+
return false;
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
export async function get_space_hardware(
|
| 174 |
+
space_id: string,
|
| 175 |
+
token?: `hf_${string}` | undefined
|
| 176 |
+
): Promise<(typeof hardware_types)[number]> {
|
| 177 |
+
const headers: { Authorization?: string } = {};
|
| 178 |
+
if (token) {
|
| 179 |
+
headers.Authorization = `Bearer ${token}`;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
try {
|
| 183 |
+
const res = await fetch(
|
| 184 |
+
`https://huggingface.co/api/spaces/${space_id}/${RUNTIME_URL}`,
|
| 185 |
+
{ headers }
|
| 186 |
+
);
|
| 187 |
+
|
| 188 |
+
if (res.status !== 200)
|
| 189 |
+
throw new Error("Space hardware could not be obtained.");
|
| 190 |
+
|
| 191 |
+
const { hardware } = await res.json();
|
| 192 |
+
|
| 193 |
+
return hardware.current;
|
| 194 |
+
} catch (e: any) {
|
| 195 |
+
throw new Error(e.message);
|
| 196 |
+
}
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
export async function set_space_timeout(
|
| 200 |
+
space_id: string,
|
| 201 |
+
timeout: number,
|
| 202 |
+
token?: `hf_${string}`
|
| 203 |
+
): Promise<any> {
|
| 204 |
+
const headers: { Authorization?: string } = {};
|
| 205 |
+
if (token) {
|
| 206 |
+
headers.Authorization = `Bearer ${token}`;
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
const body: {
|
| 210 |
+
seconds?: number;
|
| 211 |
+
} = {
|
| 212 |
+
seconds: timeout
|
| 213 |
+
};
|
| 214 |
+
|
| 215 |
+
try {
|
| 216 |
+
const res = await fetch(
|
| 217 |
+
`https://huggingface.co/api/spaces/${space_id}/${SLEEPTIME_URL}`,
|
| 218 |
+
{
|
| 219 |
+
method: "POST",
|
| 220 |
+
headers: { "Content-Type": "application/json", ...headers },
|
| 221 |
+
body: JSON.stringify(body)
|
| 222 |
+
}
|
| 223 |
+
);
|
| 224 |
+
|
| 225 |
+
if (res.status !== 200) {
|
| 226 |
+
throw new Error(
|
| 227 |
+
"Could not set sleep timeout on duplicated Space. Please visit *ADD HF LINK TO SETTINGS* to set a timeout manually to reduce billing charges."
|
| 228 |
+
);
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
const response = await res.json();
|
| 232 |
+
return response;
|
| 233 |
+
} catch (e: any) {
|
| 234 |
+
throw new Error(e.message);
|
| 235 |
+
}
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
export const hardware_types = [
|
| 239 |
+
"cpu-basic",
|
| 240 |
+
"cpu-upgrade",
|
| 241 |
+
"cpu-xl",
|
| 242 |
+
"t4-small",
|
| 243 |
+
"t4-medium",
|
| 244 |
+
"a10g-small",
|
| 245 |
+
"a10g-large",
|
| 246 |
+
"a10g-largex2",
|
| 247 |
+
"a10g-largex4",
|
| 248 |
+
"a100-large",
|
| 249 |
+
"zero-a10g",
|
| 250 |
+
"h100",
|
| 251 |
+
"h100x8"
|
| 252 |
+
] as const;
|
6.1.1/client/src/index.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export { Client } from "./client";
|
| 2 |
+
|
| 3 |
+
export { predict } from "./utils/predict";
|
| 4 |
+
export { submit } from "./utils/submit";
|
| 5 |
+
export { upload_files } from "./utils/upload_files";
|
| 6 |
+
export { FileData, upload, prepare_files } from "./upload";
|
| 7 |
+
export { handle_file } from "./helpers/data";
|
| 8 |
+
|
| 9 |
+
export type {
|
| 10 |
+
SpaceStatus,
|
| 11 |
+
StatusMessage,
|
| 12 |
+
Status,
|
| 13 |
+
client_return,
|
| 14 |
+
UploadResponse,
|
| 15 |
+
RenderMessage,
|
| 16 |
+
LogMessage,
|
| 17 |
+
Payload,
|
| 18 |
+
Config,
|
| 19 |
+
ValidationError
|
| 20 |
+
} from "./types";
|
| 21 |
+
|
| 22 |
+
export { MISSING_CREDENTIALS_MSG } from "./constants";
|
| 23 |
+
|
| 24 |
+
// todo: remove in @gradio/client v1.0
|
| 25 |
+
export { client } from "./client";
|
| 26 |
+
export { duplicate_space as duplicate } from "./client";
|
6.1.1/client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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { HttpResponse, http, RequestHandler } from "msw";
|
| 2 |
+
import {
|
| 3 |
+
HOST_URL,
|
| 4 |
+
API_INFO_URL,
|
| 5 |
+
CONFIG_URL,
|
| 6 |
+
RUNTIME_URL,
|
| 7 |
+
SLEEPTIME_URL,
|
| 8 |
+
UPLOAD_URL,
|
| 9 |
+
BROKEN_CONNECTION_MSG,
|
| 10 |
+
LOGIN_URL
|
| 11 |
+
} from "../constants";
|
| 12 |
+
import {
|
| 13 |
+
response_api_info,
|
| 14 |
+
config_response,
|
| 15 |
+
whoami_response,
|
| 16 |
+
duplicate_response,
|
| 17 |
+
hardware_sleeptime_response,
|
| 18 |
+
discussions_response,
|
| 19 |
+
runtime_response
|
| 20 |
+
} from "./test_data";
|
| 21 |
+
|
| 22 |
+
const root_url = "https://huggingface.co";
|
| 23 |
+
|
| 24 |
+
export const direct_space_url = "https://hmb-hello-world.hf.space";
|
| 25 |
+
const private_space_url = "https://hmb-secret-world.hf.space";
|
| 26 |
+
const private_auth_space_url = "https://hmb-private-auth-space.hf.space";
|
| 27 |
+
|
| 28 |
+
const server_error_space_url = "https://hmb-server-error.hf.space";
|
| 29 |
+
const upload_server_test_space_url = "https://hmb-server-test.hf.space";
|
| 30 |
+
const auth_app_space_url = "https://hmb-auth-space.hf.space";
|
| 31 |
+
const unauth_app_space_url = "https://hmb-unauth-space.hf.space";
|
| 32 |
+
const invalid_auth_space_url = "https://hmb-invalid-auth-space.hf.space";
|
| 33 |
+
|
| 34 |
+
const server_error_reference = "hmb/server_error";
|
| 35 |
+
const app_reference = "hmb/hello_world";
|
| 36 |
+
const broken_app_reference = "hmb/bye_world";
|
| 37 |
+
const duplicate_app_reference = "gradio/hello_world";
|
| 38 |
+
const private_app_reference = "hmb/secret_world";
|
| 39 |
+
const server_test_app_reference = "hmb/server_test";
|
| 40 |
+
const auth_app_reference = "hmb/auth_space";
|
| 41 |
+
const unauth_app_reference = "hmb/unauth_space";
|
| 42 |
+
const invalid_auth_app_reference = "hmb/invalid_auth_space";
|
| 43 |
+
const private_auth_app_reference = "hmb/private_auth_space";
|
| 44 |
+
|
| 45 |
+
export const handlers: RequestHandler[] = [
|
| 46 |
+
// /host requests
|
| 47 |
+
http.get(`${root_url}/api/spaces/${app_reference}/${HOST_URL}`, () => {
|
| 48 |
+
return new HttpResponse(
|
| 49 |
+
JSON.stringify({
|
| 50 |
+
subdomain: "hmb-hello-world",
|
| 51 |
+
host: "https://hmb-hello-world.hf.space"
|
| 52 |
+
}),
|
| 53 |
+
{
|
| 54 |
+
status: 200,
|
| 55 |
+
headers: {
|
| 56 |
+
"Content-Type": "application/json"
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
);
|
| 60 |
+
}),
|
| 61 |
+
http.get(`${root_url}/api/spaces/${broken_app_reference}/${HOST_URL}`, () => {
|
| 62 |
+
return new HttpResponse(null, {
|
| 63 |
+
status: 404,
|
| 64 |
+
headers: {
|
| 65 |
+
"Content-Type": "application/json",
|
| 66 |
+
hf_token: "hf_123"
|
| 67 |
+
}
|
| 68 |
+
});
|
| 69 |
+
}),
|
| 70 |
+
http.get(
|
| 71 |
+
`${root_url}/api/spaces/${private_auth_app_reference}/${HOST_URL}`,
|
| 72 |
+
() => {
|
| 73 |
+
return new HttpResponse(
|
| 74 |
+
JSON.stringify({
|
| 75 |
+
subdomain: "hmb-private-auth-space",
|
| 76 |
+
host: "https://hmb-private-auth-space.hf.space"
|
| 77 |
+
}),
|
| 78 |
+
{
|
| 79 |
+
status: 200,
|
| 80 |
+
headers: {
|
| 81 |
+
"Content-Type": "application/json"
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
);
|
| 85 |
+
}
|
| 86 |
+
),
|
| 87 |
+
http.get(
|
| 88 |
+
`${root_url}/api/spaces/${private_app_reference}/${HOST_URL}`,
|
| 89 |
+
({ request }) => {
|
| 90 |
+
const token = request.headers.get("authorization")?.substring(7);
|
| 91 |
+
|
| 92 |
+
if (!token || token !== "hf_123") {
|
| 93 |
+
return new HttpResponse(null, {
|
| 94 |
+
status: 401,
|
| 95 |
+
headers: {
|
| 96 |
+
"Content-Type": "application/json"
|
| 97 |
+
}
|
| 98 |
+
});
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
return new HttpResponse(
|
| 102 |
+
JSON.stringify({
|
| 103 |
+
subdomain: private_app_reference,
|
| 104 |
+
host: private_space_url
|
| 105 |
+
}),
|
| 106 |
+
{
|
| 107 |
+
status: 200,
|
| 108 |
+
headers: {
|
| 109 |
+
"Content-Type": "application/json"
|
| 110 |
+
}
|
| 111 |
+
}
|
| 112 |
+
);
|
| 113 |
+
}
|
| 114 |
+
),
|
| 115 |
+
http.get(
|
| 116 |
+
`${root_url}/api/spaces/${server_error_reference}/${HOST_URL}`,
|
| 117 |
+
() => {
|
| 118 |
+
return new HttpResponse(
|
| 119 |
+
JSON.stringify({
|
| 120 |
+
subdomain: "hmb-server-test",
|
| 121 |
+
host: "https://hmb-server-test.hf.space"
|
| 122 |
+
}),
|
| 123 |
+
{
|
| 124 |
+
status: 200,
|
| 125 |
+
headers: {
|
| 126 |
+
"Content-Type": "application/json"
|
| 127 |
+
}
|
| 128 |
+
}
|
| 129 |
+
);
|
| 130 |
+
}
|
| 131 |
+
),
|
| 132 |
+
http.get(
|
| 133 |
+
`${root_url}/api/spaces/${server_test_app_reference}/${HOST_URL}`,
|
| 134 |
+
() => {
|
| 135 |
+
return new HttpResponse(
|
| 136 |
+
JSON.stringify({
|
| 137 |
+
subdomain: "hmb-server-test",
|
| 138 |
+
host: "https://hmb-server-test.hf.space"
|
| 139 |
+
}),
|
| 140 |
+
{
|
| 141 |
+
status: 200,
|
| 142 |
+
headers: {
|
| 143 |
+
"Content-Type": "application/json"
|
| 144 |
+
}
|
| 145 |
+
}
|
| 146 |
+
);
|
| 147 |
+
}
|
| 148 |
+
),
|
| 149 |
+
http.get(`${root_url}/api/spaces/${auth_app_reference}/${HOST_URL}`, () => {
|
| 150 |
+
return new HttpResponse(
|
| 151 |
+
JSON.stringify({
|
| 152 |
+
subdomain: "hmb-auth-space",
|
| 153 |
+
host: "https://hmb-auth-space.hf.space"
|
| 154 |
+
}),
|
| 155 |
+
{
|
| 156 |
+
status: 200,
|
| 157 |
+
headers: {
|
| 158 |
+
"Content-Type": "application/json"
|
| 159 |
+
}
|
| 160 |
+
}
|
| 161 |
+
);
|
| 162 |
+
}),
|
| 163 |
+
http.get(
|
| 164 |
+
`${root_url}/api/spaces/${invalid_auth_app_reference}/${HOST_URL}`,
|
| 165 |
+
() => {
|
| 166 |
+
return new HttpResponse(
|
| 167 |
+
JSON.stringify({
|
| 168 |
+
subdomain: "hmb-invalid-auth-space",
|
| 169 |
+
host: "https://hmb-invalid-auth-space.hf.space"
|
| 170 |
+
}),
|
| 171 |
+
{
|
| 172 |
+
status: 200,
|
| 173 |
+
headers: {
|
| 174 |
+
"Content-Type": "application/json"
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
);
|
| 178 |
+
}
|
| 179 |
+
),
|
| 180 |
+
http.get(
|
| 181 |
+
`${root_url}/api/spaces/${duplicate_app_reference}/${HOST_URL}`,
|
| 182 |
+
() => {
|
| 183 |
+
return new HttpResponse(
|
| 184 |
+
JSON.stringify({
|
| 185 |
+
subdomain: "gradio-hello-world",
|
| 186 |
+
host: "https://gradio-hello-world.hf.space"
|
| 187 |
+
}),
|
| 188 |
+
{
|
| 189 |
+
status: 200,
|
| 190 |
+
headers: {
|
| 191 |
+
"Content-Type": "application/json"
|
| 192 |
+
}
|
| 193 |
+
}
|
| 194 |
+
);
|
| 195 |
+
}
|
| 196 |
+
),
|
| 197 |
+
http.get(`${root_url}/api/spaces/${unauth_app_reference}/${HOST_URL}`, () => {
|
| 198 |
+
return new HttpResponse(
|
| 199 |
+
JSON.stringify({
|
| 200 |
+
subdomain: "hmb-unath-space",
|
| 201 |
+
host: "https://hmb-unauth-space.hf.space"
|
| 202 |
+
}),
|
| 203 |
+
{
|
| 204 |
+
status: 200,
|
| 205 |
+
headers: {
|
| 206 |
+
"Content-Type": "application/json"
|
| 207 |
+
}
|
| 208 |
+
}
|
| 209 |
+
);
|
| 210 |
+
}),
|
| 211 |
+
// /info requests
|
| 212 |
+
http.get(`${direct_space_url}/${API_INFO_URL}`, () => {
|
| 213 |
+
return new HttpResponse(JSON.stringify(response_api_info), {
|
| 214 |
+
status: 200,
|
| 215 |
+
headers: {
|
| 216 |
+
"Content-Type": "application/json"
|
| 217 |
+
}
|
| 218 |
+
});
|
| 219 |
+
}),
|
| 220 |
+
http.get(`${upload_server_test_space_url}/${API_INFO_URL}`, () => {
|
| 221 |
+
return new HttpResponse(JSON.stringify(response_api_info), {
|
| 222 |
+
status: 200,
|
| 223 |
+
headers: {
|
| 224 |
+
"Content-Type": "application/json"
|
| 225 |
+
}
|
| 226 |
+
});
|
| 227 |
+
}),
|
| 228 |
+
http.get(`${private_space_url}/${API_INFO_URL}`, () => {
|
| 229 |
+
return new HttpResponse(JSON.stringify(response_api_info), {
|
| 230 |
+
status: 200,
|
| 231 |
+
headers: {
|
| 232 |
+
"Content-Type": "application/json"
|
| 233 |
+
}
|
| 234 |
+
});
|
| 235 |
+
}),
|
| 236 |
+
http.get(`${server_error_space_url}/${API_INFO_URL}`, () => {
|
| 237 |
+
return new HttpResponse(JSON.stringify(response_api_info), {
|
| 238 |
+
status: 200,
|
| 239 |
+
headers: {
|
| 240 |
+
"Content-Type": "application/json"
|
| 241 |
+
}
|
| 242 |
+
});
|
| 243 |
+
}),
|
| 244 |
+
http.get(`${auth_app_space_url}/${API_INFO_URL}`, async () => {
|
| 245 |
+
return new HttpResponse(JSON.stringify(response_api_info), {
|
| 246 |
+
status: 200,
|
| 247 |
+
headers: {
|
| 248 |
+
"Content-Type": "application/json"
|
| 249 |
+
}
|
| 250 |
+
});
|
| 251 |
+
}),
|
| 252 |
+
http.get(`${private_auth_space_url}/${API_INFO_URL}`, async () => {
|
| 253 |
+
return new HttpResponse(JSON.stringify(response_api_info), {
|
| 254 |
+
status: 200,
|
| 255 |
+
headers: {
|
| 256 |
+
"Content-Type": "application/json"
|
| 257 |
+
}
|
| 258 |
+
});
|
| 259 |
+
}),
|
| 260 |
+
// /config requests
|
| 261 |
+
http.get(`${direct_space_url}/${CONFIG_URL}`, () => {
|
| 262 |
+
return new HttpResponse(JSON.stringify(config_response), {
|
| 263 |
+
status: 200,
|
| 264 |
+
headers: {
|
| 265 |
+
"Content-Type": "application/json"
|
| 266 |
+
}
|
| 267 |
+
});
|
| 268 |
+
}),
|
| 269 |
+
http.get(`${private_space_url}/${CONFIG_URL}`, () => {
|
| 270 |
+
return new HttpResponse(
|
| 271 |
+
JSON.stringify({
|
| 272 |
+
...config_response,
|
| 273 |
+
root: "https://hmb-secret-world.hf.space"
|
| 274 |
+
}),
|
| 275 |
+
{
|
| 276 |
+
status: 200,
|
| 277 |
+
headers: {
|
| 278 |
+
"Content-Type": "application/json"
|
| 279 |
+
}
|
| 280 |
+
}
|
| 281 |
+
);
|
| 282 |
+
}),
|
| 283 |
+
http.get(`${upload_server_test_space_url}/${CONFIG_URL}`, () => {
|
| 284 |
+
return new HttpResponse(
|
| 285 |
+
JSON.stringify({
|
| 286 |
+
...config_response,
|
| 287 |
+
root: "https://hmb-server-test.hf.space"
|
| 288 |
+
}),
|
| 289 |
+
{
|
| 290 |
+
status: 200,
|
| 291 |
+
headers: {
|
| 292 |
+
"Content-Type": "application/json"
|
| 293 |
+
}
|
| 294 |
+
}
|
| 295 |
+
);
|
| 296 |
+
}),
|
| 297 |
+
http.get(`${private_auth_space_url}/${CONFIG_URL}`, () => {
|
| 298 |
+
return new HttpResponse(
|
| 299 |
+
JSON.stringify({
|
| 300 |
+
...config_response,
|
| 301 |
+
root: "https://hmb-private-auth-space.hf.space"
|
| 302 |
+
}),
|
| 303 |
+
{
|
| 304 |
+
status: 200,
|
| 305 |
+
headers: {
|
| 306 |
+
"Content-Type": "application/json"
|
| 307 |
+
}
|
| 308 |
+
}
|
| 309 |
+
);
|
| 310 |
+
}),
|
| 311 |
+
http.get(`${direct_space_url}/${CONFIG_URL}`, () => {
|
| 312 |
+
return new HttpResponse(JSON.stringify(config_response), {
|
| 313 |
+
status: 500,
|
| 314 |
+
headers: {
|
| 315 |
+
"Content-Type": "application/json"
|
| 316 |
+
}
|
| 317 |
+
});
|
| 318 |
+
}),
|
| 319 |
+
http.get(`${server_error_space_url}/${CONFIG_URL}`, () => {
|
| 320 |
+
return new HttpResponse(JSON.stringify(config_response), {
|
| 321 |
+
status: 200,
|
| 322 |
+
headers: {
|
| 323 |
+
"Content-Type": "application/json"
|
| 324 |
+
}
|
| 325 |
+
});
|
| 326 |
+
}),
|
| 327 |
+
http.get(`${invalid_auth_space_url}/${CONFIG_URL}`, () => {
|
| 328 |
+
return new HttpResponse(JSON.stringify({ detail: "Unauthorized" }), {
|
| 329 |
+
status: 401,
|
| 330 |
+
headers: {
|
| 331 |
+
"Content-Type": "application/json"
|
| 332 |
+
}
|
| 333 |
+
});
|
| 334 |
+
}),
|
| 335 |
+
http.get(`${auth_app_space_url}/${CONFIG_URL}`, ({ request }) => {
|
| 336 |
+
return new HttpResponse(
|
| 337 |
+
JSON.stringify({
|
| 338 |
+
...config_response,
|
| 339 |
+
root: "https://hmb-auth-space.hf.space",
|
| 340 |
+
space_id: "hmb/auth_space"
|
| 341 |
+
}),
|
| 342 |
+
{
|
| 343 |
+
status: 200,
|
| 344 |
+
headers: {
|
| 345 |
+
"Content-Type": "application/json"
|
| 346 |
+
}
|
| 347 |
+
}
|
| 348 |
+
);
|
| 349 |
+
}),
|
| 350 |
+
http.get(`${unauth_app_space_url}/${CONFIG_URL}`, () => {
|
| 351 |
+
return new HttpResponse(
|
| 352 |
+
JSON.stringify({
|
| 353 |
+
detail: "Unauthorized"
|
| 354 |
+
}),
|
| 355 |
+
{
|
| 356 |
+
status: 401,
|
| 357 |
+
headers: {
|
| 358 |
+
"Content-Type": "application/json"
|
| 359 |
+
}
|
| 360 |
+
}
|
| 361 |
+
);
|
| 362 |
+
}),
|
| 363 |
+
// /whoami requests
|
| 364 |
+
http.get(`${root_url}/api/whoami-v2`, () => {
|
| 365 |
+
return new HttpResponse(JSON.stringify(whoami_response), {
|
| 366 |
+
status: 200,
|
| 367 |
+
headers: {
|
| 368 |
+
"Content-Type": "application/json",
|
| 369 |
+
"hf-token": "hf_123"
|
| 370 |
+
}
|
| 371 |
+
});
|
| 372 |
+
}),
|
| 373 |
+
// /duplicate requests
|
| 374 |
+
http.post(
|
| 375 |
+
`${root_url}/api/spaces/${duplicate_app_reference}/duplicate`,
|
| 376 |
+
({ request }) => {
|
| 377 |
+
if (request.headers.get("authorization")?.substring(7) !== "hf_123") {
|
| 378 |
+
throw new HttpResponse(null, {
|
| 379 |
+
status: 401,
|
| 380 |
+
headers: {
|
| 381 |
+
"Content-Type": "application/json"
|
| 382 |
+
}
|
| 383 |
+
});
|
| 384 |
+
}
|
| 385 |
+
return new HttpResponse(JSON.stringify(duplicate_response), {
|
| 386 |
+
status: 200,
|
| 387 |
+
headers: {
|
| 388 |
+
"Content-Type": "application/json"
|
| 389 |
+
}
|
| 390 |
+
});
|
| 391 |
+
}
|
| 392 |
+
),
|
| 393 |
+
// /sleeptime requests
|
| 394 |
+
http.post(`${root_url}/api/spaces/${app_reference}/${SLEEPTIME_URL}`, () => {
|
| 395 |
+
return new HttpResponse(JSON.stringify(hardware_sleeptime_response), {
|
| 396 |
+
status: 200,
|
| 397 |
+
headers: {
|
| 398 |
+
"Content-Type": "application/json"
|
| 399 |
+
}
|
| 400 |
+
});
|
| 401 |
+
}),
|
| 402 |
+
http.post(
|
| 403 |
+
`${root_url}/api/spaces/${server_test_app_reference}/${SLEEPTIME_URL}`,
|
| 404 |
+
() => {
|
| 405 |
+
throw new HttpResponse(null, {
|
| 406 |
+
status: 500,
|
| 407 |
+
headers: {
|
| 408 |
+
"Content-Type": "application/json"
|
| 409 |
+
}
|
| 410 |
+
});
|
| 411 |
+
}
|
| 412 |
+
),
|
| 413 |
+
// /runtime requests
|
| 414 |
+
http.get(
|
| 415 |
+
`${root_url}/api/spaces/${broken_app_reference}/${RUNTIME_URL}`,
|
| 416 |
+
() => {
|
| 417 |
+
return new HttpResponse(null, {
|
| 418 |
+
status: 404,
|
| 419 |
+
headers: {
|
| 420 |
+
"Content-Type": "application/json"
|
| 421 |
+
}
|
| 422 |
+
});
|
| 423 |
+
}
|
| 424 |
+
),
|
| 425 |
+
http.get(`${root_url}/api/spaces/${app_reference}/${RUNTIME_URL}`, () => {
|
| 426 |
+
return new HttpResponse(JSON.stringify(hardware_sleeptime_response), {
|
| 427 |
+
status: 200,
|
| 428 |
+
headers: {
|
| 429 |
+
"Content-Type": "application/json"
|
| 430 |
+
}
|
| 431 |
+
});
|
| 432 |
+
}),
|
| 433 |
+
// queue requests
|
| 434 |
+
http.get(`${direct_space_url}/queue/data`, () => {
|
| 435 |
+
return new HttpResponse(JSON.stringify({ event_id: "123" }), {
|
| 436 |
+
status: 200,
|
| 437 |
+
headers: {
|
| 438 |
+
"Content-Type": "application/json"
|
| 439 |
+
}
|
| 440 |
+
});
|
| 441 |
+
}),
|
| 442 |
+
http.post(`${direct_space_url}/queue/join`, () => {
|
| 443 |
+
return new HttpResponse(JSON.stringify({ event_id: "123" }), {
|
| 444 |
+
status: 200,
|
| 445 |
+
headers: {
|
| 446 |
+
"Content-Type": "application/json"
|
| 447 |
+
}
|
| 448 |
+
});
|
| 449 |
+
}),
|
| 450 |
+
// upload requests
|
| 451 |
+
http.post(`${direct_space_url}/${UPLOAD_URL}`, () => {
|
| 452 |
+
return new HttpResponse(JSON.stringify(["lion.jpg"]), {
|
| 453 |
+
status: 200,
|
| 454 |
+
headers: {
|
| 455 |
+
"Content-Type": "application/json"
|
| 456 |
+
}
|
| 457 |
+
});
|
| 458 |
+
}),
|
| 459 |
+
http.post(`${upload_server_test_space_url}/${UPLOAD_URL}`, () => {
|
| 460 |
+
throw new HttpResponse(JSON.parse("Internal Server Error"), {
|
| 461 |
+
status: 200,
|
| 462 |
+
headers: {
|
| 463 |
+
"Content-Type": "application/json"
|
| 464 |
+
}
|
| 465 |
+
});
|
| 466 |
+
}),
|
| 467 |
+
// discussions requests
|
| 468 |
+
http.head(`${root_url}/api/spaces/${app_reference}/discussions`, () => {
|
| 469 |
+
return new HttpResponse(JSON.stringify(discussions_response), {
|
| 470 |
+
status: 200,
|
| 471 |
+
headers: {
|
| 472 |
+
"Content-Type": "application/json"
|
| 473 |
+
}
|
| 474 |
+
});
|
| 475 |
+
}),
|
| 476 |
+
http.head(
|
| 477 |
+
`${root_url}/api/spaces/${broken_app_reference}/discussions`,
|
| 478 |
+
() => {
|
| 479 |
+
throw new HttpResponse(
|
| 480 |
+
JSON.parse("Discussions are disabled for this repo"),
|
| 481 |
+
{
|
| 482 |
+
status: 403,
|
| 483 |
+
headers: {
|
| 484 |
+
"Content-Type": "application/json"
|
| 485 |
+
}
|
| 486 |
+
}
|
| 487 |
+
);
|
| 488 |
+
}
|
| 489 |
+
),
|
| 490 |
+
// space requests
|
| 491 |
+
http.get(`${root_url}/api/spaces/${app_reference}`, () => {
|
| 492 |
+
return new HttpResponse(
|
| 493 |
+
JSON.stringify({ id: app_reference, runtime: runtime_response }),
|
| 494 |
+
{
|
| 495 |
+
status: 200,
|
| 496 |
+
headers: {
|
| 497 |
+
"Content-Type": "application/json"
|
| 498 |
+
}
|
| 499 |
+
}
|
| 500 |
+
);
|
| 501 |
+
}),
|
| 502 |
+
http.get(`${root_url}/api/spaces/hmb/paused_space`, () => {
|
| 503 |
+
return new HttpResponse(
|
| 504 |
+
JSON.stringify({
|
| 505 |
+
id: app_reference,
|
| 506 |
+
runtime: { ...runtime_response, stage: "PAUSED" }
|
| 507 |
+
}),
|
| 508 |
+
{
|
| 509 |
+
status: 200,
|
| 510 |
+
headers: {
|
| 511 |
+
"Content-Type": "application/json"
|
| 512 |
+
}
|
| 513 |
+
}
|
| 514 |
+
);
|
| 515 |
+
}),
|
| 516 |
+
http.get(`${root_url}/api/spaces/hmb/building_space`, () => {
|
| 517 |
+
return new HttpResponse(
|
| 518 |
+
JSON.stringify({
|
| 519 |
+
id: app_reference,
|
| 520 |
+
runtime: { ...runtime_response, stage: "BUILDING" }
|
| 521 |
+
}),
|
| 522 |
+
{
|
| 523 |
+
status: 200,
|
| 524 |
+
headers: {
|
| 525 |
+
"Content-Type": "application/json"
|
| 526 |
+
}
|
| 527 |
+
}
|
| 528 |
+
);
|
| 529 |
+
}),
|
| 530 |
+
http.get(`${root_url}/api/spaces/hmb/stopped_space`, () => {
|
| 531 |
+
return new HttpResponse(
|
| 532 |
+
JSON.stringify({
|
| 533 |
+
id: app_reference,
|
| 534 |
+
runtime: { ...runtime_response, stage: "STOPPED" }
|
| 535 |
+
}),
|
| 536 |
+
{
|
| 537 |
+
status: 200,
|
| 538 |
+
headers: {
|
| 539 |
+
"Content-Type": "application/json"
|
| 540 |
+
}
|
| 541 |
+
}
|
| 542 |
+
);
|
| 543 |
+
}),
|
| 544 |
+
http.get(`${root_url}/api/spaces/hmb/failed_space`, () => {
|
| 545 |
+
throw new HttpResponse(null, {
|
| 546 |
+
status: 500,
|
| 547 |
+
headers: {
|
| 548 |
+
"Content-Type": "application/json"
|
| 549 |
+
}
|
| 550 |
+
});
|
| 551 |
+
}),
|
| 552 |
+
http.get(`${root_url}/api/spaces/${unauth_app_reference}`, () => {
|
| 553 |
+
return new HttpResponse(
|
| 554 |
+
JSON.stringify({
|
| 555 |
+
id: unauth_app_reference,
|
| 556 |
+
runtime: { ...runtime_response }
|
| 557 |
+
}),
|
| 558 |
+
{
|
| 559 |
+
status: 200,
|
| 560 |
+
headers: {
|
| 561 |
+
"Content-Type": "application/json"
|
| 562 |
+
}
|
| 563 |
+
}
|
| 564 |
+
);
|
| 565 |
+
}),
|
| 566 |
+
// jwt requests
|
| 567 |
+
http.get(`${root_url}/api/spaces/${app_reference}/jwt`, () => {
|
| 568 |
+
return new HttpResponse(
|
| 569 |
+
JSON.stringify({
|
| 570 |
+
token: "jwt_123"
|
| 571 |
+
}),
|
| 572 |
+
{
|
| 573 |
+
status: 200,
|
| 574 |
+
headers: {
|
| 575 |
+
"Content-Type": "application/json"
|
| 576 |
+
}
|
| 577 |
+
}
|
| 578 |
+
);
|
| 579 |
+
}),
|
| 580 |
+
http.get(`${root_url}/api/spaces/${broken_app_reference}/jwt`, () => {
|
| 581 |
+
return new HttpResponse(null, {
|
| 582 |
+
status: 500,
|
| 583 |
+
headers: {
|
| 584 |
+
"Content-Type": "application/json"
|
| 585 |
+
}
|
| 586 |
+
});
|
| 587 |
+
}),
|
| 588 |
+
// post_data requests
|
| 589 |
+
http.post(`${direct_space_url}`, () => {
|
| 590 |
+
return new HttpResponse(JSON.stringify({}), {
|
| 591 |
+
status: 200,
|
| 592 |
+
headers: {
|
| 593 |
+
"Content-Type": "application/json"
|
| 594 |
+
}
|
| 595 |
+
});
|
| 596 |
+
}),
|
| 597 |
+
http.post(`${private_space_url}`, () => {
|
| 598 |
+
return new HttpResponse(JSON.stringify(BROKEN_CONNECTION_MSG), {
|
| 599 |
+
status: 500,
|
| 600 |
+
headers: {
|
| 601 |
+
"Content-Type": "application/json"
|
| 602 |
+
}
|
| 603 |
+
});
|
| 604 |
+
}),
|
| 605 |
+
// heartbeat requests
|
| 606 |
+
http.get(`*/heartbeat/*`, () => {
|
| 607 |
+
return new HttpResponse(null, {
|
| 608 |
+
status: 200,
|
| 609 |
+
headers: {
|
| 610 |
+
"Content-Type": "application/json"
|
| 611 |
+
}
|
| 612 |
+
});
|
| 613 |
+
}),
|
| 614 |
+
// login requests
|
| 615 |
+
http.post(`${auth_app_space_url}/${LOGIN_URL}`, async ({ request }) => {
|
| 616 |
+
let username;
|
| 617 |
+
let password;
|
| 618 |
+
|
| 619 |
+
await request.formData().then((data) => {
|
| 620 |
+
username = data.get("username");
|
| 621 |
+
password = data.get("password");
|
| 622 |
+
});
|
| 623 |
+
|
| 624 |
+
if (username === "admin" && password === "pass1234") {
|
| 625 |
+
return new HttpResponse(
|
| 626 |
+
JSON.stringify({
|
| 627 |
+
success: true
|
| 628 |
+
}),
|
| 629 |
+
{
|
| 630 |
+
status: 200,
|
| 631 |
+
headers: {
|
| 632 |
+
"Content-Type": "application/json",
|
| 633 |
+
"Set-Cookie":
|
| 634 |
+
"access-token-123=abc; HttpOnly; Path=/; SameSite=none; Secure",
|
| 635 |
+
// @ts-ignore - multiple Set-Cookie headers are returned
|
| 636 |
+
"Set-Cookie":
|
| 637 |
+
"access-token-unsecure-123=abc; HttpOnly; Path=/; SameSite=none; Secure"
|
| 638 |
+
}
|
| 639 |
+
}
|
| 640 |
+
);
|
| 641 |
+
}
|
| 642 |
+
|
| 643 |
+
return new HttpResponse(null, {
|
| 644 |
+
status: 401,
|
| 645 |
+
headers: {
|
| 646 |
+
"Content-Type": "application/json"
|
| 647 |
+
}
|
| 648 |
+
});
|
| 649 |
+
}),
|
| 650 |
+
http.post(`${invalid_auth_space_url}/${LOGIN_URL}`, async () => {
|
| 651 |
+
return new HttpResponse(null, {
|
| 652 |
+
status: 401,
|
| 653 |
+
headers: {
|
| 654 |
+
"Content-Type": "application/json"
|
| 655 |
+
}
|
| 656 |
+
});
|
| 657 |
+
}),
|
| 658 |
+
http.post(`${private_auth_space_url}/${LOGIN_URL}`, async ({ request }) => {
|
| 659 |
+
let username;
|
| 660 |
+
let password;
|
| 661 |
+
|
| 662 |
+
await request.formData().then((data) => {
|
| 663 |
+
username = data.get("username");
|
| 664 |
+
password = data.get("password");
|
| 665 |
+
});
|
| 666 |
+
|
| 667 |
+
if (username === "admin" && password === "pass1234") {
|
| 668 |
+
return new HttpResponse(
|
| 669 |
+
JSON.stringify({
|
| 670 |
+
success: true
|
| 671 |
+
}),
|
| 672 |
+
{
|
| 673 |
+
status: 200,
|
| 674 |
+
headers: {
|
| 675 |
+
"Content-Type": "application/json",
|
| 676 |
+
"Set-Cookie":
|
| 677 |
+
"access-token-123=abc; HttpOnly; Path=/; SameSite=none; Secure",
|
| 678 |
+
// @ts-ignore - multiple Set-Cookie headers are returned
|
| 679 |
+
"Set-Cookie":
|
| 680 |
+
"access-token-unsecure-123=abc; HttpOnly; Path=/; SameSite=none; Secure"
|
| 681 |
+
}
|
| 682 |
+
}
|
| 683 |
+
);
|
| 684 |
+
}
|
| 685 |
+
|
| 686 |
+
return new HttpResponse(null, {
|
| 687 |
+
status: 401,
|
| 688 |
+
headers: {
|
| 689 |
+
"Content-Type": "application/json"
|
| 690 |
+
}
|
| 691 |
+
});
|
| 692 |
+
})
|
| 693 |
+
];
|
6.1.1/client/src/test/mock_eventsource.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { vi } from "vitest";
|
| 2 |
+
|
| 3 |
+
if (process.env.TEST_MODE !== "node") {
|
| 4 |
+
Object.defineProperty(window, "EventSource", {
|
| 5 |
+
writable: true,
|
| 6 |
+
value: vi.fn().mockImplementation(() => ({
|
| 7 |
+
close: vi.fn(() => {}),
|
| 8 |
+
addEventListener: vi.fn(),
|
| 9 |
+
onmessage: vi.fn((_event: MessageEvent) => {}),
|
| 10 |
+
onerror: vi.fn((_event: Event) => {})
|
| 11 |
+
}))
|
| 12 |
+
});
|
| 13 |
+
}
|
6.1.1/client/src/test/server.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { setupServer } from "msw/node";
|
| 2 |
+
import { handlers } from "./handlers";
|
| 3 |
+
|
| 4 |
+
export function initialise_server(): any {
|
| 5 |
+
return setupServer(...handlers);
|
| 6 |
+
}
|
6.1.1/client/src/test/test_data.ts
ADDED
|
@@ -0,0 +1,562 @@
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// @ts-nocheck
|
| 2 |
+
import { ApiData, ApiInfo, Config, EndpointInfo } from "../types";
|
| 3 |
+
|
| 4 |
+
export const runtime_response = {
|
| 5 |
+
stage: "RUNNING",
|
| 6 |
+
hardware: {
|
| 7 |
+
current: "cpu-basic",
|
| 8 |
+
requested: "cpu-basic"
|
| 9 |
+
},
|
| 10 |
+
storage: {
|
| 11 |
+
current: null,
|
| 12 |
+
requested: null
|
| 13 |
+
},
|
| 14 |
+
gcTimeout: 86400,
|
| 15 |
+
replicas: {
|
| 16 |
+
current: 1,
|
| 17 |
+
requested: 1
|
| 18 |
+
},
|
| 19 |
+
devMode: false,
|
| 20 |
+
domains: [
|
| 21 |
+
{
|
| 22 |
+
domain: "hmb-hello-world.hf.space",
|
| 23 |
+
isCustom: false,
|
| 24 |
+
stage: "READY"
|
| 25 |
+
}
|
| 26 |
+
]
|
| 27 |
+
};
|
| 28 |
+
|
| 29 |
+
export const transformed_api_info: ApiInfo<ApiData> = {
|
| 30 |
+
named_endpoints: {
|
| 31 |
+
"/predict": {
|
| 32 |
+
parameters: [
|
| 33 |
+
{
|
| 34 |
+
label: "name",
|
| 35 |
+
type: "string",
|
| 36 |
+
python_type: { type: "str", description: "" },
|
| 37 |
+
component: "Textbox",
|
| 38 |
+
example_input: "Hello!!"
|
| 39 |
+
}
|
| 40 |
+
],
|
| 41 |
+
returns: [
|
| 42 |
+
{
|
| 43 |
+
label: "output",
|
| 44 |
+
type: "string",
|
| 45 |
+
python_type: { type: "str", description: "" },
|
| 46 |
+
component: "Textbox"
|
| 47 |
+
}
|
| 48 |
+
],
|
| 49 |
+
type: { generator: false, cancel: false }
|
| 50 |
+
}
|
| 51 |
+
},
|
| 52 |
+
unnamed_endpoints: {
|
| 53 |
+
"0": {
|
| 54 |
+
parameters: [
|
| 55 |
+
{
|
| 56 |
+
label: "name",
|
| 57 |
+
type: "string",
|
| 58 |
+
python_type: { type: "str", description: "" },
|
| 59 |
+
component: "Textbox",
|
| 60 |
+
example_input: "Hello!!"
|
| 61 |
+
}
|
| 62 |
+
],
|
| 63 |
+
returns: [
|
| 64 |
+
{
|
| 65 |
+
label: "output",
|
| 66 |
+
type: "string",
|
| 67 |
+
python_type: { type: "str", description: "" },
|
| 68 |
+
component: "Textbox"
|
| 69 |
+
}
|
| 70 |
+
],
|
| 71 |
+
type: { generator: false, cancel: false }
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
};
|
| 75 |
+
|
| 76 |
+
export const response_api_info: ApiInfo<ApiData> = {
|
| 77 |
+
named_endpoints: {
|
| 78 |
+
"/predict": {
|
| 79 |
+
parameters: [
|
| 80 |
+
{
|
| 81 |
+
label: "name",
|
| 82 |
+
type: {
|
| 83 |
+
type: "string"
|
| 84 |
+
},
|
| 85 |
+
python_type: {
|
| 86 |
+
type: "str",
|
| 87 |
+
description: ""
|
| 88 |
+
},
|
| 89 |
+
component: "Textbox",
|
| 90 |
+
example_input: "Hello!!"
|
| 91 |
+
}
|
| 92 |
+
],
|
| 93 |
+
returns: [
|
| 94 |
+
{
|
| 95 |
+
label: "output",
|
| 96 |
+
type: {
|
| 97 |
+
type: "string"
|
| 98 |
+
},
|
| 99 |
+
python_type: {
|
| 100 |
+
type: "str",
|
| 101 |
+
description: ""
|
| 102 |
+
},
|
| 103 |
+
component: "Textbox"
|
| 104 |
+
}
|
| 105 |
+
]
|
| 106 |
+
}
|
| 107 |
+
},
|
| 108 |
+
unnamed_endpoints: {}
|
| 109 |
+
};
|
| 110 |
+
|
| 111 |
+
export const config_response: Config = {
|
| 112 |
+
version: "4.27.0",
|
| 113 |
+
mode: "interface",
|
| 114 |
+
app_id: 123,
|
| 115 |
+
dev_mode: false,
|
| 116 |
+
analytics_enabled: true,
|
| 117 |
+
components: [
|
| 118 |
+
{
|
| 119 |
+
id: 3,
|
| 120 |
+
type: "row",
|
| 121 |
+
props: {
|
| 122 |
+
variant: "default",
|
| 123 |
+
visible: true,
|
| 124 |
+
equal_height: false,
|
| 125 |
+
name: "row"
|
| 126 |
+
},
|
| 127 |
+
skip_api: true,
|
| 128 |
+
component_class_id: ""
|
| 129 |
+
},
|
| 130 |
+
{
|
| 131 |
+
id: 4,
|
| 132 |
+
type: "column",
|
| 133 |
+
props: {
|
| 134 |
+
scale: 1,
|
| 135 |
+
min_width: 320,
|
| 136 |
+
variant: "panel",
|
| 137 |
+
visible: true,
|
| 138 |
+
name: "column"
|
| 139 |
+
},
|
| 140 |
+
skip_api: true,
|
| 141 |
+
component_class_id: ""
|
| 142 |
+
},
|
| 143 |
+
{
|
| 144 |
+
id: 5,
|
| 145 |
+
type: "column",
|
| 146 |
+
props: {
|
| 147 |
+
scale: 1,
|
| 148 |
+
min_width: 320,
|
| 149 |
+
variant: "default",
|
| 150 |
+
visible: true,
|
| 151 |
+
name: "column"
|
| 152 |
+
},
|
| 153 |
+
skip_api: true,
|
| 154 |
+
component_class_id: ""
|
| 155 |
+
},
|
| 156 |
+
{
|
| 157 |
+
id: 1,
|
| 158 |
+
type: "textbox",
|
| 159 |
+
props: {
|
| 160 |
+
lines: 1,
|
| 161 |
+
max_lines: 20,
|
| 162 |
+
label: "name",
|
| 163 |
+
show_label: true,
|
| 164 |
+
container: true,
|
| 165 |
+
min_width: 160,
|
| 166 |
+
visible: true,
|
| 167 |
+
autofocus: false,
|
| 168 |
+
autoscroll: true,
|
| 169 |
+
elem_classes: [],
|
| 170 |
+
type: "text",
|
| 171 |
+
rtl: false,
|
| 172 |
+
show_copy_button: false,
|
| 173 |
+
name: "textbox",
|
| 174 |
+
_selectable: false
|
| 175 |
+
},
|
| 176 |
+
skip_api: false,
|
| 177 |
+
component_class_id: "",
|
| 178 |
+
api_info: {
|
| 179 |
+
type: "string"
|
| 180 |
+
},
|
| 181 |
+
example_inputs: "Hello!!"
|
| 182 |
+
},
|
| 183 |
+
{
|
| 184 |
+
id: 6,
|
| 185 |
+
type: "form",
|
| 186 |
+
props: {
|
| 187 |
+
scale: 0,
|
| 188 |
+
min_width: 0,
|
| 189 |
+
name: "form"
|
| 190 |
+
},
|
| 191 |
+
skip_api: true,
|
| 192 |
+
component_class_id: ""
|
| 193 |
+
},
|
| 194 |
+
{
|
| 195 |
+
id: 7,
|
| 196 |
+
type: "row",
|
| 197 |
+
props: {
|
| 198 |
+
variant: "default",
|
| 199 |
+
visible: true,
|
| 200 |
+
equal_height: true,
|
| 201 |
+
name: "row"
|
| 202 |
+
},
|
| 203 |
+
skip_api: true,
|
| 204 |
+
component_class_id: ""
|
| 205 |
+
},
|
| 206 |
+
{
|
| 207 |
+
id: 8,
|
| 208 |
+
type: "button",
|
| 209 |
+
props: {
|
| 210 |
+
value: "Clear",
|
| 211 |
+
variant: "secondary",
|
| 212 |
+
visible: true,
|
| 213 |
+
interactive: true,
|
| 214 |
+
elem_classes: [],
|
| 215 |
+
api_visibility: "undocumented",
|
| 216 |
+
name: "button",
|
| 217 |
+
_selectable: false
|
| 218 |
+
},
|
| 219 |
+
skip_api: true,
|
| 220 |
+
component_class_id: ""
|
| 221 |
+
},
|
| 222 |
+
{
|
| 223 |
+
id: 9,
|
| 224 |
+
type: "button",
|
| 225 |
+
props: {
|
| 226 |
+
value: "Submit",
|
| 227 |
+
variant: "primary",
|
| 228 |
+
visible: true,
|
| 229 |
+
interactive: true,
|
| 230 |
+
elem_classes: [],
|
| 231 |
+
name: "button",
|
| 232 |
+
_selectable: false
|
| 233 |
+
},
|
| 234 |
+
skip_api: true,
|
| 235 |
+
component_class_id: ""
|
| 236 |
+
},
|
| 237 |
+
{
|
| 238 |
+
id: 10,
|
| 239 |
+
type: "column",
|
| 240 |
+
props: {
|
| 241 |
+
scale: 1,
|
| 242 |
+
min_width: 320,
|
| 243 |
+
variant: "panel",
|
| 244 |
+
visible: true,
|
| 245 |
+
name: "column"
|
| 246 |
+
},
|
| 247 |
+
skip_api: true,
|
| 248 |
+
component_class_id: ""
|
| 249 |
+
},
|
| 250 |
+
{
|
| 251 |
+
id: 2,
|
| 252 |
+
type: "textbox",
|
| 253 |
+
props: {
|
| 254 |
+
lines: 1,
|
| 255 |
+
max_lines: 20,
|
| 256 |
+
label: "output",
|
| 257 |
+
show_label: true,
|
| 258 |
+
container: true,
|
| 259 |
+
min_width: 160,
|
| 260 |
+
interactive: false,
|
| 261 |
+
visible: true,
|
| 262 |
+
autofocus: false,
|
| 263 |
+
autoscroll: true,
|
| 264 |
+
elem_classes: [],
|
| 265 |
+
type: "text",
|
| 266 |
+
rtl: false,
|
| 267 |
+
show_copy_button: false,
|
| 268 |
+
name: "textbox",
|
| 269 |
+
_selectable: false
|
| 270 |
+
},
|
| 271 |
+
skip_api: false,
|
| 272 |
+
component_class_id: "",
|
| 273 |
+
api_info: {
|
| 274 |
+
type: "string"
|
| 275 |
+
},
|
| 276 |
+
example_inputs: "Hello!!"
|
| 277 |
+
},
|
| 278 |
+
{
|
| 279 |
+
id: 11,
|
| 280 |
+
type: "row",
|
| 281 |
+
props: {
|
| 282 |
+
variant: "default",
|
| 283 |
+
visible: true,
|
| 284 |
+
equal_height: true,
|
| 285 |
+
name: "row"
|
| 286 |
+
},
|
| 287 |
+
skip_api: true,
|
| 288 |
+
component_class_id: ""
|
| 289 |
+
},
|
| 290 |
+
{
|
| 291 |
+
id: 12,
|
| 292 |
+
type: "form",
|
| 293 |
+
props: {
|
| 294 |
+
scale: 0,
|
| 295 |
+
min_width: 0,
|
| 296 |
+
name: "form"
|
| 297 |
+
},
|
| 298 |
+
skip_api: true,
|
| 299 |
+
component_class_id: ""
|
| 300 |
+
}
|
| 301 |
+
],
|
| 302 |
+
css: null,
|
| 303 |
+
js: null,
|
| 304 |
+
head: null,
|
| 305 |
+
title: "Gradio",
|
| 306 |
+
space_id: "hmb/hello_world",
|
| 307 |
+
enable_queue: true,
|
| 308 |
+
show_error: false,
|
| 309 |
+
footer_links: ["api", "gradio", "settings"],
|
| 310 |
+
is_colab: false,
|
| 311 |
+
stylesheets: [],
|
| 312 |
+
theme: "default",
|
| 313 |
+
protocol: "sse_v3",
|
| 314 |
+
body_css: {
|
| 315 |
+
body_background_fill: "white",
|
| 316 |
+
body_text_color: "#1f2937",
|
| 317 |
+
body_background_fill_dark: "#0b0f19",
|
| 318 |
+
body_text_color_dark: "#f3f4f6"
|
| 319 |
+
},
|
| 320 |
+
fill_height: false,
|
| 321 |
+
layout: {
|
| 322 |
+
id: 0,
|
| 323 |
+
children: [
|
| 324 |
+
{
|
| 325 |
+
id: 3,
|
| 326 |
+
children: [
|
| 327 |
+
{
|
| 328 |
+
id: 4,
|
| 329 |
+
children: [
|
| 330 |
+
{
|
| 331 |
+
id: 5,
|
| 332 |
+
children: [
|
| 333 |
+
{
|
| 334 |
+
id: 6,
|
| 335 |
+
children: [
|
| 336 |
+
{
|
| 337 |
+
id: 1
|
| 338 |
+
}
|
| 339 |
+
]
|
| 340 |
+
}
|
| 341 |
+
]
|
| 342 |
+
},
|
| 343 |
+
{
|
| 344 |
+
id: 7,
|
| 345 |
+
children: [
|
| 346 |
+
{
|
| 347 |
+
id: 8
|
| 348 |
+
},
|
| 349 |
+
{
|
| 350 |
+
id: 9
|
| 351 |
+
}
|
| 352 |
+
]
|
| 353 |
+
}
|
| 354 |
+
]
|
| 355 |
+
},
|
| 356 |
+
{
|
| 357 |
+
id: 10,
|
| 358 |
+
children: [
|
| 359 |
+
{
|
| 360 |
+
id: 12,
|
| 361 |
+
children: [
|
| 362 |
+
{
|
| 363 |
+
id: 2
|
| 364 |
+
}
|
| 365 |
+
]
|
| 366 |
+
},
|
| 367 |
+
{
|
| 368 |
+
id: 11,
|
| 369 |
+
children: []
|
| 370 |
+
}
|
| 371 |
+
]
|
| 372 |
+
}
|
| 373 |
+
]
|
| 374 |
+
}
|
| 375 |
+
]
|
| 376 |
+
},
|
| 377 |
+
dependencies: [
|
| 378 |
+
{
|
| 379 |
+
id: 0,
|
| 380 |
+
targets: [
|
| 381 |
+
[9, "click"],
|
| 382 |
+
[1, "submit"]
|
| 383 |
+
],
|
| 384 |
+
inputs: [1],
|
| 385 |
+
outputs: [2],
|
| 386 |
+
backend_fn: true,
|
| 387 |
+
js: null,
|
| 388 |
+
queue: null,
|
| 389 |
+
api_name: "predict",
|
| 390 |
+
scroll_to_output: false,
|
| 391 |
+
show_progress: "full",
|
| 392 |
+
every: null,
|
| 393 |
+
batch: false,
|
| 394 |
+
max_batch_size: 4,
|
| 395 |
+
cancels: [],
|
| 396 |
+
types: {
|
| 397 |
+
generator: false,
|
| 398 |
+
cancel: false
|
| 399 |
+
},
|
| 400 |
+
collects_event_data: false,
|
| 401 |
+
trigger_after: null,
|
| 402 |
+
trigger_only_on_success: false,
|
| 403 |
+
trigger_only_on_failure: false,
|
| 404 |
+
trigger_mode: "once",
|
| 405 |
+
api_visibility: "public",
|
| 406 |
+
zerogpu: false
|
| 407 |
+
},
|
| 408 |
+
{
|
| 409 |
+
id: 1,
|
| 410 |
+
targets: [[8, "click"]],
|
| 411 |
+
inputs: [],
|
| 412 |
+
outputs: [1, 2],
|
| 413 |
+
backend_fn: false,
|
| 414 |
+
js: "() => [null, null]",
|
| 415 |
+
queue: false,
|
| 416 |
+
api_name: "js_fn",
|
| 417 |
+
scroll_to_output: false,
|
| 418 |
+
show_progress: "full",
|
| 419 |
+
every: null,
|
| 420 |
+
batch: false,
|
| 421 |
+
max_batch_size: 4,
|
| 422 |
+
cancels: [],
|
| 423 |
+
types: {
|
| 424 |
+
generator: false,
|
| 425 |
+
cancel: false
|
| 426 |
+
},
|
| 427 |
+
collects_event_data: false,
|
| 428 |
+
trigger_after: null,
|
| 429 |
+
trigger_only_on_success: false,
|
| 430 |
+
trigger_only_on_failure: false,
|
| 431 |
+
trigger_mode: "once",
|
| 432 |
+
api_visibility: "private",
|
| 433 |
+
zerogpu: false
|
| 434 |
+
},
|
| 435 |
+
{
|
| 436 |
+
id: 2,
|
| 437 |
+
targets: [[8, "click"]],
|
| 438 |
+
inputs: [],
|
| 439 |
+
outputs: [5],
|
| 440 |
+
backend_fn: false,
|
| 441 |
+
js: '() => [{"variant": null, "visible": true, "__type__": "update"}]\n ',
|
| 442 |
+
queue: false,
|
| 443 |
+
api_name: "js_fn_1",
|
| 444 |
+
scroll_to_output: false,
|
| 445 |
+
show_progress: "full",
|
| 446 |
+
every: null,
|
| 447 |
+
batch: false,
|
| 448 |
+
max_batch_size: 4,
|
| 449 |
+
cancels: [],
|
| 450 |
+
types: {
|
| 451 |
+
generator: false,
|
| 452 |
+
cancel: false
|
| 453 |
+
},
|
| 454 |
+
collects_event_data: false,
|
| 455 |
+
trigger_after: null,
|
| 456 |
+
trigger_only_on_success: false,
|
| 457 |
+
trigger_only_on_failure: false,
|
| 458 |
+
trigger_mode: "once",
|
| 459 |
+
api_visibility: "private",
|
| 460 |
+
zerogpu: false
|
| 461 |
+
}
|
| 462 |
+
],
|
| 463 |
+
root: "https://hmb-hello-world.hf.space",
|
| 464 |
+
path: ""
|
| 465 |
+
};
|
| 466 |
+
|
| 467 |
+
export const whoami_response = {
|
| 468 |
+
type: "user",
|
| 469 |
+
id: "123",
|
| 470 |
+
name: "hmb",
|
| 471 |
+
fullname: "jerry",
|
| 472 |
+
email: "[email protected]",
|
| 473 |
+
emailVerified: true,
|
| 474 |
+
canPay: true,
|
| 475 |
+
periodEnd: 123,
|
| 476 |
+
isPro: false,
|
| 477 |
+
avatarUrl: "",
|
| 478 |
+
orgs: [],
|
| 479 |
+
auth: {
|
| 480 |
+
type: "access_token",
|
| 481 |
+
accessToken: {
|
| 482 |
+
displayName: "Gradio Client",
|
| 483 |
+
role: "write"
|
| 484 |
+
}
|
| 485 |
+
}
|
| 486 |
+
};
|
| 487 |
+
|
| 488 |
+
export const duplicate_response = {
|
| 489 |
+
url: "https://huggingface.co/spaces/hmb/hello_world"
|
| 490 |
+
};
|
| 491 |
+
|
| 492 |
+
export const hardware_sleeptime_response = {
|
| 493 |
+
stage: "RUNNING",
|
| 494 |
+
hardware: {
|
| 495 |
+
current: "cpu-basic",
|
| 496 |
+
requested: "cpu-upgrade"
|
| 497 |
+
},
|
| 498 |
+
storage: null,
|
| 499 |
+
gcTimeout: 300,
|
| 500 |
+
replicas: {
|
| 501 |
+
current: 1,
|
| 502 |
+
requested: 1
|
| 503 |
+
},
|
| 504 |
+
devMode: false,
|
| 505 |
+
domains: [
|
| 506 |
+
{
|
| 507 |
+
domain: "hmb-hello-world.hf.space",
|
| 508 |
+
isCustom: false,
|
| 509 |
+
stage: "READY"
|
| 510 |
+
}
|
| 511 |
+
]
|
| 512 |
+
};
|
| 513 |
+
|
| 514 |
+
export const endpoint_info: EndpointInfo<ApiData> = {
|
| 515 |
+
parameters: [
|
| 516 |
+
{
|
| 517 |
+
label: "parameter_2",
|
| 518 |
+
parameter_name: "im",
|
| 519 |
+
parameter_has_default: false,
|
| 520 |
+
parameter_default: null,
|
| 521 |
+
type: "",
|
| 522 |
+
python_type: {
|
| 523 |
+
type: "Dict(background: filepath | None, layers: List[filepath], composite: filepath | None, id: str | None)",
|
| 524 |
+
description: ""
|
| 525 |
+
},
|
| 526 |
+
component: "Imageeditor",
|
| 527 |
+
example_input: {
|
| 528 |
+
background: {
|
| 529 |
+
path: "",
|
| 530 |
+
meta: {
|
| 531 |
+
_type: "gradio.FileData"
|
| 532 |
+
},
|
| 533 |
+
orig_name: "bus.png",
|
| 534 |
+
url: ""
|
| 535 |
+
},
|
| 536 |
+
layers: [],
|
| 537 |
+
composite: null
|
| 538 |
+
}
|
| 539 |
+
}
|
| 540 |
+
],
|
| 541 |
+
returns: [
|
| 542 |
+
{
|
| 543 |
+
label: "value_3",
|
| 544 |
+
type: "string",
|
| 545 |
+
python_type: {
|
| 546 |
+
type: "filepath",
|
| 547 |
+
description: ""
|
| 548 |
+
},
|
| 549 |
+
component: "Image"
|
| 550 |
+
}
|
| 551 |
+
],
|
| 552 |
+
type: {
|
| 553 |
+
generator: false
|
| 554 |
+
}
|
| 555 |
+
};
|
| 556 |
+
|
| 557 |
+
export const discussions_response = {
|
| 558 |
+
discussions: [],
|
| 559 |
+
count: 0,
|
| 560 |
+
start: 0,
|
| 561 |
+
numClosedDiscussions: 0
|
| 562 |
+
};
|
6.1.1/client/src/types.ts
ADDED
|
@@ -0,0 +1,426 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// API Data Types
|
| 2 |
+
|
| 3 |
+
import { hardware_types } from "./helpers/spaces";
|
| 4 |
+
import type { SvelteComponent } from "svelte";
|
| 5 |
+
import type { ComponentType } from "svelte";
|
| 6 |
+
|
| 7 |
+
export interface ApiData {
|
| 8 |
+
label: string;
|
| 9 |
+
parameter_name: string;
|
| 10 |
+
parameter_default?: any;
|
| 11 |
+
parameter_has_default?: boolean;
|
| 12 |
+
type: {
|
| 13 |
+
type: any;
|
| 14 |
+
description: string;
|
| 15 |
+
};
|
| 16 |
+
component: string;
|
| 17 |
+
example_input?: any;
|
| 18 |
+
python_type: { type: string; description: string };
|
| 19 |
+
serializer: string;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
export interface JsApiData {
|
| 23 |
+
label: string;
|
| 24 |
+
parameter_name: string;
|
| 25 |
+
parameter_default?: any;
|
| 26 |
+
parameter_has_default?: boolean;
|
| 27 |
+
type: string;
|
| 28 |
+
description: string;
|
| 29 |
+
component: string;
|
| 30 |
+
example_input?: any;
|
| 31 |
+
serializer: string;
|
| 32 |
+
python_type: { type: string; description: string };
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
export interface EndpointInfo<T extends ApiData | JsApiData> {
|
| 36 |
+
parameters: T[];
|
| 37 |
+
returns: T[];
|
| 38 |
+
type?: DependencyTypes;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
export interface ApiInfo<T extends ApiData | JsApiData> {
|
| 42 |
+
named_endpoints: Record<string, EndpointInfo<T>>;
|
| 43 |
+
unnamed_endpoints: Record<string, EndpointInfo<T>>;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
export interface BlobRef {
|
| 47 |
+
path: string[];
|
| 48 |
+
type: string | undefined;
|
| 49 |
+
blob: Blob | File | false;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
export type DataType = string | Buffer | Record<string, any> | any[];
|
| 53 |
+
|
| 54 |
+
// custom class used for uploading local files
|
| 55 |
+
export class Command {
|
| 56 |
+
type: string;
|
| 57 |
+
command: string;
|
| 58 |
+
meta: {
|
| 59 |
+
path: string;
|
| 60 |
+
name: string;
|
| 61 |
+
orig_path: string;
|
| 62 |
+
};
|
| 63 |
+
fileData?: FileData;
|
| 64 |
+
|
| 65 |
+
constructor(
|
| 66 |
+
command: string,
|
| 67 |
+
meta: { path: string; name: string; orig_path: string }
|
| 68 |
+
) {
|
| 69 |
+
this.type = "command";
|
| 70 |
+
this.command = command;
|
| 71 |
+
this.meta = meta;
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
// Function Signature Types
|
| 76 |
+
|
| 77 |
+
export type SubmitFunction = (
|
| 78 |
+
endpoint: string | number,
|
| 79 |
+
data?: unknown[] | Record<string, unknown>,
|
| 80 |
+
event_data?: unknown,
|
| 81 |
+
trigger_id?: number | null
|
| 82 |
+
) => SubmitIterable<GradioEvent>;
|
| 83 |
+
|
| 84 |
+
export type PredictFunction = (
|
| 85 |
+
endpoint: string | number,
|
| 86 |
+
data?: unknown[] | Record<string, unknown>,
|
| 87 |
+
event_data?: unknown
|
| 88 |
+
) => Promise<PredictReturn>;
|
| 89 |
+
|
| 90 |
+
export type client_return = {
|
| 91 |
+
config: Config | undefined;
|
| 92 |
+
predict: PredictFunction;
|
| 93 |
+
submit: SubmitFunction;
|
| 94 |
+
component_server: (
|
| 95 |
+
component_id: number,
|
| 96 |
+
fn_name: string,
|
| 97 |
+
data: unknown[]
|
| 98 |
+
) => any;
|
| 99 |
+
view_api: (_fetch: typeof fetch) => Promise<ApiInfo<JsApiData>>;
|
| 100 |
+
};
|
| 101 |
+
|
| 102 |
+
export interface SubmitIterable<T> extends AsyncIterable<T> {
|
| 103 |
+
[Symbol.asyncIterator](): AsyncIterator<T>;
|
| 104 |
+
cancel: () => Promise<void>;
|
| 105 |
+
event_id: () => string;
|
| 106 |
+
send_chunk: (payload: Record<string, unknown>) => void;
|
| 107 |
+
wait_for_id: () => Promise<string | null>;
|
| 108 |
+
close_stream: () => void;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
export type PredictReturn = {
|
| 112 |
+
type: EventType;
|
| 113 |
+
time: Date;
|
| 114 |
+
data: unknown;
|
| 115 |
+
endpoint: string;
|
| 116 |
+
fn_index: number;
|
| 117 |
+
};
|
| 118 |
+
|
| 119 |
+
// Space Status Types
|
| 120 |
+
|
| 121 |
+
export type SpaceStatus = SpaceStatusNormal | SpaceStatusError;
|
| 122 |
+
|
| 123 |
+
export interface SpaceStatusNormal {
|
| 124 |
+
status:
|
| 125 |
+
| "sleeping"
|
| 126 |
+
| "running"
|
| 127 |
+
| "building"
|
| 128 |
+
| "error"
|
| 129 |
+
| "stopped"
|
| 130 |
+
| "starting";
|
| 131 |
+
detail:
|
| 132 |
+
| "SLEEPING"
|
| 133 |
+
| "RUNNING"
|
| 134 |
+
| "RUNNING_BUILDING"
|
| 135 |
+
| "BUILDING"
|
| 136 |
+
| "APP_STARTING"
|
| 137 |
+
| "NOT_FOUND";
|
| 138 |
+
load_status: "pending" | "error" | "complete" | "generating";
|
| 139 |
+
message: string;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
export interface SpaceStatusError {
|
| 143 |
+
status: "space_error" | "paused";
|
| 144 |
+
detail:
|
| 145 |
+
| "NO_APP_FILE"
|
| 146 |
+
| "CONFIG_ERROR"
|
| 147 |
+
| "BUILD_ERROR"
|
| 148 |
+
| "RUNTIME_ERROR"
|
| 149 |
+
| "PAUSED";
|
| 150 |
+
load_status: "error";
|
| 151 |
+
message: string;
|
| 152 |
+
discussions_enabled: boolean;
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
export type SpaceStatusCallback = (a: SpaceStatus) => void;
|
| 156 |
+
|
| 157 |
+
// Configuration and Response Types
|
| 158 |
+
// --------------------------------
|
| 159 |
+
export interface Config {
|
| 160 |
+
deep_link_state?: "none" | "valid" | "invalid";
|
| 161 |
+
auth_required?: true;
|
| 162 |
+
app_id?: string;
|
| 163 |
+
analytics_enabled: boolean;
|
| 164 |
+
connect_heartbeat: boolean;
|
| 165 |
+
dev_mode: boolean;
|
| 166 |
+
vibe_mode: boolean;
|
| 167 |
+
auth_message: string;
|
| 168 |
+
components: ComponentMeta[];
|
| 169 |
+
css: string | null;
|
| 170 |
+
js: string | null;
|
| 171 |
+
head: string | null;
|
| 172 |
+
dependencies: Dependency[];
|
| 173 |
+
enable_queue: boolean;
|
| 174 |
+
show_error: boolean;
|
| 175 |
+
layout: any;
|
| 176 |
+
mode: "blocks" | "interface" | "chat_interface";
|
| 177 |
+
root: string;
|
| 178 |
+
root_url?: string;
|
| 179 |
+
theme: string;
|
| 180 |
+
title: string;
|
| 181 |
+
version: string;
|
| 182 |
+
space_id: string | null;
|
| 183 |
+
is_space: boolean;
|
| 184 |
+
is_colab: boolean;
|
| 185 |
+
footer_links: string[];
|
| 186 |
+
stylesheets: string[];
|
| 187 |
+
current_page: string;
|
| 188 |
+
page: Record<
|
| 189 |
+
string,
|
| 190 |
+
{
|
| 191 |
+
components: number[];
|
| 192 |
+
dependencies: number[];
|
| 193 |
+
layout: any;
|
| 194 |
+
}
|
| 195 |
+
>;
|
| 196 |
+
pages: [string, string, boolean][];
|
| 197 |
+
protocol: "sse_v3" | "sse_v2.1" | "sse_v2" | "sse_v1" | "sse" | "ws";
|
| 198 |
+
max_file_size?: number;
|
| 199 |
+
theme_hash?: number;
|
| 200 |
+
username: string | null;
|
| 201 |
+
api_prefix?: string;
|
| 202 |
+
fill_height?: boolean;
|
| 203 |
+
fill_width?: boolean;
|
| 204 |
+
pwa?: boolean;
|
| 205 |
+
i18n_translations?: Record<string, Record<string, string>> | null;
|
| 206 |
+
mcp_server?: boolean;
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
// todo: DRY up types
|
| 210 |
+
export interface ComponentMeta {
|
| 211 |
+
type: string;
|
| 212 |
+
id: number;
|
| 213 |
+
has_modes: boolean;
|
| 214 |
+
props: SharedProps;
|
| 215 |
+
instance: SvelteComponent;
|
| 216 |
+
component: ComponentType<SvelteComponent>;
|
| 217 |
+
documentation?: Documentation;
|
| 218 |
+
children?: ComponentMeta[];
|
| 219 |
+
parent?: ComponentMeta;
|
| 220 |
+
value?: any;
|
| 221 |
+
component_class_id: string;
|
| 222 |
+
key: string | number | null;
|
| 223 |
+
rendered_in?: number;
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
interface SharedProps {
|
| 227 |
+
elem_id?: string;
|
| 228 |
+
elem_classes?: string[];
|
| 229 |
+
components?: string[];
|
| 230 |
+
server_fns?: string[];
|
| 231 |
+
interactive: boolean;
|
| 232 |
+
visible: boolean | "hidden";
|
| 233 |
+
[key: string]: unknown;
|
| 234 |
+
root_url?: string;
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
export interface Documentation {
|
| 238 |
+
type?: TypeDescription;
|
| 239 |
+
description?: TypeDescription;
|
| 240 |
+
example_data?: string;
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
interface TypeDescription {
|
| 244 |
+
input_payload?: string;
|
| 245 |
+
response_object?: string;
|
| 246 |
+
payload?: string;
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
export interface Dependency {
|
| 250 |
+
id: number;
|
| 251 |
+
targets: [number, string][];
|
| 252 |
+
inputs: number[];
|
| 253 |
+
outputs: number[];
|
| 254 |
+
backend_fn: boolean;
|
| 255 |
+
js: string | null;
|
| 256 |
+
scroll_to_output: boolean;
|
| 257 |
+
trigger: "click" | "load" | string;
|
| 258 |
+
max_batch_size: number;
|
| 259 |
+
show_progress: "full" | "minimal" | "hidden";
|
| 260 |
+
show_progress_on: number[] | null;
|
| 261 |
+
frontend_fn: ((...args: unknown[]) => Promise<unknown[]>) | null;
|
| 262 |
+
status?: string;
|
| 263 |
+
queue: boolean | null;
|
| 264 |
+
every: number | null;
|
| 265 |
+
batch: boolean;
|
| 266 |
+
api_name: string | null;
|
| 267 |
+
cancels: number[];
|
| 268 |
+
types: DependencyTypes;
|
| 269 |
+
collects_event_data: boolean;
|
| 270 |
+
pending_request?: boolean;
|
| 271 |
+
trigger_after?: number;
|
| 272 |
+
trigger_only_on_success?: boolean;
|
| 273 |
+
trigger_only_on_failure?: boolean;
|
| 274 |
+
trigger_mode: "once" | "multiple" | "always_last";
|
| 275 |
+
final_event: Payload | null;
|
| 276 |
+
api_visibility: "public" | "private" | "undocumented";
|
| 277 |
+
rendered_in: number | null;
|
| 278 |
+
render_id: number | null;
|
| 279 |
+
connection: "stream" | "sse";
|
| 280 |
+
time_limit: number;
|
| 281 |
+
stream_every: number;
|
| 282 |
+
like_user_message: boolean;
|
| 283 |
+
event_specific_args: string[];
|
| 284 |
+
component_prop_inputs: number[];
|
| 285 |
+
js_implementation: string | null;
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
export interface DependencyTypes {
|
| 289 |
+
generator: boolean;
|
| 290 |
+
cancel: boolean;
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
export interface Payload {
|
| 294 |
+
fn_index: number;
|
| 295 |
+
data: unknown[];
|
| 296 |
+
time?: Date;
|
| 297 |
+
event_data?: unknown;
|
| 298 |
+
trigger_id?: number | null;
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
export interface PostResponse {
|
| 302 |
+
error?: string;
|
| 303 |
+
[x: string]: any;
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
export interface UploadResponse {
|
| 307 |
+
error?: string;
|
| 308 |
+
files?: string[];
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
// Client and File Handling Types
|
| 312 |
+
|
| 313 |
+
export interface DuplicateOptions extends ClientOptions {
|
| 314 |
+
private?: boolean;
|
| 315 |
+
hardware?: (typeof hardware_types)[number];
|
| 316 |
+
timeout?: number;
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
export interface ClientOptions {
|
| 320 |
+
token?: `hf_${string}`;
|
| 321 |
+
status_callback?: SpaceStatusCallback | null;
|
| 322 |
+
auth?: [string, string] | null;
|
| 323 |
+
with_null_state?: boolean;
|
| 324 |
+
events?: EventType[];
|
| 325 |
+
headers?: Record<string, string>;
|
| 326 |
+
query_params?: Record<string, string>;
|
| 327 |
+
session_hash?: string;
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
export interface FileData {
|
| 331 |
+
name: string;
|
| 332 |
+
orig_name?: string;
|
| 333 |
+
size?: number;
|
| 334 |
+
data: string;
|
| 335 |
+
blob?: File;
|
| 336 |
+
is_file?: boolean;
|
| 337 |
+
mime_type?: string;
|
| 338 |
+
alt_text?: string;
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
// Event and Listener Types
|
| 342 |
+
|
| 343 |
+
export type EventType = "data" | "status" | "log" | "render";
|
| 344 |
+
|
| 345 |
+
export interface EventMap {
|
| 346 |
+
data: PayloadMessage;
|
| 347 |
+
status: StatusMessage;
|
| 348 |
+
log: LogMessage;
|
| 349 |
+
render: RenderMessage;
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
export type GradioEvent = {
|
| 353 |
+
[P in EventType]: EventMap[P];
|
| 354 |
+
}[EventType];
|
| 355 |
+
|
| 356 |
+
export interface Log {
|
| 357 |
+
log: string;
|
| 358 |
+
title: string;
|
| 359 |
+
level: "warning" | "info" | "success" | "error";
|
| 360 |
+
}
|
| 361 |
+
export interface Render {
|
| 362 |
+
data: {
|
| 363 |
+
components: any[];
|
| 364 |
+
layout: any;
|
| 365 |
+
dependencies: Dependency[];
|
| 366 |
+
render_id: number;
|
| 367 |
+
};
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
export interface ValidationError {
|
| 371 |
+
is_valid: boolean;
|
| 372 |
+
message: string;
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
export interface Status {
|
| 376 |
+
queue: boolean;
|
| 377 |
+
code?: string;
|
| 378 |
+
success?: boolean;
|
| 379 |
+
stage: "pending" | "error" | "complete" | "generating" | "streaming";
|
| 380 |
+
duration?: number;
|
| 381 |
+
visible?: boolean;
|
| 382 |
+
broken?: boolean;
|
| 383 |
+
size?: number;
|
| 384 |
+
position?: number;
|
| 385 |
+
eta?: number;
|
| 386 |
+
title?: string;
|
| 387 |
+
message?: string | ValidationError[];
|
| 388 |
+
progress_data?: {
|
| 389 |
+
progress: number | null;
|
| 390 |
+
index: number | null;
|
| 391 |
+
length: number | null;
|
| 392 |
+
unit: string | null;
|
| 393 |
+
desc: string | null;
|
| 394 |
+
}[];
|
| 395 |
+
time?: Date;
|
| 396 |
+
changed_state_ids?: number[];
|
| 397 |
+
time_limit?: number;
|
| 398 |
+
session_not_found?: boolean;
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
export interface StatusMessage extends Status {
|
| 402 |
+
type: "status";
|
| 403 |
+
endpoint: string;
|
| 404 |
+
fn_index: number;
|
| 405 |
+
original_msg?: string;
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
export interface PayloadMessage extends Payload {
|
| 409 |
+
type: "data";
|
| 410 |
+
endpoint: string;
|
| 411 |
+
fn_index: number;
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
export interface LogMessage extends Log {
|
| 415 |
+
type: "log";
|
| 416 |
+
endpoint: string;
|
| 417 |
+
fn_index: number;
|
| 418 |
+
duration: number | null;
|
| 419 |
+
visible: boolean;
|
| 420 |
+
}
|
| 421 |
+
|
| 422 |
+
export interface RenderMessage extends Render {
|
| 423 |
+
type: "render";
|
| 424 |
+
endpoint: string;
|
| 425 |
+
fn_index: number;
|
| 426 |
+
}
|
6.1.1/client/src/upload.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { Client } from "./client";
|
| 2 |
+
import { filesize } from "./utils/filesize";
|
| 3 |
+
export async function upload(
|
| 4 |
+
this: Client,
|
| 5 |
+
file_data: FileData[],
|
| 6 |
+
root_url: string,
|
| 7 |
+
upload_id?: string,
|
| 8 |
+
max_file_size?: number
|
| 9 |
+
): Promise<(FileData | null)[] | null> {
|
| 10 |
+
let files = (Array.isArray(file_data) ? file_data : [file_data]).map(
|
| 11 |
+
(file_data) => file_data.blob!
|
| 12 |
+
);
|
| 13 |
+
|
| 14 |
+
const oversized_files = files.filter(
|
| 15 |
+
(f) => f.size > (max_file_size ?? Infinity)
|
| 16 |
+
);
|
| 17 |
+
if (oversized_files.length) {
|
| 18 |
+
throw new Error(
|
| 19 |
+
`File(s) exceed the maximum allowed size of ${filesize(max_file_size || Infinity)}: ${oversized_files
|
| 20 |
+
.map((f) => `"${f.name}"`)
|
| 21 |
+
.join(", ")}`
|
| 22 |
+
);
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
return await Promise.all(
|
| 26 |
+
await this.upload_files(root_url, files, upload_id).then(
|
| 27 |
+
async (response: { files?: string[]; error?: string }) => {
|
| 28 |
+
if (response.error) {
|
| 29 |
+
throw new Error(response.error);
|
| 30 |
+
} else {
|
| 31 |
+
if (response.files) {
|
| 32 |
+
return response.files.map((f, i) => {
|
| 33 |
+
const file = new FileData({
|
| 34 |
+
...file_data[i],
|
| 35 |
+
path: f,
|
| 36 |
+
url: `${root_url}${this.api_prefix}/file=${f}`
|
| 37 |
+
});
|
| 38 |
+
return file;
|
| 39 |
+
});
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
return [];
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
)
|
| 46 |
+
);
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
export async function prepare_files(
|
| 50 |
+
files: File[],
|
| 51 |
+
is_stream?: boolean
|
| 52 |
+
): Promise<FileData[]> {
|
| 53 |
+
return files.map(
|
| 54 |
+
(f) =>
|
| 55 |
+
new FileData({
|
| 56 |
+
path: f.name,
|
| 57 |
+
orig_name: f.name,
|
| 58 |
+
blob: f,
|
| 59 |
+
size: f.size,
|
| 60 |
+
mime_type: f.type,
|
| 61 |
+
is_stream
|
| 62 |
+
})
|
| 63 |
+
);
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
export class FileData {
|
| 67 |
+
path: string;
|
| 68 |
+
url?: string;
|
| 69 |
+
orig_name?: string;
|
| 70 |
+
size?: number;
|
| 71 |
+
blob?: File;
|
| 72 |
+
is_stream?: boolean;
|
| 73 |
+
mime_type?: string;
|
| 74 |
+
alt_text?: string;
|
| 75 |
+
b64?: string;
|
| 76 |
+
readonly meta = { _type: "gradio.FileData" };
|
| 77 |
+
|
| 78 |
+
constructor({
|
| 79 |
+
path,
|
| 80 |
+
url,
|
| 81 |
+
orig_name,
|
| 82 |
+
size,
|
| 83 |
+
blob,
|
| 84 |
+
is_stream,
|
| 85 |
+
mime_type,
|
| 86 |
+
alt_text,
|
| 87 |
+
b64
|
| 88 |
+
}: {
|
| 89 |
+
path: string;
|
| 90 |
+
url?: string;
|
| 91 |
+
orig_name?: string;
|
| 92 |
+
size?: number;
|
| 93 |
+
blob?: File;
|
| 94 |
+
is_stream?: boolean;
|
| 95 |
+
mime_type?: string;
|
| 96 |
+
alt_text?: string;
|
| 97 |
+
b64?: string;
|
| 98 |
+
}) {
|
| 99 |
+
this.path = path;
|
| 100 |
+
this.url = url;
|
| 101 |
+
this.orig_name = orig_name;
|
| 102 |
+
this.size = size;
|
| 103 |
+
this.blob = url ? undefined : blob;
|
| 104 |
+
this.is_stream = is_stream;
|
| 105 |
+
this.mime_type = mime_type;
|
| 106 |
+
this.alt_text = alt_text;
|
| 107 |
+
this.b64 = b64;
|
| 108 |
+
}
|
| 109 |
+
}
|
6.1.1/client/src/utils/duplicate.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {
|
| 2 |
+
get_space_hardware,
|
| 3 |
+
hardware_types,
|
| 4 |
+
set_space_timeout
|
| 5 |
+
} from "../helpers/spaces";
|
| 6 |
+
import type { DuplicateOptions } from "../types";
|
| 7 |
+
import { Client } from "../client";
|
| 8 |
+
import { SPACE_METADATA_ERROR_MSG } from "../constants";
|
| 9 |
+
import {
|
| 10 |
+
get_cookie_header,
|
| 11 |
+
parse_and_set_cookies
|
| 12 |
+
} from "../helpers/init_helpers";
|
| 13 |
+
import { process_endpoint } from "../helpers/api_info";
|
| 14 |
+
|
| 15 |
+
export async function duplicate(
|
| 16 |
+
app_reference: string,
|
| 17 |
+
options: DuplicateOptions
|
| 18 |
+
): Promise<Client> {
|
| 19 |
+
const { token, private: _private, hardware, timeout, auth } = options;
|
| 20 |
+
|
| 21 |
+
if (hardware && !hardware_types.includes(hardware)) {
|
| 22 |
+
throw new Error(
|
| 23 |
+
`Invalid hardware type provided. Valid types are: ${hardware_types
|
| 24 |
+
.map((v) => `"${v}"`)
|
| 25 |
+
.join(",")}.`
|
| 26 |
+
);
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
const { http_protocol, host } = await process_endpoint(app_reference, token);
|
| 30 |
+
|
| 31 |
+
let cookies: string[] | null = null;
|
| 32 |
+
|
| 33 |
+
if (auth) {
|
| 34 |
+
const cookie_header = await get_cookie_header(
|
| 35 |
+
http_protocol,
|
| 36 |
+
host,
|
| 37 |
+
auth,
|
| 38 |
+
fetch
|
| 39 |
+
);
|
| 40 |
+
|
| 41 |
+
if (cookie_header) cookies = parse_and_set_cookies(cookie_header);
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
const headers = {
|
| 45 |
+
Authorization: `Bearer ${token}`,
|
| 46 |
+
"Content-Type": "application/json",
|
| 47 |
+
...(cookies ? { Cookie: cookies.join("; ") } : {})
|
| 48 |
+
};
|
| 49 |
+
|
| 50 |
+
const user = (
|
| 51 |
+
await (
|
| 52 |
+
await fetch(`https://huggingface.co/api/whoami-v2`, {
|
| 53 |
+
headers
|
| 54 |
+
})
|
| 55 |
+
).json()
|
| 56 |
+
).name;
|
| 57 |
+
|
| 58 |
+
const space_name = app_reference.split("/")[1];
|
| 59 |
+
const body: {
|
| 60 |
+
repository: string;
|
| 61 |
+
private?: boolean;
|
| 62 |
+
hardware?: string;
|
| 63 |
+
} = {
|
| 64 |
+
repository: `${user}/${space_name}`
|
| 65 |
+
};
|
| 66 |
+
|
| 67 |
+
if (_private) {
|
| 68 |
+
body.private = true;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
let original_hardware;
|
| 72 |
+
|
| 73 |
+
try {
|
| 74 |
+
if (!hardware) {
|
| 75 |
+
original_hardware = await get_space_hardware(app_reference, token);
|
| 76 |
+
}
|
| 77 |
+
} catch (e) {
|
| 78 |
+
throw Error(SPACE_METADATA_ERROR_MSG + (e as Error).message);
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
const requested_hardware = hardware || original_hardware || "cpu-basic";
|
| 82 |
+
|
| 83 |
+
body.hardware = requested_hardware;
|
| 84 |
+
|
| 85 |
+
try {
|
| 86 |
+
const response = await fetch(
|
| 87 |
+
`https://huggingface.co/api/spaces/${app_reference}/duplicate`,
|
| 88 |
+
{
|
| 89 |
+
method: "POST",
|
| 90 |
+
headers,
|
| 91 |
+
body: JSON.stringify(body)
|
| 92 |
+
}
|
| 93 |
+
);
|
| 94 |
+
|
| 95 |
+
if (response.status === 409) {
|
| 96 |
+
try {
|
| 97 |
+
const client = await Client.connect(`${user}/${space_name}`, options);
|
| 98 |
+
return client;
|
| 99 |
+
} catch (error) {
|
| 100 |
+
console.error("Failed to connect Client instance:", error);
|
| 101 |
+
throw error;
|
| 102 |
+
}
|
| 103 |
+
} else if (response.status !== 200) {
|
| 104 |
+
throw new Error(response.statusText);
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
const duplicated_space = await response.json();
|
| 108 |
+
|
| 109 |
+
await set_space_timeout(`${user}/${space_name}`, timeout || 300, token);
|
| 110 |
+
|
| 111 |
+
return await Client.connect(
|
| 112 |
+
get_space_reference(duplicated_space.url),
|
| 113 |
+
options
|
| 114 |
+
);
|
| 115 |
+
} catch (e: any) {
|
| 116 |
+
throw new Error(e);
|
| 117 |
+
}
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
function get_space_reference(url: string): any {
|
| 121 |
+
const regex = /https:\/\/huggingface.co\/spaces\/([^/]+\/[^/]+)/;
|
| 122 |
+
const match = url.match(regex);
|
| 123 |
+
if (match) {
|
| 124 |
+
return match[1];
|
| 125 |
+
}
|
| 126 |
+
}
|
6.1.1/client/src/utils/filesize.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
type SPEC = {
|
| 2 |
+
readonly radix: number;
|
| 3 |
+
readonly unit: string[];
|
| 4 |
+
};
|
| 5 |
+
|
| 6 |
+
const si = {
|
| 7 |
+
radix: 1e3,
|
| 8 |
+
unit: ["b", "kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", "Yb"]
|
| 9 |
+
};
|
| 10 |
+
const iec = {
|
| 11 |
+
radix: 1024,
|
| 12 |
+
unit: ["b", "Kib", "Mib", "Gib", "Tib", "Pib", "Eib", "Zib", "Yib"]
|
| 13 |
+
};
|
| 14 |
+
const jedec = {
|
| 15 |
+
radix: 1024,
|
| 16 |
+
unit: ["b", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", "Yb"]
|
| 17 |
+
};
|
| 18 |
+
|
| 19 |
+
export const SPECS: Record<string, SPEC> = {
|
| 20 |
+
si,
|
| 21 |
+
iec,
|
| 22 |
+
jedec
|
| 23 |
+
};
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* file size from https://github.com/hustcc/filesize.js
|
| 27 |
+
* @param bytes - The number of bytes to convert to human-readable format
|
| 28 |
+
* @param fixed - Number of decimal places to display (default: 1)
|
| 29 |
+
* @param spec - Size specification to use: "si", "iec", or "jedec" (default: "jedec")
|
| 30 |
+
* @returns Human-readable file size string
|
| 31 |
+
*/
|
| 32 |
+
export function filesize(bytes: number, fixed = 1, spec = "jedec"): string {
|
| 33 |
+
bytes = Math.abs(bytes);
|
| 34 |
+
const { radix, unit } = SPECS[spec] || SPECS.jedec;
|
| 35 |
+
let loop = 0;
|
| 36 |
+
while (bytes >= radix) {
|
| 37 |
+
bytes /= radix;
|
| 38 |
+
++loop;
|
| 39 |
+
}
|
| 40 |
+
return `${bytes.toFixed(fixed)} ${unit[loop]}`;
|
| 41 |
+
}
|
6.1.1/client/src/utils/handle_blob.ts
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { update_object, walk_and_store_blobs } from "../helpers/data";
|
| 2 |
+
import {
|
| 3 |
+
Command,
|
| 4 |
+
type ApiData,
|
| 5 |
+
type EndpointInfo,
|
| 6 |
+
type JsApiData
|
| 7 |
+
} from "../types";
|
| 8 |
+
import { FileData } from "../upload";
|
| 9 |
+
import type { Client } from "..";
|
| 10 |
+
import {
|
| 11 |
+
FILE_PROCESSING_ERROR_MSG,
|
| 12 |
+
NODEJS_FS_ERROR_MSG,
|
| 13 |
+
ROOT_URL_ERROR_MSG
|
| 14 |
+
} from "../constants";
|
| 15 |
+
|
| 16 |
+
export async function handle_blob(
|
| 17 |
+
this: Client,
|
| 18 |
+
endpoint: string,
|
| 19 |
+
data: unknown[],
|
| 20 |
+
api_info: EndpointInfo<JsApiData | ApiData>
|
| 21 |
+
): Promise<unknown[]> {
|
| 22 |
+
const self = this;
|
| 23 |
+
|
| 24 |
+
await process_local_file_commands(self, data);
|
| 25 |
+
|
| 26 |
+
const blobRefs = await walk_and_store_blobs(
|
| 27 |
+
data,
|
| 28 |
+
undefined,
|
| 29 |
+
[],
|
| 30 |
+
true,
|
| 31 |
+
api_info
|
| 32 |
+
);
|
| 33 |
+
|
| 34 |
+
const results = await Promise.all(
|
| 35 |
+
blobRefs.map(async ({ path, blob, type }) => {
|
| 36 |
+
if (!blob) return { path, type };
|
| 37 |
+
|
| 38 |
+
const response = await self.upload_files(endpoint, [blob]);
|
| 39 |
+
const file_url = response.files && response.files[0];
|
| 40 |
+
return {
|
| 41 |
+
path,
|
| 42 |
+
file_url,
|
| 43 |
+
type,
|
| 44 |
+
name:
|
| 45 |
+
typeof File !== "undefined" && blob instanceof File
|
| 46 |
+
? blob?.name
|
| 47 |
+
: undefined
|
| 48 |
+
};
|
| 49 |
+
})
|
| 50 |
+
);
|
| 51 |
+
|
| 52 |
+
results.forEach(({ path, file_url, type, name }) => {
|
| 53 |
+
if (type === "Gallery") {
|
| 54 |
+
update_object(data, file_url, path);
|
| 55 |
+
} else if (file_url) {
|
| 56 |
+
const file = new FileData({ path: file_url, orig_name: name });
|
| 57 |
+
update_object(data, file, path);
|
| 58 |
+
}
|
| 59 |
+
});
|
| 60 |
+
|
| 61 |
+
return data;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
export async function process_local_file_commands(
|
| 65 |
+
client: Client,
|
| 66 |
+
data: unknown[]
|
| 67 |
+
): Promise<void> {
|
| 68 |
+
const root = client.config?.root || client.config?.root_url;
|
| 69 |
+
|
| 70 |
+
if (!root) {
|
| 71 |
+
throw new Error(ROOT_URL_ERROR_MSG);
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
await recursively_process_commands(client, data);
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
async function recursively_process_commands(
|
| 78 |
+
client: Client,
|
| 79 |
+
data: any,
|
| 80 |
+
path: string[] = []
|
| 81 |
+
): Promise<void> {
|
| 82 |
+
for (const key in data) {
|
| 83 |
+
if (data[key] instanceof Command) {
|
| 84 |
+
await process_single_command(client, data, key);
|
| 85 |
+
} else if (typeof data[key] === "object" && data[key] !== null) {
|
| 86 |
+
await recursively_process_commands(client, data[key], [...path, key]);
|
| 87 |
+
}
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
async function process_single_command(
|
| 92 |
+
client: Client,
|
| 93 |
+
data: any,
|
| 94 |
+
key: string
|
| 95 |
+
): Promise<void> {
|
| 96 |
+
let cmd_item = data[key] as Command;
|
| 97 |
+
const root = client.config?.root || client.config?.root_url;
|
| 98 |
+
|
| 99 |
+
if (!root) {
|
| 100 |
+
throw new Error(ROOT_URL_ERROR_MSG);
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
try {
|
| 104 |
+
let fileBuffer: Buffer;
|
| 105 |
+
let fullPath: string;
|
| 106 |
+
|
| 107 |
+
// check if running in a Node.js environment
|
| 108 |
+
if (
|
| 109 |
+
typeof process !== "undefined" &&
|
| 110 |
+
process.versions &&
|
| 111 |
+
process.versions.node
|
| 112 |
+
) {
|
| 113 |
+
const fs = await import("fs/promises");
|
| 114 |
+
const path = await import("path");
|
| 115 |
+
|
| 116 |
+
fullPath = path.resolve(process.cwd(), cmd_item.meta.path);
|
| 117 |
+
fileBuffer = await fs.readFile(fullPath); // Read file from disk
|
| 118 |
+
} else {
|
| 119 |
+
throw new Error(NODEJS_FS_ERROR_MSG);
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
const file = new Blob([fileBuffer as any], {
|
| 123 |
+
type: "application/octet-stream"
|
| 124 |
+
});
|
| 125 |
+
|
| 126 |
+
const response = await client.upload_files(root, [file]);
|
| 127 |
+
|
| 128 |
+
const file_url = response.files && response.files[0];
|
| 129 |
+
|
| 130 |
+
if (file_url) {
|
| 131 |
+
const fileData = new FileData({
|
| 132 |
+
path: file_url,
|
| 133 |
+
orig_name: cmd_item.meta.name || ""
|
| 134 |
+
});
|
| 135 |
+
|
| 136 |
+
// replace the command object with the fileData object
|
| 137 |
+
data[key] = fileData;
|
| 138 |
+
}
|
| 139 |
+
} catch (error) {
|
| 140 |
+
console.error(FILE_PROCESSING_ERROR_MSG, error);
|
| 141 |
+
}
|
| 142 |
+
}
|
6.1.1/client/src/utils/post_data.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { BROKEN_CONNECTION_MSG } from "../constants";
|
| 2 |
+
import type { PostResponse } from "../types";
|
| 3 |
+
import { Client } from "..";
|
| 4 |
+
|
| 5 |
+
export async function post_data(
|
| 6 |
+
this: Client,
|
| 7 |
+
url: string,
|
| 8 |
+
body: unknown,
|
| 9 |
+
additional_headers?: any
|
| 10 |
+
): Promise<[PostResponse, number]> {
|
| 11 |
+
const headers: {
|
| 12 |
+
Authorization?: string;
|
| 13 |
+
"Content-Type": "application/json";
|
| 14 |
+
} = { "Content-Type": "application/json" };
|
| 15 |
+
if (this.options.token) {
|
| 16 |
+
headers.Authorization = `Bearer ${this.options.token}`;
|
| 17 |
+
}
|
| 18 |
+
try {
|
| 19 |
+
var response = await this.fetch(url, {
|
| 20 |
+
method: "POST",
|
| 21 |
+
body: JSON.stringify(body),
|
| 22 |
+
headers: { ...headers, ...additional_headers },
|
| 23 |
+
credentials: "include"
|
| 24 |
+
});
|
| 25 |
+
} catch (e) {
|
| 26 |
+
return [{ error: BROKEN_CONNECTION_MSG }, 500];
|
| 27 |
+
}
|
| 28 |
+
let output: PostResponse;
|
| 29 |
+
let status: number;
|
| 30 |
+
try {
|
| 31 |
+
output = await response.json();
|
| 32 |
+
status = response.status;
|
| 33 |
+
} catch (e) {
|
| 34 |
+
output = { error: `Could not parse server response: ${e}` };
|
| 35 |
+
status = 500;
|
| 36 |
+
}
|
| 37 |
+
return [output, status];
|
| 38 |
+
}
|
6.1.1/client/src/utils/predict.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Client } from "../client";
|
| 2 |
+
import type { Dependency, PredictReturn } from "../types";
|
| 3 |
+
|
| 4 |
+
export async function predict(
|
| 5 |
+
this: Client,
|
| 6 |
+
endpoint: string | number,
|
| 7 |
+
data: unknown[] | Record<string, unknown> = {}
|
| 8 |
+
): Promise<PredictReturn> {
|
| 9 |
+
let data_returned = false;
|
| 10 |
+
let status_complete = false;
|
| 11 |
+
let dependency: Dependency;
|
| 12 |
+
|
| 13 |
+
if (!this.config) {
|
| 14 |
+
throw new Error("Could not resolve app config");
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
if (typeof endpoint === "number") {
|
| 18 |
+
dependency = this.config.dependencies.find((dep) => dep.id == endpoint)!;
|
| 19 |
+
} else {
|
| 20 |
+
const trimmed_endpoint = endpoint.replace(/^\//, "");
|
| 21 |
+
dependency = this.config.dependencies.find(
|
| 22 |
+
(dep) => dep.id == this.api_map[trimmed_endpoint]
|
| 23 |
+
)!;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
return new Promise(async (resolve, reject) => {
|
| 27 |
+
const app = this.submit(endpoint, data, null, null, true);
|
| 28 |
+
let result: unknown;
|
| 29 |
+
|
| 30 |
+
for await (const message of app) {
|
| 31 |
+
if (message.type === "data") {
|
| 32 |
+
if (status_complete) {
|
| 33 |
+
resolve(result as PredictReturn);
|
| 34 |
+
}
|
| 35 |
+
data_returned = true;
|
| 36 |
+
result = message;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
if (message.type === "status") {
|
| 40 |
+
if (message.stage === "error") reject(message);
|
| 41 |
+
if (message.stage === "complete") {
|
| 42 |
+
status_complete = true;
|
| 43 |
+
// if complete message comes after data, resolve here
|
| 44 |
+
if (data_returned) {
|
| 45 |
+
resolve(result as PredictReturn);
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
});
|
| 51 |
+
}
|
6.1.1/client/src/utils/stream.ts
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { BROKEN_CONNECTION_MSG, SSE_URL } from "../constants";
|
| 2 |
+
import type { Client } from "../client";
|
| 3 |
+
import { stream } from "fetch-event-stream";
|
| 4 |
+
|
| 5 |
+
export async function open_stream(this: Client): Promise<void> {
|
| 6 |
+
let {
|
| 7 |
+
event_callbacks,
|
| 8 |
+
unclosed_events,
|
| 9 |
+
pending_stream_messages,
|
| 10 |
+
stream_status,
|
| 11 |
+
config,
|
| 12 |
+
jwt
|
| 13 |
+
} = this;
|
| 14 |
+
|
| 15 |
+
const that = this;
|
| 16 |
+
|
| 17 |
+
if (!config) {
|
| 18 |
+
throw new Error("Could not resolve app config");
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
stream_status.open = true;
|
| 22 |
+
|
| 23 |
+
let stream: EventSource | null = null;
|
| 24 |
+
let params = new URLSearchParams({
|
| 25 |
+
session_hash: this.session_hash
|
| 26 |
+
}).toString();
|
| 27 |
+
|
| 28 |
+
let url = new URL(`${config.root}${this.api_prefix}/${SSE_URL}?${params}`);
|
| 29 |
+
|
| 30 |
+
if (jwt) {
|
| 31 |
+
url.searchParams.set("__sign", jwt);
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
stream = this.stream(url);
|
| 35 |
+
|
| 36 |
+
if (!stream) {
|
| 37 |
+
console.warn("Cannot connect to SSE endpoint: " + url.toString());
|
| 38 |
+
return;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
stream.onmessage = async function (event: MessageEvent) {
|
| 42 |
+
let _data = JSON.parse(event.data);
|
| 43 |
+
if (_data.msg === "close_stream") {
|
| 44 |
+
close_stream(stream_status, that.abort_controller);
|
| 45 |
+
return;
|
| 46 |
+
}
|
| 47 |
+
const event_id = _data.event_id;
|
| 48 |
+
if (!event_id) {
|
| 49 |
+
await Promise.all(
|
| 50 |
+
Object.keys(event_callbacks).map((event_id) =>
|
| 51 |
+
event_callbacks[event_id](_data)
|
| 52 |
+
)
|
| 53 |
+
);
|
| 54 |
+
} else if (event_callbacks[event_id] && config) {
|
| 55 |
+
if (
|
| 56 |
+
_data.msg === "process_completed" &&
|
| 57 |
+
["sse", "sse_v1", "sse_v2", "sse_v2.1", "sse_v3"].includes(
|
| 58 |
+
config.protocol
|
| 59 |
+
)
|
| 60 |
+
) {
|
| 61 |
+
unclosed_events.delete(event_id);
|
| 62 |
+
}
|
| 63 |
+
let fn: (data: any) => void = event_callbacks[event_id];
|
| 64 |
+
|
| 65 |
+
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
| 66 |
+
// fn(_data); // need to do this to put the event on the end of the event loop, so the browser can refresh between callbacks and not freeze in case of quick generations. See
|
| 67 |
+
setTimeout(fn, 0, _data); // need to do this to put the event on the end of the event loop, so the browser can refresh between callbacks and not freeze in case of quick generations. See https://github.com/gradio-app/gradio/pull/7055
|
| 68 |
+
} else {
|
| 69 |
+
fn(_data);
|
| 70 |
+
}
|
| 71 |
+
} else {
|
| 72 |
+
if (!pending_stream_messages[event_id]) {
|
| 73 |
+
pending_stream_messages[event_id] = [];
|
| 74 |
+
}
|
| 75 |
+
pending_stream_messages[event_id].push(_data);
|
| 76 |
+
}
|
| 77 |
+
};
|
| 78 |
+
stream.onerror = async function (e) {
|
| 79 |
+
console.error(e);
|
| 80 |
+
await Promise.all(
|
| 81 |
+
Object.keys(event_callbacks).map((event_id) =>
|
| 82 |
+
event_callbacks[event_id]({
|
| 83 |
+
msg: "broken_connection",
|
| 84 |
+
message: BROKEN_CONNECTION_MSG
|
| 85 |
+
})
|
| 86 |
+
)
|
| 87 |
+
);
|
| 88 |
+
};
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
export function close_stream(
|
| 92 |
+
stream_status: { open: boolean },
|
| 93 |
+
abort_controller: AbortController | null
|
| 94 |
+
): void {
|
| 95 |
+
if (stream_status) {
|
| 96 |
+
stream_status.open = false;
|
| 97 |
+
abort_controller?.abort();
|
| 98 |
+
}
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
export function apply_diff_stream(
|
| 102 |
+
pending_diff_streams: Record<string, any[][]>,
|
| 103 |
+
event_id: string,
|
| 104 |
+
data: any
|
| 105 |
+
): void {
|
| 106 |
+
let is_first_generation = !pending_diff_streams[event_id];
|
| 107 |
+
if (is_first_generation) {
|
| 108 |
+
pending_diff_streams[event_id] = [];
|
| 109 |
+
data.data.forEach((value: any, i: number) => {
|
| 110 |
+
pending_diff_streams[event_id][i] = value;
|
| 111 |
+
});
|
| 112 |
+
} else {
|
| 113 |
+
data.data.forEach((value: any, i: number) => {
|
| 114 |
+
let new_data = apply_diff(pending_diff_streams[event_id][i], value);
|
| 115 |
+
pending_diff_streams[event_id][i] = new_data;
|
| 116 |
+
data.data[i] = new_data;
|
| 117 |
+
});
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
export function apply_diff(
|
| 122 |
+
obj: any,
|
| 123 |
+
diff: [string, (number | string)[], any][]
|
| 124 |
+
): any {
|
| 125 |
+
diff.forEach(([action, path, value]) => {
|
| 126 |
+
obj = apply_edit(obj, path, action, value);
|
| 127 |
+
});
|
| 128 |
+
|
| 129 |
+
return obj;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
function apply_edit(
|
| 133 |
+
target: any,
|
| 134 |
+
path: (number | string)[],
|
| 135 |
+
action: string,
|
| 136 |
+
value: any
|
| 137 |
+
): any {
|
| 138 |
+
if (path.length === 0) {
|
| 139 |
+
if (action === "replace") {
|
| 140 |
+
return value;
|
| 141 |
+
} else if (action === "append") {
|
| 142 |
+
return target + value;
|
| 143 |
+
}
|
| 144 |
+
throw new Error(`Unsupported action: ${action}`);
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
let current = target;
|
| 148 |
+
for (let i = 0; i < path.length - 1; i++) {
|
| 149 |
+
current = current[path[i]];
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
const last_path = path[path.length - 1];
|
| 153 |
+
switch (action) {
|
| 154 |
+
case "replace":
|
| 155 |
+
current[last_path] = value;
|
| 156 |
+
break;
|
| 157 |
+
case "append":
|
| 158 |
+
current[last_path] += value;
|
| 159 |
+
break;
|
| 160 |
+
case "add":
|
| 161 |
+
if (Array.isArray(current)) {
|
| 162 |
+
current.splice(Number(last_path), 0, value);
|
| 163 |
+
} else {
|
| 164 |
+
current[last_path] = value;
|
| 165 |
+
}
|
| 166 |
+
break;
|
| 167 |
+
case "delete":
|
| 168 |
+
if (Array.isArray(current)) {
|
| 169 |
+
current.splice(Number(last_path), 1);
|
| 170 |
+
} else {
|
| 171 |
+
delete current[last_path];
|
| 172 |
+
}
|
| 173 |
+
break;
|
| 174 |
+
default:
|
| 175 |
+
throw new Error(`Unknown action: ${action}`);
|
| 176 |
+
}
|
| 177 |
+
return target;
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
export function readable_stream(
|
| 181 |
+
input: RequestInfo | URL,
|
| 182 |
+
init: RequestInit = {}
|
| 183 |
+
): EventSource {
|
| 184 |
+
const instance: EventSource & { readyState: number } = {
|
| 185 |
+
close: () => {
|
| 186 |
+
console.warn("Method not implemented.");
|
| 187 |
+
},
|
| 188 |
+
onerror: null,
|
| 189 |
+
onmessage: null,
|
| 190 |
+
onopen: null,
|
| 191 |
+
readyState: 0,
|
| 192 |
+
url: input.toString(),
|
| 193 |
+
withCredentials: false,
|
| 194 |
+
CONNECTING: 0,
|
| 195 |
+
OPEN: 1,
|
| 196 |
+
CLOSED: 2,
|
| 197 |
+
addEventListener: () => {
|
| 198 |
+
throw new Error("Method not implemented.");
|
| 199 |
+
},
|
| 200 |
+
dispatchEvent: () => {
|
| 201 |
+
throw new Error("Method not implemented.");
|
| 202 |
+
},
|
| 203 |
+
removeEventListener: () => {
|
| 204 |
+
throw new Error("Method not implemented.");
|
| 205 |
+
}
|
| 206 |
+
};
|
| 207 |
+
|
| 208 |
+
stream(input, init)
|
| 209 |
+
.then(async (res) => {
|
| 210 |
+
instance.readyState = instance.OPEN;
|
| 211 |
+
try {
|
| 212 |
+
for await (const chunk of res) {
|
| 213 |
+
//@ts-ignore
|
| 214 |
+
instance.onmessage && instance.onmessage(chunk);
|
| 215 |
+
}
|
| 216 |
+
instance.readyState = instance.CLOSED;
|
| 217 |
+
} catch (e) {
|
| 218 |
+
instance.onerror && instance.onerror(e as Event);
|
| 219 |
+
instance.readyState = instance.CLOSED;
|
| 220 |
+
}
|
| 221 |
+
})
|
| 222 |
+
.catch((e) => {
|
| 223 |
+
console.error(e);
|
| 224 |
+
instance.onerror && instance.onerror(e as Event);
|
| 225 |
+
instance.readyState = instance.CLOSED;
|
| 226 |
+
});
|
| 227 |
+
|
| 228 |
+
return instance as EventSource;
|
| 229 |
+
}
|
6.1.1/client/src/utils/submit.ts
ADDED
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* eslint-disable complexity */
|
| 2 |
+
import type {
|
| 3 |
+
Status,
|
| 4 |
+
Payload,
|
| 5 |
+
GradioEvent,
|
| 6 |
+
JsApiData,
|
| 7 |
+
EndpointInfo,
|
| 8 |
+
ApiInfo,
|
| 9 |
+
Config,
|
| 10 |
+
Dependency,
|
| 11 |
+
SubmitIterable
|
| 12 |
+
} from "../types";
|
| 13 |
+
|
| 14 |
+
import { skip_queue, post_message, handle_payload } from "../helpers/data";
|
| 15 |
+
import {
|
| 16 |
+
handle_message,
|
| 17 |
+
map_data_to_params,
|
| 18 |
+
process_endpoint
|
| 19 |
+
} from "../helpers/api_info";
|
| 20 |
+
import {
|
| 21 |
+
BROKEN_CONNECTION_MSG,
|
| 22 |
+
QUEUE_FULL_MSG,
|
| 23 |
+
SSE_URL,
|
| 24 |
+
SSE_DATA_URL,
|
| 25 |
+
RESET_URL,
|
| 26 |
+
CANCEL_URL
|
| 27 |
+
} from "../constants";
|
| 28 |
+
import { apply_diff_stream, close_stream } from "./stream";
|
| 29 |
+
import { Client } from "../client";
|
| 30 |
+
|
| 31 |
+
export function submit(
|
| 32 |
+
this: Client,
|
| 33 |
+
endpoint: string | number,
|
| 34 |
+
data: unknown[] | Record<string, unknown> = {},
|
| 35 |
+
event_data?: unknown,
|
| 36 |
+
trigger_id?: number | null,
|
| 37 |
+
all_events?: boolean
|
| 38 |
+
): SubmitIterable<GradioEvent> {
|
| 39 |
+
try {
|
| 40 |
+
const { token } = this.options;
|
| 41 |
+
const {
|
| 42 |
+
fetch,
|
| 43 |
+
app_reference,
|
| 44 |
+
config,
|
| 45 |
+
session_hash,
|
| 46 |
+
api_info,
|
| 47 |
+
api_map,
|
| 48 |
+
stream_status,
|
| 49 |
+
pending_stream_messages,
|
| 50 |
+
pending_diff_streams,
|
| 51 |
+
event_callbacks,
|
| 52 |
+
unclosed_events,
|
| 53 |
+
post_data,
|
| 54 |
+
options,
|
| 55 |
+
api_prefix
|
| 56 |
+
} = this;
|
| 57 |
+
|
| 58 |
+
const that = this;
|
| 59 |
+
|
| 60 |
+
if (!api_info) throw new Error("No API found");
|
| 61 |
+
if (!config) throw new Error("Could not resolve app config");
|
| 62 |
+
|
| 63 |
+
let { fn_index, endpoint_info, dependency } = get_endpoint_info(
|
| 64 |
+
api_info,
|
| 65 |
+
endpoint,
|
| 66 |
+
api_map,
|
| 67 |
+
config
|
| 68 |
+
);
|
| 69 |
+
|
| 70 |
+
let resolved_data = map_data_to_params(data, endpoint_info);
|
| 71 |
+
|
| 72 |
+
let stream: EventSource | null;
|
| 73 |
+
let protocol = config.protocol ?? "ws";
|
| 74 |
+
if (protocol === "ws") {
|
| 75 |
+
throw new Error("WebSocket protocol is not supported in this version");
|
| 76 |
+
}
|
| 77 |
+
let event_id_final = "";
|
| 78 |
+
let event_id_cb: () => string = () => event_id_final;
|
| 79 |
+
|
| 80 |
+
const _endpoint = typeof endpoint === "number" ? "/predict" : endpoint;
|
| 81 |
+
let payload: Payload;
|
| 82 |
+
let event_id: string | null = null;
|
| 83 |
+
let complete: Status | undefined | false = false;
|
| 84 |
+
let last_status: Record<string, Status["stage"]> = {};
|
| 85 |
+
let url_params =
|
| 86 |
+
typeof window !== "undefined" && typeof document !== "undefined"
|
| 87 |
+
? new URLSearchParams(window.location.search).toString()
|
| 88 |
+
: "";
|
| 89 |
+
|
| 90 |
+
const events_to_publish =
|
| 91 |
+
options?.events?.reduce(
|
| 92 |
+
(acc, event) => {
|
| 93 |
+
acc[event] = true;
|
| 94 |
+
return acc;
|
| 95 |
+
},
|
| 96 |
+
{} as Record<string, boolean>
|
| 97 |
+
) || {};
|
| 98 |
+
|
| 99 |
+
// event subscription methods
|
| 100 |
+
function fire_event(event: GradioEvent): void {
|
| 101 |
+
if (all_events || events_to_publish[event.type]) {
|
| 102 |
+
push_event(event);
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
async function cancel(): Promise<void> {
|
| 107 |
+
let reset_request = {};
|
| 108 |
+
let cancel_request = {};
|
| 109 |
+
reset_request = { event_id };
|
| 110 |
+
cancel_request = { event_id, session_hash, fn_index };
|
| 111 |
+
|
| 112 |
+
try {
|
| 113 |
+
if (!config) {
|
| 114 |
+
throw new Error("Could not resolve app config");
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
if ("event_id" in cancel_request) {
|
| 118 |
+
await fetch(`${config.root}${api_prefix}/${CANCEL_URL}`, {
|
| 119 |
+
headers: { "Content-Type": "application/json" },
|
| 120 |
+
method: "POST",
|
| 121 |
+
body: JSON.stringify(cancel_request)
|
| 122 |
+
});
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
await fetch(`${config.root}${api_prefix}/${RESET_URL}`, {
|
| 126 |
+
headers: { "Content-Type": "application/json" },
|
| 127 |
+
method: "POST",
|
| 128 |
+
body: JSON.stringify(reset_request)
|
| 129 |
+
});
|
| 130 |
+
} catch (e) {
|
| 131 |
+
console.warn(
|
| 132 |
+
"The `/reset` endpoint could not be called. Subsequent endpoint results may be unreliable."
|
| 133 |
+
);
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
const resolve_heartbeat = async (config: Config): Promise<void> => {
|
| 138 |
+
await this._resolve_heartbeat(config);
|
| 139 |
+
};
|
| 140 |
+
|
| 141 |
+
async function handle_render_config(render_config: any): Promise<void> {
|
| 142 |
+
if (!config) return;
|
| 143 |
+
let render_id: number = render_config.render_id;
|
| 144 |
+
config.components = [
|
| 145 |
+
...config.components.filter((c) => c.props.rendered_in !== render_id),
|
| 146 |
+
...render_config.components
|
| 147 |
+
];
|
| 148 |
+
config.dependencies = [
|
| 149 |
+
...config.dependencies.filter((d) => d.rendered_in !== render_id),
|
| 150 |
+
...render_config.dependencies
|
| 151 |
+
];
|
| 152 |
+
const any_state = config.components.some((c) => c.type === "state");
|
| 153 |
+
const any_unload = config.dependencies.some((d) =>
|
| 154 |
+
d.targets.some((t) => t[1] === "unload")
|
| 155 |
+
);
|
| 156 |
+
config.connect_heartbeat = any_state || any_unload;
|
| 157 |
+
await resolve_heartbeat(config);
|
| 158 |
+
fire_event({
|
| 159 |
+
type: "render",
|
| 160 |
+
data: render_config,
|
| 161 |
+
endpoint: _endpoint,
|
| 162 |
+
fn_index
|
| 163 |
+
});
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
const job = this.handle_blob(
|
| 167 |
+
config.root,
|
| 168 |
+
resolved_data,
|
| 169 |
+
endpoint_info
|
| 170 |
+
).then(async (_payload) => {
|
| 171 |
+
let input_data = handle_payload(
|
| 172 |
+
_payload,
|
| 173 |
+
dependency,
|
| 174 |
+
config.components,
|
| 175 |
+
"input",
|
| 176 |
+
true
|
| 177 |
+
);
|
| 178 |
+
payload = {
|
| 179 |
+
data: input_data || [],
|
| 180 |
+
event_data,
|
| 181 |
+
fn_index,
|
| 182 |
+
trigger_id
|
| 183 |
+
};
|
| 184 |
+
if (skip_queue(fn_index, config)) {
|
| 185 |
+
fire_event({
|
| 186 |
+
type: "status",
|
| 187 |
+
endpoint: _endpoint,
|
| 188 |
+
stage: "pending",
|
| 189 |
+
queue: false,
|
| 190 |
+
fn_index,
|
| 191 |
+
time: new Date()
|
| 192 |
+
});
|
| 193 |
+
|
| 194 |
+
post_data(
|
| 195 |
+
`${config.root}${api_prefix}/run${
|
| 196 |
+
_endpoint.startsWith("/") ? _endpoint : `/${_endpoint}`
|
| 197 |
+
}${url_params ? "?" + url_params : ""}`,
|
| 198 |
+
{
|
| 199 |
+
...payload,
|
| 200 |
+
session_hash
|
| 201 |
+
}
|
| 202 |
+
)
|
| 203 |
+
.then(async ([output, status_code]: any) => {
|
| 204 |
+
const data = output.data;
|
| 205 |
+
|
| 206 |
+
if (status_code == 200) {
|
| 207 |
+
fire_event({
|
| 208 |
+
type: "data",
|
| 209 |
+
endpoint: _endpoint,
|
| 210 |
+
fn_index,
|
| 211 |
+
data: handle_payload(
|
| 212 |
+
data,
|
| 213 |
+
dependency,
|
| 214 |
+
config.components,
|
| 215 |
+
"output",
|
| 216 |
+
options.with_null_state
|
| 217 |
+
),
|
| 218 |
+
time: new Date(),
|
| 219 |
+
event_data,
|
| 220 |
+
trigger_id
|
| 221 |
+
});
|
| 222 |
+
if (output.render_config) {
|
| 223 |
+
await handle_render_config(output.render_config);
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
fire_event({
|
| 227 |
+
type: "status",
|
| 228 |
+
endpoint: _endpoint,
|
| 229 |
+
fn_index,
|
| 230 |
+
stage: "complete",
|
| 231 |
+
eta: output.average_duration,
|
| 232 |
+
queue: false,
|
| 233 |
+
time: new Date()
|
| 234 |
+
});
|
| 235 |
+
} else {
|
| 236 |
+
fire_event({
|
| 237 |
+
type: "status",
|
| 238 |
+
stage: "error",
|
| 239 |
+
endpoint: _endpoint,
|
| 240 |
+
fn_index,
|
| 241 |
+
message: output.error,
|
| 242 |
+
queue: false,
|
| 243 |
+
time: new Date()
|
| 244 |
+
});
|
| 245 |
+
}
|
| 246 |
+
})
|
| 247 |
+
.catch((e) => {
|
| 248 |
+
fire_event({
|
| 249 |
+
type: "status",
|
| 250 |
+
stage: "error",
|
| 251 |
+
message: e.message,
|
| 252 |
+
endpoint: _endpoint,
|
| 253 |
+
fn_index,
|
| 254 |
+
queue: false,
|
| 255 |
+
time: new Date()
|
| 256 |
+
});
|
| 257 |
+
});
|
| 258 |
+
} else if (protocol == "sse") {
|
| 259 |
+
fire_event({
|
| 260 |
+
type: "status",
|
| 261 |
+
stage: "pending",
|
| 262 |
+
queue: true,
|
| 263 |
+
endpoint: _endpoint,
|
| 264 |
+
fn_index,
|
| 265 |
+
time: new Date()
|
| 266 |
+
});
|
| 267 |
+
var params = new URLSearchParams({
|
| 268 |
+
fn_index: fn_index.toString(),
|
| 269 |
+
session_hash: session_hash
|
| 270 |
+
}).toString();
|
| 271 |
+
let url = new URL(
|
| 272 |
+
`${config.root}${api_prefix}/${SSE_URL}?${
|
| 273 |
+
url_params ? url_params + "&" : ""
|
| 274 |
+
}${params}`
|
| 275 |
+
);
|
| 276 |
+
|
| 277 |
+
if (this.jwt) {
|
| 278 |
+
url.searchParams.set("__sign", this.jwt);
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
stream = this.stream(url);
|
| 282 |
+
|
| 283 |
+
if (!stream) {
|
| 284 |
+
return Promise.reject(
|
| 285 |
+
new Error("Cannot connect to SSE endpoint: " + url.toString())
|
| 286 |
+
);
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
stream.onmessage = async function (event: MessageEvent) {
|
| 290 |
+
const _data = JSON.parse(event.data);
|
| 291 |
+
const { type, status, data } = handle_message(
|
| 292 |
+
_data,
|
| 293 |
+
last_status[fn_index]
|
| 294 |
+
);
|
| 295 |
+
|
| 296 |
+
if (type === "update" && status && !complete) {
|
| 297 |
+
// call 'status' listeners
|
| 298 |
+
fire_event({
|
| 299 |
+
type: "status",
|
| 300 |
+
endpoint: _endpoint,
|
| 301 |
+
fn_index,
|
| 302 |
+
time: new Date(),
|
| 303 |
+
...status
|
| 304 |
+
});
|
| 305 |
+
if (status.stage === "error") {
|
| 306 |
+
stream?.close();
|
| 307 |
+
close();
|
| 308 |
+
}
|
| 309 |
+
} else if (type === "data") {
|
| 310 |
+
let [_, status] = await post_data(
|
| 311 |
+
`${config.root}${api_prefix}/queue/data`,
|
| 312 |
+
{
|
| 313 |
+
...payload,
|
| 314 |
+
session_hash,
|
| 315 |
+
event_id
|
| 316 |
+
}
|
| 317 |
+
);
|
| 318 |
+
if (status !== 200) {
|
| 319 |
+
fire_event({
|
| 320 |
+
type: "status",
|
| 321 |
+
stage: "error",
|
| 322 |
+
message: BROKEN_CONNECTION_MSG,
|
| 323 |
+
queue: true,
|
| 324 |
+
endpoint: _endpoint,
|
| 325 |
+
fn_index,
|
| 326 |
+
time: new Date()
|
| 327 |
+
});
|
| 328 |
+
stream?.close();
|
| 329 |
+
close();
|
| 330 |
+
}
|
| 331 |
+
} else if (type === "complete") {
|
| 332 |
+
complete = status;
|
| 333 |
+
} else if (type === "log") {
|
| 334 |
+
fire_event({
|
| 335 |
+
type: "log",
|
| 336 |
+
title: data.title,
|
| 337 |
+
log: data.log,
|
| 338 |
+
level: data.level,
|
| 339 |
+
endpoint: _endpoint,
|
| 340 |
+
duration: data.duration,
|
| 341 |
+
visible: data.visible,
|
| 342 |
+
fn_index
|
| 343 |
+
});
|
| 344 |
+
} else if (type === "generating" || type === "streaming") {
|
| 345 |
+
fire_event({
|
| 346 |
+
type: "status",
|
| 347 |
+
time: new Date(),
|
| 348 |
+
...status,
|
| 349 |
+
stage: status?.stage!,
|
| 350 |
+
queue: true,
|
| 351 |
+
endpoint: _endpoint,
|
| 352 |
+
fn_index
|
| 353 |
+
});
|
| 354 |
+
}
|
| 355 |
+
if (data) {
|
| 356 |
+
fire_event({
|
| 357 |
+
type: "data",
|
| 358 |
+
time: new Date(),
|
| 359 |
+
data: handle_payload(
|
| 360 |
+
data.data,
|
| 361 |
+
dependency,
|
| 362 |
+
config.components,
|
| 363 |
+
"output",
|
| 364 |
+
options.with_null_state
|
| 365 |
+
),
|
| 366 |
+
endpoint: _endpoint,
|
| 367 |
+
fn_index,
|
| 368 |
+
event_data,
|
| 369 |
+
trigger_id
|
| 370 |
+
});
|
| 371 |
+
|
| 372 |
+
if (complete) {
|
| 373 |
+
fire_event({
|
| 374 |
+
type: "status",
|
| 375 |
+
time: new Date(),
|
| 376 |
+
...complete,
|
| 377 |
+
stage: status?.stage!,
|
| 378 |
+
queue: true,
|
| 379 |
+
endpoint: _endpoint,
|
| 380 |
+
fn_index
|
| 381 |
+
});
|
| 382 |
+
stream?.close();
|
| 383 |
+
close();
|
| 384 |
+
}
|
| 385 |
+
}
|
| 386 |
+
};
|
| 387 |
+
} else if (
|
| 388 |
+
protocol == "sse_v1" ||
|
| 389 |
+
protocol == "sse_v2" ||
|
| 390 |
+
protocol == "sse_v2.1" ||
|
| 391 |
+
protocol == "sse_v3"
|
| 392 |
+
) {
|
| 393 |
+
// latest API format. v2 introduces sending diffs for intermediate outputs in generative functions, which makes payloads lighter.
|
| 394 |
+
// v3 only closes the stream when the backend sends the close stream message.
|
| 395 |
+
fire_event({
|
| 396 |
+
type: "status",
|
| 397 |
+
stage: "pending",
|
| 398 |
+
queue: true,
|
| 399 |
+
endpoint: _endpoint,
|
| 400 |
+
fn_index,
|
| 401 |
+
time: new Date()
|
| 402 |
+
});
|
| 403 |
+
let hostname = "";
|
| 404 |
+
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
| 405 |
+
hostname = window?.location?.hostname;
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
let hfhubdev = "dev.spaces.huggingface.tech";
|
| 409 |
+
const origin = hostname.includes(".dev.")
|
| 410 |
+
? `https://moon-${hostname.split(".")[1]}.${hfhubdev}`
|
| 411 |
+
: `https://huggingface.co`;
|
| 412 |
+
|
| 413 |
+
const is_zerogpu_iframe =
|
| 414 |
+
typeof window !== "undefined" &&
|
| 415 |
+
typeof document !== "undefined" &&
|
| 416 |
+
window.parent != window &&
|
| 417 |
+
window.supports_zerogpu_headers;
|
| 418 |
+
const zerogpu_auth_promise = is_zerogpu_iframe
|
| 419 |
+
? post_message<Map<string, string>>("zerogpu-headers", origin)
|
| 420 |
+
: Promise.resolve(null);
|
| 421 |
+
const post_data_promise = zerogpu_auth_promise.then((headers) => {
|
| 422 |
+
return post_data(
|
| 423 |
+
`${config.root}${api_prefix}/${SSE_DATA_URL}?${url_params}`,
|
| 424 |
+
{
|
| 425 |
+
...payload,
|
| 426 |
+
session_hash
|
| 427 |
+
},
|
| 428 |
+
headers
|
| 429 |
+
);
|
| 430 |
+
});
|
| 431 |
+
|
| 432 |
+
return post_data_promise.then(async ([response, status]: any) => {
|
| 433 |
+
if (response.event_id) {
|
| 434 |
+
event_id_final = response.event_id as string;
|
| 435 |
+
}
|
| 436 |
+
|
| 437 |
+
if (status === 503) {
|
| 438 |
+
fire_event({
|
| 439 |
+
type: "status",
|
| 440 |
+
stage: "error",
|
| 441 |
+
message: QUEUE_FULL_MSG,
|
| 442 |
+
queue: true,
|
| 443 |
+
endpoint: _endpoint,
|
| 444 |
+
fn_index,
|
| 445 |
+
time: new Date(),
|
| 446 |
+
visible: true
|
| 447 |
+
});
|
| 448 |
+
} else if (status === 422) {
|
| 449 |
+
fire_event({
|
| 450 |
+
type: "status",
|
| 451 |
+
stage: "error",
|
| 452 |
+
message: response.detail,
|
| 453 |
+
queue: true,
|
| 454 |
+
endpoint: _endpoint,
|
| 455 |
+
fn_index,
|
| 456 |
+
code: "validation_error",
|
| 457 |
+
time: new Date(),
|
| 458 |
+
visible: true
|
| 459 |
+
});
|
| 460 |
+
close();
|
| 461 |
+
} else if (status !== 200) {
|
| 462 |
+
fire_event({
|
| 463 |
+
type: "status",
|
| 464 |
+
stage: "error",
|
| 465 |
+
broken: false,
|
| 466 |
+
message: response.detail,
|
| 467 |
+
queue: true,
|
| 468 |
+
endpoint: _endpoint,
|
| 469 |
+
fn_index,
|
| 470 |
+
time: new Date(),
|
| 471 |
+
visible: true
|
| 472 |
+
});
|
| 473 |
+
} else {
|
| 474 |
+
event_id = response.event_id as string;
|
| 475 |
+
event_id_final = event_id;
|
| 476 |
+
let callback = async function (_data: object): Promise<void> {
|
| 477 |
+
try {
|
| 478 |
+
const { type, status, data, original_msg } = handle_message(
|
| 479 |
+
_data,
|
| 480 |
+
last_status[fn_index]
|
| 481 |
+
);
|
| 482 |
+
|
| 483 |
+
if (type == "heartbeat") {
|
| 484 |
+
return;
|
| 485 |
+
}
|
| 486 |
+
|
| 487 |
+
if (type === "update" && status && !complete) {
|
| 488 |
+
// call 'status' listeners
|
| 489 |
+
fire_event({
|
| 490 |
+
type: "status",
|
| 491 |
+
endpoint: _endpoint,
|
| 492 |
+
fn_index,
|
| 493 |
+
time: new Date(),
|
| 494 |
+
original_msg: original_msg,
|
| 495 |
+
...status
|
| 496 |
+
});
|
| 497 |
+
} else if (type === "complete") {
|
| 498 |
+
complete = status;
|
| 499 |
+
} else if (
|
| 500 |
+
type == "unexpected_error" ||
|
| 501 |
+
type == "broken_connection"
|
| 502 |
+
) {
|
| 503 |
+
console.error("Unexpected error", status?.message);
|
| 504 |
+
const broken = type === "broken_connection";
|
| 505 |
+
fire_event({
|
| 506 |
+
type: "status",
|
| 507 |
+
stage: "error",
|
| 508 |
+
message: status?.message || "An Unexpected Error Occurred!",
|
| 509 |
+
queue: true,
|
| 510 |
+
endpoint: _endpoint,
|
| 511 |
+
broken,
|
| 512 |
+
session_not_found: status?.session_not_found,
|
| 513 |
+
fn_index,
|
| 514 |
+
time: new Date()
|
| 515 |
+
});
|
| 516 |
+
} else if (type === "log") {
|
| 517 |
+
fire_event({
|
| 518 |
+
type: "log",
|
| 519 |
+
title: data.title,
|
| 520 |
+
log: data.log,
|
| 521 |
+
level: data.level,
|
| 522 |
+
endpoint: _endpoint,
|
| 523 |
+
duration: data.duration,
|
| 524 |
+
visible: data.visible,
|
| 525 |
+
fn_index
|
| 526 |
+
});
|
| 527 |
+
return;
|
| 528 |
+
} else if (type === "generating" || type === "streaming") {
|
| 529 |
+
fire_event({
|
| 530 |
+
type: "status",
|
| 531 |
+
time: new Date(),
|
| 532 |
+
...status,
|
| 533 |
+
stage: status?.stage!,
|
| 534 |
+
queue: true,
|
| 535 |
+
endpoint: _endpoint,
|
| 536 |
+
fn_index
|
| 537 |
+
});
|
| 538 |
+
if (
|
| 539 |
+
data &&
|
| 540 |
+
dependency.connection !== "stream" &&
|
| 541 |
+
["sse_v2", "sse_v2.1", "sse_v3"].includes(protocol)
|
| 542 |
+
) {
|
| 543 |
+
apply_diff_stream(pending_diff_streams, event_id!, data);
|
| 544 |
+
}
|
| 545 |
+
}
|
| 546 |
+
if (data) {
|
| 547 |
+
fire_event({
|
| 548 |
+
type: "data",
|
| 549 |
+
time: new Date(),
|
| 550 |
+
data: handle_payload(
|
| 551 |
+
data.data,
|
| 552 |
+
dependency,
|
| 553 |
+
config.components,
|
| 554 |
+
"output",
|
| 555 |
+
options.with_null_state
|
| 556 |
+
),
|
| 557 |
+
endpoint: _endpoint,
|
| 558 |
+
fn_index
|
| 559 |
+
});
|
| 560 |
+
if (data.render_config) {
|
| 561 |
+
await handle_render_config(data.render_config);
|
| 562 |
+
}
|
| 563 |
+
|
| 564 |
+
if (complete) {
|
| 565 |
+
fire_event({
|
| 566 |
+
type: "status",
|
| 567 |
+
time: new Date(),
|
| 568 |
+
...complete,
|
| 569 |
+
stage: status?.stage!,
|
| 570 |
+
queue: true,
|
| 571 |
+
endpoint: _endpoint,
|
| 572 |
+
fn_index
|
| 573 |
+
});
|
| 574 |
+
close();
|
| 575 |
+
}
|
| 576 |
+
}
|
| 577 |
+
|
| 578 |
+
if (status?.stage === "complete" || status?.stage === "error") {
|
| 579 |
+
if (event_callbacks[event_id!]) {
|
| 580 |
+
delete event_callbacks[event_id!];
|
| 581 |
+
}
|
| 582 |
+
if (event_id! in pending_diff_streams) {
|
| 583 |
+
delete pending_diff_streams[event_id!];
|
| 584 |
+
}
|
| 585 |
+
}
|
| 586 |
+
} catch (e) {
|
| 587 |
+
console.error("Unexpected client exception", e);
|
| 588 |
+
fire_event({
|
| 589 |
+
type: "status",
|
| 590 |
+
stage: "error",
|
| 591 |
+
message: "An Unexpected Error Occurred!",
|
| 592 |
+
queue: true,
|
| 593 |
+
endpoint: _endpoint,
|
| 594 |
+
fn_index,
|
| 595 |
+
time: new Date()
|
| 596 |
+
});
|
| 597 |
+
if (["sse_v2", "sse_v2.1", "sse_v3"].includes(protocol)) {
|
| 598 |
+
close_stream(stream_status, that.abort_controller);
|
| 599 |
+
stream_status.open = false;
|
| 600 |
+
close();
|
| 601 |
+
}
|
| 602 |
+
}
|
| 603 |
+
};
|
| 604 |
+
|
| 605 |
+
if (event_id in pending_stream_messages) {
|
| 606 |
+
pending_stream_messages[event_id].forEach((msg) => callback(msg));
|
| 607 |
+
delete pending_stream_messages[event_id];
|
| 608 |
+
}
|
| 609 |
+
// @ts-ignore
|
| 610 |
+
event_callbacks[event_id] = callback;
|
| 611 |
+
unclosed_events.add(event_id);
|
| 612 |
+
if (!stream_status.open) {
|
| 613 |
+
await this.open_stream();
|
| 614 |
+
}
|
| 615 |
+
}
|
| 616 |
+
});
|
| 617 |
+
}
|
| 618 |
+
});
|
| 619 |
+
|
| 620 |
+
let done = false;
|
| 621 |
+
const values: (IteratorResult<GradioEvent> | PromiseLike<never>)[] = [];
|
| 622 |
+
const resolvers: ((
|
| 623 |
+
value: IteratorResult<GradioEvent> | PromiseLike<never>
|
| 624 |
+
) => void)[] = [];
|
| 625 |
+
|
| 626 |
+
function close(): void {
|
| 627 |
+
done = true;
|
| 628 |
+
while (resolvers.length > 0)
|
| 629 |
+
(resolvers.shift() as (typeof resolvers)[0])({
|
| 630 |
+
value: undefined,
|
| 631 |
+
done: true
|
| 632 |
+
});
|
| 633 |
+
}
|
| 634 |
+
|
| 635 |
+
function push(
|
| 636 |
+
data: { value: GradioEvent; done: boolean } | PromiseLike<never>
|
| 637 |
+
): void {
|
| 638 |
+
if (resolvers.length > 0) {
|
| 639 |
+
(resolvers.shift() as (typeof resolvers)[0])(data);
|
| 640 |
+
} else {
|
| 641 |
+
values.push(data);
|
| 642 |
+
}
|
| 643 |
+
}
|
| 644 |
+
|
| 645 |
+
function push_error(error: unknown): void {
|
| 646 |
+
push(thenable_reject(error));
|
| 647 |
+
close();
|
| 648 |
+
}
|
| 649 |
+
|
| 650 |
+
function push_event(event: GradioEvent): void {
|
| 651 |
+
push({ value: event, done: false });
|
| 652 |
+
}
|
| 653 |
+
|
| 654 |
+
function next(): Promise<IteratorResult<GradioEvent, unknown>> {
|
| 655 |
+
if (values.length > 0) {
|
| 656 |
+
return Promise.resolve(values.shift() as (typeof values)[0]);
|
| 657 |
+
}
|
| 658 |
+
return new Promise((resolve) => resolvers.push(resolve));
|
| 659 |
+
}
|
| 660 |
+
|
| 661 |
+
const iterator = {
|
| 662 |
+
[Symbol.asyncIterator]: () => iterator,
|
| 663 |
+
next,
|
| 664 |
+
throw: async (value: unknown) => {
|
| 665 |
+
push_error(value);
|
| 666 |
+
return next();
|
| 667 |
+
},
|
| 668 |
+
return: async () => {
|
| 669 |
+
close();
|
| 670 |
+
return { value: undefined, done: true as const };
|
| 671 |
+
},
|
| 672 |
+
cancel,
|
| 673 |
+
send_chunk: (payload: Record<string, unknown>) => {
|
| 674 |
+
this.post_data(`${config.root}${api_prefix}/stream/${event_id_final}`, {
|
| 675 |
+
...payload,
|
| 676 |
+
session_hash: this.session_hash
|
| 677 |
+
});
|
| 678 |
+
},
|
| 679 |
+
close_stream: () => {
|
| 680 |
+
this.post_data(
|
| 681 |
+
`${config.root}${api_prefix}/stream/${event_id_final}/close`,
|
| 682 |
+
{}
|
| 683 |
+
);
|
| 684 |
+
|
| 685 |
+
close();
|
| 686 |
+
},
|
| 687 |
+
event_id: () => event_id_final,
|
| 688 |
+
wait_for_id: async () => {
|
| 689 |
+
await job;
|
| 690 |
+
return event_id;
|
| 691 |
+
}
|
| 692 |
+
};
|
| 693 |
+
|
| 694 |
+
return iterator;
|
| 695 |
+
} catch (error) {
|
| 696 |
+
console.error("Submit function encountered an error:", error);
|
| 697 |
+
throw error;
|
| 698 |
+
}
|
| 699 |
+
}
|
| 700 |
+
|
| 701 |
+
function thenable_reject<T>(error: T): PromiseLike<never> {
|
| 702 |
+
return {
|
| 703 |
+
then: (
|
| 704 |
+
resolve: (value: never) => PromiseLike<never>,
|
| 705 |
+
reject: (error: T) => PromiseLike<never>
|
| 706 |
+
) => reject(error)
|
| 707 |
+
};
|
| 708 |
+
}
|
| 709 |
+
|
| 710 |
+
function get_endpoint_info(
|
| 711 |
+
api_info: ApiInfo<JsApiData>,
|
| 712 |
+
endpoint: string | number,
|
| 713 |
+
api_map: Record<string, number>,
|
| 714 |
+
config: Config
|
| 715 |
+
): {
|
| 716 |
+
fn_index: number;
|
| 717 |
+
endpoint_info: EndpointInfo<JsApiData>;
|
| 718 |
+
dependency: Dependency;
|
| 719 |
+
} {
|
| 720 |
+
let fn_index: number;
|
| 721 |
+
let endpoint_info: EndpointInfo<JsApiData>;
|
| 722 |
+
let dependency: Dependency;
|
| 723 |
+
|
| 724 |
+
if (typeof endpoint === "number") {
|
| 725 |
+
fn_index = endpoint;
|
| 726 |
+
endpoint_info = api_info.unnamed_endpoints[fn_index];
|
| 727 |
+
dependency = config.dependencies.find((dep) => dep.id == endpoint)!;
|
| 728 |
+
} else {
|
| 729 |
+
const trimmed_endpoint = endpoint.replace(/^\//, "");
|
| 730 |
+
|
| 731 |
+
fn_index = api_map[trimmed_endpoint];
|
| 732 |
+
endpoint_info = api_info.named_endpoints[endpoint.trim()];
|
| 733 |
+
dependency = config.dependencies.find(
|
| 734 |
+
(dep) => dep.id == api_map[trimmed_endpoint]
|
| 735 |
+
)!;
|
| 736 |
+
}
|
| 737 |
+
|
| 738 |
+
if (typeof fn_index !== "number") {
|
| 739 |
+
throw new Error(
|
| 740 |
+
"There is no endpoint matching that name of fn_index matching that number."
|
| 741 |
+
);
|
| 742 |
+
}
|
| 743 |
+
return { fn_index, endpoint_info, dependency };
|
| 744 |
+
}
|
6.1.1/client/src/utils/upload_files.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { Client } from "..";
|
| 2 |
+
import { BROKEN_CONNECTION_MSG, UPLOAD_URL } from "../constants";
|
| 3 |
+
import type { UploadResponse } from "../types";
|
| 4 |
+
|
| 5 |
+
export async function upload_files(
|
| 6 |
+
this: Client,
|
| 7 |
+
root_url: string,
|
| 8 |
+
files: (Blob | File)[],
|
| 9 |
+
upload_id?: string
|
| 10 |
+
): Promise<UploadResponse> {
|
| 11 |
+
const headers: {
|
| 12 |
+
Authorization?: string;
|
| 13 |
+
} = {};
|
| 14 |
+
if (this?.options?.token) {
|
| 15 |
+
headers.Authorization = `Bearer ${this.options.token}`;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
const chunkSize = 1000;
|
| 19 |
+
const uploadResponses = [];
|
| 20 |
+
let response: Response;
|
| 21 |
+
|
| 22 |
+
for (let i = 0; i < files.length; i += chunkSize) {
|
| 23 |
+
const chunk = files.slice(i, i + chunkSize);
|
| 24 |
+
const formData = new FormData();
|
| 25 |
+
chunk.forEach((file) => {
|
| 26 |
+
formData.append("files", file);
|
| 27 |
+
});
|
| 28 |
+
try {
|
| 29 |
+
const upload_url = upload_id
|
| 30 |
+
? `${root_url}${this.api_prefix}/${UPLOAD_URL}?upload_id=${upload_id}`
|
| 31 |
+
: `${root_url}${this.api_prefix}/${UPLOAD_URL}`;
|
| 32 |
+
|
| 33 |
+
response = await this.fetch(upload_url, {
|
| 34 |
+
method: "POST",
|
| 35 |
+
body: formData,
|
| 36 |
+
headers,
|
| 37 |
+
credentials: "include"
|
| 38 |
+
});
|
| 39 |
+
} catch (e) {
|
| 40 |
+
throw new Error(BROKEN_CONNECTION_MSG + (e as Error).message);
|
| 41 |
+
}
|
| 42 |
+
if (!response.ok) {
|
| 43 |
+
const error_text = await response.text();
|
| 44 |
+
return { error: `HTTP ${response.status}: ${error_text}` };
|
| 45 |
+
}
|
| 46 |
+
const output: UploadResponse["files"] = await response.json();
|
| 47 |
+
if (output) {
|
| 48 |
+
uploadResponses.push(...output);
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
return { files: uploadResponses };
|
| 52 |
+
}
|
6.1.1/client/src/utils/view_api.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ApiInfo, ApiData } from "../types";
|
| 2 |
+
import { API_INFO_URL, BROKEN_CONNECTION_MSG } from "../constants";
|
| 3 |
+
import { Client } from "../client";
|
| 4 |
+
import { SPACE_FETCHER_URL } from "../constants";
|
| 5 |
+
import { join_urls, transform_api_info } from "../helpers/api_info";
|
| 6 |
+
|
| 7 |
+
export async function view_api(this: Client): Promise<any> {
|
| 8 |
+
if (this.api_info) return this.api_info;
|
| 9 |
+
|
| 10 |
+
const { token } = this.options;
|
| 11 |
+
const { config } = this;
|
| 12 |
+
|
| 13 |
+
const headers: {
|
| 14 |
+
Authorization?: string;
|
| 15 |
+
"Content-Type": "application/json";
|
| 16 |
+
} = { "Content-Type": "application/json" };
|
| 17 |
+
|
| 18 |
+
if (token) {
|
| 19 |
+
headers.Authorization = `Bearer ${token}`;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
if (!config) {
|
| 23 |
+
return;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
try {
|
| 27 |
+
let response: Response;
|
| 28 |
+
let api_info: ApiInfo<ApiData> | { api: ApiInfo<ApiData> };
|
| 29 |
+
if (typeof window !== "undefined" && window.gradio_api_info) {
|
| 30 |
+
api_info = window.gradio_api_info;
|
| 31 |
+
} else {
|
| 32 |
+
const url = join_urls(config.root, this.api_prefix, API_INFO_URL);
|
| 33 |
+
response = await this.fetch(url, {
|
| 34 |
+
headers,
|
| 35 |
+
credentials: "include"
|
| 36 |
+
});
|
| 37 |
+
if (!response.ok) {
|
| 38 |
+
throw new Error(BROKEN_CONNECTION_MSG);
|
| 39 |
+
}
|
| 40 |
+
api_info = await response.json();
|
| 41 |
+
}
|
| 42 |
+
if ("api" in api_info) {
|
| 43 |
+
api_info = api_info.api;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
if (
|
| 47 |
+
api_info.named_endpoints["/predict"] &&
|
| 48 |
+
!api_info.unnamed_endpoints["0"]
|
| 49 |
+
) {
|
| 50 |
+
api_info.unnamed_endpoints[0] = api_info.named_endpoints["/predict"];
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
return transform_api_info(api_info, config, this.api_map);
|
| 54 |
+
} catch (e) {
|
| 55 |
+
throw new Error("Could not get API info. " + (e as Error).message);
|
| 56 |
+
}
|
| 57 |
+
}
|
6.1.1/client/src/vite-env.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/// <reference types="vite/client" />
|
| 2 |
+
|
| 3 |
+
declare const BROWSER_BUILD: boolean;
|
6.1.1/client/tsconfig.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"include": ["src/**/*"],
|
| 3 |
+
"exclude": ["src/**/*.test.ts", "src/**/*.node-test.ts", "src/test/**/*"],
|
| 4 |
+
"compilerOptions": {
|
| 5 |
+
"allowJs": true,
|
| 6 |
+
"declaration": true,
|
| 7 |
+
"emitDeclarationOnly": true,
|
| 8 |
+
"outDir": "dist",
|
| 9 |
+
"declarationMap": true,
|
| 10 |
+
"module": "ESNext",
|
| 11 |
+
"target": "ES2020",
|
| 12 |
+
"useDefineForClassFields": true,
|
| 13 |
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
| 14 |
+
"skipLibCheck": true,
|
| 15 |
+
"types": ["node"],
|
| 16 |
+
|
| 17 |
+
/* Bundler */
|
| 18 |
+
"moduleResolution": "Bundler",
|
| 19 |
+
"skipDefaultLibCheck": true,
|
| 20 |
+
"allowImportingTsExtensions": true,
|
| 21 |
+
"esModuleInterop": true,
|
| 22 |
+
"resolveJsonModule": true,
|
| 23 |
+
"isolatedModules": true,
|
| 24 |
+
|
| 25 |
+
/* Linting */
|
| 26 |
+
"strict": true
|
| 27 |
+
}
|
| 28 |
+
}
|