@allthings/sdk 8.0.0 → 8.1.1

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/dist/lib.cjs.js CHANGED
@@ -10,6 +10,7 @@ var require$$3 = require('http');
10
10
  var require$$4 = require('https');
11
11
  var require$$5 = require('url');
12
12
  var require$$6 = require('fs');
13
+ var require$$8 = require('crypto');
13
14
 
14
15
  function createTokenStore(initialToken) {
15
16
  const token = new Map(Object.entries(initialToken || {}));
@@ -20,7 +21,7 @@ function createTokenStore(initialToken) {
20
21
  };
21
22
  }
22
23
 
23
- const version = "8.0.0";
24
+ const version = "8.1.1";
24
25
 
25
26
  const REST_API_URL = 'https://api.allthings.me';
26
27
  const OAUTH_URL = 'https://accounts.allthings.me';
@@ -45,30 +46,36 @@ const USER_AGENT = `Allthings Node SDK REST Client/${version}`;
45
46
 
46
47
  const RESPONSE_TYPE$1 = 'code';
47
48
  const GRANT_TYPE$3 = 'authorization_code';
48
- const castToAuthorizationRequestParams$1 = (params) => {
49
- const { redirectUri, clientId, scope, state } = params;
49
+ const castToAuthorizationRequestParameters$1 = (parameters) => {
50
+ const { redirectUri, clientId, scope, state } = parameters;
50
51
  if (!clientId) {
51
52
  throw new Error('Missing required "clientId" parameter to perform authorization code grant redirect');
52
53
  }
53
54
  if (!redirectUri) {
54
55
  throw new Error('Missing required "redirectUri" parameter to perform authorization code grant redirect');
55
56
  }
56
- return Object.assign(Object.assign({ client_id: clientId, redirect_uri: redirectUri, response_type: RESPONSE_TYPE$1 }, (scope ? { scope } : {})), (state ? { state } : {}));
57
+ return {
58
+ client_id: clientId,
59
+ redirect_uri: redirectUri,
60
+ response_type: RESPONSE_TYPE$1,
61
+ ...(scope ? { scope } : {}),
62
+ ...(state ? { state } : {}),
63
+ };
57
64
  };
58
- const isEligibleForClientRedirect$1 = (params) => {
65
+ const isEligibleForClientRedirect$1 = (parameters) => {
59
66
  try {
60
- return !!castToAuthorizationRequestParams$1(params);
67
+ return !!castToAuthorizationRequestParameters$1(parameters);
61
68
  }
62
- catch (_a) {
69
+ catch {
63
70
  return false;
64
71
  }
65
72
  };
66
- const getRedirectUrl$1 = (params) => `${params.oauthUrl}/oauth/authorize?${querystring.stringify(castToAuthorizationRequestParams$1(params), {
73
+ const getRedirectUrl$1 = (parameters) => `${parameters.oauthUrl}/oauth/authorize?${querystring.stringify(castToAuthorizationRequestParameters$1(parameters), {
67
74
  skipEmptyString: true,
68
75
  skipNull: true,
69
76
  })}`;
70
- const castToTokenRequestParams$2 = (params) => {
71
- const { authorizationCode, redirectUri, clientId, clientSecret } = params;
77
+ const castToTokenRequestParameters$2 = (parameters) => {
78
+ const { authorizationCode, redirectUri, clientId, clientSecret } = parameters;
72
79
  if (!clientId) {
73
80
  throw new Error('Missing required "clientId" parameter to perform authorization code grant');
74
81
  }
@@ -78,37 +85,44 @@ const castToTokenRequestParams$2 = (params) => {
78
85
  if (!authorizationCode) {
79
86
  throw new Error('Missing required "authorizationCode" parameter to perform authorization code grant');
80
87
  }
81
- return Object.assign({ client_id: clientId, code: authorizationCode, grant_type: GRANT_TYPE$3, redirect_uri: redirectUri }, (clientSecret ? { client_secret: clientSecret } : {}));
88
+ return {
89
+ client_id: clientId,
90
+ code: authorizationCode,
91
+ grant_type: GRANT_TYPE$3,
92
+ redirect_uri: redirectUri,
93
+ ...(clientSecret ? { client_secret: clientSecret } : {}),
94
+ };
82
95
  };
83
- const isEligible$3 = (params) => {
96
+ const isEligible$3 = (parameters) => {
84
97
  try {
85
- return !!castToTokenRequestParams$2(params);
98
+ return !!castToTokenRequestParameters$2(parameters);
86
99
  }
87
- catch (_a) {
100
+ catch {
88
101
  return false;
89
102
  }
90
103
  };
91
- const requestToken$3 = (tokenRequester, params) => tokenRequester(castToTokenRequestParams$2(params));
104
+ const requestToken$3 = (tokenRequester, parameters) => tokenRequester(castToTokenRequestParameters$2(parameters));
92
105
 
93
- const SUBSCRIPTIONS = (process.env.DEBUG &&
94
- process.env.DEBUG.split(',').map((item) => item.trim())) ||
95
- [];
106
+ const SUBSCRIPTIONS = process.env.DEBUG?.split(',').map((item) => item.trim()) || [];
96
107
  function makeLogger(name) {
97
- return ['log', 'info', 'warn', 'error'].reduce((logger, type) => (Object.assign(Object.assign({}, logger), { [type]: function log(...logs) {
108
+ return ['log', 'info', 'warn', 'error'].reduce((logger, type) => ({
109
+ ...logger,
110
+ [type]: function log(...logs) {
98
111
  if (SUBSCRIPTIONS.includes('*') ||
99
112
  SUBSCRIPTIONS.includes(name) ||
100
113
  SUBSCRIPTIONS.includes(name.toLocaleLowerCase())) {
101
114
  console[type](`${name}:`, ...logs);
102
115
  }
103
116
  return true;
104
- } })), {});
117
+ },
118
+ }), {});
105
119
  }
106
120
 
107
121
  const logger = makeLogger('OAuth Token Request');
108
- const makeFetchTokenRequester = (url) => async (params) => {
122
+ const makeFetchTokenRequester = (url) => async (parameters) => {
109
123
  try {
110
124
  const response = await fetch(url, {
111
- body: querystring.stringify(params, {
125
+ body: querystring.stringify(parameters, {
112
126
  skipEmptyString: true,
113
127
  skipNull: true,
114
128
  }),
@@ -143,25 +157,31 @@ const makeFetchTokenRequester = (url) => async (params) => {
143
157
  };
144
158
 
145
159
  const GRANT_TYPE$2 = 'refresh_token';
146
- const castToTokenRequestParams$1 = (params) => {
147
- const { clientId, clientSecret, refreshToken, scope } = params;
160
+ const castToTokenRequestParameters$1 = (parameters) => {
161
+ const { clientId, clientSecret, refreshToken, scope } = parameters;
148
162
  if (!clientId) {
149
163
  throw new Error('Missing required "clientId" parameter to perform refresh token grant');
150
164
  }
151
165
  if (!refreshToken) {
152
166
  throw new Error('Missing required "refreshToken" parameter to perform refresh token grant');
153
167
  }
154
- return Object.assign(Object.assign({ client_id: clientId, grant_type: GRANT_TYPE$2, refresh_token: refreshToken }, (clientSecret ? { client_secret: clientSecret } : {})), (scope ? { scope } : {}));
168
+ return {
169
+ client_id: clientId,
170
+ grant_type: GRANT_TYPE$2,
171
+ refresh_token: refreshToken,
172
+ ...(clientSecret ? { client_secret: clientSecret } : {}),
173
+ ...(scope ? { scope } : {}),
174
+ };
155
175
  };
156
- const isEligible$2 = (params) => {
176
+ const isEligible$2 = (parameters) => {
157
177
  try {
158
- return !!castToTokenRequestParams$1(params);
178
+ return !!castToTokenRequestParameters$1(parameters);
159
179
  }
160
- catch (_a) {
180
+ catch {
161
181
  return false;
162
182
  }
163
183
  };
164
- const requestToken$2 = (tokenRequester, params) => tokenRequester(castToTokenRequestParams$1(params));
184
+ const requestToken$2 = (tokenRequester, parameters) => tokenRequester(castToTokenRequestParameters$1(parameters));
165
185
 
166
186
  async function requestAndSaveToStore(requester, tokenStore) {
167
187
  const response = await requester();
@@ -169,14 +189,14 @@ async function requestAndSaveToStore(requester, tokenStore) {
169
189
  return response;
170
190
  }
171
191
 
172
- const partial = (fn, ...partialArgs) => (...args) => fn(...partialArgs, ...args);
192
+ const partial = (function_, ...partialArguments) => (...arguments_) => function_(...partialArguments, ...arguments_);
173
193
  async function until(predicate, transformer, initialValue, iterationCount = 0) {
174
194
  const transformed = await transformer(initialValue, iterationCount);
175
195
  return (await predicate(transformed, iterationCount))
176
196
  ? transformed
177
197
  : until(predicate, transformer, transformed, iterationCount + 1);
178
198
  }
179
- function fnClearInterval(intervalId) {
199
+ function clearIntervalFunction(intervalId) {
180
200
  clearInterval(intervalId);
181
201
  return true;
182
202
  }
@@ -184,9 +204,9 @@ function fnClearInterval(intervalId) {
184
204
  function pseudoRandomString(length = 16) {
185
205
  let token = '';
186
206
  while (token.length < length) {
187
- token += Math.random().toString(36).substr(2);
207
+ token += Math.random().toString(36).slice(2);
188
208
  }
189
- return token.substr(0, length);
209
+ return token.slice(0, Math.max(0, length));
190
210
  }
191
211
 
192
212
  async function del(request, method, body, returnRawResultObject, headers) {
@@ -197,17 +217,6 @@ async function get$1(request, method, query, returnRawResultObject, headers) {
197
217
  return request('get', method, { headers, query }, returnRawResultObject);
198
218
  }
199
219
 
200
- var __rest$4 = (undefined && undefined.__rest) || function (s, e) {
201
- var t = {};
202
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
203
- t[p] = s[p];
204
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
205
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
206
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
207
- t[p[i]] = s[p[i]];
208
- }
209
- return t;
210
- };
211
220
  var EnumGender;
212
221
  (function (EnumGender) {
213
222
  EnumGender["female"] = "female";
@@ -259,12 +268,16 @@ exports.EnumUserPermissionObjectType = void 0;
259
268
  EnumUserPermissionObjectType["unit"] = "Unit";
260
269
  })(exports.EnumUserPermissionObjectType || (exports.EnumUserPermissionObjectType = {}));
261
270
  const remapUserResult = (user) => {
262
- const { tenantIDs: tenantIds } = user, result = __rest$4(user, ["tenantIDs"]);
263
- return Object.assign(Object.assign({}, result), { tenantIds });
271
+ const { tenantIDs: tenantIds, ...result } = user;
272
+ return { ...result, tenantIds };
264
273
  };
265
274
  const remapEmbeddedUser = (embedded) => embedded.users ? embedded.users.map(remapUserResult) : [];
266
275
  async function userCreate(client, appId, username, data) {
267
- return client.post('/v1/users', Object.assign(Object.assign({}, data), { creationContext: appId, username }));
276
+ return client.post('/v1/users', {
277
+ ...data,
278
+ creationContext: appId,
279
+ username,
280
+ });
268
281
  }
269
282
  async function getUsers(client, page = 1, limit = -1, filter = {}) {
270
283
  const { _embedded: { items: users }, total, } = await client.get('/v1/users', {
@@ -281,34 +294,40 @@ async function userGetById(client, userId) {
281
294
  return remapUserResult(await client.get(`/v1/users/${userId}`));
282
295
  }
283
296
  async function userUpdateById(client, userId, data) {
284
- const { tenantIds: tenantIDs } = data, rest = __rest$4(data, ["tenantIds"]);
285
- return remapUserResult(await client.patch(`/v1/users/${userId}`, Object.assign(Object.assign({}, rest), { tenantIDs })));
297
+ const { tenantIds: tenantIDs, ...rest } = data;
298
+ return remapUserResult(await client.patch(`/v1/users/${userId}`, { ...rest, tenantIDs }));
286
299
  }
287
300
  async function userCreatePermission(client, userId, data) {
288
- const { objectId: objectID } = data, rest = __rest$4(data, ["objectId"]);
289
- const _a = await client.post(`/v1/users/${userId}/permissions`, Object.assign(Object.assign({}, rest), { objectID })), { objectID: resultObjectId } = _a, result = __rest$4(_a, ["objectID"]);
290
- return Object.assign(Object.assign({}, result), { objectId: resultObjectId });
301
+ const { objectId: objectID, ...rest } = data;
302
+ const { objectID: resultObjectId, ...result } = await client.post(`/v1/users/${userId}/permissions`, {
303
+ ...rest,
304
+ objectID,
305
+ });
306
+ return {
307
+ ...result,
308
+ objectId: resultObjectId,
309
+ };
291
310
  }
292
311
  async function userCreatePermissionBatch(client, userId, permissions) {
293
312
  const { objectId, objectType, roles, startDate, endDate } = permissions;
294
313
  const batch = {
295
314
  batch: roles.map((role) => ({
296
- endDate: endDate && endDate.toISOString(),
315
+ endDate: endDate?.toISOString(),
297
316
  objectID: objectId,
298
317
  objectType,
299
318
  restrictions: [],
300
319
  role,
301
- startDate: startDate && startDate.toISOString(),
320
+ startDate: startDate?.toISOString(),
302
321
  })),
303
322
  };
304
323
  return !(await client.post(`/v1/users/${userId}/permissions`, batch));
305
324
  }
306
325
  async function userGetPermissions(client, userId) {
307
326
  const { _embedded: { items: permissions }, } = await client.get(`/v1/users/${userId}/roles?limit=-1`);
308
- return permissions.map((_a) => {
309
- var { objectID: objectId } = _a, result = __rest$4(_a, ["objectID"]);
310
- return (Object.assign(Object.assign({}, result), { objectId }));
311
- });
327
+ return permissions.map(({ objectID: objectId, ...result }) => ({
328
+ ...result,
329
+ objectId,
330
+ }));
312
331
  }
313
332
  async function userDeletePermission(client, permissionId) {
314
333
  return !(await client.delete(`/v1/permissions/${permissionId}`));
@@ -334,10 +353,19 @@ async function userChangePassword(client, userId, currentPassword, newPassword)
334
353
  }
335
354
 
336
355
  async function agentCreate(client, appId, propertyManagerId, username, data, sendInvitation, externalAgentCompany) {
337
- const user = await client.userCreate(appId, username, Object.assign(Object.assign({}, data), { type: EnumUserType.customer }));
338
- const manager = await client.post(`/v1/property-managers/${propertyManagerId}/users`, Object.assign({ userID: user.id }, (externalAgentCompany && { externalAgentCompany })));
356
+ const user = await client.userCreate(appId, username, {
357
+ ...data,
358
+ type: EnumUserType.customer,
359
+ });
360
+ const manager = await client.post(`/v1/property-managers/${propertyManagerId}/users`, {
361
+ userID: user.id,
362
+ ...(externalAgentCompany && { externalAgentCompany }),
363
+ });
339
364
  return (!((typeof sendInvitation !== 'undefined' ? sendInvitation : true) &&
340
- (await client.post(`/v1/users/${user.id}/invitations`))) && Object.assign(Object.assign({}, user), manager));
365
+ (await client.post(`/v1/users/${user.id}/invitations`))) && {
366
+ ...user,
367
+ ...manager,
368
+ });
341
369
  }
342
370
  async function agentCreatePermissions(client, agentId, objectId, objectType, permissions, startDate, endDate) {
343
371
  return client.userCreatePermissionBatch(agentId, {
@@ -351,7 +379,11 @@ async function agentCreatePermissions(client, agentId, objectId, objectType, per
351
379
  }
352
380
 
353
381
  async function appCreate(client, userId, data) {
354
- return client.post(`/v1/users/${userId}/apps`, Object.assign(Object.assign({ availableLocales: { '0': 'de_DE' } }, data), { siteUrl: data.siteUrl.replace('_', '') }));
382
+ return client.post(`/v1/users/${userId}/apps`, {
383
+ availableLocales: { '0': 'de_DE' },
384
+ ...data,
385
+ siteUrl: data.siteUrl.replace('_', ''),
386
+ });
355
387
  }
356
388
  async function appGetById(client, appId) {
357
389
  return client.get(`/v1/apps/${appId}`);
@@ -417,11 +449,12 @@ async function conversationGetById(client, conversationId) {
417
449
  }
418
450
  async function conversationCreateMessage(client, conversationId, messageData) {
419
451
  const url = `/v1/conversations/${conversationId}/messages`;
420
- const payload = messageData.attachments && messageData.attachments.length
452
+ const payload = messageData.attachments?.length
421
453
  ? {
422
454
  content: {
423
455
  description: messageData.body,
424
- files: (await createManyFilesSorted(messageData.attachments, client)).success,
456
+ files: (await createManyFilesSorted(messageData.attachments, client))
457
+ .success,
425
458
  },
426
459
  createdBy: messageData.createdBy,
427
460
  inputChannel: messageData.inputChannel,
@@ -451,24 +484,16 @@ async function fileDelete(client, fileId) {
451
484
  return (await client.delete(`/v1/files/${fileId}`)) === '';
452
485
  }
453
486
 
454
- var __rest$3 = (undefined && undefined.__rest) || function (s, e) {
455
- var t = {};
456
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
457
- t[p] = s[p];
458
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
459
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
460
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
461
- t[p[i]] = s[p[i]];
462
- }
463
- return t;
464
- };
465
487
  async function groupCreate(client, propertyId, data) {
466
- const { propertyManagerId } = data, rest = __rest$3(data, ["propertyManagerId"]);
467
- return client.post(`/v1/properties/${propertyId}/groups`, Object.assign(Object.assign({}, rest), { propertyManagerID: propertyManagerId }));
488
+ const { propertyManagerId, ...rest } = data;
489
+ return client.post(`/v1/properties/${propertyId}/groups`, {
490
+ ...rest,
491
+ propertyManagerID: propertyManagerId,
492
+ });
468
493
  }
469
494
  async function groupGetById(client, groupId) {
470
- const _a = await client.get(`/v1/groups/${groupId}`), { propertyManagerID: propertyManagerId } = _a, result = __rest$3(_a, ["propertyManagerID"]);
471
- return Object.assign(Object.assign({}, result), { propertyManagerId });
495
+ const { propertyManagerID: propertyManagerId, ...result } = await client.get(`/v1/groups/${groupId}`);
496
+ return { ...result, propertyManagerId };
472
497
  }
473
498
  async function groupUpdateById(client, groupId, data) {
474
499
  return client.patch(`/v1/groups/${groupId}`, data);
@@ -486,9 +511,13 @@ async function lookupIds(client, appId, data) {
486
511
  const url = data.dataSource
487
512
  ? `/v1/id-lookup/${appId}/${data.resource}/${data.dataSource}`
488
513
  : `/v1/id-lookup/${appId}/${data.resource}`;
489
- return client.post(url, Object.assign(Object.assign({ externalIds: typeof data.externalIds === 'string'
514
+ return client.post(url, {
515
+ externalIds: typeof data.externalIds === 'string'
490
516
  ? [data.externalIds]
491
- : data.externalIds }, (data.parentId ? { parentId: data.parentId } : {})), (data.userType ? { userType: data.userType } : {})));
517
+ : data.externalIds,
518
+ ...(data.parentId ? { parentId: data.parentId } : {}),
519
+ ...(data.userType ? { userType: data.userType } : {}),
520
+ });
492
521
  }
493
522
 
494
523
  function stringToDate(s) {
@@ -498,17 +527,6 @@ function dateToString(d) {
498
527
  return d.toISOString();
499
528
  }
500
529
 
501
- var __rest$2 = (undefined && undefined.__rest) || function (s, e) {
502
- var t = {};
503
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
504
- t[p] = s[p];
505
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
506
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
507
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
508
- t[p[i]] = s[p[i]];
509
- }
510
- return t;
511
- };
512
530
  var EnumNotificationCategory;
513
531
  (function (EnumNotificationCategory) {
514
532
  EnumNotificationCategory["events"] = "events";
@@ -541,9 +559,13 @@ var EnumNotificationType;
541
559
  EnumNotificationType["ticketComment"] = "ticket-comment";
542
560
  EnumNotificationType["welcomeNotification"] = "welcome-notification";
543
561
  })(EnumNotificationType || (EnumNotificationType = {}));
544
- function remapNotificationResult(_a) {
545
- var { createdAt, objectID, referencedObjectID } = _a, restNotification = __rest$2(_a, ["createdAt", "objectID", "referencedObjectID"]);
546
- return Object.assign({ createdAt: stringToDate(createdAt), objectId: objectID, referencedObjectId: referencedObjectID }, restNotification);
562
+ function remapNotificationResult({ createdAt, objectID, referencedObjectID, ...restNotification }) {
563
+ return {
564
+ createdAt: stringToDate(createdAt),
565
+ objectId: objectID,
566
+ referencedObjectId: referencedObjectID,
567
+ ...restNotification,
568
+ };
547
569
  }
548
570
  async function notificationsGetByUser(client, userId, page = 1, limit = -1) {
549
571
  const { _embedded: { items: notifications }, total, metaData, } = await client.get(`/v1/users/${userId}/notifications?page=${page}&limit=${limit}`);
@@ -562,8 +584,11 @@ async function notificationUpdateRead(client, notificationId) {
562
584
  return remapNotificationResult(await client.patch(`/v1/notifications/${notificationId}`, { read: true }));
563
585
  }
564
586
 
565
- function remapKeys(input, mapFn) {
566
- return Object.entries(input).reduce((acc, entry) => (Object.assign(Object.assign({}, acc), { [mapFn(entry[0])]: entry[1] })), {});
587
+ function remapKeys(input, mapFunction) {
588
+ return Object.entries(input).reduce((accumulator, entry) => ({
589
+ ...accumulator,
590
+ [mapFunction(entry[0])]: entry[1],
591
+ }), {});
567
592
  }
568
593
 
569
594
  function camelCaseToDash(input) {
@@ -609,26 +634,20 @@ async function getProperties(client, page = 1, limit = -1, filter = {}) {
609
634
  return { _embedded: { items: properties }, total };
610
635
  }
611
636
 
612
- var __rest$1 = (undefined && undefined.__rest) || function (s, e) {
613
- var t = {};
614
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
615
- t[p] = s[p];
616
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
617
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
618
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
619
- t[p[i]] = s[p[i]];
620
- }
621
- return t;
622
- };
623
637
  const remapRegistationCodeResult = (registrationCode) => {
624
- const { tenantID: externalId } = registrationCode, result = __rest$1(registrationCode, ["tenantID"]);
625
- return Object.assign(Object.assign({}, result), { externalId });
638
+ const { tenantID: externalId, ...result } = registrationCode;
639
+ return { ...result, externalId };
626
640
  };
627
641
  async function registrationCodeCreate(client, code, utilisationPeriods, options = { permanent: false }) {
628
- const { externalId } = options, moreOptions = __rest$1(options, ["externalId"]);
629
- return remapRegistationCodeResult(await client.post('/v1/registration-codes', Object.assign(Object.assign({ code, utilisationPeriods: typeof utilisationPeriods === 'string'
642
+ const { externalId, ...moreOptions } = options;
643
+ return remapRegistationCodeResult(await client.post('/v1/registration-codes', {
644
+ code,
645
+ utilisationPeriods: typeof utilisationPeriods === 'string'
630
646
  ? [utilisationPeriods]
631
- : utilisationPeriods }, (externalId ? { externalId, tenantID: externalId } : {})), moreOptions)));
647
+ : utilisationPeriods,
648
+ ...(externalId ? { externalId, tenantID: externalId } : {}),
649
+ ...moreOptions,
650
+ }));
632
651
  }
633
652
  async function registrationCodeUpdateById(client, registrationCodeId, data) {
634
653
  return remapRegistationCodeResult(await client.patch(`/v1/registration-codes/${registrationCodeId}`, data));
@@ -667,14 +686,21 @@ async function ticketGetById(client, ticketId) {
667
686
  return client.get(`/v1/tickets/${ticketId}`);
668
687
  }
669
688
  async function ticketCreateOnUser(client, userId, utilisationPeriodId, payload) {
670
- return client.post(`/v1/users/${userId}/tickets`, Object.assign(Object.assign({}, payload), { files: payload.files
689
+ return client.post(`/v1/users/${userId}/tickets`, {
690
+ ...payload,
691
+ files: payload.files
671
692
  ? (await createManyFilesSorted(payload.files, client)).success
672
- : [], utilisationPeriod: utilisationPeriodId }));
693
+ : [],
694
+ utilisationPeriod: utilisationPeriodId,
695
+ });
673
696
  }
674
697
  async function ticketCreateOnServiceProvider(client, serviceProviderId, payload) {
675
- return client.post(`/v1/property-managers/${serviceProviderId}/tickets`, Object.assign(Object.assign({}, payload), { files: payload.files
698
+ return client.post(`/v1/property-managers/${serviceProviderId}/tickets`, {
699
+ ...payload,
700
+ files: payload.files
676
701
  ? (await createManyFilesSorted(payload.files, client)).success
677
- : [] }));
702
+ : [],
703
+ });
678
704
  }
679
705
 
680
706
  exports.EnumUnitObjectType = void 0;
@@ -796,17 +822,6 @@ async function userRelationsGetByUser(client, userId) {
796
822
  return client.get(`/v1/users/${userId}/user-relations`);
797
823
  }
798
824
 
799
- var __rest = (undefined && undefined.__rest) || function (s, e) {
800
- var t = {};
801
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
802
- t[p] = s[p];
803
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
804
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
805
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
806
- t[p[i]] = s[p[i]];
807
- }
808
- return t;
809
- };
810
825
  exports.EnumUtilisationPeriodType = void 0;
811
826
  (function (EnumUtilisationPeriodType) {
812
827
  EnumUtilisationPeriodType["tenant"] = "tenant";
@@ -814,16 +829,31 @@ exports.EnumUtilisationPeriodType = void 0;
814
829
  EnumUtilisationPeriodType["vacant"] = "vacant";
815
830
  })(exports.EnumUtilisationPeriodType || (exports.EnumUtilisationPeriodType = {}));
816
831
  async function utilisationPeriodCreate(client, unitId, data) {
817
- const _a = await client.post(`/v1/units/${unitId}/utilisation-periods`, data), { tenantIDs: tenantIds, _embedded } = _a, result = __rest(_a, ["tenantIDs", "_embedded"]);
818
- return Object.assign(Object.assign({}, result), { invitations: _embedded.invitations.map(remapRegistationCodeResult), tenantIds, users: remapEmbeddedUser(_embedded) });
832
+ const { tenantIDs: tenantIds, _embedded, ...result } = await client.post(`/v1/units/${unitId}/utilisation-periods`, data);
833
+ return {
834
+ ...result,
835
+ invitations: _embedded.invitations.map(remapRegistationCodeResult),
836
+ tenantIds,
837
+ users: remapEmbeddedUser(_embedded),
838
+ };
819
839
  }
820
840
  async function utilisationPeriodGetById(client, utilisationPeriodId) {
821
- const _a = await client.get(`/v1/utilisation-periods/${utilisationPeriodId}`), { tenantIDs: tenantIds, _embedded } = _a, result = __rest(_a, ["tenantIDs", "_embedded"]);
822
- return Object.assign(Object.assign({}, result), { invitations: _embedded.invitations.map(remapRegistationCodeResult), tenantIds, users: remapEmbeddedUser(_embedded) });
841
+ const { tenantIDs: tenantIds, _embedded, ...result } = await client.get(`/v1/utilisation-periods/${utilisationPeriodId}`);
842
+ return {
843
+ ...result,
844
+ invitations: _embedded.invitations.map(remapRegistationCodeResult),
845
+ tenantIds,
846
+ users: remapEmbeddedUser(_embedded),
847
+ };
823
848
  }
824
849
  async function utilisationPeriodUpdateById(client, utilisationPeriodId, data) {
825
- const _a = await client.patch(`/v1/utilisation-periods/${utilisationPeriodId}`, data), { tenantIDs: tenantIds, _embedded } = _a, result = __rest(_a, ["tenantIDs", "_embedded"]);
826
- return Object.assign(Object.assign({}, result), { invitations: _embedded.invitations.map(remapRegistationCodeResult), tenantIds, users: remapEmbeddedUser(_embedded) });
850
+ const { tenantIDs: tenantIds, _embedded, ...result } = await client.patch(`/v1/utilisation-periods/${utilisationPeriodId}`, data);
851
+ return {
852
+ ...result,
853
+ invitations: _embedded.invitations.map(remapRegistationCodeResult),
854
+ tenantIds,
855
+ users: remapEmbeddedUser(_embedded),
856
+ };
827
857
  }
828
858
  async function utilisationPeriodDelete(client, utilisationPeriodId) {
829
859
  return !(await client.delete(`/v1/utilisation-periods/${utilisationPeriodId}/soft`));
@@ -11927,7 +11957,7 @@ var hasRequiredMimeTypes;
11927
11957
  function requireMimeTypes () {
11928
11958
  if (hasRequiredMimeTypes) return mimeTypes;
11929
11959
  hasRequiredMimeTypes = 1;
11930
- (function (exports) {
11960
+ (function (exports$1) {
11931
11961
 
11932
11962
  /**
11933
11963
  * Module dependencies.
@@ -11950,16 +11980,16 @@ function requireMimeTypes () {
11950
11980
  * @public
11951
11981
  */
11952
11982
 
11953
- exports.charset = charset;
11954
- exports.charsets = { lookup: charset };
11955
- exports.contentType = contentType;
11956
- exports.extension = extension;
11957
- exports.extensions = Object.create(null);
11958
- exports.lookup = lookup;
11959
- exports.types = Object.create(null);
11983
+ exports$1.charset = charset;
11984
+ exports$1.charsets = { lookup: charset };
11985
+ exports$1.contentType = contentType;
11986
+ exports$1.extension = extension;
11987
+ exports$1.extensions = Object.create(null);
11988
+ exports$1.lookup = lookup;
11989
+ exports$1.types = Object.create(null);
11960
11990
 
11961
11991
  // Populate the extensions/types maps
11962
- populateMaps(exports.extensions, exports.types);
11992
+ populateMaps(exports$1.extensions, exports$1.types);
11963
11993
 
11964
11994
  /**
11965
11995
  * Get the default charset for a MIME type.
@@ -12003,7 +12033,7 @@ function requireMimeTypes () {
12003
12033
  }
12004
12034
 
12005
12035
  var mime = str.indexOf('/') === -1
12006
- ? exports.lookup(str)
12036
+ ? exports$1.lookup(str)
12007
12037
  : str;
12008
12038
 
12009
12039
  if (!mime) {
@@ -12012,7 +12042,7 @@ function requireMimeTypes () {
12012
12042
 
12013
12043
  // TODO: use content-type or other module
12014
12044
  if (mime.indexOf('charset') === -1) {
12015
- var charset = exports.charset(mime);
12045
+ var charset = exports$1.charset(mime);
12016
12046
  if (charset) mime += '; charset=' + charset.toLowerCase();
12017
12047
  }
12018
12048
 
@@ -12035,7 +12065,7 @@ function requireMimeTypes () {
12035
12065
  var match = EXTRACT_TYPE_REGEXP.exec(type);
12036
12066
 
12037
12067
  // get extensions
12038
- var exts = match && exports.extensions[match[1].toLowerCase()];
12068
+ var exts = match && exports$1.extensions[match[1].toLowerCase()];
12039
12069
 
12040
12070
  if (!exts || !exts.length) {
12041
12071
  return false
@@ -12065,7 +12095,7 @@ function requireMimeTypes () {
12065
12095
  return false
12066
12096
  }
12067
12097
 
12068
- return exports.types[extension] || false
12098
+ return exports$1.types[extension] || false
12069
12099
  }
12070
12100
 
12071
12101
  /**
@@ -13557,7 +13587,7 @@ function requireGetIntrinsic () {
13557
13587
  if (!allowMissing) {
13558
13588
  throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
13559
13589
  }
13560
- return void 0;
13590
+ return void undefined$1;
13561
13591
  }
13562
13592
  if ($gOPD && (i + 1) >= parts.length) {
13563
13593
  var desc = $gOPD(value, part);
@@ -13655,12 +13685,11 @@ var hasRequiredPopulate;
13655
13685
  function requirePopulate () {
13656
13686
  if (hasRequiredPopulate) return populate;
13657
13687
  hasRequiredPopulate = 1;
13658
- // populates missing values
13659
- populate = function(dst, src) {
13660
13688
 
13661
- Object.keys(src).forEach(function(prop)
13662
- {
13663
- dst[prop] = dst[prop] || src[prop];
13689
+ // populates missing values
13690
+ populate = function (dst, src) {
13691
+ Object.keys(src).forEach(function (prop) {
13692
+ dst[prop] = dst[prop] || src[prop]; // eslint-disable-line no-param-reassign
13664
13693
  });
13665
13694
 
13666
13695
  return dst;
@@ -13674,6 +13703,7 @@ var hasRequiredForm_data;
13674
13703
  function requireForm_data () {
13675
13704
  if (hasRequiredForm_data) return form_data;
13676
13705
  hasRequiredForm_data = 1;
13706
+
13677
13707
  var CombinedStream = requireCombined_stream();
13678
13708
  var util = require$$1;
13679
13709
  var path = require$$1$1;
@@ -13682,24 +13712,20 @@ function requireForm_data () {
13682
13712
  var parseUrl = require$$5.parse;
13683
13713
  var fs = require$$6;
13684
13714
  var Stream = require$$0$1.Stream;
13715
+ var crypto = require$$8;
13685
13716
  var mime = requireMimeTypes();
13686
13717
  var asynckit = requireAsynckit();
13687
13718
  var setToStringTag = /*@__PURE__*/ requireEsSetTostringtag();
13719
+ var hasOwn = /*@__PURE__*/ requireHasown();
13688
13720
  var populate = requirePopulate();
13689
13721
 
13690
- // Public API
13691
- form_data = FormData;
13692
-
13693
- // make it a Stream
13694
- util.inherits(FormData, CombinedStream);
13695
-
13696
13722
  /**
13697
13723
  * Create readable "multipart/form-data" streams.
13698
13724
  * Can be used to submit forms
13699
13725
  * and file uploads to other web applications.
13700
13726
  *
13701
13727
  * @constructor
13702
- * @param {Object} options - Properties to be added/overriden for FormData and CombinedStream
13728
+ * @param {object} options - Properties to be added/overriden for FormData and CombinedStream
13703
13729
  */
13704
13730
  function FormData(options) {
13705
13731
  if (!(this instanceof FormData)) {
@@ -13712,35 +13738,39 @@ function requireForm_data () {
13712
13738
 
13713
13739
  CombinedStream.call(this);
13714
13740
 
13715
- options = options || {};
13716
- for (var option in options) {
13741
+ options = options || {}; // eslint-disable-line no-param-reassign
13742
+ for (var option in options) { // eslint-disable-line no-restricted-syntax
13717
13743
  this[option] = options[option];
13718
13744
  }
13719
13745
  }
13720
13746
 
13747
+ // make it a Stream
13748
+ util.inherits(FormData, CombinedStream);
13749
+
13721
13750
  FormData.LINE_BREAK = '\r\n';
13722
13751
  FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream';
13723
13752
 
13724
- FormData.prototype.append = function(field, value, options) {
13725
-
13726
- options = options || {};
13753
+ FormData.prototype.append = function (field, value, options) {
13754
+ options = options || {}; // eslint-disable-line no-param-reassign
13727
13755
 
13728
13756
  // allow filename as single option
13729
- if (typeof options == 'string') {
13730
- options = {filename: options};
13757
+ if (typeof options === 'string') {
13758
+ options = { filename: options }; // eslint-disable-line no-param-reassign
13731
13759
  }
13732
13760
 
13733
13761
  var append = CombinedStream.prototype.append.bind(this);
13734
13762
 
13735
13763
  // all that streamy business can't handle numbers
13736
- if (typeof value == 'number') {
13737
- value = '' + value;
13764
+ if (typeof value === 'number' || value == null) {
13765
+ value = String(value); // eslint-disable-line no-param-reassign
13738
13766
  }
13739
13767
 
13740
13768
  // https://github.com/felixge/node-form-data/issues/38
13741
13769
  if (Array.isArray(value)) {
13742
- // Please convert your array into string
13743
- // the way web server expects it
13770
+ /*
13771
+ * Please convert your array into string
13772
+ * the way web server expects it
13773
+ */
13744
13774
  this._error(new Error('Arrays are not supported.'));
13745
13775
  return;
13746
13776
  }
@@ -13756,15 +13786,17 @@ function requireForm_data () {
13756
13786
  this._trackLength(header, value, options);
13757
13787
  };
13758
13788
 
13759
- FormData.prototype._trackLength = function(header, value, options) {
13789
+ FormData.prototype._trackLength = function (header, value, options) {
13760
13790
  var valueLength = 0;
13761
13791
 
13762
- // used w/ getLengthSync(), when length is known.
13763
- // e.g. for streaming directly from a remote server,
13764
- // w/ a known file a size, and not wanting to wait for
13765
- // incoming file to finish to get its size.
13792
+ /*
13793
+ * used w/ getLengthSync(), when length is known.
13794
+ * e.g. for streaming directly from a remote server,
13795
+ * w/ a known file a size, and not wanting to wait for
13796
+ * incoming file to finish to get its size.
13797
+ */
13766
13798
  if (options.knownLength != null) {
13767
- valueLength += +options.knownLength;
13799
+ valueLength += Number(options.knownLength);
13768
13800
  } else if (Buffer.isBuffer(value)) {
13769
13801
  valueLength = value.length;
13770
13802
  } else if (typeof value === 'string') {
@@ -13774,12 +13806,10 @@ function requireForm_data () {
13774
13806
  this._valueLength += valueLength;
13775
13807
 
13776
13808
  // @check why add CRLF? does this account for custom/multiple CRLFs?
13777
- this._overheadLength +=
13778
- Buffer.byteLength(header) +
13779
- FormData.LINE_BREAK.length;
13809
+ this._overheadLength += Buffer.byteLength(header) + FormData.LINE_BREAK.length;
13780
13810
 
13781
13811
  // empty or either doesn't have path or not an http response or not a stream
13782
- if (!value || ( !value.path && !(value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) && !(value instanceof Stream))) {
13812
+ if (!value || (!value.path && !(value.readable && hasOwn(value, 'httpVersion')) && !(value instanceof Stream))) {
13783
13813
  return;
13784
13814
  }
13785
13815
 
@@ -13789,9 +13819,8 @@ function requireForm_data () {
13789
13819
  }
13790
13820
  };
13791
13821
 
13792
- FormData.prototype._lengthRetriever = function(value, callback) {
13793
- if (Object.prototype.hasOwnProperty.call(value, 'fd')) {
13794
-
13822
+ FormData.prototype._lengthRetriever = function (value, callback) {
13823
+ if (hasOwn(value, 'fd')) {
13795
13824
  // take read range into a account
13796
13825
  // `end` = Infinity –> read file till the end
13797
13826
  //
@@ -13800,54 +13829,52 @@ function requireForm_data () {
13800
13829
  // Fix it when node fixes it.
13801
13830
  // https://github.com/joyent/node/issues/7819
13802
13831
  if (value.end != undefined && value.end != Infinity && value.start != undefined) {
13803
-
13804
13832
  // when end specified
13805
13833
  // no need to calculate range
13806
13834
  // inclusive, starts with 0
13807
- callback(null, value.end + 1 - (value.start ? value.start : 0));
13835
+ callback(null, value.end + 1 - (value.start ? value.start : 0)); // eslint-disable-line callback-return
13808
13836
 
13809
- // not that fast snoopy
13837
+ // not that fast snoopy
13810
13838
  } else {
13811
13839
  // still need to fetch file size from fs
13812
- fs.stat(value.path, function(err, stat) {
13813
-
13814
- var fileSize;
13815
-
13840
+ fs.stat(value.path, function (err, stat) {
13816
13841
  if (err) {
13817
13842
  callback(err);
13818
13843
  return;
13819
13844
  }
13820
13845
 
13821
13846
  // update final size based on the range options
13822
- fileSize = stat.size - (value.start ? value.start : 0);
13847
+ var fileSize = stat.size - (value.start ? value.start : 0);
13823
13848
  callback(null, fileSize);
13824
13849
  });
13825
13850
  }
13826
13851
 
13827
- // or http response
13828
- } else if (Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
13829
- callback(null, +value.headers['content-length']);
13852
+ // or http response
13853
+ } else if (hasOwn(value, 'httpVersion')) {
13854
+ callback(null, Number(value.headers['content-length'])); // eslint-disable-line callback-return
13830
13855
 
13831
- // or request stream http://github.com/mikeal/request
13832
- } else if (Object.prototype.hasOwnProperty.call(value, 'httpModule')) {
13856
+ // or request stream http://github.com/mikeal/request
13857
+ } else if (hasOwn(value, 'httpModule')) {
13833
13858
  // wait till response come back
13834
- value.on('response', function(response) {
13859
+ value.on('response', function (response) {
13835
13860
  value.pause();
13836
- callback(null, +response.headers['content-length']);
13861
+ callback(null, Number(response.headers['content-length']));
13837
13862
  });
13838
13863
  value.resume();
13839
13864
 
13840
- // something else
13865
+ // something else
13841
13866
  } else {
13842
- callback('Unknown stream');
13867
+ callback('Unknown stream'); // eslint-disable-line callback-return
13843
13868
  }
13844
13869
  };
13845
13870
 
13846
- FormData.prototype._multiPartHeader = function(field, value, options) {
13847
- // custom header specified (as string)?
13848
- // it becomes responsible for boundary
13849
- // (e.g. to handle extra CRLFs on .NET servers)
13850
- if (typeof options.header == 'string') {
13871
+ FormData.prototype._multiPartHeader = function (field, value, options) {
13872
+ /*
13873
+ * custom header specified (as string)?
13874
+ * it becomes responsible for boundary
13875
+ * (e.g. to handle extra CRLFs on .NET servers)
13876
+ */
13877
+ if (typeof options.header === 'string') {
13851
13878
  return options.header;
13852
13879
  }
13853
13880
 
@@ -13855,7 +13882,7 @@ function requireForm_data () {
13855
13882
  var contentType = this._getContentType(value, options);
13856
13883
 
13857
13884
  var contents = '';
13858
- var headers = {
13885
+ var headers = {
13859
13886
  // add custom disposition as third element or keep it two elements if not
13860
13887
  'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []),
13861
13888
  // if no content type. allow it to be empty array
@@ -13863,18 +13890,18 @@ function requireForm_data () {
13863
13890
  };
13864
13891
 
13865
13892
  // allow custom headers.
13866
- if (typeof options.header == 'object') {
13893
+ if (typeof options.header === 'object') {
13867
13894
  populate(headers, options.header);
13868
13895
  }
13869
13896
 
13870
13897
  var header;
13871
- for (var prop in headers) {
13872
- if (Object.prototype.hasOwnProperty.call(headers, prop)) {
13898
+ for (var prop in headers) { // eslint-disable-line no-restricted-syntax
13899
+ if (hasOwn(headers, prop)) {
13873
13900
  header = headers[prop];
13874
13901
 
13875
13902
  // skip nullish headers.
13876
13903
  if (header == null) {
13877
- continue;
13904
+ continue; // eslint-disable-line no-restricted-syntax, no-continue
13878
13905
  }
13879
13906
 
13880
13907
  // convert all headers to arrays.
@@ -13892,49 +13919,45 @@ function requireForm_data () {
13892
13919
  return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK;
13893
13920
  };
13894
13921
 
13895
- FormData.prototype._getContentDisposition = function(value, options) {
13896
-
13897
- var filename
13898
- , contentDisposition
13899
- ;
13922
+ FormData.prototype._getContentDisposition = function (value, options) { // eslint-disable-line consistent-return
13923
+ var filename;
13900
13924
 
13901
13925
  if (typeof options.filepath === 'string') {
13902
13926
  // custom filepath for relative paths
13903
13927
  filename = path.normalize(options.filepath).replace(/\\/g, '/');
13904
- } else if (options.filename || value.name || value.path) {
13905
- // custom filename take precedence
13906
- // formidable and the browser add a name property
13907
- // fs- and request- streams have path property
13908
- filename = path.basename(options.filename || value.name || value.path);
13909
- } else if (value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
13928
+ } else if (options.filename || (value && (value.name || value.path))) {
13929
+ /*
13930
+ * custom filename take precedence
13931
+ * formidable and the browser add a name property
13932
+ * fs- and request- streams have path property
13933
+ */
13934
+ filename = path.basename(options.filename || (value && (value.name || value.path)));
13935
+ } else if (value && value.readable && hasOwn(value, 'httpVersion')) {
13910
13936
  // or try http response
13911
13937
  filename = path.basename(value.client._httpMessage.path || '');
13912
13938
  }
13913
13939
 
13914
13940
  if (filename) {
13915
- contentDisposition = 'filename="' + filename + '"';
13941
+ return 'filename="' + filename + '"';
13916
13942
  }
13917
-
13918
- return contentDisposition;
13919
13943
  };
13920
13944
 
13921
- FormData.prototype._getContentType = function(value, options) {
13922
-
13945
+ FormData.prototype._getContentType = function (value, options) {
13923
13946
  // use custom content-type above all
13924
13947
  var contentType = options.contentType;
13925
13948
 
13926
13949
  // or try `name` from formidable, browser
13927
- if (!contentType && value.name) {
13950
+ if (!contentType && value && value.name) {
13928
13951
  contentType = mime.lookup(value.name);
13929
13952
  }
13930
13953
 
13931
13954
  // or try `path` from fs-, request- streams
13932
- if (!contentType && value.path) {
13955
+ if (!contentType && value && value.path) {
13933
13956
  contentType = mime.lookup(value.path);
13934
13957
  }
13935
13958
 
13936
13959
  // or if it's http-reponse
13937
- if (!contentType && value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
13960
+ if (!contentType && value && value.readable && hasOwn(value, 'httpVersion')) {
13938
13961
  contentType = value.headers['content-type'];
13939
13962
  }
13940
13963
 
@@ -13944,18 +13967,18 @@ function requireForm_data () {
13944
13967
  }
13945
13968
 
13946
13969
  // fallback to the default content type if `value` is not simple value
13947
- if (!contentType && typeof value == 'object') {
13970
+ if (!contentType && value && typeof value === 'object') {
13948
13971
  contentType = FormData.DEFAULT_CONTENT_TYPE;
13949
13972
  }
13950
13973
 
13951
13974
  return contentType;
13952
13975
  };
13953
13976
 
13954
- FormData.prototype._multiPartFooter = function() {
13955
- return function(next) {
13977
+ FormData.prototype._multiPartFooter = function () {
13978
+ return function (next) {
13956
13979
  var footer = FormData.LINE_BREAK;
13957
13980
 
13958
- var lastPart = (this._streams.length === 0);
13981
+ var lastPart = this._streams.length === 0;
13959
13982
  if (lastPart) {
13960
13983
  footer += this._lastBoundary();
13961
13984
  }
@@ -13964,18 +13987,18 @@ function requireForm_data () {
13964
13987
  }.bind(this);
13965
13988
  };
13966
13989
 
13967
- FormData.prototype._lastBoundary = function() {
13990
+ FormData.prototype._lastBoundary = function () {
13968
13991
  return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK;
13969
13992
  };
13970
13993
 
13971
- FormData.prototype.getHeaders = function(userHeaders) {
13994
+ FormData.prototype.getHeaders = function (userHeaders) {
13972
13995
  var header;
13973
13996
  var formHeaders = {
13974
13997
  'content-type': 'multipart/form-data; boundary=' + this.getBoundary()
13975
13998
  };
13976
13999
 
13977
- for (header in userHeaders) {
13978
- if (Object.prototype.hasOwnProperty.call(userHeaders, header)) {
14000
+ for (header in userHeaders) { // eslint-disable-line no-restricted-syntax
14001
+ if (hasOwn(userHeaders, header)) {
13979
14002
  formHeaders[header.toLowerCase()] = userHeaders[header];
13980
14003
  }
13981
14004
  }
@@ -13983,11 +14006,14 @@ function requireForm_data () {
13983
14006
  return formHeaders;
13984
14007
  };
13985
14008
 
13986
- FormData.prototype.setBoundary = function(boundary) {
14009
+ FormData.prototype.setBoundary = function (boundary) {
14010
+ if (typeof boundary !== 'string') {
14011
+ throw new TypeError('FormData boundary must be a string');
14012
+ }
13987
14013
  this._boundary = boundary;
13988
14014
  };
13989
14015
 
13990
- FormData.prototype.getBoundary = function() {
14016
+ FormData.prototype.getBoundary = function () {
13991
14017
  if (!this._boundary) {
13992
14018
  this._generateBoundary();
13993
14019
  }
@@ -13995,60 +14021,55 @@ function requireForm_data () {
13995
14021
  return this._boundary;
13996
14022
  };
13997
14023
 
13998
- FormData.prototype.getBuffer = function() {
13999
- var dataBuffer = new Buffer.alloc(0);
14024
+ FormData.prototype.getBuffer = function () {
14025
+ var dataBuffer = new Buffer.alloc(0); // eslint-disable-line new-cap
14000
14026
  var boundary = this.getBoundary();
14001
14027
 
14002
14028
  // Create the form content. Add Line breaks to the end of data.
14003
14029
  for (var i = 0, len = this._streams.length; i < len; i++) {
14004
14030
  if (typeof this._streams[i] !== 'function') {
14005
-
14006
14031
  // Add content to the buffer.
14007
- if(Buffer.isBuffer(this._streams[i])) {
14008
- dataBuffer = Buffer.concat( [dataBuffer, this._streams[i]]);
14009
- }else {
14010
- dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(this._streams[i])]);
14032
+ if (Buffer.isBuffer(this._streams[i])) {
14033
+ dataBuffer = Buffer.concat([dataBuffer, this._streams[i]]);
14034
+ } else {
14035
+ dataBuffer = Buffer.concat([dataBuffer, Buffer.from(this._streams[i])]);
14011
14036
  }
14012
14037
 
14013
14038
  // Add break after content.
14014
- if (typeof this._streams[i] !== 'string' || this._streams[i].substring( 2, boundary.length + 2 ) !== boundary) {
14015
- dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(FormData.LINE_BREAK)] );
14039
+ if (typeof this._streams[i] !== 'string' || this._streams[i].substring(2, boundary.length + 2) !== boundary) {
14040
+ dataBuffer = Buffer.concat([dataBuffer, Buffer.from(FormData.LINE_BREAK)]);
14016
14041
  }
14017
14042
  }
14018
14043
  }
14019
14044
 
14020
14045
  // Add the footer and return the Buffer object.
14021
- return Buffer.concat( [dataBuffer, Buffer.from(this._lastBoundary())] );
14046
+ return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
14022
14047
  };
14023
14048
 
14024
- FormData.prototype._generateBoundary = function() {
14049
+ FormData.prototype._generateBoundary = function () {
14025
14050
  // This generates a 50 character boundary similar to those used by Firefox.
14026
- // They are optimized for boyer-moore parsing.
14027
- var boundary = '--------------------------';
14028
- for (var i = 0; i < 24; i++) {
14029
- boundary += Math.floor(Math.random() * 10).toString(16);
14030
- }
14031
14051
 
14032
- this._boundary = boundary;
14052
+ // They are optimized for boyer-moore parsing.
14053
+ this._boundary = '--------------------------' + crypto.randomBytes(12).toString('hex');
14033
14054
  };
14034
14055
 
14035
14056
  // Note: getLengthSync DOESN'T calculate streams length
14036
- // As workaround one can calculate file size manually
14037
- // and add it as knownLength option
14038
- FormData.prototype.getLengthSync = function() {
14057
+ // As workaround one can calculate file size manually and add it as knownLength option
14058
+ FormData.prototype.getLengthSync = function () {
14039
14059
  var knownLength = this._overheadLength + this._valueLength;
14040
14060
 
14041
- // Don't get confused, there are 3 "internal" streams for each keyval pair
14042
- // so it basically checks if there is any value added to the form
14061
+ // Don't get confused, there are 3 "internal" streams for each keyval pair so it basically checks if there is any value added to the form
14043
14062
  if (this._streams.length) {
14044
14063
  knownLength += this._lastBoundary().length;
14045
14064
  }
14046
14065
 
14047
14066
  // https://github.com/form-data/form-data/issues/40
14048
14067
  if (!this.hasKnownLength()) {
14049
- // Some async length retrievers are present
14050
- // therefore synchronous length calculation is false.
14051
- // Please use getLength(callback) to get proper length
14068
+ /*
14069
+ * Some async length retrievers are present
14070
+ * therefore synchronous length calculation is false.
14071
+ * Please use getLength(callback) to get proper length
14072
+ */
14052
14073
  this._error(new Error('Cannot calculate proper length in synchronous way.'));
14053
14074
  }
14054
14075
 
@@ -14058,7 +14079,7 @@ function requireForm_data () {
14058
14079
  // Public API to check if length of added values is known
14059
14080
  // https://github.com/form-data/form-data/issues/196
14060
14081
  // https://github.com/form-data/form-data/issues/262
14061
- FormData.prototype.hasKnownLength = function() {
14082
+ FormData.prototype.hasKnownLength = function () {
14062
14083
  var hasKnownLength = true;
14063
14084
 
14064
14085
  if (this._valuesToMeasure.length) {
@@ -14068,7 +14089,7 @@ function requireForm_data () {
14068
14089
  return hasKnownLength;
14069
14090
  };
14070
14091
 
14071
- FormData.prototype.getLength = function(cb) {
14092
+ FormData.prototype.getLength = function (cb) {
14072
14093
  var knownLength = this._overheadLength + this._valueLength;
14073
14094
 
14074
14095
  if (this._streams.length) {
@@ -14080,13 +14101,13 @@ function requireForm_data () {
14080
14101
  return;
14081
14102
  }
14082
14103
 
14083
- asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {
14104
+ asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function (err, values) {
14084
14105
  if (err) {
14085
14106
  cb(err);
14086
14107
  return;
14087
14108
  }
14088
14109
 
14089
- values.forEach(function(length) {
14110
+ values.forEach(function (length) {
14090
14111
  knownLength += length;
14091
14112
  });
14092
14113
 
@@ -14094,31 +14115,26 @@ function requireForm_data () {
14094
14115
  });
14095
14116
  };
14096
14117
 
14097
- FormData.prototype.submit = function(params, cb) {
14098
- var request
14099
- , options
14100
- , defaults = {method: 'post'}
14101
- ;
14102
-
14103
- // parse provided url if it's string
14104
- // or treat it as options object
14105
- if (typeof params == 'string') {
14118
+ FormData.prototype.submit = function (params, cb) {
14119
+ var request;
14120
+ var options;
14121
+ var defaults = { method: 'post' };
14106
14122
 
14107
- params = parseUrl(params);
14123
+ // parse provided url if it's string or treat it as options object
14124
+ if (typeof params === 'string') {
14125
+ params = parseUrl(params); // eslint-disable-line no-param-reassign
14126
+ /* eslint sort-keys: 0 */
14108
14127
  options = populate({
14109
14128
  port: params.port,
14110
14129
  path: params.pathname,
14111
14130
  host: params.hostname,
14112
14131
  protocol: params.protocol
14113
14132
  }, defaults);
14114
-
14115
- // use custom params
14116
- } else {
14117
-
14133
+ } else { // use custom params
14118
14134
  options = populate(params, defaults);
14119
14135
  // if no port provided use default one
14120
14136
  if (!options.port) {
14121
- options.port = options.protocol == 'https:' ? 443 : 80;
14137
+ options.port = options.protocol === 'https:' ? 443 : 80;
14122
14138
  }
14123
14139
  }
14124
14140
 
@@ -14126,14 +14142,14 @@ function requireForm_data () {
14126
14142
  options.headers = this.getHeaders(params.headers);
14127
14143
 
14128
14144
  // https if specified, fallback to http in any other case
14129
- if (options.protocol == 'https:') {
14145
+ if (options.protocol === 'https:') {
14130
14146
  request = https.request(options);
14131
14147
  } else {
14132
14148
  request = http.request(options);
14133
14149
  }
14134
14150
 
14135
14151
  // get content length and fire away
14136
- this.getLength(function(err, length) {
14152
+ this.getLength(function (err, length) {
14137
14153
  if (err && err !== 'Unknown stream') {
14138
14154
  this._error(err);
14139
14155
  return;
@@ -14165,7 +14181,7 @@ function requireForm_data () {
14165
14181
  return request;
14166
14182
  };
14167
14183
 
14168
- FormData.prototype._error = function(err) {
14184
+ FormData.prototype._error = function (err) {
14169
14185
  if (!this.error) {
14170
14186
  this.error = err;
14171
14187
  this.pause();
@@ -14176,7 +14192,10 @@ function requireForm_data () {
14176
14192
  FormData.prototype.toString = function () {
14177
14193
  return '[object FormData]';
14178
14194
  };
14179
- setToStringTag(FormData, 'FormData');
14195
+ setToStringTag(FormData.prototype, 'FormData');
14196
+
14197
+ // Public API
14198
+ form_data = FormData;
14180
14199
  return form_data;
14181
14200
  }
14182
14201
 
@@ -14184,7 +14203,7 @@ var form_dataExports = requireForm_data();
14184
14203
  var FormDataModule = /*@__PURE__*/getDefaultExportFromCjs(form_dataExports);
14185
14204
 
14186
14205
  const GRANT_TYPE$1 = 'client_credentials';
14187
- const castClientOptionsToRequestParams = (clientOptions) => {
14206
+ const castClientOptionsToRequestParameters = (clientOptions) => {
14188
14207
  const { scope, clientId, clientSecret } = clientOptions;
14189
14208
  if (!clientId) {
14190
14209
  throw new Error('Missing required "clientId" parameter to perform client credentials grant');
@@ -14192,42 +14211,53 @@ const castClientOptionsToRequestParams = (clientOptions) => {
14192
14211
  if (!clientSecret) {
14193
14212
  throw new Error('Missing required "clientSecret" parameter to perform client credentials grant');
14194
14213
  }
14195
- return Object.assign({ client_id: clientId, client_secret: clientSecret, grant_type: GRANT_TYPE$1 }, (scope ? { scope } : {}));
14214
+ return {
14215
+ client_id: clientId,
14216
+ client_secret: clientSecret,
14217
+ grant_type: GRANT_TYPE$1,
14218
+ ...(scope ? { scope } : {}),
14219
+ };
14196
14220
  };
14197
14221
  const isEligible$1 = (clientOptions) => {
14198
14222
  try {
14199
- return !!castClientOptionsToRequestParams(clientOptions);
14223
+ return !!castClientOptionsToRequestParameters(clientOptions);
14200
14224
  }
14201
- catch (_a) {
14225
+ catch {
14202
14226
  return false;
14203
14227
  }
14204
14228
  };
14205
- const requestToken$1 = (oauthTokenRequest, clientOptions) => oauthTokenRequest(castClientOptionsToRequestParams(clientOptions));
14229
+ const requestToken$1 = (oauthTokenRequest, clientOptions) => oauthTokenRequest(castClientOptionsToRequestParameters(clientOptions));
14206
14230
 
14207
14231
  const RESPONSE_TYPE = 'token';
14208
- const castToAuthorizationRequestParams = (params) => {
14209
- const { clientId, scope, state, redirectUri } = params;
14232
+ const castToAuthorizationRequestParameters = (parameters) => {
14233
+ const { clientId, scope, state, redirectUri } = parameters;
14210
14234
  if (!clientId) {
14211
14235
  throw new Error('Missing required "clientId" parameter to perform implicit grant');
14212
14236
  }
14213
- return Object.assign(Object.assign({ client_id: clientId, redirect_uri: redirectUri || window.location.href, response_type: RESPONSE_TYPE }, (scope ? { scope } : {})), (state ? { state } : {}));
14237
+ return {
14238
+ client_id: clientId,
14239
+ redirect_uri: redirectUri || window.location.href,
14240
+ response_type: RESPONSE_TYPE,
14241
+ ...(scope ? { scope } : {}),
14242
+ ...(state ? { state } : {}),
14243
+ };
14214
14244
  };
14215
- const isEligibleForClientRedirect = (params) => {
14245
+ const isEligibleForClientRedirect = (parameters) => {
14216
14246
  try {
14217
- return !!castToAuthorizationRequestParams(params);
14247
+ return !!castToAuthorizationRequestParameters(parameters);
14218
14248
  }
14219
- catch (_a) {
14249
+ catch {
14220
14250
  return false;
14221
14251
  }
14222
14252
  };
14223
- const getRedirectUrl = (params) => `${params.oauthUrl}/oauth/authorize?${querystring.stringify(castToAuthorizationRequestParams(params), {
14253
+ const getRedirectUrl = (parameters) => `${parameters.oauthUrl}/oauth/authorize?${querystring.stringify(castToAuthorizationRequestParameters(parameters), {
14224
14254
  skipEmptyString: true,
14225
14255
  skipNull: true,
14226
14256
  })}`;
14227
14257
 
14228
14258
  const GRANT_TYPE = 'password';
14229
- const castToTokenRequestParams = (params) => {
14230
- const { username, password, scope, clientId, clientSecret } = params;
14259
+ const castToTokenRequestParameters = (parameters) => {
14260
+ const { username, password, scope, clientId, clientSecret } = parameters;
14231
14261
  if (!clientId) {
14232
14262
  throw new Error('Missing required "clientId" parameter to perform password grant');
14233
14263
  }
@@ -14237,24 +14267,33 @@ const castToTokenRequestParams = (params) => {
14237
14267
  if (!password) {
14238
14268
  throw new Error('Missing required "password" parameter to perform password grant');
14239
14269
  }
14240
- return Object.assign(Object.assign({ client_id: clientId, grant_type: GRANT_TYPE, password,
14241
- username }, (scope ? { scope } : {})), (clientSecret ? { client_secret: clientSecret } : {}));
14270
+ return {
14271
+ client_id: clientId,
14272
+ grant_type: GRANT_TYPE,
14273
+ password,
14274
+ username,
14275
+ ...(scope ? { scope } : {}),
14276
+ ...(clientSecret ? { client_secret: clientSecret } : {}),
14277
+ };
14242
14278
  };
14243
- const isEligible = (params) => {
14279
+ const isEligible = (parameters) => {
14244
14280
  try {
14245
- return !!castToTokenRequestParams(params);
14281
+ return !!castToTokenRequestParameters(parameters);
14246
14282
  }
14247
- catch (_a) {
14283
+ catch {
14248
14284
  return false;
14249
14285
  }
14250
14286
  };
14251
- const requestToken = (tokenRequester, params) => tokenRequester(castToTokenRequestParams(params));
14287
+ const requestToken = (tokenRequester, parameters) => tokenRequester(castToTokenRequestParameters(parameters));
14252
14288
 
14253
14289
  async function maybeUpdateToken(oauthTokenStore, tokenFetcher, options, mustRefresh = false) {
14254
14290
  if (!mustRefresh && oauthTokenStore.get('accessToken')) {
14255
14291
  return;
14256
14292
  }
14257
- const refreshOptions = Object.assign(Object.assign({}, options), { refreshToken: oauthTokenStore.get('refreshToken') });
14293
+ const refreshOptions = {
14294
+ ...options,
14295
+ refreshToken: oauthTokenStore.get('refreshToken'),
14296
+ };
14258
14297
  if (isEligible$2(refreshOptions)) {
14259
14298
  return oauthTokenStore.set(await requestToken$2(tokenFetcher, refreshOptions));
14260
14299
  }
@@ -14309,12 +14348,12 @@ function refillReservoir() {
14309
14348
  const reservoir = (await queue.currentReservoir());
14310
14349
  if (queue.empty() && (await queue.running()) === 0 && reservoir > 10) {
14311
14350
  return ((await queue.incrementReservoir(1)) &&
14312
- fnClearInterval(interval) &&
14351
+ clearIntervalFunction(interval) &&
14313
14352
  refillIntervalSet.delete(interval));
14314
14353
  }
14315
14354
  return reservoir < QUEUE_RESERVOIR
14316
14355
  ? queue.incrementReservoir(1)
14317
- : fnClearInterval(interval) && refillIntervalSet.delete(interval);
14356
+ : clearIntervalFunction(interval) && refillIntervalSet.delete(interval);
14318
14357
  }, QUEUE_RESERVOIR_REFILL_INTERVAL);
14319
14358
  return refillIntervalSet.add(interval);
14320
14359
  }
@@ -14354,7 +14393,7 @@ function makeApiRequest(oauthTokenStore, oauthTokenRequester, options, httpMetho
14354
14393
  }
14355
14394
  await maybeUpdateToken(oauthTokenStore, oauthTokenRequester, options, retryCount > 0 &&
14356
14395
  TOKEN_REFRESH_STATUS_CODES.includes(previousResult.status));
14357
- const payloadQuery = (payload === null || payload === void 0 ? void 0 : payload.query)
14396
+ const payloadQuery = payload?.query
14358
14397
  ? (apiMethod.includes('?') ? '&' : '?') +
14359
14398
  querystring.stringify(payload.query, {
14360
14399
  skipEmptyString: true,
@@ -14368,21 +14407,31 @@ function makeApiRequest(oauthTokenStore, oauthTokenRequester, options, httpMetho
14368
14407
  try {
14369
14408
  return (refillReservoir() &&
14370
14409
  (await queue.schedule(async () => {
14371
- var _a, _b, _c;
14372
14410
  const method = httpMethod.toUpperCase();
14373
- const body = payload && payload.body;
14411
+ const body = payload?.body;
14374
14412
  const hasForm = isFormData(body);
14375
14413
  const form = isFormData(body) ? body.formData : {};
14376
14414
  const formData = Object.entries(form).reduce((previous, [name, value]) => {
14377
14415
  previous.append.apply(previous, [name].concat(value));
14378
14416
  return previous;
14379
14417
  }, new FormDataModule());
14380
- const headers = Object.assign(Object.assign(Object.assign(Object.assign({ accept: 'application/json', authorization: `Bearer ${oauthTokenStore.get('accessToken')}`, 'X-Allthings-Caller': `${options.serviceName
14418
+ const headers = {
14419
+ accept: 'application/json',
14420
+ authorization: `Bearer ${oauthTokenStore.get('accessToken')}`,
14421
+ 'X-Allthings-Caller': `${options.serviceName
14381
14422
  ? options.serviceName
14382
- : process.env.SEVICE_NAME
14383
- ? process.env.SEVICE_NAME
14384
- : 'unknown service name'} --- clientID ${(_c = (_b = (_a = options.clientId) === null || _a === void 0 ? void 0 : _a.split('_')[0]) !== null && _b !== void 0 ? _b : options.clientId) !== null && _c !== void 0 ? _c : 'no client id present'}` }, (!hasForm ? { 'content-type': 'application/json' } : {})), (typeof window === 'undefined' &&
14385
- typeof document === 'undefined' && { 'user-agent': USER_AGENT })), (payload && payload.headers ? payload.headers : {})), (hasForm && formData.getHeaders ? formData.getHeaders() : {}));
14423
+ :
14424
+ process.env.SEVICE_NAME
14425
+ ? process.env.SEVICE_NAME
14426
+ : 'unknown service name'} --- clientID ${options.clientId?.split('_')[0] ??
14427
+ options.clientId ??
14428
+ 'no client id present'}`,
14429
+ ...(hasForm ? {} : { 'content-type': 'application/json' }),
14430
+ ...(typeof window === 'undefined' &&
14431
+ typeof document === 'undefined' && { 'user-agent': USER_AGENT }),
14432
+ ...payload?.headers,
14433
+ ...(hasForm && formData.getHeaders ? formData.getHeaders() : {}),
14434
+ };
14386
14435
  if (process.env.LOG_REQUEST) {
14387
14436
  console.log({ sdkLogs: { method, url } });
14388
14437
  }
@@ -14393,8 +14442,14 @@ function makeApiRequest(oauthTokenStore, oauthTokenRequester, options, httpMetho
14393
14442
  const requestBody = {
14394
14443
  body: hasForm ? formData : JSON.stringify(body),
14395
14444
  };
14396
- const response = await fetch(url, Object.assign({ cache: 'no-cache', credentials: 'omit', headers,
14397
- method, mode: 'cors' }, (hasForm || body ? requestBody : {})));
14445
+ const response = await fetch(url, {
14446
+ cache: 'no-cache',
14447
+ credentials: 'omit',
14448
+ headers,
14449
+ method,
14450
+ mode: 'cors',
14451
+ ...(hasForm || body ? requestBody : {}),
14452
+ });
14398
14453
  const result = await makeResultFromResponse(response);
14399
14454
  responseLogger.log(method, url, result instanceof Error
14400
14455
  ? { error: result }
@@ -14493,11 +14548,14 @@ const API_METHODS = [
14493
14548
  bookingGetById,
14494
14549
  ];
14495
14550
  function restClient(userOptions = DEFAULT_API_WRAPPER_OPTIONS) {
14496
- const options = Object.assign(Object.assign({}, DEFAULT_API_WRAPPER_OPTIONS), userOptions);
14497
- if (typeof options.apiUrl === 'undefined') {
14551
+ const options = {
14552
+ ...DEFAULT_API_WRAPPER_OPTIONS,
14553
+ ...userOptions,
14554
+ };
14555
+ if (options.apiUrl === undefined) {
14498
14556
  throw new Error('API URL is undefined.');
14499
14557
  }
14500
- if (typeof options.oauthUrl === 'undefined') {
14558
+ if (options.oauthUrl === undefined) {
14501
14559
  throw new Error('OAuth2 URL is undefined.');
14502
14560
  }
14503
14561
  if (!options.clientId &&
@@ -14519,13 +14577,25 @@ function restClient(userOptions = DEFAULT_API_WRAPPER_OPTIONS) {
14519
14577
  const put$1 = partial(put, request$1);
14520
14578
  const oauth = {
14521
14579
  authorizationCode: {
14522
- getUri: (state = options.state || pseudoRandomString()) => partial(getRedirectUrl$1, Object.assign(Object.assign({}, options), { state }))(),
14523
- requestToken: (authorizationCode) => requestAndSaveToStore(partial(requestToken$3, tokenRequester, Object.assign(Object.assign({}, options), { authorizationCode: authorizationCode || options.authorizationCode })), tokenStore),
14580
+ getUri: (state = options.state || pseudoRandomString()) => partial(getRedirectUrl$1, {
14581
+ ...options,
14582
+ state,
14583
+ })(),
14584
+ requestToken: (authorizationCode) => requestAndSaveToStore(partial(requestToken$3, tokenRequester, {
14585
+ ...options,
14586
+ authorizationCode: authorizationCode || options.authorizationCode,
14587
+ }), tokenStore),
14524
14588
  },
14525
14589
  generateState: pseudoRandomString,
14526
- refreshToken: (refreshToken) => requestAndSaveToStore(partial(requestToken$2, tokenRequester, Object.assign(Object.assign({}, options), { refreshToken: refreshToken || tokenStore.get('refreshToken') })), tokenStore),
14590
+ refreshToken: (refreshToken) => requestAndSaveToStore(partial(requestToken$2, tokenRequester, {
14591
+ ...options,
14592
+ refreshToken: refreshToken || tokenStore.get('refreshToken'),
14593
+ }), tokenStore),
14527
14594
  };
14528
- const client = API_METHODS.reduce((methods, method) => (Object.assign(Object.assign({}, methods), { [method.name]: (...args) => method(client, ...args) })), {
14595
+ const client = API_METHODS.reduce((methods, method) => ({
14596
+ ...methods,
14597
+ [method.name]: (...arguments_) => method(client, ...arguments_),
14598
+ }), {
14529
14599
  delete: del$1,
14530
14600
  get,
14531
14601
  oauth,