Skip to content

Commit 86291a5

Browse files
Rohit MishraRohit Mishra
Rohit Mishra
authored and
Rohit Mishra
committed
updated in query file
1 parent 35c18bf commit 86291a5

File tree

15 files changed

+90
-102
lines changed

15 files changed

+90
-102
lines changed

dist/native-script/contentstack.js

+21-24
Original file line numberDiff line numberDiff line change
@@ -785,12 +785,13 @@ var Stack = function () {
785785
}, {
786786
key: 'Assets',
787787
value: function Assets(uid) {
788-
var asset = new _assets2.default();
789788
this.type = 'asset';
790789
if (uid && typeof uid === "string") {
790+
var asset = new _assets2.default();
791791
asset.asset_uid = uid;
792+
return Utils.merge(asset, this);
792793
}
793-
return Utils.merge(asset, this);
794+
return this;
794795
}
795796

796797
/**
@@ -1472,7 +1473,6 @@ var Query = function (_Entry) {
14721473

14731474
_this._query = _this._query || {};
14741475
_this._query['query'] = _this._query['query'] || {};
1475-
14761476
/**
14771477
* @method lessThan
14781478
* @description This method provides only the entries with values less than the specified value for a field.
@@ -2448,30 +2448,27 @@ var Assets = function () {
24482448
* @example Assets().Query()
24492449
* @returns {Query}
24502450
*/
2451+
// Query() {
2452+
// let query = new Query();
2453+
// return Utils.merge(query, this);
2454+
// }
24512455

2456+
/**
2457+
* @method toJSON
2458+
* @description This method is used to convert the result in to plain javascript object.
2459+
* @example
2460+
* assetQuery
2461+
* .toJSON()
2462+
* .then(function (result) {
2463+
* let value = result.get(field_uid)
2464+
* },function (error) {
2465+
* // error function
2466+
* })
2467+
* @returns {Object}
2468+
*/
24522469

2453-
_createClass(Assets, [{
2454-
key: 'Query',
2455-
value: function Query() {
2456-
var query = new _query2.default();
2457-
return Utils.merge(query, this);
2458-
}
24592470

2460-
/**
2461-
* @method toJSON
2462-
* @description This method is used to convert the result in to plain javascript object.
2463-
* @example
2464-
* assetQuery
2465-
* .toJSON()
2466-
* .then(function (result) {
2467-
* let value = result.get(field_uid)
2468-
* },function (error) {
2469-
* // error function
2470-
* })
2471-
* @returns {Object}
2472-
*/
2473-
2474-
}, {
2471+
_createClass(Assets, [{
24752472
key: 'toJSON',
24762473
value: function toJSON() {
24772474
this.tojson = true;

dist/node/contentstack.js

+21-24
Original file line numberDiff line numberDiff line change
@@ -796,12 +796,13 @@ var Stack = function () {
796796
}, {
797797
key: 'Assets',
798798
value: function Assets(uid) {
799-
var asset = new _assets2.default();
800799
this.type = 'asset';
801800
if (uid && typeof uid === "string") {
801+
var asset = new _assets2.default();
802802
asset.asset_uid = uid;
803+
return Utils.merge(asset, this);
803804
}
804-
return Utils.merge(asset, this);
805+
return this;
805806
}
806807

807808
/**
@@ -1938,7 +1939,6 @@ var Query = function (_Entry) {
19381939

19391940
_this._query = _this._query || {};
19401941
_this._query['query'] = _this._query['query'] || {};
1941-
19421942
/**
19431943
* @method lessThan
19441944
* @description This method provides only the entries with values less than the specified value for a field.
@@ -7121,30 +7121,27 @@ var Assets = function () {
71217121
* @example Assets().Query()
71227122
* @returns {Query}
71237123
*/
7124+
// Query() {
7125+
// let query = new Query();
7126+
// return Utils.merge(query, this);
7127+
// }
71247128

7129+
/**
7130+
* @method toJSON
7131+
* @description This method is used to convert the result in to plain javascript object.
7132+
* @example
7133+
* assetQuery
7134+
* .toJSON()
7135+
* .then(function (result) {
7136+
* let value = result.get(field_uid)
7137+
* },function (error) {
7138+
* // error function
7139+
* })
7140+
* @returns {Object}
7141+
*/
71257142

7126-
_createClass(Assets, [{
7127-
key: 'Query',
7128-
value: function Query() {
7129-
var query = new _query2.default();
7130-
return Utils.merge(query, this);
7131-
}
71327143

7133-
/**
7134-
* @method toJSON
7135-
* @description This method is used to convert the result in to plain javascript object.
7136-
* @example
7137-
* assetQuery
7138-
* .toJSON()
7139-
* .then(function (result) {
7140-
* let value = result.get(field_uid)
7141-
* },function (error) {
7142-
* // error function
7143-
* })
7144-
* @returns {Object}
7145-
*/
7146-
7147-
}, {
7144+
_createClass(Assets, [{
71487145
key: 'toJSON',
71497146
value: function toJSON() {
71507147
this.tojson = true;

dist/react-native/contentstack.js

+21-24
Original file line numberDiff line numberDiff line change
@@ -785,12 +785,13 @@ var Stack = function () {
785785
}, {
786786
key: 'Assets',
787787
value: function Assets(uid) {
788-
var asset = new _assets2.default();
789788
this.type = 'asset';
790789
if (uid && typeof uid === "string") {
790+
var asset = new _assets2.default();
791791
asset.asset_uid = uid;
792+
return Utils.merge(asset, this);
792793
}
793-
return Utils.merge(asset, this);
794+
return this;
794795
}
795796

796797
/**
@@ -1472,7 +1473,6 @@ var Query = function (_Entry) {
14721473

14731474
_this._query = _this._query || {};
14741475
_this._query['query'] = _this._query['query'] || {};
1475-
14761476
/**
14771477
* @method lessThan
14781478
* @description This method provides only the entries with values less than the specified value for a field.
@@ -2448,30 +2448,27 @@ var Assets = function () {
24482448
* @example Assets().Query()
24492449
* @returns {Query}
24502450
*/
2451+
// Query() {
2452+
// let query = new Query();
2453+
// return Utils.merge(query, this);
2454+
// }
24512455

2456+
/**
2457+
* @method toJSON
2458+
* @description This method is used to convert the result in to plain javascript object.
2459+
* @example
2460+
* assetQuery
2461+
* .toJSON()
2462+
* .then(function (result) {
2463+
* let value = result.get(field_uid)
2464+
* },function (error) {
2465+
* // error function
2466+
* })
2467+
* @returns {Object}
2468+
*/
24522469

2453-
_createClass(Assets, [{
2454-
key: 'Query',
2455-
value: function Query() {
2456-
var query = new _query2.default();
2457-
return Utils.merge(query, this);
2458-
}
24592470

2460-
/**
2461-
* @method toJSON
2462-
* @description This method is used to convert the result in to plain javascript object.
2463-
* @example
2464-
* assetQuery
2465-
* .toJSON()
2466-
* .then(function (result) {
2467-
* let value = result.get(field_uid)
2468-
* },function (error) {
2469-
* // error function
2470-
* })
2471-
* @returns {Object}
2472-
*/
2473-
2474-
}, {
2471+
_createClass(Assets, [{
24752472
key: 'toJSON',
24762473
value: function toJSON() {
24772474
this.tojson = true;

dist/web/contentstack.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/node/contentstack-demo.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ContentstackDemo {
2323
*/
2424
getEntries(contentTypeUid) {
2525
contentTypeUid = contentTypeUid || 'source'
26-
return this.Stack.ContentType(contentTypeUid).Query().toJSON().find()
26+
return this.Stack.ContentType(contentTypeUid).Query().where('title', "hometestfinal").toJSON().find()
2727
}
2828

2929
/**
@@ -55,7 +55,7 @@ class ContentstackDemo {
5555
*/
5656
getAsset(assetUid) {
5757
assetUid = assetUid || 'blt123something'
58-
return this.Stack.Assets(assetUid).fetch()
58+
return this.Stack.Assets(assetUid).addParam('include_dimension', 'true').fetch()
5959
}
6060

6161
}

js-sdk-reference/global.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,7 @@ <h5>Parameters:</h5>
13311331

13321332
<h5>Example</h5>
13331333

1334-
<pre class="prettyprint"><code>Stack.Assets('blt1234567890abcef')</code></pre>
1334+
<pre class="prettyprint"><code>Stack.Assets('blt1234567890abcef').fetch</code></pre>
13351335

13361336

13371337

@@ -3069,7 +3069,7 @@ <h5>Example</h5>
30693069

30703070

30713071

3072-
<h4 class="name" id="AddParam"><span class="type-signature"></span>AddParam<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="global.html#Query">Query</a>}</span></h4>
3072+
<h4 class="name" id="AddParam"><span class="type-signature"></span>AddParam<span class="signature">()</span><span class="type-signature"></span></h4>
30733073

30743074

30753075

@@ -3138,7 +3138,7 @@ <h4 class="name" id="AddParam"><span class="type-signature"></span>AddParam<span
31383138

31393139
<h5>Example</h5>
31403140

3141-
<pre class="prettyprint"><code>blogQuery.addParam('include_count', 'true')</code></pre>
3141+
<pre class="prettyprint"><code>blogQuery.addParam('include_count', 'true').fetch()</code></pre>
31423142

31433143

31443144

js-sdk-reference/modules_assets.js.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ <h1 class="page-title">modules/assets.js</h1>
7979
* @example Assets().Query()
8080
* @returns {Query}
8181
*/
82-
Query() {
83-
let query = new Query();
84-
return Utils.merge(query, this);
85-
}
82+
// Query() {
83+
// let query = new Query();
84+
// return Utils.merge(query, this);
85+
// }
8686

8787
/**
8888
* @method toJSON

js-sdk-reference/modules_entry.js.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,7 @@ <h1 class="page-title">modules/entry.js</h1>
233233
/**
234234
* @method AddParam
235235
* @description This method includes query parameter in query.
236-
* @example blogQuery.addParam('include_count', 'true')
237-
* @returns {Query}
236+
* @example blogQuery.addParam('include_count', 'true').fetch()
238237
*/
239238
addParam(key, value) {
240239
if (key &amp;&amp; value &amp;&amp; typeof key === 'string' &amp;&amp; typeof value === 'string') {

js-sdk-reference/modules_query.js.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ <h1 class="page-title">modules/query.js</h1>
129129
* @ignore
130130
*/
131131
export default class Query extends Entry {
132+
132133
constructor() {
133134
super();
134135
this._query = this._query || {};
135136
this._query['query'] = this._query['query'] || {};
136-
137137
/**
138138
* @method lessThan
139139
* @description This method provides only the entries with values less than the specified value for a field.

js-sdk-reference/stack.js.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -248,16 +248,17 @@ <h1 class="page-title">stack.js</h1>
248248
* @method Assets
249249
* @description Set the Asset Uid which you want to retrive the Asset.
250250
* @param {String} uid - asset_uid
251-
* @example Stack.Assets('blt1234567890abcef')
251+
* @example Stack.Assets('blt1234567890abcef').fetch
252252
* @returns {Assets}
253253
*/
254254
Assets(uid) {
255-
let asset = new Assets();
256255
this.type = 'asset';
257256
if (uid &amp;&amp; typeof uid === "string") {
257+
let asset = new Assets();
258258
asset.asset_uid = uid;
259+
return Utils.merge(asset, this);
259260
}
260-
return Utils.merge(asset, this);
261+
return this;
261262
}
262263

263264
/**

src/core/modules/assets.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ export default class Assets {
4040
* @example Assets().Query()
4141
* @returns {Query}
4242
*/
43-
Query() {
44-
let query = new Query();
45-
return Utils.merge(query, this);
46-
}
43+
// Query() {
44+
// let query = new Query();
45+
// return Utils.merge(query, this);
46+
// }
4747

4848
/**
4949
* @method toJSON

src/core/modules/query.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ const _extend = {
9090
* @ignore
9191
*/
9292
export default class Query extends Entry {
93+
9394
constructor() {
9495
super();
9596
this._query = this._query || {};
9697
this._query['query'] = this._query['query'] || {};
97-
9898
/**
9999
* @method lessThan
100100
* @description This method provides only the entries with values less than the specified value for a field.

src/core/stack.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,17 @@ export default class Stack {
209209
* @method Assets
210210
* @description Set the Asset Uid which you want to retrive the Asset.
211211
* @param {String} uid - asset_uid
212-
* @example Stack.Assets('blt1234567890abcef')
212+
* @example Stack.Assets('blt1234567890abcef').fetch
213213
* @returns {Assets}
214214
*/
215215
Assets(uid) {
216-
let asset = new Assets();
217216
this.type = 'asset';
218217
if (uid && typeof uid === "string") {
218+
let asset = new Assets();
219219
asset.asset_uid = uid;
220+
return Utils.merge(asset, this);
220221
}
221-
return Utils.merge(asset, this);
222+
return this;
222223
}
223224

224225
/**

test/asset/find.js

-4
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ test('.ascending()', function(assert) {
5555
.toJSON()
5656
.find()
5757
.then(function success(assets) {
58-
// assert.ok("assets" in result, 'assets key present in the resultset');
59-
// assert.equal(Utils.isassetsPublished(assets[0], Stack.environment_uid, 'en-us'), true, "assets present in the resultset are published.");
6058
assert.ok(assets[0].length, 'assets present in the resultset');
6159
if (assets && assets.length && assets[0].length) {
6260
var prev = assets[0][0][field];
@@ -78,7 +76,6 @@ test('.ascending()', function(assert) {
7876
test('.descending()', function(assert) {
7977
var Query = Stack.Assets().Query(),
8078
field = 'created_at';
81-
8279
Query
8380
.descending(field)
8481
.toJSON()
@@ -267,7 +264,6 @@ test('.notEqualTo()', function(assert) {
267264

268265
test('.where()', function(assert) {
269266
var Query = Stack.Assets().Query();
270-
271267
Query
272268
.where('title', "image1")
273269
.toJSON()

test/report.json

+1-1
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)