fix invoke in stream.ts, upgrade package

This commit is contained in:
04041b 2024-12-11 21:49:19 -08:00
parent 3e090931d2
commit 58f103eaf6
5 changed files with 32 additions and 35 deletions

54
app/global.d.ts vendored
View File

@ -12,32 +12,34 @@ declare module "*.svg";
declare interface Window { declare interface Window {
__TAURI__?: { __TAURI__?: {
writeText(text: string): Promise<void>; core: {
invoke(command: string, payload?: Record<string, unknown>): Promise<any>; writeText(text: string): Promise<void>;
dialog: { invoke(command: string, payload?: Record<string, unknown>): Promise<any>;
save(options?: Record<string, unknown>): Promise<string | null>; dialog: {
}; save(options?: Record<string, unknown>): Promise<string | null>;
fs: { };
writeBinaryFile(path: string, data: Uint8Array): Promise<void>; fs: {
writeTextFile(path: string, data: string): Promise<void>; writeBinaryFile(path: string, data: Uint8Array): Promise<void>;
}; writeTextFile(path: string, data: string): Promise<void>;
notification: { };
requestPermission(): Promise<Permission>; notification: {
isPermissionGranted(): Promise<boolean>; requestPermission(): Promise<Permission>;
sendNotification(options: string | Options): void; isPermissionGranted(): Promise<boolean>;
}; sendNotification(options: string | Options): void;
updater: { };
checkUpdate(): Promise<UpdateResult>; updater: {
installUpdate(): Promise<void>; checkUpdate(): Promise<UpdateResult>;
onUpdaterEvent( installUpdate(): Promise<void>;
handler: (status: UpdateStatusResult) => void, onUpdaterEvent(
): Promise<UnlistenFn>; handler: (status: UpdateStatusResult) => void,
}; ): Promise<UnlistenFn>;
http: { };
fetch<T>( http: {
url: string, fetch<T>(
options?: Record<string, unknown>, url: string,
): Promise<Response<T>>; options?: Record<string, unknown>,
): Promise<Response<T>>;
};
}; };
}; };
} }

View File

@ -74,7 +74,7 @@ export function fetch(url: string, options?: RequestInit): Promise<Response> {
for (const item of new Headers(_headers || {})) { for (const item of new Headers(_headers || {})) {
headers[item[0]] = item[1]; headers[item[0]] = item[1];
} }
return window.__TAURI__ return window.__TAURI__.core
.invoke("stream_fetch", { .invoke("stream_fetch", {
method: method.toUpperCase(), method: method.toUpperCase(),
url, url,

View File

@ -64,7 +64,7 @@
"zustand": "^4.3.8" "zustand": "^4.3.8"
}, },
"devDependencies": { "devDependencies": {
"@tauri-apps/api": "2.0.0", "@tauri-apps/api": "^2.1.1",
"@tauri-apps/cli": "^2.1.0", "@tauri-apps/cli": "^2.1.0",
"@testing-library/dom": "^10.4.0", "@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3", "@testing-library/jest-dom": "^6.6.3",

File diff suppressed because one or more lines are too long

View File

@ -2029,12 +2029,7 @@
dependencies: dependencies:
tslib "^2.4.0" tslib "^2.4.0"
"@tauri-apps/api@2.0.0": "@tauri-apps/api@^2.0.0", "@tauri-apps/api@^2.1.1":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@tauri-apps/api/-/api-2.0.0.tgz#a75768a578958210827aca752c804118a6a76f11"
integrity sha512-moKgCp2EX7X5GiOx/G/bmoEpkFQVVmyS98UaJU4xUVzan+E1BdwlAKcbip+cGldshYOqL4JSwAEN1OkRXeug0Q==
"@tauri-apps/api@^2.0.0":
version "2.1.1" version "2.1.1"
resolved "https://registry.yarnpkg.com/@tauri-apps/api/-/api-2.1.1.tgz#77d4ddb683d31072de4e6a47c8613d9db011652b" resolved "https://registry.yarnpkg.com/@tauri-apps/api/-/api-2.1.1.tgz#77d4ddb683d31072de4e6a47c8613d9db011652b"
integrity sha512-fzUfFFKo4lknXGJq8qrCidkUcKcH2UHhfaaCNt4GzgzGaW2iS26uFOg4tS3H4P8D6ZEeUxtiD5z0nwFF0UN30A== integrity sha512-fzUfFFKo4lknXGJq8qrCidkUcKcH2UHhfaaCNt4GzgzGaW2iS26uFOg4tS3H4P8D6ZEeUxtiD5z0nwFF0UN30A==