vinmonopolet-ts 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/LICENSE +21 -0
- package/README.md +788 -0
- package/dist/cjs/csvUrls.js +5 -0
- package/dist/cjs/datamaps/facetsMap.js +30 -0
- package/dist/cjs/datamaps/productMap.js +62 -0
- package/dist/cjs/datamaps/productStreamMap.js +55 -0
- package/dist/cjs/datamaps/storeStreamMap.js +38 -0
- package/dist/cjs/filters/boolean.js +3 -0
- package/dist/cjs/filters/clockToPercentage.js +17 -0
- package/dist/cjs/filters/foodPairing.js +12 -0
- package/dist/cjs/filters/index.js +31 -0
- package/dist/cjs/filters/join.js +14 -0
- package/dist/cjs/filters/number.js +39 -0
- package/dist/cjs/filters/openingHours.js +18 -0
- package/dist/cjs/filters/price.js +20 -0
- package/dist/cjs/filters/status.js +15 -0
- package/dist/cjs/filters/text.js +6 -0
- package/dist/cjs/filters/trim.js +6 -0
- package/dist/cjs/filters/volume.js +26 -0
- package/dist/cjs/filters/year.js +5 -0
- package/dist/cjs/index.js +75 -0
- package/dist/cjs/models/Category.js +10 -0
- package/dist/cjs/models/Facet.js +121 -0
- package/dist/cjs/models/FacetCategories.js +17 -0
- package/dist/cjs/models/FacetValue.js +30 -0
- package/dist/cjs/models/FoodPairing.js +34 -0
- package/dist/cjs/models/Pagination.js +24 -0
- package/dist/cjs/models/Product.js +306 -0
- package/dist/cjs/models/ProductImage.js +25 -0
- package/dist/cjs/models/ProductStatus.js +8 -0
- package/dist/cjs/models/RawMaterial.js +13 -0
- package/dist/cjs/models/Store.js +115 -0
- package/dist/cjs/retrievers/getFacets.js +19 -0
- package/dist/cjs/retrievers/getProduct.js +14 -0
- package/dist/cjs/retrievers/getProductByBarcode.js +14 -0
- package/dist/cjs/retrievers/getProducts.js +87 -0
- package/dist/cjs/retrievers/getProductsById.js +11 -0
- package/dist/cjs/retrievers/getProductsByStore.js +25 -0
- package/dist/cjs/retrievers/getStore.js +15 -0
- package/dist/cjs/retrievers/getStores.js +80 -0
- package/dist/cjs/retrievers/searchProducts.js +8 -0
- package/dist/cjs/scripts/getCsvUrls.js +36 -0
- package/dist/cjs/stream.js +38 -0
- package/dist/cjs/util/arrayify.js +6 -0
- package/dist/cjs/util/camelcase.js +7 -0
- package/dist/cjs/util/oneOfMessage.js +7 -0
- package/dist/cjs/util/productUrl.js +32 -0
- package/dist/cjs/util/request.js +45 -0
- package/dist/esm/csvUrls.js +3 -0
- package/dist/esm/datamaps/facetsMap.js +25 -0
- package/dist/esm/datamaps/productMap.js +57 -0
- package/dist/esm/datamaps/productStreamMap.js +50 -0
- package/dist/esm/datamaps/storeStreamMap.js +33 -0
- package/dist/esm/filters/boolean.js +1 -0
- package/dist/esm/filters/clockToPercentage.js +15 -0
- package/dist/esm/filters/foodPairing.js +7 -0
- package/dist/esm/filters/index.js +26 -0
- package/dist/esm/filters/join.js +11 -0
- package/dist/esm/filters/number.js +37 -0
- package/dist/esm/filters/openingHours.js +15 -0
- package/dist/esm/filters/price.js +18 -0
- package/dist/esm/filters/status.js +9 -0
- package/dist/esm/filters/text.js +3 -0
- package/dist/esm/filters/trim.js +3 -0
- package/dist/esm/filters/volume.js +20 -0
- package/dist/esm/filters/year.js +3 -0
- package/dist/esm/index.js +47 -0
- package/dist/esm/models/Category.js +11 -0
- package/dist/esm/models/Facet.js +97 -0
- package/dist/esm/models/FacetCategories.js +14 -0
- package/dist/esm/models/FacetValue.js +31 -0
- package/dist/esm/models/FoodPairing.js +35 -0
- package/dist/esm/models/Pagination.js +52 -0
- package/dist/esm/models/Product.js +279 -0
- package/dist/esm/models/ProductImage.js +28 -0
- package/dist/esm/models/ProductStatus.js +6 -0
- package/dist/esm/models/RawMaterial.js +14 -0
- package/dist/esm/models/Store.js +188 -0
- package/dist/esm/retrievers/getFacets.js +14 -0
- package/dist/esm/retrievers/getProduct.js +9 -0
- package/dist/esm/retrievers/getProductByBarcode.js +9 -0
- package/dist/esm/retrievers/getProducts.js +80 -0
- package/dist/esm/retrievers/getProductsById.js +6 -0
- package/dist/esm/retrievers/getProductsByStore.js +20 -0
- package/dist/esm/retrievers/getStore.js +10 -0
- package/dist/esm/retrievers/getStores.js +73 -0
- package/dist/esm/retrievers/searchProducts.js +3 -0
- package/dist/esm/scripts/getCsvUrls.js +31 -0
- package/dist/esm/stream.js +33 -0
- package/dist/esm/util/arrayify.js +3 -0
- package/dist/esm/util/camelcase.js +4 -0
- package/dist/esm/util/oneOfMessage.js +4 -0
- package/dist/esm/util/productUrl.js +30 -0
- package/dist/esm/util/request.js +40 -0
- package/dist/types/csvUrls.d.ts +5 -0
- package/dist/types/datamaps/facetsMap.d.ts +23 -0
- package/dist/types/datamaps/productMap.d.ts +43 -0
- package/dist/types/datamaps/productStreamMap.d.ts +44 -0
- package/dist/types/datamaps/storeStreamMap.d.ts +32 -0
- package/dist/types/filters/boolean.d.ts +2 -0
- package/dist/types/filters/clockToPercentage.d.ts +5 -0
- package/dist/types/filters/foodPairing.d.ts +3 -0
- package/dist/types/filters/index.d.ts +24 -0
- package/dist/types/filters/join.d.ts +1 -0
- package/dist/types/filters/number.d.ts +6 -0
- package/dist/types/filters/openingHours.d.ts +4 -0
- package/dist/types/filters/price.d.ts +2 -0
- package/dist/types/filters/status.d.ts +1 -0
- package/dist/types/filters/text.d.ts +1 -0
- package/dist/types/filters/trim.d.ts +1 -0
- package/dist/types/filters/volume.d.ts +1 -0
- package/dist/types/filters/year.d.ts +2 -0
- package/dist/types/index.d.ts +51 -0
- package/dist/types/models/Category.d.ts +12 -0
- package/dist/types/models/Facet.d.ts +17 -0
- package/dist/types/models/FacetCategories.d.ts +14 -0
- package/dist/types/models/FacetValue.d.ts +20 -0
- package/dist/types/models/FoodPairing.d.ts +16 -0
- package/dist/types/models/Pagination.d.ts +36 -0
- package/dist/types/models/Product.d.ts +219 -0
- package/dist/types/models/ProductImage.d.ts +19 -0
- package/dist/types/models/ProductStatus.d.ts +6 -0
- package/dist/types/models/RawMaterial.d.ts +11 -0
- package/dist/types/models/Store.d.ts +123 -0
- package/dist/types/retrievers/getFacets.d.ts +3 -0
- package/dist/types/retrievers/getProduct.d.ts +3 -0
- package/dist/types/retrievers/getProductByBarcode.d.ts +3 -0
- package/dist/types/retrievers/getProducts.d.ts +51 -0
- package/dist/types/retrievers/getProductsById.d.ts +3 -0
- package/dist/types/retrievers/getProductsByStore.d.ts +21 -0
- package/dist/types/retrievers/getStore.d.ts +3 -0
- package/dist/types/retrievers/getStores.d.ts +36 -0
- package/dist/types/retrievers/searchProducts.d.ts +2 -0
- package/dist/types/scripts/getCsvUrls.d.ts +1 -0
- package/dist/types/stream.d.ts +6 -0
- package/dist/types/util/arrayify.d.ts +1 -0
- package/dist/types/util/camelcase.d.ts +1 -0
- package/dist/types/util/oneOfMessage.d.ts +1 -0
- package/dist/types/util/productUrl.d.ts +2 -0
- package/dist/types/util/request.d.ts +17 -0
- package/package.json +69 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#Changelog
|
|
2
|
+
|
|
3
|
+
## [1.0.0] - date here
|
|
4
|
+
|
|
5
|
+
A complete "rewrite" (or translation if you will) to TypeScript.
|
|
6
|
+
|
|
7
|
+
### Breaking changes IF YOU ARE COMING FROM THE ORGINAL VINMONOPOLET PACKAGE:
|
|
8
|
+
- Product: Removed property containerSize in favor of Volume to more closely mirror the api.
|
|
9
|
+
- Product: Removed categories property as it no longer exists.
|
|
10
|
+
- Product: Removed pointOfService property, as it no longer exists.
|
|
11
|
+
- Split Product into BaseProduct, StreamProduct and PopulatedProduct. Import for the old Product is now BaseProduct, and populate returns a new instance of PopulatedProduct instead.
|
|
12
|
+
- Product: removed isComplete(), as populate returns a new object instead.
|
|
13
|
+
- Removed onlyCount option from getProducts. It is now its own function getProductCount.
|
|
14
|
+
- Removed getStores as vinmonopolet now only returns a maximum of 126 stores. The old functionality is now effectively split in two new APIs:
|
|
15
|
+
- getAllStores: Takes no arguments and returns all stores without pagination.
|
|
16
|
+
- searchStores: Takes the same arguments as the old getStores (And effectively the same functionality) but will never be able to return more than 126 stores.
|
|
17
|
+
- Store model is changed to better reflect the new API:
|
|
18
|
+
- Like products Store is now split into BaseStore and PopulatedStore. This is due to changes from vinmonopolet.
|
|
19
|
+
- getAllStores will return PopulatedProduct w
|
|
20
|
+
- Streams now return a promise you need to resolve before you can interact with the stream.
|
|
21
|
+
- stream.getProducts now only returns name and code as per april 2021. This is due to changes in data from Vinmonopolet.
|
|
22
|
+
- Minimum Node version is now 14.
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- Product: Added allergens property.
|
|
26
|
+
- Product: Added style property.
|
|
27
|
+
- Facets: Added static strings to generate product category facets.
|
|
28
|
+
- GetProductCount function that returns the count of a given getProducts query.
|
|
29
|
+
- PopulatedProduct model.
|
|
30
|
+
- GetAllStores and SearchStores functions (see Breaking Changes).
|
|
31
|
+
- GetProductsByStore now returns the store number along pagination and products.
|
|
32
|
+
- SearchStore function.
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
- GetStores is completely rewritten. The old api is no longer in use, and the current one returns a maximum of 126 stores in total.
|
|
36
|
+
Instead we just use the stream api and make it more "synchronous" for those who dont want to use the stream implementation.
|
|
37
|
+
- Facet: Facet title now maps to the "code" property instead of the name property. This should restore the old functionality where title now maps to the english name.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 Espen Hovlandsdal
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|