para-client-js 1.37.3 → 1.37.7

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.
Files changed (2) hide show
  1. package/lib/index.js +9 -9
  2. package/package.json +3 -3
package/lib/index.js CHANGED
@@ -67,7 +67,7 @@ export default class ParaClient {
67
67
  var that = this;
68
68
  var secret = secretKey;
69
69
 
70
- function getFullPath(resourcePath) {
70
+ this.getFullPath = function (resourcePath) {
71
71
  if (resourcePath && startsWith(resourcePath, JWT_PATH)) {
72
72
  return resourcePath;
73
73
  }
@@ -140,7 +140,7 @@ export default class ParaClient {
140
140
  * @returns {Object} response
141
141
  */
142
142
  this.invokeGet = function (resourcePath, params) {
143
- return invokeSignedRequest("GET", that.endpoint, getFullPath(resourcePath), null, params);
143
+ return that.invokeSignedRequest("GET", that.endpoint, that.getFullPath(resourcePath), null, params);
144
144
  };
145
145
 
146
146
  /**
@@ -150,7 +150,7 @@ export default class ParaClient {
150
150
  * @returns {Object} response
151
151
  */
152
152
  this.invokePost = function (resourcePath, entity) {
153
- return invokeSignedRequest("POST", that.endpoint, getFullPath(resourcePath), null, null, entity);
153
+ return that.invokeSignedRequest("POST", that.endpoint, that.getFullPath(resourcePath), null, null, entity);
154
154
  };
155
155
 
156
156
  /**
@@ -160,7 +160,7 @@ export default class ParaClient {
160
160
  * @returns {Object} response
161
161
  */
162
162
  this.invokePut = function (resourcePath, entity) {
163
- return invokeSignedRequest("PUT", that.endpoint, getFullPath(resourcePath), null, null, entity);
163
+ return that.invokeSignedRequest("PUT", that.endpoint, that.getFullPath(resourcePath), null, null, entity);
164
164
  };
165
165
 
166
166
  /**
@@ -170,7 +170,7 @@ export default class ParaClient {
170
170
  * @returns {Object} response
171
171
  */
172
172
  this.invokePatch = function (resourcePath, entity) {
173
- return invokeSignedRequest("PATCH", that.endpoint, getFullPath(resourcePath), null, null, entity);
173
+ return that.invokeSignedRequest("PATCH", that.endpoint, that.getFullPath(resourcePath), null, null, entity);
174
174
  };
175
175
 
176
176
  /**
@@ -180,10 +180,10 @@ export default class ParaClient {
180
180
  * @returns {Object} response
181
181
  */
182
182
  this.invokeDelete = function (resourcePath, params) {
183
- return invokeSignedRequest("DELETE", that.endpoint, getFullPath(resourcePath), null, params);
183
+ return that.invokeSignedRequest("DELETE", that.endpoint, that.getFullPath(resourcePath), null, params);
184
184
  };
185
185
 
186
- this.invokeSignedRequest = function(httpMethod, endpointURL, reqPath, headers, params, jsonEntity) {
186
+ this.invokeSignedRequest = function (httpMethod, endpointURL, reqPath, headers, params, jsonEntity) {
187
187
  if (!accessKey || isEmpty(accessKey.trim())) {
188
188
  throw new Error("Blank access key: " + httpMethod + " " + reqPath);
189
189
  }
@@ -1347,7 +1347,7 @@ export default class ParaClient {
1347
1347
  if (accessToken && isString(accessToken)) {
1348
1348
  var auth = startsWith(accessToken, "Bearer") ? accessToken : "Bearer " + accessToken;
1349
1349
  var headers = { "Authorization": auth };
1350
- return this.getEntity(this.invokeSignedRequest("GET", this.endpoint, getFullPath("_me"), headers), fn, false);
1350
+ return this.getEntity(this.invokeSignedRequest("GET", this.endpoint, this.getFullPath("_me"), headers), fn, false);
1351
1351
  } else {
1352
1352
  return this.getEntity(this.invokeGet("_me"), fn, false);
1353
1353
  }
@@ -1412,7 +1412,7 @@ export default class ParaClient {
1412
1412
  if (!destinationIndex) {
1413
1413
  return this.getEntity(this.invokePost("_reindex"), fn);
1414
1414
  } else {
1415
- return this.getEntity(this.invokeSignedRequest("POST", this.endpoint, getFullPath("_reindex"), {},
1415
+ return this.getEntity(this.invokeSignedRequest("POST", this.endpoint, this.getFullPath("_reindex"), {},
1416
1416
  { 'destinationIndex': destinationIndex }), fn);
1417
1417
  }
1418
1418
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "para-client-js",
3
- "version": "1.37.3",
3
+ "version": "1.37.7",
4
4
  "description": "JavaScript Client for Para",
5
5
  "homepage": "https://paraio.org",
6
6
  "repository": "erudika/para-client-js",
7
- "main": "lib/index.js",
7
+ "exports": "lib/index.js",
8
8
  "types": "lib/index.d.ts",
9
9
  "type": "module",
10
10
  "author": {
@@ -31,7 +31,7 @@
31
31
  "devDependencies": {
32
32
  "browserify": "^17.0.0",
33
33
  "minimist": ">=1.2.2",
34
- "mocha": "^9.0.0"
34
+ "mocha": "^9.1.3"
35
35
  },
36
36
  "scripts": {
37
37
  "test": "mocha",