para-client-js 1.38.3 → 1.39.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +9 -5
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -1490,7 +1490,7 @@ export default class ParaClient {
|
|
|
1490
1490
|
* @returns {RSVP.Promise} a map of the permissions for this subject id
|
|
1491
1491
|
*/
|
|
1492
1492
|
grantResourcePermission(subjectid, resourcePath, permission, fn) {
|
|
1493
|
-
return
|
|
1493
|
+
return grantResourcePermissions(subjectid, resourcePath, permission, false, fn);
|
|
1494
1494
|
}
|
|
1495
1495
|
/**
|
|
1496
1496
|
* Revokes a permission for a subject, meaning they no longer will be able to access the given resource.
|
|
@@ -1505,7 +1505,7 @@ export default class ParaClient {
|
|
|
1505
1505
|
fn({});
|
|
1506
1506
|
return resolve({});
|
|
1507
1507
|
}
|
|
1508
|
-
resourcePath =
|
|
1508
|
+
resourcePath = base64Url(resourcePath);
|
|
1509
1509
|
return this.getEntity(this.invokeDelete("_permissions/" + urlEncode(subjectid) + "/" + resourcePath), fn);
|
|
1510
1510
|
}
|
|
1511
1511
|
/**
|
|
@@ -1536,7 +1536,7 @@ export default class ParaClient {
|
|
|
1536
1536
|
fn(false);
|
|
1537
1537
|
return resolve(false);
|
|
1538
1538
|
}
|
|
1539
|
-
resourcePath =
|
|
1539
|
+
resourcePath = base64Url(resourcePath);
|
|
1540
1540
|
var url = "_permissions/" + urlEncode(subjectid) + "/" + resourcePath + "/" + httpMethod;
|
|
1541
1541
|
return this.getEntity(this.invokeGet(url)).then(function (result) {
|
|
1542
1542
|
var res = result === "true";
|
|
@@ -1732,7 +1732,7 @@ export default class ParaClient {
|
|
|
1732
1732
|
* @param {Function} fn callback (optional)
|
|
1733
1733
|
* @returns {RSVP.Promise} a map of the permissions for this subject id
|
|
1734
1734
|
*/
|
|
1735
|
-
|
|
1735
|
+
grantResourcePermissions(subjectid, resourcePath, permission, allowGuestAccess, fn) {
|
|
1736
1736
|
fn = fn || noop;
|
|
1737
1737
|
if (!subjectid || !resourcePath || !permission || !isArray(permission)) {
|
|
1738
1738
|
fn({});
|
|
@@ -1741,7 +1741,7 @@ export default class ParaClient {
|
|
|
1741
1741
|
if (allowGuestAccess && subjectid === "*") {
|
|
1742
1742
|
permission.push("?");
|
|
1743
1743
|
}
|
|
1744
|
-
resourcePath =
|
|
1744
|
+
resourcePath = base64Url(resourcePath);
|
|
1745
1745
|
return this.getEntity(this.invokePut("_permissions/" + urlEncode(subjectid) + "/" + resourcePath, permission), fn);
|
|
1746
1746
|
}
|
|
1747
1747
|
}
|
|
@@ -1767,6 +1767,10 @@ function decode(str, encoding) {
|
|
|
1767
1767
|
return Buffer.from(unescape(str), 'base64').toString(encoding || 'utf8');
|
|
1768
1768
|
}
|
|
1769
1769
|
|
|
1770
|
+
function base64Url(str) {
|
|
1771
|
+
return atob(str.replace(/_/g, '/').replace(/-/g, '+'));
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1770
1774
|
function resolve(obj) {
|
|
1771
1775
|
return Promise.resolve(obj);
|
|
1772
1776
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "para-client-js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.39.1",
|
|
4
4
|
"description": "JavaScript Client for Para",
|
|
5
5
|
"homepage": "https://paraio.org",
|
|
6
6
|
"repository": "erudika/para-client-js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"browserify": "^17.0.0",
|
|
33
33
|
"minimist": "^1.2.8",
|
|
34
|
-
"mocha": "^10.2
|
|
34
|
+
"mocha": "^10.5.2"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"test": "mocha",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
},
|
|
40
40
|
"license": "Apache-2.0",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"aws4": "^1.
|
|
42
|
+
"aws4": "^1.13.0",
|
|
43
43
|
"lodash": "^4.17.21",
|
|
44
|
-
"lru-cache": "^10.
|
|
44
|
+
"lru-cache": "^10.2.2",
|
|
45
45
|
"rsvp": "^4.8.5",
|
|
46
|
-
"superagent": "^
|
|
46
|
+
"superagent": "^9.0.2"
|
|
47
47
|
}
|
|
48
48
|
}
|