files.com 1.0.163 → 1.0.164
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/_VERSION +1 -1
- package/lib/models/SsoStrategy.js +96 -34
- package/package.json +1 -1
- package/src/models/SsoStrategy.js +26 -0
package/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.164
|
@@ -7,10 +7,10 @@ exports.default = void 0;
|
|
7
7
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
9
9
|
|
10
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
11
|
-
|
12
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
13
11
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
13
|
+
|
14
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
15
15
|
|
16
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
@@ -170,10 +170,72 @@ var SsoStrategy = /*#__PURE__*/(0, _createClass2.default)(function SsoStrategy()
|
|
170
170
|
(0, _defineProperty2.default)(this, "getLdapUsernameField", function () {
|
171
171
|
return _this.attributes.ldap_username_field;
|
172
172
|
});
|
173
|
-
|
174
|
-
var
|
175
|
-
|
176
|
-
|
173
|
+
(0, _defineProperty2.default)(this, "sync", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
174
|
+
var params,
|
175
|
+
_args = arguments;
|
176
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
177
|
+
while (1) {
|
178
|
+
switch (_context.prev = _context.next) {
|
179
|
+
case 0:
|
180
|
+
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
181
|
+
|
182
|
+
if (_this.attributes.id) {
|
183
|
+
_context.next = 3;
|
184
|
+
break;
|
185
|
+
}
|
186
|
+
|
187
|
+
throw new Error('Current object has no id');
|
188
|
+
|
189
|
+
case 3:
|
190
|
+
if ((0, _utils.isObject)(params)) {
|
191
|
+
_context.next = 5;
|
192
|
+
break;
|
193
|
+
}
|
194
|
+
|
195
|
+
throw new Error("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
196
|
+
|
197
|
+
case 5:
|
198
|
+
params.id = _this.attributes.id;
|
199
|
+
|
200
|
+
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
201
|
+
_context.next = 8;
|
202
|
+
break;
|
203
|
+
}
|
204
|
+
|
205
|
+
throw new Error("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
206
|
+
|
207
|
+
case 8:
|
208
|
+
if (params['id']) {
|
209
|
+
_context.next = 14;
|
210
|
+
break;
|
211
|
+
}
|
212
|
+
|
213
|
+
if (!_this.attributes.id) {
|
214
|
+
_context.next = 13;
|
215
|
+
break;
|
216
|
+
}
|
217
|
+
|
218
|
+
params['id'] = _this.id;
|
219
|
+
_context.next = 14;
|
220
|
+
break;
|
221
|
+
|
222
|
+
case 13:
|
223
|
+
throw new Error('Parameter missing: id');
|
224
|
+
|
225
|
+
case 14:
|
226
|
+
return _context.abrupt("return", _Api.default.sendRequest("/sso_strategies/".concat(params['id'], "/sync"), 'POST', params, _this.options));
|
227
|
+
|
228
|
+
case 15:
|
229
|
+
case "end":
|
230
|
+
return _context.stop();
|
231
|
+
}
|
232
|
+
}
|
233
|
+
}, _callee);
|
234
|
+
})));
|
235
|
+
Object.entries(attributes).forEach(function (_ref2) {
|
236
|
+
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
237
|
+
key = _ref3[0],
|
238
|
+
value = _ref3[1];
|
177
239
|
|
178
240
|
var normalizedKey = key.replace('?', '');
|
179
241
|
_this.attributes[normalizedKey] = value;
|
@@ -184,22 +246,22 @@ var SsoStrategy = /*#__PURE__*/(0, _createClass2.default)(function SsoStrategy()
|
|
184
246
|
});
|
185
247
|
this.options = _objectSpread({}, options);
|
186
248
|
});
|
187
|
-
(0, _defineProperty2.default)(SsoStrategy, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
249
|
+
(0, _defineProperty2.default)(SsoStrategy, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
188
250
|
var _response$data;
|
189
251
|
|
190
252
|
var params,
|
191
253
|
options,
|
192
254
|
response,
|
193
|
-
|
194
|
-
return _regenerator.default.wrap(function
|
255
|
+
_args2 = arguments;
|
256
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
195
257
|
while (1) {
|
196
|
-
switch (
|
258
|
+
switch (_context2.prev = _context2.next) {
|
197
259
|
case 0:
|
198
|
-
params =
|
199
|
-
options =
|
260
|
+
params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
261
|
+
options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
|
200
262
|
|
201
263
|
if (!(params['cursor'] && !(0, _utils.isString)(params['cursor']))) {
|
202
|
-
|
264
|
+
_context2.next = 4;
|
203
265
|
break;
|
204
266
|
}
|
205
267
|
|
@@ -207,28 +269,28 @@ var SsoStrategy = /*#__PURE__*/(0, _createClass2.default)(function SsoStrategy()
|
|
207
269
|
|
208
270
|
case 4:
|
209
271
|
if (!(params['per_page'] && !(0, _utils.isInt)(params['per_page']))) {
|
210
|
-
|
272
|
+
_context2.next = 6;
|
211
273
|
break;
|
212
274
|
}
|
213
275
|
|
214
276
|
throw new Error("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(per_page)));
|
215
277
|
|
216
278
|
case 6:
|
217
|
-
|
279
|
+
_context2.next = 8;
|
218
280
|
return _Api.default.sendRequest("/sso_strategies", 'GET', params, options);
|
219
281
|
|
220
282
|
case 8:
|
221
|
-
response =
|
222
|
-
return
|
283
|
+
response = _context2.sent;
|
284
|
+
return _context2.abrupt("return", (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
|
223
285
|
return new SsoStrategy(obj, options);
|
224
286
|
})) || []);
|
225
287
|
|
226
288
|
case 10:
|
227
289
|
case "end":
|
228
|
-
return
|
290
|
+
return _context2.stop();
|
229
291
|
}
|
230
292
|
}
|
231
|
-
},
|
293
|
+
}, _callee2);
|
232
294
|
})));
|
233
295
|
(0, _defineProperty2.default)(SsoStrategy, "all", function () {
|
234
296
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
@@ -236,20 +298,20 @@ var SsoStrategy = /*#__PURE__*/(0, _createClass2.default)(function SsoStrategy()
|
|
236
298
|
return SsoStrategy.list(params, options);
|
237
299
|
});
|
238
300
|
(0, _defineProperty2.default)(SsoStrategy, "find", /*#__PURE__*/function () {
|
239
|
-
var
|
301
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(id) {
|
240
302
|
var params,
|
241
303
|
options,
|
242
304
|
response,
|
243
|
-
|
244
|
-
return _regenerator.default.wrap(function
|
305
|
+
_args3 = arguments;
|
306
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
245
307
|
while (1) {
|
246
|
-
switch (
|
308
|
+
switch (_context3.prev = _context3.next) {
|
247
309
|
case 0:
|
248
|
-
params =
|
249
|
-
options =
|
310
|
+
params = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
|
311
|
+
options = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {};
|
250
312
|
|
251
313
|
if ((0, _utils.isObject)(params)) {
|
252
|
-
|
314
|
+
_context3.next = 4;
|
253
315
|
break;
|
254
316
|
}
|
255
317
|
|
@@ -259,7 +321,7 @@ var SsoStrategy = /*#__PURE__*/(0, _createClass2.default)(function SsoStrategy()
|
|
259
321
|
params['id'] = id;
|
260
322
|
|
261
323
|
if (params['id']) {
|
262
|
-
|
324
|
+
_context3.next = 7;
|
263
325
|
break;
|
264
326
|
}
|
265
327
|
|
@@ -267,30 +329,30 @@ var SsoStrategy = /*#__PURE__*/(0, _createClass2.default)(function SsoStrategy()
|
|
267
329
|
|
268
330
|
case 7:
|
269
331
|
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
270
|
-
|
332
|
+
_context3.next = 9;
|
271
333
|
break;
|
272
334
|
}
|
273
335
|
|
274
336
|
throw new Error("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
275
337
|
|
276
338
|
case 9:
|
277
|
-
|
339
|
+
_context3.next = 11;
|
278
340
|
return _Api.default.sendRequest("/sso_strategies/".concat(params['id']), 'GET', params, options);
|
279
341
|
|
280
342
|
case 11:
|
281
|
-
response =
|
282
|
-
return
|
343
|
+
response = _context3.sent;
|
344
|
+
return _context3.abrupt("return", new SsoStrategy(response === null || response === void 0 ? void 0 : response.data, options));
|
283
345
|
|
284
346
|
case 13:
|
285
347
|
case "end":
|
286
|
-
return
|
348
|
+
return _context3.stop();
|
287
349
|
}
|
288
350
|
}
|
289
|
-
},
|
351
|
+
}, _callee3);
|
290
352
|
}));
|
291
353
|
|
292
354
|
return function (_x) {
|
293
|
-
return
|
355
|
+
return _ref5.apply(this, arguments);
|
294
356
|
};
|
295
357
|
}());
|
296
358
|
(0, _defineProperty2.default)(SsoStrategy, "get", function (id) {
|
package/package.json
CHANGED
@@ -152,6 +152,32 @@ class SsoStrategy {
|
|
152
152
|
getLdapUsernameField = () => this.attributes.ldap_username_field
|
153
153
|
|
154
154
|
|
155
|
+
// Synchronize provisioning data with the SSO remote server
|
156
|
+
sync = async (params = {}) => {
|
157
|
+
if (!this.attributes.id) {
|
158
|
+
throw new Error('Current object has no id')
|
159
|
+
}
|
160
|
+
|
161
|
+
if (!isObject(params)) {
|
162
|
+
throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
163
|
+
}
|
164
|
+
|
165
|
+
params.id = this.attributes.id
|
166
|
+
if (params['id'] && !isInt(params['id'])) {
|
167
|
+
throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
168
|
+
}
|
169
|
+
|
170
|
+
if (!params['id']) {
|
171
|
+
if (this.attributes.id) {
|
172
|
+
params['id'] = this.id
|
173
|
+
} else {
|
174
|
+
throw new Error('Parameter missing: id')
|
175
|
+
}
|
176
|
+
}
|
177
|
+
|
178
|
+
return Api.sendRequest(`/sso_strategies/${params['id']}/sync`, 'POST', params, this.options)
|
179
|
+
}
|
180
|
+
|
155
181
|
// Parameters:
|
156
182
|
// cursor - string - Used for pagination. Send a cursor value to resume an existing list from the point at which you left off. Get a cursor from an existing list via either the X-Files-Cursor-Next header or the X-Files-Cursor-Prev header.
|
157
183
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|