From d3ce2e8917ff00535c6ce8c3781cae94663f1f41 Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 10 May 2024 23:54:34 +0800 Subject: [PATCH] use prisma-client-rust main branch (#2471) * use primsa-client-rust main branch * remove as i64 --- Cargo.lock | Bin 310288 -> 310238 bytes Cargo.toml | 48 +++++++++--------- .../object/media/old_media_processor/job.rs | 4 +- .../media/old_media_processor/shallow.rs | 4 +- crates/sync-generator/src/model.rs | 1 + crates/utils/src/db.rs | 4 +- packages/client/src/core.ts | 8 +-- 7 files changed, 36 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0954fd44b5c475807213e095147c1a95a58e251c..ddd8e70aff7b7b8bf9fdf312b2cbd06653123140 100644 GIT binary patch delta 3075 zcmcguTWDNW6y=^XNobyv=OnRe(iF69CcWo%A4m*{tq6fMQM9Fky^nL6kaiL$F&O-? z0TC-Ht&C<`Xppoi0z1F0(ib$={KrDhkNkRQEts+vQkRslRv#V)@ zI%n-uf7C4hUUO#rC{*;IMCQbiCfGfJ`Z7hSsm%D%w(Q5LpPGc|ART&g*ctWurQc=> zOHfN#iZjWn;c?1bYA|I=!cC^Qt#htS3#uQ8C9bj2U7`i7Ju}x|SX>*H8SDJ!(7C2Y51Y9aX zJA?U@Hq)Gm-?t@W?=K4mk84XTiV~;VW0e7%*LHQn%%t{Mr}8M3N*Tl@jJbpe&ybd9 za%mCEGpOYozL2IPbn1lN7|P(jl)7p7zRekE55*Gj^ewF<7+%-bUW`KQDTd>)XBH<* z)6b5KddYrgq(4|ahCXNIZd#`Nq14dWfY%Qne2NLbui;u4$e{*p9A3zw-Yth^N~WFBp)@S!&@?2w zaVxa!!R7FCd#oCkm(X@N`3b6p<+I4zEY5@H(8KU!fYvwj!uTB}k|X_2TKb^x#R-_5 zM@5i5hqC`t>a%-s9sF_@-M=~f8lhtzCBWQ^Cv~S!_=?0iA!V-2&<4PE& zxEbaaP*u=ejK8mk;v=}POK{t@eVv7|WD=iK8OD|HiAOjUGK>L>ahrsRt(##s*bWh{ z)G6_V;Sz%r1s`t54O4%HO&a$wHCx8)V+-L1^@qLc7Y# z0--FWLD39eEEFa0&Y)!$e`E(=eut0uMrbK>t+fkQc7_YX^)VkR*WprK&rTiI8$Q}}*he#o$AkoP7l+kP4gS{ON=X~p1Ykh02 z@B80ojNF}ZVrLBstgxstQVRn3c`d3mKIy+TC+fF5x_J-fJ*0a;4=(0H5f6Y< zM7c|2BkLVwa~enB0 zoJpwC2?-TTozyU070R%uKbQ(*ov0O}TA`Ai>JJXjg|#C=C9Ay|TncmLzHvpNn7uO^ zEMFNgSbZC$zwi8%8U$d&6ingyASC!tqg5Su2 zNvMfTl;+&}J_+uOSFDc3KT zGTgX=roi=cXgn9xgfcU~IPbRQf?54FI-Cn&BBiW)5iP(?!+a4`VDmN94yUf54aL4* zwS8M(?~o0tDUy;7BJfWb+r|FH5-+=nnC*Tmb&ov_r)4{#+>M4&y2C zYUED_dk@e2tC+A+;4@8wJ{*~8*-(UMnz%U&r$7Rp4c89h7jqGrn61pu){W-J%8M=Y zMf$FJgohPbl1)B>cc&8vxxQ$gtWx2a63&l`w_DDu(Gtp2d_;_JZu5Z3vsC1AX-V=4MXzS=4wEqq*ynQK{pY6Mjcdu)@hQ)xx aNNZsc9PjeJ;q>yt^Esf(nRju+d;bKCC8Zev diff --git a/Cargo.toml b/Cargo.toml index bd7e4cb1e..467e90178 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,17 +1,17 @@ [workspace] resolver = "2" members = [ - "core", - "core/crates/*", - "crates/*", - "apps/cli", - "apps/p2p-relay", - "apps/desktop/src-tauri", - "apps/desktop/crates/*", - "apps/mobile/modules/sd-core/core", - "apps/mobile/modules/sd-core/android/crate", - "apps/mobile/modules/sd-core/ios/crate", - "apps/server", + "core", + "core/crates/*", + "crates/*", + "apps/cli", + "apps/p2p-relay", + "apps/desktop/src-tauri", + "apps/desktop/crates/*", + "apps/mobile/modules/sd-core/core", + "apps/mobile/modules/sd-core/android/crate", + "apps/mobile/modules/sd-core/ios/crate", + "apps/server", ] [workspace.package] @@ -20,22 +20,22 @@ edition = "2021" repository = "https://github.com/spacedriveapp/spacedrive" [workspace.dependencies] -# First party dependencies -prisma-client-rust = { git = "https://github.com/spacedriveapp/prisma-client-rust", rev = "528ab1cd02c25a1b183c0a8bc44e28954fdd0bfd", features = [ - "migrations", - "specta", - "sqlite", - "sqlite-create-many", +prisma-client-rust = { git = "https://github.com/brendonovich/prisma-client-rust", rev = "4f9ef9d38ca732162accff72b2eb684d2f120bab", features = [ + "migrations", + "specta", + "sqlite", + "sqlite-create-many", ], default-features = false } -prisma-client-rust-cli = { git = "https://github.com/spacedriveapp/prisma-client-rust", rev = "528ab1cd02c25a1b183c0a8bc44e28954fdd0bfd", features = [ - "migrations", - "specta", - "sqlite", - "sqlite-create-many", +prisma-client-rust-cli = { git = "https://github.com/brendonovich/prisma-client-rust", rev = "4f9ef9d38ca732162accff72b2eb684d2f120bab", features = [ + "migrations", + "specta", + "sqlite", + "sqlite-create-many", ], default-features = false } -prisma-client-rust-sdk = { git = "https://github.com/spacedriveapp/prisma-client-rust", rev = "528ab1cd02c25a1b183c0a8bc44e28954fdd0bfd", features = [ - "sqlite", +prisma-client-rust-sdk = { git = "https://github.com/brendonovich/prisma-client-rust", rev = "4f9ef9d38ca732162accff72b2eb684d2f120bab", features = [ + "sqlite", ], default-features = false } + rspc = { version = "0.1.4" } specta = { version = "=2.0.0-rc.11" } tauri-specta = { version = "=2.0.0-rc.8" } diff --git a/core/src/object/media/old_media_processor/job.rs b/core/src/object/media/old_media_processor/job.rs index 78e3960d0..938c21658 100644 --- a/core/src/object/media/old_media_processor/job.rs +++ b/core/src/object/media/old_media_processor/job.rs @@ -602,7 +602,7 @@ async fn get_files_for_labeling( "" } ), - PrismaValue::Int(parent_iso_file_path.location_id() as i64), + PrismaValue::Int(parent_iso_file_path.location_id()), PrismaValue::String(format!( "{}%", parent_iso_file_path @@ -640,7 +640,7 @@ async fn get_all_children_files_by_extensions( .collect::>() .join(",") ), - PrismaValue::Int(parent_iso_file_path.location_id() as i64), + PrismaValue::Int(parent_iso_file_path.location_id()), PrismaValue::String(format!( "{}%", parent_iso_file_path diff --git a/core/src/object/media/old_media_processor/shallow.rs b/core/src/object/media/old_media_processor/shallow.rs index b45d3fa48..12197ebb2 100644 --- a/core/src/object/media/old_media_processor/shallow.rs +++ b/core/src/object/media/old_media_processor/shallow.rs @@ -262,7 +262,7 @@ async fn get_files_for_labeling( "" } ), - PrismaValue::Int(parent_iso_file_path.location_id() as i64), + PrismaValue::Int(parent_iso_file_path.location_id()), PrismaValue::String( parent_iso_file_path .materialized_path_for_children() @@ -354,7 +354,7 @@ async fn get_files_by_extensions( .collect::>() .join(",") ), - PrismaValue::Int(parent_iso_file_path.location_id() as i64), + PrismaValue::Int(parent_iso_file_path.location_id()), PrismaValue::String( parent_iso_file_path .materialized_path_for_children() diff --git a/crates/sync-generator/src/model.rs b/crates/sync-generator/src/model.rs index 6c8cb7bef..f68437446 100644 --- a/crates/sync-generator/src/model.rs +++ b/crates/sync-generator/src/model.rs @@ -174,6 +174,7 @@ pub fn module((model, sync_type): ModelWithSyncType) -> Module { model.name(), quote! { use super::prisma::*; + use prisma_client_rust::scalar_types::*; #sync_id diff --git a/crates/utils/src/db.rs b/crates/utils/src/db.rs index 67e2d6e05..f30a24773 100644 --- a/crates/utils/src/db.rs +++ b/crates/utils/src/db.rs @@ -16,7 +16,9 @@ pub enum MigrationError { /// load_and_migrate will load the database from the given path and migrate it to the latest version of the schema. pub async fn load_and_migrate(db_url: &str) -> Result { - let client = prisma::new_client_with_url(db_url) + let client = prisma::PrismaClient::_builder() + .with_url(db_url.to_string()) + .build() .await .map_err(Box::new)?; diff --git a/packages/client/src/core.ts b/packages/client/src/core.ts index 3f591b425..40f041338 100644 --- a/packages/client/src/core.ts +++ b/packages/client/src/core.ts @@ -53,7 +53,7 @@ export type Procedures = { { key: "sync.messages", input: LibraryArgs, result: CRDTOperation[] } | { key: "tags.get", input: LibraryArgs, result: Tag | null } | { key: "tags.getForObject", input: LibraryArgs, result: Tag[] } | - { key: "tags.getWithObjects", input: LibraryArgs, result: { [key in number]: ({ date_created: string | null; object: { id: number } })[] } } | + { key: "tags.getWithObjects", input: LibraryArgs, result: { [key in number]: ({ object: { id: number }; date_created: string | null })[] } } | { key: "tags.list", input: LibraryArgs, result: Tag[] } | { key: "volumes.list", input: never, result: Volume[] }, mutations: @@ -297,7 +297,7 @@ export type FilePathOrder = { field: "name"; value: SortOrder } | { field: "size export type FilePathSearchArgs = { take?: number | null; orderAndPagination?: OrderAndPagination | null; filters?: SearchFilterArgs[]; groupDirectories?: boolean } -export type FilePathWithObject = { id: number; pub_id: number[]; is_dir: boolean | null; cas_id: string | null; integrity_checksum: string | null; location_id: number | null; materialized_path: string | null; name: string | null; extension: string | null; hidden: boolean | null; size_in_bytes: string | null; size_in_bytes_bytes: number[] | null; inode: number[] | null; object_id: number | null; key_id: number | null; date_created: string | null; date_modified: string | null; date_indexed: string | null; object: { id: number; pub_id: number[]; kind: number | null; key_id: number | null; hidden: boolean | null; favorite: boolean | null; important: boolean | null; note: string | null; date_created: string | null; date_accessed: string | null; exif_data: { resolution: number[] | null; media_date: number[] | null; media_location: number[] | null; camera_data: number[] | null; artist: string | null; description: string | null; copyright: string | null; exif_version: string | null } | null } | null } +export type FilePathWithObject = { id: number; pub_id: number[]; is_dir: boolean | null; cas_id: string | null; integrity_checksum: string | null; location_id: number | null; materialized_path: string | null; name: string | null; extension: string | null; hidden: boolean | null; size_in_bytes: string | null; size_in_bytes_bytes: number[] | null; inode: number[] | null; object_id: number | null; object: { id: number; pub_id: number[]; kind: number | null; key_id: number | null; hidden: boolean | null; favorite: boolean | null; important: boolean | null; note: string | null; date_created: string | null; date_accessed: string | null; exif_data: { resolution: number[] | null; media_date: number[] | null; media_location: number[] | null; camera_data: number[] | null; artist: string | null; description: string | null; copyright: string | null; exif_version: string | null } | null } | null; key_id: number | null; date_created: string | null; date_modified: string | null; date_indexed: string | null } export type Flash = { /** @@ -517,9 +517,9 @@ export type ObjectSearchArgs = { take: number; orderAndPagination?: OrderAndPagi export type ObjectValidatorArgs = { id: number; path: string } -export type ObjectWithFilePaths = { id: number; pub_id: number[]; kind: number | null; key_id: number | null; hidden: boolean | null; favorite: boolean | null; important: boolean | null; note: string | null; date_created: string | null; date_accessed: string | null; file_paths: ({ id: number; pub_id: number[]; is_dir: boolean | null; cas_id: string | null; integrity_checksum: string | null; location_id: number | null; materialized_path: string | null; name: string | null; extension: string | null; hidden: boolean | null; size_in_bytes: string | null; size_in_bytes_bytes: number[] | null; inode: number[] | null; object_id: number | null; key_id: number | null; date_created: string | null; date_modified: string | null; date_indexed: string | null; object: { id: number; pub_id: number[]; kind: number | null; key_id: number | null; hidden: boolean | null; favorite: boolean | null; important: boolean | null; note: string | null; date_created: string | null; date_accessed: string | null; exif_data: { resolution: number[] | null; media_date: number[] | null; media_location: number[] | null; camera_data: number[] | null; artist: string | null; description: string | null; copyright: string | null; exif_version: string | null } | null; ffmpeg_data: { id: number; formats: string; bit_rate: number[]; duration: number[] | null; start_time: number[] | null; title: string | null; creation_time: string | null; date: string | null; album_artist: string | null; disc: string | null; track: string | null; album: string | null; artist: string | null; metadata: number[] | null; object_id: number; chapters: FfmpegMediaChapter[]; programs: ({ program_id: number; name: string | null; metadata: number[] | null; ffmpeg_data_id: number; streams: ({ stream_id: number; name: string | null; aspect_ratio_num: number; aspect_ratio_den: number; frames_per_second_num: number; frames_per_second_den: number; time_base_real_den: number; time_base_real_num: number; dispositions: string | null; title: string | null; encoder: string | null; language: string | null; duration: number[] | null; metadata: number[] | null; program_id: number; ffmpeg_data_id: number; codec: { id: number; kind: string | null; sub_kind: string | null; tag: string | null; name: string | null; profile: string | null; bit_rate: number; stream_id: number; program_id: number; ffmpeg_data_id: number; audio_props: FfmpegMediaAudioProps | null; video_props: FfmpegMediaVideoProps | null } | null })[] })[] } | null } | null })[] } +export type ObjectWithFilePaths = { id: number; pub_id: number[]; kind: number | null; key_id: number | null; hidden: boolean | null; favorite: boolean | null; important: boolean | null; note: string | null; date_created: string | null; date_accessed: string | null; file_paths: ({ id: number; pub_id: number[]; is_dir: boolean | null; cas_id: string | null; integrity_checksum: string | null; location_id: number | null; materialized_path: string | null; name: string | null; extension: string | null; hidden: boolean | null; size_in_bytes: string | null; size_in_bytes_bytes: number[] | null; inode: number[] | null; object_id: number | null; object: { id: number; pub_id: number[]; kind: number | null; key_id: number | null; hidden: boolean | null; favorite: boolean | null; important: boolean | null; note: string | null; date_created: string | null; date_accessed: string | null; exif_data: { resolution: number[] | null; media_date: number[] | null; media_location: number[] | null; camera_data: number[] | null; artist: string | null; description: string | null; copyright: string | null; exif_version: string | null } | null; ffmpeg_data: { id: number; formats: string; bit_rate: number[]; duration: number[] | null; start_time: number[] | null; chapters: FfmpegMediaChapter[]; programs: ({ program_id: number; streams: ({ stream_id: number; name: string | null; codec: { id: number; kind: string | null; sub_kind: string | null; tag: string | null; name: string | null; profile: string | null; bit_rate: number; video_props: FfmpegMediaVideoProps | null; audio_props: FfmpegMediaAudioProps | null; stream_id: number; program_id: number; ffmpeg_data_id: number } | null; aspect_ratio_num: number; aspect_ratio_den: number; frames_per_second_num: number; frames_per_second_den: number; time_base_real_den: number; time_base_real_num: number; dispositions: string | null; title: string | null; encoder: string | null; language: string | null; duration: number[] | null; metadata: number[] | null; program_id: number; ffmpeg_data_id: number })[]; name: string | null; metadata: number[] | null; ffmpeg_data_id: number })[]; title: string | null; creation_time: string | null; date: string | null; album_artist: string | null; disc: string | null; track: string | null; album: string | null; artist: string | null; metadata: number[] | null; object_id: number } | null } | null; key_id: number | null; date_created: string | null; date_modified: string | null; date_indexed: string | null })[] } -export type ObjectWithFilePaths2 = { id: number; pub_id: number[]; kind: number | null; key_id: number | null; hidden: boolean | null; favorite: boolean | null; important: boolean | null; note: string | null; date_created: string | null; date_accessed: string | null; file_paths: ({ id: number; pub_id: number[]; is_dir: boolean | null; cas_id: string | null; integrity_checksum: string | null; location_id: number | null; materialized_path: string | null; name: string | null; extension: string | null; hidden: boolean | null; size_in_bytes: string | null; size_in_bytes_bytes: number[] | null; inode: number[] | null; object_id: number | null; key_id: number | null; date_created: string | null; date_modified: string | null; date_indexed: string | null; object: { id: number; pub_id: number[]; kind: number | null; key_id: number | null; hidden: boolean | null; favorite: boolean | null; important: boolean | null; note: string | null; date_created: string | null; date_accessed: string | null; exif_data: { resolution: number[] | null; media_date: number[] | null; media_location: number[] | null; camera_data: number[] | null; artist: string | null; description: string | null; copyright: string | null; exif_version: string | null } | null; ffmpeg_data: { id: number; formats: string; bit_rate: number[]; duration: number[] | null; start_time: number[] | null; title: string | null; creation_time: string | null; date: string | null; album_artist: string | null; disc: string | null; track: string | null; album: string | null; artist: string | null; metadata: number[] | null; object_id: number; chapters: FfmpegMediaChapter[]; programs: ({ program_id: number; name: string | null; metadata: number[] | null; ffmpeg_data_id: number; streams: ({ stream_id: number; name: string | null; aspect_ratio_num: number; aspect_ratio_den: number; frames_per_second_num: number; frames_per_second_den: number; time_base_real_den: number; time_base_real_num: number; dispositions: string | null; title: string | null; encoder: string | null; language: string | null; duration: number[] | null; metadata: number[] | null; program_id: number; ffmpeg_data_id: number; codec: { id: number; kind: string | null; sub_kind: string | null; tag: string | null; name: string | null; profile: string | null; bit_rate: number; stream_id: number; program_id: number; ffmpeg_data_id: number; audio_props: FfmpegMediaAudioProps | null; video_props: FfmpegMediaVideoProps | null } | null })[] })[] } | null } | null })[] } +export type ObjectWithFilePaths2 = { id: number; pub_id: number[]; kind: number | null; key_id: number | null; hidden: boolean | null; favorite: boolean | null; important: boolean | null; note: string | null; date_created: string | null; date_accessed: string | null; file_paths: ({ id: number; pub_id: number[]; is_dir: boolean | null; cas_id: string | null; integrity_checksum: string | null; location_id: number | null; materialized_path: string | null; name: string | null; extension: string | null; hidden: boolean | null; size_in_bytes: string | null; size_in_bytes_bytes: number[] | null; inode: number[] | null; object_id: number | null; object: { id: number; pub_id: number[]; kind: number | null; key_id: number | null; hidden: boolean | null; favorite: boolean | null; important: boolean | null; note: string | null; date_created: string | null; date_accessed: string | null; exif_data: { resolution: number[] | null; media_date: number[] | null; media_location: number[] | null; camera_data: number[] | null; artist: string | null; description: string | null; copyright: string | null; exif_version: string | null } | null; ffmpeg_data: { id: number; formats: string; bit_rate: number[]; duration: number[] | null; start_time: number[] | null; chapters: FfmpegMediaChapter[]; programs: ({ program_id: number; streams: ({ stream_id: number; name: string | null; codec: { id: number; kind: string | null; sub_kind: string | null; tag: string | null; name: string | null; profile: string | null; bit_rate: number; video_props: FfmpegMediaVideoProps | null; audio_props: FfmpegMediaAudioProps | null; stream_id: number; program_id: number; ffmpeg_data_id: number } | null; aspect_ratio_num: number; aspect_ratio_den: number; frames_per_second_num: number; frames_per_second_den: number; time_base_real_den: number; time_base_real_num: number; dispositions: string | null; title: string | null; encoder: string | null; language: string | null; duration: number[] | null; metadata: number[] | null; program_id: number; ffmpeg_data_id: number })[]; name: string | null; metadata: number[] | null; ffmpeg_data_id: number })[]; title: string | null; creation_time: string | null; date: string | null; album_artist: string | null; disc: string | null; track: string | null; album: string | null; artist: string | null; metadata: number[] | null; object_id: number } | null } | null; key_id: number | null; date_created: string | null; date_modified: string | null; date_indexed: string | null })[] } export type OldFileCopierJobInit = { source_location_id: number; target_location_id: number; sources_file_path_ids: number[]; target_location_relative_directory_path: string }