Skip to content
This repository was archived by the owner on May 28, 2023. It is now read-only.

Commit 875ed27

Browse files
authored
Merge pull request #386 from DivanteLtd/develop
Release v1.11
2 parents 8b7ded1 + a67f2fe commit 875ed27

File tree

147 files changed

+12879
-6983
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+12879
-6983
lines changed

.eslintrc.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
module.exports = {
2+
root: true,
3+
env: { jest: true, node: true, es6: true},
4+
parserOptions: {
5+
parser: '@typescript-eslint/parser',
6+
ecmaVersion: 2018,
7+
sourceType: 'module'
8+
},
9+
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
10+
extends: [
11+
'standard',
12+
'plugin:@typescript-eslint/recommended'
13+
],
14+
plugins: ['vue-storefront', '@typescript-eslint'],
15+
// add your custom rules here
16+
rules: {
17+
'@typescript-eslint/no-var-requires': 1,
18+
'@typescript-eslint/indent': ['error', 2],
19+
'@typescript-eslint/camelcase': 0,
20+
semi: 'off',
21+
'@typescript-eslint/semi': 0,
22+
'@typescript-eslint/member-delimiter-style': ['error', { 'multiline': { 'delimiter': 'comma', 'requireLast': false }, 'singleline': { 'delimiter': 'comma' } }],
23+
'@typescript-eslint/no-empty-interface': 1,
24+
'@typescript-eslint/no-use-before-define': 1,
25+
'@typescript-eslint/no-explicit-any': 0,
26+
'@typescript-eslint/class-name-casing': 1,
27+
'@typescript-eslint/no-unused-vars': 0,
28+
'@typescript-eslint/explicit-function-return-type': 0,
29+
'@typescript-eslint/no-var-requires': 0,
30+
'handle-callback-err': 1,
31+
'prefer-promise-reject-errors': 0,
32+
'import/no-duplicates': ['warning'],
33+
// allow paren-less arrow functions
34+
'arrow-parens': 0,
35+
'prefer-arrow-callback': 1,
36+
// allow async-await
37+
'generator-star-spacing': 0,
38+
// allow debugger during development
39+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
40+
'no-restricted-imports': [2, { paths: ['lodash-es'] }],
41+
'vue-storefront/no-corecomponent-import': 'error',
42+
'vue-storefront/no-corecomponent': 'error',
43+
'vue-storefront/no-corepage-import': 'error',
44+
'vue-storefront/no-corepage': 'error',
45+
'no-console': 0,
46+
'no-unused-vars': 1
47+
},
48+
overrides: [
49+
{
50+
// @todo check if this is closed https://github.com/typescript-eslint/typescript-eslint/issues/342
51+
// This is an issue with interfaces so we need to wait until it fixed.
52+
files: ['core/**/*.ts'],
53+
rules: {
54+
'no-undef': 1
55+
}
56+
}
57+
]
58+
};

.github/workflows/nodejs.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Node CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
strategy:
11+
matrix:
12+
node-version: [10.x, 12.x]
13+
14+
steps:
15+
- uses: actions/checkout@v1
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
- name: yarn lint
21+
run: |
22+
yarn
23+
yarn lint
24+
env:
25+
CI: true
26+
- name: yarn build
27+
run: |
28+
yarn build
29+
env:
30+
CI: true
31+

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ api_test.sh
99
package-lock.json
1010
src/config.json
1111
config/local.json
12+
config/certs/*.pem
1213
var/magento2-sample-data/
1314
.migrate
1415
*.iml
1516
/docker/elasticsearch/data/
1617
!/docker/elasticsearch/data/.gitkeep
18+
/docker/elasticsearch7/data/
19+
!/docker/elasticsearch7/data/.gitkeep

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ jobs:
1818
- yarn build
1919
node_js: '10'
2020

21+
- &unit
22+
stage: Test
23+
script: yarn test:unit
24+
name: "NodeJS 10 unit tests"
25+
node_js: "10"
2126
- <<: *build
2227
node_js: '12'
2328

CHANGELOG.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,44 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.11.0] - 2019.12.20
8+
9+
### Fixed
10+
11+
- Fixed some smaller issues with graphql so that it is now working again with the fronted - #350
12+
- Replaced the old `crop` function call which has been removed from Sharp image processor - @grimasod (#381)
13+
14+
15+
## [1.11.0-rc.1] - 2019.10.03
16+
17+
### Added
18+
- Experimental Elastic 7 support - @pkarw (#342)
19+
- Output cache support with tagging and cache invalidate requests forwarding - @pkarw @resubaka (https://github.com/DivanteLtd/vue-storefront/issues/3367, #333)
20+
- Constant for Mailchimp subscription status - @KonstantinSoelch (#294)
21+
- mage2vs import now has optional `--generate-unique-url-keys` parameter which defaults to `false` to enable/disable the url key generation with name and id for categories - @rain2o (#232)
22+
- `extensions/elastic-stock` module added which is a drop-in replacement for `stock`; the difference is that it's getting the stock information from Elastic, not from e-Commerce backend directly; to use it - please just make sure your `config/local.json` file has `elastic-stock` in the `registeredExtensions` collection; then please make sure in the `vue-storefront` to change the `config.stock.ednpoint` from `http://<your-api-host>/api/stock` to `http://<your-api-host>/api/ext/elastic-stock`
23+
- Added eslint config from vue-storefront so we have the same config and in both repos typescript support - @resubaka (#320)
24+
- Added jest support - @resubaka (#321)
25+
- Added caching factory and action factory for the image endpoint. This gives the possibility to use other services for caching or image processing - @resubaka (#317, #315)
26+
- Added support for tax calculation where the values from customer_tax_class_ids is used - @resubaka (#307)
27+
- The `db` context object - passed to every api endpoint now has two usefull methods: `getElasticClient` and `getRedisClient` for accesing the data stores - @pkarw (#328)
28+
- The `lib/utils` got two new methods `getStoreCode(req: Express.Request)` and `getStoreView(code: string)` for getting the current multistore context from `vue-storefront` frontend requests - @pkarw
29+
30+
### Removed
31+
- The `scripts/seo.js` tool has been removed, the legacy `migrations` scripts have been removed, the unused legacy extensions (`gls-parcelshop-dk`, `postnord-parcelshop-dk`) - @pkarw (#342)
32+
33+
### Fixed
34+
- The way Elastic and Redis clients have been fixed and code duplication removed across the app - @pkarw (#327)
35+
- The `product.price_*` fields have been normalized with the backward compatibility support (see `config.tax.deprecatedPriceFieldsSupport` which is by default true) - @pkarw (#289)
36+
- The `product.final_price` field is now being taken into product price calcualtion. Moreover, we've added the `config.tax.finalPriceIncludesTax` - which is set to `true` by default. All the `price`, `original_price` and `special_price` fields are calculated accordingly. It was required as Magento2 uses `final_price` to set the catalog pricing rules after-prices - @pkarw (#289)
37+
- Force ES connections to use protocol config option - @cewald (#303, #304)
38+
- Better handling of HTTP error codes provided by API client - #3151
39+
40+
### Changed
41+
- Error responses for mailchimp - @andrzejewsky (#3337)
42+
- Replaced function arguments to object destructuring in `calculateProductTax` - @andrzejewsky (#3337)
43+
- Refactor `taxcalc.js` similar to frontend - @gibkigonzo (#356)
44+
745
## [1.10.0] - 2019.08.12
846

947
### Added
@@ -16,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1654
- Extensions have ability to modify Elasticsearch results. - @grimasod (#269)
1755
- Refactored Travis build config - @Tjitse-E (#273)
1856
- Multistore support for `magento1`-platform using `magento1-vsbridge` - @cewald (#276)
57+
- Support self signed certificates - @lukeromanowicz (#287)
1958

2059
### Changed
2160
- Sharp dependency has been updated. *It might require reinstalling yarn dependencies* - @lukeromanowicz
@@ -56,7 +95,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5695
- Support unicode characters in order requests - @lukeromanowicz (#201)
5796
- TravisCI configured for building and linting - @lukeromanowicz (#204)
5897
- Use Redis database from configuration in mage2vs - @Cyclonecode (#211)
59-
- Requests with invalid body result in HTTP code 400 instead of 500 - @AndreiBelokopytov (#220)
98+
- Requests with invalid body result in HTTP code 400 instead of 500 - @AndreiBelokopytov (#220)
6099
- `src/models/order.schema.json` was moved to `src/models/order.schema.js` to support regex transformation - @lukeromanowicz (#201)
61100

62101
## [1.8.4] - 2019.04.17

README.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,68 @@ A [Kibana](https://www.elastic.co/products/kibana) service is available to explo
6565

6666
At first access it will ask to specify an index pattern, insert `vue_storefront*`
6767

68+
**Note:** Kibana is not provided with the Elastic 7 docker file. Please install it on your own when needed or check the [`es-head`](https://chrome.google.com/webstore/detail/elasticsearch-head/ffmkiejjmecolpfloofpjologoblkegm) Chrome plugin.
69+
70+
## Elastic 7 support
71+
72+
By default, Vue Storefront API docker files and config are based on Elastic 5.6. We plan to change the default Elastic version to 7 with the 1.11 stable release. As for now, the [Elastic 7 support](https://github.com/DivanteLtd/vue-storefront-api/pull/342) is marked as **experimental**.
73+
74+
**How to use it?**
75+
76+
In order to use the new Elastic 7 please make sure your `vue-storefront-api` has been checked out from the [PR#342](https://github.com/DivanteLtd/vue-storefront-api/pull/342) branch.
77+
To start the Elastic 7 docker service please use the `docker-compose.elastic7.yml` file provided:
78+
79+
```bash
80+
docker-compose -f docker-compose.elastic7.yml up
81+
```
82+
83+
Then, please do change the `config/local.json` to start using the new Elastic API. Key properties in the `elasticsearch` section are: `indexTypes` and `apiVersion` (to be set to 7.1). If you're using the multistore configuration please make sure you adjusted the `storeViews.*.elasticsearch` section as well - per each separate store.
84+
85+
```json
86+
"elasticsearch": {
87+
"host": "localhost",
88+
"port": 9200,
89+
"protocol": "http",
90+
"min_score": 0.01,
91+
"indices": [
92+
"vue_storefront_catalog",
93+
"vue_storefront_catalog_de",
94+
"vue_storefront_catalog_it"
95+
],
96+
"indexTypes": [
97+
"product",
98+
"category",
99+
"cms_block",
100+
"cms_page",
101+
"attribute",
102+
"taxrule",
103+
"review"
104+
],
105+
"apiVersion": "7.1"
106+
}
107+
```
108+
109+
Starting from [Elasitc 6 and 7](https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking-changes-7.0.html) we can have **just single** document type per single index. Vue Storefront used to have `product`, `category` ... types defined in the `vue_storefront_catalog`.
110+
111+
From now on, we're using the separate indexes per each entity type. The convention is: `${indexName}_${entityType}`. If your' **logical index name** is `vue_storefront_catalog` then it will be mapped to the **physical indexes** of: `vue_storefront_catalog_product`, `vue_storefront_catalog_category` ...
112+
113+
To take the advantage of this new logical->physical index distinction we've provided new Elastic tools: `db7`, `migrate7`, `dump7`, `restore7` tools. They can be used exactly the same way [like the old tools](https://docs.vuestorefront.io/guide/data/database-tool.html) were. The only distinction is that they work on separate indexes.
114+
115+
**Create new index**
116+
117+
Before restoreing or importing data you might want to create a new Elastic index with the proper data types/schema applied. You can run just the `yarn db7 new` command in order to do that.
118+
119+
**Restore the data**
120+
121+
After you ran the docker file and have Elastic7 up and running you might want to:
122+
123+
a) restore the demo data by running `yarn restore7` and `yarn restore7_it; yarn restore7_de` for default multistores. The data is restored from `var/catalog_product.json`, `var/catalog_category.json` and so on...
124+
125+
b) import the data from Magento to proper physical indexes. To do so, currently you can do this only with [mage2vuestorefront](https://github.com/DivanteLtd/mage2vuestorefront/pull/96).
126+
127+
**Note:** After 1.11 stable release (around November, 2019) we'll **replace** the standard tools: `db`, `migrate`, `dump`, `restore` with the Elastic 7 equivalents and it will become the default.
128+
129+
68130
## API access
69131
Catalog API calls are compliant with ElasticSearch (it works like a filtering proxy to ES). More on ES queries: [ElasticSearch queries tutorial](http://okfnlabs.org/blog/2013/07/01/elasticsearch-query-tutorial.html)
70132

@@ -94,6 +156,24 @@ NOTE: `npm` users will still have to install the dependencies individually in th
94156

95157
## Reviews
96158
To use review feature you need to install custom module for Magento 2: [Divante ReviewApi](https://github.com/DivanteLtd/magento2-review-api)
159+
By default new reviews will be added with status "Pending".
160+
```json
161+
"review": {
162+
"defaultReviewStatus": 2
163+
},
164+
```
165+
166+
## Output Cache
167+
Vue Storefront API supports output cache for catalog operations. Cache is tagged and can by dynamically invalidated. Please find the details how to configure it [in our docs](https://docs.vuestorefront.io/guide/basics/ssr-cache.html).
168+
169+
You can manually clear the Redis cache for specific tags by running the following command:
170+
171+
```bash
172+
npm run cache clear
173+
npm run cache clear -- --tag=product,category
174+
npm run cache clear -- --tag=P198
175+
npm run cache clear -- --tag=*
176+
```
97177

98178
## Running initial Magento2 import
99179

@@ -141,6 +221,11 @@ You can use the following command to run a delta indexer for a specific storevie
141221
yarn mage2vs productsdelta --store-code=de
142222
```
143223

224+
## Self signed certificates
225+
226+
Often in non production environment other services are using self signed certificates for secure connection.
227+
You can easily setup the application to trust them by putting them in config/certs directory.
228+
144229
License
145230
-------
146231

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = {
33
[
44
'@babel/preset-env', {
55
targets: {
6-
node: "8"
6+
node: "10"
77
}
88
}
99
]

config/certs/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)