| 597 | } |
| 598 | |
| 599 | static validateFileDownloadOptions(fileDownload) { |
| 600 | try { |
| 601 | if (fileDownload == null || typeof fileDownload !== 'object' || Array.isArray(fileDownload)) { |
| 602 | throw 'fileDownload must be an object value.'; |
| 603 | } |
| 604 | } catch (e) { |
| 605 | if (e instanceof ReferenceError) { |
| 606 | return; |
| 607 | } |
| 608 | throw e; |
| 609 | } |
| 610 | if (fileDownload.enableForAnonymousUser === undefined) { |
| 611 | fileDownload.enableForAnonymousUser = FileDownloadOptions.enableForAnonymousUser.default; |
| 612 | } else if (typeof fileDownload.enableForAnonymousUser !== 'boolean') { |
| 613 | throw 'fileDownload.enableForAnonymousUser must be a boolean value.'; |
| 614 | } |
| 615 | if (fileDownload.enableForPublic === undefined) { |
| 616 | fileDownload.enableForPublic = FileDownloadOptions.enableForPublic.default; |
| 617 | } else if (typeof fileDownload.enableForPublic !== 'boolean') { |
| 618 | throw 'fileDownload.enableForPublic must be a boolean value.'; |
| 619 | } |
| 620 | if (fileDownload.enableForAuthenticatedUser === undefined) { |
| 621 | fileDownload.enableForAuthenticatedUser = FileDownloadOptions.enableForAuthenticatedUser.default; |
| 622 | } else if (typeof fileDownload.enableForAuthenticatedUser !== 'boolean') { |
| 623 | throw 'fileDownload.enableForAuthenticatedUser must be a boolean value.'; |
| 624 | } |
| 625 | } |
| 626 | |
| 627 | static validateIps(field, masterKeyIps) { |
| 628 | for (let ip of masterKeyIps) { |