box-node-sdk 1.34.1 → 1.36.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,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.36.0 (2020-01-27)
4
+
5
+ **New Features and Enhancements:**
6
+
7
+ - Add folder lock functionality ([#560](https://github.com/box/box-node-sdk/pull/560))
8
+ - Add support for filtering groups by name ([#561](https://github.com/box/box-node-sdk/pull/561))
9
+
10
+ **Bug Fixes:**
11
+
12
+ - Update proxy-agent to patch proxy support issue ([#563](https://github.com/box/box-node-sdk/pull/563))
13
+ - Update dependencies to patch security vulnerabilities ([#566](https://github.com/box/box-node-sdk/pull/566))
14
+
15
+ ## 1.35.0 (2020-11-02)
16
+
17
+ **New Features and Enhancements:**
18
+
19
+ - Add support for search param to get shared link items ([#547](https://github.com/box/box-node-sdk/pull/547))
20
+
21
+ ## 1.34.3 (2020-10-02)
22
+
23
+ **Bug Fixes:**
24
+
25
+ - Upgrade ajv dependency ([#545](https://github.com/box/box-node-sdk/pull/545))
26
+
27
+ ## 1.34.2 [2020-08-20]
28
+
29
+ - Make iterator bug fix for uploading files non breaking ([#534](https://github.com/box/box-node-sdk/pull/534))
30
+
3
31
  ## 1.34.1 [2020-08-17]
4
32
 
5
33
  - Fix iterator bug for uploading new file versions ([#531](https://github.com/box/box-node-sdk/pull/531))
@@ -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 = {
@@ -15,6 +15,7 @@ var urlPath = require('../util/url-path'),
15
15
  // Private
16
16
  // ------------------------------------------------------------------------------
17
17
  var BASE_PATH = '/folders',
18
+ FOLDER_LOCK = '/folder_locks',
18
19
  WATERMARK_SUBRESOURCE = '/watermark';
19
20
 
20
21
 
@@ -577,6 +578,68 @@ Folders.prototype.removeWatermark = function(folderID, callback) {
577
578
 
578
579
  return this.client.wrapWithDefaultHandler(this.client.del)(apiPath, null, callback);
579
580
  };
581
+
582
+ /**
583
+ * Used to lock a Box folder.
584
+ *
585
+ * API Endpoint: '/folder_locks'
586
+ * Method: POST
587
+ *
588
+ * @param {string} folderID - The Box ID of the folder to lock
589
+ * @param {Function} [callback] - Passed the folder lock object if successful, error otherwise
590
+ * @returns {Promise<void>} A promise resolving to a folder lock object
591
+ */
592
+ Folders.prototype.lock = function(folderID, callback) {
593
+ var params = {
594
+ body: {
595
+ folder: {
596
+ type: 'folder',
597
+ id: folderID
598
+ },
599
+ locked_operations: {
600
+ move: true,
601
+ delete: true
602
+ }
603
+ }
604
+ };
605
+ return this.client.wrapWithDefaultHandler(this.client.post)(FOLDER_LOCK, params, callback);
606
+ };
607
+
608
+ /**
609
+ * Used to get all locks on a folder.
610
+ *
611
+ * API Endpoint: '/folder_locks'
612
+ * Method: GET
613
+ *
614
+ * @param {string} folderID - The Box ID of the folder to lock
615
+ * @param {Function} [callback] - Passed a collection of folder lock objects if successful, error otherwise
616
+ * @returns {Promise<void>} A promise resolving to a collection of folder lock objects
617
+ */
618
+ Folders.prototype.getLocks = function(folderID, callback) {
619
+ var params = {
620
+ qs: {
621
+ folder_id: folderID
622
+ }
623
+ };
624
+ return this.client.wrapWithDefaultHandler(this.client.get)(FOLDER_LOCK, params, callback);
625
+ };
626
+
627
+ /**
628
+ * Used to delete a lock on a folder.
629
+ *
630
+ * API Endpoint: '/folder_locks/:folderLockID'
631
+ * Method: DELETE
632
+ *
633
+ * @param {string} folderLockID - The Box ID of the folder lock
634
+ * @param {Function} [callback] - Empty response body passed if successful, error otherwise
635
+ * @returns {Promise<void>} A promise resolving to nothing
636
+ */
637
+ Folders.prototype.deleteLock = function(folderLockID, callback) {
638
+
639
+ var apiPath = urlPath(FOLDER_LOCK, folderLockID);
640
+
641
+ return this.client.wrapWithDefaultHandler(this.client.del)(apiPath, null, callback);
642
+ };
580
643
  /**
581
644
  * @module box-node-sdk/lib/managers/folders
582
645
  * @see {@Link Folders}
@@ -279,6 +279,7 @@ Groups.prototype.getMemberships = function(groupID, options, callback) {
279
279
  * Method: GET
280
280
  *
281
281
  * @param {Object} [options] - Optional parameters, can be left null in most cases
282
+ * @param {string} [options.filter_term] - Limits the results to only groups whose name starts with the search term
282
283
  * @param {int} [options.limit] - The number of memberships to retrieve
283
284
  * @param {int} [options.offset] - Paging marker, retrieve records starting at this position in the list
284
285
  * @param {Function} [callback] - Passed a list of groups if successful, error otherwise
@@ -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
 
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.1",
4
+ "version": "1.36.0",
5
5
  "description": "Official SDK for Box Plaform APIs",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -32,19 +32,20 @@
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",
38
39
  "merge-options": "^1.0.1",
39
40
  "promise-queue": "^2.2.3",
40
- "proxy-agent": "^3.1.1",
41
+ "proxy-agent": "^4.0.0",
41
42
  "request": "^2.88.0",
42
43
  "url-template": "^2.0.8",
43
44
  "uuid": "^3.3.3"
44
45
  },
45
46
  "devDependencies": {
46
47
  "chai": "^4.2.0",
47
- "coveralls": "^3.0.8",
48
+ "coveralls": "^3.1.0",
48
49
  "eslint": "^4.19.1",
49
50
  "eslint-plugin-node": "^6.0.1",
50
51
  "eslint-plugin-promise": "^3.8.0",
@@ -53,12 +54,13 @@
53
54
  "jsdoc": "^3.6.3",
54
55
  "jsonlint2": "^1.7.1",
55
56
  "leche": "^2.3.0",
56
- "mocha": "^5.2.0",
57
+ "mocha": "^6.0.0",
57
58
  "mockery": "^2.1.0",
58
59
  "nock": "^9.6.1",
59
- "np": "^5.1.3",
60
+ "np": "^7.2.0",
61
+ "npm-force-resolutions": "0.0.3",
60
62
  "npm-upgrade": "^2.0.3",
61
- "nyc": "^11.9.0",
63
+ "nyc": "^14.0.0",
62
64
  "shelljs": "^0.8.3",
63
65
  "shelljs-nodecli": "^0.1.1",
64
66
  "sinon": "^7.5.0"
@@ -66,5 +68,9 @@
66
68
  "files": [
67
69
  "config",
68
70
  "lib"
69
- ]
71
+ ],
72
+ "resolutions": {
73
+ "handlebars": "4.5.3",
74
+ "minimist": "1.2.5"
75
+ }
70
76
  }