box-node-sdk 1.34.0 → 1.35.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.35.0 (2020-11-02)
4
+
5
+ **New Features and Enhancements:**
6
+
7
+ - Add support for search param to get shared link items ([#547](https://github.com/box/box-node-sdk/pull/547))
8
+
9
+ ## 1.34.3 (2020-10-02)
10
+
11
+ **Bug Fixes:**
12
+
13
+ - Upgrade ajv dependency ([#545](https://github.com/box/box-node-sdk/pull/545))
14
+
15
+ ## 1.34.2 [2020-08-20]
16
+
17
+ - Make iterator bug fix for uploading files non breaking ([#534](https://github.com/box/box-node-sdk/pull/534))
18
+
19
+ ## 1.34.1 [2020-08-17]
20
+
21
+ - Fix iterator bug for uploading new file versions ([#531](https://github.com/box/box-node-sdk/pull/531))
22
+
3
23
  ## 1.34.0 [2020-08-04]
4
24
 
5
25
  - Add zip functionality ([#525](https://github.com/box/box-node-sdk/pull/525))
@@ -1600,8 +1600,8 @@ Files.prototype.getRepresentationContent = function(fileID, representationType,
1600
1600
  *
1601
1601
  * @param {name} name - The name of the zip file to be created
1602
1602
  * @param {Array} items - Array of files or folders to be part of the created zip
1603
- * @param {Function} [callback] Passed a stream over the representation contents if successful
1604
- * @returns {Promise<string>} A promise resolving to the file's download URL
1603
+ * @param {Function} [callback] Passed a zip information object
1604
+ * @returns {Promise<string>} A promise resolving to a zip information object
1605
1605
  */
1606
1606
  Files.prototype.createZip = function(name, items, callback) {
1607
1607
  var params = {
@@ -1623,8 +1623,8 @@ Files.prototype.createZip = function(name, items, callback) {
1623
1623
  * @param {name} name - The name of the zip file to be created
1624
1624
  * @param {Array} items - Array of files or folders to be part of the created zip
1625
1625
  * @param {Stream} stream - Stream to pipe the readable stream of the zip file
1626
- * @param {Function} [callback] - Passed a status response object
1627
- * @returns {Promise<Readable>} A promise resolving for the file stream
1626
+ * @param {Function} [callback] - Passed a zip download status object
1627
+ * @returns {Promise<Readable>} A promise resolving to a zip download status object
1628
1628
  */
1629
1629
  Files.prototype.downloadZip = function(name, items, stream, callback) {
1630
1630
  var downloadStreamOptions = {
@@ -76,6 +76,8 @@ Search.prototype = {
76
76
  * @param {string} [options.type] - The type of objects you want to include in the search results. The type can be file, folder, or web_link
77
77
  * @param {string} [options.trash_content=non_trashed_only] - Controls whether to search in the trash. The value can be trashed_only or non_trashed_only
78
78
  * @param {SearchMetadataFilter[]} [options.mdfilters] - Searches for objects with a specific metadata object association. Searches with the this parameter do not require a query string
79
+ * @param {boolean} [options.include_recent_shared_links] - Determines whether to include items accessible only via shared link in the response.
80
+ * @param {string} [options.fields] - Comma-delimited list of fields to be included in the response
79
81
  * @param {int} [options.limit=30] - The number of search results to return, max 200
80
82
  * @param {int} [options.offset=0] - The search result at which to start the response, must be a multiple of limit
81
83
  * @param {string} [options.sort] - The field on which the results should be sorted, e.g. "modified_at"
@@ -58,7 +58,11 @@ class PagingIterator {
58
58
  * @returns {boolean} Whether the response is iterable
59
59
  */
60
60
  static isIterable(response) {
61
- var isGetOrPostRequest = (response.request && (response.request.method === 'GET' || response.request.method === 'POST')),
61
+ // POST responses for uploading a file are explicitly excluded here because, while the response is iterable,
62
+ // it always contains only a single entry and historically has not been handled as iterable in the SDK.
63
+ // This behavior is being preserved here to avoid a breaking change.
64
+ let UPLOAD_PATTERN = /.*upload\.box\.com.*\/content/;
65
+ var isGetOrPostRequest = (response.request && (response.request.method === 'GET' || (response.request.method === 'POST' && !UPLOAD_PATTERN.test(response.request.uri.href)))),
62
66
  hasEntries = (response.body && Array.isArray(response.body.entries)),
63
67
  notEventStream = (response.body && !response.body.next_stream_position);
64
68
 
@@ -160,6 +164,9 @@ class PagingIterator {
160
164
  if (response.request.method === 'GET') {
161
165
  this.options.qs[this.nextField] = this.nextValue;
162
166
  } else if (response.request.method === 'POST') {
167
+ if (!this.options.body) {
168
+ this.options.body = {};
169
+ }
163
170
  this.options.body[this.nextField] = this.nextValue;
164
171
  let bodyString = JSON.stringify(this.options.body);
165
172
  this.options.headers['content-length'] = bodyString.length;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "box-node-sdk",
3
3
  "author": "Box <oss@box.com>",
4
- "version": "1.34.0",
4
+ "version": "1.35.0",
5
5
  "description": "Official SDK for Box Plaform APIs",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -32,6 +32,7 @@
32
32
  "major": "node Makefile.js major"
33
33
  },
34
34
  "dependencies": {
35
+ "ajv": "^6.12.3",
35
36
  "bluebird": "^3.7.1",
36
37
  "http-status": "^1.4.1",
37
38
  "jsonwebtoken": "^8.5.1",