Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NTR - prepare release 0.9.0 #42

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# NEXT-RELEASE
- NEXT-37536 - Added the profile mapping option `column_type` with which the column type can be specified if the inferred one leads to conversion t issues. Valid options are `string`, `number` and `boolean`.

# v0.9.0

- NEXT-37536 - Added the profile mapping option `column_type` with which the column type can be specified if the inferred one leads to conversion issues. Valid options are `string`, `number` and `boolean`.
- NEXT-37310 - Added single row import strategy when encountering an error that cannot be handled automatically during a chunk import.

# v0.8.0
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sw-sync-cli"
version = "0.8.0"
version = "0.9.0"
edition = "2021"
description = "CLI for fast and flexible data transfer between shopware and (CSV) files over API"
keywords = ["cli", "shopware", "import", "export"]
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ The structure of a profile `.yaml` is as follows:
entity: product

# optional filtering, only applied on export
# maps to api filters, see https://developer.shopware.com/docs/resources/references/core-reference/dal-reference/filters-reference.html
filter:
# export main products (parentId = NULL) only
- type: "equals"
Expand Down Expand Up @@ -150,8 +151,8 @@ mappings:
key: "net_price_eur"

# optional serialization script, which is called once per entity
# documentation can be found here https://github.com/shopware/sw-sync-cli?tab=readme-ov-file#serialization--deserialization-scripts
serialize_script: |
// See https://rhai.rs/book/ for scripting language documentation
// you receive an entity object, which consists of the whole entity API response for that single entity
// you also receive an empty row object where the specified keys above are missing (you need to set them)
// the other simple mappings are executed (added to the row object) after this script
Expand All @@ -166,13 +167,14 @@ serialize_script: |
row.gross_price_eur = price.gross;
row.net_price_eur = price.net;

# optional deserialization script, which is called once per entity
# optional deserialization script, which is called once per file row
# documentation can be found here https://github.com/shopware/sw-sync-cli?tab=readme-ov-file#serialization--deserialization-scripts
deserialize_script: |
// See https://rhai.rs/book/ for scripting language documentation
// you receive 'row' as an object that has all the keys defined above with the corresponding value
// you receive 'row' as an object that has all the keys defined above with the corresponding value from the file row
// you also receive an empty entity object, where you need to resolve your keys
// the other simple mappings are executed (added to the entity object) after this script

// debugging utils
// print(entity); // will be empty
// debug(row); // will contain only the specified keys + their values

Expand Down Expand Up @@ -201,7 +203,10 @@ deserialize_script: |
These are optional scripts where you can run more complex serialization/deserialization logic for your specific use case. These scripts are written in the [Rhai scripting language](https://rhai.rs/book/).
The scripts are executed once per entity.

For serialization, you receive the entity object and an empty row object which you can populate. For deserialization, you receive the row object and an empty entity object which you can populate. The keys you set in the entity/row object should match the keys you defined in the mappings section. The other simple mappings are executed after these scripts.
For serialization, you receive the entity object and an empty row object which you can populate.
For deserialization, you receive the row object and an empty entity object which you can populate.
The keys you set in the entity/row object should match the keys you defined in the mappings section.
The other simple mappings are executed after these scripts.

There are some utility functions available in the scripts:
- `get_default(key: string) -> string`: Returns the default value for the given key. The following keys are available:
Expand Down