Skip to content

Commit cf6f733

Browse files
author
Anthony Sendra
committed
rename metadata into volatile
1 parent 2b80f02 commit cf6f733

File tree

8 files changed

+39
-39
lines changed

8 files changed

+39
-39
lines changed

src/Collection.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Collection.prototype.create = function (options, cb) {
134134
* Create a new document in Kuzzle.
135135
*
136136
* Takes an optional argument object with the following properties:
137-
* - metadata (object, default: null):
137+
* - volatile (object, default: null):
138138
* Additional information passed to notifications to other users
139139
* - ifExist (string, allowed values: "error" (default), "replace"):
140140
* If the same document already exists:
@@ -209,7 +209,7 @@ Collection.prototype.createDocument = function (id, document, options, cb) {
209209
* That means that a document that was just been created won’t be returned by this function
210210
*
211211
* Takes an optional argument object with the following properties:
212-
* - metadata (object, default: null):
212+
* - volatile (object, default: null):
213213
* Additional information passed to notifications to other users
214214
*
215215
* @param {string|object} arg - Either a document ID (will delete only this particular document), or a set of filters
@@ -361,7 +361,7 @@ Collection.prototype.getMapping = function (options, cb) {
361361
* Publish a realtime message
362362
*
363363
* Takes an optional argument object with the following properties:
364-
* - metadata (object, default: null):
364+
* - volatile (object, default: null):
365365
* Additional information passed to notifications to other users
366366
*
367367
* @param {object} document - either a Document instance or a JSON object
@@ -388,7 +388,7 @@ Collection.prototype.publishMessage = function (document, options, cb) {
388388
* Replace an existing document with a new one.
389389
*
390390
* Takes an optional argument object with the following properties:
391-
* - metadata (object, default: null):
391+
* - volatile (object, default: null):
392392
* Additional information passed to notifications to other users
393393
*
394394
* @param {string} documentId - Unique document identifier of the document to replace
@@ -612,7 +612,7 @@ Collection.prototype.truncate = function (options, cb) {
612612
* Update parts of a document
613613
*
614614
* Takes an optional argument object with the following properties:
615-
* - metadata (object, default: null):
615+
* - volatile (object, default: null):
616616
* Additional information passed to notifications to other users
617617
*
618618
* @param {string} documentId - Unique document identifier of the document to update

src/Document.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Document.prototype.toString = function () {
127127
* Deletes this document in Kuzzle.
128128
*
129129
* Takes an optional argument object with the following properties:
130-
* - metadata (object, default: null):
130+
* - volatile (object, default: null):
131131
* Additional information passed to notifications to other users
132132
*
133133
* @param {object} [options] - Optional parameters
@@ -194,7 +194,7 @@ Document.prototype.refresh = function (options, cb) {
194194
* of this object.
195195
*
196196
* Takes an optional argument object with the following properties:
197-
* - metadata (object, default: null):
197+
* - volatile (object, default: null):
198198
* Additional information passed to notifications to other users
199199
*
200200
* @param {object} [options] - Optional parameters
@@ -231,7 +231,7 @@ Document.prototype.save = function (options, cb) {
231231
* Sends the content of this document as a realtime message.
232232
*
233233
* Takes an optional argument object with the following properties:
234-
* - metadata (object, default: null):
234+
* - volatile (object, default: null):
235235
* Additional information passed to notifications to other users
236236
*
237237
* @param {object} [options] - Optional parameters

src/Kuzzle.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ function Kuzzle (host, options, cb) {
146146
enumerable: true,
147147
writable: true
148148
},
149-
metadata: {
149+
volatile: {
150150
value: {},
151151
enumerable: true,
152152
writable: true
@@ -1252,7 +1252,7 @@ Kuzzle.prototype.now = function (options, cb) {
12521252
* Base method used to send read queries to Kuzzle
12531253
*
12541254
* Takes an optional argument object with the following properties:
1255-
* - metadata (object, default: null):
1255+
* - volatile (object, default: null):
12561256
* Additional information passed to notifications to other users
12571257
*
12581258
* @param {object} queryArgs - Query configuration
@@ -1266,7 +1266,7 @@ Kuzzle.prototype.query = function (queryArgs, query, options, cb) {
12661266
object = {
12671267
action: queryArgs.action,
12681268
controller: queryArgs.controller,
1269-
metadata: this.metadata
1269+
volatile: this.volatile
12701270
},
12711271
self = this;
12721272

@@ -1302,9 +1302,9 @@ Kuzzle.prototype.query = function (queryArgs, query, options, cb) {
13021302
object.scrollId = options.scrollId;
13031303
}
13041304

1305-
if (options.metadata) {
1306-
Object.keys(options.metadata).forEach(function (meta) {
1307-
object.metadata[meta] = options.metadata[meta];
1305+
if (options.volatile) {
1306+
Object.keys(options.volatile).forEach(function (meta) {
1307+
object.volatile[meta] = options.volatile[meta];
13081308
});
13091309
}
13101310
}
@@ -1313,14 +1313,14 @@ Kuzzle.prototype.query = function (queryArgs, query, options, cb) {
13131313
throw new Error('Invalid query parameter: ' + query);
13141314
}
13151315

1316-
if (query.metadata) {
1317-
Object.keys(query.metadata).forEach(function (meta) {
1318-
object.metadata[meta] = query.metadata[meta];
1316+
if (query.volatile) {
1317+
Object.keys(query.volatile).forEach(function (meta) {
1318+
object.volatile[meta] = query.volatile[meta];
13191319
});
13201320
}
13211321

13221322
for (attr in query) {
1323-
if (attr !== 'metadata' && query.hasOwnProperty(attr)) {
1323+
if (attr !== 'volatile' && query.hasOwnProperty(attr)) {
13241324
object[attr] = query[attr];
13251325
}
13261326
}

src/Room.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ function Room(collection, options) {
9191
enumerable: true,
9292
writable: true
9393
},
94-
metadata: {
95-
value: (options && options.metadata) ? options.metadata : {},
94+
volatile: {
95+
value: (options && options.volatile) ? options.volatile : {},
9696
enumerable: true,
9797
writable: true
9898
},
@@ -214,7 +214,7 @@ Room.prototype.renew = function (filters, notificationCB, cb) {
214214
subscribeQuery.body = self.filters;
215215
subscribeQuery = self.kuzzle.addHeaders(subscribeQuery, this.headers);
216216

217-
self.kuzzle.query(self.collection.buildQueryArgs('realtime', 'subscribe'), subscribeQuery, {metadata: self.metadata}, function (error, response) {
217+
self.kuzzle.query(self.collection.buildQueryArgs('realtime', 'subscribe'), subscribeQuery, {volatile: self.volatile}, function (error, response) {
218218
delete self.kuzzle.subscriptions.pending[self.id];
219219
self.subscribing = false;
220220

test/Room/constructor.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('Room constructor', function () {
2121
it('should handle provided arguments correctly', function () {
2222
var room = new Room(collection);
2323

24-
should(room.metadata).be.an.Object().and.be.empty();
24+
should(room.volatile).be.an.Object().and.be.empty();
2525
should(room.subscribeToSelf).be.true();
2626
should(room.scope).be.exactly('all');
2727
should(room.state).be.exactly('done');
@@ -35,11 +35,11 @@ describe('Room constructor', function () {
3535
scope: 'in',
3636
state: 'pending',
3737
users: 'all',
38-
metadata: {some: 'metadata'},
38+
volatile: {some: 'metadata'},
3939
subscribeToSelf: false
4040
});
4141

42-
should(room.metadata).match({some: 'metadata'});
42+
should(room.volatile).match({some: 'metadata'});
4343
should(room.subscribeToSelf).be.false();
4444
should(room.scope).be.exactly('in');
4545
should(room.state).be.exactly('pending');
@@ -55,7 +55,7 @@ describe('Room constructor', function () {
5555
should(room).have.propertyWithDescriptor('scope', {enumerable: false, writable: false, configurable: false});
5656
should(room).have.propertyWithDescriptor('state', {enumerable: false, writable: false, configurable: false});
5757
should(room).have.propertyWithDescriptor('users', {enumerable: false, writable: false, configurable: false});
58-
should(room).have.propertyWithDescriptor('metadata', {enumerable: true, writable: true, configurable: false});
58+
should(room).have.propertyWithDescriptor('volatile', {enumerable: true, writable: true, configurable: false});
5959
should(room).have.propertyWithDescriptor('subscribeToSelf', {
6060
enumerable: true,
6161
writable: true,

test/kuzzle/constructor.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('Kuzzle constructor', function () {
6565
should(kuzzle).have.propertyWithDescriptor('queueMaxSize', { enumerable: true, writable: true, configurable: false });
6666
should(kuzzle).have.propertyWithDescriptor('queueTTL', { enumerable: true, writable: true, configurable: false });
6767
should(kuzzle).have.propertyWithDescriptor('headers', { enumerable: true, writable: true, configurable: false });
68-
should(kuzzle).have.propertyWithDescriptor('metadata', { enumerable: true, writable: true, configurable: false });
68+
should(kuzzle).have.propertyWithDescriptor('volatile', { enumerable: true, writable: true, configurable: false });
6969
should(kuzzle).have.propertyWithDescriptor('replayInterval', { enumerable: true, writable: true, configurable: false });
7070
should(kuzzle).have.propertyWithDescriptor('reconnectionDelay', { enumerable: true, writable: true, configurable: false });
7171
should(kuzzle).have.propertyWithDescriptor('jwtToken', { enumerable: true, writable: true, configurable: false });
@@ -84,7 +84,7 @@ describe('Kuzzle constructor', function () {
8484
should(kuzzle.queueTTL).be.exactly(120000);
8585
should(kuzzle.queueMaxSize).be.exactly(500);
8686
should(kuzzle.headers).be.an.Object().and.be.empty();
87-
should(kuzzle.metadata).be.an.Object().and.be.empty();
87+
should(kuzzle.volatile).be.an.Object().and.be.empty();
8888
should(kuzzle.replayInterval).be.exactly(10);
8989
should(kuzzle.reconnectionDelay).be.exactly(1000);
9090
should(kuzzle.defaultIndex).be.undefined();
@@ -102,7 +102,7 @@ describe('Kuzzle constructor', function () {
102102
queueTTL: 123,
103103
queueMaxSize: 42,
104104
headers: {foo: 'bar'},
105-
metadata: {foo: ['bar', 'baz', 'qux'], bar: 'foo'},
105+
volatile: {foo: ['bar', 'baz', 'qux'], bar: 'foo'},
106106
replayInterval: 99999,
107107
reconnectionDelay: 666,
108108
defaultIndex: 'foobar',
@@ -119,7 +119,7 @@ describe('Kuzzle constructor', function () {
119119
should(kuzzle.queueTTL).be.exactly(options.queueTTL);
120120
should(kuzzle.queueMaxSize).be.exactly(options.queueMaxSize);
121121
should(kuzzle.headers).be.an.Object().and.match(options.headers);
122-
should(kuzzle.metadata).be.an.Object().and.match(options.metadata);
122+
should(kuzzle.volatile).be.an.Object().and.match(options.volatile);
123123
should(kuzzle.replayInterval).be.exactly(options.replayInterval);
124124
should(kuzzle.reconnectionDelay).be.exactly(options.reconnectionDelay);
125125
should(kuzzle.port).be.exactly(options.port);

test/kuzzle/methods.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe('Kuzzle methods', function () {
7171
should(emitted).be.true();
7272

7373
emitted = false;
74-
passedOptions = {queuable: true, metadata: {foo: 'bar'}};
74+
passedOptions = {queuable: true, volatile: {foo: 'bar'}};
7575
kuzzle.getAllStatistics(passedOptions, function () {});
7676
});
7777

test/kuzzle/query.test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ describe('Query management', function () {
166166
should(function () { kuzzle.query(queryArgs, 'foobar'); }).throw(Error);
167167
});
168168

169-
it('should handle options metadata properly', function () {
169+
it('should handle options volatile properly', function () {
170170
var
171-
metadata = {
171+
volatile = {
172172
foo: 'bar',
173173
baz: ['foo', 'bar', 'qux']
174174
};
175175

176-
kuzzle.query(queryArgs, { body: { some: 'query'}}, {metadata: metadata});
177-
should(requestObject.metadata).match(metadata);
176+
kuzzle.query(queryArgs, { body: { some: 'query'}}, {volatile: volatile});
177+
should(requestObject.volatile).match(volatile);
178178
});
179179

180180
it('should handle option refresh properly', function () {
@@ -207,16 +207,16 @@ describe('Query management', function () {
207207
should(emitted).be.false();
208208
});
209209

210-
it('should copy query local metadata over optional ones', function () {
210+
it('should copy query local volatile over optional ones', function () {
211211
var
212-
metadata = {
212+
volatile = {
213213
foo: 'bar',
214214
baz: ['foo', 'bar', 'qux']
215215
};
216216

217-
kuzzle.query(queryArgs, { body: { some: 'query'}, metadata: {foo: 'foo'}}, {metadata: metadata});
218-
should(requestObject.metadata.foo).be.exactly('foo');
219-
should(requestObject.metadata.baz).match(metadata.baz);
217+
kuzzle.query(queryArgs, { body: { some: 'query'}, volatile: {foo: 'foo'}}, {volatile: volatile});
218+
should(requestObject.volatile.foo).be.exactly('foo');
219+
should(requestObject.volatile.baz).match(volatile.baz);
220220
});
221221

222222
it('should not define optional members if none was provided', function () {

0 commit comments

Comments
 (0)