Skip to content

Commit 493c5fc

Browse files
committed
Merge branch 'release/v0.12.14'
2 parents 1c09b47 + e71d5ae commit 493c5fc

File tree

11 files changed

+52
-38
lines changed

11 files changed

+52
-38
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [[0.12.14]](https://github.com/thoth-pub/thoth/releases/tag/v0.12.14) - 2024-11-04
10+
### Changed
11+
- [642](https://github.com/thoth-pub/thoth/issues/642) - Output `ProductAvailability` based on work status in Thoth ONIX 3.0
12+
- [642](https://github.com/thoth-pub/thoth/issues/642) - Use `UnpricedItemType` code `01` (Free of charge) for unpriced products in Thoth ONIX 3.0
13+
914
## [[0.12.13]](https://github.com/thoth-pub/thoth/releases/tag/v0.12.13) - 2024-10-23
1015
### Fixed
1116
- [639](https://github.com/thoth-pub/thoth/issues/639) - Make new locations canonical by default

Cargo.lock

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth"
3-
version = "0.12.13"
3+
version = "0.12.14"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2021"
66
license = "Apache-2.0"
@@ -16,11 +16,11 @@ maintenance = { status = "actively-developed" }
1616
members = ["thoth-api", "thoth-api-server", "thoth-app", "thoth-app-server", "thoth-client", "thoth-errors", "thoth-export-server"]
1717

1818
[dependencies]
19-
thoth-api = { version = "=0.12.13", path = "thoth-api", features = ["backend"] }
20-
thoth-api-server = { version = "=0.12.13", path = "thoth-api-server" }
21-
thoth-app-server = { version = "=0.12.13", path = "thoth-app-server" }
22-
thoth-errors = { version = "=0.12.13", path = "thoth-errors" }
23-
thoth-export-server = { version = "=0.12.13", path = "thoth-export-server" }
19+
thoth-api = { version = "=0.12.14", path = "thoth-api", features = ["backend"] }
20+
thoth-api-server = { version = "=0.12.14", path = "thoth-api-server" }
21+
thoth-app-server = { version = "=0.12.14", path = "thoth-app-server" }
22+
thoth-errors = { version = "=0.12.14", path = "thoth-errors" }
23+
thoth-export-server = { version = "=0.12.14", path = "thoth-export-server" }
2424
clap = { version = "4.5.16", features = ["cargo", "env"] }
2525
dialoguer = { version = "0.11.0", features = ["password"] }
2626
dotenv = "0.15.0"

thoth-api-server/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-api-server"
3-
version = "0.12.13"
3+
version = "0.12.14"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2021"
66
license = "Apache-2.0"
@@ -9,8 +9,8 @@ repository = "https://github.com/thoth-pub/thoth"
99
readme = "README.md"
1010

1111
[dependencies]
12-
thoth-api = { version = "=0.12.13", path = "../thoth-api", features = ["backend"] }
13-
thoth-errors = { version = "=0.12.13", path = "../thoth-errors" }
12+
thoth-api = { version = "=0.12.14", path = "../thoth-api", features = ["backend"] }
13+
thoth-errors = { version = "=0.12.14", path = "../thoth-errors" }
1414
actix-web = "4.9"
1515
actix-cors = "0.7.0"
1616
actix-identity = "0.7.1"

thoth-api/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-api"
3-
version = "0.12.13"
3+
version = "0.12.14"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2021"
66
license = "Apache-2.0"
@@ -16,7 +16,7 @@ maintenance = { status = "actively-developed" }
1616
backend = ["diesel", "diesel-derive-enum", "diesel_migrations", "futures", "actix-web", "jsonwebtoken"]
1717

1818
[dependencies]
19-
thoth-errors = { version = "=0.12.13", path = "../thoth-errors" }
19+
thoth-errors = { version = "=0.12.14", path = "../thoth-errors" }
2020
actix-web = { version = "4.8", optional = true }
2121
argon2rs = "0.2.5"
2222
isbn2 = "0.4.0"

thoth-app-server/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-app-server"
3-
version = "0.12.13"
3+
version = "0.12.14"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2021"
66
license = "Apache-2.0"

thoth-app/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-app"
3-
version = "0.12.13"
3+
version = "0.12.14"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2021"
66
license = "Apache-2.0"
@@ -36,8 +36,8 @@ uuid = { version = "1.10.0", features = ["serde", "v4"] }
3636
# `getrandom` is a dependency of `uuid`, we need to explicitly import and include the `js` feature to enable wasm
3737
# https://docs.rs/getrandom/latest/getrandom/#webassembly-support
3838
getrandom = { version = "0.2", features = ["js"] }
39-
thoth-api = { version = "=0.12.13", path = "../thoth-api" }
40-
thoth-errors = { version = "=0.12.13", path = "../thoth-errors" }
39+
thoth-api = { version = "=0.12.14", path = "../thoth-api" }
40+
thoth-errors = { version = "=0.12.14", path = "../thoth-errors" }
4141

4242
[build-dependencies]
4343
dotenv = "0.15.0"

thoth-client/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-client"
3-
version = "0.12.13"
3+
version = "0.12.14"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2021"
66
license = "Apache-2.0"
@@ -10,8 +10,8 @@ readme = "README.md"
1010
build = "build.rs"
1111

1212
[dependencies]
13-
thoth-api = {version = "=0.12.13", path = "../thoth-api" }
14-
thoth-errors = {version = "=0.12.13", path = "../thoth-errors" }
13+
thoth-api = {version = "=0.12.14", path = "../thoth-api" }
14+
thoth-errors = {version = "=0.12.14", path = "../thoth-errors" }
1515
graphql_client = "0.14.0"
1616
chrono = { version = "0.4.38", features = ["serde"] }
1717
reqwest = { version = "0.12", features = ["json"] }
@@ -22,4 +22,4 @@ serde_json = "1.0"
2222
uuid = { version = "1.10.0", features = ["serde"] }
2323

2424
[build-dependencies]
25-
thoth-api = { version = "=0.12.13", path = "../thoth-api", features = ["backend"] }
25+
thoth-api = { version = "=0.12.14", path = "../thoth-api", features = ["backend"] }

thoth-errors/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-errors"
3-
version = "0.12.13"
3+
version = "0.12.14"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2021"
66
license = "Apache-2.0"

thoth-export-server/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-export-server"
3-
version = "0.12.13"
3+
version = "0.12.14"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2021"
66
license = "Apache-2.0"
@@ -10,9 +10,9 @@ readme = "README.md"
1010
build = "build.rs"
1111

1212
[dependencies]
13-
thoth-api = { version = "=0.12.13", path = "../thoth-api" }
14-
thoth-errors = { version = "=0.12.13", path = "../thoth-errors" }
15-
thoth-client = { version = "=0.12.13", path = "../thoth-client" }
13+
thoth-api = { version = "=0.12.14", path = "../thoth-api" }
14+
thoth-errors = { version = "=0.12.14", path = "../thoth-errors" }
15+
thoth-client = { version = "=0.12.14", path = "../thoth-client" }
1616
actix-web = "4.9"
1717
actix-cors = "0.7.0"
1818
cc_license = "0.1.0"

thoth-export-server/src/xml/onix3_thoth.rs

+15-6
Original file line numberDiff line numberDiff line change
@@ -924,9 +924,18 @@ impl XmlElementBlock<Onix3Thoth> for Work {
924924
}
925925
Ok(())
926926
})?;
927-
// 99 Contact supplier
928927
write_element_block("ProductAvailability", w, |w| {
929-
w.write(XmlEvent::Characters("99")).map_err(|e| e.into())
928+
let availability = match self.work_status {
929+
WorkStatus::CANCELLED => "01", // 01 – Cancelled
930+
WorkStatus::FORTHCOMING => "10", // 10 – Not yet available
931+
WorkStatus::POSTPONED_INDEFINITELY => "09", // 09 – Not yet available, postponed indefinitely
932+
WorkStatus::ACTIVE => "20", // 20 – Available
933+
WorkStatus::SUPERSEDED => "41", // 41 – Not available, replaced by new product
934+
WorkStatus::WITHDRAWN => "49", // 49 – Recalled
935+
WorkStatus::Other(_) => unreachable!(),
936+
};
937+
w.write(XmlEvent::Characters(availability))
938+
.map_err(|e| e.into())
930939
})?;
931940
if let Some(date) = &self.publication_date {
932941
write_element_block("SupplyDate", w, |w| {
@@ -949,9 +958,9 @@ impl XmlElementBlock<Onix3Thoth> for Work {
949958
})?;
950959
}
951960
if publication.prices.is_empty() {
952-
// 04 Contact supplier
961+
// 01 Free of charge
953962
write_element_block("UnpricedItemType", w, |w| {
954-
w.write(XmlEvent::Characters("04")).map_err(|e| e.into())
963+
w.write(XmlEvent::Characters("01")).map_err(|e| e.into())
955964
})
956965
} else {
957966
for price in &publication.prices {
@@ -2836,7 +2845,7 @@ mod tests {
28362845
<WebsiteLink>https://www.book.com/pb_landing</WebsiteLink>
28372846
</Website>
28382847
</Supplier>
2839-
<ProductAvailability>99</ProductAvailability>
2848+
<ProductAvailability>20</ProductAvailability>
28402849
<SupplyDate>
28412850
<SupplyDateRole>08</SupplyDateRole>
28422851
<Date dateformat="00">19991231</Date>
@@ -3357,7 +3366,7 @@ mod tests {
33573366
</Website>"#
33583367
));
33593368
// UnpricedItemType block instead of any Prices
3360-
assert!(output.contains(r#" <UnpricedItemType>04</UnpricedItemType>"#));
3369+
assert!(output.contains(r#" <UnpricedItemType>01</UnpricedItemType>"#));
33613370
assert!(!output.contains(r#" <Price>"#));
33623371

33633372
// Remove chapter DOI: can't output ContentDetail block

0 commit comments

Comments
 (0)