Date: Fri, 19 Aug 2022 07:41:08 +0800
Subject: [PATCH 08/15] use latest prisma-client-rust
---
Cargo.lock | Bin 165043 -> 170602 bytes
core/Cargo.toml | 16 +++++++++++++---
core/prisma/Cargo.toml | 5 ++++-
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index c143a58ec412a659813abb47ca2d51b9943e242e..d4285c8fed94c934c71b81c163f37088f0f960a1 100644
GIT binary patch
delta 6406
zcmcIoYmA)LdDa=Q*Sm`^>&q-QUNdWBCpF&9xnF3^LeiwfHej37ZDKdhxn>7;XVx=g
za2zfsG${y52%qB9A1#TcQWB+#NH^)UDTzR8m8umbpeRWrVxYOSrBQ%NNGYMD?>D69GAJ)iQp8cE84Faf5V?vfKfMc8ix;0T;3d{%Z${ORo9e>G7ubymWfJeaF8S+jjcm&v$)&{@I57>4(q_
zvwhbe8{89owA2emy;Dlr0DpTq=iJWbU#^C?@Y#4@xp=C
z#U1s5V%PrN#l!pm>HIHPJaK^cPqk;pIv<{i?b(+P+_h){78%`DExzkk=Holi@a&NP
z;R3CZAO8*-EGFy!a{iA{Ud-0wu^X4=qf_Y8i`#xOPTP&!25KAUhGXthzi
z;{HGTjoD8=^>5>APXlM;z|FDMt~VRC?X`_~+~gsK_D)bHH6xH9hC}iP!kBl)G76az
zqZBSevM^?~hs-B|avdqf)N-A4lG+yb;c9X4b4&BLj-hqM+p3H5&Yz8%h$@P>!fi)QEB?`HKMx
z&P%`Fmp34^_RH@>Vo`VRVzlD|q>E23-+N^gG&;#Nb}~>)aCD3_ZllLq3#K?XI0>hz
zFGDY&_Gw6Z&AibLc2#`i1H;9WoBR8wW2aU3?R@F-%4q&rKN>E+@WS2+!prgj6A{Xs
z)WL9qHEhgc6F5YPSOVY1V1yGqhyb^3EEik}sIEAb1+AF*%98%t#xv)?Wd6fgJTlX4
zbz*C5rqzUJlkspnANnD36Gp&QI41!smOH~RPdp@LoY6jb6QFo00?RTig*C}rLOjM^
z1Vc1&v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$`8d1^*|h-T%EkZH$ArDIUiMHFBBG--
z2_?m;WJn>EFd?vDltkPU-h?Q`!jqK8NJX3_A`x+t7!(VQ?ADJqWgUy4x57^w=UrzEvpYJB$g_
zL@SPoiMZQZ4Ncjli`?^fLeZUWhU)Bi5$>zVg-C8sGn~w4=P#UsCik-z_(eY3ztRf3?UjM5
z?D00ZrzRhaXMf{~F>`U*4T)tB-vZMW+3!2y{-SHU1Agm%<$|TI{*$o5Z5i?tM`L9~
zg1w-Gq$)}^6QQCZi3Bw=5-3R((pYQBLgN{LLlGI4P$7^A~J(z?t
z!ZkJ;bB;Z4)5LcLVb69J?dU*(Vf2nA9AlxLA9IsGHlNU
z(hq@>Yi{#RLQO-L+kF)lyYF0u)$V)K@L?BCLWjFN<AgU!c1_B`
zkqP(m-Uawowr}uew`?D@+S6bETz2>?@cqg@i5MY<&=6xvMaY~D?J7W+`slil1uTO??27ixdTwh
zNt5s7b<3erP-s+RqvPX=mcw1UCiSHDGu}^Mcj5^cbC1kGxBL4HwAaitT&s!EG51Ux
zthaBzy~=&@AZ*F5AA}zT**Bhqlhs-2FkA>~-t`FX$8Ev7tn<4tTa`!Eve+#!!TOYgXQ3aL+;$
za;!LK{x%T$8-jNnj5BU!Q^D3Bt#zNj;ODsb3;Z;v>GIBiEYG)%L-~}(v-Ey<>s4^`
zn&7VS8f?pk{sB|By19?}k;TK%*CFvmB2;^$=PxNKPGaSK59ccOW(;w~A|^x31@fMS
zG9CF+5uzngXyIn!T}xH=*4??x=d~2yY+8q=#zCJi!mp$JbtjWm=&9wx~
Wjcg7Y-2N@Wwp`95yQ42yx9LAu50=6J
diff --git a/core/Cargo.toml b/core/Cargo.toml
index 3eddc564e..2399c855c 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -8,7 +8,8 @@ repository = "https://github.com/spacedriveapp/spacedrive"
edition = "2021"
[features]
-p2p = [] # This feature controlls whether the Spacedrive Core contains the Peer to Peer syncing engine (It isn't required for the hosted core so we can disable it).
+p2p = [
+] # This feature controlls whether the Spacedrive Core contains the Peer to Peer syncing engine (It isn't required for the hosted core so we can disable it).
[dependencies]
hostname = "0.3.1"
@@ -26,8 +27,17 @@ rmp = "^0.8.11"
rmp-serde = "^1.1.0"
# Project dependencies
-prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust.git", branch = "0.6.0", features = ["rspc"] }
-rspc = { version = "0.0.4", features = ["axum", "tauri", "uuid", "chrono", "tracing"] }
+prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust.git", rev = "6a0119bce951c8d956542a59b2f783fc5a591fc7", features = [
+ "rspc",
+ "sqlite-create-many",
+] }
+rspc = { version = "0.0.4", features = [
+ "axum",
+ "tauri",
+ "uuid",
+ "chrono",
+ "tracing",
+] }
walkdir = "^2.3.2"
uuid = { version = "1.1.2", features = ["v4", "serde"] }
sysinfo = "0.23.9"
diff --git a/core/prisma/Cargo.toml b/core/prisma/Cargo.toml
index d9b60cd5a..b24c05939 100644
--- a/core/prisma/Cargo.toml
+++ b/core/prisma/Cargo.toml
@@ -4,4 +4,7 @@ version = "0.1.0"
edition = "2021"
[dependencies]
-prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust.git", branch = "0.6.0", features = ["rspc"] }
+prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust.git", rev = "6a0119bce951c8d956542a59b2f783fc5a591fc7", features = [
+ "rspc",
+ "sqlite-create-many",
+] }
From d919dff99ec1a0707cabf274a5bc7dad95dd380b Mon Sep 17 00:00:00 2001
From: Brendan Allan
Date: Fri, 19 Aug 2022 08:58:27 +0800
Subject: [PATCH 09/15] update to latest prisma-client-rust
---
Cargo.lock | Bin 165043 -> 170602 bytes
Cargo.toml | 11 ++++++-----
core/Cargo.toml | 18 ++++++++++++++----
core/prisma/Cargo.toml | 5 ++++-
core/src/api/files.rs | 12 ++++++------
core/src/api/locations.rs | 12 ++++++------
core/src/api/tags.rs | 14 +++++---------
core/src/file/cas/identifier.rs | 26 ++++++++++++++------------
core/src/file/indexer.rs | 3 ++-
core/src/job/job_manager.rs | 26 +++++++++++++++-----------
core/src/job/mod.rs | 4 ++--
core/src/library/library_manager.rs | 8 ++------
core/src/sys/locations.rs | 4 ++--
core/src/sys/volumes.rs | 7 ++-----
core/src/util/db.rs | 13 ++++++++-----
15 files changed, 88 insertions(+), 75 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index c143a58ec412a659813abb47ca2d51b9943e242e..d4285c8fed94c934c71b81c163f37088f0f960a1 100644
GIT binary patch
delta 6406
zcmcIoYmA)LdDa=Q*Sm`^>&q-QUNdWBCpF&9xnF3^LeiwfHej37ZDKdhxn>7;XVx=g
za2zfsG${y52%qB9A1#TcQWB+#NH^)UDTzR8m8umbpeRWrVxYOSrBQ%NNGYMD?>D69GAJ)iQp8cE84Faf5V?vfKfMc8ix;0T;3d{%Z${ORo9e>G7ubymWfJeaF8S+jjcm&v$)&{@I57>4(q_
zvwhbe8{89owA2emy;Dlr0DpTq=iJWbU#^C?@Y#4@xp=C
z#U1s5V%PrN#l!pm>HIHPJaK^cPqk;pIv<{i?b(+P+_h){78%`DExzkk=Holi@a&NP
z;R3CZAO8*-EGFy!a{iA{Ud-0wu^X4=qf_Y8i`#xOPTP&!25KAUhGXthzi
z;{HGTjoD8=^>5>APXlM;z|FDMt~VRC?X`_~+~gsK_D)bHH6xH9hC}iP!kBl)G76az
zqZBSevM^?~hs-B|avdqf)N-A4lG+yb;c9X4b4&BLj-hqM+p3H5&Yz8%h$@P>!fi)QEB?`HKMx
z&P%`Fmp34^_RH@>Vo`VRVzlD|q>E23-+N^gG&;#Nb}~>)aCD3_ZllLq3#K?XI0>hz
zFGDY&_Gw6Z&AibLc2#`i1H;9WoBR8wW2aU3?R@F-%4q&rKN>E+@WS2+!prgj6A{Xs
z)WL9qHEhgc6F5YPSOVY1V1yGqhyb^3EEik}sIEAb1+AF*%98%t#xv)?Wd6fgJTlX4
zbz*C5rqzUJlkspnANnD36Gp&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"apps/desktop/src-tauri",
+ "core",
+ "core/prisma",
+ "core/derive",
+ "apps/server",
]
+resolver = "2"
diff --git a/core/Cargo.toml b/core/Cargo.toml
index 3eddc564e..f199eefdd 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -8,7 +8,8 @@ repository = "https://github.com/spacedriveapp/spacedrive"
edition = "2021"
[features]
-p2p = [] # This feature controlls whether the Spacedrive Core contains the Peer to Peer syncing engine (It isn't required for the hosted core so we can disable it).
+p2p = [
+] # This feature controlls whether the Spacedrive Core contains the Peer to Peer syncing engine (It isn't required for the hosted core so we can disable it).
[dependencies]
hostname = "0.3.1"
@@ -26,8 +27,17 @@ rmp = "^0.8.11"
rmp-serde = "^1.1.0"
# Project dependencies
-prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust.git", branch = "0.6.0", features = ["rspc"] }
-rspc = { version = "0.0.4", features = ["axum", "tauri", "uuid", "chrono", "tracing"] }
+prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust.git", rev = "6a0119bce951c8d956542a59b2f783fc5a591fc7", features = [
+ "rspc",
+ "sqlite-create-many",
+] }
+rspc = { version = "0.0.4", features = [
+ "axum",
+ "tauri",
+ "uuid",
+ "chrono",
+ "tracing",
+] }
walkdir = "^2.3.2"
uuid = { version = "1.1.2", features = ["v4", "serde"] }
sysinfo = "0.23.9"
@@ -42,7 +52,7 @@ webp = "0.2.2"
ffmpeg-next = "5.0.3"
fs_extra = "1.2.0"
tracing = "0.1.35"
-tracing-subscriber = "0.3.14"
+tracing-subscriber = { version = "0.3.14", features = ["env-filter"] }
async-stream = "0.3.3"
once_cell = "1.13.0"
ctor = "0.1.22"
diff --git a/core/prisma/Cargo.toml b/core/prisma/Cargo.toml
index d9b60cd5a..b24c05939 100644
--- a/core/prisma/Cargo.toml
+++ b/core/prisma/Cargo.toml
@@ -4,4 +4,7 @@ version = "0.1.0"
edition = "2021"
[dependencies]
-prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust.git", branch = "0.6.0", features = ["rspc"] }
+prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust.git", rev = "6a0119bce951c8d956542a59b2f783fc5a591fc7", features = [
+ "rspc",
+ "sqlite-create-many",
+] }
diff --git a/core/src/api/files.rs b/core/src/api/files.rs
index bb33d9acd..e8329c6ac 100644
--- a/core/src/api/files.rs
+++ b/core/src/api/files.rs
@@ -26,8 +26,7 @@ pub(crate) fn mount() -> RouterBuilder {
library
.db
.file()
- .find_unique(file::id::equals(args.id))
- .update(vec![file::note::set(args.note)])
+ .update(file::id::equals(args.id), vec![file::note::set(args.note)])
.exec()
.await?;
@@ -54,8 +53,10 @@ pub(crate) fn mount() -> RouterBuilder {
library
.db
.file()
- .find_unique(file::id::equals(args.id))
- .update(vec![file::favorite::set(args.favorite)])
+ .update(
+ file::id::equals(args.id),
+ vec![file::favorite::set(args.favorite)],
+ )
.exec()
.await?;
@@ -82,8 +83,7 @@ pub(crate) fn mount() -> RouterBuilder {
library
.db
.file()
- .find_unique(file::id::equals(id))
- .delete()
+ .delete(file::id::equals(id))
.exec()
.await?;
diff --git a/core/src/api/locations.rs b/core/src/api/locations.rs
index 666afcc48..d690597f5 100644
--- a/core/src/api/locations.rs
+++ b/core/src/api/locations.rs
@@ -133,8 +133,10 @@ pub(crate) fn mount() -> RouterBuilder {
library
.db
.location()
- .find_unique(location::id::equals(args.id))
- .update(vec![location::name::set(args.name)])
+ .update(
+ location::id::equals(args.id),
+ vec![location::name::set(args.name)],
+ )
.exec()
.await?;
@@ -147,16 +149,14 @@ pub(crate) fn mount() -> RouterBuilder {
library
.db
.file_path()
- .find_many(vec![file_path::location_id::equals(Some(location_id))])
- .delete()
+ .delete_many(vec![file_path::location_id::equals(Some(location_id))])
.exec()
.await?;
library
.db
.location()
- .find_unique(location::id::equals(location_id))
- .delete()
+ .delete(location::id::equals(location_id))
.exec()
.await?;
diff --git a/core/src/api/tags.rs b/core/src/api/tags.rs
index c8a75bc9d..b7a7996d5 100644
--- a/core/src/api/tags.rs
+++ b/core/src/api/tags.rs
@@ -97,8 +97,10 @@ pub(crate) fn mount() -> RouterBuilder {
library
.db
.tag()
- .find_unique(tag::id::equals(args.id))
- .update(vec![tag::name::set(args.name), tag::color::set(args.color)])
+ .update(
+ tag::id::equals(args.id),
+ vec![tag::name::set(args.name), tag::color::set(args.color)],
+ )
.exec()
.await?;
@@ -117,13 +119,7 @@ pub(crate) fn mount() -> RouterBuilder {
.mutation("delete", |ctx, arg: LibraryArgs| async move {
let (id, library) = arg.get_library(&ctx).await?;
- library
- .db
- .tag()
- .find_unique(tag::id::equals(id))
- .delete()
- .exec()
- .await?;
+ library.db.tag().delete(tag::id::equals(id)).exec().await?;
invalidate_query!(
library,
diff --git a/core/src/file/cas/identifier.rs b/core/src/file/cas/identifier.rs
index 8cbe5bbcc..ac13c7b92 100644
--- a/core/src/file/cas/identifier.rs
+++ b/core/src/file/cas/identifier.rs
@@ -3,7 +3,7 @@ use super::checksum::generate_cas_id;
use crate::{
job::{JobError, JobReportUpdate, JobResult, JobState, StatefulJob, WorkerContext},
library::LibraryContext,
- prisma::{self, file, file_path, location},
+ prisma::{file, file_path, location},
};
use chrono::{DateTime, FixedOffset};
use prisma_client_rust::{prisma_models::PrismaValue, raw, raw::Raw, Direction};
@@ -160,10 +160,10 @@ impl StatefulJob for FileIdentifierJob {
if let Err(e) = library_ctx
.db
.file_path()
- .find_unique(file_path::id::equals(
- *cas_lookup.get(&existing_file.cas_id).unwrap(),
- ))
- .update(vec![file_path::file_id::set(Some(existing_file.id))])
+ .update(
+ file_path::id::equals(*cas_lookup.get(&existing_file.cas_id).unwrap()),
+ vec![file_path::file_id::set(Some(existing_file.id))],
+ )
.exec()
.await
{
@@ -205,6 +205,7 @@ impl StatefulJob for FileIdentifierJob {
),
values,
))
+ .exec()
.await
.unwrap_or_else(|e| {
error!("Error inserting files: {:#?}", e);
@@ -219,10 +220,10 @@ impl StatefulJob for FileIdentifierJob {
.library_ctx()
.db
.file_path()
- .find_unique(file_path::id::equals(
- *cas_lookup.get(&created_file.cas_id).unwrap(),
- ))
- .update(vec![file_path::file_id::set(Some(created_file.id))])
+ .update(
+ file_path::id::equals(*cas_lookup.get(&created_file.cas_id).unwrap()),
+ vec![file_path::file_id::set(Some(created_file.id))],
+ )
.exec()
.await
{
@@ -277,12 +278,13 @@ struct CountRes {
pub async fn count_orphan_file_paths(
ctx: &LibraryContext,
location_id: i64,
-) -> Result {
+) -> Result {
let files_count = ctx.db
._query_raw::(raw!(
"SELECT COUNT(*) AS count FROM file_paths WHERE file_id IS NULL AND is_dir IS FALSE AND location_id = {}",
PrismaValue::Int(location_id)
))
+ .exec()
.await?;
Ok(files_count[0].count.unwrap_or(0))
}
@@ -290,7 +292,7 @@ pub async fn count_orphan_file_paths(
pub async fn get_orphan_file_paths(
ctx: &LibraryContext,
cursor: i32,
-) -> Result, prisma::QueryError> {
+) -> Result, prisma_client_rust::QueryError> {
info!(
"discovering {} orphan file paths at cursor: {:?}",
CHUNK_SIZE, cursor
@@ -302,7 +304,7 @@ pub async fn get_orphan_file_paths(
file_path::is_dir::equals(false),
])
.order_by(file_path::id::order(Direction::Asc))
- .cursor(file_path::id::cursor(cursor))
+ .cursor(file_path::id::equals(cursor))
.take(CHUNK_SIZE as i64)
.exec()
.await
diff --git a/core/src/file/indexer.rs b/core/src/file/indexer.rs
index b9189b17d..36c75b470 100644
--- a/core/src/file/indexer.rs
+++ b/core/src/file/indexer.rs
@@ -86,6 +86,7 @@ impl StatefulJob for IndexerJob {
.library_ctx()
.db
._query_raw::(raw!("SELECT MAX(id) id FROM file_paths"))
+ .exec()
.await
{
Ok(rows) => rows[0].id.unwrap_or(0),
@@ -241,7 +242,7 @@ impl StatefulJob for IndexerJob {
files
);
- let count = ctx.library_ctx().db._execute_raw(raw).await;
+ let count = ctx.library_ctx().db._execute_raw(raw).exec().await;
info!("Inserted {:?} records", count);
diff --git a/core/src/job/job_manager.rs b/core/src/job/job_manager.rs
index 140b1ddf2..f79996579 100644
--- a/core/src/job/job_manager.rs
+++ b/core/src/job/job_manager.rs
@@ -6,7 +6,7 @@ use crate::{
},
job::{worker::Worker, DynJob, Job, JobError},
library::LibraryContext,
- prisma::{self, job, node},
+ prisma::{job, node},
};
use int_enum::IntEnum;
use rspc::Type;
@@ -117,7 +117,9 @@ impl JobManager {
ret
}
- pub async fn get_history(ctx: &LibraryContext) -> Result, prisma::QueryError> {
+ pub async fn get_history(
+ ctx: &LibraryContext,
+ ) -> Result, prisma_client_rust::QueryError> {
let jobs = ctx
.db
.job()
@@ -291,15 +293,17 @@ impl JobReport {
pub async fn update(&self, ctx: &LibraryContext) -> Result<(), JobError> {
ctx.db
.job()
- .find_unique(job::id::equals(self.id.as_bytes().to_vec()))
- .update(vec![
- job::status::set(self.status.int_value()),
- job::data::set(self.data.clone()),
- job::task_count::set(self.task_count),
- job::completed_task_count::set(self.completed_task_count),
- job::date_modified::set(chrono::Utc::now().into()),
- job::seconds_elapsed::set(self.seconds_elapsed),
- ])
+ .update(
+ job::id::equals(self.id.as_bytes().to_vec()),
+ vec![
+ job::status::set(self.status.int_value()),
+ job::data::set(self.data.clone()),
+ job::task_count::set(self.task_count),
+ job::completed_task_count::set(self.completed_task_count),
+ job::date_modified::set(chrono::Utc::now().into()),
+ job::seconds_elapsed::set(self.seconds_elapsed),
+ ],
+ )
.exec()
.await?;
Ok(())
diff --git a/core/src/job/mod.rs b/core/src/job/mod.rs
index 31b7ce16a..3ecd9015e 100644
--- a/core/src/job/mod.rs
+++ b/core/src/job/mod.rs
@@ -1,4 +1,4 @@
-use crate::{prisma, sys::LocationError};
+use crate::sys::LocationError;
use rmp_serde::{decode::Error as DecodeError, encode::Error as EncodeError};
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use std::{collections::VecDeque, fmt::Debug};
@@ -14,7 +14,7 @@ pub use worker::*;
#[derive(Error, Debug)]
pub enum JobError {
#[error("Database error: {0}")]
- DatabaseError(#[from] prisma::QueryError),
+ DatabaseError(#[from] prisma_client_rust::QueryError),
#[error("Location error: {0}")]
LocationError(#[from] LocationError),
#[error("I/O error: {0}")]
diff --git a/core/src/library/library_manager.rs b/core/src/library/library_manager.rs
index 9f40cc5d6..2b873ea7a 100644
--- a/core/src/library/library_manager.rs
+++ b/core/src/library/library_manager.rs
@@ -10,11 +10,7 @@ use tokio::sync::RwLock;
use uuid::Uuid;
use crate::{
- invalidate_query,
- node::Platform,
- prisma::{self, node},
- util::db::load_and_migrate,
- NodeContext,
+ invalidate_query, node::Platform, prisma::node, util::db::load_and_migrate, NodeContext,
};
use super::{LibraryConfig, LibraryConfigWrapped, LibraryContext};
@@ -36,7 +32,7 @@ pub enum LibraryManagerError {
#[error("error serializing or deserializing the JSON in the config file")]
Json(#[from] serde_json::Error),
#[error("Database error: {0}")]
- Database(#[from] prisma::QueryError),
+ Database(#[from] prisma_client_rust::QueryError),
#[error("Library not found error")]
LibraryNotFound,
#[error("error migrating the config file")]
diff --git a/core/src/sys/locations.rs b/core/src/sys/locations.rs
index 6c1b54a99..1a34e1066 100644
--- a/core/src/sys/locations.rs
+++ b/core/src/sys/locations.rs
@@ -8,7 +8,7 @@ use crate::{
invalidate_query,
job::Job,
library::LibraryContext,
- prisma::{self, location},
+ prisma::location,
};
use rspc::ErrorCode;
@@ -195,7 +195,7 @@ pub enum LocationError {
#[error("Failed to connect to database (error: {0:?})")]
IOError(io::Error),
#[error("Database error")]
- DatabaseError(#[from] prisma::QueryError),
+ DatabaseError(#[from] prisma_client_rust::QueryError),
}
impl From for rspc::Error {
diff --git a/core/src/sys/volumes.rs b/core/src/sys/volumes.rs
index 81a3c3e06..dbf581570 100644
--- a/core/src/sys/volumes.rs
+++ b/core/src/sys/volumes.rs
@@ -1,7 +1,4 @@
-use crate::{
- library::LibraryContext,
- prisma::{self, volume::*},
-};
+use crate::{library::LibraryContext, prisma::volume::*};
use rspc::Type;
use serde::{Deserialize, Serialize};
use thiserror::Error;
@@ -24,7 +21,7 @@ pub struct Volume {
#[derive(Error, Debug)]
pub enum VolumeError {
#[error("Database error: {0}")]
- DatabaseErr(#[from] prisma::QueryError),
+ DatabaseErr(#[from] prisma_client_rust::QueryError),
#[error("FromUtf8Error: {0}")]
FromUtf8Error(#[from] std::string::FromUtf8Error),
}
diff --git a/core/src/util/db.rs b/core/src/util/db.rs
index 4ced4361a..9df21142e 100644
--- a/core/src/util/db.rs
+++ b/core/src/util/db.rs
@@ -14,7 +14,7 @@ pub enum MigrationError {
#[error("An error occurred while initialising a new database connection")]
DatabaseInitialization(#[from] NewClientError),
#[error("An error occurred with the database while applying migrations")]
- DatabaseError(#[from] prisma_client_rust::queries::Error),
+ DatabaseError(#[from] prisma_client_rust::QueryError),
#[error("An error occurred reading the embedded migration files. {0}. Please report to Spacedrive developers!")]
InvalidEmbeddedMigration(&'static str),
}
@@ -27,11 +27,12 @@ pub async fn load_and_migrate(db_url: &str) -> Result(raw!(
"SELECT name FROM sqlite_master WHERE type='table' AND name='_migrations'"
))
+ .exec()
.await?
.is_empty();
if migrations_table_missing {
- client._execute_raw(raw!(INIT_MIGRATION)).await?;
+ client._execute_raw(raw!(INIT_MIGRATION)).exec().await?;
}
let mut migration_directories = MIGRATIONS_DIR
@@ -102,11 +103,13 @@ pub async fn load_and_migrate(db_url: &str) -> Result>();
let steps = &steps[0..steps.len() - 1];
for (i, step) in steps.iter().enumerate() {
- client._execute_raw(raw!(*step)).await?;
+ client._execute_raw(raw!(*step)).exec().await?;
client
.migration()
- .find_unique(migration::checksum::equals(checksum.clone()))
- .update(vec![migration::steps_applied::set(i as i32 + 1)])
+ .update(
+ migration::checksum::equals(checksum.clone()),
+ vec![migration::steps_applied::set(i as i32 + 1)],
+ )
.exec()
.await?;
}
From a64ac38005792a26a7bd5024c25fd6e9eed07683 Mon Sep 17 00:00:00 2001
From: Brendan Allan
Date: Fri, 19 Aug 2022 09:03:47 +0800
Subject: [PATCH 10/15] keep dist folder in desktop
---
.gitignore | 4 ++--
apps/desktop/dist/.gitignore | 5 +++++
2 files changed, 7 insertions(+), 2 deletions(-)
create mode 100644 apps/desktop/dist/.gitignore
diff --git a/.gitignore b/.gitignore
index 53da2a22b..500449750 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
node_modules
.next
dist
+!apps/desktop/dist
*.tsbuildinfo
package-lock.json
.eslintcache
@@ -15,7 +16,6 @@ storybook-static/
cache
.env
vendor/
-dist
data
node_modules
packages/turbo-server/data/
@@ -61,4 +61,4 @@ todos.md
examples/*/*.lock
/target
-/sdserver_data
\ No newline at end of file
+/sdserver_data
diff --git a/apps/desktop/dist/.gitignore b/apps/desktop/dist/.gitignore
new file mode 100644
index 000000000..c53272268
--- /dev/null
+++ b/apps/desktop/dist/.gitignore
@@ -0,0 +1,5 @@
+# Ignore everything in this directory
+*
+# Except this file
+!.gitignore
+# This is done so that Tauri never complains that '../dist does not exist'
From 5208628060ced19ef6cdff3066c6529ef7fe8db4 Mon Sep 17 00:00:00 2001
From: Brendan Allan
Date: Fri, 19 Aug 2022 09:57:52 +0800
Subject: [PATCH 11/15] fix clippy ci
---
.github/workflows/clippy.yml | 4 ----
1 file changed, 4 deletions(-)
diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml
index f2c039e33..3de8c04df 100644
--- a/.github/workflows/clippy.yml
+++ b/.github/workflows/clippy.yml
@@ -48,10 +48,6 @@ jobs:
working-directory: core
if: steps.cache-prisma.outputs.cache-hit != 'true'
run: cargo run -p prisma-cli --release -- generate
-
- # This is do the proc-macro `tauri::generate_context!()` doesn't panic
- - name: Create fake `dist` folder
- run: mkdir ./apps/desktop/dist
- name: Run Clippy
uses: actions-rs/clippy-check@v1
From d10cf558bd0775c2add7619d765baff00a5d9858 Mon Sep 17 00:00:00 2001
From: Brendan Allan
Date: Sat, 20 Aug 2022 02:18:52 +0800
Subject: [PATCH 12/15] use ghost api v5 on landing
---
apps/landing/package.json | 102 +++++++++---------
apps/landing/src/pages/blog/api.ts | 52 ++++-----
.../src/pages/blog/post.page.server.ts | 26 ++---
3 files changed, 90 insertions(+), 90 deletions(-)
diff --git a/apps/landing/package.json b/apps/landing/package.json
index 4a5a08e58..d6e3ac3f1 100644
--- a/apps/landing/package.json
+++ b/apps/landing/package.json
@@ -1,53 +1,53 @@
{
- "name": "@sd/landing",
- "scripts": {
- "dev": "pnpm run server",
- "prod": "pnpm run build && pnpm run server:prod",
- "vercel-build": "./vercel/deploy.sh",
- "build": "vite build && vite build --ssr && vite-plugin-ssr prerender",
- "server": "ts-node ./server",
- "server:prod": "cross-env NODE_ENV=production ts-node ./server"
- },
- "dependencies": {
- "@heroicons/react": "^1.0.6",
- "@icons-pack/react-simple-icons": "^5.2.0",
- "@sd/interface": "link:../../packages/interface",
- "@sd/ui": "link:../../packages/ui",
- "@tryghost/content-api": "^1.11.0",
- "@types/compression": "^1.7.2",
- "@types/express": "^4.17.13",
- "@types/node": "^17.0.31",
- "@types/react": "^18.0.8",
- "@types/react-dom": "^18.0.3",
- "@vitejs/plugin-react": "^1.3.2",
- "clsx": "^1.2.1",
- "compression": "^1.7.4",
- "cross-env": "^7.0.3",
- "express": "^4.18.1",
- "phosphor-react": "^1.4.1",
- "prismjs": "^1.28.0",
- "react": "^18.1.0",
- "react-dom": "^18.1.0",
- "react-helmet": "^6.1.0",
- "react-hook-form": "^7.33.1",
- "react-tsparticles": "^2.1.3",
- "sirv": "^2.0.2",
- "ts-node": "^10.7.0",
- "tsparticles": "^2.1.3",
- "typescript": "^4.6.4",
- "vite": "^2.9.14",
- "vite-plugin-ssr": "^0.4.15"
- },
- "devDependencies": {
- "@tailwindcss/line-clamp": "^0.4.0",
- "@tailwindcss/typography": "^0.5.4",
- "@types/prismjs": "^1.26.0",
- "@types/react-helmet": "^6.1.5",
- "@types/tryghost__content-api": "^1.3.11",
- "postcss": "^8.4.14",
- "sass": "^1.54.0",
- "tailwind": "^4.0.0",
- "vite-plugin-markdown": "^2.0.2",
- "vite-plugin-svgr": "^2.2.1"
- }
+ "name": "@sd/landing",
+ "scripts": {
+ "dev": "pnpm run server",
+ "prod": "pnpm run build && pnpm run server:prod",
+ "vercel-build": "./vercel/deploy.sh",
+ "build": "vite build",
+ "server": "ts-node ./server",
+ "server:prod": "cross-env NODE_ENV=production ts-node ./server"
+ },
+ "dependencies": {
+ "@heroicons/react": "^1.0.6",
+ "@icons-pack/react-simple-icons": "^5.2.0",
+ "@sd/interface": "link:../../packages/interface",
+ "@sd/ui": "link:../../packages/ui",
+ "@tryghost/content-api": "^1.11.0",
+ "@types/compression": "^1.7.2",
+ "@types/express": "^4.17.13",
+ "@types/node": "^17.0.31",
+ "@types/react": "^18.0.8",
+ "@types/react-dom": "^18.0.3",
+ "@vitejs/plugin-react": "^1.3.2",
+ "clsx": "^1.2.1",
+ "compression": "^1.7.4",
+ "cross-env": "^7.0.3",
+ "express": "^4.18.1",
+ "phosphor-react": "^1.4.1",
+ "prismjs": "^1.28.0",
+ "react": "^18.1.0",
+ "react-dom": "^18.1.0",
+ "react-helmet": "^6.1.0",
+ "react-hook-form": "^7.33.1",
+ "react-tsparticles": "^2.1.3",
+ "sirv": "^2.0.2",
+ "ts-node": "^10.7.0",
+ "tsparticles": "^2.1.3",
+ "typescript": "^4.6.4",
+ "vite": "^2.9.14",
+ "vite-plugin-ssr": "^0.4.15"
+ },
+ "devDependencies": {
+ "@tailwindcss/line-clamp": "^0.4.0",
+ "@tailwindcss/typography": "^0.5.4",
+ "@types/prismjs": "^1.26.0",
+ "@types/react-helmet": "^6.1.5",
+ "@types/tryghost__content-api": "^1.3.11",
+ "postcss": "^8.4.14",
+ "sass": "^1.54.0",
+ "tailwind": "^4.0.0",
+ "vite-plugin-markdown": "^2.0.2",
+ "vite-plugin-svgr": "^2.2.1"
+ }
}
diff --git a/apps/landing/src/pages/blog/api.ts b/apps/landing/src/pages/blog/api.ts
index 03778da1e..64b298abf 100644
--- a/apps/landing/src/pages/blog/api.ts
+++ b/apps/landing/src/pages/blog/api.ts
@@ -7,35 +7,35 @@ const ghostURL = import.meta.env.VITE_API_URL;
export const blogEnabled = !!(ghostURL && ghostKey);
export const api = blogEnabled
- ? new GhostContentAPI({
- url: ghostURL,
- key: ghostKey,
- version: 'v4'
- })
- : null;
+ ? new GhostContentAPI({
+ url: ghostURL,
+ key: ghostKey,
+ version: 'v5.0'
+ })
+ : null;
export async function getPosts() {
- if (!api) {
- return [];
- }
- const posts = await api.posts
- .browse({
- include: ['tags', 'authors']
- })
- .catch(() => []);
- return posts;
+ if (!api) {
+ return [];
+ }
+ const posts = await api.posts
+ .browse({
+ include: ['tags', 'authors']
+ })
+ .catch(() => []);
+ return posts;
}
export async function getPost(slug: string) {
- if (!api) {
- return null;
- }
- return await api.posts
- .read(
- { slug },
- {
- include: ['tags', 'authors']
- }
- )
- .catch(() => null);
+ if (!api) {
+ return null;
+ }
+ return await api.posts
+ .read(
+ { slug },
+ {
+ include: ['tags', 'authors']
+ }
+ )
+ .catch(() => null);
}
diff --git a/apps/landing/src/pages/blog/post.page.server.ts b/apps/landing/src/pages/blog/post.page.server.ts
index 25d68151c..9f366b450 100644
--- a/apps/landing/src/pages/blog/post.page.server.ts
+++ b/apps/landing/src/pages/blog/post.page.server.ts
@@ -3,22 +3,22 @@ import { PageContextBuiltIn } from 'vite-plugin-ssr';
import { getPost, getPosts } from './api';
export async function onBeforeRender(pageContext: PageContextBuiltIn) {
- const post = await getPost(pageContext.routeParams['slug']);
+ const post = await getPost(pageContext.routeParams['slug']);
- return {
- pageContext: {
- pageProps: {
- post
- }
- }
- };
+ return {
+ pageContext: {
+ pageProps: {
+ post
+ }
+ }
+ };
}
export async function prerender() {
- const posts = await getPosts();
+ const posts = await getPosts();
- return posts.map((post) => ({
- url: `/blog/${post.slug}`,
- pageContext: { pageProps: { post } }
- }));
+ return posts.map((post) => ({
+ url: `/blog/${post.slug}`,
+ pageContext: { pageProps: { post } }
+ }));
}
From d54f4b1c373ed31ccee1cd3b6ab94557d21c0fbb Mon Sep 17 00:00:00 2001
From: Brendan Allan
Date: Sat, 20 Aug 2022 02:41:47 +0800
Subject: [PATCH 13/15] hide funding announcement as blog post isn't working
---
.../src/pages/blog/index.page.server.ts | 33 ++-
apps/landing/src/pages/blog/index.page.tsx | 104 +++----
.../src/pages/blog/post.page.server.ts | 9 -
apps/landing/src/pages/index.page.tsx | 256 +++++++++---------
4 files changed, 200 insertions(+), 202 deletions(-)
diff --git a/apps/landing/src/pages/blog/index.page.server.ts b/apps/landing/src/pages/blog/index.page.server.ts
index c92ae28dc..b2962ec40 100644
--- a/apps/landing/src/pages/blog/index.page.server.ts
+++ b/apps/landing/src/pages/blog/index.page.server.ts
@@ -1,22 +1,27 @@
-import { getPosts } from './api';
+import { blogEnabled, getPosts } from './api';
export async function onBeforeRender() {
- const posts = await getPosts();
+ const posts = await getPosts();
- return {
- pageContext: {
- pageProps: {
- posts
- }
- }
- };
+ return {
+ pageContext: {
+ pageProps: {
+ posts
+ }
+ }
+ };
}
export async function prerender() {
- const posts = await getPosts();
+ const posts = await getPosts();
- return {
- url: '/blog',
- pageContext: { pageProps: { posts } }
- };
+ const individualPosts = posts.map((post) => ({
+ url: `/blog/${post.slug}`,
+ pageContext: { pageProps: { post } }
+ }));
+
+ return [...individualPosts, {
+ url: '/blog',
+ pageContext: { pageProps: { posts } }
+ }];
}
diff --git a/apps/landing/src/pages/blog/index.page.tsx b/apps/landing/src/pages/blog/index.page.tsx
index 3a90b23c1..123a9e066 100644
--- a/apps/landing/src/pages/blog/index.page.tsx
+++ b/apps/landing/src/pages/blog/index.page.tsx
@@ -7,59 +7,59 @@ import { getWindow } from '../../utils';
import { blogEnabled } from './api';
function Page({ posts }: { posts: PostOrPage[] }) {
- if (!blogEnabled) {
- let window = getWindow();
- if (!window) return;
- window.location.href = '/blog-not-enabled';
- return <>>;
- }
+ if (!blogEnabled) {
+ let window = getWindow();
+ if (!window) return;
+ window.location.href = '/blog-not-enabled';
+ return <>>;
+ }
- return (
-
-
- Spacedrive Blog
-
-
-
- Blog
- Get the latest from Spacedrive.
-
-
- {posts.map((post) => {
- return (
- {
- window.location.href = `/blog/${post.slug}`;
- }}
- className="relative z-0 flex flex-col gap-2 mb-8 overflow-hidden transition-colors border border-gray-500 cursor-pointer rounded-xl"
- >
- {post.feature_image && (
-

- )}
-
-
{post.title}
-
{post.reading_time} minute read.
-
{post.excerpt}
-
- by {post.primary_author?.name} ·{' '}
- {new Date(post.published_at ?? '').toLocaleDateString()}
-
-
- {post.tags?.map((tag: Tag) => {
- return ;
- })}
-
-
-
- );
- })}
-
-
- );
+ return (
+
+
+ Spacedrive Blog
+
+
+
+ Blog
+ Get the latest from Spacedrive.
+
+
+ {posts.map((post) => {
+ return (
+ {
+ window.location.href = `/blog/${post.slug}`;
+ }}
+ className="relative z-0 flex flex-col gap-2 mb-8 overflow-hidden transition-colors border border-gray-500 cursor-pointer rounded-xl"
+ >
+ {post.feature_image && (
+

+ )}
+
+
{post.title}
+
{post.reading_time} minute read.
+
{post.excerpt}
+
+ by {post.primary_author?.name} ·{' '}
+ {new Date(post.published_at ?? '').toLocaleDateString()}
+
+
+ {post.tags?.map((tag: Tag) => {
+ return ;
+ })}
+
+
+
+ );
+ })}
+
+
+ );
}
export { Page };
diff --git a/apps/landing/src/pages/blog/post.page.server.ts b/apps/landing/src/pages/blog/post.page.server.ts
index 9f366b450..73d5a08a2 100644
--- a/apps/landing/src/pages/blog/post.page.server.ts
+++ b/apps/landing/src/pages/blog/post.page.server.ts
@@ -13,12 +13,3 @@ export async function onBeforeRender(pageContext: PageContextBuiltIn) {
}
};
}
-
-export async function prerender() {
- const posts = await getPosts();
-
- return posts.map((post) => ({
- url: `/blog/${post.slug}`,
- pageContext: { pageProps: { post } }
- }));
-}
diff --git a/apps/landing/src/pages/index.page.tsx b/apps/landing/src/pages/index.page.tsx
index d4c39fa7f..dbd90e136 100644
--- a/apps/landing/src/pages/index.page.tsx
+++ b/apps/landing/src/pages/index.page.tsx
@@ -12,147 +12,149 @@ import { usePageContext } from '../renderer/usePageContext';
import { getWindow } from '../utils';
interface SectionProps {
- orientation: 'left' | 'right';
- heading?: string;
- description?: string | React.ReactNode;
- children?: React.ReactNode;
- className?: string;
+ orientation: 'left' | 'right';
+ heading?: string;
+ description?: string | React.ReactNode;
+ children?: React.ReactNode;
+ className?: string;
}
function Section(props: SectionProps = { orientation: 'left' }) {
- let info = (
-
- {props.heading &&
{props.heading}
}
- {props.description && (
-
{props.description}
- )}
-
- );
- return (
-
- {props.orientation === 'right' ? (
- <>
- {info}
- {props.children}
- >
- ) : (
- <>
- {props.children}
- {info}
- >
- )}
-
- );
+ let info = (
+
+ {props.heading &&
{props.heading}
}
+ {props.description && (
+
{props.description}
+ )}
+
+ );
+ return (
+
+ {props.orientation === 'right' ? (
+ <>
+ {info}
+ {props.children}
+ >
+ ) : (
+ <>
+ {props.children}
+ {info}
+ >
+ )}
+
+ );
}
function Page() {
- const { urlParsed } = usePageContext();
- const [unsubscribedFromWaitlist, setUnsubscribedFromWaitlist] = useState(false);
+ const { urlParsed } = usePageContext();
+ const [unsubscribedFromWaitlist, setUnsubscribedFromWaitlist] = useState(false);
- useEffect(() => {
- if (!getWindow()) return;
+ useEffect(() => {
+ if (!getWindow()) return;
- const cuid = urlParsed.search?.['wunsub'];
- if (!cuid) return;
+ const cuid = urlParsed.search?.['wunsub'];
+ if (!cuid) return;
- (async () => {
- const prod = import.meta.env.PROD;
- const url = prod ? 'https://waitlist-api.spacedrive.com' : 'http://localhost:3000';
+ (async () => {
+ const prod = import.meta.env.PROD;
+ const url = prod ? 'https://waitlist-api.spacedrive.com' : 'http://localhost:3000';
- const req = await fetch(`${url}/api/waitlist?i=${cuid}`, {
- method: 'DELETE'
- });
+ const req = await fetch(`${url}/api/waitlist?i=${cuid}`, {
+ method: 'DELETE'
+ });
- if (req.status === 200) {
- setUnsubscribedFromWaitlist(true);
- window.history.replaceState(
- {},
- '',
- prod ? 'https://spacedrive.com' : 'http://localhost:8003'
- );
+ if (req.status === 200) {
+ setUnsubscribedFromWaitlist(true);
+ window.history.replaceState(
+ {},
+ '',
+ prod ? 'https://spacedrive.com' : 'http://localhost:8003'
+ );
- setTimeout(() => {
- setUnsubscribedFromWaitlist(false);
- }, 5000);
- } else if (req.status >= 400 && req.status < 500) {
- alert('An error occurred while unsubscribing from waitlist');
- }
- })();
- }, []);
+ setTimeout(() => {
+ setUnsubscribedFromWaitlist(false);
+ }, 5000);
+ } else if (req.status >= 400 && req.status < 500) {
+ alert('An error occurred while unsubscribing from waitlist');
+ }
+ })();
+ }, []);
- return (
- <>
-
- Spacedrive — A file manager from the future.
-
-
-
-
-
-
-
-
- {unsubscribedFromWaitlist && (
-
-
-
You have been unsubscribed from the waitlist
-
- )}
+ return (
+ <>
+
+ Spacedrive — A file manager from the future.
+
+
+
+
+
+
+
+ // Disabled while blog post is not available
+ // TODO: re-enable
+ {/* */}
+ {unsubscribedFromWaitlist && (
+
+
+
You have been unsubscribed from the waitlist
+
+ )}
-
- A file explorer from the future.
-
-
- Combine your drives and clouds into one database that you can organize and explore from any
- device.
-
-
- Designed for creators, hoarders and the painfully disorganized.
-
-
-
-
-
- Spacedrive accounts for every file you own, uniquely fingerprinting and extracting
- metadata so you can sort, tag, backup and share files without limitations of any one
- cloud provider.
-
-
-
- Find out more →
-
- >
- }
- />
-
- >
- );
+
+ A file explorer from the future.
+
+
+ Combine your drives and clouds into one database that you can organize and explore from any
+ device.
+
+
+ Designed for creators, hoarders and the painfully disorganized.
+
+
+
+
+
+ Spacedrive accounts for every file you own, uniquely fingerprinting and extracting
+ metadata so you can sort, tag, backup and share files without limitations of any one
+ cloud provider.
+
+
+
+ Find out more →
+
+ >
+ }
+ />
+
+ >
+ );
}
export { Page };
From 1d158d0d7d0eeafc5dca8aa88fe8915c83f4b1d2 Mon Sep 17 00:00:00 2001
From: Brendan Allan
Date: Sat, 20 Aug 2022 02:48:07 +0800
Subject: [PATCH 14/15] brenan is stupid
---
apps/landing/src/pages/index.page.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/apps/landing/src/pages/index.page.tsx b/apps/landing/src/pages/index.page.tsx
index dbd90e136..a702c9815 100644
--- a/apps/landing/src/pages/index.page.tsx
+++ b/apps/landing/src/pages/index.page.tsx
@@ -100,8 +100,8 @@ function Page() {
- // Disabled while blog post is not available
- // TODO: re-enable
+ {/* Disabled while blog post is not available */}
+ {/* TODO: re-enable */}
{/*
Date: Sat, 20 Aug 2022 23:55:29 -0700
Subject: [PATCH 15/15] hotfix: (macOS) app platform prop not being set
correctly
---
packages/interface/src/App.tsx | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/packages/interface/src/App.tsx b/packages/interface/src/App.tsx
index 81765f019..9b522df65 100644
--- a/packages/interface/src/App.tsx
+++ b/packages/interface/src/App.tsx
@@ -39,6 +39,12 @@ function RouterContainer(props: { props: AppProps }) {
export default function SpacedriveInterface(props: AppProps) {
useInvalidateQuery();
+ // hotfix for bug where props are not updated, not sure of the cause
+ if (props.platform === 'unknown') {
+ // this should be a loading screen if we can't fix the issue above
+ return <>>;
+ }
+
return (