@aws-amplify/amplify-appsync-simulator
Advanced tools
Comparing version 2.5.0-rc.88f873875.0 to 2.5.0-rc.c212c3d66.0
@@ -7,8 +7,8 @@ "use strict"; | ||
exports.generalUtils = void 0; | ||
const uuid_1 = require("uuid"); | ||
const js_string_escape_1 = __importDefault(require("js-string-escape")); | ||
const errors_1 = require("./errors"); | ||
const uuid_1 = require("uuid"); | ||
const string_1 = require("../value-mapper/string"); | ||
const array_1 = require("../value-mapper/array"); | ||
const map_1 = require("../value-mapper/map"); | ||
const js_string_escape_1 = __importDefault(require("js-string-escape")); | ||
exports.generalUtils = { | ||
@@ -22,5 +22,3 @@ errors: [], | ||
urlEncode(value) { | ||
return encodeURIComponent(value).replace(/[!'()]/g, function (c) { | ||
return '%' + c.charCodeAt(0).toString(16).toUpperCase(); | ||
}); | ||
return encodeURIComponent(value).replace(/[!'()]/g, c => `%${c.charCodeAt(0).toString(16).toUpperCase()}`); | ||
}, | ||
@@ -37,3 +35,8 @@ urlDecode(value) { | ||
parseJson(value) { | ||
return JSON.parse(value); | ||
try { | ||
return JSON.parse(value); | ||
} | ||
catch (_) { | ||
return null; | ||
} | ||
}, | ||
@@ -73,3 +76,3 @@ toJson(value) { | ||
isNull(value) { | ||
return value === null || typeof value == 'undefined'; | ||
return value === null || typeof value === 'undefined'; | ||
}, | ||
@@ -80,6 +83,6 @@ isNullOrEmpty(value) { | ||
if (value instanceof map_1.JavaMap) { | ||
return Object.keys(value.toJSON()).length == 0; | ||
return Object.keys(value.toJSON()).length === 0; | ||
} | ||
if (value instanceof array_1.JavaArray || value instanceof string_1.JavaString) { | ||
return value.toJSON().length == 0; | ||
return value.toJSON().length === 0; | ||
} | ||
@@ -145,5 +148,5 @@ return !!value; | ||
}; | ||
function filterData(info, data = null) { | ||
const filterData = (info, data = null) => { | ||
if (data instanceof map_1.JavaMap) { | ||
var filteredData = {}; | ||
const filteredData = {}; | ||
info.operation.selectionSet.selections | ||
@@ -153,7 +156,9 @@ .map(selection => selection) | ||
.selectionSet.selections.map(fieldNode => fieldNode.name.value) | ||
.forEach(field => (filteredData[field] = data.get(field))); | ||
.forEach(field => { | ||
filteredData[field] = data.get(field); | ||
}); | ||
data = filteredData; | ||
} | ||
return data; | ||
} | ||
}; | ||
//# sourceMappingURL=general-utils.js.map |
{ | ||
"name": "@aws-amplify/amplify-appsync-simulator", | ||
"version": "2.5.0-rc.88f873875.0", | ||
"version": "2.5.0-rc.c212c3d66.0", | ||
"description": "An AppSync Simulator to test AppSync API.", | ||
@@ -64,3 +64,3 @@ "repository": { | ||
"devDependencies": { | ||
"@aws-amplify/amplify-graphiql-explorer": "2.5.0-rc.88f873875.0", | ||
"@aws-amplify/amplify-graphiql-explorer": "2.5.0-rc.c212c3d66.0", | ||
"@types/cors": "^2.8.6", | ||
@@ -94,3 +94,3 @@ "@types/express": "^4.17.3", | ||
}, | ||
"gitHead": "15e2539dcd93942d7797925c3c2fc1da1f7ca893" | ||
"gitHead": "6bc253c77e7384be880bbf608d592bfb4f02f346" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11064578
13638