├── .babelrc.js ├── .ci ├── doc │ ├── Dockerfile │ ├── config.yml │ ├── docker-compose.yml │ ├── eslint.json │ ├── package.json │ ├── puppeteer.js │ ├── templates │ │ ├── blank.tpl.js │ │ ├── catch.tpl.js │ │ ├── controller.tpl.js │ │ ├── createDocumentAfterSnippet.tpl.js │ │ ├── default.tpl.html │ │ ├── default.tpl.js │ │ ├── doIt.tpl.js │ │ ├── empty-realtime.tpl.js │ │ ├── empty.tpl.js │ │ ├── eventemitter.tpl.js │ │ ├── mqtt-end.tpl.js │ │ ├── print-result-successes.tpl.js │ │ ├── realtime.tpl.js │ │ ├── success.tpl.js │ │ ├── thencatch.tpl.js │ │ └── without-connect.tpl.js │ └── webpackBuild.js ├── docker-compose.yml ├── start_kuzzle.sh ├── stop_kuzzle.sh └── test-docs.sh ├── .commitlintrc.json ├── .cz.json ├── .eslintignore ├── .eslintrc-ts.json ├── .eslintrc.json ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── config.yml │ └── feature_request.md ├── actions │ ├── functional-tests │ │ └── action.yml │ ├── snippet-tests │ │ └── action.yml │ └── unit-tests │ │ └── action.yml ├── pull_request_template.md └── workflows │ ├── codeql.yml │ ├── pull_request.workflow.yml │ └── push_branches.workflow.yaml ├── .gitignore ├── .gitmodules ├── .husky ├── commit-msg └── pre-commit ├── .mocharc.json ├── .releaserc.json ├── .vscode └── launch.json ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── ast-refactor └── inline-options-to-interface.ts ├── build.js ├── codecov.yml ├── cypress.json ├── dist ├── .gitignore └── .npmignore ├── doc ├── 7 │ ├── .vuepress │ ├── controllers │ │ ├── auth │ │ │ ├── check-rights │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── check-rights.js │ │ │ │ │ └── check-rights.test.yml │ │ │ ├── check-token │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── check-token.js │ │ │ │ │ └── check-token.test.yml │ │ │ ├── create-api-key │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── create-api-key.js │ │ │ │ │ └── create-api-key.test.yml │ │ │ ├── create-my-credentials │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── create-my-credentials.js │ │ │ │ │ └── create-my-credentials.test.yml │ │ │ ├── credentials-exist │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── credentials-exist.js │ │ │ │ │ └── credentials-exist.test.yml │ │ │ ├── delete-api-key │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── delete-api-key.js │ │ │ │ │ └── delete-api-key.test.yml │ │ │ ├── delete-my-credentials │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── delete-my-credentials.js │ │ │ │ │ └── delete-my-credentials.test.yml │ │ │ ├── get-current-user │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get-current-user.js │ │ │ │ │ └── get-current-user.test.yml │ │ │ ├── get-my-credentials │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get-my-credentials.js │ │ │ │ │ └── get-my-credentials.test.yml │ │ │ ├── get-my-rights │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get-my-rights.js │ │ │ │ │ └── get-my-rights.test.yml │ │ │ ├── get-strategies │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get-strategies.js │ │ │ │ │ └── get-strategies.test.yml │ │ │ ├── index.md │ │ │ ├── login │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── login.js │ │ │ │ │ └── login.test.yml │ │ │ ├── logout │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── logout.js │ │ │ │ │ └── logout.test.yml │ │ │ ├── refresh-token │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── refreshToken.js │ │ │ │ │ └── refreshToken.test.yml │ │ │ ├── search-api-keys │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── search-api-keys-es.js │ │ │ │ │ ├── search-api-keys-koncorde.js │ │ │ │ │ └── search-api-keys-koncorde.test.yml │ │ │ ├── update-my-credentials │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── update-my-credentials.js │ │ │ │ │ └── update-my-credentials.test.yml │ │ │ ├── update-self │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── update-self.js │ │ │ │ │ └── update-self.test.yml │ │ │ └── validate-my-credentials │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ ├── validate-my-credentials.js │ │ │ │ └── validate-my-credentials.test.yml │ │ ├── bulk │ │ │ ├── delete-by-query │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── delete-by-query.js │ │ │ │ │ └── delete-by-query.test.yml │ │ │ ├── import │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── import.js │ │ │ │ │ └── import.test.yml │ │ │ ├── index.md │ │ │ ├── mWrite │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── mWrite.js │ │ │ │ │ └── mWrite.test.yml │ │ │ ├── update-by-query │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── update-by-query.js │ │ │ │ │ └── update-by-query.test.yml │ │ │ └── write │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ ├── write.js │ │ │ │ └── write.test.yml │ │ ├── collection │ │ │ ├── create │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── create.js │ │ │ │ │ └── create.test.yml │ │ │ ├── delete-specifications │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── delete-specifications.js │ │ │ │ │ └── delete-specifications.test.yml │ │ │ ├── delete │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── delete.js │ │ │ │ │ └── delete.test.yml │ │ │ ├── exists │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── exists.js │ │ │ │ │ └── exists.test.yml │ │ │ ├── get-mapping │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get-mapping.js │ │ │ │ │ └── get-mapping.test.yml │ │ │ ├── get-specifications │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get-specifications.js │ │ │ │ │ └── get-specifications.test.yml │ │ │ ├── index.md │ │ │ ├── list │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── list.js │ │ │ │ │ └── list.test.yml │ │ │ ├── refresh │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── refresh.js │ │ │ │ │ └── refresh.test.yml │ │ │ ├── search-specifications │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── search-specifications.js │ │ │ │ │ └── search-specifications.test.yml │ │ │ ├── truncate │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── truncate.js │ │ │ │ │ └── truncate.test.yml │ │ │ ├── update-mapping │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── update-mapping.js │ │ │ │ │ └── update-mapping.test.yml │ │ │ ├── update-specifications │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── update-specifications.js │ │ │ │ │ └── update-specifications.test.yml │ │ │ ├── update │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── update.js │ │ │ │ │ └── update.test.yml │ │ │ └── validate-specifications │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ ├── validate-specifications.js │ │ │ │ └── validate-specifications.test.yml │ │ ├── document │ │ │ ├── count │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── count.js │ │ │ │ │ └── count.test.yml │ │ │ ├── create-or-replace │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── create-or-replace.js │ │ │ │ │ └── create-or-replace.test.yml │ │ │ ├── create │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── create.js │ │ │ │ │ └── create.test.yml │ │ │ ├── delete-by-query │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── delete-by-query-es.js │ │ │ │ │ ├── delete-by-query-es.test.yml │ │ │ │ │ ├── delete-by-query-koncorde.js │ │ │ │ │ └── delete-by-query-koncorde.test.yml │ │ │ ├── delete-fields │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── deleteFields.js │ │ │ │ │ └── deleteFields.test.yml │ │ │ ├── delete │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── delete.js │ │ │ │ │ └── delete.test.yml │ │ │ ├── exists │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── exists.js │ │ │ │ │ └── exists.test.yml │ │ │ ├── get │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get.js │ │ │ │ │ └── get.test.yml │ │ │ ├── index.md │ │ │ ├── m-create-or-replace │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── m-create-or-replace.js │ │ │ │ │ └── m-create-or-replace.test.yml │ │ │ ├── m-create │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── m-create.js │ │ │ │ │ └── m-create.test.yml │ │ │ ├── m-delete │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── m-delete.js │ │ │ │ │ └── m-delete.test.yml │ │ │ ├── m-get │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── m-get.js │ │ │ │ │ └── m-get.test.yml │ │ │ ├── m-replace │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── m-replace.js │ │ │ │ │ └── m-replace.test.yml │ │ │ ├── m-update │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── m-update.js │ │ │ │ │ └── m-update.test.yml │ │ │ ├── m-upsert │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── m-upsert.js │ │ │ │ │ └── m-upsert.test.yml │ │ │ ├── replace │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── replace.js │ │ │ │ │ └── replace.test.yml │ │ │ ├── search │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── search-es.js │ │ │ │ │ ├── search-es.test.yml │ │ │ │ │ ├── search-koncorde.js │ │ │ │ │ └── search-koncorde.test.yml │ │ │ ├── update-by-query │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── update-by-query-es.js │ │ │ │ │ ├── update-by-query-es.test.yml │ │ │ │ │ ├── update-by-query-koncorde.js │ │ │ │ │ └── update-by-query-koncorde.test.yml │ │ │ ├── update │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── update.js │ │ │ │ │ └── update.test.yml │ │ │ ├── upsert │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── upsert.js │ │ │ │ │ └── upsert.test.yml │ │ │ └── validate │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ ├── validate.js │ │ │ │ └── validate.test.yml │ │ ├── index.md │ │ ├── index │ │ │ ├── create │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── create.js │ │ │ │ │ └── create.test.yml │ │ │ ├── delete │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── delete.js │ │ │ │ │ └── delete.test.yml │ │ │ ├── exists │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── exists.js │ │ │ │ │ └── exists.test.yml │ │ │ ├── index.md │ │ │ ├── list │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── list.js │ │ │ │ │ └── list.test.yml │ │ │ ├── m-delete │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── mDelete.js │ │ │ │ │ └── mDelete.test.yml │ │ │ └── stats │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ ├── stats.js │ │ │ │ └── stats.test.yml │ │ ├── ms │ │ │ ├── append │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── append.js │ │ │ │ │ └── append.test.yml │ │ │ ├── bitcount │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── bitcount.js │ │ │ │ │ └── bitcount.test.yml │ │ │ ├── bitop │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── bitop.js │ │ │ │ │ └── bitop.test.yml │ │ │ ├── bitpos │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── bitpos.js │ │ │ │ │ └── bitpos.test.yml │ │ │ ├── dbsize │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── dbsize.js │ │ │ │ │ └── dbsize.test.yml │ │ │ ├── decr │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── decr.js │ │ │ │ │ └── decr.test.yml │ │ │ ├── decrby │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── decrby.js │ │ │ │ │ └── decrby.test.yml │ │ │ ├── del │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── del.js │ │ │ │ │ └── del.test.yml │ │ │ ├── exists │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── exists.js │ │ │ │ │ └── exists.test.yml │ │ │ ├── expire │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── expire.js │ │ │ │ │ └── expire.test.yml │ │ │ ├── expireat │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── expireat.js │ │ │ │ │ └── expireat.test.yml │ │ │ ├── flushdb │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── flushdb.js │ │ │ │ │ └── flushdb.test.yml │ │ │ ├── geoadd │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── geoadd.js │ │ │ │ │ └── geoadd.test.yml │ │ │ ├── geodist │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── geodist.js │ │ │ │ │ └── geodist.test.yml │ │ │ ├── geohash │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── geohash.js │ │ │ │ │ └── geohash.test.yml │ │ │ ├── geopos │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── geopos.js │ │ │ │ │ └── geopos.test.yml │ │ │ ├── georadius │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── georadius.js │ │ │ │ │ └── georadius.test.yml │ │ │ ├── georadiusbymember │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── georadiusbymember.js │ │ │ │ │ └── georadiusbymember.test.yml │ │ │ ├── get │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get.js │ │ │ │ │ └── get.test.yml │ │ │ ├── getbit │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── getbit.js │ │ │ │ │ └── getbit.test.yml │ │ │ ├── getrange │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── getrange.js │ │ │ │ │ └── getrange.test.yml │ │ │ ├── getset │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── getset.js │ │ │ │ │ └── getset.test.yml │ │ │ ├── hdel │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── hdel.js │ │ │ │ │ └── hdel.test.yml │ │ │ ├── hexists │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── hexists.js │ │ │ │ │ └── hexists.test.yml │ │ │ ├── hget │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── hget.js │ │ │ │ │ └── hget.test.yml │ │ │ ├── hgetall │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── hgetall.js │ │ │ │ │ └── hgetall.test.yml │ │ │ ├── hincrby │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── hincrby.js │ │ │ │ │ └── hincrby.test.yml │ │ │ ├── hincrbyfloat │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── hincrbyfloat.js │ │ │ │ │ └── hincrbyfloat.test.yml │ │ │ ├── hkeys │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── hkeys.js │ │ │ │ │ └── hkeys.test.yml │ │ │ ├── hlen │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── hlen.js │ │ │ │ │ └── hlen.test.yml │ │ │ ├── hmget │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── hmget.js │ │ │ │ │ └── hmget.test.yml │ │ │ ├── hmset │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── hmset.js │ │ │ │ │ └── hmset.test.yml │ │ │ ├── hscan │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── hscan.js │ │ │ │ │ └── hscan.test.yml │ │ │ ├── hset │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── hset.js │ │ │ │ │ └── hset.test.yml │ │ │ ├── hsetnx │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── hsetnx.js │ │ │ │ │ └── hsetnx.test.yml │ │ │ ├── hstrlen │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── hstrlen.js │ │ │ │ │ └── hstrlen.test.yml │ │ │ ├── hvals │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── hvals.js │ │ │ │ │ └── hvals.test.yml │ │ │ ├── incr │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── incr.js │ │ │ │ │ └── incr.test.yml │ │ │ ├── incrby │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── incrby.js │ │ │ │ │ └── incrby.test.yml │ │ │ ├── incrbyfloat │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── incrbyfloat.js │ │ │ │ │ └── incrbyfloat.test.yml │ │ │ ├── index.md │ │ │ ├── keys │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── keys.js │ │ │ │ │ └── keys.test.yml │ │ │ ├── lindex │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── lindex.js │ │ │ │ │ └── lindex.test.yml │ │ │ ├── linsert │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── linsert.js │ │ │ │ │ └── linsert.test.yml │ │ │ ├── llen │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── llen.js │ │ │ │ │ └── llen.test.yml │ │ │ ├── lpop │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── lpop.js │ │ │ │ │ └── lpop.test.yml │ │ │ ├── lpush │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── lpush.js │ │ │ │ │ └── lpush.test.yml │ │ │ ├── lpushx │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── lpushx.js │ │ │ │ │ └── lpushx.test.yml │ │ │ ├── lrange │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── lrange.js │ │ │ │ │ └── lrange.test.yml │ │ │ ├── lrem │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── lrem.js │ │ │ │ │ └── lrem.test.yml │ │ │ ├── lset │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── lset.js │ │ │ │ │ └── lset.test.yml │ │ │ ├── ltrim │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── ltrim.js │ │ │ │ │ └── ltrim.test.yml │ │ │ ├── mexecute │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── mexecute.js │ │ │ │ │ └── mexecute.test.yml │ │ │ ├── mget │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── mget.js │ │ │ │ │ └── mget.test.yml │ │ │ ├── mset │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── mset.js │ │ │ │ │ └── mset.test.yml │ │ │ ├── msetnx │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── msetnx.js │ │ │ │ │ └── msetnx.test.yml │ │ │ ├── object │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── object.js │ │ │ │ │ └── object.test.yml │ │ │ ├── persist │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── persist.js │ │ │ │ │ └── persist.test.yml │ │ │ ├── pexpire │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── pexpire.js │ │ │ │ │ └── pexpire.test.yml │ │ │ ├── pexpireat │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── pexpireat.js │ │ │ │ │ └── pexpireat.test.yml │ │ │ ├── pfadd │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── pfadd.js │ │ │ │ │ └── pfadd.test.yml │ │ │ ├── pfcount │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── pfcount.js │ │ │ │ │ └── pfcount.test.yml │ │ │ ├── pfmerge │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── pfmerge.js │ │ │ │ │ └── pfmerge.test.yml │ │ │ ├── ping │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── ping.js │ │ │ │ │ └── ping.test.yml │ │ │ ├── psetex │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── psetex.js │ │ │ │ │ └── psetex.test.yml │ │ │ ├── pttl │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── pttl.js │ │ │ │ │ └── pttl.test.yml │ │ │ ├── randomkey │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── randomkey.js │ │ │ │ │ └── randomkey.test.yml │ │ │ ├── rename │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── rename.js │ │ │ │ │ └── rename.test.yml │ │ │ ├── renamenx │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── renamenx.js │ │ │ │ │ └── renamenx.test.yml │ │ │ ├── rpop │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── rpop.js │ │ │ │ │ └── rpop.test.yml │ │ │ ├── rpoplpush │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── rpoplpush.js │ │ │ │ │ └── rpoplpush.test.yml │ │ │ ├── rpush │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── rpush.js │ │ │ │ │ └── rpush.test.yml │ │ │ ├── rpushx │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── rpushx.js │ │ │ │ │ └── rpushx.test.yml │ │ │ ├── sadd │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── sadd.js │ │ │ │ │ └── sadd.test.yml │ │ │ ├── scan │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── scan.js │ │ │ │ │ └── scan.test.yml │ │ │ ├── scard │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── scard.js │ │ │ │ │ └── scard.test.yml │ │ │ ├── sdiff │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── sdiff.js │ │ │ │ │ └── sdiff.test.yml │ │ │ ├── sdiffstore │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── sdiffstore.js │ │ │ │ │ └── sdiffstore.test.yml │ │ │ ├── set │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── set.js │ │ │ │ │ └── set.test.yml │ │ │ ├── setex │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── setex.js │ │ │ │ │ └── setex.test.yml │ │ │ ├── setnx │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── setnx.js │ │ │ │ │ └── setnx.test.yml │ │ │ ├── sinter │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── sinter.js │ │ │ │ │ └── sinter.test.yml │ │ │ ├── sinterstore │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── sinterstore.js │ │ │ │ │ └── sinterstore.test.yml │ │ │ ├── sismember │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── sismember.js │ │ │ │ │ └── sismember.test.yml │ │ │ ├── smembers │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── smembers.js │ │ │ │ │ └── smembers.test.yml │ │ │ ├── smove │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── smove.js │ │ │ │ │ └── smove.test.yml │ │ │ ├── sort │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── sort.js │ │ │ │ │ └── sort.test.yml │ │ │ ├── spop │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── spop.js │ │ │ │ │ └── spop.test.yml │ │ │ ├── srandmember │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── srandmember.js │ │ │ │ │ └── srandmember.test.yml │ │ │ ├── srem │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── srem.js │ │ │ │ │ └── srem.test.yml │ │ │ ├── sscan │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── sscan.js │ │ │ │ │ └── sscan.test.yml │ │ │ ├── strlen │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── strlen.js │ │ │ │ │ └── strlen.test.yml │ │ │ ├── sunion │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── sunion.js │ │ │ │ │ └── sunion.test.yml │ │ │ ├── sunionstore │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── sunionstore.js │ │ │ │ │ └── sunionstore.test.yml │ │ │ ├── time │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── time.js │ │ │ │ │ └── time.test.yml │ │ │ ├── touch │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── touch.js │ │ │ │ │ └── touch.test.yml │ │ │ ├── ttl │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── ttl.js │ │ │ │ │ └── ttl.test.yml │ │ │ ├── type │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── type.js │ │ │ │ │ └── type.test.yml │ │ │ ├── zadd │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zadd.js │ │ │ │ │ └── zadd.test.yml │ │ │ ├── zcard │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zcard.js │ │ │ │ │ └── zcard.test.yml │ │ │ ├── zcount │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zcount.js │ │ │ │ │ └── zcount.test.yml │ │ │ ├── zincrby │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zincrby.js │ │ │ │ │ └── zincrby.test.yml │ │ │ ├── zinterstore │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zinterstore.js │ │ │ │ │ └── zinterstore.test.yml │ │ │ ├── zlexcount │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zlexcount.js │ │ │ │ │ └── zlexcount.test.yml │ │ │ ├── zrange │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zrange.js │ │ │ │ │ └── zrange.test.yml │ │ │ ├── zrangebylex │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zrangebylex.js │ │ │ │ │ └── zrangebylex.test.yml │ │ │ ├── zrangebyscore │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zrangebyscore.js │ │ │ │ │ └── zrangebyscore.test.yml │ │ │ ├── zrank │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zrank.js │ │ │ │ │ └── zrank.test.yml │ │ │ ├── zrem │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zrem.js │ │ │ │ │ └── zrem.test.yml │ │ │ ├── zremrangebylex │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zremrangebylex.js │ │ │ │ │ └── zremrangebylex.test.yml │ │ │ ├── zremrangebyrank │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zremrangebyrank.js │ │ │ │ │ └── zremrangebyrank.test.yml │ │ │ ├── zremrangebyscore │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zremrangebyscore.js │ │ │ │ │ └── zremrangebyscore.test.yml │ │ │ ├── zrevrange │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zrevrange.js │ │ │ │ │ └── zrevrange.test.yml │ │ │ ├── zrevrangebylex │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zrevrangebylex.js │ │ │ │ │ └── zrevrangebylex.test.yml │ │ │ ├── zrevrangebyscore │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zrevrangebyscore.js │ │ │ │ │ └── zrevrangebyscore.test.yml │ │ │ ├── zrevrank │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zrevrank.js │ │ │ │ │ └── zrevrank.test.yml │ │ │ ├── zscan │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zscan.js │ │ │ │ │ └── zscan.test.yml │ │ │ ├── zscore │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── zscore.js │ │ │ │ │ └── zscore.test.yml │ │ │ └── zunionstore │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ ├── zunionstore.js │ │ │ │ └── zunionstore.test.yml │ │ ├── realtime │ │ │ ├── count │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── count.js │ │ │ │ │ └── count.test.yml │ │ │ ├── index.md │ │ │ ├── publish │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── publish.js │ │ │ │ │ └── publish.test.yml │ │ │ ├── subscribe │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── document-notifications-leave-scope.js │ │ │ │ │ ├── document-notifications-leave-scope.test.yml │ │ │ │ │ ├── document-notifications.js │ │ │ │ │ ├── document-notifications.test.yml │ │ │ │ │ ├── message-notifications.js │ │ │ │ │ ├── message-notifications.test.yml │ │ │ │ │ ├── user-notifications.js │ │ │ │ │ └── user-notifications.test.yml │ │ │ └── unsubscribe │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ ├── unsubscribe.js │ │ │ │ └── unsubscribe.test.yml │ │ ├── security │ │ │ ├── check-rights │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── check-rights.js │ │ │ │ │ └── check-rights.test.yml │ │ │ ├── create-api-key │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── create-api-key.js │ │ │ │ │ └── create-api-key.test.yml │ │ │ ├── create-credentials │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── create-credentials.js │ │ │ │ │ └── create-credentials.test.yml │ │ │ ├── create-first-admin │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── create-first-admin.js │ │ │ │ │ └── create-first-admin.test.yml │ │ │ ├── create-or-replace-profile │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── create-or-replace-profile.js │ │ │ │ │ └── create-or-replace-profile.test.yml │ │ │ ├── create-or-replace-role │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── create-or-replace-role.js │ │ │ │ │ └── create-or-replace-role.test.yml │ │ │ ├── create-profile │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── create-profile.js │ │ │ │ │ └── create-profile.test.yml │ │ │ ├── create-restricted-user │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── create-restricted-user.js │ │ │ │ │ └── create-restricted-user.test.yml │ │ │ ├── create-role │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── create-role.js │ │ │ │ │ └── create-role.test.yml │ │ │ ├── create-user │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── create-user.js │ │ │ │ │ └── create-user.test.yml │ │ │ ├── delete-api-key │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── delete-api-key.js │ │ │ │ │ └── delete-api-key.test.yml │ │ │ ├── delete-credentials │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── delete-credentials.js │ │ │ │ │ └── delete-credentials.test.yml │ │ │ ├── delete-profile │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── delete-profile.js │ │ │ │ │ └── delete-profile.test.yml │ │ │ ├── delete-role │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── delete-role.js │ │ │ │ │ └── delete-role.test.yml │ │ │ ├── delete-user │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── delete-user.js │ │ │ │ │ └── delete-user.test.yml │ │ │ ├── get-all-credential-fields │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get-all-credential-fields.js │ │ │ │ │ └── get-all-credential-fields.test.yml │ │ │ ├── get-credential-fields │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get-credential-fields.js │ │ │ │ │ └── get-credential-fields.test.yml │ │ │ ├── get-credentials-by-id │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get-credentials-by-id.js │ │ │ │ │ └── get-credentials-by-id.test.yml │ │ │ ├── get-credentials │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get-credentials.js │ │ │ │ │ └── get-credentials.test.yml │ │ │ ├── get-profile-mapping │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get-profile-mapping.js │ │ │ │ │ └── get-profile-mapping.test.yml │ │ │ ├── get-profile-rights │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get-profile-rights.js │ │ │ │ │ └── get-profile-rights.test.yml │ │ │ ├── get-profile │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get-profile.js │ │ │ │ │ └── get-profile.test.yml │ │ │ ├── get-role-mapping │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get-role-mapping.js │ │ │ │ │ └── get-role-mapping.test.yml │ │ │ ├── get-role │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get-role.js │ │ │ │ │ └── get-role.test.yml │ │ │ ├── get-user-mapping │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get-user-mapping.js │ │ │ │ │ └── get-user-mapping.test.yml │ │ │ ├── get-user-rights │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get-user-rights.js │ │ │ │ │ └── get-user-rights.test.yml │ │ │ ├── get-user-strategies │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get-user-strategies.js │ │ │ │ │ └── get-user-strategies.test.yml │ │ │ ├── get-user │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── get-user.js │ │ │ │ │ └── get-user.test.yml │ │ │ ├── has-credentials │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── has-credentials.js │ │ │ │ │ └── has-credentials.test.yml │ │ │ ├── index.md │ │ │ ├── m-delete-profiles │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── m-delete-profiles.js │ │ │ │ │ └── m-delete-profiles.test.yml │ │ │ ├── m-delete-roles │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── m-delete-roles.js │ │ │ │ │ └── m-delete-roles.test.yml │ │ │ ├── m-delete-users │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── m-delete-users.js │ │ │ │ │ └── m-delete-users.test.yml │ │ │ ├── m-get-profiles │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── m-get-profiles.js │ │ │ │ │ └── m-get-profiles.test.yml │ │ │ ├── m-get-roles │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── m-get-roles.js │ │ │ │ │ └── m-get-roles.test.yml │ │ │ ├── m-get-users │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── m-get-users.js │ │ │ │ │ └── m-get-users.test.yml │ │ │ ├── refresh │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── refresh.js │ │ │ │ │ └── refresh.test.yml │ │ │ ├── replace-user │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── replace-user.js │ │ │ │ │ └── replace-user.test.yml │ │ │ ├── search-api-keys │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── search-api-keys-es.js │ │ │ │ │ ├── search-api-keys-koncorde.js │ │ │ │ │ └── search-api-keys-koncorde.test.yml │ │ │ ├── search-profiles │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── search-profiles.js │ │ │ │ │ └── search-profiles.test.yml │ │ │ ├── search-roles │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── search-roles.js │ │ │ │ │ └── search-roles.test.yml │ │ │ ├── search-users │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── search-users-es.js │ │ │ │ │ ├── search-users-es.test.yml │ │ │ │ │ ├── search-users-koncorde.js │ │ │ │ │ └── search-users-koncorde.test.yml │ │ │ ├── update-credentials │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── update-credentials.js │ │ │ │ │ └── update-credentials.test.yml │ │ │ ├── update-profile-mapping │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── update-profile-mapping.js │ │ │ │ │ └── update-profile-mapping.test.yml │ │ │ ├── update-profile │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── update-profile.js │ │ │ │ │ └── update-profile.test.yml │ │ │ ├── update-role-mapping │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── update-role-mapping.js │ │ │ │ │ └── update-role-mapping.test.yml │ │ │ ├── update-role │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── update-role.js │ │ │ │ │ └── update-role.test.yml │ │ │ ├── update-user-mapping │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── update-user-mapping.js │ │ │ │ │ └── update-user-mapping.test.yml │ │ │ ├── update-user │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── update-user.js │ │ │ │ │ └── update-user.test.yml │ │ │ └── validate-credentials │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ ├── validate-credentials.js │ │ │ │ └── validate-credentials.test.yml │ │ └── server │ │ │ ├── admin-exists │ │ │ ├── index.md │ │ │ └── snippets │ │ │ │ ├── admin-exists.js │ │ │ │ └── admin-exists.test.yml │ │ │ ├── get-all-stats │ │ │ ├── index.md │ │ │ └── snippets │ │ │ │ ├── get-all-stats.js │ │ │ │ └── get-all-stats.test.yml │ │ │ ├── get-config │ │ │ ├── index.md │ │ │ └── snippets │ │ │ │ ├── get-config.js │ │ │ │ └── get-config.test.yml │ │ │ ├── get-last-stats │ │ │ ├── index.md │ │ │ └── snippets │ │ │ │ ├── get-last-stats.js │ │ │ │ └── get-last-stats.test.yml │ │ │ ├── get-stats │ │ │ ├── index.md │ │ │ └── snippets │ │ │ │ ├── get-stats.js │ │ │ │ └── get-stats.test.yml │ │ │ ├── index.md │ │ │ ├── info │ │ │ ├── index.md │ │ │ └── snippets │ │ │ │ ├── info.js │ │ │ │ └── info.test.yml │ │ │ └── now │ │ │ ├── index.md │ │ │ └── snippets │ │ │ ├── now.js │ │ │ └── now.test.yml │ ├── core-classes │ │ ├── base-controller │ │ │ ├── index.md │ │ │ ├── introduction │ │ │ │ └── index.md │ │ │ ├── properties │ │ │ │ └── index.md │ │ │ └── query │ │ │ │ └── index.md │ │ ├── batch-controller │ │ │ ├── constructor │ │ │ ├── dispose │ │ │ │ └── index.md │ │ │ ├── index.md │ │ │ └── introduction │ │ │ │ └── index.md │ │ ├── index.md │ │ ├── kuzzle-error │ │ │ ├── index.md │ │ │ ├── introduction │ │ │ │ └── index.md │ │ │ └── properties │ │ │ │ └── index.md │ │ ├── kuzzle-event-emitter │ │ │ ├── add-listener │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── add-listener.js │ │ │ │ │ └── add-listener.test.yml │ │ │ ├── add-once-listener │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── add-once-listener.js │ │ │ │ │ └── add-once-listener.test.yml │ │ │ ├── emit │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── emit.js │ │ │ │ │ └── emit.test.yml │ │ │ ├── index.md │ │ │ ├── introduction │ │ │ │ └── index.md │ │ │ ├── listeners │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── listeners.js │ │ │ │ │ └── listeners.test.yml │ │ │ ├── on │ │ │ │ └── index.md │ │ │ ├── once │ │ │ │ └── index.md │ │ │ ├── prepend-listener │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── prepend-listener.js │ │ │ │ │ └── prepend-listener.test.yml │ │ │ ├── prepend-once-listener │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── prepend-once-listener.js │ │ │ │ │ └── prepend-once-listener.test.yml │ │ │ ├── remove-all-listener │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── remove-all-listeners.js │ │ │ │ │ └── remove-all-listeners.test.yml │ │ │ └── remove-listener │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ ├── remove-listener.js │ │ │ │ └── remove-listener.test.yml │ │ ├── kuzzle │ │ │ ├── authenticate │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── authenticate.js │ │ │ │ │ └── authenticate.test.yml │ │ │ ├── connect │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── connect.js │ │ │ │ │ └── connect.test.yml │ │ │ ├── constructor │ │ │ ├── disconnect │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── disconnect.js │ │ │ │ │ └── disconnect.test.yml │ │ │ ├── flush-queue │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── flush-queue.js │ │ │ │ │ └── flush-queue.test.yml │ │ │ ├── index.md │ │ │ ├── introduction │ │ │ │ └── index.md │ │ │ ├── play-queue │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── play-queue.js │ │ │ │ │ └── play-queue.test.yml │ │ │ ├── properties │ │ │ │ └── index.md │ │ │ ├── query │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── query.js │ │ │ │ │ └── query.test.yml │ │ │ ├── start-queuing │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── start-queuing.js │ │ │ │ │ └── start-queuing.test.yml │ │ │ ├── stop-queuing │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── stop-queuing.js │ │ │ │ │ └── stop-queuing.test.yml │ │ │ └── use-controller │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ ├── use-controller.js │ │ │ │ └── use-controller.test.yml │ │ ├── observer │ │ │ ├── constructor │ │ │ ├── get │ │ │ │ └── index.md │ │ │ ├── index.md │ │ │ ├── introduction │ │ │ │ └── index.md │ │ │ ├── m-get │ │ │ │ └── index.md │ │ │ ├── observe │ │ │ │ └── index.md │ │ │ ├── search │ │ │ │ └── index.md │ │ │ └── stop │ │ │ │ └── index.md │ │ ├── profile │ │ │ ├── getRoles │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── getRoles.js │ │ │ │ │ └── getRoles.test.yml │ │ │ ├── index.md │ │ │ ├── introduction │ │ │ │ └── index.md │ │ │ ├── properties │ │ │ │ └── index.md │ │ │ └── serialize │ │ │ │ └── index.md │ │ ├── role │ │ │ ├── index.md │ │ │ ├── introduction │ │ │ │ └── index.md │ │ │ ├── properties │ │ │ │ └── index.md │ │ │ └── serialize │ │ │ │ └── index.md │ │ ├── search-result │ │ │ ├── index.md │ │ │ ├── next │ │ │ │ ├── index.md │ │ │ │ └── snippets │ │ │ │ │ ├── fromsize.js │ │ │ │ │ ├── fromsize.test.yml │ │ │ │ │ ├── scroll.js │ │ │ │ │ ├── scroll.test.yml │ │ │ │ │ ├── sortsize.js │ │ │ │ │ └── sortsize.test.yml │ │ │ └── properties │ │ │ │ └── index.md │ │ └── user │ │ │ ├── getProfiles │ │ │ ├── index.md │ │ │ └── snippets │ │ │ │ ├── getProfiles.js │ │ │ │ └── getProfiles.test.yml │ │ │ ├── index.md │ │ │ ├── introduction │ │ │ └── index.md │ │ │ ├── properties │ │ │ └── index.md │ │ │ └── serialize │ │ │ └── index.md │ ├── essentials │ │ ├── batch-processing │ │ │ └── index.md │ │ ├── debugging │ │ │ └── index.md │ │ ├── error-handling │ │ │ ├── index.md │ │ │ └── snippets │ │ │ │ ├── error-handling-async.js │ │ │ │ ├── error-handling-async.test.yml │ │ │ │ ├── error-handling.js │ │ │ │ └── error-handling.test.yml │ │ ├── events │ │ │ └── index.md │ │ ├── extend-sdk │ │ │ └── index.md │ │ ├── index.md │ │ ├── offline-tools │ │ │ └── index.md │ │ ├── realtime-application │ │ │ └── index.md │ │ ├── realtime-notifications │ │ │ └── index.md │ │ └── strong-typing │ │ │ └── index.md │ ├── getting-started │ │ ├── index.md │ │ ├── node-js │ │ │ ├── index.md │ │ │ └── snippets │ │ │ │ ├── create.js │ │ │ │ ├── create.test.yml │ │ │ │ ├── init.js │ │ │ │ ├── init.test.yml │ │ │ │ ├── load-sdk.js │ │ │ │ ├── load-sdk.test.yml │ │ │ │ ├── prepare-db.js │ │ │ │ ├── prepare-db.test.yml │ │ │ │ ├── subscribe.js │ │ │ │ └── subscribe.test.yml │ │ ├── raw-web │ │ │ ├── index.md │ │ │ └── snippets │ │ │ │ ├── create.html │ │ │ │ ├── create.test.yml │ │ │ │ ├── load-sdk.html │ │ │ │ ├── load-sdk.test.yml │ │ │ │ ├── prepare-db.html │ │ │ │ ├── prepare-db.test.yml │ │ │ │ ├── subscribe.html │ │ │ │ └── subscribe.test.yml │ │ └── webpack │ │ │ ├── index.md │ │ │ └── snippets.disabled │ │ │ ├── create.js │ │ │ ├── create.test.yml │ │ │ ├── init-kuzzle.js │ │ │ ├── init-kuzzle.test.yml │ │ │ ├── subscribe.js │ │ │ └── subscribe.test.yml │ ├── index.md │ └── protocols │ │ ├── http │ │ ├── constructor │ │ ├── index.md │ │ ├── introduction │ │ │ └── index.md │ │ └── properties │ │ │ └── index.md │ │ ├── index.md │ │ └── websocket │ │ ├── constructor │ │ ├── index.md │ │ ├── introduction │ │ ├── index.md │ │ └── websocket-cookie-authentication.png │ │ └── properties │ │ └── index.md └── docker-compose.yml ├── features ├── .eslintrc.json ├── steps │ ├── auth.js │ ├── collection.js │ ├── document.js │ ├── index.js │ ├── kuzzle.js │ ├── realtime.js │ └── security.js └── support │ ├── hooks.js │ └── world.js ├── index.ts ├── package-lock.json ├── package.json ├── src ├── Kuzzle.ts ├── KuzzleError.ts ├── RequestTimeoutError.ts ├── controllers │ ├── Auth.ts │ ├── Base.ts │ ├── Bulk.ts │ ├── Collection.ts │ ├── Document.ts │ ├── Index.ts │ ├── MemoryStorage.js │ ├── Realtime.ts │ ├── Security.ts │ └── Server.ts ├── core │ ├── InstrumentablePromise.ts │ ├── Jwt.js │ ├── KuzzleEventEmitter.ts │ ├── Observer.ts │ ├── RealtimeDocument.ts │ ├── Room.js │ ├── batchWriter │ │ ├── BatchBuffer.ts │ │ ├── BatchController.ts │ │ └── BatchWriter.ts │ ├── searchResult │ │ ├── Document.ts │ │ ├── Profile.ts │ │ ├── RealtimeDocument.ts │ │ ├── Role.ts │ │ ├── SearchResultBase.ts │ │ ├── Specifications.ts │ │ └── User.ts │ └── security │ │ ├── Profile.ts │ │ ├── Role.ts │ │ └── User.ts ├── protocols │ ├── DisconnectionOrigin.ts │ ├── Http.ts │ ├── WebSocket.ts │ ├── abstract │ │ ├── Base.ts │ │ ├── PendingRequest.ts │ │ └── Realtime.ts │ ├── index.ts │ └── routes.json ├── types │ ├── ApiKey.ts │ ├── ArgsDefault.ts │ ├── BaseRequest.ts │ ├── Document.ts │ ├── HttpRoutes.ts │ ├── JSONObject.ts │ ├── KDocument.ts │ ├── Mappings.ts │ ├── Notification.ts │ ├── ProfilePolicy.ts │ ├── RequestPayload.ts │ ├── ResponsePayload.ts │ ├── RoleRightsDefinition.ts │ ├── index.ts │ ├── mRequests.ts │ └── mResponses.ts └── utils │ ├── Deprecation.ts │ ├── browser.ts │ ├── debug.js │ ├── object.ts │ ├── proxify.js │ ├── stackTrace.js │ └── uuidv4.js ├── test ├── .eslintrc.json ├── browser.html ├── browser2.html ├── controllers │ ├── auth.test.js │ ├── bulk.test.js │ ├── collection.test.js │ ├── document.test.js │ ├── index.test.js │ ├── memoryStorage.test.js │ ├── realtime.test.js │ ├── security.test.js │ └── server.test.js ├── core │ ├── Jwt.test.js │ ├── batchWriter │ │ ├── BatchBuffer.test.js │ │ ├── BatchController.test.js │ │ └── BatchWriter.test.js │ ├── observer.test.js │ ├── room.test.js │ ├── searchResult │ │ ├── document.test.js │ │ ├── profile.test.js │ │ ├── role.test.js │ │ ├── specifications.test.js │ │ └── user.test.js │ └── security │ │ ├── profile.test.js │ │ └── user.test.js ├── kuzzle-sdk-test.ts ├── kuzzle │ ├── authenticator.test.js │ ├── connect.test.js │ ├── constructor.test.js │ ├── eventEmitter.test.js │ ├── getters.test.js │ ├── listenersManagement.test.js │ ├── protocol.test.js │ ├── proxy.test.js │ ├── query.test.js │ ├── queue.test.js │ ├── setters.test.js │ └── useController.test.js ├── mocks │ ├── generateJwt.mock.js │ ├── protocol.mock.js │ └── window.mock.js ├── protocol │ ├── Base.test.js │ ├── Http.test.js │ └── WebSocket.test.js └── utils │ ├── Deprecation.test.js │ └── proxify.test.js ├── tsconfig.json └── webpack.config.js /.babelrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | [ 4 | '@babel/env', 5 | { 6 | targets: { 7 | browsers: ['> 1%'] 8 | } 9 | } 10 | ] 11 | ], 12 | plugins: [ 13 | ['@babel/plugin-transform-for-of', {'assumeArray': true}] 14 | ] 15 | }; 16 | -------------------------------------------------------------------------------- /.ci/doc/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docs", 3 | "version": "1.0.0", 4 | "description": "docs for kuzzle-sdk", 5 | "author": "The Kuzzle Team ", 6 | "main": "index.js", 7 | "scripts": {}, 8 | "dependencies": {}, 9 | "devDependencies": {} 10 | } 11 | -------------------------------------------------------------------------------- /.ci/doc/templates/blank.tpl.js: -------------------------------------------------------------------------------- 1 | // load the Kuzzle SDK module 2 | const 3 | { 4 | Kuzzle, 5 | WebSocket, 6 | Http 7 | } = require('kuzzle-sdk'); 8 | 9 | const kuzzle = new Kuzzle( 10 | new WebSocket('kuzzle', { pingInterval: 2000 }) 11 | ); 12 | 13 | [snippet-code] 14 | console.log('Everything is ok'); 15 | -------------------------------------------------------------------------------- /.ci/doc/templates/controller.tpl.js: -------------------------------------------------------------------------------- 1 | // load the Kuzzle SDK module 2 | const 3 | { 4 | Kuzzle, 5 | WebSocket, 6 | BaseController 7 | } = require('kuzzle-sdk'); 8 | 9 | BaseController.prototype.query = () => Promise.resolve(null); 10 | 11 | [snippet-code] 12 | -------------------------------------------------------------------------------- /.ci/doc/templates/default.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Snippet testing 7 | 8 | 9 | 10 | [snippet-code] 11 | 12 | 13 | -------------------------------------------------------------------------------- /.ci/doc/templates/doIt.tpl.js: -------------------------------------------------------------------------------- 1 | // This template expects a snippet that declares a function called doIt function 2 | // which it calls. 3 | [snippet-code] 4 | 5 | doIt(); 6 | -------------------------------------------------------------------------------- /.ci/doc/templates/empty.tpl.js: -------------------------------------------------------------------------------- 1 | [snippet-code] 2 | 3 | console.log('Success'); 4 | -------------------------------------------------------------------------------- /.ci/doc/templates/eventemitter.tpl.js: -------------------------------------------------------------------------------- 1 | const 2 | { 3 | KuzzleEventEmitter 4 | } = require('kuzzle-sdk'); 5 | 6 | [snippet-code] 7 | -------------------------------------------------------------------------------- /.ci/doc/templates/mqtt-end.tpl.js: -------------------------------------------------------------------------------- 1 | [snippet-code] finally { 2 | console.log('Success'); 3 | client.end(); 4 | } 5 | -------------------------------------------------------------------------------- /.ci/stop_kuzzle.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | # Download and launch custom Kuzzle stack 4 | 5 | docker-compose -f .ci/docker-compose.yml stop 6 | -------------------------------------------------------------------------------- /.ci/test-docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 6 | cd "$here" 7 | 8 | docker compose -f ./doc/docker-compose.yml build 9 | docker compose -f ./doc/docker-compose.yml pull 10 | docker compose -f ./doc/docker-compose.yml run doc-tests node index 11 | EXIT=$? 12 | docker compose -f ./doc/docker-compose.yml down 13 | -------------------------------------------------------------------------------- /.commitlintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["@commitlint/config-conventional"] 3 | } -------------------------------------------------------------------------------- /.cz.json: -------------------------------------------------------------------------------- 1 | { 2 | "path": "./node_modules/cz-conventional-changelog" 3 | } -------------------------------------------------------------------------------- /.eslintrc-ts.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["kuzzle"], 3 | "extends": [ 4 | "plugin:kuzzle/default", 5 | "plugin:kuzzle/node", 6 | "plugin:kuzzle/typescript" 7 | ], 8 | "rules": { 9 | "func-names": 0, 10 | "strict": 0 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["kuzzle"], 3 | "extends": ["plugin:kuzzle/default", "plugin:kuzzle/node"], 4 | "rules": { 5 | "func-names": 0, 6 | "strict": 0 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: 🗣 Ask a Question 4 | url: https://stackoverflow.com/questions/ask?tags=kuzzle 5 | about: How does X work? 6 | - name: 👋 Join us on Discord 7 | url: http://join.discord.kuzzle.io/ 8 | about: I have an idea... 9 | - name: 📖 Read Kuzzle's Documentation 10 | url: https://docs.kuzzle.io 11 | about: How to use Kuzzle? 12 | -------------------------------------------------------------------------------- /.github/actions/unit-tests/action.yml: -------------------------------------------------------------------------------- 1 | name: Unit Tests 2 | description: Run Unit Tests 3 | runs: 4 | using: "composite" 5 | steps: 6 | - name: Run build 7 | run: | 8 | npm ci 9 | npm run build 10 | shell: bash 11 | - name: Run tests 12 | run: | 13 | npm run test:unit 14 | shell: bash 15 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "features/features"] 2 | path = features/features 3 | url = https://github.com/kuzzleio/sdk-features.git 4 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | [ -n "$CI" ] && exit 0 3 | 4 | . "$(dirname -- "$0")/_/husky.sh" 5 | 6 | npx --no -- commitlint --edit ${1} -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | [ -n "$CI" ] && exit 0 3 | 4 | . "$(dirname -- "$0")/_/husky.sh" 5 | 6 | npm run lint -------------------------------------------------------------------------------- /.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "reporter": "dot", 3 | "recursive": true, 4 | "slow": 2000, 5 | "timeout": 10000, 6 | "require": ["should-sinon", "ts-node/register"] 7 | } 8 | -------------------------------------------------------------------------------- /.releaserc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["semantic-release-config-kuzzle"], 3 | "branches": [ 4 | "master", 5 | { "name": "beta", "prerelease": true } 6 | ] 7 | } -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "program": "${workspaceFolder}/index.js" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | range: "90...100" 3 | 4 | status: 5 | project: 6 | default: 7 | threshold: 1 8 | 9 | patch: false 10 | changes: false 11 | -------------------------------------------------------------------------------- /dist/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /dist/.npmignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuzzleio/sdk-javascript/c0aad86c7ca1df4ec07c19dd17e612efa461c289/dist/.npmignore -------------------------------------------------------------------------------- /doc/7/.vuepress: -------------------------------------------------------------------------------- 1 | ../framework/src/.vuepress/ -------------------------------------------------------------------------------- /doc/7/controllers/auth/check-rights/snippets/check-rights.js: -------------------------------------------------------------------------------- 1 | const requestPayload = { 2 | controller: 'document', 3 | action: 'create', 4 | index: 'nyc-open-data', 5 | collection: 'yellow-taxi', 6 | body: { 7 | name: 'Melis' 8 | } 9 | } 10 | 11 | try { 12 | const result = await kuzzle.auth.checkRights(requestPayload); 13 | console.log(result); 14 | /* 15 | true 16 | */ 17 | } catch (error) { 18 | console.error(error.message); 19 | } 20 | -------------------------------------------------------------------------------- /doc/7/controllers/auth/check-rights/snippets/check-rights.test.yml: -------------------------------------------------------------------------------- 1 | name: auth#checkRights 2 | description: Checks if an API action can be executed by the current user 3 | hooks: 4 | before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' 5 | after: curl -X DELETE kuzzle:7512/users/foo 6 | template: default 7 | expected: true -------------------------------------------------------------------------------- /doc/7/controllers/auth/check-token/snippets/check-token.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: auth#checkToken 3 | description: Checks a JWT token's validity. 4 | hooks: 5 | before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' 6 | after: curl -X DELETE kuzzle:7512/users/foo 7 | template: default 8 | expected: Token is valid 9 | 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/auth/create-my-credentials/snippets/create-my-credentials.js: -------------------------------------------------------------------------------- 1 | const credentials = { username: 'foo', password: 'bar' }; 2 | 3 | await kuzzle.auth.login('local', credentials); 4 | 5 | const response = await kuzzle.auth.createMyCredentials('other', credentials); 6 | console.log(response); 7 | /* 8 | { username: 'foo', kuid: 'AVkDBl3YsT6qHI7MxLz0' } 9 | */ 10 | 11 | console.log('Credentials successfully created'); 12 | -------------------------------------------------------------------------------- /doc/7/controllers/auth/credentials-exist/snippets/credentials-exist.js: -------------------------------------------------------------------------------- 1 | const credentials = { username: 'foo', password: 'bar' }; 2 | 3 | try { 4 | await kuzzle.auth.login('local', credentials); 5 | 6 | const exists = await kuzzle.auth.credentialsExist('local'); 7 | 8 | if (exists === true) { 9 | console.log('Credentials exist'); 10 | } 11 | } catch (error) { 12 | console.error(error.message); 13 | } 14 | -------------------------------------------------------------------------------- /doc/7/controllers/auth/delete-api-key/snippets/delete-api-key.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.auth.login('local', { 3 | username: 'jane.doe', 4 | password: 'password', 5 | }); 6 | 7 | const apiKey = await kuzzle.auth.createApiKey('Sigfox API key', { 8 | refresh: 'wait_for' 9 | }); 10 | 11 | await kuzzle.auth.deleteApiKey(apiKey._id); 12 | 13 | console.log('API key successfully deleted'); 14 | } catch (e) { 15 | console.error(e); 16 | } 17 | -------------------------------------------------------------------------------- /doc/7/controllers/auth/delete-my-credentials/snippets/delete-my-credentials.js: -------------------------------------------------------------------------------- 1 | const credentials = { username: 'foo', password: 'bar' }; 2 | 3 | try { 4 | await kuzzle.auth.login('local', credentials); 5 | 6 | const success = await kuzzle.auth.deleteMyCredentials('local'); 7 | console.log(success); 8 | if (success === true) { 9 | console.log('Credentials successfully deleted'); 10 | } 11 | } catch (error) { 12 | console.error(error.message); 13 | } 14 | -------------------------------------------------------------------------------- /doc/7/controllers/auth/get-my-credentials/snippets/get-my-credentials.js: -------------------------------------------------------------------------------- 1 | const credentials = { username: 'foo', password: 'bar' }; 2 | 3 | try { 4 | await kuzzle.auth.login('local', credentials); 5 | 6 | const localCredentials = await kuzzle.auth.getMyCredentials('local'); 7 | console.log(localCredentials); 8 | /* 9 | { username: 'foo', kuid: 'AVkDBl3YsT6qHI7MxLz0' } 10 | */ 11 | 12 | console.log('Success'); 13 | } catch (error) { 14 | console.error(error.message); 15 | } 16 | -------------------------------------------------------------------------------- /doc/7/controllers/auth/get-strategies/snippets/get-strategies.js: -------------------------------------------------------------------------------- 1 | const credentials = { username: 'foo', password: 'bar' }; 2 | 3 | try { 4 | await kuzzle.auth.login('local', credentials); 5 | 6 | const strategies = await kuzzle.auth.getStrategies(); 7 | console.log(strategies); 8 | /* 9 | [ 'local', 'facebook' ] 10 | */ 11 | 12 | console.log('Success'); 13 | } catch (error) { 14 | console.error(error.message); 15 | } 16 | -------------------------------------------------------------------------------- /doc/7/controllers/auth/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: auth 5 | description: auth controller documentation 6 | --- 7 | -------------------------------------------------------------------------------- /doc/7/controllers/auth/login/snippets/login.js: -------------------------------------------------------------------------------- 1 | const credentials = { username: 'foo', password: 'bar' }; 2 | 3 | try { 4 | const jwt = await kuzzle.auth.login('local', credentials); 5 | console.log(jwt); 6 | /* 7 | 'eyJhbGciOiJIUzI1NiIsIkpXVCJ9.eyJfaWQiOiJmb28iLCJpYXQiOjE.wSPmb0z2tErRdYEg' 8 | */ 9 | console.log('Success'); 10 | } catch (error) { 11 | console.error(error.message); 12 | } 13 | -------------------------------------------------------------------------------- /doc/7/controllers/auth/login/snippets/login.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: auth#login 3 | description: Authenticate a user 4 | hooks: 5 | before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' 6 | after: curl -X DELETE kuzzle:7512/users/foo 7 | template: default 8 | expected: Success 9 | 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/auth/logout/snippets/logout.js: -------------------------------------------------------------------------------- 1 | const credentials = { username: 'foo', password: 'bar' }; 2 | 3 | try { 4 | await kuzzle.auth.login('local', credentials); 5 | 6 | await kuzzle.auth.logout(); 7 | 8 | console.log('Success'); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/auth/logout/snippets/logout.test.yml: -------------------------------------------------------------------------------- 1 | name: auth#logout 2 | description: Revokes the user's token & unsubscribe them from registered rooms. 3 | hooks: 4 | before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' 5 | after: curl -X DELETE kuzzle:7512/users/foo 6 | template: default 7 | expected: Success 8 | 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/auth/update-self/snippets/update-self.test.yml: -------------------------------------------------------------------------------- 1 | name: auth#updateSelf 2 | description: Updates the current user object in Kuzzle 3 | hooks: 4 | before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' 5 | after: curl -X DELETE kuzzle:7512/users/foo 6 | template: default 7 | expected: Success 8 | 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/auth/validate-my-credentials/snippets/validate-my-credentials.js: -------------------------------------------------------------------------------- 1 | const credentials = { username: 'foo', password: 'bar' }; 2 | 3 | try { 4 | await kuzzle.auth.login('local', credentials); 5 | 6 | const valid = await kuzzle.auth.validateMyCredentials('local', credentials); 7 | 8 | if (valid === true) { 9 | console.log('Credentials are valid'); 10 | } 11 | } catch (error) { 12 | console.error(error.message); 13 | } 14 | -------------------------------------------------------------------------------- /doc/7/controllers/bulk/delete-by-query/snippets/delete-by-query.js: -------------------------------------------------------------------------------- 1 | try { 2 | const deleted = await kuzzle.bulk.deleteByQuery( 3 | 'nyc-open-data', 4 | 'yellow-taxi', 5 | { 6 | query: { 7 | term: { capacity: 7 } 8 | } 9 | } 10 | ); 11 | 12 | console.log(`Successfully deleted ${deleted} documents`); 13 | } catch (error) { 14 | console.error(error.message); 15 | } -------------------------------------------------------------------------------- /doc/7/controllers/bulk/import/snippets/import.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: bulk#import 3 | description: Bulk imports three documents into Kuzzle 4 | hooks: 5 | before: | 6 | curl -X DELETE kuzzle:7512/nyc-open-data 7 | curl -X POST kuzzle:7512/nyc-open-data/_create 8 | curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi 9 | after: 10 | template: default 11 | expected: Successfully imported 3 documents 12 | -------------------------------------------------------------------------------- /doc/7/controllers/bulk/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: bulk 5 | description: bulk controller documentation 6 | --- 7 | -------------------------------------------------------------------------------- /doc/7/controllers/bulk/mWrite/snippets/mWrite.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: bulk#mWrite 3 | description: Creates or replaces multiple documents directly into the storage engine. 4 | hooks: 5 | before: | 6 | curl -X DELETE kuzzle:7512/nyc-open-data 7 | curl -X POST kuzzle:7512/nyc-open-data/_create 8 | curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi 9 | template: default 10 | expected: Document creator is dahi 11 | -------------------------------------------------------------------------------- /doc/7/controllers/bulk/update-by-query/snippets/update-by-query.js: -------------------------------------------------------------------------------- 1 | try { 2 | const result = await kuzzle.bulk.updateByQuery( 3 | 'nyc-open-data', 4 | 'yellow-taxi', 5 | { 6 | match: { 7 | capacity: 4 8 | } 9 | }, 10 | { capacity: 42 }); 11 | console.log(result); 12 | /** 13 | * 2 14 | */ 15 | } catch (error) { 16 | console.log(error.message); 17 | } 18 | -------------------------------------------------------------------------------- /doc/7/controllers/bulk/write/snippets/write.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: bulk#write 3 | description: Creates or replaces a document directly into the storage engine. 4 | hooks: 5 | before: | 6 | curl -X DELETE kuzzle:7512/nyc-open-data 7 | curl -X POST kuzzle:7512/nyc-open-data/_create 8 | curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi 9 | template: default 10 | expected: Document creator is liia 11 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/create/snippets/create.js: -------------------------------------------------------------------------------- 1 | const mappings = { 2 | properties: { 3 | license: { type: 'keyword' }, 4 | driver: { 5 | properties: { 6 | name: { type: 'keyword' }, 7 | curriculum: { type: 'text' } 8 | } 9 | } 10 | } 11 | }; 12 | 13 | try { 14 | await kuzzle.collection.create('nyc-open-data', 'yellow-taxi', { mappings }); 15 | 16 | console.log('Success'); 17 | } catch (error) { 18 | console.error(error.message); 19 | } 20 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/create/snippets/create.test.yml: -------------------------------------------------------------------------------- 1 | name: collection#create 2 | description: Create a new collection 3 | hooks: 4 | before: curl -X POST kuzzle:7512/nyc-open-data/_create 5 | after: 6 | template: default 7 | expected: Success 8 | 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/delete-specifications/snippets/delete-specifications.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.collection.deleteSpecifications('nyc-open-data', 'yellow-taxi'); 3 | 4 | console.log('Success'); 5 | } catch (error) { 6 | console.error(error.message); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/delete-specifications/snippets/delete-specifications.test.yml: -------------------------------------------------------------------------------- 1 | name: collection#deleteSpecifications 2 | description: Delete validation specifications for a collection 3 | hooks: 4 | before: curl -X POST kuzzle:7512/nyc-open-data/_create && curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi 5 | after: 6 | template: default 7 | expected: Success 8 | 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/delete/snippets/delete.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.collection.delete('nyc-open-data', 'yellow-taxi'); 3 | 4 | console.log('Success'); 5 | } catch (error) { 6 | console.error(error.message); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/delete/snippets/delete.test.yml: -------------------------------------------------------------------------------- 1 | name: collection#delete 2 | description: Delete a collection 3 | hooks: 4 | before: curl -X POST kuzzle:7512/nyc-open-data/_create && curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi 5 | after: 6 | template: default 7 | expected: Success 8 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/exists/snippets/exists.js: -------------------------------------------------------------------------------- 1 | try { 2 | const exists = await kuzzle.collection.exists('nyc-open-data', 'green-taxi'); 3 | 4 | if (exists) { 5 | console.log('Success'); 6 | } 7 | } catch (error) { 8 | console.error(error.message); 9 | } 10 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/exists/snippets/exists.test.yml: -------------------------------------------------------------------------------- 1 | name: collection#exists 2 | description: Check if collection exists 3 | hooks: 4 | before: curl -X POST kuzzle:7512/nyc-open-data/_create && curl -X PUT kuzzle:7512/nyc-open-data/green-taxi 5 | after: 6 | template: default 7 | expected: Success 8 | 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/get-mapping/snippets/get-mapping.test.yml: -------------------------------------------------------------------------------- 1 | name: collection#getMapping 2 | description: Return collection mapping 3 | hooks: 4 | before: curl -X POST kuzzle:7512/nyc-open-data/_create && curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi 5 | after: 6 | template: default 7 | expected: "true" 8 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: collection 5 | description: collection controller documentation 6 | --- 7 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/list/snippets/list.js: -------------------------------------------------------------------------------- 1 | try { 2 | const options = { from: 1, size: 1 }; 3 | 4 | const collectionList = await kuzzle.collection.list('mtp-open-data', options); 5 | console.log(collectionList); 6 | /* 7 | { 8 | type: 'all', 9 | collections: [ { name: 'pink-taxi', type: 'stored' } ], 10 | from: 1, 11 | size: 1 12 | } 13 | */ 14 | 15 | console.log('Success'); 16 | } catch (error) { 17 | console.error(error.message); 18 | } 19 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/list/snippets/list.test.yml: -------------------------------------------------------------------------------- 1 | name: collection#list 2 | description: Returns the collection list of an index 3 | hooks: 4 | before: curl -X POST kuzzle:7512/mtp-open-data/_create && curl -X PUT kuzzle:7512/mtp-open-data/pink-taxi && curl -X PUT kuzzle:7512/mtp-open-data/dark-taxi 5 | after: 6 | template: default 7 | expected: Success 8 | 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/refresh/snippets/refresh.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.collection.refresh('nyc-open-data', 'yellow-taxi'); 3 | 4 | console.log('Refresh successful'); 5 | } catch (error) { 6 | console.error(error.message); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/refresh/snippets/refresh.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: index#refresh 3 | description: Forces an Elasticsearch search index update 4 | hooks: 5 | before: | 6 | curl -X POST kuzzle:7512/nyc-open-data/_create 7 | curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: 9 | template: default 10 | expected: Refresh successful 11 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/truncate/snippets/truncate.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.collection.truncate('nyc-open-data', 'yellow-taxi'); 3 | 4 | console.log('Success'); 5 | } catch (error) { 6 | console.error(error.message); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/truncate/snippets/truncate.test.yml: -------------------------------------------------------------------------------- 1 | name: collection#truncate 2 | description: Remove all documents from collection 3 | hooks: 4 | before: curl -X POST kuzzle:7512/nyc-open-data/_create && curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi 5 | after: 6 | template: default 7 | expected: Success 8 | 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/update-mapping/snippets/update-mapping.js: -------------------------------------------------------------------------------- 1 | const mapping = { 2 | dynamic: 'false', 3 | _meta: { 4 | area: 'Panipokhari' 5 | }, 6 | properties: { 7 | plate: { type: 'keyword' } 8 | } 9 | }; 10 | 11 | try { 12 | await kuzzle.collection.updateMapping('nyc-open-data', 'yellow-taxi', mapping); 13 | 14 | console.log('Success'); 15 | } catch (error) { 16 | console.error(error.message); 17 | } 18 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/update-mapping/snippets/update-mapping.test.yml: -------------------------------------------------------------------------------- 1 | name: collection#updateMapping 2 | description: Update the collection mapping 3 | hooks: 4 | before: curl -X POST kuzzle:7512/nyc-open-data/_create && curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi 5 | after: 6 | template: default 7 | expected: Success 8 | 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/update/snippets/update.js: -------------------------------------------------------------------------------- 1 | const mappings = { 2 | dynamic: 'false', 3 | _meta: { 4 | area: 'Panipokhari' 5 | }, 6 | properties: { 7 | plate: { type: 'keyword' } 8 | } 9 | }; 10 | 11 | try { 12 | await kuzzle.collection.update('nyc-open-data', 'yellow-taxi', { mappings }); 13 | 14 | console.log('Success'); 15 | } catch (error) { 16 | console.error(error.message); 17 | } 18 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/update/snippets/update.test.yml: -------------------------------------------------------------------------------- 1 | name: collection#update 2 | description: Update the collection mapping 3 | hooks: 4 | before: curl -X POST kuzzle:7512/nyc-open-data/_create && curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi 5 | after: 6 | template: default 7 | expected: Success 8 | 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/collection/validate-specifications/snippets/validate-specifications.test.yml: -------------------------------------------------------------------------------- 1 | name: collection#validateSpecifications 2 | description: Validate specifications format 3 | hooks: 4 | before: curl -X POST kuzzle:7512/nyc-open-data/_create && curl -X PUT kuzzle:7512/nyc-open-data/green-taxi 5 | after: 6 | template: default 7 | expected: Some errors with provided specifications. 8 | 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/document/count/snippets/count.js: -------------------------------------------------------------------------------- 1 | try { 2 | const count = await kuzzle.document.count( 3 | 'nyc-open-data', 4 | 'yellow-taxi', 5 | { 6 | query: { 7 | match: { license: 'valid' } 8 | } 9 | } 10 | ); 11 | 12 | console.log(`Found ${count} documents matching license:valid`); 13 | } catch (error) { 14 | console.error(error.message); 15 | } 16 | -------------------------------------------------------------------------------- /doc/7/controllers/document/create-or-replace/snippets/create-or-replace.test.yml: -------------------------------------------------------------------------------- 1 | name: document#createOrReplace 2 | description: Creates or replaces a document 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: 9 | template: default 10 | expected: "_id: 'some-id'" -------------------------------------------------------------------------------- /doc/7/controllers/document/create/snippets/create.test.yml: -------------------------------------------------------------------------------- 1 | name: document#create 2 | description: Creates a new document 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: 9 | template: default 10 | expected: Success 11 | -------------------------------------------------------------------------------- /doc/7/controllers/document/delete-by-query/snippets/delete-by-query-es.js: -------------------------------------------------------------------------------- 1 | try { 2 | const deleted = await kuzzle.document.deleteByQuery( 3 | 'nyc-open-data', 4 | 'yellow-taxi', 5 | { 6 | query: { term: { capacity: 7 } } 7 | } 8 | ); 9 | 10 | console.log(`Successfully deleted ${deleted.length} documents`); 11 | } catch (error) { 12 | console.error(error.message); 13 | } -------------------------------------------------------------------------------- /doc/7/controllers/document/delete-by-query/snippets/delete-by-query-koncorde.js: -------------------------------------------------------------------------------- 1 | try { 2 | const deleted = await kuzzle.document.deleteByQuery( 3 | 'nyc-open-data', 4 | 'yellow-taxi', { 5 | query: { 6 | equals: { capacity: 7 } 7 | } 8 | }, { lang: 'koncorde' } 9 | ); 10 | 11 | console.log(`Successfully deleted ${deleted.length} documents`); 12 | } catch (error) { 13 | console.error(error.message); 14 | } 15 | -------------------------------------------------------------------------------- /doc/7/controllers/document/delete-fields/snippets/deleteFields.js: -------------------------------------------------------------------------------- 1 | try { 2 | const response = await kuzzle.document.deleteFields('nyc-open-data', 'yellow-taxi', 'some-id', ['bar'], {source: true}); 3 | 4 | console.log(response._source); 5 | } catch (error) { 6 | console.error(error.message); 7 | } -------------------------------------------------------------------------------- /doc/7/controllers/document/delete/snippets/delete.js: -------------------------------------------------------------------------------- 1 | try { 2 | const id = await kuzzle.document.delete('nyc-open-data', 'yellow-taxi', 'some-id'); 3 | 4 | if (id === 'some-id') { 5 | console.log('Success'); 6 | } 7 | } catch (error) { 8 | console.error(error.message); 9 | } -------------------------------------------------------------------------------- /doc/7/controllers/document/delete/snippets/delete.test.yml: -------------------------------------------------------------------------------- 1 | name: document#delete 2 | description: Deletes a document from kuzzle 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | curl --fail -H "Content-type: application/json" -XPUT -d '{}' kuzzle:7512/nyc-open-data/yellow-taxi/some-id 9 | after: 10 | template: default 11 | expected: Success 12 | -------------------------------------------------------------------------------- /doc/7/controllers/document/exists/snippets/exists.js: -------------------------------------------------------------------------------- 1 | try { 2 | const response = await kuzzle.document.exists('nyc-open-data', 'yellow-taxi', 'some-id'); 3 | 4 | console.log(response); 5 | } catch (error) { 6 | console.error(error.message); 7 | } -------------------------------------------------------------------------------- /doc/7/controllers/document/exists/snippets/exists.test.yml: -------------------------------------------------------------------------------- 1 | name: document#exists 2 | description: Check if a document exists in kuzzle 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | curl --fail -H "Content-type: application/json" -XPUT -d '{}' kuzzle:7512/nyc-open-data/yellow-taxi/some-id 9 | after: 10 | template: default 11 | expected: true 12 | -------------------------------------------------------------------------------- /doc/7/controllers/document/get/snippets/get.test.yml: -------------------------------------------------------------------------------- 1 | name: document#get 2 | description: Get a document from kuzzle 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: 9 | template: default 10 | expected: "_id: 'some-id'" 11 | -------------------------------------------------------------------------------- /doc/7/controllers/document/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: document 5 | description: Document controller 6 | --- 7 | 8 | # Document Controller 9 | -------------------------------------------------------------------------------- /doc/7/controllers/document/m-create-or-replace/snippets/m-create-or-replace.test.yml: -------------------------------------------------------------------------------- 1 | name: document#mCreateOrReplace 2 | description: Create or replace documents 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: 9 | template: default 10 | expected: Successfully createOrReplace 2 documents 11 | -------------------------------------------------------------------------------- /doc/7/controllers/document/m-create/snippets/m-create.test.yml: -------------------------------------------------------------------------------- 1 | name: document#mCreate 2 | description: Create multiple documents in kuzzle 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: 9 | template: default 10 | expected: Successfully created 2 documents -------------------------------------------------------------------------------- /doc/7/controllers/document/m-delete/snippets/m-delete.test.yml: -------------------------------------------------------------------------------- 1 | name: document#mDelete 2 | description: Delete documents 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: 9 | template: default 10 | expected: Successfully deleted 2 documents 11 | -------------------------------------------------------------------------------- /doc/7/controllers/document/m-get/snippets/m-get.test.yml: -------------------------------------------------------------------------------- 1 | name: document#mGet 2 | description: Get multiple documents 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: 9 | template: default 10 | expected: Successfully get 2 documents -------------------------------------------------------------------------------- /doc/7/controllers/document/m-replace/snippets/m-replace.test.yml: -------------------------------------------------------------------------------- 1 | name: document#mReplace 2 | description: Replace documents 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: 9 | template: default 10 | expected: Success -------------------------------------------------------------------------------- /doc/7/controllers/document/m-update/snippets/m-update.test.yml: -------------------------------------------------------------------------------- 1 | name: document#mUpdate 2 | description: Update documents 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: 9 | template: default 10 | expected: Success 11 | -------------------------------------------------------------------------------- /doc/7/controllers/document/m-upsert/snippets/m-upsert.test.yml: -------------------------------------------------------------------------------- 1 | name: document#mUpsert 2 | description: Update documents 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: 9 | template: default 10 | expected: Success 11 | -------------------------------------------------------------------------------- /doc/7/controllers/document/replace/snippets/replace.test.yml: -------------------------------------------------------------------------------- 1 | name: document#replace 2 | description: Replace a document 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: 9 | template: default 10 | expected: Success 11 | -------------------------------------------------------------------------------- /doc/7/controllers/document/search/snippets/search-es.test.yml: -------------------------------------------------------------------------------- 1 | name: document#search-with-es 2 | description: Search for documents 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: 9 | template: default 10 | expected: Successfully retrieved 5 documents 11 | -------------------------------------------------------------------------------- /doc/7/controllers/document/search/snippets/search-koncorde.test.yml: -------------------------------------------------------------------------------- 1 | name: document#search-with-koncorde 2 | description: Search for documents 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: 9 | template: default 10 | expected: Successfully retrieved 5 documents 11 | -------------------------------------------------------------------------------- /doc/7/controllers/document/update/snippets/update.test.yml: -------------------------------------------------------------------------------- 1 | name: document#update 2 | description: Update a document 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: 9 | template: default 10 | expected: "id: 'some-id'" 11 | -------------------------------------------------------------------------------- /doc/7/controllers/document/upsert/snippets/upsert.test.yml: -------------------------------------------------------------------------------- 1 | name: document#upsert 2 | description: Applies a partial update to an existing document. 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: 9 | template: default 10 | expected: "_id: 'some-id'" -------------------------------------------------------------------------------- /doc/7/controllers/document/validate/snippets/validate.js: -------------------------------------------------------------------------------- 1 | try { 2 | const valid = await kuzzle.document.validate( 3 | 'nyc-open-data', 4 | 'yellow-taxi', 5 | { capacity: 4 } 6 | ); 7 | 8 | if (valid) { 9 | console.log('Success'); 10 | } 11 | } catch (error) { 12 | console.error(error.message); 13 | } -------------------------------------------------------------------------------- /doc/7/controllers/document/validate/snippets/validate.test.yml: -------------------------------------------------------------------------------- 1 | name: document#validate 2 | description: Validate a document 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: 9 | template: default 10 | expected: Success -------------------------------------------------------------------------------- /doc/7/controllers/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: false 3 | type: branch 4 | order: 400 5 | title: Controllers 6 | description: Javascript SDK v7.x controllers 7 | --- 8 | 9 | 10 | -------------------------------------------------------------------------------- /doc/7/controllers/index/create/snippets/create.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.index.create('nyc-open-data'); 3 | 4 | console.log('Index created'); 5 | } catch (error) { 6 | console.error(error.message); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/controllers/index/create/snippets/create.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: index#create 3 | description: Creates a new index 4 | hooks: 5 | before: curl -X DELETE kuzzle:7512/nyc-open-data 6 | after: 7 | template: default 8 | expected: "Index created" 9 | -------------------------------------------------------------------------------- /doc/7/controllers/index/delete/snippets/delete.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.index.delete('nyc-open-data'); 3 | 4 | console.log('Index deleted'); 5 | } catch (error) { 6 | console.error(error.message); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/controllers/index/delete/snippets/delete.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: index#delete 3 | description: Delete an index 4 | hooks: 5 | before: curl -X POST kuzzle:7512/nyc-open-data/_create 6 | after: 7 | template: default 8 | expected: Index deleted 9 | 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/index/exists/snippets/exists.js: -------------------------------------------------------------------------------- 1 | try { 2 | const exists = await kuzzle.index.exists('nyc-open-data'); 3 | 4 | if (exists === true) { 5 | console.log('Index exists'); 6 | } else { 7 | console.log('Index does not exists'); 8 | } 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/index/exists/snippets/exists.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: index#exists 3 | description: Tests if an index exists 4 | hooks: 5 | before: | 6 | curl -X POST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: 9 | template: default 10 | expected: Index exists 11 | -------------------------------------------------------------------------------- /doc/7/controllers/index/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: index 5 | description: index controller documentation 6 | --- 7 | -------------------------------------------------------------------------------- /doc/7/controllers/index/list/snippets/list.js: -------------------------------------------------------------------------------- 1 | try { 2 | const indexes = await kuzzle.index.list(); 3 | console.log(indexes); 4 | /* 5 | [ 'nyc-open-data', 'mtp-open-data' ] 6 | */ 7 | 8 | console.log(`Kuzzle contains ${indexes.length} indexes`); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/index/m-delete/snippets/mDelete.js: -------------------------------------------------------------------------------- 1 | try { 2 | const indexes = await kuzzle.index.mDelete(['nyc-open-data', 'mtp-open-data']); 3 | console.log(indexes); 4 | /* 5 | [ 'nyc-open-data', 'mtp-open-data' ] 6 | */ 7 | 8 | console.log(`Successfully deleted ${indexes.length} indexes`); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/index/m-delete/snippets/mDelete.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: index#mDelete 3 | description: Delete multiple indexes 4 | hooks: 5 | before: | 6 | curl -X POST kuzzle:7512/nyc-open-data/_create 7 | curl -X POST kuzzle:7512/mtp-open-data/_create 8 | after: 9 | template: default 10 | expected: Successfully deleted 2 indexes 11 | 12 | sdk: js 13 | version: 7 14 | -------------------------------------------------------------------------------- /doc/7/controllers/index/stats/snippets/stats.js: -------------------------------------------------------------------------------- 1 | const stats = await kuzzle.index.stats(); 2 | 3 | console.log(JSON.stringify(stats)); 4 | /* 5 | { 6 | "indexes":[ 7 | { 8 | "name":"nyc-open-data", 9 | "size":42, 10 | "collections":[ 11 | { 12 | "name":"yellow-taxi", 13 | "documentCount":42, 14 | "size":42 15 | } 16 | ] 17 | } 18 | ], 19 | "size":42 20 | } 21 | */ 22 | -------------------------------------------------------------------------------- /doc/7/controllers/index/stats/snippets/stats.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: index#stats 3 | description: Gets detailed storage statistics 4 | hooks: 5 | before: | 6 | curl -X POST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: curl -X DELETE kuzzle:7512/nyc-open-data 9 | template: catch 10 | expected: ["documentCount":0] 11 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/append/snippets/append.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('hw', 'Hello'); 3 | 4 | await kuzzle.ms.append('hw', ' World'); 5 | 6 | // Prints: Hello World 7 | console.log(await kuzzle.ms.get('hw')); 8 | } catch (error) { 9 | console.error(error.message); 10 | } 11 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/append/snippets/append.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#append 2 | description: Appends a value to a key. If the key does not exist, it is created 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: Hello World 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/bitcount/snippets/bitcount.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('key', 'foobar'); 3 | 4 | // Prints: 26 5 | console.log(await kuzzle.ms.bitcount('key')); 6 | 7 | // Prints: 4 8 | console.log(await kuzzle.ms.bitcount('key', {start: 0, end: 0})); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/bitcount/snippets/bitcount.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#bitcount 2 | description: Counts the number of set bits (population counting) in a string 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - 26 9 | - 4 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/bitop/snippets/bitop.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('key1', 'foobar'); 3 | await kuzzle.ms.set('key2', 'abcdef'); 4 | 5 | await kuzzle.ms.bitop('dest', 'AND', ['key1', 'key2']); 6 | 7 | // Prints: `bc`ab 8 | console.log(await kuzzle.ms.get('dest')); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/bitop/snippets/bitop.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#bitop 2 | description: Performs a bitwise operation between multiple keys 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "`bc`ab" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/bitpos/snippets/bitpos.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('key', '\x00\x00\x01'); 3 | 4 | // Prints: 23 5 | console.log(await kuzzle.ms.bitpos('key', 1)); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/bitpos/snippets/bitpos.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#bitpos 2 | description: Returns the position of the first bit set to 1 or 0 in a string, or in a substring 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 23 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/dbsize/snippets/dbsize.js: -------------------------------------------------------------------------------- 1 | try { 2 | const size = await kuzzle.ms.dbsize(); 3 | console.log('Success'); 4 | } catch (error) { 5 | console.error(error.message); 6 | } 7 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/dbsize/snippets/dbsize.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#dbsize 2 | description: Returns the number of keys in the application database 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: Success 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/decr/snippets/decr.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('val', 43); 3 | 4 | // Prints: 42 5 | console.log(await kuzzle.ms.decr('val')); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/decr/snippets/decr.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#decr 2 | description: Decrements the number stored at `key` by 1 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 42 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/decrby/snippets/decrby.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('val', 12); 3 | 4 | // Prints: 42 5 | console.log(await kuzzle.ms.decrby('val', -30)); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/decrby/snippets/decrby.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#decrby 2 | description: Decrements the number stored at key by a provided integer value 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 42 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/del/snippets/del.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', 'bar'); 3 | 4 | // Prints: 1 5 | console.log(await kuzzle.ms.exists(['foo'])); 6 | 7 | await kuzzle.ms.del(['foo']); 8 | 9 | // Prints: 0 10 | console.log(await kuzzle.ms.exists(['foo'])); 11 | 12 | console.log('Success'); 13 | } catch (error) { 14 | console.error(error.message); 15 | } 16 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/del/snippets/del.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#del 2 | description: Deletes a list of keys 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 0 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/exists/snippets/exists.js: -------------------------------------------------------------------------------- 1 | try { 2 | // Prints: 0 3 | console.log(await kuzzle.ms.exists(['foo'])); 4 | 5 | await kuzzle.ms.set('foo', 'bar'); 6 | 7 | // Prints: 1 8 | console.log(await kuzzle.ms.exists(['foo'])); 9 | 10 | console.log('Success'); 11 | } catch (error) { 12 | console.error(error.message); 13 | } 14 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/exists/snippets/exists.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#exists 2 | description: Checks if the specified keys exist in the database 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^0$ 9 | - ^1$ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/expire/snippets/expire.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', 'bar'); 3 | 4 | // Prints: -1 5 | console.log(await kuzzle.ms.ttl('foo')); 6 | 7 | await kuzzle.ms.expire('foo', 10); 8 | 9 | // Prints: 10 10 | console.log(await kuzzle.ms.ttl('foo')); 11 | } catch (error) { 12 | console.error(error.message); 13 | } 14 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/expire/snippets/expire.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#expire 2 | description: Sets a timeout (in seconds) on a key 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - -1 9 | - ^[1-9]+ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/expireat/snippets/expireat.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', 'bar'); 3 | 4 | // Prints: 1 5 | console.log(await kuzzle.ms.exists(['foo'])); 6 | 7 | // Oct. 12, 2011 8 | await kuzzle.ms.expireat('foo', 1318425955); 9 | 10 | // Prints: 0 11 | console.log(await kuzzle.ms.exists(['foo'])); 12 | } catch (error) { 13 | console.error(error.message); 14 | } 15 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/expireat/snippets/expireat.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#expireat 2 | description: Sets an expiration timestamp on a key 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^1$ 9 | - ^0$ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/flushdb/snippets/flushdb.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.flushdb(); 3 | console.log('Success'); 4 | } catch (error) { 5 | console.error(error.message); 6 | } 7 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/flushdb/snippets/flushdb.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#flushdb 2 | description: Empties the database dedicated to client applications 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: Success 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/geoadd/snippets/geoadd.js: -------------------------------------------------------------------------------- 1 | const kuzzleHQ = { 2 | lon: 3.9109057, 3 | lat: 43.6073913, 4 | name: 'HQ' 5 | }; 6 | const otherHQ = { 7 | lon: 3.897105, 8 | lat: 43.6002203, 9 | name: 'other HQ' 10 | }; 11 | 12 | try { 13 | const result = await kuzzle.ms.geoadd('geofoo', [kuzzleHQ, otherHQ]); 14 | 15 | // Prints: 2 16 | console.log(result); 17 | } catch (error) { 18 | console.error(error.message); 19 | } 20 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/geoadd/snippets/geoadd.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#geoadd 2 | description: Adds geospatial points to the specified key 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 2 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/geodist/snippets/geodist.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#geodist 2 | description: Returns the distance between two geospatial members of a key 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - 1367.8521 9 | - 4487.7038 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/geohash/snippets/geohash.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#geohash 2 | description: Converts a key's geopoints into geohashes 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "[ 'spfb0frz6x0', 'spfb09jv9n0' ]" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/geopos/snippets/geopos.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#geopos 2 | description: Returns the positions of the provided key's members 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "\\[ 3.910904824733734, 43.607392252329916 ]," 9 | - "\\[ 3.8971075415611267, 43.600221526170145 ]" 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/get/snippets/get.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', 'bar'); 3 | 4 | // Prints: 'bar' 5 | console.log(await kuzzle.ms.get('foo')); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/get/snippets/get.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#get 2 | description: Gets the value of a key 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: bar 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/getbit/snippets/getbit.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', '\x01'); 3 | 4 | // Prints: 0 5 | console.log(await kuzzle.ms.getbit('foo', 2)); 6 | 7 | // Prints: 1 8 | console.log(await kuzzle.ms.getbit('foo', 7)); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/getbit/snippets/getbit.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#getbit 2 | description: Returns the bit value at the provided offset 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^0$ 9 | - ^1$ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/getrange/snippets/getrange.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', 'foobar'); 3 | 4 | // Prints: 'oba' 5 | console.log(await kuzzle.ms.getrange('foo', 2, 4)); 6 | 7 | // Prints: 'bar' 8 | console.log(await kuzzle.ms.getrange('foo', -3, -1)); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/getrange/snippets/getrange.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#getrange 2 | description: Returns a substring of a key's value 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^oba$ 9 | - ^bar$ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/getset/snippets/getset.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', 'bar'); 3 | 4 | // Prints: 'bar' 5 | console.log(await kuzzle.ms.getset('foo', 'qux')); 6 | 7 | // Prints: 'qux' 8 | console.log(await kuzzle.ms.get('foo')); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/getset/snippets/getset.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#getset 2 | description: Sets a new value for a key, and returns its previously stored value 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^bar$ 9 | - ^qux$ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hdel/snippets/hdel.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.hset('hashfoo', 'field1', 'val'); 3 | await kuzzle.ms.hset('hashfoo', 'field2', 'val'); 4 | 5 | // Prints: 2 6 | console.log(await kuzzle.ms.hlen('hashfoo')); 7 | 8 | await kuzzle.ms.hdel('hashfoo', ['field2']); 9 | 10 | // Prints: 1 11 | console.log(await kuzzle.ms.hlen('hashfoo')); 12 | } catch (error) { 13 | console.error(error.message); 14 | } 15 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hdel/snippets/hdel.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#hdel 2 | description: Removes fields from a hash 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^2$ 9 | - ^1$ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hexists/snippets/hexists.js: -------------------------------------------------------------------------------- 1 | try { 2 | // Prints: false 3 | console.log(await kuzzle.ms.hexists('hashfoo', 'foo')); 4 | 5 | await kuzzle.ms.hset('hashfoo', 'foo', 'bar'); 6 | 7 | // Prints: true 8 | console.log(await kuzzle.ms.hexists('hashfoo', 'foo')); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hexists/snippets/hexists.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#hexists 2 | description: Checks if a field exists in a hash 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^false$ 9 | - ^true$ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hget/snippets/hget.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.hset('hashfoo', 'foo', 'bar'); 3 | 4 | // Prints: 'bar' 5 | console.log(await kuzzle.ms.hget('hashfoo', 'foo')); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hget/snippets/hget.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#hget 2 | description: Returns the field's value of a hash 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^bar$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hgetall/snippets/hgetall.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.hset('hashfoo', 'field1', 'val1'); 3 | await kuzzle.ms.hset('hashfoo', 'field2', 'val2'); 4 | 5 | // Prints: { field1: 'val1', field2: 'val2' } 6 | console.log(await kuzzle.ms.hgetall('hashfoo')); 7 | } catch (error) { 8 | console.error(error.message); 9 | } 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hgetall/snippets/hgetall.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#hgetall 2 | description: Returns all fields and values of a hash 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "{ field1: 'val1', field2: 'val2' }" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hincrby/snippets/hincrby.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.hset('hashfoo', 'answer', 100); 3 | 4 | // Prints: 42 5 | console.log(await kuzzle.ms.hincrby('hashfoo', 'answer', -58)); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hincrby/snippets/hincrby.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#hincrby 2 | description: Increments the number stored in a hash field by the provided integer value 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^42$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hincrbyfloat/snippets/hincrbyfloat.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.hset('hashfoo', 'almost_pi', 3); 3 | 4 | // Prints: 3.14159 5 | console.log(await kuzzle.ms.hincrbyfloat('hashfoo', 'almost_pi', 0.14159)); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hincrbyfloat/snippets/hincrbyfloat.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#hincrbyfloat 2 | description: Increments the number stored in a hash field by the provided float value 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^3.14159$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hkeys/snippets/hkeys.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.hset('hashfoo', 'never', 'foo'); 3 | await kuzzle.ms.hset('hashfoo', 'gonna', 'bar'); 4 | await kuzzle.ms.hset('hashfoo', 'give you up', 'baz'); 5 | 6 | // Prints: ['never', 'gonna', 'give you up'] 7 | console.log(await kuzzle.ms.hkeys('hashfoo')); 8 | } catch (error) { 9 | console.error(error.message); 10 | } 11 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hkeys/snippets/hkeys.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#hkeys 2 | description: Returns all field names contained in a hash 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: \[ 'never', 'gonna', 'give you up' ] 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hlen/snippets/hlen.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.hset('hashfoo', 'key1', 'val1'); 3 | await kuzzle.ms.hset('hashfoo', 'key2', 'val2'); 4 | await kuzzle.ms.hset('hashfoo', 'key3', 'val3'); 5 | 6 | // Prints: 3 7 | console.log(await kuzzle.ms.hlen('hashfoo')); 8 | } catch (error) { 9 | console.error(error.message); 10 | } 11 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hlen/snippets/hlen.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#hlen 2 | description: Returns the number of fields contained in a hash 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^3$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hmget/snippets/hmget.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.hset('hashfoo', 'key1', 'val1'); 3 | await kuzzle.ms.hset('hashfoo', 'key2', 'val2'); 4 | await kuzzle.ms.hset('hashfoo', 'key3', 'val3'); 5 | 6 | // Prints: [ 'val3', 'val1' ] 7 | console.log(await kuzzle.ms.hmget('hashfoo', ['key3', 'key1'])); 8 | 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hmget/snippets/hmget.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#hmget 2 | description: Returns the values of the specified hash's fields 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: \[ 'val3', 'val1' ] 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hmset/snippets/hmset.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.hmset( 3 | 'hashfoo', 4 | [ 5 | {field: 'key1', value: 'val1'}, 6 | {field: 'key2', value: 'val2'}, 7 | {field: 'key3', value: 'val3'} 8 | ] 9 | ); 10 | 11 | // Prints: { key1: 'val1', key2: 'val2', key3: 'val3' } 12 | console.log(await kuzzle.ms.hgetall('hashfoo')); 13 | } catch (error) { 14 | console.error(error.message); 15 | } 16 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hmset/snippets/hmset.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#hmset 2 | description: Sets multiple fields at once in a hash 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: { key1: 'val1', key2: 'val2', key3: 'val3' } 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hscan/snippets/hscan.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.hset('hashfoo', 'key1', 'val1'); 3 | await kuzzle.ms.hset('hashfoo', 'key2', 'val2'); 4 | await kuzzle.ms.hset('hashfoo', 'key3', 'val3'); 5 | 6 | // Prints: 7 | // { 8 | // cursor: '0', 9 | // values: [ 'key1', 'val1', 'key2', 'val2', 'key3', 'val3' ] 10 | // } 11 | console.log(await kuzzle.ms.hscan('hashfoo', 0)); 12 | } catch (error) { 13 | console.error(error.message); 14 | } 15 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hscan/snippets/hscan.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#hscan 2 | description: Iterates incrementally over fields contained in a hash, using a cursor 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "{" 9 | - "cursor: '0'," 10 | - "values: \\[ 'key1', 'val1', 'key2', 'val2', 'key3', 'val3' ]" 11 | - "}" 12 | sdk: js 13 | version: 7 14 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hset/snippets/hset.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.hset('hashfoo', 'foo', 'bar'); 3 | 4 | // Prints: { foo: 'bar' } 5 | console.log(await kuzzle.ms.hgetall('hashfoo')); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hset/snippets/hset.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#hset 2 | description: Sets a field and its value in a hash 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "{ foo: 'bar' }" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hsetnx/snippets/hsetnx.js: -------------------------------------------------------------------------------- 1 | try { 2 | // Prints: true 3 | console.log(await kuzzle.ms.hsetnx('hashfoo', 'foo', 'bar')); 4 | 5 | // Prints: false 6 | console.log(await kuzzle.ms.hsetnx('hashfoo', 'foo', 'qux')); 7 | 8 | // Prints: bar 9 | console.log(await kuzzle.ms.hget('hashfoo', 'foo')); 10 | 11 | } catch (error) { 12 | console.error(error.message); 13 | } 14 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hsetnx/snippets/hsetnx.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#hsetnx 2 | description: Sets a field and its value in a hash, only if the field does not already exist 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^true$ 9 | - ^false$ 10 | - ^bar$ 11 | sdk: js 12 | version: 7 13 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hstrlen/snippets/hstrlen.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.hset('hashfoo', 'foo', 'bar'); 3 | 4 | // Prints: 3 5 | console.log(await kuzzle.ms.hstrlen('hashfoo', 'foo')); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hstrlen/snippets/hstrlen.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#hstrlen 2 | description: Returns the string length of a field's value in a hash 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^3$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hvals/snippets/hvals.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.hset('hashfoo', 'key1', 'val1'); 3 | await kuzzle.ms.hset('hashfoo', 'key2', 'val2'); 4 | await kuzzle.ms.hset('hashfoo', 'key3', 'val3'); 5 | 6 | // Prints: [ 'val1', 'val2', 'val3' ] 7 | console.log(await kuzzle.ms.hvals('hashfoo')); 8 | } catch (error) { 9 | console.error(error.message); 10 | } 11 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/hvals/snippets/hvals.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#hvals 2 | description: Returns all values contained in a hash 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "\\[ 'val1', 'val2', 'val3' ]" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/incr/snippets/incr.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', 41); 3 | 4 | // Prints: 42 5 | console.log(await kuzzle.ms.incr('foo')); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/incr/snippets/incr.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#incr 2 | description: Increments the number stored at key by 1 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^42$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/incrby/snippets/incrby.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', 100); 3 | 4 | // Prints: 42 5 | console.log(await kuzzle.ms.incrby('foo', -58)); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/incrby/snippets/incrby.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#incrby 2 | description: Increments the number stored at `key` by the provided integer value 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^42$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/incrbyfloat/snippets/incrbyfloat.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('almost pi', 3); 3 | 4 | // Prints: 3.14159 5 | console.log(await kuzzle.ms.incrbyfloat('almost pi', 0.14159)); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/incrbyfloat/snippets/incrbyfloat.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#incrbyfloat 2 | description: Increments the number stored at key by the provided float value 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^3.14159$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: ms 5 | description: memory storage controller documentation 6 | --- 7 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/keys/snippets/keys.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', 'bar'); 3 | await kuzzle.ms.set('Suddenly', 'Bananas'); 4 | await kuzzle.ms.set('Hello', 'World'); 5 | 6 | // Prints: [ 'foo', 'Hello' ] 7 | console.log(await kuzzle.ms.keys('*o')); 8 | } catch (error) { 9 | console.error(error.message); 10 | } 11 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/keys/snippets/keys.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#keys 2 | description: Returns all keys matching the provided pattern 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "\\[ '(Hello|foo)', '(Hello|foo)' ]" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/lindex/snippets/lindex.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.rpush('listfoo', ['foo', 'bar', 'baz']); 3 | 4 | // Prints: bar 5 | console.log(await kuzzle.ms.lindex('listfoo', 1)); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/lindex/snippets/lindex.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#lindex 2 | description: Returns the element at the provided index in a list 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^bar$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/linsert/snippets/linsert.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.rpush('listfoo', ['foo', 'bar', 'baz']); 3 | 4 | await kuzzle.ms.linsert('listfoo', 'before', 'bar', 'qux'); 5 | 6 | // Prints: [ 'foo', 'qux', 'bar', 'baz' ] 7 | console.log(await kuzzle.ms.lrange('listfoo', 0, -1)); 8 | } catch (error) { 9 | console.error(error.message); 10 | } 11 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/linsert/snippets/linsert.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#linsert 2 | description: Inserts a value in a list, either before or after a pivot value 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "\\[ 'foo', 'qux', 'bar', 'baz' ]" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/llen/snippets/llen.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.rpush('listfoo', ['foo', 'bar', 'baz']); 3 | 4 | // Prints: 3 5 | console.log(await kuzzle.ms.llen('listfoo')); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/llen/snippets/llen.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#llen 2 | description: Returns the length of a list 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^3$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/lpop/snippets/lpop.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.rpush('listfoo', ['foo', 'bar', 'baz']); 3 | 4 | // Prints: foo 5 | console.log(await kuzzle.ms.lpop('listfoo')); 6 | 7 | // Prints: [ 'bar', 'baz' ] 8 | console.log(await kuzzle.ms.lrange('listfoo', 0, -1)); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/lpop/snippets/lpop.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#lpop 2 | description: Removes and returns the first element of a list 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^foo$ 9 | - "\\[ 'bar', 'baz' ]" 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/lpush/snippets/lpush.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.rpush('listfoo', ['foobar']); 3 | 4 | // Prints: 3 5 | console.log(await kuzzle.ms.lpush('listfoo', ['World', 'Hello'])); 6 | 7 | // Prints: [ 'Hello', 'World', 'foobar' ] 8 | console.log(await kuzzle.ms.lrange('listfoo', 0, -1)); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/lpush/snippets/lpush.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#lpush 2 | description: Prepends the specified values to a list 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^3$ 9 | - "\\[ 'Hello', 'World', 'foobar' ]" 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/lpushx/snippets/lpushx.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#lpushx 2 | description: Prepends the specified value to an existing list 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^0$ 9 | - "\\[]" 10 | - ^2$ 11 | - "\\[ 'foo', 'bar' ]" 12 | sdk: js 13 | version: 7 14 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/lrange/snippets/lrange.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.rpush('listfoo', ['a', 'b', 'c', 'd', 'e', 'f']); 3 | 4 | // Prints: [ 'b', 'c', 'd' ] 5 | console.log(await kuzzle.ms.lrange('listfoo', 1, 3)); 6 | 7 | // Prints: [ d', 'e' ] 8 | console.log(await kuzzle.ms.lrange('listfoo', 3, -2)); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/lrange/snippets/lrange.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#lrange 2 | description: Returns the list elements between the start and stop positions 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "\\[ 'b', 'c', 'd' ]" 9 | - "\\[ 'd', 'e' ]" 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/lrem/snippets/lrem.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.rpush('listfoo', ['foo', 'bar', 'foo', 'baz', 'foo']); 3 | 4 | // Prints: 2 5 | console.log(await kuzzle.ms.lrem('listfoo', 2, 'foo')); 6 | 7 | // Prints: [ 'bar', 'baz', 'foo' ] 8 | console.log(await kuzzle.ms.lrange('listfoo', 0, -1)); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/lrem/snippets/lrem.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#lrem 2 | description: Removes the first occurences of an element from a list 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^2$ 9 | - "\\[ 'bar', 'baz', 'foo' ]" 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/lset/snippets/lset.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.rpush('listfoo', ['qux', 'bar', 'baz']); 3 | 4 | await kuzzle.ms.lset('listfoo', 0, 'foo'); 5 | 6 | // Prints: [ 'foo', 'bar', 'baz' ] 7 | console.log(await kuzzle.ms.lrange('listfoo', 0, -1)); 8 | } catch (error) { 9 | console.error(error.message); 10 | } 11 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/lset/snippets/lset.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#lset 2 | description: Sets the list element at index with the provided value 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "\\[ 'foo', 'bar', 'baz' ]" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/ltrim/snippets/ltrim.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.rpush('listfoo', ['a', 'b', 'c', 'd', 'e', 'f']); 3 | 4 | await kuzzle.ms.ltrim('listfoo', 3, -2); 5 | 6 | // Prints [ 'd', 'e' ] 7 | console.log(await kuzzle.ms.lrange('listfoo', 0, -1)); 8 | } catch (error) { 9 | console.error(error.message); 10 | } 11 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/ltrim/snippets/ltrim.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#ltrim 2 | description: Trims an existing list 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "\\[ 'd', 'e' ]" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/mexecute/snippets/mexecute.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#mexecute 2 | description: Executes multiple commands in a single step 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "\\[ \\[ null, 'OK' ], \\[ null, '1' ], \\[ null, 1 ] ]" 8 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/mget/snippets/mget.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', 'bar'); 3 | await kuzzle.ms.set('hello', 'world'); 4 | 5 | // Prints: [ 'world', 'bar' ] 6 | console.log(await kuzzle.ms.mget(['hello', 'foo'])); 7 | } catch (error) { 8 | console.error(error.message); 9 | } 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/mget/snippets/mget.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#mget 2 | description: Returns the values of the provided keys 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "\\[ 'world', 'bar' ]" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/mset/snippets/mset.js: -------------------------------------------------------------------------------- 1 | try { 2 | // Prints: 0 3 | console.log(await kuzzle.ms.exists(['key1', 'key2', 'key3'])); 4 | 5 | await kuzzle.ms.mset([ 6 | { key: 'key1', value: 'val1' }, 7 | { key: 'key2', value: 'val2' }, 8 | { key: 'key3', value: 'val3' } 9 | ]); 10 | 11 | // Prints: 3 12 | console.log(await kuzzle.ms.exists(['key1', 'key2', 'key3'])); 13 | } catch (error) { 14 | console.error(error.message); 15 | } 16 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/mset/snippets/mset.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#mset 2 | description: Sets the provided keys to their respective values 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^0$ 9 | - ^3$ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/msetnx/snippets/msetnx.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#msetnx 2 | description: Sets the provided keys to their respective values, only if they do not exist 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^false$ 9 | - ^true$ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/object/snippets/object.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.sadd('foo', ['bar', 'baz']); 3 | 4 | // Prints: hashtable 5 | console.log(await kuzzle.ms.object('foo', 'encoding')); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/object/snippets/object.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#object 2 | description: Inspects the low-level properties of a key 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^hashtable$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/persist/snippets/persist.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.setex('foo', 'bar', 60); 3 | 4 | // Prints: 60 5 | console.log(await kuzzle.ms.ttl('foo')); 6 | 7 | await kuzzle.ms.persist('foo'); 8 | 9 | // Prints: -1 10 | console.log(await kuzzle.ms.ttl('foo')); 11 | } catch (error) { 12 | console.error(error.message); 13 | } 14 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/persist/snippets/persist.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#persist 2 | description: Removes the expiration delay or timestamp from a key, making it persistent 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^[0-9]+$ 9 | - "-1" 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/pexpire/snippets/pexpire.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', 'bar'); 3 | 4 | // Prints: -1 5 | console.log(await kuzzle.ms.ttl('foo')); 6 | 7 | await kuzzle.ms.pexpire('foo', 60000); 8 | 9 | // Prints: 60 10 | console.log(await kuzzle.ms.ttl('foo')); 11 | } catch (error) { 12 | console.error(error.message); 13 | } 14 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/pexpire/snippets/pexpire.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#pexpire 2 | description: Sets a timeout (in milliseconds) on a key 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^-1$ 9 | - ^[0-9]{1,2}$ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/pexpireat/snippets/pexpireat.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', 'bar'); 3 | 4 | // Prints: 1 5 | console.log(await kuzzle.ms.exists(['foo'])); 6 | 7 | // Oct. 12, 2011 8 | await kuzzle.ms.pexpireat('foo', 1318425955000); 9 | 10 | // Prints: 0 11 | console.log(await kuzzle.ms.exists(['foo'])); 12 | } catch (error) { 13 | console.error(error.message); 14 | } 15 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/pexpireat/snippets/pexpireat.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#pexpireat 2 | description: Sets an expiration timestamp on a key 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^1$ 9 | - ^0$ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/pfadd/snippets/pfadd.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.pfadd('hllfoo', ['foo', 'bar', 'baz', 'qux']); 3 | 4 | // Prints: 4 5 | console.log(await kuzzle.ms.pfcount('hllfoo')); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/pfadd/snippets/pfadd.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#pfadd 2 | description: Adds elements to a HyperLogLog data structure 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^4$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/pfcount/snippets/pfcount.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.pfadd('hllfoo', ['foo', 'bar', 'baz']); 3 | await kuzzle.ms.pfadd('hllfoo2', ['hello', 'world', 'foo']); 4 | 5 | // Prints: 5 6 | console.log(await kuzzle.ms.pfcount(['hllfoo', 'hllfoo2'])); 7 | } catch (error) { 8 | console.error(error.message); 9 | } 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/pfcount/snippets/pfcount.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#pfcount 2 | description: Returns the probabilistic cardinality of a HyperLogLog data structure 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^5$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/pfmerge/snippets/pfmerge.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.pfadd('hllfoo', ['foo', 'bar', 'baz']); 3 | await kuzzle.ms.pfadd('hllfoo2', ['hello', 'world', 'foo']); 4 | 5 | await kuzzle.ms.pfmerge('hllmerged', ['hllfoo', 'hllfoo2']); 6 | 7 | // Prints: 5 8 | console.log(await kuzzle.ms.pfcount(['hllmerged'])); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/pfmerge/snippets/pfmerge.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#pfmerge 2 | description: Merges multiple HyperLogLog data structures 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^5$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/ping/snippets/ping.js: -------------------------------------------------------------------------------- 1 | try { 2 | // Prints: PONG 3 | console.log(await kuzzle.ms.ping()); 4 | } catch (error) { 5 | console.error(error.message); 6 | } 7 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/ping/snippets/ping.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#ping 2 | description: Pings the memory storage database 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^PONG$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/psetex/snippets/psetex.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.psetex('foo', 'bar', 60000); 3 | 4 | // Prints: 60 5 | console.log(await kuzzle.ms.ttl('foo')); 6 | 7 | // Prints: bar 8 | console.log(await kuzzle.ms.get('foo')); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/psetex/snippets/psetex.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#psetex 2 | description: Sets a key with the provided value, and an expiration delay expressed in milliseconds 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^[0-9]{1,2}$ 9 | - ^bar$ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/pttl/snippets/pttl.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.psetex('foo', 'bar', 60000); 3 | 4 | // Prints: 60000 5 | console.log(await kuzzle.ms.pttl('foo')); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/pttl/snippets/pttl.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#pttl 2 | description: Returns the remaining time to live of a key, in milliseconds 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^[0-9]+$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/randomkey/snippets/randomkey.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', 'val'); 3 | await kuzzle.ms.set('bar', 'val'); 4 | await kuzzle.ms.set('baz', 'val'); 5 | 6 | // Prints one of the following: foo, bar or baz 7 | console.log(await kuzzle.ms.randomkey()); 8 | } catch (error) { 9 | console.error(error.message); 10 | } 11 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/randomkey/snippets/randomkey.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#randomkey 2 | description: Returns a key identifier from the memory storage, at random 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^(foo|bar|baz)$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/rename/snippets/rename.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', 'World'); 3 | 4 | await kuzzle.ms.rename('foo', 'Hello'); 5 | 6 | // Prints: World 7 | console.log(await kuzzle.ms.get('Hello')); 8 | } catch (error) { 9 | console.error(error.message); 10 | } 11 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/rename/snippets/rename.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#rename 2 | description: Renames a key 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^World$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/renamenx/snippets/renamenx.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', 'val'); 3 | await kuzzle.ms.set('bar', 'val'); 4 | 5 | // Prints: false 6 | // (the key "bar" already exists) 7 | console.log(await kuzzle.ms.renamenx('foo', 'bar')); 8 | 9 | // Prints: true 10 | console.log(await kuzzle.ms.renamenx('foo', 'qux')); 11 | } catch (error) { 12 | console.error(error.message); 13 | } 14 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/renamenx/snippets/renamenx.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#renamenx 2 | description: Renames a key, only if the new name is not already used 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^false$ 9 | - ^true$ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/rpop/snippets/rpop.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.rpush('listfoo', ['foo', 'bar', 'baz']); 3 | 4 | // Prints: 'baz' 5 | console.log(await kuzzle.ms.rpop('listfoo')); 6 | 7 | // Prints: [ 'foo', 'bar' ] 8 | console.log(await kuzzle.ms.lrange('listfoo', 0, -1)); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/rpop/snippets/rpop.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#rpop 2 | description: Removes the last element of a list and returns it 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^baz$ 9 | - "\\[ 'foo', 'bar' ]" 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/rpoplpush/snippets/rpoplpush.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.rpush('foo', ['rick', 'astley', 'never']); 3 | await kuzzle.ms.rpush('bar', ['gonna', 'give', 'you', 'up']); 4 | 5 | // Prints: never 6 | console.log(await kuzzle.ms.rpoplpush('foo', 'bar')); 7 | 8 | // Prints: [ 'never', 'gonna', 'give', 'you', 'up' ] 9 | console.log(await kuzzle.ms.lrange('bar', 0, -1)); 10 | } catch (error) { 11 | console.error(error.message); 12 | } 13 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/rpoplpush/snippets/rpoplpush.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#rpoplpush 2 | description: Removes the last element of a list, and pushes it back at the start of another list 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^never$ 9 | - "\\[ 'never', 'gonna', 'give', 'you', 'up' ]" 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/rpush/snippets/rpush.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.rpush('listfoo', ['foo', 'bar', 'baz']); 3 | 4 | // Prints: [ 'foo', 'bar', 'baz' ] 5 | console.log(await kuzzle.ms.lrange('listfoo', 0, -1)); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/rpush/snippets/rpush.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#rpush 2 | description: Appends values at the end of a list 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "\\[ 'foo', 'bar', 'baz' ]" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/rpushx/snippets/rpushx.js: -------------------------------------------------------------------------------- 1 | try { 2 | // Prints: 0 3 | // ("listfoo" does not exist: the operation fails) 4 | console.log(await kuzzle.ms.rpushx('listfoo', 'qux')); 5 | 6 | await kuzzle.ms.rpush('listfoo', ['foo', 'bar', 'baz']); 7 | 8 | // Prints: 4 9 | console.log(await kuzzle.ms.rpushx('listfoo', 'qux')); 10 | } catch (error) { 11 | console.error(error.message); 12 | } 13 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/rpushx/snippets/rpushx.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#rpushx 2 | description: Appends a value at the end of an existing list 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^0$ 9 | - ^4$ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/sadd/snippets/sadd.js: -------------------------------------------------------------------------------- 1 | try { 2 | // Prints: 2 3 | console.log(await kuzzle.ms.sadd('setfoo', ['foo', 'bar'])); 4 | 5 | // Prints: 1 6 | console.log(await kuzzle.ms.sadd('setfoo', ['foo', 'bar', 'baz'])); 7 | 8 | // Prints: [ 'foo', 'bar', 'baz' ] 9 | console.log(await kuzzle.ms.smembers('setfoo')); 10 | } catch (error) { 11 | console.error(error.message); 12 | } 13 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/sadd/snippets/sadd.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#sadd 2 | description: Adds members to a set of unique values stored at key 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^2$ 9 | - ^1$ 10 | - "\\[ '(foo|bar|baz)', '(foo|bar|baz)', '(foo|bar|baz)' ]" 11 | sdk: js 12 | version: 7 13 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/scan/snippets/scan.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('key1', 'val1'); 3 | await kuzzle.ms.set('key2', 'val2'); 4 | await kuzzle.ms.set('key3', 'val3'); 5 | 6 | // Prints: 7 | // { 8 | // cursor: '0', 9 | // values: [ 'key1', 'key2', 'key3' ] 10 | // } 11 | console.log(await kuzzle.ms.scan(0)); 12 | } catch (error) { 13 | console.error(error.message); 14 | } 15 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/scan/snippets/scan.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#scan 2 | description: Iterates incrementally over the set of keys in the database using a cursor 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "{ cursor: '0', values: \\[ 'key[123]', 'key[123]', 'key[123]' ] }" 9 | 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/scard/snippets/scard.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.sadd('setfoo', ['foo', 'foo', 'bar', 'baz']); 3 | 4 | // Prints: 3 5 | console.log(await kuzzle.ms.scard('setfoo')); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/scard/snippets/scard.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#scard 2 | description: Returns the number of members stored in a set of unique values 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^3$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/sdiff/snippets/sdiff.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.sadd('ref', ['foo', 'bar', 'baz']); 3 | 4 | await kuzzle.ms.sadd('set1', ['foo', 'hello']); 5 | await kuzzle.ms.sadd('set2', ['bar', 'world']); 6 | 7 | // Prints: [ 'baz' ] 8 | console.log(await kuzzle.ms.sdiff('ref', ['set1', 'set2'])); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/sdiff/snippets/sdiff.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#sdiff 2 | description: Returns the difference between a reference set and a list of other sets 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "\\[ 'baz' ]" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/sdiffstore/snippets/sdiffstore.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.sadd('ref', ['foo', 'bar', 'baz']); 3 | 4 | await kuzzle.ms.sadd('set1', ['foo', 'hello']); 5 | await kuzzle.ms.sadd('set2', ['bar', 'world']); 6 | 7 | await kuzzle.ms.sdiffstore('ref', ['set1', 'set2'], 'diffs'); 8 | 9 | // Prints: [ 'baz' ] 10 | console.log(await kuzzle.ms.smembers('diffs')); 11 | } catch (error) { 12 | console.error(error.message); 13 | } 14 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/sdiffstore/snippets/sdiffstore.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#sdiffstore 2 | description: Stores the difference between a reference set and a list of other sets in a new key 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "\\[ 'baz' ]" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/set/snippets/set.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', 'bar'); 3 | 4 | // Prints: bar 5 | console.log(await kuzzle.ms.get('foo')); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/set/snippets/set.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#set 2 | description: Creates a key holding the provided value, or overwrites it if it already exists 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^bar$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/setex/snippets/setex.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.setex('foo', 'bar', 60); 3 | 4 | // Prints: 60 5 | console.log(await kuzzle.ms.ttl('foo')); 6 | 7 | // Prints: bar 8 | console.log(await kuzzle.ms.get('foo')); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/setex/snippets/setex.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#setex 2 | description: Sets a value and a time to live (in seconds) on a key 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^[0-9]{1,2}$ 9 | - ^bar$ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/setnx/snippets/setnx.js: -------------------------------------------------------------------------------- 1 | try { 2 | // Prints: true 3 | console.log(await kuzzle.ms.setnx('foo', 'bar')); 4 | 5 | // Prints: false 6 | console.log(await kuzzle.ms.setnx('foo', 'qux')); 7 | 8 | // Prints: bar 9 | console.log(await kuzzle.ms.get('foo')); 10 | } catch (error) { 11 | console.error(error.message); 12 | } 13 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/setnx/snippets/setnx.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#setnx 2 | description: Sets a value on a key, only if it does not already exist 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^true$ 9 | - ^false$ 10 | - ^bar$ 11 | sdk: js 12 | version: 7 13 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/sinter/snippets/sinter.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.sadd('set1', ['foo', 'bar', 'hello']); 3 | await kuzzle.ms.sadd('set2', ['world', 'baz', 'foo']); 4 | 5 | // Prints: [ 'foo' ] 6 | console.log(await kuzzle.ms.sinter(['set1', 'set2'])); 7 | } catch (error) { 8 | console.error(error.message); 9 | } 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/sinter/snippets/sinter.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#sinter 2 | description: Returns the intersection of the provided sets of unique values 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "\\[ 'foo' ]" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/sinterstore/snippets/sinterstore.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.sadd('set1', ['foo', 'bar', 'hello']); 3 | await kuzzle.ms.sadd('set2', ['world', 'baz', 'foo']); 4 | 5 | // Prints: 1 6 | console.log(await kuzzle.ms.sinterstore('dest', ['set1', 'set2'])); 7 | 8 | // Prints: [ 'foo' ] 9 | console.log(await kuzzle.ms.smembers('dest')); 10 | } catch (error) { 11 | console.error(error.message); 12 | } 13 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/sinterstore/snippets/sinterstore.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#sinterstore 2 | description: Stores the intersection of the provided sets of unique values 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^1$ 9 | - "\\[ 'foo' ]" 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/sismember/snippets/sismember.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.sadd('setfoo', ['foo', 'bar', 'baz']); 3 | 4 | // Prints: true 5 | console.log(await kuzzle.ms.sismember('setfoo', 'bar')); 6 | 7 | // Prints: false 8 | console.log(await kuzzle.ms.sismember('setfoo', 'qux')); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/sismember/snippets/sismember.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#sismember 2 | description: Checks if a value is a member of a set of unique values. 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^true$ 9 | - ^false$ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/smembers/snippets/smembers.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.sadd('listfoo', ['foo', 'bar', 'baz']); 3 | 4 | // Prints: [ 'foo', 'bar', 'baz' ] 5 | console.log(await kuzzle.ms.smembers('listfoo')); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/smembers/snippets/smembers.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#smembers 2 | description: Returns the members of a set of unique values 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "\\[ '(foo|bar|baz)', '(foo|bar|baz)', '(foo|bar|baz)' ]" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/smove/snippets/smove.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.sadd('set1', ['foo', 'bar', 'baz']); 3 | await kuzzle.ms.sadd('set2', ['qux']); 4 | 5 | await kuzzle.ms.smove('set1', 'set2', 'foo'); 6 | 7 | // Prints: [ 'bar', 'baz' ] 8 | console.log(await kuzzle.ms.smembers('set1')); 9 | 10 | // Prints: [ 'foo', 'qux' ] 11 | console.log(await kuzzle.ms.smembers('set2')); 12 | } catch (error) { 13 | console.error(error.message); 14 | } 15 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/smove/snippets/smove.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#smove 2 | description: Moves a member from a set of unique values to another 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "\\[ '(bar|baz)', '(bar|baz)' ]" 9 | - "\\[ '(foo|qux)', '(foo|qux)' ]" 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/sort/snippets/sort.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.sadd('setfoo', [1, 2, 3, 4, 5, 6, 7]); 3 | await kuzzle.ms.rpush('listfoo', ['foo', 'bar', 'baz', 'qux']); 4 | 5 | // Prints: [ '7', '6', '5', '4', '3', '2', '1' ] 6 | console.log(await kuzzle.ms.sort('setfoo', {direction: 'DESC'})); 7 | 8 | // Prints: [ 'bar', 'baz', 'foo', 'qux' ] 9 | console.log(await kuzzle.ms.sort('listfoo', {alpha: true})); 10 | } catch (error) { 11 | console.error(error.message); 12 | } 13 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/sort/snippets/sort.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#sort 2 | description: Sorts and returns elements contained in a list, a set or a sorted set 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "\\[" 9 | - "'7', '6', '5'," 10 | - "'4', '3', '2'," 11 | - "'1'" 12 | - "]" 13 | - "\\[ 'bar', 'baz', 'foo', 'qux' ]" 14 | sdk: js 15 | version: 7 16 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/spop/snippets/spop.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#spop 2 | description: Removes one or more elements at random from a set of unique values 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "^\\[ '[a-f]' ]" 9 | - "^\\[ '[a-f]', '[a-f]', '[a-f]' ]" 10 | - ^2$ 11 | sdk: js 12 | version: 7 13 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/srandmember/snippets/srandmember.js: -------------------------------------------------------------------------------- 1 | try { 2 | 3 | await kuzzle.ms.sadd('setfoo', ['a', 'b', 'c', 'd', 'e', 'f']); 4 | 5 | // Prints one of the elements of setfoo, at random 6 | console.log(await kuzzle.ms.srandmember('setfoo')); 7 | 8 | // Prints three elements of setfoo, at random 9 | console.log(await kuzzle.ms.srandmember('setfoo', {count: 3})); 10 | } catch (error) { 11 | console.error(error.message); 12 | } 13 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/srandmember/snippets/srandmember.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#srandmember 2 | description: Returns one or more members of a set of unique values, at random 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "^\\[ '[a-f]' ]" 9 | - "^\\[ '[a-f]', '[a-f]', '[a-f]' ]" 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/srem/snippets/srem.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.sadd('setfoo', ['foo', 'bar', 'baz']); 3 | 4 | // Prints: 2 5 | console.log(await kuzzle.ms.srem('setfoo', ['bar', 'baz'])); 6 | 7 | // Prints: ['foo'] 8 | console.log(await kuzzle.ms.smembers('setfoo')); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/srem/snippets/srem.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#srem 2 | description: Removes members from a set of unique values 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^2$ 9 | - "\\[ 'foo' ]" 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/sscan/snippets/sscan.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.sadd('setfoo', ['foo', 'bar', 'baz']); 3 | 4 | // Prints: 5 | // { 6 | // cursor: '0', 7 | // values: [ bar', 'baz' ] 8 | // } 9 | console.log(await kuzzle.ms.sscan('setfoo', 0, {match: 'ba*'})); 10 | } catch (error) { 11 | console.error(error.message); 12 | } 13 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/sscan/snippets/sscan.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#sscan 2 | description: Iterates incrementally over members contained in a set of unique values 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "{ cursor: '0', values: \\[ 'ba[rz]', 'ba[rz]' ] }" 9 | 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/strlen/snippets/strlen.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', 'abcdef'); 3 | 4 | // Prints: 6 5 | console.log(await kuzzle.ms.strlen('foo')); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/strlen/snippets/strlen.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#strlen 2 | description: Returns the length of a value 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^6$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/sunion/snippets/sunion.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.sadd('set1', ['a', 'b', 'c']); 3 | await kuzzle.ms.sadd('set2', ['d', 'e', 'f']); 4 | await kuzzle.ms.sadd('set3', ['g', 'h', 'i']); 5 | 6 | // Prints: [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i' ] 7 | console.log(await kuzzle.ms.sunion(['set1', 'set2', 'set3'])); 8 | } catch (error) { 9 | console.error(error.message); 10 | } 11 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/sunion/snippets/sunion.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#sunion 2 | description: Returns the union of sets of unique values 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "\\[" 9 | - ('[a-i]', ) 10 | - ('[a-i]', ) 11 | - ('[a-i]', ) 12 | sdk: js 13 | version: 7 14 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/sunionstore/snippets/sunionstore.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#sunionstore 2 | description: Stores the union of multiple sets of unique values 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "\\[" 9 | - ('[a-i]', ) 10 | - ('[a-i]', ) 11 | - ('[a-i]', ) 12 | sdk: js 13 | version: 7 14 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/time/snippets/time.js: -------------------------------------------------------------------------------- 1 | try { 2 | // Prints: [ 1542890183, 868983 ] 3 | // ...but only if the current time on your server is: 4 | // [GMT] Nov. 22, 2018 12:36:23 PM 5 | console.log(await kuzzle.ms.time()); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/time/snippets/time.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#time 2 | description: Returns the current server time 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "\\[ \\d{10}, \\d+ ]$" 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/touch/snippets/touch.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', 'bar'); 3 | await kuzzle.ms.set('baz', 'qux'); 4 | 5 | // Prints: 2 6 | console.log(await kuzzle.ms.touch(['foo', 'baz', 'thedroidsIamlookingfor'])); 7 | } catch (error) { 8 | console.error(error.message); 9 | } 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/touch/snippets/touch.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#touch 2 | description: Alters the last access time of the provided keys 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^2$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/ttl/snippets/ttl.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.set('foo', 'bar', {ex: 60}); 3 | 4 | // Prints: 60 5 | console.log(await kuzzle.ms.ttl('foo')); 6 | } catch (error) { 7 | console.error(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/ttl/snippets/ttl.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#ttl 2 | description: Returns the remaining time to live of a key, in seconds 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^\d{1,2}$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/type/snippets/type.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#type 2 | description: Returns the type of the value held by a key 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^string$ 9 | - ^list$ 10 | - ^set$ 11 | sdk: js 12 | version: 7 13 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zadd/snippets/zadd.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zadd 2 | description: Adds elements to a sorted set 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "\\[" 9 | - "{ member: 'baz', score: -272.15 }," 10 | - "{ member: 'bar', score: 4 }," 11 | - "{ member: 'foo', score: 42 }" 12 | - "]" 13 | sdk: js 14 | version: 7 15 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zcard/snippets/zcard.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.zadd('ssetfoo', [ 3 | {member: 'foo', score: '42'}, 4 | {member: 'bar', score: '4'}, 5 | {member: 'baz', score: '-272.15'} 6 | ]); 7 | 8 | // Prints 3 9 | console.log(await kuzzle.ms.zcard('ssetfoo')); 10 | } catch (error) { 11 | console.error(error.message); 12 | } 13 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zcard/snippets/zcard.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zcard 2 | description: Returns the number of elements held by a sorted set 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^3$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zcount/snippets/zcount.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.zadd('ssetfoo', [ 3 | {member: 'foo', score: '42'}, 4 | {member: 'bar', score: '4'}, 5 | {member: 'baz', score: '-272.15'} 6 | ]); 7 | 8 | // Prints: 2 9 | // Counts elements with a score lower than 42 (excluded) 10 | console.log(await kuzzle.ms.zcount('ssetfoo', '-inf', '(42')); 11 | } catch (error) { 12 | console.error(error.message); 13 | } 14 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zcount/snippets/zcount.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zcount 2 | description: Counts elements in a sorted set within a score range 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^2$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zincrby/snippets/zincrby.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zincrby 2 | description: Increments the score of a sorted set member by the provided value 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "\\[" 9 | - "{ member: 'baz', score: -272.15 }," 10 | - "{ member: 'foo', score: 42 }," 11 | - "{ member: 'bar', score: 1337 }" 12 | - "\\]" 13 | sdk: js 14 | version: 7 15 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zinterstore/snippets/zinterstore.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zinterstore 2 | description: Stores the intersection of the provided sorted sets 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "\\[" 9 | - "{ member: 'foo', score: 13 }," 10 | - "{ member: 'baz', score: 27.85\\d* }" 11 | - "]" 12 | - "\\[ { member: 'baz', score: -272.15 }, { member: 'foo', score: -29 } ]" 13 | sdk: js 14 | version: 7 15 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zlexcount/snippets/zlexcount.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zlexcount 2 | description: Counts elements in a sorted set using lexicographical ordering 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: ^2$ 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zrange/snippets/zrange.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.zadd('ssetfoo', [ 3 | {member: 'foo', score: '42'}, 4 | {member: 'bar', score: '4'}, 5 | {member: 'baz', score: '-272.15'} 6 | ]); 7 | 8 | // Prints: 9 | // [ { member: 'baz', score: -272.15 }, 10 | // { member: 'bar', score: 4 } ] 11 | console.log(await kuzzle.ms.zrange('ssetfoo', 0, 1)); 12 | } catch (error) { 13 | console.error(error.message); 14 | } 15 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zrange/snippets/zrange.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zrange 2 | description: Returns elements depending on their position in the sorted set 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "\\[ { member: 'baz', score: -272.15 }, { member: 'bar', score: 4 } ]" 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zrangebylex/snippets/zrangebylex.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zrangebylex 2 | description: Returns elements within a provided interval, using lexicographical ordering 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "\\[ 'bar', 'baz' ]" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zrangebyscore/snippets/zrangebyscore.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.zadd('ssetfoo', [ 3 | {member: 'foo', score: '42'}, 4 | {member: 'bar', score: '4'}, 5 | {member: 'baz', score: '-272.15'} 6 | ]); 7 | 8 | // Prints: 9 | // [ { member: 'baz', score: -272.15 }, 10 | // { member: 'bar', score: 4 } ] 11 | console.log(await kuzzle.ms.zrangebyscore('ssetfoo', '-inf', '(42')); 12 | } catch (error) { 13 | console.error(error.message); 14 | } 15 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zrangebyscore/snippets/zrangebyscore.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zrangebyscore 2 | description: Returns all sorted set elements with a score within a provided range 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "\\[ { member: 'baz', score: -272.15 }, { member: 'bar', score: 4 } ]" 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zrank/snippets/zrank.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.zadd('ssetfoo', [ 3 | {member: 'foo', score: '42'}, 4 | {member: 'bar', score: '4'}, 5 | {member: 'baz', score: '-272.15'} 6 | ]); 7 | 8 | // Prints: 2 9 | console.log(await kuzzle.ms.zrank('ssetfoo', 'foo')); 10 | 11 | // Prints: null 12 | console.log(await kuzzle.ms.zrank('ssetfoo', 'qux')); 13 | } catch (error) { 14 | console.error(error.message); 15 | } 16 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zrank/snippets/zrank.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zrank 2 | description: Returns the position of an element in a sorted set 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^2$ 9 | - ^null$ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zrem/snippets/zrem.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.zadd('ssetfoo', [ 3 | {member: 'foo', score: '42'}, 4 | {member: 'bar', score: '4'}, 5 | {member: 'baz', score: '-272.15'} 6 | ]); 7 | 8 | await kuzzle.ms.zrem('ssetfoo', ['foo', 'bar']); 9 | 10 | // Prints: [ { member: 'baz', score: -272.15 } ] 11 | console.log(await kuzzle.ms.zrange('ssetfoo', 0, -1)); 12 | } catch (error) { 13 | console.error(error.message); 14 | } 15 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zrem/snippets/zrem.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zrem 2 | description: Removes members from a sorted set 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "\\[ { member: 'baz', score: -272.15 } ]" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zremrangebylex/snippets/zremrangebylex.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.zadd('ssetfoo', [ 3 | {member: 'foo', score: '0'}, 4 | {member: 'bar', score: '0'}, 5 | {member: 'baz', score: '0'} 6 | ]); 7 | 8 | await kuzzle.ms.zremrangebylex('ssetfoo', '[baz', '+'); 9 | 10 | // Prints: [ 'bar' ] 11 | console.log(await kuzzle.ms.zrangebylex('ssetfoo', '-', '+')); 12 | } catch (error) { 13 | console.error(error.message); 14 | } 15 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zremrangebylex/snippets/zremrangebylex.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zremrangebylex 2 | description: Removes members within a provided range, using lexicographical ordering 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "\\[ 'bar' ]" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zremrangebyrank/snippets/zremrangebyrank.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.zadd('ssetfoo', [ 3 | {member: 'foo', score: '42'}, 4 | {member: 'bar', score: '4'}, 5 | {member: 'baz', score: '-272.15'} 6 | ]); 7 | 8 | await kuzzle.ms.zremrangebyrank('ssetfoo', 1, 2); 9 | 10 | // Prints: [ { member: 'baz', score: -272.15 } ] 11 | console.log(await kuzzle.ms.zrange('ssetfoo', 0, -1)); 12 | } catch (error) { 13 | console.error(error.message); 14 | } 15 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zremrangebyrank/snippets/zremrangebyrank.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zremrangebyrank 2 | description: Removes members from a sorted setn by position 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "\\[ { member: 'baz', score: -272.15 } ]" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zremrangebyscore/snippets/zremrangebyscore.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zremrangebyscore 2 | description: Removes members from a sorted set, by score 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "\\[ { member: 'baz', score: -272.15 } ]" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zrevrange/snippets/zrevrange.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.zadd('ssetfoo', [ 3 | {member: 'foo', score: '42'}, 4 | {member: 'bar', score: '4'}, 5 | {member: 'baz', score: '-272.15'} 6 | ]); 7 | 8 | // Prints: 9 | // [ { member: 'foo', score: 42 }, 10 | // { member: 'bar', score: 4 } ] 11 | console.log(await kuzzle.ms.zrevrange('ssetfoo', 0, 1)); 12 | } catch (error) { 13 | console.error(error.message); 14 | } 15 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zrevrange/snippets/zrevrange.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zrevrange 2 | description: Returns elements depending on their position in the sorted set, in descending order 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "\\[ { member: 'foo', score: 42 }, { member: 'bar', score: 4 } ]" 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zrevrangebylex/snippets/zrevrangebylex.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zrevrangebylex 2 | description: Returns elements within a provided interval, using lexicographical ordering 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: "\\[ 'baz', 'bar' ]" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zrevrangebyscore/snippets/zrevrangebyscore.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zrevrangebyscore 2 | description: Returns all sorted set elements with a score within a provided range in descending order 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "\\[ { member: 'bar', score: 4 }, { member: 'baz', score: -272.15 } ]" 9 | 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zrevrank/snippets/zrevrank.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.zadd('ssetfoo', [ 3 | {member: 'foo', score: '42'}, 4 | {member: 'bar', score: '4'}, 5 | {member: 'baz', score: '-272.15'} 6 | ]); 7 | 8 | // Prints: 0 9 | console.log(await kuzzle.ms.zrevrank('ssetfoo', 'foo')); 10 | 11 | // Prints: null 12 | console.log(await kuzzle.ms.zrank('ssetfoo', 'qux')); 13 | } catch (error) { 14 | console.error(error.message); 15 | } 16 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zrevrank/snippets/zrevrank.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zrevrank 2 | description: Returns the position of an element in a sorted set, in reverse order 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^0$ 9 | - ^null$ 10 | 11 | sdk: js 12 | version: 7 13 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zscan/snippets/zscan.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.zadd('ssetfoo', [ 3 | {member: 'foo', score: '42'}, 4 | {member: 'bar', score: '4'}, 5 | {member: 'baz', score: '-272.15'} 6 | ]); 7 | 8 | // Prints: 9 | // { 10 | // cursor: '0', 11 | // values: [ 'baz', '-272.15', 'bar', '4', 'foo', '42' ] 12 | // } 13 | console.log(await kuzzle.ms.zscan('ssetfoo', 0)); 14 | } catch (error) { 15 | console.error(error.message); 16 | } 17 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zscan/snippets/zscan.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zscan 2 | description: Iterates incrementally over fields contained in a sorted set, using a cursor 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - "{" 9 | - "cursor: '0'," 10 | - "values: \\[ 'baz', '-272.1\\d{1,}', 'bar', '4', 'foo', '42' ]" 11 | - "}" 12 | sdk: js 13 | version: 7 14 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zscore/snippets/zscore.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.ms.zadd('ssetfoo', [ 3 | {member: 'foo', score: '42'}, 4 | {member: 'bar', score: '4'}, 5 | {member: 'baz', score: '-272.15'} 6 | ]); 7 | 8 | // Prints: 42 9 | console.log(await kuzzle.ms.zscore('ssetfoo', 'foo')); 10 | 11 | // Prints: 4 12 | console.log(await kuzzle.ms.zscore('ssetfoo', 'bar')); 13 | } catch (error) { 14 | console.error(error.message); 15 | } 16 | -------------------------------------------------------------------------------- /doc/7/controllers/ms/zscore/snippets/zscore.test.yml: -------------------------------------------------------------------------------- 1 | name: ms#zscore 2 | description: Returns the score of an element in a sorted set 3 | hooks: 4 | before: curl -X POST kuzzle:7512/ms/_flushdb 5 | after: 6 | template: default 7 | expected: 8 | - ^42$ 9 | - ^4$ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/controllers/realtime/count/snippets/count.js: -------------------------------------------------------------------------------- 1 | try { 2 | const roomId = await kuzzle.realtime.subscribe( 3 | 'nyc-open-data', 4 | 'yellow-taxi', 5 | {}, 6 | () => {} 7 | ); 8 | 9 | const count = await kuzzle.realtime.count(roomId); 10 | 11 | console.log(`Currently ${count} active subscription`); 12 | } catch (error) { 13 | console.error(error.message); 14 | } -------------------------------------------------------------------------------- /doc/7/controllers/realtime/count/snippets/count.test.yml: -------------------------------------------------------------------------------- 1 | name: realtime#count 2 | description: Count subscribers for a subscription room 3 | hooks: 4 | before: 5 | after: 6 | template: default 7 | expected: Currently 1 active subscription 8 | 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/realtime/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: realtime 5 | description: Realtime Controller 6 | --- 7 | 8 | # Realtime Controller 9 | -------------------------------------------------------------------------------- /doc/7/controllers/realtime/publish/snippets/publish.js: -------------------------------------------------------------------------------- 1 | const message = { realtime: 'rule the web' }; 2 | 3 | try { 4 | await kuzzle.realtime.publish( 5 | 'i-dont-exist', 6 | 'in-database', 7 | message 8 | ); 9 | 10 | console.log('Success'); 11 | } catch (error) { 12 | console.error(error.message); 13 | } -------------------------------------------------------------------------------- /doc/7/controllers/realtime/publish/snippets/publish.test.yml: -------------------------------------------------------------------------------- 1 | name: realtime#publish 2 | description: Publish a realtime message 3 | hooks: 4 | before: 5 | after: 6 | template: default 7 | expected: Success 8 | 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/realtime/subscribe/snippets/document-notifications-leave-scope.test.yml: -------------------------------------------------------------------------------- 1 | name: realtime#subscribe-documents-leave-scope 2 | description: Subscribe to documents leaving the scope 3 | hooks: 4 | before: curl -X POST kuzzle:7512/nyc-open-data/_create ; curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi/ 5 | after: 6 | template: realtime 7 | expected: Document moved out from the scope 8 | 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/realtime/subscribe/snippets/document-notifications.test.yml: -------------------------------------------------------------------------------- 1 | name: realtime#subscribe-documents 2 | description: Simple subscribe to document notifications 3 | hooks: 4 | before: curl -X POST kuzzle:7512/nyc-open-data/_create ; curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi/ 5 | after: 6 | template: realtime 7 | expected: Document nina vkote enter the scope 8 | 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/realtime/subscribe/snippets/message-notifications.test.yml: -------------------------------------------------------------------------------- 1 | name: realtime#subscribe-messages 2 | description: Subscribe to message notifications 3 | hooks: 4 | before: 5 | after: 6 | template: realtime 7 | expected: Message notification received 8 | 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/realtime/subscribe/snippets/user-notifications.test.yml: -------------------------------------------------------------------------------- 1 | name: realtime#subscribe-users 2 | description: Subscribe to users joining or leaving the room 3 | hooks: 4 | before: curl -X POST kuzzle:7512/nyc-open-data/_create ; curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi/ 5 | after: 6 | template: realtime 7 | expected: "username: 'nina vkote'" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/controllers/realtime/unsubscribe/snippets/unsubscribe.js: -------------------------------------------------------------------------------- 1 | try { 2 | const roomId = await kuzzle.realtime.subscribe( 3 | 'nyc-open-data', 4 | 'yellow-taxi', 5 | {}, 6 | () => {} 7 | ); 8 | 9 | await kuzzle.realtime.unsubscribe(roomId); 10 | 11 | console.log('Success'); 12 | } catch (error) { 13 | console.error(error.message); 14 | } -------------------------------------------------------------------------------- /doc/7/controllers/realtime/unsubscribe/snippets/unsubscribe.test.yml: -------------------------------------------------------------------------------- 1 | name: realtime#unsubscribe 2 | description: Removes a subscription 3 | hooks: 4 | before: 5 | after: 6 | template: default 7 | expected: Success 8 | 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/security/check-rights/snippets/check-rights.js: -------------------------------------------------------------------------------- 1 | const requestPayload = { 2 | controller: 'document', 3 | action: 'create', 4 | index: 'nyc-open-data', 5 | collection: 'yellow-taxi', 6 | body: { 7 | name: 'Melis' 8 | } 9 | } 10 | 11 | try { 12 | const allowed = await kuzzle.security.checkRights('foo', requestPayload); 13 | console.log(allowed); 14 | /* 15 | true 16 | */ 17 | } catch (error) { 18 | console.error(error.message); 19 | } 20 | -------------------------------------------------------------------------------- /doc/7/controllers/security/check-rights/snippets/check-rights.test.yml: -------------------------------------------------------------------------------- 1 | name: security#checkRights 2 | description: Checks if an API action can be executed by a user 3 | hooks: 4 | before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' 5 | after: curl -X DELETE kuzzle:7512/users/foo 6 | template: default 7 | expected: true 8 | -------------------------------------------------------------------------------- /doc/7/controllers/security/create-credentials/snippets/create-credentials.test.yml: -------------------------------------------------------------------------------- 1 | name: security#createCredentials 2 | description: Creates credentials for the specified strategy 3 | hooks: 4 | after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for 5 | template: default 6 | expected: Credentials successfully created 7 | -------------------------------------------------------------------------------- /doc/7/controllers/security/create-first-admin/snippets/create-first-admin.test.yml: -------------------------------------------------------------------------------- 1 | name: security#createFirstAdmin 2 | description: Creates first admin 3 | hooks: 4 | after: curl -X DELETE kuzzle:7512/users/admin?refresh=wait_for 5 | template: default 6 | expected: First admin successfully created 7 | -------------------------------------------------------------------------------- /doc/7/controllers/security/create-or-replace-profile/snippets/create-or-replace-profile.test.yml: -------------------------------------------------------------------------------- 1 | name: security#createOrReplaceProfile 2 | description: Creates or replaces a profile 3 | hooks: 4 | before: curl -XPOST kuzzle:7512/someindex/_create 5 | after: curl -XDELETE kuzzle:7512/profiles/myProfile?refresh=wait_for 6 | template: default 7 | expected: Profile successfully updated 8 | -------------------------------------------------------------------------------- /doc/7/controllers/security/create-or-replace-role/snippets/create-or-replace-role.test.yml: -------------------------------------------------------------------------------- 1 | name: security#createOrReplaceRole 2 | description: Creates or replaces role 3 | hooks: 4 | after: curl -XDELETE kuzzle:7512/roles/read-only 5 | template: default 6 | expected: Role successfully updated 7 | -------------------------------------------------------------------------------- /doc/7/controllers/security/create-profile/snippets/create-profile.test.yml: -------------------------------------------------------------------------------- 1 | name: security#createProfile 2 | description: Creates a profile 3 | hooks: 4 | after: curl -XDELETE kuzzle:7512/profiles/myProfile?refresh=wait_for 5 | template: default 6 | expected: Profile successfully created 7 | -------------------------------------------------------------------------------- /doc/7/controllers/security/create-restricted-user/snippets/create-restricted-user.test.yml: -------------------------------------------------------------------------------- 1 | name: security#createRestrictedUser 2 | description: creates a restricted user 3 | hooks: 4 | after: curl -XDELETE http://kuzzle:7512/users/jdoe 5 | template: default 6 | expected: User successfully created 7 | -------------------------------------------------------------------------------- /doc/7/controllers/security/create-role/snippets/create-role.test.yml: -------------------------------------------------------------------------------- 1 | name: security#createRole 2 | description: Creates a role 3 | hooks: 4 | after: curl -XDELETE kuzzle:7512/roles/read-only?refresh=wait_for 5 | template: default 6 | expected: Role successfully created 7 | -------------------------------------------------------------------------------- /doc/7/controllers/security/create-user/snippets/create-user.test.yml: -------------------------------------------------------------------------------- 1 | name: security#createUser 2 | description: creates user 3 | hooks: 4 | after: curl -XDELETE kuzzle:7512/users/jdoe 5 | template: default 6 | expected: 7 | - "User {" 8 | - "_id: 'jdoe'," 9 | - "_source: {" 10 | - "profileIds: \\[ \\'default\\' \\]," 11 | -------------------------------------------------------------------------------- /doc/7/controllers/security/delete-api-key/snippets/delete-api-key.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.security.deleteApiKey('john.doe', 'fQRa28BsidO6V_wmOcL'); 3 | 4 | console.log('API key successfully deleted'); 5 | } catch (e) { 6 | console.error(e); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/controllers/security/delete-credentials/snippets/delete-credentials.js: -------------------------------------------------------------------------------- 1 | try { 2 | const response = await kuzzle.security.deleteCredentials('local', 'john.doe'); 3 | console.log(response); 4 | /* 5 | { acknowledged: true } 6 | */ 7 | 8 | console.log('Credentials successfully deleted'); 9 | } catch (e) { 10 | console.error(e); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/security/delete-profile/snippets/delete-profile.test.yml: -------------------------------------------------------------------------------- 1 | name: security#deleteProfile 2 | description: deletes profile 3 | hooks: 4 | before: > 5 | curl --fail -H "Content-type: application/json" -d '{ 6 | "policies": [] 7 | }' kuzzle:7512/profiles/myProfile/_create 8 | template: default 9 | expected: Profile successfully deleted 10 | -------------------------------------------------------------------------------- /doc/7/controllers/security/delete-role/snippets/delete-role.test.yml: -------------------------------------------------------------------------------- 1 | name: security#deleteRole 2 | description: deletes role 3 | hooks: 4 | before: > 5 | curl --fail -H "Content-type: application/json" -d '{ 6 | "controllers": { 7 | "*": { 8 | "actions": { 9 | "*": true 10 | } 11 | } 12 | } 13 | }' kuzzle:7512/roles/myRole/_create 14 | template: default 15 | expected: Role successfully deleted 16 | -------------------------------------------------------------------------------- /doc/7/controllers/security/delete-user/snippets/delete-user.js: -------------------------------------------------------------------------------- 1 | try { 2 | const response = await kuzzle.security.deleteUser('john.doe'); 3 | console.log(response); 4 | /* 5 | { _id: 'john.doe' } 6 | */ 7 | 8 | console.log('User successfully deleted'); 9 | } catch (e) { 10 | console.error(e); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/security/get-all-credential-fields/snippets/get-all-credential-fields.js: -------------------------------------------------------------------------------- 1 | try { 2 | const response = await kuzzle.security.getAllCredentialFields(); 3 | 4 | console.log(response); 5 | /* 6 | { local: [ 'username', 'password' ], 7 | facebook: [ ] } 8 | */ 9 | } catch (e) { 10 | console.error(e); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/controllers/security/get-all-credential-fields/snippets/get-all-credential-fields.test.yml: -------------------------------------------------------------------------------- 1 | name: security#getAllCredentialFields 2 | description: get all credential fields 3 | template: default 4 | expected: '{ local: \[ ''username'', ''password'' \] }' 5 | -------------------------------------------------------------------------------- /doc/7/controllers/security/get-credential-fields/snippets/get-credential-fields.js: -------------------------------------------------------------------------------- 1 | try { 2 | const response = await kuzzle.security.getCredentialFields('local'); 3 | 4 | console.log(response); 5 | /* 6 | [ 'username', 'password' ] 7 | */ 8 | } catch (e) { 9 | console.error(e); 10 | } 11 | -------------------------------------------------------------------------------- /doc/7/controllers/security/get-credential-fields/snippets/get-credential-fields.test.yml: -------------------------------------------------------------------------------- 1 | name: security#getCredentialFields 2 | description: get credential fields 3 | template: default 4 | expected: '^\[ ''username'', ''password'' \]$' 5 | -------------------------------------------------------------------------------- /doc/7/controllers/security/get-credentials-by-id/snippets/get-credentials-by-id.js: -------------------------------------------------------------------------------- 1 | try { 2 | const response = await kuzzle.security.getCredentialsById('local', 'jdoe'); 3 | 4 | console.log(response); 5 | /* 6 | { username: 'jdoe', kuid: 'john.doe' } 7 | */ 8 | } catch (e) { 9 | console.error(e); 10 | } 11 | -------------------------------------------------------------------------------- /doc/7/controllers/security/get-credentials/snippets/get-credentials.js: -------------------------------------------------------------------------------- 1 | try { 2 | const response = await kuzzle.security.getCredentials('local', 'john.doe'); 3 | 4 | console.log(response); 5 | /* 6 | { username: 'jdoe', kuid: 'john.doe' } 7 | */ 8 | } catch (e) { 9 | console.error(e); 10 | } 11 | -------------------------------------------------------------------------------- /doc/7/controllers/security/get-profile-mapping/snippets/get-profile-mapping.test.yml: -------------------------------------------------------------------------------- 1 | name: security#getProfileMapping 2 | description: get profile mapping 3 | template: default 4 | expected: 5 | - "mapping: { policies: { properties: \\[Object\\]" 6 | -------------------------------------------------------------------------------- /doc/7/controllers/security/get-role-mapping/snippets/get-role-mapping.js: -------------------------------------------------------------------------------- 1 | try { 2 | const response = await kuzzle.security.getRoleMapping(); 3 | 4 | console.log(response); 5 | /* 6 | { mapping: { controllers: { type: 'object', enabled: false } } } 7 | */ 8 | } catch (e) { 9 | console.error(e); 10 | } 11 | -------------------------------------------------------------------------------- /doc/7/controllers/security/get-role-mapping/snippets/get-role-mapping.test.yml: -------------------------------------------------------------------------------- 1 | name: security#getRoleMapping 2 | description: get roles mapping 3 | template: default 4 | expected: 5 | - "mapping: {" 6 | -------------------------------------------------------------------------------- /doc/7/controllers/security/get-role/snippets/get-role.js: -------------------------------------------------------------------------------- 1 | try { 2 | const response = await kuzzle.security.getRole('myRole'); 3 | 4 | console.log(response); 5 | /* 6 | Role { 7 | _id: 'myRole', 8 | controllers: 9 | { auth: 10 | { actions: { login: true, getMyRights: true, updateSelf: true } }, 11 | document: { actions: { get: true, search: true } } } } 12 | */ 13 | } catch (e) { 14 | console.error(e); 15 | } 16 | -------------------------------------------------------------------------------- /doc/7/controllers/security/get-user-mapping/snippets/get-user-mapping.test.yml: -------------------------------------------------------------------------------- 1 | name: security#getUserMapping 2 | description: get users mapping 3 | template: default 4 | expected: 5 | - "mapping: {" 6 | -------------------------------------------------------------------------------- /doc/7/controllers/security/get-user-rights/snippets/get-user-rights.js: -------------------------------------------------------------------------------- 1 | try { 2 | const response = await kuzzle.security.getUserRights('john.doe'); 3 | 4 | console.log(response); 5 | /* 6 | [ { controller: '*', 7 | action: '*', 8 | index: '*', 9 | collection: '*', 10 | value: 'allowed' } ] 11 | */ 12 | } catch (e) { 13 | console.error(e); 14 | } 15 | -------------------------------------------------------------------------------- /doc/7/controllers/security/get-user-strategies/snippets/get-user-strategies.js: -------------------------------------------------------------------------------- 1 | const strategies = await kuzzle.security.getUserStrategies('john.doe'); 2 | 3 | console.log(strategies); 4 | // [ 'local' ] 5 | -------------------------------------------------------------------------------- /doc/7/controllers/security/has-credentials/snippets/has-credentials.js: -------------------------------------------------------------------------------- 1 | try { 2 | const response = await kuzzle.security.hasCredentials('local', 'john.doe'); 3 | 4 | console.log(response); 5 | /* 6 | true 7 | */ 8 | } catch (e) { 9 | console.error(e); 10 | } 11 | -------------------------------------------------------------------------------- /doc/7/controllers/security/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: security 5 | description: Security controller 6 | --- 7 | 8 | # Security 9 | -------------------------------------------------------------------------------- /doc/7/controllers/security/m-delete-profiles/snippets/m-delete-profiles.js: -------------------------------------------------------------------------------- 1 | try { 2 | const response = await kuzzle.security.mDeleteProfiles([ 3 | 'profile1', 4 | 'profile2', 5 | 'profile3', 6 | 'profile4', 7 | 'profile5' 8 | ]); 9 | 10 | console.log(response); 11 | /* 12 | [ 'profile1', 'profile2', 'profile3', 'profile4', 'profile5' ] 13 | */ 14 | } catch (e) { 15 | console.error(e); 16 | } 17 | -------------------------------------------------------------------------------- /doc/7/controllers/security/m-delete-roles/snippets/m-delete-roles.js: -------------------------------------------------------------------------------- 1 | try { 2 | const response = await kuzzle.security.mDeleteRoles([ 3 | 'role1', 4 | 'role2', 5 | 'role3', 6 | 'role4', 7 | 'role5' 8 | ]); 9 | 10 | console.log(response); 11 | /* 12 | [ 'role1', 'role2', 'role3', 'role4', 'role5' ] 13 | */ 14 | } catch (e) { 15 | console.error(e); 16 | } 17 | -------------------------------------------------------------------------------- /doc/7/controllers/security/m-delete-users/snippets/m-delete-users.js: -------------------------------------------------------------------------------- 1 | try { 2 | const response = await kuzzle.security.mDeleteUsers([ 3 | 'user1', 4 | 'user2', 5 | 'user3' 6 | ]); 7 | 8 | console.log(response); 9 | /* 10 | [ 'user1', 'user2', 'user3' ] 11 | */ 12 | } catch (e) { 13 | console.error(e); 14 | } 15 | -------------------------------------------------------------------------------- /doc/7/controllers/security/refresh/snippets/refresh.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.security.refresh('users'); 3 | console.log('Success'); 4 | } catch (e) { 5 | console.error(e); 6 | } -------------------------------------------------------------------------------- /doc/7/controllers/security/refresh/snippets/refresh.test.yml: -------------------------------------------------------------------------------- 1 | name: security#refresh 2 | description: Refreshes security collection 3 | hooks: 4 | template: default 5 | expected: Success 6 | -------------------------------------------------------------------------------- /doc/7/controllers/security/search-roles/snippets/search-roles.test.yml: -------------------------------------------------------------------------------- 1 | name: security#searchRoles 2 | description: search roles 3 | template: default 4 | expected: ^Successfully retrieved 3 roles$ 5 | -------------------------------------------------------------------------------- /doc/7/controllers/security/update-credentials/snippets/update-credentials.js: -------------------------------------------------------------------------------- 1 | try { 2 | const response = await kuzzle.security.updateCredentials( 3 | 'local', 4 | 'john.doe', 5 | { 6 | username: 'jdoe', 7 | password: 'newPassword' 8 | } 9 | ); 10 | 11 | console.log(response); 12 | /* 13 | { username: "jdoe" } 14 | */ 15 | } catch (e) { 16 | console.error(e); 17 | } 18 | -------------------------------------------------------------------------------- /doc/7/controllers/security/update-profile-mapping/snippets/update-profile-mapping.js: -------------------------------------------------------------------------------- 1 | try { 2 | const updatedMapping = await kuzzle.security.updateProfileMapping({ 3 | properties: { 4 | description: { type: 'text' } 5 | } 6 | }); 7 | 8 | console.log(updatedMapping); 9 | /* 10 | { 11 | properties: { 12 | description: { type: 'text' } 13 | } 14 | } 15 | */ 16 | } catch (e) { 17 | console.error(e); 18 | } 19 | -------------------------------------------------------------------------------- /doc/7/controllers/security/update-profile-mapping/snippets/update-profile-mapping.test.yml: -------------------------------------------------------------------------------- 1 | name: security#updateProfileMapping 2 | description: update profile mapping 3 | template: default 4 | expected: 'description: {' 5 | -------------------------------------------------------------------------------- /doc/7/controllers/security/update-role-mapping/snippets/update-role-mapping.js: -------------------------------------------------------------------------------- 1 | try { 2 | const updatedMapping = await kuzzle.security.updateRoleMapping({ 3 | properties: { 4 | description: { type: 'text' } 5 | } 6 | }); 7 | 8 | console.log(updatedMapping); 9 | /* 10 | { 11 | properties: { 12 | description: { type: 'text' } 13 | } 14 | } 15 | */ 16 | } catch (e) { 17 | console.error(e); 18 | } 19 | -------------------------------------------------------------------------------- /doc/7/controllers/security/update-role-mapping/snippets/update-role-mapping.test.yml: -------------------------------------------------------------------------------- 1 | name: security#updateRoleMapping 2 | description: update role mapping 3 | template: default 4 | expected: 'description:' 5 | -------------------------------------------------------------------------------- /doc/7/controllers/security/update-user-mapping/snippets/update-user-mapping.test.yml: -------------------------------------------------------------------------------- 1 | name: security#updateUserMapping 2 | description: update user mapping 3 | template: default 4 | expected: 'firstName: ' 5 | -------------------------------------------------------------------------------- /doc/7/controllers/security/update-user/snippets/update-user.test.yml: -------------------------------------------------------------------------------- 1 | name: security#updateUser 2 | description: update user 3 | hooks: 4 | before: > 5 | curl -f -H "Content-type: application/json" -d '{ 6 | "content": { 7 | "profileIds": ["default"] 8 | }, 9 | "credentials": { } 10 | }' kuzzle:7512/users/john.doe/_create 11 | after: curl -f -XDELETE kuzzle:7512/users/john.doe 12 | template: default 13 | expected: 14 | - "firstName: 'John'" 15 | -------------------------------------------------------------------------------- /doc/7/controllers/security/validate-credentials/snippets/validate-credentials.js: -------------------------------------------------------------------------------- 1 | try { 2 | const response = await kuzzle.security.validateCredentials( 3 | 'local', 4 | 'john.doe', 5 | { 6 | username: 'jdoe', 7 | password: 'password' 8 | } 9 | ); 10 | 11 | console.log(response); 12 | /* 13 | true 14 | */ 15 | 16 | } catch (e) { 17 | console.error(e); 18 | } 19 | -------------------------------------------------------------------------------- /doc/7/controllers/server/admin-exists/snippets/admin-exists.js: -------------------------------------------------------------------------------- 1 | try { 2 | const exists = await kuzzle.server.adminExists(); 3 | 4 | console.log('Admin exists?', exists); 5 | } catch (error) { 6 | console.error(error.message); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/controllers/server/admin-exists/snippets/admin-exists.test.yml: -------------------------------------------------------------------------------- 1 | name: server#adminExists 2 | description: Checks that an administrator account exists. 3 | hooks: 4 | before: 5 | after: 6 | template: default 7 | expected: ^(Admin exists\?) (true|false)$ 8 | 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/controllers/server/get-all-stats/snippets/get-all-stats.js: -------------------------------------------------------------------------------- 1 | try { 2 | const allStats = await kuzzle.server.getAllStats(); 3 | 4 | console.log('All Kuzzle Stats:', JSON.stringify(allStats)); 5 | } catch (error) { 6 | console.error(error.message); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/controllers/server/get-all-stats/snippets/get-all-stats.test.yml: -------------------------------------------------------------------------------- 1 | name: server#getAllStats 2 | description: Gets all stored internal statistic snapshots. 3 | hooks: 4 | before: 5 | after: 6 | template: default 7 | expected: ongoingRequests 8 | -------------------------------------------------------------------------------- /doc/7/controllers/server/get-config/snippets/get-config.js: -------------------------------------------------------------------------------- 1 | try { 2 | const config = await kuzzle.server.getConfig(); 3 | 4 | console.log('Kuzzle Server configuration:', JSON.stringify(config)); 5 | } catch (error) { 6 | console.error(error.message); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/controllers/server/get-config/snippets/get-config.test.yml: -------------------------------------------------------------------------------- 1 | name: server#getConfig 2 | description: Returns the current Kuzzle configuration. 3 | hooks: 4 | before: 5 | after: 6 | template: default 7 | expected: '^Kuzzle Server configuration:' -------------------------------------------------------------------------------- /doc/7/controllers/server/get-last-stats/snippets/get-last-stats.js: -------------------------------------------------------------------------------- 1 | try { 2 | const lastStat = await kuzzle.server.getLastStats(); 3 | 4 | console.log('Last Kuzzle Stats:', JSON.stringify(lastStat)); 5 | } catch (error) { 6 | console.error(error.message); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/controllers/server/get-last-stats/snippets/get-last-stats.test.yml: -------------------------------------------------------------------------------- 1 | name: server#getLastStats 2 | description: Gets all stored internal statistic snapshots. 3 | hooks: 4 | before: 5 | after: 6 | template: default 7 | expected: ongoingRequests 8 | -------------------------------------------------------------------------------- /doc/7/controllers/server/get-stats/snippets/get-stats.js: -------------------------------------------------------------------------------- 1 | try { 2 | const stats = await kuzzle.server.getStats('1234567890101', '1541426610304'); 3 | 4 | console.log('Kuzzle Stats:', JSON.stringify(stats)); 5 | } catch (error) { 6 | console.error(error.message); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/controllers/server/get-stats/snippets/get-stats.test.yml: -------------------------------------------------------------------------------- 1 | name: server#getStats 2 | description: Returns statistics snapshots within a provided timestamp range. 3 | hooks: 4 | before: 5 | after: 6 | template: default 7 | expected: hits 8 | -------------------------------------------------------------------------------- /doc/7/controllers/server/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: server 5 | description: Server Controller 6 | --- 7 | 8 | # Server Controller 9 | -------------------------------------------------------------------------------- /doc/7/controllers/server/info/snippets/info.js: -------------------------------------------------------------------------------- 1 | try { 2 | const serverInfo = await kuzzle.server.info(); 3 | 4 | console.log('Kuzzle Server information:', JSON.stringify(serverInfo)); 5 | } catch (error) { 6 | console.error(error.message); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/controllers/server/info/snippets/info.test.yml: -------------------------------------------------------------------------------- 1 | name: server##info 2 | description: Retrieves information about Kuzzle plugins and active services. 3 | hooks: 4 | before: 5 | after: 6 | template: default 7 | expected: serverInfo 8 | -------------------------------------------------------------------------------- /doc/7/controllers/server/now/snippets/now.js: -------------------------------------------------------------------------------- 1 | try { 2 | const timestamp = await kuzzle.server.now(); 3 | 4 | console.log('Epoch-millis timestamp:', timestamp); 5 | } catch (error) { 6 | console.error(error.message); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/controllers/server/now/snippets/now.test.yml: -------------------------------------------------------------------------------- 1 | name: server#now 2 | description: Fetch the current server timestamp, in Epoch-millis format. 3 | hooks: 4 | before: 5 | after: 6 | template: default 7 | expected: ^(Epoch-millis timestamp:) [0-9]{13}$ -------------------------------------------------------------------------------- /doc/7/core-classes/base-controller/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: BaseController 5 | description: BaseController object documentation 6 | order: 500 7 | --- 8 | 9 | 10 | -------------------------------------------------------------------------------- /doc/7/core-classes/batch-controller/dispose/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: page 4 | title: dispose 5 | description: BatchController dispose method 6 | --- 7 | 8 | # dispose 9 | 10 | 11 | 12 | Dispose the instance. 13 | 14 | This method has to be called to destroy the underlaying timer sending batch requests. 15 | 16 | ## Arguments 17 | 18 | ```js 19 | dispose (): Promise 20 | ``` 21 | -------------------------------------------------------------------------------- /doc/7/core-classes/batch-controller/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: BatchController 5 | description: BatchController class documentation 6 | --- 7 | 8 | 9 | -------------------------------------------------------------------------------- /doc/7/core-classes/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: false 3 | type: branch 4 | order: 200 5 | title: Core Classes 6 | description: Javascript SDK v7.x core classes 7 | --- 8 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle-error/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: KuzzleError 5 | description: KuzzleError object documentation 6 | order: 510 7 | --- 8 | 9 | 10 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle-error/introduction/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: false 3 | type: page 4 | title: Introduction 5 | description: KuzzleError object 6 | order: 0 7 | --- 8 | 9 | # KuzzleError 10 | 11 | Inherits from the standard `Error` class. 12 | 13 | The KuzzleError class represents an [error response from Kuzzle API](/core/2/api/payloads/error). 14 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle-event-emitter/add-listener/snippets/add-listener.js: -------------------------------------------------------------------------------- 1 | const eventEmitter = new KuzzleEventEmitter(); 2 | 3 | eventEmitter.addListener('myEvent', () => console.log('Caught event "myEvent"!')); 4 | 5 | // Prints: Caught event "myEvent"! 6 | eventEmitter.emit('myEvent'); 7 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle-event-emitter/add-listener/snippets/add-listener.test.yml: -------------------------------------------------------------------------------- 1 | name: kuzzleEventEmitter#add-listener 2 | description: Adds new listener for the given event 3 | hooks: 4 | before: 5 | after: 6 | template: eventemitter 7 | expected: Caught event "myEvent"! 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle-event-emitter/add-once-listener/snippets/add-once-listener.js: -------------------------------------------------------------------------------- 1 | const eventEmitter = new KuzzleEventEmitter(); 2 | 3 | eventEmitter.addOnceListener( 4 | 'myEvent', 5 | () => console.log('Caught event "myEvent"!')); 6 | 7 | // Prints: Caught event "myEvent"! 8 | eventEmitter.emit('myEvent'); 9 | 10 | // Prints nothing: the event has since been removed 11 | eventEmitter.emit('myEvent'); 12 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle-event-emitter/add-once-listener/snippets/add-once-listener.test.yml: -------------------------------------------------------------------------------- 1 | name: kuzzleEventEmitter#add-once-listener 2 | description: Adds new once listener for the given event 3 | hooks: 4 | before: 5 | after: 6 | template: eventemitter 7 | expected: Caught event "myEvent"! 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle-event-emitter/emit/snippets/emit.js: -------------------------------------------------------------------------------- 1 | const eventEmitter = new KuzzleEventEmitter(); 2 | 3 | eventEmitter.addListener('helloEvent', msg => console.log(`Hello ${msg}`)); 4 | 5 | eventEmitter.emit('helloEvent', 'World'); 6 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle-event-emitter/emit/snippets/emit.test.yml: -------------------------------------------------------------------------------- 1 | name: kuzzleEventEmitter#emit 2 | description: Emits an event 3 | hooks: 4 | before: 5 | after: 6 | template: eventemitter 7 | expected: Hello World 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle-event-emitter/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: KuzzleEventEmitter 5 | description: KuzzleEventEmitter class documentation 6 | order: 510 7 | --- 8 | 9 | 10 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle-event-emitter/listeners/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: page 4 | title: listeners 5 | description: Returns listeners for an event 6 | --- 7 | 8 | # listeners 9 | 10 | Returns the listener functions bound to a specific event. 11 | 12 | ## Arguments 13 | 14 | ```js 15 | listeners(eventName); 16 | ``` 17 | 18 | ## Return 19 | 20 | An array of listener functions. 21 | 22 | ## Usage 23 | 24 | <<< ./snippets/listeners.js 25 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle-event-emitter/listeners/snippets/listeners.js: -------------------------------------------------------------------------------- 1 | const eventEmitter = new KuzzleEventEmitter(); 2 | 3 | eventEmitter.addListener('myEvent', () => console.log('Hello')); 4 | eventEmitter.addListener('myEvent', () => console.log('Hello World')); 5 | 6 | const listeners = eventEmitter.listeners('myEvent'); 7 | 8 | console.log(`There are ${listeners.length} listeners bound to the event "myEvent"`); 9 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle-event-emitter/listeners/snippets/listeners.test.yml: -------------------------------------------------------------------------------- 1 | name: kuzzleEventEmitter#listeners 2 | description: Returns listeners binded to an event 3 | hooks: 4 | before: 5 | after: 6 | template: eventemitter 7 | expected: There are 2 listeners bound to the event "myEvent" 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle-event-emitter/on/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: page 4 | title: on 5 | description: Alias for addListener 6 | --- 7 | 8 | # on 9 | 10 | Alias for [addListener](https://nodejs.org/api/events.html#events_emitter_addlistener_eventname_listener). 11 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle-event-emitter/once/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: page 4 | title: once 5 | description: Alias for addOnceListener 6 | --- 7 | 8 | # once 9 | 10 | Alias for [addOnceListener](/sdk/js/7/core-classes/kuzzle-event-emitter/add-once-listener). 11 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle-event-emitter/prepend-listener/snippets/prepend-listener.js: -------------------------------------------------------------------------------- 1 | const eventEmitter = new KuzzleEventEmitter(); 2 | 3 | eventEmitter.addListener('myEvent', () => console.log('listener1')); 4 | 5 | eventEmitter.prependListener('myEvent', () => console.log('listener2')); 6 | 7 | // Prints: 8 | // listener2 9 | // listener1 10 | eventEmitter.emit('myEvent'); 11 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle-event-emitter/prepend-listener/snippets/prepend-listener.test.yml: -------------------------------------------------------------------------------- 1 | name: kuzzleEventEmitter#prepend-listener 2 | description: Prepends a new listener for the given event 3 | hooks: 4 | before: 5 | after: 6 | template: eventemitter 7 | expected: 8 | - ^listener2$ 9 | - ^listener1$ 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle-event-emitter/prepend-once-listener/snippets/prepend-once-listener.test.yml: -------------------------------------------------------------------------------- 1 | name: kuzzleEventEmitter#prepend-once-listener 2 | description: Prepends an once new listener for the given event 3 | hooks: 4 | before: 5 | after: 6 | template: eventemitter 7 | expected: 8 | - ^listener2$ 9 | - ^listener1$ 10 | - ^listener1$ 11 | sdk: js 12 | version: 7 13 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle-event-emitter/remove-all-listener/snippets/remove-all-listeners.test.yml: -------------------------------------------------------------------------------- 1 | name: kuzzleEventEmitter#remove-all-listeners 2 | description: Removes a listener for the given event 3 | hooks: 4 | before: 5 | after: 6 | template: eventemitter 7 | expected: Successfully removed all listeners 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle-event-emitter/remove-listener/snippets/remove-listener.test.yml: -------------------------------------------------------------------------------- 1 | name: kuzzleEventEmitter#remove-listener 2 | description: Removes a listener for the given event 3 | hooks: 4 | before: 5 | after: 6 | template: eventemitter 7 | expected: Successfully removed the listener 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/authenticate/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: page 4 | title: authenticate 5 | description: Authenticate the SDK with the setted authenticator 6 | --- 7 | 8 | # authenticate 9 | 10 | Authenticate the SDK by using the function set in the [authenticator](/sdk/js/7/core-classes/kuzzle/properties#authenticator) property. 11 | 12 | ## Arguments 13 | 14 | ```js 15 | authenticate(); 16 | ``` 17 | 18 | ## Usage 19 | 20 | <<< ./snippets/authenticate.js 21 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/authenticate/snippets/authenticate.js: -------------------------------------------------------------------------------- 1 | kuzzle.authenticator = async () => { 2 | await kuzzle.auth.login('local', { username: 'foo', password: 'bar' }); 3 | }; 4 | 5 | try { 6 | await kuzzle.authenticate(); 7 | 8 | console.log('Success'); 9 | } catch (error) { 10 | console.error(error.message); 11 | } 12 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/authenticate/snippets/authenticate.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: kuzzle#authenticate 3 | description: Authenticate the SDK 4 | hooks: 5 | before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' 6 | after: curl -X DELETE kuzzle:7512/users/foo 7 | template: default 8 | expected: Success 9 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/connect/snippets/connect.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.connect(); 3 | 4 | console.log('Successfully connected'); 5 | } catch (error) { 6 | console.error(error.message); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/connect/snippets/connect.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: kuzzle#connect 3 | description: Connects the SDK to Kuzzle 4 | hooks: 5 | before: 6 | after: 7 | template: without-connect 8 | expected: Successfully connected 9 | 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/constructor/snippets/constructor.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: kuzzle#constructor 3 | description: Creates a new Kuzzle instance connected to kuzzle 4 | hooks: 5 | before: 6 | after: 7 | template: empty 8 | expected: Success 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/disconnect/snippets/disconnect.js: -------------------------------------------------------------------------------- 1 | try { 2 | kuzzle.disconnect(); 3 | 4 | console.log('Successfully disconnected'); 5 | } catch (error) { 6 | console.error(error); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/disconnect/snippets/disconnect.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: kuzzle#disconnect 3 | description: Disconnects the SDK 4 | hooks: 5 | before: 6 | after: 7 | template: without-connect 8 | expected: Successfully disconnected 9 | 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/flush-queue/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: page 4 | title: flushQueue 5 | description: Empties the offline request queue 6 | --- 7 | 8 | # flushQueue 9 | 10 | Empties the offline request queue without playing it. 11 | 12 | ## Arguments 13 | 14 | ```js 15 | flushQueue(); 16 | ``` 17 | 18 | ## Return 19 | 20 | The `Kuzzle` instance. 21 | 22 | ## Usage 23 | 24 | <<< ./snippets/flush-queue.js 25 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/flush-queue/snippets/flush-queue.js: -------------------------------------------------------------------------------- 1 | try { 2 | kuzzle.flushQueue(); 3 | 4 | console.log('Offline queue flushed'); 5 | } catch (error) { 6 | console.error(error); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/flush-queue/snippets/flush-queue.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: kuzzle#flushQueue 3 | description: Empties the offline request queue 4 | hooks: 5 | before: 6 | after: 7 | template: without-connect 8 | expected: Offline queue flushed 9 | 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: Kuzzle 5 | description: Kuzzle object documentation 6 | order: 510 7 | --- 8 | 9 | 10 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/play-queue/snippets/play-queue.js: -------------------------------------------------------------------------------- 1 | try { 2 | kuzzle.playQueue(); 3 | 4 | console.log('Start playing offline queue'); 5 | } catch (error) { 6 | console.error(error); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/play-queue/snippets/play-queue.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: kuzzle#playQueue 3 | description: Play the requests queued 4 | hooks: 5 | before: 6 | after: 7 | template: without-connect 8 | expected: Start playing offline queue 9 | 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/query/snippets/query.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: kuzzle#query 3 | description: Sends a request to Kuzzle API 4 | hooks: 5 | before: | 6 | curl -X POST kuzzle:7512/nyc-open-data/_create 7 | curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | curl -X DELETE kuzzle:7512/nyc-open-data/yellow-taxi/my-custom-document-id 9 | after: 10 | template: default 11 | expected: Document created 12 | 13 | sdk: js 14 | version: 7 15 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/start-queuing/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: page 4 | title: startQueuing 5 | description: Starts the requests queuing 6 | --- 7 | 8 | # startQueuing 9 | 10 | Starts the requests queuing. 11 | Works only in `offline` state, and if the `autoQueue` option is set to false. 12 | 13 | ## Arguments 14 | 15 | ```js 16 | startQueuing(); 17 | ``` 18 | 19 | ## Return 20 | 21 | The `Kuzzle` instance. 22 | 23 | ## Usage 24 | 25 | <<< ./snippets/start-queuing.js 26 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/start-queuing/snippets/start-queuing.js: -------------------------------------------------------------------------------- 1 | try { 2 | kuzzle.startQueuing(); 3 | 4 | console.log('Start queuing requests'); 5 | } catch (error) { 6 | console.error(error); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/start-queuing/snippets/start-queuing.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: kuzzle#startQueuing 3 | description: Starts the requests queuing 4 | hooks: 5 | before: 6 | after: 7 | template: without-connect 8 | expected: Start queuing requests 9 | 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/stop-queuing/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: page 4 | title: stopQueuing 5 | description: Stops the requests queuing 6 | --- 7 | 8 | # stopQueuing 9 | 10 | Stops the requests queuing. 11 | Works only in `offline` state, and if the `autoQueue` option is set to false. 12 | 13 | ## Arguments 14 | 15 | ```js 16 | stopQueuing(); 17 | ``` 18 | 19 | ## Return 20 | 21 | The `Kuzzle` instance. 22 | 23 | ## Usage 24 | 25 | <<< ./snippets/stop-queuing.js 26 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/stop-queuing/snippets/stop-queuing.js: -------------------------------------------------------------------------------- 1 | try { 2 | kuzzle.stopQueuing(); 3 | 4 | console.log('Stop queuing requests'); 5 | } catch (error) { 6 | console.error(error); 7 | } 8 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/stop-queuing/snippets/stop-queuing.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: kuzzle#stopQueuing 3 | description: Stops the requests queuing 4 | hooks: 5 | before: 6 | after: 7 | template: without-connect 8 | expected: Stop queuing requests 9 | 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/core-classes/kuzzle/use-controller/snippets/use-controller.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: kuzzle#useController 3 | description: Adds a new controller to the SDK 4 | hooks: 5 | before: 6 | after: 7 | template: controller 8 | expected: Success 9 | 10 | sdk: js 11 | version: 7 -------------------------------------------------------------------------------- /doc/7/core-classes/observer/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: Observer 5 | description: Observer class documentation 6 | --- 7 | 8 | 9 | -------------------------------------------------------------------------------- /doc/7/core-classes/profile/getRoles/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: page 4 | title: getRoles 5 | description: Profile getRoles method 6 | --- 7 | 8 | # getRoles 9 | 10 | Loads information about the profile roles. 11 | 12 | ## Arguments 13 | 14 | ```js 15 | getRoles(); 16 | ``` 17 | 18 | ## Resolve 19 | 20 | Resolves to an array of [Role](/sdk/js/7/core-classes/role). 21 | 22 | ## Usage 23 | 24 | <<< ./snippets/getRoles.js 25 | -------------------------------------------------------------------------------- /doc/7/core-classes/profile/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: Profile 5 | description: Profile class documentation 6 | order: 510 7 | --- 8 | 9 | 10 | -------------------------------------------------------------------------------- /doc/7/core-classes/profile/introduction/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: false 3 | type: page 4 | title: Introduction 5 | description: Profile class 6 | order: 0 7 | --- 8 | 9 | # Profile 10 | 11 | This class represents a Kuzzle Profile. 12 | 13 | Refer to the [Security guide](/core/2/guides/main-concepts/permissions#profiles) for more information about profiles. 14 | -------------------------------------------------------------------------------- /doc/7/core-classes/role/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: Role 5 | description: Role class documentation 6 | order: 510 7 | --- 8 | 9 | 10 | -------------------------------------------------------------------------------- /doc/7/core-classes/role/introduction/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: false 3 | type: page 4 | title: Introduction 5 | description: Role class 6 | order: 0 7 | --- 8 | 9 | # Role 10 | 11 | This class represents a Kuzzle Role. 12 | 13 | Refer to the [Security guide](/core/2/guides/main-concepts/permissions#roles) for more information about roles. -------------------------------------------------------------------------------- /doc/7/core-classes/role/properties/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: false 3 | type: page 4 | title: Properties 5 | description: Role class properties 6 | order: 10 7 | --- 8 | 9 | # Properties 10 | 11 | Available properties: 12 | 13 | | Property | Type | Description | 14 | |--- |--- |--- | 15 | | `_id` |
string
| Role unique identifier | 16 | | `controllers` |
object
| Object defining controller actions allowed by this role | 17 | -------------------------------------------------------------------------------- /doc/7/core-classes/role/serialize/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: page 4 | title: serialize 5 | description: Role serialize method 6 | --- 7 | 8 | # serialize 9 | 10 | 11 | 12 | Serialize the profile into a JSONObject. 13 | 14 | ## Arguments 15 | 16 | ```js 17 | serialize(); 18 | ``` 19 | 20 | ## Resolve 21 | 22 | Serialized role with the following properties: 23 | - `_id`: Role ID 24 | - `controllers`: Controllers definition 25 | -------------------------------------------------------------------------------- /doc/7/core-classes/search-result/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: SearchResult 5 | description: SearchResult class documentation 6 | order: 510 7 | --- 8 | 9 | 10 | -------------------------------------------------------------------------------- /doc/7/core-classes/search-result/next/snippets/fromsize.test.yml: -------------------------------------------------------------------------------- 1 | name: searchresult#fromsize 2 | description: Next method with from/size 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: | 9 | curl -XDELETE kuzzle:7512/nyc-open-data 10 | template: default 11 | expected: Successfully retrieved 100 documents 12 | sdk: js 13 | version: 7 14 | -------------------------------------------------------------------------------- /doc/7/core-classes/search-result/next/snippets/scroll.test.yml: -------------------------------------------------------------------------------- 1 | name: searchresult#scroll 2 | description: Next method with scroll 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: | 9 | curl -XDELETE kuzzle:7512/nyc-open-data 10 | template: default 11 | expected: Successfully retrieved 100 documents 12 | sdk: js 13 | version: 7 14 | -------------------------------------------------------------------------------- /doc/7/core-classes/search-result/next/snippets/sortsize.test.yml: -------------------------------------------------------------------------------- 1 | name: searchresult#sortsize 2 | description: Next method with sort/size 3 | hooks: 4 | before: | 5 | curl -XDELETE kuzzle:7512/nyc-open-data 6 | curl -XPOST kuzzle:7512/nyc-open-data/_create 7 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: | 9 | curl -XDELETE kuzzle:7512/nyc-open-data 10 | template: default 11 | expected: Successfully retrieved 100 documents -------------------------------------------------------------------------------- /doc/7/core-classes/user/getProfiles/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: page 4 | title: getProfiles 5 | description: User getProfiles method 6 | --- 7 | 8 | # getProfiles 9 | 10 | Loads information about the user profiles. 11 | 12 | ## Arguments 13 | 14 | ```js 15 | getProfiles(); 16 | ``` 17 | 18 | ## Resolve 19 | 20 | Resolves to an array of [Profile](/sdk/js/7/core-classes/profile). 21 | 22 | ## Usage 23 | 24 | <<< ./snippets/getProfiles.js 25 | -------------------------------------------------------------------------------- /doc/7/core-classes/user/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: User 5 | description: User class documentation 6 | order: 510 7 | --- 8 | 9 | 10 | -------------------------------------------------------------------------------- /doc/7/core-classes/user/serialize/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: page 4 | title: serialize 5 | description: User serialize method 6 | --- 7 | 8 | # serialize 9 | 10 | 11 | 12 | Serialize the user into a JSONObject. 13 | 14 | ## Arguments 15 | 16 | ```js 17 | serialize(); 18 | ``` 19 | 20 | ## Resolve 21 | 22 | Serialized user with the following properties: 23 | - `_id`: User ID 24 | - `_source`: User content 25 | -------------------------------------------------------------------------------- /doc/7/essentials/error-handling/snippets/error-handling-async.js: -------------------------------------------------------------------------------- 1 | try { 2 | await kuzzle.index.create('nyc-open-data'); 3 | } catch (error) { 4 | if (error.status === 412) { 5 | console.log(error.message); 6 | console.log('Try with another name!'); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /doc/7/essentials/error-handling/snippets/error-handling-async.test.yml: -------------------------------------------------------------------------------- 1 | name: essentials#errorHandlingAsync 2 | description: How to handle errors with the SDK 3 | hooks: 4 | before: | 5 | curl -X DELETE kuzzle:7512/nyc-open-data 6 | curl -X POST kuzzle:7512/nyc-open-data/_create 7 | curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi 8 | after: 9 | template: default 10 | expected: Try with another name! 11 | -------------------------------------------------------------------------------- /doc/7/essentials/error-handling/snippets/error-handling.js: -------------------------------------------------------------------------------- 1 | kuzzle.index.create('nyc-open-data') 2 | .then(() => 'do something') 3 | .catch(error => { 4 | if (error.status === 412) { 5 | console.log(error.message); 6 | console.log('Try with another name!'); 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /doc/7/essentials/error-handling/snippets/error-handling.test.yml: -------------------------------------------------------------------------------- 1 | name: essentials#errorHandling 2 | description: How to handle errors with the SDK 3 | hooks: 4 | before: curl -X POST kuzzle:7512/nyc-open-data/_create 5 | after: 6 | template: thencatch 7 | expected: Try with another name! 8 | 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/essentials/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: false 3 | type: branch 4 | order: 100 5 | title: Essentials 6 | description: Javascript SDK v7.x essential notions 7 | --- 8 | 9 | 10 | -------------------------------------------------------------------------------- /doc/7/getting-started/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: false 3 | type: branch 4 | title: Getting Started 5 | description: Get started with the Javascript SDK 6 | order: 0 7 | --- 8 | 9 | 10 | -------------------------------------------------------------------------------- /doc/7/getting-started/node-js/snippets/create.test.yml: -------------------------------------------------------------------------------- 1 | name: gettingstarted#nodejscreate 2 | description: Creates a document 3 | hooks: 4 | before: | 5 | curl -XPOST kuzzle:7512/nyc-open-data/_create 6 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 7 | after: 8 | template: empty 9 | expected: New document successfully created! 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/getting-started/node-js/snippets/init.test.yml: -------------------------------------------------------------------------------- 1 | name: gettingstarted#nodejsinit 2 | description: Creates an index and a collection 3 | hooks: 4 | before: curl -X DELETE kuzzle:7512/nyc-open-data 5 | after: 6 | template: empty 7 | expected: nyc-open-data/yellow-taxi ready! 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/getting-started/node-js/snippets/load-sdk.js: -------------------------------------------------------------------------------- 1 | const { 2 | Kuzzle, 3 | WebSocket 4 | } = require('kuzzle-sdk'); 5 | 6 | // Replace 'kuzzle' with your Kuzzle server hostname (e.g. 'localhost') 7 | const kuzzle = new Kuzzle( 8 | new WebSocket('kuzzle') 9 | ); 10 | -------------------------------------------------------------------------------- /doc/7/getting-started/node-js/snippets/load-sdk.test.yml: -------------------------------------------------------------------------------- 1 | name: gettingstarted#nodejsload 2 | description: Load SDK 3 | hooks: 4 | before: 5 | after: 6 | template: empty 7 | expected: Success 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/getting-started/node-js/snippets/prepare-db.test.yml: -------------------------------------------------------------------------------- 1 | name: gettingstarted#nodejspreparedb 2 | description: Prepare database 3 | hooks: 4 | before: curl -X DELETE kuzzle:7512/nyc-open-data 5 | after: 6 | template: blank 7 | expected: nyc-open-data/yellow-taxi ready! 8 | sdk: js 9 | version: 7 10 | -------------------------------------------------------------------------------- /doc/7/getting-started/node-js/snippets/subscribe.test.yml: -------------------------------------------------------------------------------- 1 | name: gettingstarted#nodejssubscribe 2 | description: Subscribes to document notifications 3 | hooks: 4 | before: | 5 | curl -XPOST kuzzle:7512/nyc-open-data/_create 6 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 7 | after: 8 | template: empty-realtime 9 | expected: Successfully subscribed to document notifications! 10 | sdk: js 11 | version: 7 12 | -------------------------------------------------------------------------------- /doc/7/getting-started/raw-web/snippets/create.test.yml: -------------------------------------------------------------------------------- 1 | name: gettingstarted#browservanillacreate 2 | description: Create a document 3 | hooks: 4 | before: | 5 | curl -XPOST kuzzle:7512/nyc-open-data/_create 6 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 7 | after: 8 | template: default 9 | expected: New document successfully created 10 | sdk: js 11 | version: 7 12 | runner: web 13 | -------------------------------------------------------------------------------- /doc/7/getting-started/raw-web/snippets/load-sdk.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/7/getting-started/raw-web/snippets/load-sdk.test.yml: -------------------------------------------------------------------------------- 1 | name: gettingstarted#browservanillaconnect 2 | description: Connect to Kuzzle 3 | hooks: 4 | before: 5 | after: 6 | template: default 7 | expected: Successfully connected to Kuzzle 8 | sdk: js 9 | version: 7 10 | runner: web 11 | -------------------------------------------------------------------------------- /doc/7/getting-started/raw-web/snippets/prepare-db.test.yml: -------------------------------------------------------------------------------- 1 | name: gettingstarted#browservanillaprepare 2 | description: Prepare the database 3 | hooks: 4 | before: curl -X DELETE kuzzle:7512/nyc-open-data 5 | after: 6 | template: default 7 | expected: nyc-open-data/yellow-taxi ready 8 | sdk: js 9 | version: 7 10 | runner: web 11 | -------------------------------------------------------------------------------- /doc/7/getting-started/raw-web/snippets/subscribe.test.yml: -------------------------------------------------------------------------------- 1 | name: gettingstarted#browservanillasubscribe 2 | description: Subscribe to notifications 3 | hooks: 4 | before: | 5 | curl -XPOST kuzzle:7512/nyc-open-data/_create 6 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 7 | after: 8 | template: default 9 | expected: Successfully subscribed to document notifications 10 | sdk: js 11 | version: 7 12 | runner: web 13 | -------------------------------------------------------------------------------- /doc/7/getting-started/webpack/snippets.disabled/create.test.yml: -------------------------------------------------------------------------------- 1 | name: gettingstarted#webpackcreate 2 | description: Creates a document 3 | hooks: 4 | before: | 5 | curl -XPOST kuzzle:7512/nyc-open-data/_create 6 | curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi 7 | after: 8 | template: doIt 9 | expected: New document successfully created! 10 | 11 | runner: webpack 12 | sdk: js 13 | version: 7 14 | -------------------------------------------------------------------------------- /doc/7/getting-started/webpack/snippets.disabled/init-kuzzle.test.yml: -------------------------------------------------------------------------------- 1 | name: gettingstarted#webpackinitkuzzle 2 | description: Creates an index and a collection 3 | hooks: 4 | before: curl -X DELETE kuzzle:7512/nyc-open-data 5 | after: 6 | template: empty 7 | expected: nyc-open-data/yellow-taxi ready! 8 | sdk: js 9 | version: 7 10 | runner: webpack 11 | -------------------------------------------------------------------------------- /doc/7/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: false 3 | type: root 4 | order: 0 5 | title: Javascript SDK v7.x 6 | description: Javascript SDK v7.x 7 | --- 8 | 9 | -------------------------------------------------------------------------------- /doc/7/protocols/http/constructor/snippets/constructor.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: http#constructor 3 | description: Creates a new Http instance 4 | hooks: 5 | before: 6 | after: 7 | template: empty 8 | expected: Success 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/protocols/http/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: Http 5 | description: Http protocol documentation 6 | order: 600 7 | --- 8 | 9 | 10 | -------------------------------------------------------------------------------- /doc/7/protocols/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: false 3 | type: branch 4 | order: 300 5 | title: Protocols 6 | description: Javascript SDK v7.x protocols 7 | --- 8 | 9 | 10 | -------------------------------------------------------------------------------- /doc/7/protocols/websocket/constructor/snippets/constructor.js: -------------------------------------------------------------------------------- 1 | // Loads the WebSocket protocol 2 | const 3 | { 4 | Kuzzle, 5 | WebSocket 6 | } = require('kuzzle-sdk'); 7 | 8 | const options = { 9 | autoReconnect: false 10 | }; 11 | 12 | // Instantiates the websocket protocol 13 | const websocketProtocol = new WebSocket('kuzzle', options); 14 | 15 | // Use it with Kuzzle 16 | const kuzzle = new Kuzzle(websocketProtocol); 17 | -------------------------------------------------------------------------------- /doc/7/protocols/websocket/constructor/snippets/constructor.test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: websocket#constructor 3 | description: Creates a new WebSocket instance 4 | hooks: 5 | before: 6 | after: 7 | template: empty 8 | expected: Success 9 | sdk: js 10 | version: 7 11 | -------------------------------------------------------------------------------- /doc/7/protocols/websocket/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | code: true 3 | type: branch 4 | title: WebSocket 5 | description: WebSocket protocol documentation 6 | order: 600 7 | --- 8 | 9 | 10 | -------------------------------------------------------------------------------- /doc/7/protocols/websocket/introduction/websocket-cookie-authentication.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuzzleio/sdk-javascript/c0aad86c7ca1df4ec07c19dd17e612efa461c289/doc/7/protocols/websocket/introduction/websocket-cookie-authentication.png -------------------------------------------------------------------------------- /doc/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | doc: 5 | image: kuzzleio/documentation:dev 6 | ports: 7 | - 8080:8080 8 | tty: true 9 | volumes: 10 | - cache:/var/app/node_modules/@vuepress/core/node_modules/.cache 11 | - ./7:/var/app/src/sdk/js/7 12 | 13 | volumes: 14 | cache: 15 | -------------------------------------------------------------------------------- /features/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "new-cap": 0 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/core/InstrumentablePromise.ts: -------------------------------------------------------------------------------- 1 | export class InstrumentablePromise { 2 | public promise: Promise; 3 | public resolve: (...any) => any; 4 | public reject: (...any) => any; 5 | 6 | constructor() { 7 | this.promise = new Promise((resolve, reject) => { 8 | this.resolve = resolve; 9 | this.reject = reject; 10 | }); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/protocols/DisconnectionOrigin.ts: -------------------------------------------------------------------------------- 1 | export enum DisconnectionOrigin { 2 | WEBSOCKET_AUTH_RENEWAL = "websocket/auth-renewal", 3 | USER_CONNECTION_CLOSED = "user/connection-closed", 4 | NETWORK_ERROR = "network/error", 5 | } 6 | -------------------------------------------------------------------------------- /src/protocols/abstract/PendingRequest.ts: -------------------------------------------------------------------------------- 1 | import { InstrumentablePromise } from "../../core/InstrumentablePromise"; 2 | import { RequestPayload } from "../../types/RequestPayload"; 3 | 4 | export class PendingRequest extends InstrumentablePromise { 5 | public request: RequestPayload; 6 | 7 | constructor(request: RequestPayload) { 8 | super(); 9 | 10 | this.request = request; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/protocols/index.ts: -------------------------------------------------------------------------------- 1 | export { default as WebSocket } from "./WebSocket"; 2 | export { default as Http } from "./Http"; 3 | -------------------------------------------------------------------------------- /src/types/ArgsDefault.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Generic API action arguments 3 | */ 4 | export interface ArgsDefault { 5 | queuable?: boolean; 6 | 7 | timeout?: number; 8 | 9 | [name: string]: any; 10 | } 11 | -------------------------------------------------------------------------------- /src/types/BaseRequest.ts: -------------------------------------------------------------------------------- 1 | import { JSONObject } from "./JSONObject"; 2 | 3 | export interface BaseRequest extends JSONObject { 4 | controller: string; 5 | 6 | action: string; 7 | 8 | body?: JSONObject; 9 | } 10 | -------------------------------------------------------------------------------- /src/types/JSONObject.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * An interface representing an object with string key and any value 3 | */ 4 | export type JSONObject = Record; 5 | -------------------------------------------------------------------------------- /src/utils/object.ts: -------------------------------------------------------------------------------- 1 | import { JSONObject } from "../types"; 2 | 3 | export function omit(object: JSONObject, omitted: string[]): JSONObject { 4 | const result = {}; 5 | 6 | for (const [key, value] of Object.entries(object)) { 7 | if (!omitted.includes(key)) { 8 | result[key] = value; 9 | } 10 | } 11 | 12 | return result; 13 | } 14 | -------------------------------------------------------------------------------- /src/utils/uuidv4.js: -------------------------------------------------------------------------------- 1 | // golfed version of uuid-v4 2 | // uuid node module relies on crypto, which is a bit fat to embed 3 | // 4 | // cf amazing https://gist.github.com/jed/982883 5 | 6 | const uuidv4 = (a) => 7 | a 8 | ? (a ^ ((Math.random() * 16) >> (a / 4))).toString(16) 9 | : ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, uuidv4); 10 | 11 | module.exports = { uuidv4 }; 12 | -------------------------------------------------------------------------------- /test/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "func-names": 0, 4 | "no-invalid-this": 0, 5 | "no-new": 0, 6 | "new-cap": 0, 7 | "no-console": 0 8 | }, 9 | "parserOptions": { 10 | "ecmaVersion": 2017 11 | }, 12 | "env": { 13 | "browser": true, 14 | "mocha": true 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "listEmittedFiles": true, 5 | "module": "commonjs", 6 | "target": "es2020", 7 | "moduleResolution": "node", 8 | "sourceMap": true, 9 | "baseUrl": ".", 10 | "resolveJsonModule": true, 11 | "esModuleInterop": true 12 | }, 13 | "rootDir": "src/", 14 | "include": ["index.ts", "src/**/*.ts"], 15 | "exclude": ["node_modules"] 16 | } 17 | --------------------------------------------------------------------------------