Skip to content

Commit b7a39f3

Browse files
committed
Merge pull request #46 from kuzzleio/KUZ372_removePutMapping
removed the dataCollection.putMapping method
2 parents 1018cbe + 4f0efd0 commit b7a39f3

File tree

6 files changed

+4
-117
lines changed

6 files changed

+4
-117
lines changed

dist/kuzzle.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,29 +1760,6 @@ KuzzleDataCollection.prototype.publishMessage = function (document, options) {
17601760
return this;
17611761
};
17621762

1763-
/**
1764-
* Applies a new mapping to the data collection.
1765-
* Note that you cannot delete an existing mapping, you can only add or update one.
1766-
*
1767-
* @param {object} mapping - mapping to apply
1768-
* @param {object} [options] - optional arguments
1769-
* @param {responseCallback} [cb] - Returns an instantiated KuzzleDataMapping object
1770-
* @returns {*} this
1771-
*/
1772-
KuzzleDataCollection.prototype.putMapping = function (mapping, options, cb) {
1773-
var dataMapping;
1774-
1775-
if (!cb && typeof options === 'function') {
1776-
cb = options;
1777-
options = null;
1778-
}
1779-
1780-
dataMapping = new KuzzleDataMapping(this, mapping);
1781-
dataMapping.apply(options, cb);
1782-
1783-
return this;
1784-
};
1785-
17861763
/**
17871764
* Replace an existing document with a new one.
17881765
*

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.7",
3+
"version": "1.3.8",
44
"description": "Official Javascript SDK for Kuzzle",
55
"author": "The Kuzzle Team <[email protected]>",
66
"repository": {

src/kuzzleDataCollection.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -430,29 +430,6 @@ KuzzleDataCollection.prototype.publishMessage = function (document, options) {
430430
return this;
431431
};
432432

433-
/**
434-
* Applies a new mapping to the data collection.
435-
* Note that you cannot delete an existing mapping, you can only add or update one.
436-
*
437-
* @param {object} mapping - mapping to apply
438-
* @param {object} [options] - optional arguments
439-
* @param {responseCallback} [cb] - Returns an instantiated KuzzleDataMapping object
440-
* @returns {*} this
441-
*/
442-
KuzzleDataCollection.prototype.putMapping = function (mapping, options, cb) {
443-
var dataMapping;
444-
445-
if (!cb && typeof options === 'function') {
446-
cb = options;
447-
options = null;
448-
}
449-
450-
dataMapping = new KuzzleDataMapping(this, mapping);
451-
dataMapping.apply(options, cb);
452-
453-
return this;
454-
};
455-
456433
/**
457434
* Replace an existing document with a new one.
458435
*

test/kuzzleDataCollection/methods.test.js

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -696,73 +696,6 @@ describe('KuzzleDataCollection methods', function () {
696696
});
697697
});
698698

699-
describe('#putMapping', function () {
700-
var
701-
KuzzleDataCollectionProxyquired,
702-
collection;
703-
704-
beforeEach(function () {
705-
expectedQuery = {
706-
index: 'bar',
707-
collection: 'foo',
708-
action: 'putMapping',
709-
controller: 'admin',
710-
body: {}
711-
};
712-
713-
KuzzleDataCollectionProxyquired = proxyquire('../../src/kuzzleDataCollection', {
714-
'./kuzzleDataMapping': function (c, m) {
715-
var dm = new KuzzleDataMapping(c, m);
716-
717-
dm.refresh = function (options, cb) {
718-
cb(null, result);
719-
};
720-
return dm;
721-
}
722-
});
723-
724-
kuzzle = new Kuzzle('foo', {defaultIndex: 'bar'});
725-
collection = new KuzzleDataCollectionProxyquired(kuzzle, expectedQuery.index, expectedQuery.collection);
726-
kuzzle.query = queryStub;
727-
emitted = false;
728-
result = { result: {_source: { properties: {}}}};
729-
error = null;
730-
});
731-
732-
it('should instantiate a new KuzzleDataMapping object', function (done) {
733-
var
734-
options = { queuable: false };
735-
736-
expectedQuery.options = options;
737-
738-
should(collection.putMapping(result.result, options, function (err, res) {
739-
should(err).be.null();
740-
done();
741-
})).be.exactly(collection);
742-
should(emitted).be.true();
743-
});
744-
745-
it('should handle the callback argument correctly', function () {
746-
collection.putMapping(result.result, function () {});
747-
should(emitted).be.true();
748-
749-
emitted = false;
750-
collection.putMapping(result.result, {}, function () {});
751-
should(emitted).be.true();
752-
});
753-
754-
it('should call the callback with an error if one occurs', function (done) {
755-
error = 'foobar';
756-
this.timeout(50);
757-
758-
collection.putMapping({}, function (err, res) {
759-
should(err).be.exactly('foobar');
760-
should(res).be.undefined();
761-
done();
762-
});
763-
});
764-
});
765-
766699
describe('#replaceDocument', function () {
767700
beforeEach(function () {
768701
kuzzle = new Kuzzle('foo', {defaultIndex: 'bar'});

0 commit comments

Comments
 (0)