Skip to content

Conversation

Aschen
Copy link
Contributor

@Aschen Aschen commented Apr 27, 2020

What does this PR do?

Before this PR we were mutating user options passed to SDK method (eg: document:search).
It could lead to confusion because the user may want to reuse the same options object across different calls.

How should this be manually tested?

$ kourou collection:create index collection

This code should print { from: 0, size: 42 } two times.

const { Kuzzle, WebSocket } = require('./index')

const kuzzle = new Kuzzle(new WebSocket('localhost'));

(async () => {
  await kuzzle.connect();

  const options = { from: 0, size: 42 }
  console.log(options)
  await kuzzle.document.search('index', 'collection', {}, options)
  console.log(options)

  kuzzle.disconnect();
})();

Other changes

  • remove custom errors when the result of server:now or server:adminExists is unexpected

@codecov
Copy link

codecov bot commented Apr 27, 2020

Codecov Report

Merging #511 into 7-dev will decrease coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            7-dev     #511      +/-   ##
==========================================
- Coverage   95.81%   95.75%   -0.07%     
==========================================
  Files          32       32              
  Lines        1315     1295      -20     
==========================================
- Hits         1260     1240      -20     
  Misses         55       55              
Impacted Files Coverage Δ
src/controllers/Collection.js 100.00% <ø> (ø)
src/controllers/Security.js 97.05% <ø> (-0.07%) ⬇️
src/controllers/Document.js 94.91% <100.00%> (-0.33%) ⬇️
src/controllers/Server.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 65b526e...d2c2ebb. Read the comment docs.

@Leodau Leodau merged commit f80c67d into 7-dev Apr 27, 2020
@Aschen Aschen mentioned this pull request Apr 28, 2020
Aschen added a commit that referenced this pull request Apr 28, 2020
# [7.2.0](https://github.com/kuzzleio/sdk-javascript/releases/tag/7.2.0) (2020-04-28)


#### Bug fixes

- [ [#508](#508) ] Fix SearchResult.next with sort/size   ([Aschen](https://github.com/Aschen))
- [ [#512](#512) ] Fix token expired   ([Aschen](https://github.com/Aschen))
- [ [#511](#511) ] Avoid to mutate user options   ([Aschen](https://github.com/Aschen))
- [ [#507](#507) ] Fix collection getMapping   ([Aschen](https://github.com/Aschen))

#### New features

- [ [#510](#510) ] Add security:refresh   ([Yoann-Abbes](https://github.com/Yoann-Abbes))

#### Enhancements

- [ [#509](#509) ] Add the rate limit property to Profile objects   ([scottinet](https://github.com/scottinet))
---
@rolljee rolljee deleted the do-not-mutate-user-option branch August 29, 2023 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants