Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port SDK 6 #524

Merged
merged 18 commits into from Apr 24, 2019

Conversation

Projects
None yet
4 participants
@jenow
Copy link
Member

commented Apr 16, 2019

What does this PR do ?

Port kuzzle sdk from version 5 to 6.

Other changes

Uses async await when possible.

@jenow jenow self-assigned this Apr 16, 2019

jenow added some commits Apr 16, 2019

@benoitvidis
Copy link
Member

left a comment

Could not find in the code where the problem lies but I cannot connect to a kuzzle instance running on a port different than 7512:

  • host: kuzzle.uat.kuzzle.io
  • ssl: on
  • port: 7443
@scottinet
Copy link
Member

left a comment

A few minor corrections to make, and many nitpicking issues about kuzzle.query being used instead of the dedicated API action method.

Apart from that: 👍

replaceIfExist: true
})
setTimeout(() => {
// we can't perform refresh index on %kuzzle

This comment has been minimized.

Copy link
@scottinet

scottinet Apr 17, 2019

Member

why don't you use refresh: 'wait_for'?
https://docs.kuzzle.io/api/1/controller-security/create-profile/

(this remark also applies to other security objects creations below)

return Promise.reject(new Error('ids<Array> parameter is required'))
}

return Vue.prototype.$kuzzle.query(

This comment has been minimized.

Copy link
@scottinet

scottinet Apr 17, 2019

Member

(nitpicking) Why not use document.mDelete?

  return Vue.prototype.$kuzzle.document.mDelete(
    index, collection, ids, {refresh: 'wait_for'});
})
})
}
const res = await Vue.prototype.$kuzzle

This comment has been minimized.

Copy link
@scottinet

scottinet Apr 17, 2019

Member

(nitpicking) why not using Vue.prototype.$kuzzle.auth.getStrategies()?

.query(
{ controller: 'security', action: 'mDeleteUsers', body: { ids } }
)
await Vue.prototype.$kuzzle

This comment has been minimized.

Copy link
@scottinet

scottinet Apr 17, 2019

Member

(nitpicking)

await Vue.prototype.$kuzzle.index.refreshInternal();
const result = await Vue.prototype.$kuzzle.security
.searchProfiles({ ...filters }, { size: 100, ...pagination })

let profiles = result.hits.map(document => {

This comment has been minimized.

Copy link
@scottinet

scottinet Apr 17, 2019

Member

should be const

.auth
.login(
'local',
{ username: data.username, password: data.password },

This comment has been minimized.

Copy link
@scottinet

scottinet Apr 17, 2019

Member
Suggested change
{ username: data.username, password: data.password },
data,
async [types.CHECK_FIRST_ADMIN]({ commit }) {
try {
const res = await Vue.prototype.$kuzzle.query({ controller: 'server', action: 'adminExists' }, {})
if (!res.result.exists) {

This comment has been minimized.

Copy link
@scottinet

scottinet Apr 17, 2019

Member

(nitpicking)

if (!await Vue.prototype.$kuzzle.server.adminExists()) {
}

if (getters.indexCollections(index).stored.indexOf(collection) !== -1) {
return kuzzle
.queryPromise(
const response = await Vue.prototype.$kuzzle

This comment has been minimized.

Copy link
@scottinet

scottinet Apr 17, 2019

Member

(nitpicking)

const response = await Vue.prototype.$kuzzle.collection.getMapping(index, collection)
Show resolved Hide resolved src/vuex/modules/index/actions.js
Show resolved Hide resolved src/vuex/modules/index/actions.js

jenow added some commits Apr 23, 2019

@codecov-io

This comment has been minimized.

Copy link

commented Apr 23, 2019

Codecov Report

Merging #524 into 2-dev will decrease coverage by 4.8%.
The diff coverage is 65.08%.

Impacted file tree graph

@@            Coverage Diff             @@
##            2-dev     #524      +/-   ##
==========================================
- Coverage   83.43%   78.63%   -4.81%     
==========================================
  Files          35       34       -1     
  Lines         803      763      -40     
==========================================
- Hits          670      600      -70     
- Misses        133      163      +30
Impacted Files Coverage Δ
src/vuex/modules/security/actions.js 100% <100%> (ø) ⬆️
src/vuex/modules/collection/actions.js 20% <15.38%> (-25.72%) ⬇️
src/vuex/modules/common/kuzzle/actions.js 88% <57.14%> (-1.8%) ⬇️
src/services/kuzzleWrapper.js 66.37% <58.42%> (-17.95%) ⬇️
src/vuex/modules/index/actions.js 89.47% <80%> (-6.45%) ⬇️
src/vuex/modules/auth/actions.js 86.95% <87.09%> (-8.79%) ⬇️

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 c57cf7d...0f713c6. Read the comment docs.

@scottinet scottinet merged commit 4e67df6 into 2-dev Apr 24, 2019

3 of 5 checks passed

codecov/patch 81.06% of diff hit (target 83.43%)
Details
codecov/project 82.3% (-1.14%) compared to c57cf7d
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
deploy/netlify Deploy preview ready!
Details

@scottinet scottinet deleted the port-sdk-6 branch Apr 24, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.