Skip to content

Commit 233f6e0

Browse files
author
DaB
committed
Merge pull request #48 from kuzzleio/KUZ-374-put-verb
Kuz 374 put verb
2 parents e26b668 + 2ac5a05 commit 233f6e0

File tree

11 files changed

+20
-20
lines changed

11 files changed

+20
-20
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Official Kuzzle Javascript SDK
55
======
66

7-
This SDK version requires Kuzzle v0.9 or higher.
7+
This SDK version requires Kuzzle v0.12 or higher.
88

99
## About Kuzzle
1010

dist/kuzzle.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,7 @@ KuzzleDataCollection.prototype.createDocument = function (id, document, options,
15611561
}
15621562

15631563
if (options) {
1564-
action = options.updateIfExist ? 'createOrUpdate' : 'create';
1564+
action = options.updateIfExist ? 'createOrReplace' : 'create';
15651565
}
15661566

15671567
if (id) {
@@ -1801,7 +1801,7 @@ KuzzleDataCollection.prototype.replaceDocument = function (documentId, content,
18011801
data = self.kuzzle.addHeaders(data, this.headers);
18021802

18031803
if (cb) {
1804-
self.kuzzle.query(this.buildQueryArgs('write', 'createOrUpdate'), data, options, function (err, res) {
1804+
self.kuzzle.query(this.buildQueryArgs('write', 'createOrReplace'), data, options, function (err, res) {
18051805
var document;
18061806

18071807
if (err) {
@@ -1813,7 +1813,7 @@ KuzzleDataCollection.prototype.replaceDocument = function (documentId, content,
18131813
cb(null, document);
18141814
});
18151815
} else {
1816-
self.kuzzle.query(this.buildQueryArgs('write', 'createOrUpdate'), data, options);
1816+
self.kuzzle.query(this.buildQueryArgs('write', 'createOrReplace'), data, options);
18171817
}
18181818

18191819
return this;
@@ -2038,7 +2038,7 @@ KuzzleDataMapping.prototype.apply = function (options, cb) {
20382038
options = null;
20392039
}
20402040

2041-
self.kuzzle.query(this.collection.buildQueryArgs('admin', 'putMapping'), data, options, function (err) {
2041+
self.kuzzle.query(this.collection.buildQueryArgs('admin', 'updateMapping'), data, options, function (err) {
20422042
if (err) {
20432043
return cb ? cb(err) : false;
20442044
}
@@ -2380,7 +2380,7 @@ KuzzleDocument.prototype.save = function (options, cb) {
23802380

23812381
data.persist = true;
23822382

2383-
self.kuzzle.query(this.dataCollection.buildQueryArgs('write', 'createOrUpdate'), data, options, function (error, res) {
2383+
self.kuzzle.query(this.dataCollection.buildQueryArgs('write', 'createOrReplace'), data, options, function (error, res) {
23842384
if (error) {
23852385
return cb ? cb(error) : false;
23862386
}

dist/kuzzle.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/kuzzle.min.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "kuzzle-sdk",
3-
"version": "1.3.9",
3+
"version": "1.4.0",
44
"description": "Official Javascript SDK for Kuzzle",
55
"author": "The Kuzzle Team <[email protected]>",
66
"repository": {

src/kuzzleDataCollection.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ KuzzleDataCollection.prototype.createDocument = function (id, document, options,
219219
}
220220

221221
if (options) {
222-
action = options.updateIfExist ? 'createOrUpdate' : 'create';
222+
action = options.updateIfExist ? 'createOrReplace' : 'create';
223223
}
224224

225225
if (id) {
@@ -459,7 +459,7 @@ KuzzleDataCollection.prototype.replaceDocument = function (documentId, content,
459459
data = self.kuzzle.addHeaders(data, this.headers);
460460

461461
if (cb) {
462-
self.kuzzle.query(this.buildQueryArgs('write', 'createOrUpdate'), data, options, function (err, res) {
462+
self.kuzzle.query(this.buildQueryArgs('write', 'createOrReplace'), data, options, function (err, res) {
463463
var document;
464464

465465
if (err) {
@@ -471,7 +471,7 @@ KuzzleDataCollection.prototype.replaceDocument = function (documentId, content,
471471
cb(null, document);
472472
});
473473
} else {
474-
self.kuzzle.query(this.buildQueryArgs('write', 'createOrUpdate'), data, options);
474+
self.kuzzle.query(this.buildQueryArgs('write', 'createOrReplace'), data, options);
475475
}
476476

477477
return this;

src/kuzzleDataMapping.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ KuzzleDataMapping.prototype.apply = function (options, cb) {
7373
options = null;
7474
}
7575

76-
self.kuzzle.query(this.collection.buildQueryArgs('admin', 'putMapping'), data, options, function (err) {
76+
self.kuzzle.query(this.collection.buildQueryArgs('admin', 'updateMapping'), data, options, function (err) {
7777
if (err) {
7878
return cb ? cb(err) : false;
7979
}

src/kuzzleDocument.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ KuzzleDocument.prototype.save = function (options, cb) {
254254

255255
data.persist = true;
256256

257-
self.kuzzle.query(this.dataCollection.buildQueryArgs('write', 'createOrUpdate'), data, options, function (error, res) {
257+
self.kuzzle.query(this.dataCollection.buildQueryArgs('write', 'createOrReplace'), data, options, function (error, res) {
258258
if (error) {
259259
return cb ? cb(error) : false;
260260
}

test/kuzzleDataCollection/methods.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ describe('KuzzleDataCollection methods', function () {
354354

355355
it('should be able to handle the updateIfExist option', function () {
356356
var collection = kuzzle.dataCollectionFactory(expectedQuery.collection);
357-
expectedQuery.action = 'createOrUpdate';
357+
expectedQuery.action = 'createOrReplace';
358358

359359
collection.createDocument(result.result._source, {updateIfExist: true});
360360
should(emitted).be.true();
@@ -706,7 +706,7 @@ describe('KuzzleDataCollection methods', function () {
706706
expectedQuery = {
707707
index: 'bar',
708708
collection: 'foo',
709-
action: 'createOrUpdate',
709+
action: 'createOrReplace',
710710
controller: 'write',
711711
body: {}
712712
};

test/kuzzleDataMapping/methods.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ describe('KuzzleDataMapping methods', function () {
5858
expectedQuery = {
5959
index: 'bar',
6060
collection: 'foo',
61-
action: 'putMapping',
61+
action: 'updateMapping',
6262
controller: 'admin',
6363
body: result.result._source
6464
};
6565
});
6666

67-
it('should call the right putMapping query when invoked', function (done) {
67+
it('should call the right updateMapping query when invoked', function (done) {
6868
var
6969
refreshed = false,
7070
mapping = new KuzzleDataMapping(dataCollection, result.result._source.properties);

0 commit comments

Comments
 (0)