files.com 1.0.421 → 1.0.422
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.js +179 -0
- package/_VERSION +1 -1
- package/lib/Api.js +14 -13
- package/lib/Errors.js +4 -2
- package/lib/Files.js +6 -6
- package/lib/Logger.js +20 -12
- package/lib/models/AccountLineItem.js +2 -2
- package/lib/models/Action.js +2 -2
- package/lib/models/ActionNotificationExport.js +2 -1
- package/lib/models/ActionNotificationExportResult.js +2 -1
- package/lib/models/ActionWebhookFailure.js +3 -3
- package/lib/models/ApiKey.js +8 -7
- package/lib/models/App.js +2 -1
- package/lib/models/As2IncomingMessage.js +2 -1
- package/lib/models/As2OutgoingMessage.js +2 -1
- package/lib/models/As2Partner.js +8 -7
- package/lib/models/As2Station.js +8 -7
- package/lib/models/Auto.js +2 -2
- package/lib/models/Automation.js +21 -20
- package/lib/models/AutomationRun.js +2 -1
- package/lib/models/BandwidthSnapshot.js +2 -1
- package/lib/models/Behavior.js +9 -8
- package/lib/models/Bundle.js +21 -20
- package/lib/models/BundleDownload.js +2 -1
- package/lib/models/BundleNotification.js +4 -3
- package/lib/models/BundleRecipient.js +2 -1
- package/lib/models/BundleRegistration.js +2 -1
- package/lib/models/Clickwrap.js +9 -8
- package/lib/models/DnsRecord.js +2 -1
- package/lib/models/EmailIncomingMessage.js +2 -1
- package/lib/models/Errors.js +2 -2
- package/lib/models/ExternalEvent.js +2 -1
- package/lib/models/File.js +51 -42
- package/lib/models/FileAction.js +2 -2
- package/lib/models/FileComment.js +5 -4
- package/lib/models/FileCommentReaction.js +3 -2
- package/lib/models/FileMigration.js +2 -1
- package/lib/models/FileUploadPart.js +2 -2
- package/lib/models/Folder.js +10 -7
- package/lib/models/FormField.js +2 -2
- package/lib/models/FormFieldSet.js +6 -5
- package/lib/models/GpgKey.js +8 -7
- package/lib/models/Group.js +8 -7
- package/lib/models/GroupUser.js +8 -7
- package/lib/models/History.js +19 -8
- package/lib/models/HistoryExport.js +2 -1
- package/lib/models/HistoryExportResult.js +2 -1
- package/lib/models/Image.js +2 -2
- package/lib/models/InboxRecipient.js +2 -1
- package/lib/models/InboxRegistration.js +2 -1
- package/lib/models/InboxUpload.js +2 -1
- package/lib/models/Invoice.js +8 -3
- package/lib/models/InvoiceLineItem.js +2 -2
- package/lib/models/IpAddress.js +8 -3
- package/lib/models/Lock.js +4 -3
- package/lib/models/Message.js +7 -6
- package/lib/models/MessageComment.js +5 -4
- package/lib/models/MessageCommentReaction.js +3 -2
- package/lib/models/MessageReaction.js +3 -2
- package/lib/models/Notification.js +9 -8
- package/lib/models/Payment.js +8 -3
- package/lib/models/PaymentLineItem.js +2 -2
- package/lib/models/Permission.js +3 -2
- package/lib/models/Preview.js +2 -2
- package/lib/models/Priority.js +2 -1
- package/lib/models/Project.js +5 -4
- package/lib/models/PublicIpAddress.js +2 -2
- package/lib/models/PublicKey.js +5 -4
- package/lib/models/RemoteBandwidthSnapshot.js +2 -1
- package/lib/models/RemoteServer.js +81 -76
- package/lib/models/RemoteServerConfigurationFile.js +2 -2
- package/lib/models/Request.js +3 -2
- package/lib/models/Session.js +2 -1
- package/lib/models/SettingsChange.js +2 -1
- package/lib/models/SftpHostKey.js +6 -5
- package/lib/models/ShareGroup.js +7 -6
- package/lib/models/ShareGroupMember.js +2 -2
- package/lib/models/Site.js +5 -2
- package/lib/models/Snapshot.js +7 -6
- package/lib/models/SsoStrategy.js +3 -2
- package/lib/models/Status.js +2 -2
- package/lib/models/Style.js +4 -3
- package/lib/models/UsageDailySnapshot.js +2 -1
- package/lib/models/UsageSnapshot.js +2 -1
- package/lib/models/User.js +33 -32
- package/lib/models/UserCipherUse.js +2 -1
- package/lib/models/UserRequest.js +3 -2
- package/lib/models/WebhookTest.js +2 -1
- package/lib/utils/pathNormalizer.js +2 -2
- package/lib/utils/pathNormalizer.test.js +1 -1
- package/lib/utils.js +2 -0
- package/package.json +7 -1
- package/src/Api.js +17 -13
- package/src/Errors.js +2 -1
- package/src/Files.js +16 -6
- package/src/Logger.js +16 -16
- package/src/isomorphic/File.node.js +7 -7
- package/src/models/AccountLineItem.js +3 -2
- package/src/models/Action.js +3 -2
- package/src/models/ActionNotificationExport.js +5 -2
- package/src/models/ActionNotificationExportResult.js +4 -2
- package/src/models/ActionWebhookFailure.js +4 -3
- package/src/models/ApiKey.js +15 -8
- package/src/models/App.js +4 -2
- package/src/models/As2IncomingMessage.js +4 -2
- package/src/models/As2OutgoingMessage.js +4 -2
- package/src/models/As2Partner.js +13 -8
- package/src/models/As2Station.js +13 -8
- package/src/models/Auto.js +3 -2
- package/src/models/Automation.js +26 -21
- package/src/models/AutomationRun.js +5 -2
- package/src/models/BandwidthSnapshot.js +4 -2
- package/src/models/Behavior.js +15 -9
- package/src/models/Bundle.js +26 -21
- package/src/models/BundleDownload.js +4 -2
- package/src/models/BundleNotification.js +9 -4
- package/src/models/BundleRecipient.js +5 -2
- package/src/models/BundleRegistration.js +4 -2
- package/src/models/Clickwrap.js +14 -9
- package/src/models/DnsRecord.js +4 -2
- package/src/models/EmailIncomingMessage.js +4 -2
- package/src/models/Errors.js +3 -2
- package/src/models/ExternalEvent.js +6 -2
- package/src/models/File.js +39 -28
- package/src/models/FileAction.js +3 -2
- package/src/models/FileComment.js +9 -5
- package/src/models/FileCommentReaction.js +5 -3
- package/src/models/FileMigration.js +4 -2
- package/src/models/FileUploadPart.js +3 -2
- package/src/models/Folder.js +5 -3
- package/src/models/FormField.js +3 -2
- package/src/models/FormFieldSet.js +11 -6
- package/src/models/GpgKey.js +13 -8
- package/src/models/Group.js +13 -8
- package/src/models/GroupUser.js +12 -8
- package/src/models/History.js +10 -4
- package/src/models/HistoryExport.js +5 -2
- package/src/models/HistoryExportResult.js +4 -2
- package/src/models/Image.js +3 -2
- package/src/models/InboxRecipient.js +5 -2
- package/src/models/InboxRegistration.js +4 -2
- package/src/models/InboxUpload.js +4 -2
- package/src/models/Invoice.js +5 -2
- package/src/models/InvoiceLineItem.js +3 -2
- package/src/models/IpAddress.js +6 -2
- package/src/models/Lock.js +7 -4
- package/src/models/Message.js +12 -7
- package/src/models/MessageComment.js +10 -5
- package/src/models/MessageCommentReaction.js +7 -3
- package/src/models/MessageReaction.js +7 -3
- package/src/models/Notification.js +14 -9
- package/src/models/Payment.js +5 -2
- package/src/models/PaymentLineItem.js +3 -2
- package/src/models/Permission.js +6 -3
- package/src/models/Preview.js +3 -2
- package/src/models/Priority.js +4 -2
- package/src/models/Project.js +10 -5
- package/src/models/PublicIpAddress.js +3 -2
- package/src/models/PublicKey.js +10 -5
- package/src/models/RemoteBandwidthSnapshot.js +4 -2
- package/src/models/RemoteServer.js +82 -75
- package/src/models/RemoteServerConfigurationFile.js +3 -2
- package/src/models/Request.js +7 -3
- package/src/models/Session.js +4 -2
- package/src/models/SettingsChange.js +4 -2
- package/src/models/SftpHostKey.js +11 -6
- package/src/models/ShareGroup.js +12 -7
- package/src/models/ShareGroupMember.js +3 -2
- package/src/models/Site.js +6 -2
- package/src/models/Snapshot.js +12 -7
- package/src/models/SsoStrategy.js +6 -3
- package/src/models/Status.js +3 -2
- package/src/models/Style.js +7 -4
- package/src/models/UsageDailySnapshot.js +4 -2
- package/src/models/UsageSnapshot.js +4 -2
- package/src/models/User.js +38 -33
- package/src/models/UserCipherUse.js +4 -2
- package/src/models/UserRequest.js +7 -3
- package/src/models/WebhookTest.js +4 -2
- package/src/utils/pathNormalizer.js +1 -1
- package/src/utils/pathNormalizer.test.js +2 -2
- package/src/utils.js +6 -5
- package/test.sh +10 -0
package/src/models/Site.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
1
2
|
import Api from '../Api'
|
2
3
|
import * as errors from '../Errors'
|
3
|
-
import
|
4
|
-
|
4
|
+
import { getType, isArray, isInt, isObject, isString } from '../utils'
|
5
|
+
/* eslint-enable no-unused-vars */
|
5
6
|
|
6
7
|
/**
|
7
8
|
* Class Site
|
@@ -468,12 +469,14 @@ class Site {
|
|
468
469
|
static get = async (options = {}) => {
|
469
470
|
const response = await Api.sendRequest(`/site`, 'GET', {}, options)
|
470
471
|
|
472
|
+
|
471
473
|
return new Site(response?.data, options)
|
472
474
|
}
|
473
475
|
|
474
476
|
static getUsage = async (options = {}) => {
|
475
477
|
const response = await Api.sendRequest(`/site/usage`, 'GET', {}, options)
|
476
478
|
|
479
|
+
const UsageSnapshot = require("./UsageSnapshot.js").default
|
477
480
|
return new UsageSnapshot(response?.data, options)
|
478
481
|
}
|
479
482
|
|
@@ -885,6 +888,7 @@ class Site {
|
|
885
888
|
|
886
889
|
const response = await Api.sendRequest(`/site`, 'PATCH', params, options)
|
887
890
|
|
891
|
+
|
888
892
|
return new Site(response?.data, options)
|
889
893
|
}
|
890
894
|
}
|
package/src/models/Snapshot.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
1
2
|
import Api from '../Api'
|
2
3
|
import * as errors from '../Errors'
|
3
|
-
import
|
4
|
-
|
4
|
+
import { getType, isArray, isInt, isObject, isString } from '../utils'
|
5
|
+
/* eslint-enable no-unused-vars */
|
5
6
|
|
6
7
|
/**
|
7
8
|
* Class Snapshot
|
@@ -88,16 +89,16 @@ class Snapshot {
|
|
88
89
|
|
89
90
|
params.id = this.attributes.id
|
90
91
|
if (params['id'] && !isInt(params['id'])) {
|
91
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
92
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
|
92
93
|
}
|
93
94
|
if (params['expires_at'] && !isString(params['expires_at'])) {
|
94
|
-
throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(expires_at)}`)
|
95
|
+
throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params['expires_at'])}`)
|
95
96
|
}
|
96
97
|
if (params['name'] && !isString(params['name'])) {
|
97
|
-
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(name)}`)
|
98
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params['name'])}`)
|
98
99
|
}
|
99
100
|
if (params['paths'] && !isArray(params['paths'])) {
|
100
|
-
throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(paths)}`)
|
101
|
+
throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(params['paths'])}`)
|
101
102
|
}
|
102
103
|
|
103
104
|
if (!params['id']) {
|
@@ -110,6 +111,7 @@ class Snapshot {
|
|
110
111
|
|
111
112
|
const response = await Api.sendRequest(`/snapshots/${encodeURIComponent(params['id'])}`, 'PATCH', params, this.options)
|
112
113
|
|
114
|
+
|
113
115
|
return new Snapshot(response?.data, this.options)
|
114
116
|
}
|
115
117
|
|
@@ -124,7 +126,7 @@ class Snapshot {
|
|
124
126
|
|
125
127
|
params.id = this.attributes.id
|
126
128
|
if (params['id'] && !isInt(params['id'])) {
|
127
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
129
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
|
128
130
|
}
|
129
131
|
|
130
132
|
if (!params['id']) {
|
@@ -167,6 +169,7 @@ class Snapshot {
|
|
167
169
|
|
168
170
|
const response = await Api.sendRequest(`/snapshots`, 'GET', params, options)
|
169
171
|
|
172
|
+
|
170
173
|
return response?.data?.map(obj => new Snapshot(obj, options)) || []
|
171
174
|
}
|
172
175
|
|
@@ -192,6 +195,7 @@ class Snapshot {
|
|
192
195
|
|
193
196
|
const response = await Api.sendRequest(`/snapshots/${encodeURIComponent(params['id'])}`, 'GET', params, options)
|
194
197
|
|
198
|
+
|
195
199
|
return new Snapshot(response?.data, options)
|
196
200
|
}
|
197
201
|
|
@@ -217,6 +221,7 @@ class Snapshot {
|
|
217
221
|
|
218
222
|
const response = await Api.sendRequest(`/snapshots`, 'POST', params, options)
|
219
223
|
|
224
|
+
|
220
225
|
return new Snapshot(response?.data, options)
|
221
226
|
}
|
222
227
|
}
|
@@ -1,7 +1,8 @@
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
1
2
|
import Api from '../Api'
|
2
3
|
import * as errors from '../Errors'
|
3
|
-
import
|
4
|
-
|
4
|
+
import { getType, isArray, isInt, isObject, isString } from '../utils'
|
5
|
+
/* eslint-enable no-unused-vars */
|
5
6
|
|
6
7
|
/**
|
7
8
|
* Class SsoStrategy
|
@@ -168,7 +169,7 @@ class SsoStrategy {
|
|
168
169
|
|
169
170
|
params.id = this.attributes.id
|
170
171
|
if (params['id'] && !isInt(params['id'])) {
|
171
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
172
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
|
172
173
|
}
|
173
174
|
|
174
175
|
if (!params['id']) {
|
@@ -198,6 +199,7 @@ class SsoStrategy {
|
|
198
199
|
|
199
200
|
const response = await Api.sendRequest(`/sso_strategies`, 'GET', params, options)
|
200
201
|
|
202
|
+
|
201
203
|
return response?.data?.map(obj => new SsoStrategy(obj, options)) || []
|
202
204
|
}
|
203
205
|
|
@@ -223,6 +225,7 @@ class SsoStrategy {
|
|
223
225
|
|
224
226
|
const response = await Api.sendRequest(`/sso_strategies/${encodeURIComponent(params['id'])}`, 'GET', params, options)
|
225
227
|
|
228
|
+
|
226
229
|
return new SsoStrategy(response?.data, options)
|
227
230
|
}
|
228
231
|
|
package/src/models/Status.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
1
2
|
import Api from '../Api'
|
2
3
|
import * as errors from '../Errors'
|
3
|
-
import
|
4
|
-
|
4
|
+
import { getType, isArray, isInt, isObject, isString } from '../utils'
|
5
|
+
/* eslint-enable no-unused-vars */
|
5
6
|
|
6
7
|
/**
|
7
8
|
* Class Status
|
package/src/models/Style.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
1
2
|
import Api from '../Api'
|
2
3
|
import * as errors from '../Errors'
|
3
|
-
import
|
4
|
-
|
4
|
+
import { getType, isArray, isInt, isObject, isString } from '../utils'
|
5
|
+
/* eslint-enable no-unused-vars */
|
5
6
|
|
6
7
|
/**
|
7
8
|
* Class Style
|
@@ -72,7 +73,7 @@ class Style {
|
|
72
73
|
|
73
74
|
params.path = this.attributes.path
|
74
75
|
if (params['path'] && !isString(params['path'])) {
|
75
|
-
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
|
76
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params['path'])}`)
|
76
77
|
}
|
77
78
|
|
78
79
|
if (!params['path']) {
|
@@ -93,6 +94,7 @@ class Style {
|
|
93
94
|
|
94
95
|
const response = await Api.sendRequest(`/styles/${encodeURIComponent(params['path'])}`, 'PATCH', params, this.options)
|
95
96
|
|
97
|
+
|
96
98
|
return new Style(response?.data, this.options)
|
97
99
|
}
|
98
100
|
|
@@ -107,7 +109,7 @@ class Style {
|
|
107
109
|
|
108
110
|
params.path = this.attributes.path
|
109
111
|
if (params['path'] && !isString(params['path'])) {
|
110
|
-
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
|
112
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params['path'])}`)
|
111
113
|
}
|
112
114
|
|
113
115
|
if (!params['path']) {
|
@@ -148,6 +150,7 @@ class Style {
|
|
148
150
|
|
149
151
|
const response = await Api.sendRequest(`/styles/${encodeURIComponent(params['path'])}`, 'GET', params, options)
|
150
152
|
|
153
|
+
|
151
154
|
return new Style(response?.data, options)
|
152
155
|
}
|
153
156
|
|
@@ -1,7 +1,8 @@
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
1
2
|
import Api from '../Api'
|
2
3
|
import * as errors from '../Errors'
|
3
|
-
import
|
4
|
-
|
4
|
+
import { getType, isArray, isInt, isObject, isString } from '../utils'
|
5
|
+
/* eslint-enable no-unused-vars */
|
5
6
|
|
6
7
|
/**
|
7
8
|
* Class UsageDailySnapshot
|
@@ -77,6 +78,7 @@ class UsageDailySnapshot {
|
|
77
78
|
|
78
79
|
const response = await Api.sendRequest(`/usage_daily_snapshots`, 'GET', params, options)
|
79
80
|
|
81
|
+
|
80
82
|
return response?.data?.map(obj => new UsageDailySnapshot(obj, options)) || []
|
81
83
|
}
|
82
84
|
|
@@ -1,7 +1,8 @@
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
1
2
|
import Api from '../Api'
|
2
3
|
import * as errors from '../Errors'
|
3
|
-
import
|
4
|
-
|
4
|
+
import { getType, isArray, isInt, isObject, isString } from '../utils'
|
5
|
+
/* eslint-enable no-unused-vars */
|
5
6
|
|
6
7
|
/**
|
7
8
|
* Class UsageSnapshot
|
@@ -83,6 +84,7 @@ class UsageSnapshot {
|
|
83
84
|
|
84
85
|
const response = await Api.sendRequest(`/usage_snapshots`, 'GET', params, options)
|
85
86
|
|
87
|
+
|
86
88
|
return response?.data?.map(obj => new UsageSnapshot(obj, options)) || []
|
87
89
|
}
|
88
90
|
|
package/src/models/User.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
1
2
|
import Api from '../Api'
|
2
3
|
import * as errors from '../Errors'
|
3
|
-
import
|
4
|
-
|
4
|
+
import { getType, isArray, isInt, isObject, isString } from '../utils'
|
5
|
+
/* eslint-enable no-unused-vars */
|
5
6
|
|
6
7
|
/**
|
7
8
|
* Class User
|
@@ -522,7 +523,7 @@ class User {
|
|
522
523
|
|
523
524
|
params.id = this.attributes.id
|
524
525
|
if (params['id'] && !isInt(params['id'])) {
|
525
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
526
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
|
526
527
|
}
|
527
528
|
|
528
529
|
if (!params['id']) {
|
@@ -550,7 +551,7 @@ class User {
|
|
550
551
|
|
551
552
|
params.id = this.attributes.id
|
552
553
|
if (params['id'] && !isInt(params['id'])) {
|
553
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
554
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
|
554
555
|
}
|
555
556
|
|
556
557
|
if (!params['id']) {
|
@@ -578,7 +579,7 @@ class User {
|
|
578
579
|
|
579
580
|
params.id = this.attributes.id
|
580
581
|
if (params['id'] && !isInt(params['id'])) {
|
581
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
582
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
|
582
583
|
}
|
583
584
|
|
584
585
|
if (!params['id']) {
|
@@ -651,85 +652,85 @@ class User {
|
|
651
652
|
|
652
653
|
params.id = this.attributes.id
|
653
654
|
if (params['id'] && !isInt(params['id'])) {
|
654
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
655
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
|
655
656
|
}
|
656
657
|
if (params['change_password'] && !isString(params['change_password'])) {
|
657
|
-
throw new errors.InvalidParameterError(`Bad parameter: change_password must be of type String, received ${getType(change_password)}`)
|
658
|
+
throw new errors.InvalidParameterError(`Bad parameter: change_password must be of type String, received ${getType(params['change_password'])}`)
|
658
659
|
}
|
659
660
|
if (params['change_password_confirmation'] && !isString(params['change_password_confirmation'])) {
|
660
|
-
throw new errors.InvalidParameterError(`Bad parameter: change_password_confirmation must be of type String, received ${getType(change_password_confirmation)}`)
|
661
|
+
throw new errors.InvalidParameterError(`Bad parameter: change_password_confirmation must be of type String, received ${getType(params['change_password_confirmation'])}`)
|
661
662
|
}
|
662
663
|
if (params['email'] && !isString(params['email'])) {
|
663
|
-
throw new errors.InvalidParameterError(`Bad parameter: email must be of type String, received ${getType(email)}`)
|
664
|
+
throw new errors.InvalidParameterError(`Bad parameter: email must be of type String, received ${getType(params['email'])}`)
|
664
665
|
}
|
665
666
|
if (params['grant_permission'] && !isString(params['grant_permission'])) {
|
666
|
-
throw new errors.InvalidParameterError(`Bad parameter: grant_permission must be of type String, received ${getType(grant_permission)}`)
|
667
|
+
throw new errors.InvalidParameterError(`Bad parameter: grant_permission must be of type String, received ${getType(params['grant_permission'])}`)
|
667
668
|
}
|
668
669
|
if (params['group_id'] && !isInt(params['group_id'])) {
|
669
|
-
throw new errors.InvalidParameterError(`Bad parameter: group_id must be of type Int, received ${getType(group_id)}`)
|
670
|
+
throw new errors.InvalidParameterError(`Bad parameter: group_id must be of type Int, received ${getType(params['group_id'])}`)
|
670
671
|
}
|
671
672
|
if (params['group_ids'] && !isString(params['group_ids'])) {
|
672
|
-
throw new errors.InvalidParameterError(`Bad parameter: group_ids must be of type String, received ${getType(group_ids)}`)
|
673
|
+
throw new errors.InvalidParameterError(`Bad parameter: group_ids must be of type String, received ${getType(params['group_ids'])}`)
|
673
674
|
}
|
674
675
|
if (params['imported_password_hash'] && !isString(params['imported_password_hash'])) {
|
675
|
-
throw new errors.InvalidParameterError(`Bad parameter: imported_password_hash must be of type String, received ${getType(imported_password_hash)}`)
|
676
|
+
throw new errors.InvalidParameterError(`Bad parameter: imported_password_hash must be of type String, received ${getType(params['imported_password_hash'])}`)
|
676
677
|
}
|
677
678
|
if (params['password'] && !isString(params['password'])) {
|
678
|
-
throw new errors.InvalidParameterError(`Bad parameter: password must be of type String, received ${getType(password)}`)
|
679
|
+
throw new errors.InvalidParameterError(`Bad parameter: password must be of type String, received ${getType(params['password'])}`)
|
679
680
|
}
|
680
681
|
if (params['password_confirmation'] && !isString(params['password_confirmation'])) {
|
681
|
-
throw new errors.InvalidParameterError(`Bad parameter: password_confirmation must be of type String, received ${getType(password_confirmation)}`)
|
682
|
+
throw new errors.InvalidParameterError(`Bad parameter: password_confirmation must be of type String, received ${getType(params['password_confirmation'])}`)
|
682
683
|
}
|
683
684
|
if (params['allowed_ips'] && !isString(params['allowed_ips'])) {
|
684
|
-
throw new errors.InvalidParameterError(`Bad parameter: allowed_ips must be of type String, received ${getType(allowed_ips)}`)
|
685
|
+
throw new errors.InvalidParameterError(`Bad parameter: allowed_ips must be of type String, received ${getType(params['allowed_ips'])}`)
|
685
686
|
}
|
686
687
|
if (params['authenticate_until'] && !isString(params['authenticate_until'])) {
|
687
|
-
throw new errors.InvalidParameterError(`Bad parameter: authenticate_until must be of type String, received ${getType(authenticate_until)}`)
|
688
|
+
throw new errors.InvalidParameterError(`Bad parameter: authenticate_until must be of type String, received ${getType(params['authenticate_until'])}`)
|
688
689
|
}
|
689
690
|
if (params['authentication_method'] && !isString(params['authentication_method'])) {
|
690
|
-
throw new errors.InvalidParameterError(`Bad parameter: authentication_method must be of type String, received ${getType(authentication_method)}`)
|
691
|
+
throw new errors.InvalidParameterError(`Bad parameter: authentication_method must be of type String, received ${getType(params['authentication_method'])}`)
|
691
692
|
}
|
692
693
|
if (params['header_text'] && !isString(params['header_text'])) {
|
693
|
-
throw new errors.InvalidParameterError(`Bad parameter: header_text must be of type String, received ${getType(header_text)}`)
|
694
|
+
throw new errors.InvalidParameterError(`Bad parameter: header_text must be of type String, received ${getType(params['header_text'])}`)
|
694
695
|
}
|
695
696
|
if (params['language'] && !isString(params['language'])) {
|
696
|
-
throw new errors.InvalidParameterError(`Bad parameter: language must be of type String, received ${getType(language)}`)
|
697
|
+
throw new errors.InvalidParameterError(`Bad parameter: language must be of type String, received ${getType(params['language'])}`)
|
697
698
|
}
|
698
699
|
if (params['notification_daily_send_time'] && !isInt(params['notification_daily_send_time'])) {
|
699
|
-
throw new errors.InvalidParameterError(`Bad parameter: notification_daily_send_time must be of type Int, received ${getType(notification_daily_send_time)}`)
|
700
|
+
throw new errors.InvalidParameterError(`Bad parameter: notification_daily_send_time must be of type Int, received ${getType(params['notification_daily_send_time'])}`)
|
700
701
|
}
|
701
702
|
if (params['name'] && !isString(params['name'])) {
|
702
|
-
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(name)}`)
|
703
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params['name'])}`)
|
703
704
|
}
|
704
705
|
if (params['company'] && !isString(params['company'])) {
|
705
|
-
throw new errors.InvalidParameterError(`Bad parameter: company must be of type String, received ${getType(company)}`)
|
706
|
+
throw new errors.InvalidParameterError(`Bad parameter: company must be of type String, received ${getType(params['company'])}`)
|
706
707
|
}
|
707
708
|
if (params['notes'] && !isString(params['notes'])) {
|
708
|
-
throw new errors.InvalidParameterError(`Bad parameter: notes must be of type String, received ${getType(notes)}`)
|
709
|
+
throw new errors.InvalidParameterError(`Bad parameter: notes must be of type String, received ${getType(params['notes'])}`)
|
709
710
|
}
|
710
711
|
if (params['password_validity_days'] && !isInt(params['password_validity_days'])) {
|
711
|
-
throw new errors.InvalidParameterError(`Bad parameter: password_validity_days must be of type Int, received ${getType(password_validity_days)}`)
|
712
|
+
throw new errors.InvalidParameterError(`Bad parameter: password_validity_days must be of type Int, received ${getType(params['password_validity_days'])}`)
|
712
713
|
}
|
713
714
|
if (params['require_login_by'] && !isString(params['require_login_by'])) {
|
714
|
-
throw new errors.InvalidParameterError(`Bad parameter: require_login_by must be of type String, received ${getType(require_login_by)}`)
|
715
|
+
throw new errors.InvalidParameterError(`Bad parameter: require_login_by must be of type String, received ${getType(params['require_login_by'])}`)
|
715
716
|
}
|
716
717
|
if (params['ssl_required'] && !isString(params['ssl_required'])) {
|
717
|
-
throw new errors.InvalidParameterError(`Bad parameter: ssl_required must be of type String, received ${getType(ssl_required)}`)
|
718
|
+
throw new errors.InvalidParameterError(`Bad parameter: ssl_required must be of type String, received ${getType(params['ssl_required'])}`)
|
718
719
|
}
|
719
720
|
if (params['sso_strategy_id'] && !isInt(params['sso_strategy_id'])) {
|
720
|
-
throw new errors.InvalidParameterError(`Bad parameter: sso_strategy_id must be of type Int, received ${getType(sso_strategy_id)}`)
|
721
|
+
throw new errors.InvalidParameterError(`Bad parameter: sso_strategy_id must be of type Int, received ${getType(params['sso_strategy_id'])}`)
|
721
722
|
}
|
722
723
|
if (params['require_2fa'] && !isString(params['require_2fa'])) {
|
723
|
-
throw new errors.InvalidParameterError(`Bad parameter: require_2fa must be of type String, received ${getType(require_2fa)}`)
|
724
|
+
throw new errors.InvalidParameterError(`Bad parameter: require_2fa must be of type String, received ${getType(params['require_2fa'])}`)
|
724
725
|
}
|
725
726
|
if (params['time_zone'] && !isString(params['time_zone'])) {
|
726
|
-
throw new errors.InvalidParameterError(`Bad parameter: time_zone must be of type String, received ${getType(time_zone)}`)
|
727
|
+
throw new errors.InvalidParameterError(`Bad parameter: time_zone must be of type String, received ${getType(params['time_zone'])}`)
|
727
728
|
}
|
728
729
|
if (params['user_root'] && !isString(params['user_root'])) {
|
729
|
-
throw new errors.InvalidParameterError(`Bad parameter: user_root must be of type String, received ${getType(user_root)}`)
|
730
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_root must be of type String, received ${getType(params['user_root'])}`)
|
730
731
|
}
|
731
732
|
if (params['username'] && !isString(params['username'])) {
|
732
|
-
throw new errors.InvalidParameterError(`Bad parameter: username must be of type String, received ${getType(username)}`)
|
733
|
+
throw new errors.InvalidParameterError(`Bad parameter: username must be of type String, received ${getType(params['username'])}`)
|
733
734
|
}
|
734
735
|
|
735
736
|
if (!params['id']) {
|
@@ -742,6 +743,7 @@ class User {
|
|
742
743
|
|
743
744
|
const response = await Api.sendRequest(`/users/${encodeURIComponent(params['id'])}`, 'PATCH', params, this.options)
|
744
745
|
|
746
|
+
|
745
747
|
return new User(response?.data, this.options)
|
746
748
|
}
|
747
749
|
|
@@ -756,7 +758,7 @@ class User {
|
|
756
758
|
|
757
759
|
params.id = this.attributes.id
|
758
760
|
if (params['id'] && !isInt(params['id'])) {
|
759
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
761
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
|
760
762
|
}
|
761
763
|
|
762
764
|
if (!params['id']) {
|
@@ -823,6 +825,7 @@ class User {
|
|
823
825
|
|
824
826
|
const response = await Api.sendRequest(`/users`, 'GET', params, options)
|
825
827
|
|
828
|
+
|
826
829
|
return response?.data?.map(obj => new User(obj, options)) || []
|
827
830
|
}
|
828
831
|
|
@@ -848,6 +851,7 @@ class User {
|
|
848
851
|
|
849
852
|
const response = await Api.sendRequest(`/users/${encodeURIComponent(params['id'])}`, 'GET', params, options)
|
850
853
|
|
854
|
+
|
851
855
|
return new User(response?.data, options)
|
852
856
|
}
|
853
857
|
|
@@ -1007,6 +1011,7 @@ class User {
|
|
1007
1011
|
|
1008
1012
|
const response = await Api.sendRequest(`/users`, 'POST', params, options)
|
1009
1013
|
|
1014
|
+
|
1010
1015
|
return new User(response?.data, options)
|
1011
1016
|
}
|
1012
1017
|
}
|
@@ -1,7 +1,8 @@
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
1
2
|
import Api from '../Api'
|
2
3
|
import * as errors from '../Errors'
|
3
|
-
import
|
4
|
-
|
4
|
+
import { getType, isArray, isInt, isObject, isString } from '../utils'
|
5
|
+
/* eslint-enable no-unused-vars */
|
5
6
|
|
6
7
|
/**
|
7
8
|
* Class UserCipherUse
|
@@ -61,6 +62,7 @@ class UserCipherUse {
|
|
61
62
|
|
62
63
|
const response = await Api.sendRequest(`/user_cipher_uses`, 'GET', params, options)
|
63
64
|
|
65
|
+
|
64
66
|
return response?.data?.map(obj => new UserCipherUse(obj, options)) || []
|
65
67
|
}
|
66
68
|
|
@@ -1,7 +1,8 @@
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
1
2
|
import Api from '../Api'
|
2
3
|
import * as errors from '../Errors'
|
3
|
-
import
|
4
|
-
|
4
|
+
import { getType, isArray, isInt, isObject, isString } from '../utils'
|
5
|
+
/* eslint-enable no-unused-vars */
|
5
6
|
|
6
7
|
/**
|
7
8
|
* Class UserRequest
|
@@ -63,7 +64,7 @@ class UserRequest {
|
|
63
64
|
|
64
65
|
params.id = this.attributes.id
|
65
66
|
if (params['id'] && !isInt(params['id'])) {
|
66
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
67
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
|
67
68
|
}
|
68
69
|
|
69
70
|
if (!params['id']) {
|
@@ -106,6 +107,7 @@ class UserRequest {
|
|
106
107
|
|
107
108
|
const response = await Api.sendRequest(`/user_requests`, 'GET', params, options)
|
108
109
|
|
110
|
+
|
109
111
|
return response?.data?.map(obj => new UserRequest(obj, options)) || []
|
110
112
|
}
|
111
113
|
|
@@ -131,6 +133,7 @@ class UserRequest {
|
|
131
133
|
|
132
134
|
const response = await Api.sendRequest(`/user_requests/${encodeURIComponent(params['id'])}`, 'GET', params, options)
|
133
135
|
|
136
|
+
|
134
137
|
return new UserRequest(response?.data, options)
|
135
138
|
}
|
136
139
|
|
@@ -168,6 +171,7 @@ class UserRequest {
|
|
168
171
|
|
169
172
|
const response = await Api.sendRequest(`/user_requests`, 'POST', params, options)
|
170
173
|
|
174
|
+
|
171
175
|
return new UserRequest(response?.data, options)
|
172
176
|
}
|
173
177
|
}
|
@@ -1,7 +1,8 @@
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
1
2
|
import Api from '../Api'
|
2
3
|
import * as errors from '../Errors'
|
3
|
-
import
|
4
|
-
|
4
|
+
import { getType, isArray, isInt, isObject, isString } from '../utils'
|
5
|
+
/* eslint-enable no-unused-vars */
|
5
6
|
|
6
7
|
/**
|
7
8
|
* Class WebhookTest
|
@@ -181,6 +182,7 @@ class WebhookTest {
|
|
181
182
|
|
182
183
|
const response = await Api.sendRequest(`/webhook_tests`, 'POST', params, options)
|
183
184
|
|
185
|
+
|
184
186
|
return new WebhookTest(response?.data, options)
|
185
187
|
}
|
186
188
|
}
|
@@ -244,7 +244,7 @@ const startsWith = (path1, path2) => typeof path1 === 'string' && typeof path2 =
|
|
244
244
|
&& normalizeForComparison(path1).startsWith(normalizeForComparison(path2))
|
245
245
|
|
246
246
|
const keyLookup = (object, path) => {
|
247
|
-
const key = Object.keys(object || {}).find(
|
247
|
+
const key = Object.keys(object || {}).find(itemKey => same(itemKey, path))
|
248
248
|
return typeof key === 'string' ? object[key] : undefined
|
249
249
|
}
|
250
250
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import pathNormalizer from './pathNormalizer'
|
2
2
|
|
3
|
-
import normalizationForComparisonTestData from '
|
3
|
+
import normalizationForComparisonTestData from '../../shared/normalization_for_comparison_test_data.json'
|
4
4
|
|
5
5
|
describe('pathNormalizer', () => {
|
6
6
|
it('normalizes paths for comparison', () => {
|
@@ -54,4 +54,4 @@ describe('pathNormalizer', () => {
|
|
54
54
|
expect(pathNormalizer.keyLookup(map, '/////foo')).toEqual({ readonly: true })
|
55
55
|
expect(pathNormalizer.keyLookup(map, '/////foo/')).toEqual({ readonly: true })
|
56
56
|
})
|
57
|
-
})
|
57
|
+
})
|
package/src/utils.js
CHANGED
@@ -8,15 +8,16 @@ const isObject = value => value && typeof value === 'object' && !Array.isArray(v
|
|
8
8
|
|
9
9
|
const isString = value => typeof value === 'string'
|
10
10
|
|
11
|
-
const isEmpty = value => !value
|
12
|
-
(isArray(value) && value.length === 0)
|
13
|
-
(isObject(value) && Object.keys(value).length === 0)
|
11
|
+
const isEmpty = value => !value
|
12
|
+
|| (isArray(value) && value.length === 0)
|
13
|
+
|| (isObject(value) && Object.keys(value).length === 0)
|
14
14
|
|
15
15
|
const getType = value =>
|
16
|
-
isArray(value)
|
16
|
+
(isArray(value)
|
17
17
|
? 'array'
|
18
|
-
: typeof value
|
18
|
+
: typeof value)
|
19
19
|
|
20
|
+
// eslint-disable-next-line no-restricted-globals
|
20
21
|
const isBrowser = () => typeof self !== 'undefined' && typeof self.document !== 'undefined'
|
21
22
|
|
22
23
|
export {
|