pipedrive 17.5.2 → 17.5.4

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -7,7 +7,6 @@ The file format of it is based on [Keep a Changelog](http://keepachangelog.com/e
7
7
  For public Changelog covering all changes done to Pipedrive’s API, webhooks and app extensions platforms, see [public Changelog](https://pipedrive.readme.io/docs/changelog) with discussion area in [Developers Community](https://devcommunity.pipedrive.com/c/documentation/changelog/19).
8
8
 
9
9
  ## [Unreleased]
10
-
11
10
  ## 17.5.2
12
11
  ### Changed
13
12
  - Updated endpoint descriptions to warn about permanently removing deleted entities:
package/README.md CHANGED
@@ -17,6 +17,12 @@ Pipedrive API’s core concepts for its usage can be found in our [Developer doc
17
17
 
18
18
  ## How to use it?
19
19
 
20
+ > **Warning**
21
+ >
22
+ > The `pipedrive.ApiClient.instance` shouldn't be used as a global static instance in the **Production code**.
23
+ >
24
+ > Please, initialise a `new pipedrive.ApiClient()` instance separately for each request instead.
25
+
20
26
  ### With a pre-set API token
21
27
  You can retrieve the api_token from your existing Pipedrive account’s settings page. A step-by-step guide is available [here](https://pipedrive.readme.io/docs/how-to-find-the-api-token).
22
28
 
@@ -27,7 +33,7 @@ const pipedrive = require('pipedrive');
27
33
 
28
34
  const PORT = 1800;
29
35
 
30
- const defaultClient = pipedrive.ApiClient.instance;
36
+ const defaultClient = new pipedrive.ApiClient();
31
37
 
32
38
  // Configure API key authorization: apiToken
33
39
  let apiToken = defaultClient.authentications.api_key;
@@ -38,7 +44,7 @@ app.listen(PORT, () => {
38
44
  });
39
45
 
40
46
  app.get('/', async (req, res) => {
41
- const api = new pipedrive.DealsApi();
47
+ const api = new pipedrive.DealsApi(defaultClient);
42
48
  const deals = await api.getDeals();
43
49
 
44
50
  res.send(deals);
@@ -62,7 +68,7 @@ Next, initialize the API client as follows:
62
68
  ```JavaScript
63
69
  const pipedrive = require('pipedrive');
64
70
 
65
- const apiClient = pipedrive.ApiClient.instance;
71
+ const apiClient = new pipedrive.ApiClient();
66
72
 
67
73
  // Configuration parameters and credentials
68
74
  let oauth2 = apiClient.authentications.oauth2;
@@ -215,9 +221,9 @@ app.use(cookieSession({
215
221
  }));
216
222
  const PORT = 1800;
217
223
 
218
- const lib = require('pipedrive');
224
+ const pipedrive = require('pipedrive');
219
225
 
220
- const apiClient = lib.ApiClient.instance;
226
+ const apiClient = new pipedrive.ApiClient();
221
227
 
222
228
  let oauth2 = apiClient.authentications.oauth2;
223
229
  oauth2.clientId = 'clientId'; // OAuth 2 Client ID
@@ -233,7 +239,7 @@ app.get('/', async (req, res) => {
233
239
  // token is already set in the session
234
240
  // now make API calls as required
235
241
  // client will automatically refresh the token when it expires and call the token update callback
236
- const api = new lib.DealsApi();
242
+ const api = new pipedrive.DealsApi(apiClient);
237
243
  const deals = await api.getDeals();
238
244
 
239
245
  res.send(deals);
@@ -1246,7 +1252,7 @@ Class | Method | HTTP request | Description
1246
1252
  - **Type**: OAuth
1247
1253
  - **Flow**: accessCode
1248
1254
  - **Authorization URL**: https://oauth.pipedrive.com/oauth/authorize
1249
- - **Scopes**:
1255
+ - **Scopes**:
1250
1256
  - deals:read: Read most data about deals and related entities.
1251
1257
  - deals:full: Create, read, update and delete deals, its participants and followers.
1252
1258
  - goals:read: Read data on all goals.
package/dist/ApiClient.js CHANGED
@@ -689,7 +689,8 @@ var ApiClient = /*#__PURE__*/function () {
689
689
  for (var key in obj) {
690
690
  var keyValue = obj[key];
691
691
  var isArray = Array.isArray(keyValue);
692
- var isObject = (0, _typeof2["default"])(keyValue) === 'object' && !isArray;
692
+ var isNull = keyValue === null;
693
+ var isObject = (0, _typeof2["default"])(keyValue) === 'object' && !isArray && !isNull;
693
694
  var isHash = /^[a-f0-9]{40}$|^[a-f0-9]{40}_[a-z0-9]+$/i.test(key);
694
695
  if (isArray) keyValue = keyValue.map(function (kv) {
695
696
  return (0, _typeof2["default"])(kv) === 'object' ? _this3.replaceCamelCaseObj(kv) : kv;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pipedrive",
3
- "version": "17.5.2",
3
+ "version": "17.5.4",
4
4
  "description": "Pipedrive REST client for NodeJS",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",