Giter Site home page Giter Site logo

ephigenia / ikea-availability-checker Goto Github PK

View Code? Open in Web Editor NEW
227.0 5.0 41.0 2.05 MB

Command-Line-Script & Library for checking the availability of specific IKEA products in specific stores and/or countries.

License: MIT License

JavaScript 14.56% Shell 11.77% TypeScript 72.90% Makefile 0.77%
ikea stock iows furniture api cli bu-codes storage warehouse command-line-tool

ikea-availability-checker's Introduction

Hi there 👋

Hi, I’m a formerly freelance full-stack developer from Berlin working for @bitly Europe (@Egoditor). Beforehand I was supporting agencies, businesses, and science projects with clean and fast performing JavaScript & PHP since 2001.

Whether it’s back end or front end, apps or web-based services, consulting or coding – I love to tackle complex challenges and always strive for a structured product.

GitHub stats

ikea-availability-checker's People

Contributors

bambutz avatar bartsimp avatar cfharp avatar cquintana92 avatar cubeghost avatar dependabot[bot] avatar ephemera avatar ephigenia avatar gitolicious avatar gitter-badger avatar guedou avatar i-pear avatar jeffreyca avatar lirux avatar martinlosak avatar maxkratz avatar mochipon avatar nick2k3 avatar nrobert avatar rcralph avatar semantic-release-bot avatar teko012 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ikea-availability-checker's Issues

SyntaxError: Unexpected token '.'

Describe the bug
Cannot check stock - SyntaxError

To Reproduce
Steps to reproduce the behavior:

$ ikea-availability stock --country be 30346934
/usr/local/lib/node_modules/ikea-availability-checker/source/lib/iows2.js:232
        if (err.request?.res) {
                        ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/ikea-availability-checker/source/cli-stock.js:8:13)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

Client (please complete the following information):
Debian Bullseye
NodeJS v12.22.5
Installed from npm

Help

The cmd gives me this error "Missing script: "start"

stock availability with buCode only doesn’t work

Though the store’s buCode also defines the country the store is in the following call doesn't return any result:

npm run start -- stock --store=155 S69022537

probably caused by getStoresMatchingQuery not returning any stores.

A Paris store is missing

First of all thanks a lot for this tool! It is really useful.

Describe the bug
The "Rivoli" store is missing in stores.json.

To Reproduce
Use the following command:

ikea-availability stores store fr |grep Rivoli

Expected behavior

ikea-availability stores store fr |grep Rivoli
│ fr          │ France  │ 645    │ Rivoli      

Possible fix
Here is the patch that I used to fix this issue:

diff --git a/source/data/stores.json b/source/data/stores.json
index fe5ff7b..4d13040 100644
--- a/source/data/stores.json
+++ b/source/data/stores.json
@@ -3289,6 +3289,15 @@
     ],
     "countryCode": "be"
   },
+  {
+    "buCode": "645",
+    "name": "Rivoli",
+    "coordinates": [
+      2.3425746,
+      48.8604859
+    ],
+    "countryCode": "fr"
+  },
   {
     "buCode": "376",
     "name": "Zaventem",

Use as a library

It doesn't seem like this code is usable as a library. Would you consider adding the ability for this to be used as a library, as well as a CLI program?

"stores at" return testing/garbage output

Describe the bug

[frafra@e32 ~]$ npx ikea-availability-checker stores at | head -n5
npx: installed 20 in 1.466s
undefined
undefined
undefined
                                   !             H|H|H|H|H           H__________________________________             H|§|§|§|H           H|* * * * * *|---------------------|             H|§|∞|§|H           H| * * * * * |---------------------|             H|§|§|§|H           H|* * * * * *|---------------------|             H|H|H|H|H           H| * * * * * |---------------------|             H|H|H|H|H           H|---------------------------------|          ===============        H|---------------------------------|            /| _   _ |          H|---------------------------------|            (| O   O |)          H|---------------------------------|            /|   U   |          H-----------------------------------             |  =/  |           H              _..._/            H              _|I/|_            H      _______/| H |/_______    H     /           / /          H    |          | | /         |  H    |          ||o||          |  H    |    |     ||o||     |    |  H    |    |     ||o||     |    |  H   Carl Pilcher  
tͣ͂eͪͩsͫ̈tͤ̈ī̉̄n̏ͨg͊̈ͦ ̈̀ ҉͍̝̜t͐͒e͑̚s͌͒tͮ̊i̔̃ň̋g͆͗ ͦͣtͪͬe̿͌ ҉̠̳̼s̈̚tͤ̓iͬͣ̌n͋̎ ҉̙̜g̐ͤ ͫ́ ҉̜̼̕t̽̾ ҉̹̱͜e͌̇s̏̾ͣt̽͋iͬ̇ͯn̑͑g̓̿ ̀t̾͛eͭ͊s̾̅̌tͤ̇i͛̓ ҉̗̬͈͜͠n̂ͯg͋͊͛ ͨ͑t͌ͮe̐ͬs͒̚ ҉̶̧ ҉̗̟͎t͒̉ỉ͑̚ň̓g̍̈ ͯ̔t̓͐ ҉͚͘ė̑ ҉̪ͅs̓̑͑t̏̽iͮ͐n͌̆ǧ͒
^C[frafra@e32 ~]$ npx ikea-availability-checker -V
npx: installed 20 in 1.484s
1.0.5

Wrong method calling

Promise {
  <rejected> TypeError: stores.getStoreById is not a function
      at Object.availability ([...]/node_modules/ikea-availability-checker/source/index.js:21:26)
}
(node:12110) UnhandledPromiseRejectionWarning: TypeError: stores.getStoreById is not a function

Apparently the store object does not contain getStoreById anymore but findById instead

const checker = require('ikea-availability-checker');
console.log(Object.keys(checker.stores));
[
  'data',
  'findByQuery',
  'findById',
  'findOneById',
  'findByCountryCode',
  'getCountryCodes',
  'getLanguageCode'
]

Check online store stock

Can this also be expanded to return the online store stock? or is it only actual branch locations only?

Home Delivery Availability

In an age where more and more shopping happens online, I think many people will find it useful to check Home Delivery Availability.

Is there currently a way to check for Home Delivery Availability within a country? If not, would be possible to have this option added if IKEA provides this information through their endpoints?

I think this works slightly differently as some countries (GB, DE...) require a postcode to check for Home Delivery Availability.

Support Abholstation availability

Some countries like germany and Austria have also the option to pickup from Abholstations "Pickup stations". Can this be added as well?

The automated release is failing 🚨

🚨 The automated release from the 1.0.x branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the 1.0.x branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


The release 1.0.3 on branch 1.0.x cannot be published as it is out of range.

Based on the releases published on other branches, only versions within the range >=1.0.2 <1.0.3 can be published from branch 1.0.x.

The following commit is responsible for the invalid release:

  • fix: adds check-pr-title workflow (d8d5d19)

This commit should be moved to a valid branch with git merge or git cherry-pick and removed from branch 1.0.x with git revert or git reset.

A valid branch could be master.

See the workflow configuration documentation for more details.


Good luck with your project ✨

Your semantic-release bot 📦🚀

Setup Semantic Release

Setup semantic release with

master -> channel: latest
develop -> channel: beta
next -> channel: next

403 Error / Deprecated on Alpha 5

The issue from #111 and #113 is back :(

I seem to be having the same issue on 2.0.0-alpha.5

Command
npx ikea-availability-checker@alpha stock --country=nl 50411990

Most countries I attempted return a probability=ERR_HTTP_403:

  • no
  • dk
  • ch
  • jp
  • au
  • ca
  • hk
  • at
  • sg
  • nl
  • es
  • fr
  • be
  • kw
  • us
  • gb
  • it
  • hu
  • pl
  • cz
  • sk
  • tw
  • fi
  • my
  • cn
  • pt
  • ro
  • ie
  • th
  • qa
  • jo
  • hr
  • kr
  • es

Some countries return a probability=DEPRECATED:

  • se
  • de

Some countries still work:

  • sa
  • lt

At first I thought the product might be deprecated in those countries, but that is not the case. I confirmed that the product was still in stock on their website. So is seems to be pointing to something else being deprecated.

Still this does not explain the 403 errors on the other countries.

Hopefully there is a fix. If you need me to do additional testing, I'd be happy to.

undefined "stock" in alpha version

Original report from @okniazik in #100 (comment)

npx [email protected] stock --country pl 80382321                          
Need to install the following packages:
  [email protected]
Ok to proceed? (y) y
/Users/ephigenia/.npm/_npx/dc2879d1cfed7f18/node_modules/ikea-availability-checker/source/cli-stock.js:152
      .then(results => results.filter(item => item.availability.stock >= opts.minStock))
                                                                ^

TypeError: Cannot read properties of undefined (reading 'stock')
    at /Users/ephigenia/.npm/_npx/dc2879d1cfed7f18/node_modules/ikea-availability-checker/source/cli-stock.js:152:65
    at Array.filter (<anonymous>)
    at /Users/ephigenia/.npm/_npx/dc2879d1cfed7f18/node_modules/ikea-availability-checker/source/cli-stock.js:152:32
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

  • OS: OSX
  • Version 2.0.0-alpha.1

Error: 'ikea-availability-stock' does not exist

Hello all,

I've installed the package within a docker container with the following settings:

  • ubuntu 20.04
  • nodejs v10.19.0
  • npm v6.14.4

To install the checker, I've used the following command npm install -g ikea-availability-checker which gives me a warning:

npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]

Although ikea-availability --help outputs the correct help section of the program, ikea-availability stock at results in an error:

_/usr/local/lib/node_modules/ikea-availability-checker/node_modules/commander/index.js:925
throw new Error(executableMissing);
^

Error: 'ikea-availability-stock' does not exist

  • if 'stock' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
  • if the default executable name is not suitable, use the executableFile option to supply a custom name
    at ChildProcess.proc.on (/usr/local/lib/node_modules/ikea-availability-checker/node_modules/commander/index.js:925:15)
    at ChildProcess.emit (events.js:198:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
    at onErrorNT (internal/child_process.js:415:16)
    at process.tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

Am I missing something? Any idea where my fault is?


Small side notice: ikea-availability-check can not be found as a executable.

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two Factor Authentication for your account, set its level to "Authorization only" in your account settings. semantic-release cannot publish with the default "
Authorization and writes" level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

find stor by ID returns wrong type of object

Promise {
  <rejected> AssertionError [ERR_ASSERTION]: Expected first argument countryCode to be a string, instead undefined given.
      at new IOWS2 ([...]/node_modules/ikea-availability-checker/source/lib/iows2.js:52:12)
      at Object.availability ([...]/node_modules/ikea-availability-checker/source/index.js:24:18)

It seems that stores.findById returns an array of stores, this is why the below code throws an error

const store = stores.findById(buCode);
// @TODO handle error when store could not be found
const iows = new IOWS2(store.countryCode);

the object store is an array, not an object containing countryCode resulting in an undefined value, handled by the asserter as an error

Can't search by store ID

Thanks for putting this together. I apologize if I'm doing something incorrectly here but I can't seem to get this to run whenever I pass the "store" parameter, as shown in the docs. For instance, this works fine:

`% npm run start -- stock --country=ca 40413131

[email protected] start /Users/abc/projects/ikea/node_modules/ikea-availability-checker
node $npm_package_main "stock" "--country=ca" "40413131"

┌──────────────────────────┬─────────────┬─────────┬──────────┬──────────────────┬──────────────┬───────┬─────────────┐
│ date │ countryCode │ country │ product │ storeId (buCode) │ store │ stock │ probability │
├──────────────────────────┼─────────────┼─────────┼──────────┼──────────────────┼──────────────┼───────┼─────────────┤
│ 2020-06-23T02:57:26.181Z │ ca │ Canada │ 40413131 │ 414 │ Boucherville │ 144 │ HIGH │
├──────────────────────────┼─────────────┼─────────┼──────────┼──────────────────┼──────────────┼───────┼─────────────┤
│ 2020-06-23T02:57:26.176Z │ ca │ Canada │ 40413131 │ 040 │ Burlington │ 50 │ HIGH │
├──────────────────────────┼─────────────┼─────────┼──────────┼──────────────────┼──────────────┼───────┼─────────────┤
│ 2020-06-23T02:57:26.190Z │ ca │ Canada │ 40413131 │ 216 │ Calgary │ 4 │ HIGH │
├──────────────────────────┼─────────────┼─────────┼──────────┼──────────────────┼──────────────┼───────┼─────────────┤
│ 2020-06-23T02:57:26.182Z │ ca │ Canada │ 40413131 │ 313 │ Coquitlam │ 54 │ HIGH │
├──────────────────────────┼─────────────┼─────────┼──────────┼──────────────────┼──────────────┼───────┼─────────────┤
│ 2020-06-23T02:57:26.190Z │ ca │ Canada │ 40413131 │ 349 │ Edmonton │ 0 │ LOW │
├──────────────────────────┼─────────────┼─────────┼──────────┼──────────────────┼──────────────┼───────┼─────────────┤
│ 2020-06-23T02:57:26.184Z │ ca │ Canada │ 40413131 │ 256 │ Etobicoke │ 40 │ HIGH │
├──────────────────────────┼─────────────┼─────────┼──────────┼──────────────────┼──────────────┼───────┼─────────────┤
│ 2020-06-23T02:57:26.182Z │ ca │ Canada │ 40413131 │ 039 │ Montreal │ 114 │ HIGH │
├──────────────────────────┼─────────────┼─────────┼──────────┼──────────────────┼──────────────┼───────┼─────────────┤
│ 2020-06-23T02:57:26.196Z │ ca │ Canada │ 40413131 │ 149 │ North York │ 152 │ HIGH │
├──────────────────────────┼─────────────┼─────────┼──────────┼──────────────────┼──────────────┼───────┼─────────────┤
│ 2020-06-23T02:57:26.178Z │ ca │ Canada │ 40413131 │ 004 │ Ottawa │ 23 │ HIGH │
├──────────────────────────┼─────────────┼─────────┼──────────┼──────────────────┼──────────────┼───────┼─────────────┤
│ 2020-06-23T02:57:26.179Z │ ca │ Canada │ 40413131 │ 003 │ Richmond │ 81 │ HIGH │
├──────────────────────────┼─────────────┼─────────┼──────────┼──────────────────┼──────────────┼───────┼─────────────┤
│ 2020-06-23T02:57:26.178Z │ ca │ Canada │ 40413131 │ 372 │ Vaughan │ 18 │ HIGH │
├──────────────────────────┼─────────────┼─────────┼──────────┼──────────────────┼──────────────┼───────┼─────────────┤
│ 2020-06-23T02:57:26.188Z │ ca │ Canada │ 40413131 │ 249 │ Winnipeg │ 73 │ HIGH │
└──────────────────────────┴─────────────┴─────────┴──────────┴──────────────────┴──────────────┴───────┴─────────────┘
`

But attempting to put in the store ID for any store on the list returns an empty data set, for instance:

`% npm run start -- stock --country=ca --store=414 40413131

[email protected] start /Users/abc/projects/ikea/node_modules/ikea-availability-checker
node $npm_package_main "stock" "--country=ca" "--store=414" "40413131"

┌──────┬─────────────┬─────────┬─────────┬──────────────────┬───────┬───────┬─────────────┐
│ date │ countryCode │ country │ product │ storeId (buCode) │ store │ stock │ probability │
└──────┴─────────────┴─────────┴─────────┴──────────────────┴───────┴───────┴─────────────┘
`

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two Factor Authentication for your account, set its level to "Authorization only" in your account settings. semantic-release cannot publish with the default "
Authorization and writes" level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

The automated release is failing 🚨

🚨 The automated release from the next branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the next branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


No npm token specified.

An npm token must be created and set in the NPM_TOKEN environment variable on your CI environment.

Please make sure to create an npm token and to set it in the NPM_TOKEN environment variable on your CI environment. The token must allow to publish to the registry https://registry.npmjs.org/.


Good luck with your project ✨

Your semantic-release bot 📦🚀

undefined store for fr country

There is a issue on french contry requests, for exemple : npx [email protected] stock --store 562 80382321 will throw an issue on buCode.

return cache[key].find(item => item.store.buCode === buCode);
                                              ^

TypeError: Cannot read properties of undefined (reading 'buCode')
    at /workspace/ikea-web-checker/node_modules/ikea-availability-checker/source/lib/ingka.js:99:47
    at Array.find (<anonymous>)
    at IngkaApi.getStoreProductAvailability (/workspace/ikea-web-checker/node_modules/ikea-availability-checker/source/lib/ingka.js:99:23)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)

After investigating there is a undefined store.

image

Is it possible to add a small verification on this find ?

return cache[key].find(item => item.store && item.store.buCode === buCode);

Add support for Dublin store

Hello, would it be possible to add support to this awesome tool for the IKEA in Dublin Ireland ? The store id is 038. Thanks.

Markdown reporter

Hi!
Thanks for sharing the code of your nice project! :-)
I was wondering if you were willing to add a reporter for generating Markdown/CommonMark tables.

Cannot read property 'toISOString' of undefined

This issue arises sometimes, not every time but once it is there it keeps on happening.

Query: npm run start -- stock --country us S19282863

Output:

(node:17224) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toISOString' of undefined
    at /Users/martinstoyanov/Downloads/ikea/node_modules/ikea-availability-checker/source/lib/reporter/stock-table.js:57:32
    at Array.map (<anonymous>)
    at Object.createReport (/Users/martinstoyanov/Downloads/ikea/node_modules/ikea-availability-checker/source/lib/reporter/stock-table.js:56:8)
    at /Users/martinstoyanov/Downloads/ikea/node_modules/ikea-availability-checker/source/cli-stock.js:114:45
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:17224) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:17224) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I'm on the latest version. Thanks!

Szczecin store not visible in the software

Describe the bug
Szczecin store doesn't appear when running ikea-availability stores pl or any other command.

To Reproduce
Steps to reproduce the behavior:

  1. Run ikea-availability stores pl
  2. See the lack of Szczecin store

Expected behavior
Szczecin store is being checked by the software

Screenshots

> ikea-availability stores pl
┌─────────────┬─────────┬────────┬──────────────────────┐
 countryCode  country  buCode  name                 
├─────────────┼─────────┼────────┼──────────────────────┤
 pl           Poland   188     Warszawa / Janki     
├─────────────┼─────────┼────────┼──────────────────────┤
 pl           Poland   203     Gdańsk               
├─────────────┼─────────┼────────┼──────────────────────┤
 pl           Poland   204     Kraków               
├─────────────┼─────────┼────────┼──────────────────────┤
 pl           Poland   205     Poznań               
├─────────────┼─────────┼────────┼──────────────────────┤
 pl           Poland   294     Wrocław              
├─────────────┼─────────┼────────┼──────────────────────┤
 pl           Poland   306     Katowice             
├─────────────┼─────────┼────────┼──────────────────────┤
 pl           Poland   307     Warszawa / Targówek  
├─────────────┼─────────┼────────┼──────────────────────┤
 pl           Poland   311     Lublin               
├─────────────┼─────────┼────────┼──────────────────────┤
 pl           Poland   329     Łódź                 
├─────────────┼─────────┼────────┼──────────────────────┤
 pl           Poland   429     Bydgoszcz            
├─────────────┼─────────┼────────┼──────────────────────┤
 pl           Poland   623     Warszawa / Blue City 
└─────────────┴─────────┴────────┴──────────────────────┘

Client (please complete the following information):

  • OS: Linux Ubuntu

IKEA Store missing and error

Hello,

I would very like to use this API but I have some issues:

  1. This store (https://www.ikea.com/fr/fr/stores/grand-parilly/) is missing in the French stores list (when typing the command npx ikea-availability-checker -- stores fr it doesn't show up)
  2. Don't know if its related but checking the stock of a product on all the French stores (npx ikea-availability-checker -- stock --country fr 20388972) makes an error: (node:17700) UnhandledPromiseRejectionWarning: Error: Unable to receive product 20388972 availability for store 132 status code: 410 Gone.

Thanks.

Missing store,

It looks like Store 537 FL, Jacksonville is missing from the list.

Thanks.

US search not working

Logging a separate issue to follow-on to my previous one, when I try to enter the country code "us", I get the following error:

`% npm run start -- stock --country=us 40413131

[email protected] start /Users/abc/projects/ikea/node_modules/ikea-availability-checker
node $npm_package_main "stock" "--country=us" "40413131"

(node:16663) UnhandledPromiseRejectionWarning: Error: Unable to receive product 40413131 availability for store 250 status code: 410.
at /Users/abc/projects/ikea/node_modules/ikea-availability-checker/source/lib/iows2.js:52:23
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Promise.all (index 42)
(node:16663) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:16663) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.`

Running the same command with other country codes works fine.

Some item's showing Not Found

Describe the bug
Certain items have begun showing "Not Found" when queried via the API but when I search those items on the Ikea website they show up without issue. This is for queries to US stores. I have not checked for other countries. A week ago this issue was not occurring and was showing expected results/restock dates and projections just fine. This does not happen on all items only some. I've mainly been checking for a few still missing pieces from a Sektion Cabinet build.

To Reproduce
Steps to reproduce the behavior:

Query the availability for item number 00265533 for a US store(s). It will show not found. However if you search that item number on the Ikea US website, it shows the proper item, a 24" Utrusta shelf.

Expected behavior
Display the item results when queried via API

Screenshots

Screenshot from 2021-09-08 23-11-43

https://www.ikea.com/us/en/p/utrusta-shelf-white-00265533/

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

403 for all request to BE stores

It seems that all request to Belgian stores are failing with a 403. I did tested the same request using other countries (it, be, fr, de) and they worked. Not sure what the problem is.

$ ikea-availability stock --country be 70346932
/usr/local/lib/node_modules/ikea-availability-checker/source/lib/iows2.js:114
      throw new errors.IOWS2ResponseError(error);
            ^

IOWS2ResponseError: Unable to receive product 70346932 availability for store 482 status code: 403 undefined using url: /retail/iows/be/fr/stores/482/availability/ART/70346932
    at IOWS2.fetch (/usr/local/lib/node_modules/ikea-availability-checker/source/lib/iows2.js:114:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

nico@kit:~$ ikea-availability stock --store 423 70346932
/usr/local/lib/node_modules/ikea-availability-checker/source/lib/iows2.js:114
      throw new errors.IOWS2ResponseError(error);
            ^

IOWS2ResponseError: Unable to receive product 70346932 availability for store 423 status code: 403 undefined using url: /retail/iows/be/fr/stores/423/availability/ART/70346932
    at IOWS2.fetch (/usr/local/lib/node_modules/ikea-availability-checker/source/lib/iows2.js:114:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Support for new IOWS API

Noticed in #4 some IKEA websites use another version of the IOWS interface. For example Ireland is requesting the availability information from here: https://www.ikea.com/ie/en/retail/iows/stores/038/item/SPR,29932181

An example response looks like this:

{
    "StoreItem": {
        "ItemNo": {
            "$": 29932181
        },
        "ItemType": {
            "$": "SPR"
        },
        "StoreNo": {
            "$": "038"
        },
        "StoreName": {
            "$": "Dublin Store"
        },
        "Availability": {
            "AvailabilityClassificationList": {
                "AvailabilityClassification": [
                    {
                        "ClassificationValue": {
                            "$": "YES"
                        },
                        "ClassificationType": {
                            "$": "STORE"
                        }
                    },
                    {
                        "ClassificationValue": {
                            "$": "YES"
                        },
                        "ClassificationType": {
                            "$": "CUSTORDER"
                        }
                    }
                ]
            },
            "AvailableStockList": {
                "AvailableStock": {
                    "AvailableStockType": {
                        "$": "STORE"
                    },
                    "InStockProbabilityCode": {
                        "$": "HIGH"
                    },
                    "InStockProbabilityReliabilityCode": {
                        "$": "HIGH"
                    },
                    "EarliestRestockDate": {
                        "$": "2018-12-13"
                    },
                    "RestockReliabilityCode": {
                        "$": "MEDIUM"
                    },
                    "AvailableStockUpdateDateTime": {
                        "$": "2018-10-15"
                    }
                }
            }
        },
        "PriceList": {},
        "ApproachEndDateSale": {
            "$": false
        },
        "StoreItemChildList": {
            "StoreItemChild": [
                {
                    "ItemNo": {
                        "$": 90217972
                    },
                    "ItemType": {
                        "$": "ART"
                    },
                    "Availability": {
                        "AvailabilityClassificationList": {
                            "AvailabilityClassification": [
                                {
                                    "ClassificationValue": {
                                        "$": "YES"
                                    },
                                    "ClassificationType": {
                                        "$": "STORE"
                                    }
                                },
                                {
                                    "ClassificationValue": {
                                        "$": "YES"
                                    },
                                    "ClassificationType": {
                                        "$": "CUSTORDER"
                                    }
                                }
                            ]
                        },
                        "AvailableStockList": {
                            "AvailableStock": {
                                "AvailableStockType": {
                                    "$": "STORE"
                                },
                                "InStockProbabilityCode": {
                                    "$": "HIGH"
                                },
                                "InStockProbabilityReliabilityCode": {
                                    "$": "HIGH"
                                },
                                "EarliestRestockDate": {
                                    "$": "2018-12-13"
                                },
                                "RestockReliabilityCode": {
                                    "$": "MEDIUM"
                                },
                                "AvailableStockUpdateDateTime": {
                                    "$": "2018-10-15"
                                }
                            }
                        }
                    },
                    "PriceList": {},
                    "SalesMethodCode": {
                        "$": "SELF_SERVE"
                    },
                    "RecommendedSalesLocation": {
                        "Aisle": {
                            "$": 16
                        },
                        "Bin": {
                            "$": "02"
                        },
                        "Department": {
                            "$": "Even number aisles"
                        }
                    },
                    "ApproachEndDateSale": {
                        "$": false
                    }
                },
                {
                    "ItemNo": {
                        "$": "00251135"
                    },
                    "ItemType": {
                        "$": "ART"
                    },
                    "Availability": {
                        "AvailabilityClassificationList": {
                            "AvailabilityClassification": [
                                {
                                    "ClassificationValue": {
                                        "$": "YES"
                                    },
                                    "ClassificationType": {
                                        "$": "STORE"
                                    }
                                },
                                {
                                    "ClassificationValue": {
                                        "$": "YES"
                                    },
                                    "ClassificationType": {
                                        "$": "CUSTORDER"
                                    }
                                }
                            ]
                        },
                        "AvailableStockList": {
                            "AvailableStock": {
                                "AvailableStockType": {
                                    "$": "STORE"
                                },
                                "InStockProbabilityCode": {
                                    "$": "HIGH"
                                },
                                "InStockProbabilityReliabilityCode": {
                                    "$": "HIGH"
                                },
                                "EarliestRestockDate": {
                                    "$": "2018-12-13"
                                },
                                "RestockReliabilityCode": {
                                    "$": "MEDIUM"
                                },
                                "AvailableStockUpdateDateTime": {
                                    "$": "2018-11-26"
                                }
                            }
                        }
                    },
                    "PriceList": {},
                    "SalesMethodCode": {
                        "$": "SELF_SERVE"
                    },
                    "RecommendedSalesLocation": {
                        "Aisle": {
                            "$": 16
                        },
                        "Bin": {
                            "$": "05"
                        },
                        "Department": {
                            "$": "Even number aisles"
                        }
                    },
                    "ApproachEndDateSale": {
                        "$": false
                    }
                }
            ]
        }
    }
}

The automated release is failing 🚨

🚨 The automated release from the 1.0.x branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the 1.0.x branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


The release 1.0.3 on branch 1.0.x cannot be published as it is out of range.

Based on the releases published on other branches, only versions within the range >=1.0.2 <1.0.3 can be published from branch 1.0.x.

The following commits are responsible for the invalid release:

  • Merge branch '1.0.x' of github.com:Ephigenia/ikea-availability-checker into 1.0.x (56afb31)
  • docs: removes not supported country code from README (c88c165)
  • fix(iows): throw a IOWS2DeprecationError on deprecation header (#80) (270c3a5)
  • fix: adds all australian ikea stores (#81) (a04df08)
  • fix: adds check-pr-title workflow (d8d5d19)

Those commits should be moved to a valid branch with git merge or git cherry-pick and removed from branch 1.0.x with git revert or git reset.

A valid branch could be master.

See the workflow configuration documentation for more details.


Good luck with your project ✨

Your semantic-release bot 📦🚀

AU Stores

Hi there,

Looks like not all AU stores are returned from executing ikea-availability stores au

countryCode │ country │ buCode │ name │
├─────────────┼───────────┼────────┼─────────────┤
│ au │ Australia │ 451 │ Canberra │
├─────────────┼───────────┼────────┼─────────────┤
│ au │ Australia │ 460 │ North Lakes │
├─────────────┼───────────┼────────┼─────────────┤
│ au │ Australia │ 919 │ Logan │

Adelaide store is 557.

ikea-availability -- stock --store=557 10335192

Yet cannot hit it (no stores found), any ideas?

Handle unparsable but valid response

In some cases (at least one, indicated in #26) the IKEA iows API replies with a different JSON format than expected. In that case an exception is thrown while there are other stores valid. There should be a special soft-handling of unparsable json response formats which results in a similar output like a 404 (cli-stock.js:122) so that it’s possible to find out which store raises the error.

Refusing to install package with name "ikea-availability-checker" under a package also called "ikea-availability-checker"

I have the latest version of ikea-availability-checker and the current recommended version of node.js, 10.16.3. When I run npm install ikea-availability-checker per the Installation section of the readme, I get the following error:

npm ERR! code ENOSELF
npm ERR! Refusing to install package with name "ikea-availability-checker" under a package
npm ERR! also called "ikea-availability-checker". Did you name your project the same
npm ERR! as the dependency you're installing?

Can this give stock of online distribution center?

I'm wanting to buy some smart blinds and the inventory online keeps showing up as available but when you go to buy it, the website says it's out of stock. What I've noticed is that if you keep checking, more stock will become available and you are able to make the purchase. Is it possible to use this tool to check that inventory?

Add new store

Hi, I am looking to add store in Ireland. Can you tell how to find a store code?

I should add this to ./data/buCodes.csv and ./data/stores.json ?

error while querying Belgian stores

Hi,
I have recently submitted a PR for adding the belgian stores( #50 ).
I have seen that it has been merged immediately, brilliant!
However I thought I am having trouble using the recently added stores:

If I run:

ikea-availability stock --country be 30346934

I get the following output:

/usr/local/lib/node_modules/ikea-availability-checker/source/lib/iows2.js:94
          const err = new errors.IOWS2ResponseError(`Unexpected http status code ${response.status}`);
                      ^

IOWS2ResponseError: Unable to receive product 30346934 availability for store 483 status code: 400 Bad Request using url: https://iows.ikea.com/retail/iows/be/be/stores/483/availability/ART/30346934
    at /usr/local/lib/node_modules/ikea-availability-checker/source/lib/iows2.js:94:23
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 1) {
  request: {
    url: 'https://iows.ikea.com/retail/iows/be/be/stores/483/availability/ART/30346934',
    params: {
      headers: {
        Accept: 'application/vnd.ikea.iows+json;version=1.0',
        Contract: '37249',
        Consumer: 'MAMMUT'
      }
    }
  },
  response: Response {
    size: 0,
    timeout: 0,
    [Symbol(Body internals)]: {
      body: <ref *1> Gunzip {
        _writeState: Uint32Array(2) [ 0, 0 ],
        _readableState: ReadableState {
          objectMode: false,
          highWaterMark: 16384,
          buffer: BufferList { head: null, tail: null, length: 0 },
          length: 0,
          pipes: [],
          flowing: null,
          ended: false,
          endEmitted: false,
          reading: false,
          constructed: true,
          sync: false,
          needReadable: false,
          emittedReadable: false,
          readableListening: false,
          resumeScheduled: false,
          errorEmitted: false,
          emitClose: true,
          autoDestroy: true,
          destroyed: false,
          errored: null,
          closed: false,
          closeEmitted: false,
          defaultEncoding: 'utf8',
          awaitDrainWriters: null,
          multiAwaitDrain: false,
          readingMore: false,
          decoder: null,
          encoding: null,
          [Symbol(kPaused)]: null
        },
        _events: [Object: null prototype] {
          prefinish: [Function: prefinish],
          error: [Function (anonymous)]
        },
        _eventsCount: 2,
        _maxListeners: undefined,
        _writableState: WritableState {
          objectMode: false,
          highWaterMark: 16384,
          finalCalled: true,
          needDrain: false,
          ending: true,
          ended: true,
          finished: true,
          destroyed: false,
          decodeStrings: true,
          defaultEncoding: 'utf8',
          length: 0,
          writing: false,
          corked: 0,
          sync: false,
          bufferProcessing: false,
          onwrite: [Function: bound onwrite],
          writecb: null,
          writelen: 0,
          afterWriteTickInfo: null,
          buffered: [],
          bufferedIndex: 0,
          allBuffers: true,
          allNoop: true,
          pendingcb: 0,
          constructed: true,
          prefinished: true,
          errorEmitted: false,
          emitClose: true,
          autoDestroy: true,
          errored: null,
          closed: false,
          closeEmitted: false,
          [Symbol(kOnFinished)]: []
        },
        allowHalfOpen: true,
        bytesWritten: 0,
        _handle: Zlib {
          onerror: [Function: zlibOnError],
          buffer: Buffer(0) [Uint8Array] [],
          cb: [Function (anonymous)],
          availOutBefore: 16384,
          availInBefore: 0,
          inOff: 0,
          flushFlag: 2,
          [Symbol(owner_symbol)]: [Circular *1]
        },
        _outBuffer: Buffer(16384) [Uint8Array] [
          176, 203, 210, 182, 176, 203, 210, 182,  72, 240,  45,   4,
           72, 240,  45,   4,   0,   0,   0,   0,   8,   0,   0,   0,
            0,   0,   0,   0, 128, 240,  45,   4, 255, 255, 255, 255,
           10,   0,   0,   0, 255, 255, 255, 255,  49,   0,   0,   0,
            0,   0,   0,   0, 128,   0,   0,   0,  49, 133, 236,  92,
           89, 133, 236,  92, 129, 133, 236,  92, 169, 133, 236,  92,
            8, 241,  45,   4,   8,   0,   0,   0,   1,   0,   0,   0,
            0,   0,   0,   0, 164, 240,  45,   4,   0,   0,   0,   0,
          172, 240,  45,   4,
          ... 16284 more items
        ],
        _outOffset: 0,
        _chunkSize: 16384,
        _defaultFlushFlag: 2,
        _finishFlushFlag: 2,
        _defaultFullFlushFlag: 3,
        _info: undefined,
        _maxOutputLength: 1073741823,
        _level: -1,
        _strategy: 0,
        [Symbol(kCapture)]: false,
        [Symbol(kCallback)]: null,
        [Symbol(kError)]: null
      },
      disturbed: false,
      error: null
    },
    [Symbol(Response internals)]: {
      url: 'https://iows.ikea.com/retail/iows/be/be/stores/483/availability/ART/30346934',
      status: 400,
      statusText: 'Bad Request',
      headers: Headers {
        [Symbol(map)]: [Object: null prototype] {
          'x-backside-transport': [ 'FAIL FAIL,FAIL FAIL' ],
          'content-type': [ 'text/xml' ],
          'unique-rq-id': [ '1622021866-568f4f7' ],
          'x-global-transaction-id': [ '34ed051960ae16ea0076f571' ],
          'content-encoding': [ 'gzip' ],
          'content-length': [ '0' ],
          date: [ 'Wed, 26 May 2021 09:37:46 GMT' ],
          connection: [ 'close' ],
          vary: [ 'Accept-Encoding' ],
          'x-content-type-options': [ 'nosniff' ],
          'strict-transport-security': [ 'max-age=31536000' ],
          server: [ 'IITP Server' ]
        }
      },
      counter: 0
    }
  }
}

I think the issue might be in the URL that is being called:
https://iows.ikea.com/retail/iows/be/**be**/stores/483/availability/ART/30346934

As Belgium has two languages, it might be "fr" or "nl".

Unfortunately I have been trying to send a request with postman to test this assumption but I am always getting error 400, even by adding the headers:

Accept:application/vnd.ikea.iows+json;version=1.0
Contract:37249
Consumer:MAMMUT
``
Any help diagnosing it further?

The automated release is failing 🚨

🚨 The automated release from the next branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the next branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


The release 1.0.1 on branch next cannot be published as it is out of range.

Based on the releases published on other branches, only versions within the range >=1.0.0 <1.0.1 can be published from branch next.

The following commits are responsible for the invalid release:

  • build: enable npm release (66d71b3)
  • chore(release): 1.0.1 [skip ci] (d3340e0)
  • build: re-enable release (bd9759b)
  • Merge branch 'master' of github.com:Ephigenia/ikea-availability-checker (adcfbb8)
  • fix(stores): adds Queens, NY store (#75) (431a788)
  • build: disable automatic release (01d42de)
  • Merge branch 'master' of github.com:Ephigenia/ikea-availability-checker (e6e0187)
  • fix: Paris Rivoli store added (#74) (8195efa)

Those commits should be moved to a valid branch with git merge or git cherry-pick and removed from branch next with git revert or git reset.

A valid branch could be master or next-major.

See the workflow configuration documentation for more details.


Good luck with your project ✨

Your semantic-release bot 📦🚀

Wrong Coordinates for store in Karlsruhe

Describe the bug
The coordinates of the store in Karlsruhe are wrong
{ "buCode": "551", "name": "Karlsruhe", "coordinates": [ 38.925, 45.0125 ], "countryCode": "de" }
Based on Google maps the coordinates should be
8.4420776, 49.0048648

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.