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