Code Monkey home page Code Monkey logo

nodejs's Introduction

commercetools logo Node.js commercetools ecosystem.

CircleCI Status Codecov Coverage Status Waffle.io Board

The commercetools nodejs repo is managed as a monorepo and contains different npm packages.

Documentation

https://commercetools.github.io/nodejs/

Support

If you have any urgent issues regarding this repository please create a support request over our official support channel.

Contributing

We'd love to have your helping hand on this ecosystem! Please see CONTRIBUTING.md for more information on our guidelines.

Packages

SDK

Package Version Dependencies
sdk-auth sdk-auth Version sdk-auth Dependencies Status
sdk-client sdk-client Version sdk-client Dependencies Status
sdk-middleware-auth sdk-middleware-auth Version sdk-middleware-auth Dependencies Status
sdk-middleware-http sdk-middleware-http Version sdk-middleware-http Dependencies Status
sdk-middleware-logger sdk-middleware-logger Version sdk-middleware-logger Dependencies Status
sdk-middleware-queue sdk-middleware-queue Version sdk-middleware-queue Dependencies Status
sdk-middleware-user-agent sdk-middleware-user-agent Version sdk-middleware-user-agent Dependencies Status

CLI tools

Package Version Dependencies
category-exporter category-exporter Version category-exporter Dependencies Status
csv-parser-discount-code csv-parser-discount-code Version csv-parser-discount-code Dependencies Status
csv-parser-orders csv-parser-orders Version csv-parser-orders Dependencies Status
csv-parser-price csv-parser-price Version csv-parser-price Dependencies Status
csv-parser-state csv-parser-state Version csv-parser-state Dependencies Status
custom-objects-exporter custom-objects-exporter Version custom-objects-exporter Dependencies Status
custom-objects-importer custom-objects-importer Version custom-objects-importer Dependencies Status
customer-groups-exporter customer-groups-exporter Version customer-groups-exporter Dependencies Status
personal-data-erasure personal-data-erasure Version personal-data-erasure Dependencies Status
discount-code-exporter discount-code-exporter Version discount-code-exporter Dependencies Status
discount-code-generator discount-code-generator Version discount-code-generator Dependencies Status
discount-code-importer discount-code-importer Version discount-code-importer Dependencies Status
inventories-exporter inventories-exporter Version inventories-exporter Dependencies Status
price-exporter price-exporter Version price-exporter Dependencies Status
product-exporter product-exporter Version product-exporter Dependencies Status
product-json-to-csv product-json-to-csv Version product-json-to-csv Dependencies Status
product-json-to-xlsx product-json-to-xlsx Version product-json-to-xlsx Dependencies Status
state-importer state-importer Version state-importer Dependencies Status

Other

Package Version Dependencies
api-request-builder api-request-builder Version api-request-builder Dependencies Status
sync-actions sync-actions Version sync-actions Dependencies Status

nodejs's People

Contributors

acbeni avatar adnasa avatar ajimae avatar arriolaleo avatar ashishhk avatar babanila avatar daern91 avatar damarna85 avatar danrleyt avatar dferber90 avatar emmenko avatar greenkeeper[bot] avatar hisabimbola avatar jenschude avatar jherey avatar junajan avatar katmatt avatar leventekobor avatar markus-azer avatar merchant-center-automation avatar michelerezk avatar mohib0306 avatar nicolasnieto92 avatar qmateub avatar renovate-bot avatar renovate[bot] avatar siilwyn avatar tdeekens avatar vineetkumarkushwaha avatar wizzy25 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

Watchers

 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

nodejs's Issues

[csv-parser-price] add support for access token

Description

A regression occurred during the move to the monorepo, the module no longer supports accessToken flag and users using this on impex now get this error:
screenshot 2017-04-21 15 04 33

Expected Behavior

Should use accessToken if present

Current Behavior

Does not support accessToken

Context

Possible Solution

[api-request-builder] Support limit on get requests

Description

Currently get requests return only 20 per page. If you want more (or less), you have to manually add &limit=number to the uri

Expected Behavior

Should expose a method like service.limit(number).build()

Current Behavior

Something like this has to be done:

const uri = `${service.build()}?limit=100`

Context

Possible Solution

[api-request-builder] Create new feature for price selection query parameters

There are 4 new query parameters used by the projections endpoint (and search).

http://dev.commercetools.com/http-api-projects-productProjections.html#get-productprojection-by-id
http://dev.commercetools.com/http-api-projects-products-search.html#search-productprojections

They should be put into a new separate feature (e.g. query-price-selection)

  • priceCurrency
  • priceCountry (requires priceCurrency)
  • priceCustomerGroup (requires priceCurrency)
  • priceChannel (requires priceCurrency)

Discount code importer

Description

A new module to import new or update existing discount codes to the API

Todo

  • Read batches

  • Decide if to update or create

  • Create codes

  • Update codes

  • Write documentation

  • Add integration tests

[api-request-builder] Support version when deleting

Description

Currently to do a delete, you have to manually add the version to the uri.

I find the user experience of this very bad, especially when compared to the old SDK

Expected Behavior

Should expose a method like service.delete(versionNumber).build()

Current Behavior

Example of current behaviour can be found here

Context

Possible Solution

[sync-actions] Can't add/change inventory quantity to 0

Description

At the moment, if you try to add/change a inventory quantity with number "0" the API returns a bad request error

export function buildBaseAttributesActions ({
  actions,
  diff,
  oldObj,
  newObj,
}) {
  return actions
    .map((item) => {
      const key = item.key // e.g.: name, description, ...
      const actionKey = item.actionKey || item.key
      const delta = diff[key]
      const before = oldObj[key]
      const now = newObj[key]

      if (!delta) return undefined

      if (!now && !before) return undefined

      if (now && !before) // no value previously set
        return { action: item.action, [actionKey]: now }

      if (!now && !{}.hasOwnProperty.call(newObj, key)) // no new value
        return undefined

      if (!now && {}.hasOwnProperty.call(newObj, key)) // value unset
        return { action: item.action }
    })
    .filter(action => action)
}

Expected Behavior

It should assemble the correct request body

Current Behavior

Its assembling the request body without a required field (quantity).
This is happening because 0 is falsy, and on the buildBaseAttributesActions function it relies only on the value in order to define what to return

Possible Solution

Maybe adding a variable to check the existence of the value (hasNow and hasBefore), so 0 wouldn't return false in this case.

Discount code generator module

Description

A new module to generate discount codes

Todo

  • Function to generate codes
  • CLI tool to get input from user
  • Save generated codes to file
  • Write documentation

[sdk-middleware-http] Support for product image uploads

Description

I'm trying to use the node sdk to upload a product image to commercetools. I'm currently using code that looks like:

          // let's upload to the product's images endpoint
          let imgType = mime.lookup(tmpFile);
          let img = fs.readFileSync(tmpFile);
          const pimgUri = requestBuilder.products.byId(existingProduct.id).build({ projectKey: projectKey });
          const addImageRequest = {uri: pimgUri + '/images', method: "POST", headers: {'Content-Type': imgType}, body:img};
          /// This won't work with current ct sdk
          client.execute(addImageRequest).catch((e) => {
            console.log(e);
            process.exit(45);
          });

I noticed that under the hood, the node sdk uses node-fetch, which would support sending a stream or buffer object as the request body. However, the sdk seems to drop that support in favor of ensuring every body is sent as JSON.

Expected Behavior

I'd expect to be able to upload an image to the product's images endpoint using the node sdk.

Current Behavior

The sdk middleware seems to be JSON.stringify()'ing my Buffer/Stream object and sending that to commercetools, resulting in a 'This jpg encoding is not supported' error from commercetools.

Context

While writing an importer for a potential customer, I needed to import their product images as well. I am currently unable to do so using the node sdk. I am able to use a call to curl, or a custom Request object to accomplish this in the meantime.

Possible Solution

I'm not entirely sure, but https://github.com/commercetools/nodejs/blob/master/packages/sdk-middleware-http/src/http.js#L25 looks like it would cause this issue

[api-request-builder] Send markMatchingVariants=false by default

Description

Based on the documentation the markMatchingVariants parameter will add a flag to all variants which match search criteria.

On the API it is by default set to true but in the new SDK we can only set it to true because false value is not sent to the API so there is no chance to turn this feature off.

Expected Behavior

We should have a possibility to set this feature off or it should be turned off by default.

Possible Solutions

We have two options:

  1. by default send markMatchingVariants=false
  2. allow users to set it to false by calling markMatchingVariants(false)

[csv-parser-price] Handle logging appropriately

Description

Unlike the old repo, status will always be printed to stdout. This can "disturb" the standard output

Expected Behavior

Logging should be separated from the output content

Possible Solution

This, which is missing in this repo will be a good place to start

Clean up flow types

Description

The amount of flow type warnings are building up making it very hard to see new warnings and making me sad when running the linting task. :(

 packages/api-request-builder/src/build-query-string.js:26:49
  ⚠   26:49  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   26:49  Missing "e" parameter type annotation.                                      flowtype/require-parameter-type
  ⚠   45:49  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   45:49  Missing "s" parameter type annotation.                                      flowtype/require-parameter-type
  ⚠   58:19  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   58:19  Missing "f" parameter type annotation.                                      flowtype/require-parameter-type
  ⚠   59:20  Missing "f" parameter type annotation.                                      flowtype/require-parameter-type
  ⚠   59:20  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   60:27  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   60:27  Missing "f" parameter type annotation.                                      flowtype/require-parameter-type
  ⚠   61:28  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   61:28  Missing "f" parameter type annotation.                                      flowtype/require-parameter-type

  packages/api-request-builder/src/create-request-builder.js:13:42
  ⚠   13:42  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   13:43  Missing "acc" parameter type annotation.                                    flowtype/require-parameter-type
  ⚠   13:48  Missing "key" parameter type annotation.                                    flowtype/require-parameter-type

  packages/api-request-builder/src/create-service.js:53:23
  ⚠   53:23  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   53:24  Missing "acc" parameter type annotation.                                    flowtype/require-parameter-type
  ⚠   53:29  Missing "feature" parameter type annotation.                                flowtype/require-parameter-type

  packages/sdk-client/src/client.js:34:27
  ⚠   34:27  Missing "resolve" parameter type annotation.                                flowtype/require-parameter-type
  ⚠   34:36  Missing "reject" parameter type annotation.                                 flowtype/require-parameter-type
  ⚠   68:27  Missing "resolve" parameter type annotation.                                flowtype/require-parameter-type
  ⚠   68:36  Missing "reject" parameter type annotation.                                 flowtype/require-parameter-type
  ⚠  125:24  Missing return type annotation.                                             flowtype/require-return-type
  ⚠  125:24  Missing "func" parameter type annotation.                                   flowtype/require-parameter-type
  ⚠  130:23  Missing return type annotation.                                             flowtype/require-return-type
  ⚠  130:24  Missing "a" parameter type annotation.                                      flowtype/require-parameter-type
  ⚠  130:27  Missing "b" parameter type annotation.                                      flowtype/require-parameter-type
  ⚠  130:33  Missing return type annotation.                                             flowtype/require-return-type
  ⚠  130:34  Missing "args" parameter type annotation.                                   flowtype/require-parameter-type

  packages/sdk-middleware-auth/src/build-requests.js:44:3
  ⚠   44:3   Unexpected todo comment.                                                    no-warning-comments
  ⚠   48:3   Unexpected todo comment.                                                    no-warning-comments
  ⚠   52:3   Unexpected todo comment.                                                    no-warning-comments

  packages/sdk-middleware-auth/src/client-credentials-flow.js:29:10
  ⚠   29:10  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   29:10  Missing "next" parameter type annotation.                                   flowtype/require-parameter-type
  ⚠   92:35  Missing "task" parameter type annotation.                                   flowtype/require-parameter-type
  ⚠  113:13  Missing "error" parameter type annotation.                                  flowtype/require-parameter-type

  packages/sdk-middleware-http/src/http.js:21:10
  ⚠   21:10  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   21:10  Missing "next" parameter type annotation.                                   flowtype/require-parameter-type
  ⚠   97:23  Missing "{ statusCode, message, ...rest }" parameter type annotation.       flowtype/require-parameter-type

  packages/sdk-middleware-logger/src/logger.js:9:10
  ⚠    9:10  Missing return type annotation.                                             flowtype/require-return-type
  ⚠    9:10  Missing "next" parameter type annotation.                                   flowtype/require-parameter-type
  ⚠   11:5   Unexpected console statement.                                               no-console
  ⚠   12:5   Unexpected console statement.                                               no-console

  packages/sdk-middleware-logger/test/logger.spec.js:21:28
  ⚠   21:28  Unexpected console statement.                                               no-console
  ⚠   26:5   Unexpected console statement.                                               no-console
  ⚠   31:5   Unexpected console statement.                                               no-console
  ⚠   51:14  Unexpected console statement.                                               no-console
  ⚠   52:14  Unexpected console statement.                                               no-console
  ⚠   56:14  Unexpected console statement.                                               no-console

  packages/sdk-middleware-queue/src/queue.js:35:10
  ⚠   35:10  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   35:10  Missing "next" parameter type annotation.                                   flowtype/require-parameter-type

  packages/sdk-middleware-user-agent/src/user-agent.js:18:10
  ⚠   18:10  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   18:10  Missing "next" parameter type annotation.                                   flowtype/require-parameter-type

  packages/sync-actions/src/categories.js:16:1
  ⚠   16:1   Missing return type annotation.                                             flowtype/require-return-type
  ⚠   16:36  Missing "mapActionGroup" parameter type annotation.                         flowtype/require-parameter-type
  ⚠   17:10  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   17:33  Missing "diff" parameter type annotation.                                   flowtype/require-parameter-type
  ⚠   17:39  Missing "newObj" parameter type annotation.                                 flowtype/require-parameter-type
  ⚠   17:47  Missing "oldObj" parameter type annotation.                                 flowtype/require-parameter-type
  ⚠   20:44  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   23:50  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   26:44  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   29:46  Missing return type annotation.                                             flowtype/require-return-type

  packages/sync-actions/src/customers.js:16:1
  ⚠   16:1   Missing return type annotation.                                             flowtype/require-return-type
  ⚠   16:36  Missing "mapActionGroup" parameter type annotation.                         flowtype/require-parameter-type
  ⚠   17:10  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   17:33  Missing "diff" parameter type annotation.                                   flowtype/require-parameter-type
  ⚠   17:39  Missing "newObj" parameter type annotation.                                 flowtype/require-parameter-type
  ⚠   17:47  Missing "oldObj" parameter type annotation.                                 flowtype/require-parameter-type
  ⚠   20:44  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   23:50  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   26:49  Missing return type annotation.                                             flowtype/require-return-type

  packages/sync-actions/src/inventories.js:16:1
  ⚠   16:1   Missing return type annotation.                                             flowtype/require-return-type
  ⚠   16:37  Missing "mapActionGroup" parameter type annotation.                         flowtype/require-parameter-type
  ⚠   17:10  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   17:33  Missing "diff" parameter type annotation.                                   flowtype/require-parameter-type
  ⚠   17:39  Missing "newObj" parameter type annotation.                                 flowtype/require-parameter-type
  ⚠   17:47  Missing "oldObj" parameter type annotation.                                 flowtype/require-parameter-type
  ⚠   20:44  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   23:50  Missing return type annotation.                                             flowtype/require-return-type

  packages/sync-actions/src/orders.js:17:1
  ⚠   17:1   Missing return type annotation.                                             flowtype/require-return-type
  ⚠   17:33  Missing "mapActionGroup" parameter type annotation.                         flowtype/require-parameter-type
  ⚠   18:10  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   18:33  Missing "diff" parameter type annotation.                                   flowtype/require-parameter-type
  ⚠   18:39  Missing "newObj" parameter type annotation.                                 flowtype/require-parameter-type
  ⚠   18:47  Missing "oldObj" parameter type annotation.                                 flowtype/require-parameter-type
  ⚠   21:44  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   24:50  Missing return type annotation.                                             flowtype/require-return-type

  packages/sync-actions/src/products.js:23:1
  ⚠   23:1   Missing return type annotation.                                             flowtype/require-return-type
  ⚠   23:35  Missing "mapActionGroup" parameter type annotation.                         flowtype/require-parameter-type
  ⚠   24:10  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   24:33  Missing "diff" parameter type annotation.                                   flowtype/require-parameter-type
  ⚠   24:39  Missing "newObj" parameter type annotation.                                 flowtype/require-parameter-type
  ⚠   24:47  Missing "oldObj" parameter type annotation.                                 flowtype/require-parameter-type
  ⚠   24:55  Missing "options" parameter type annotation.                                flowtype/require-parameter-type
  ⚠   28:44  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   31:44  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   34:50  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   37:48  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   40:50  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   44:46  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   47:46  Missing return type annotation.                                             flowtype/require-return-type
  ⚠   50:50  Missing return type annotation.                                             flowtype/require-return-type

To prevent this from happening in the future let's run ESLint on CI with --max-warnings 0 so it fails.

Move csv-parser-orders to monorepo

Move the csv-parser-orders module to this repository.

Doing this will also require changes to the code of the module and some additional steps:

  • Use the new SDK packages as dependencies
  • Get tests passing manually passing credentials
  • Add a package to get credentials from the FS
  • Check if everything is working as expected manually using the CLI
  • Get rid of underscore dependencies
  • Convert tape to jest tests
  • Remove all root files that already exist in the monorepo root
  • Slim down package.json fields and development dependencies
  • Migrate CLI tests that talk to the API to the integration tests directory
  • Refactor arguments to be named
    Accepting one object instead of three unnamed objects.

[api-request-builder] Add a support for ShoppingLists endpoint

Description

We would like to add a support for ShoppingList endpoint on Impex and therefore we should add it also here to api-request-builder.

Current Behavior

Not supported currently.

Possible Solution

Add an endpoint specification to the list of default services here.

Use caret semver range for development dependencies?

Let's discuss if we want to use exact versions or semver ranges for the development dependencies.
I would vote for using semver ranges to decrease the amount of Greenkeeper PRs. And feel confident in doing this because we have the dependency lockfile.

SDK middleware fails when given a host that ends with a slash

Description

Passing https://api.sphere.io/ vs. https://api.sphere.io makes a difference.

Expected Behavior

Both should work the same.

Current Behavior

My guess is it ends up with a double slash when appending things to the host URL.

Context

I used the URLs that are given at the dev.commercetools.com documentation which failed. Confirmed this for sdk-middleware-http.

Possible Solution

Merge slashes if needed.

[csv-parser-price] value.currencyCode is missing from transformed data

Description

For some weird reasons, the csv-parser-price module does not output the correct json data. The currencyCode is missing from the data returned from the module, hence making the data invalid

Expected Behavior

centAmount should be added to the data returned from the module
Expected data format

{
	"prices": [{
		"sku": "123",
		"prices": [{
			"variant-sku": "123",
			"value": {
				"centAmount": 5000
				"currencyCode": "EUR"
			}
		}]
	}]
}

Current Behavior

Current data format

{
	"prices": [{
		"sku": "123",
		"prices": [{
			"variant-sku": "123",
			"value": {
				"centAmount": 5000
			}
		}]
	}]
}

Context

Possible Solution

List packages in readme

List the packages with their link to the NPM page, version and dependency status in the readme.

[csv-parser-price] Correct SKU naming

Description

Currently the price-parser outputs the sku field wrongly, this is is not understood by the price-importer module. Changing the field of the sku from variant-sku to sku should fix the issue

Expected Behavior

Correct output data should look like this

{
  "prices": [
    {
      "sku": "123",
      "prices": [
        {
          "variant-sku": "123",
          "value": {
            "centAmount": 2000
          },
          "custom": {
            "type": {
              "id": "d1fefedefb1-ee4b-411c-81fe-cd1ab777115d"
            },
            "fields": {
              "measureUnit": "ST",
              "basePriceMeasureUnit": ""
            }
          }
        }
      ]
    }
  ]
}

Current Behavior

Current outputed data looks like this

{
  "prices": [
    {
      "variant-sku": "123",
      "prices": [
        {
          "variant-sku": "123",
          "value": {
            "centAmount": 2000
          },
          "custom": {
            "type": {
              "id": "d1fdefb1-ee4b-411c-81fe-cd1ab777115d"
            },
            "fields": {
              "measureUnit": "ST",
              "basePriceMeasureUnit": ""
            }
          }
        }
      ]
    }
  ]
}

Context

Possible Solution

[sync-actions]: support empty orderHint

Description

When an empty string is provided as the orderHint of a category an invalid sync-action is generated.

I created the following tests which should succeed but fail currently (first one fails, second one is to ensure we don't change existing behaviour and currently succeeds):

// nodejs/packages/sync-actions/test/category-sync.spec.js

  describe('changeOrderHint', () => {
    describe('when setting to an empty string', () => {
      it('should build a `changeOrderHint` action', () => {
        const before = { orderHint: 'foo' }
        const now = { orderHint: '' }
        const actual = categorySync.buildActions(now, before)
        const expected = [
          {
            action: 'changeOrderHint',
            value: '',
          },
        ]
        expect(actual).toEqual(expected)
      })
    })

    describe('when not provided', () => {
      it('should not build an update action', () => {
        const before = { orderHint: 'foo' }
        const now = {}
        const actual = categorySync.buildActions(now, before)
        const expected = []
        expect(actual).toEqual(expected)
      })
    })
  })

Expected Behavior

The following sync-actions should be generated in the first case:

        [
          {
            action: 'changeOrderHint',
            value: '',
          },
        ]

Current Behavior

The following sync action is generated in the first case:

        [
          {
            action: 'changeOrderHint',
          },
        ]

This is an invalid sync action as value is a required field. Providing an empty string as the value is valid and supported by the API.

Context

In the MC, when trying to let users set an empty orderHint for a category they get an API error instead of having the changes saved successfully.

Possible Solution

Note

I tried to push a failing test so you could work on that, but I don't have sufficient permissions to this repository :( You can add the snippet I provided above to the Actions section of the tests.

Enforce git commit message

Description

After reading this it got me thinking on how to enforce the git commit message. It seems that only with GitHub Enterprise you can define server side hooks but what we can do is: only allow rebasing PRs that pass the CI and adding a commit message check at the CI. Shouldn't be to difficult to do and prevents any possibility of human error.

Thoughts? @hisabimbola @emmenko

Move csv-parser-price to this repository

Move the csv-parser-price module to this repository.

Doing this will also require changes to the code of the module and some additional steps:

  • Use the new SDK packages as dependencies
  • Add a types endpoint to the SDK, PR
  • Get tests passing manually passing credentials
  • Add a package to get credentials from the FS
  • Check if everything is working as expected manually using the CLI
  • Get rid of underscore dependencies
  • Convert tape to jest tests
    Got this done by using jest-codemods, replacing it for test and then manually grouping all same-function tests in describe blocks and rewriting .then().catch() chains.
  • Remove all root files that already exist in the monorepo root
  • Slim down package.json fields and development dependencies
  • Migrate CLI tests that talk to the API to the integration tests directory
  • Refactor arguments to be named
    Accepting one object instead of three unnamed objects.

[sdk-middleware-auth] Add support for token

Description

In the sphere-node-sdk, it was possible to pass in the token to the client object and it will skip generating another token for the request.
This feature is currently missing in the sdk-middleware-auth middleware.

// sphere-node-sdk
client = new SphereClient
  config:
    project_key: projectKey
  access_token: token['access_token'] // not possible with new SDK

Expected Behavior

It should accept the token parameter and if present, use it to authenticate subsequent request.

Current Behavior

Does not accept valid token.

Add API credentials retrieving package

Description

Have a package that retrieves the API credentials from a system like the one we have in the old utils repository. Trying to simplify the behaviour of getting the credentials I came up with three steps. The package will return a promise since it could need to read from the FS.

Expected Behavior

  1. Project name is passed, environment variable: CT_<project key> containing <client id>:<client secret>.
    Managing multiple projects having to only pass the name.
  2. Check environment variables CT_PROJECT_KEY, CT_CLIENT_ID, CT_CLIENT_SECRET.
    For single project usage, nice to have so no project name needs to be passed.
  3. Use dotenv package loading values from a file ct-credentials.env from the current or etc directory.
    Same as the second step but nice to have for users that are not comfortable with setting environment variables.

Context

This is needed to move on with #27 and good to have for future packages. Avoiding logic duplication like over multiple packages like in csv-parser-price.

Thoughts?

sdk-middleware-auth is broken in Node.js environment

Description

Using the auth middleware does not work in Node.js because of this piece of code:

export function getBasicAuth (
  username: string,
  password: string,
  windowObject: Object = window,
): string {
  const basicAuth = `${username}:${password}`
  if (
    windowObject &&
    windowObject.btoa &&
    typeof windowObject.btoa === 'function'
  )
    return windowObject.btoa(basicAuth)

  return new Buffer(basicAuth).toString('base64')
}

So windowObject falls back to window which will be undefined.

Possible Solution

I propose to follow this approach which Abi found online:
https://nolanlawson.com/2017/01/09/how-to-write-a-javascript-package-for-both-node-and-the-browser/
Funny enough the author created a package for this which we can use: base64-encode-string.

Automate nested dependency updating

Description

Currently we use Greenkeeper but it does only update the dependencies in the root package.json. The check-updates npm script solves this but does not seem to be triggered automatically anywhere. We can trigger it after CI tests so every time before a PR is merged the dependencies need to be updated. Another option is using Travis new cron jobs in combination with Renovate

Disable integration tests for PRs coming from forks

We started this discussion some time ago. This is the problem that PRs from external contributors don't have access to encrypted variables in travis, for security reasons.
I think for now we can simply disable e.g. integration tests when travis builds such PRs.

@commercetools/node-js wdyt?

Set user agent for the tools missing it.

Description

The user agent is set in few commercetools Node.js modules but not in all. To maintain consistency and also to traceback on logs, we need this user agent to be set in all projects.

Expected Behaviour

Have all the tools set the user agent following this pattern, like it is done in sphere-order-export.

Context

We would like to measure the usage of each module in Kibana.

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.