Skip to content

Commit b9f2453

Browse files
committed
fix: 🐛 node fetch issue resolved
1 parent c3ee938 commit b9f2453

13 files changed

Lines changed: 58 additions & 47 deletions

File tree

dist/nativescript/contentstack.js

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

dist/react-native/contentstack.js

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

dist/web/contentstack.js

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

examples/node/contentstack-demo.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class ContentstackDemo {
1515
//console.log("datattatata", Contentstack.Region.EUROPE)
1616

1717
this.Stack = Contentstack.Stack(...config);
18-
console.log(Contentstack.Utils.render());
1918
}
2019

2120

package-lock.json

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

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "contentstack",
3-
"version": "3.13.0",
3+
"version": "3.13.1",
44
"description": "Contentstack Javascript SDK",
55
"homepage": "https://www.contentstack.com/",
66
"author": {
@@ -22,7 +22,8 @@
2222
"buildnativescript": "webpack --config webpack/webpack.nativescript.js",
2323
"build": "NODE_ENV=production && npm run buildnode && npm run buildweb && npm run buildreactnative && npm run buildnativescript",
2424
"generate-docs": "node_modules/.bin/jsdoc --configure docs-config.json --verbose",
25-
"prepare": "npm run build"
25+
"prepare": "npm run build",
26+
"pretest": "npm run build"
2627
},
2728
"repository": {
2829
"type": "git",
@@ -99,7 +100,7 @@
99100
"dependencies": {
100101
"@contentstack/utils": "1.0.0",
101102
"es6-promise": "4.1.1",
102-
"localStorage": "1.0.3",
103-
"node-fetch": "^2.6.1"
103+
"isomorphic-fetch": "^3.0.0",
104+
"localStorage": "1.0.3"
104105
}
105106
}

src/core/lib/request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async function safeParseJSON(response) {
6161
const body = await response.text();
6262
}
6363
function fetchRetry(url, headers, retryDelay = 300, retryLimit = 5, fetchOptions, resolve, reject) {
64-
var option = Object.assign({
64+
var option = Utils.mergeDeep({
6565
method: 'GET',
6666
headers: headers,
6767
timeout: 30000,

src/core/lib/utils.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,7 @@ export function sendRequest(queryObject, options) {
238238
let tojson = (typeof self.tojson !== 'undefined') ? self.tojson : false;
239239
let isSingle = (self.entry_uid || self.singleEntry || self.asset_uid) ? true : false;
240240
let hashQuery = getHash(parseQueryFromParams(self, isSingle, tojson));
241-
if (queryObject.requestParams.url.includes(config.urls.sync)) {
242-
cachePolicy = -1;
243-
}
241+
244242
/**
245243
for new api v3
246244
*/

src/core/modules/assets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export default class Assets {
118118
query: this._query
119119
}
120120
}
121-
var options = Object.assign({}, this.fetchOptions, fetchOptions);
121+
var options = Utils.mergeDeep({}, this.fetchOptions, fetchOptions);
122122
return Utils.sendRequest(this, options);
123123
} else {
124124
console.error("Kindly provide an asset uid. e.g. .Assets('bltsomething123')");

src/core/modules/entry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ export default class Entry {
341341
query: this._query
342342
}
343343
};
344-
var options = Object.assign({}, this.fetchOptions, fetchOptions);
344+
var options = Utils.mergeDeep({}, this.fetchOptions, fetchOptions);
345345
return Utils.sendRequest(this, options);
346346
} else {
347347
console.error("Kindly provide an entry uid. e.g. .Entry('bltsomething123')");

0 commit comments

Comments
 (0)