@extrahorizon/javascript-sdk 8.9.0-dev-136-24be1b9 → 8.9.0-dev-138-3022f93

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.
Files changed (31) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/build/index.cjs.js +89 -89
  3. package/build/index.mjs +90 -90
  4. package/build/types/mockType.d.ts +48 -21
  5. package/build/types/services/auth/oidc/providers/types.d.ts +4 -0
  6. package/build/types/services/events/index.d.ts +1 -2
  7. package/build/types/services/events/types.d.ts +5 -0
  8. package/build/types/services/localizations/index.d.ts +1 -2
  9. package/build/types/services/localizations/types.d.ts +5 -0
  10. package/build/types/services/notifications/index.d.ts +1 -2
  11. package/build/types/services/notifications/types.d.ts +5 -0
  12. package/build/types/services/notificationsV2/index.d.ts +1 -2
  13. package/build/types/services/notificationsV2/types.d.ts +5 -0
  14. package/build/types/services/profiles/index.d.ts +1 -2
  15. package/build/types/services/profiles/types.d.ts +5 -0
  16. package/build/types/services/tasks/functions/types.d.ts +145 -1
  17. package/build/types/services/tasks/schedules/types.d.ts +4 -0
  18. package/build/types/services/tasks/types.d.ts +11 -0
  19. package/build/types/services/templatesV2/index.d.ts +1 -2
  20. package/build/types/services/templatesV2/types.d.ts +5 -0
  21. package/build/types/services/users/index.d.ts +2 -4
  22. package/build/types/services/users/types.d.ts +5 -0
  23. package/build/types/version.d.ts +1 -1
  24. package/package.json +1 -1
  25. package/build/types/services/events/health.d.ts +0 -9
  26. package/build/types/services/localizations/health.d.ts +0 -9
  27. package/build/types/services/notifications/health.d.ts +0 -9
  28. package/build/types/services/notificationsV2/health.d.ts +0 -9
  29. package/build/types/services/profiles/health.d.ts +0 -9
  30. package/build/types/services/templatesV2/health.d.ts +0 -9
  31. package/build/types/services/users/health.d.ts +0 -9
package/CHANGELOG.md CHANGED
@@ -8,7 +8,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
  ## [8.9.0]
9
9
 
10
10
  ### Added
11
+ - Added the `exh.tasks.functions` methods `find`, `getByName`, `update`, `enable`, `disable` and `remove`
11
12
  - Added a `exh.users.findByEmail` method to find a user by their email address.
13
+ - Completed the `Task` type for changes made in TaskService 1.3.0 a while ago:
14
+ - Added the `retriedByTaskId`, `retryForTaskIds`, and `error` properties.
15
+ - Added the `retried` status.
16
+
17
+ ### Deprecated
18
+ - `exh.tasks.schedules.delete` is deprecated in favor of `exh.tasks.schedules.remove`
19
+ - `exh.auth.oidc.providers.delete` is deprecated in favor of `exh.auth.oidc.providers.remove`
12
20
 
13
21
  ### Fixed
14
22
  - Corrected the types for the `findFirst` (based) methods to indicate they may return `undefined` when no results are found.
@@ -999,12 +999,23 @@ exports.ApiRequestErrorType = void 0;
999
999
  ApiRequestErrorType["RESPONSE"] = "response";
1000
1000
  })(exports.ApiRequestErrorType || (exports.ApiRequestErrorType = {}));
1001
1001
 
1002
+ exports.FunctionPermissionMode = void 0;
1003
+ (function (FunctionPermissionMode) {
1004
+ /** To execute this function directly the user needs the EXECUTE_TASK_FUNCTION permission */
1005
+ FunctionPermissionMode["PERMISSION_REQUIRED"] = "permissionRequired";
1006
+ /** Every logged in user can execute this function directly */
1007
+ FunctionPermissionMode["ALL_USERS"] = "allUsers";
1008
+ /** The function can be executed even by unauthenticated requests */
1009
+ FunctionPermissionMode["PUBLIC"] = "public";
1010
+ })(exports.FunctionPermissionMode || (exports.FunctionPermissionMode = {}));
1011
+
1002
1012
  exports.TaskStatus = void 0;
1003
1013
  (function (TaskStatus) {
1004
1014
  TaskStatus["NEW"] = "new";
1005
1015
  TaskStatus["IN_PROGRESS"] = "inProgress";
1006
1016
  TaskStatus["COMPLETE"] = "complete";
1007
1017
  TaskStatus["FAILED"] = "failed";
1018
+ TaskStatus["RETRIED"] = "retried";
1008
1019
  TaskStatus["CANCELED"] = "canceled";
1009
1020
  })(exports.TaskStatus || (exports.TaskStatus = {}));
1010
1021
 
@@ -3464,10 +3475,13 @@ var providers = (oidcClient, httpWithAuth) => {
3464
3475
  const { data } = await oidcClient.post(httpWithAuth, `/oidc/providers/${providerId}/disable`, {});
3465
3476
  return data;
3466
3477
  },
3467
- async delete(providerId) {
3478
+ async remove(providerId) {
3468
3479
  const { data } = await oidcClient.delete(httpWithAuth, `/oidc/providers/${providerId}`);
3469
3480
  return data;
3470
3481
  },
3482
+ delete(providerId) {
3483
+ return this.remove(providerId);
3484
+ },
3471
3485
  };
3472
3486
  };
3473
3487
 
@@ -4011,8 +4025,48 @@ var apiRequests = (client, httpAuth) => {
4011
4025
  };
4012
4026
 
4013
4027
  var functions = (client, httpAuth) => ({
4028
+ async find(options) {
4029
+ const response = await client.get(httpAuth, '/functions/', options);
4030
+ return response.data;
4031
+ },
4032
+ async create(body, options) {
4033
+ const response = await client.post(httpAuth, '/functions/', body, {
4034
+ ...options,
4035
+ customKeys: ['environmentVariables'],
4036
+ });
4037
+ return response.data;
4038
+ },
4039
+ async getByName(name, options) {
4040
+ const response = await client.get(httpAuth, `/functions/${name}`, {
4041
+ ...options,
4042
+ customResponseKeys: ['environmentVariables'],
4043
+ });
4044
+ return response.data;
4045
+ },
4046
+ async update(name, body, options) {
4047
+ const response = await client.put(httpAuth, `/functions/${name}`, body, {
4048
+ ...options,
4049
+ customRequestKeys: ['environmentVariables'],
4050
+ });
4051
+ return response.data;
4052
+ },
4053
+ async remove(name, options) {
4054
+ const response = await client.delete(httpAuth, `/functions/${name}`, options);
4055
+ return response.data;
4056
+ },
4057
+ async enable(name, options) {
4058
+ const response = await client.post(httpAuth, `/functions/${name}/enable`, {}, options);
4059
+ return response.data;
4060
+ },
4061
+ async disable(name, options) {
4062
+ const response = await client.post(httpAuth, `/functions/${name}/disable`, {}, options);
4063
+ return response.data;
4064
+ },
4014
4065
  async execute(functionName, data, options) {
4015
- const response = await client.post(httpAuth, `/functions/${functionName}/execute`, { data }, { ...options, customKeys: ['data', 'result'] });
4066
+ const response = await client.post(httpAuth, `/functions/${functionName}/execute`, { data }, {
4067
+ ...options,
4068
+ customKeys: ['data', 'result'],
4069
+ });
4016
4070
  return response.data;
4017
4071
  },
4018
4072
  });
@@ -4047,10 +4101,13 @@ var schedules = (client, httpAuth) => {
4047
4101
  });
4048
4102
  return data;
4049
4103
  },
4050
- async delete(scheduleId, options) {
4104
+ async remove(scheduleId, options) {
4051
4105
  const { data } = await client.delete(httpAuth, `/schedules/${scheduleId}`, options);
4052
4106
  return data;
4053
4107
  },
4108
+ delete(scheduleId, options) {
4109
+ return this.remove(scheduleId, options);
4110
+ },
4054
4111
  async find(options) {
4055
4112
  const result = await query(options);
4056
4113
  return addPagersFn(query, options, result);
@@ -4258,17 +4315,6 @@ var groupRoles = (client, httpWithAuth) => ({
4258
4315
  },
4259
4316
  });
4260
4317
 
4261
- var health$7 = (userClient, http) => ({
4262
- /**
4263
- * Perform a health check
4264
- * @returns {boolean} success
4265
- */
4266
- async health() {
4267
- const result = await userClient.get(http, '/health');
4268
- return result.status === exports.Results.Success;
4269
- },
4270
- });
4271
-
4272
4318
  const settingsService = (client, httpWithAuth) => ({
4273
4319
  async getVerificationSettings(options) {
4274
4320
  const response = await client.get(httpWithAuth, '/settings/verification', options);
@@ -4451,6 +4497,10 @@ var users$1 = (userClient, httpWithAuth, http) => {
4451
4497
  const { data } = await userClient.put(httpWithAuth, '/email_templates', templates);
4452
4498
  return data;
4453
4499
  },
4500
+ async health() {
4501
+ const result = await userClient.get(http, '/health');
4502
+ return result.status === 200;
4503
+ },
4454
4504
  };
4455
4505
  };
4456
4506
 
@@ -4459,7 +4509,6 @@ const usersService = (httpWithAuth, http) => {
4459
4509
  basePath: USER_BASE,
4460
4510
  transformRequestData: decamelizeRequestData,
4461
4511
  });
4462
- const healthMethods = health$7(userClient, httpWithAuth);
4463
4512
  const usersMethods = users$1(userClient, httpWithAuth, http);
4464
4513
  const groupRolesMethods = groupRoles(userClient, httpWithAuth);
4465
4514
  const globalRolesMethods = globalRoles(userClient, httpWithAuth);
@@ -4467,7 +4516,6 @@ const usersService = (httpWithAuth, http) => {
4467
4516
  const forgotPasswordRequestsMethods = forgotPasswordRequestsService(userClient, httpWithAuth);
4468
4517
  const settingsMethods = settingsService(userClient, httpWithAuth);
4469
4518
  return {
4470
- ...healthMethods,
4471
4519
  ...usersMethods,
4472
4520
  groupRoles: groupRolesMethods,
4473
4521
  globalRoles: globalRolesMethods,
@@ -4849,7 +4897,7 @@ var appStoreSubscriptions = (client, httpAuth) => ({
4849
4897
  },
4850
4898
  });
4851
4899
 
4852
- var health$6 = (client, httpAuth) => ({
4900
+ var health = (client, httpAuth) => ({
4853
4901
  /**
4854
4902
  * Check if the service is available
4855
4903
  * @returns true if service is up and running
@@ -5053,7 +5101,7 @@ const paymentsService = (httpWithAuth) => {
5053
5101
  basePath: PAYMENTS_BASE,
5054
5102
  });
5055
5103
  return {
5056
- ...health$6(client, httpWithAuth),
5104
+ ...health(client, httpWithAuth),
5057
5105
  products: products(client, httpWithAuth),
5058
5106
  orders: orders(client, httpWithAuth),
5059
5107
  subscriptions: subscriptions$1(client, httpWithAuth),
@@ -5075,17 +5123,6 @@ var countries = (client, httpAuth) => ({
5075
5123
  },
5076
5124
  });
5077
5125
 
5078
- var health$5 = (client, http) => ({
5079
- /**
5080
- * Perform a health check
5081
- * @returns {boolean} success
5082
- */
5083
- async health() {
5084
- const result = await client.get(http, '/health');
5085
- return result.status === exports.Results.Success;
5086
- },
5087
- });
5088
-
5089
5126
  var languages = (client, httpAuth) => ({
5090
5127
  async getLanguages(options) {
5091
5128
  return (await client.get(httpAuth, '/languages', options)).data.data;
@@ -5119,6 +5156,10 @@ var localizations = (client, httpAuth) => ({
5119
5156
  customResponseKeys: ['*'],
5120
5157
  })).data;
5121
5158
  },
5159
+ async health() {
5160
+ const result = await client.get(httpAuth, '/health');
5161
+ return result.status === 200;
5162
+ },
5122
5163
  });
5123
5164
 
5124
5165
  const localizationsService = (httpWithAuth) => {
@@ -5127,7 +5168,6 @@ const localizationsService = (httpWithAuth) => {
5127
5168
  basePath: LOCALIZATIONS_BASE,
5128
5169
  });
5129
5170
  return {
5130
- ...health$5(client, httpWithAuth),
5131
5171
  ...localizations(client, httpWithAuth),
5132
5172
  ...countries(client, httpWithAuth),
5133
5173
  ...languages(client, httpWithAuth),
@@ -5152,17 +5192,6 @@ var groups = (client, httpAuth) => ({
5152
5192
  },
5153
5193
  });
5154
5194
 
5155
- var health$4 = (client, httpAuth) => ({
5156
- /**
5157
- * Perform a health check for profiles service
5158
- * @returns {boolean} success
5159
- */
5160
- async health() {
5161
- const result = await client.get(httpAuth, '/health');
5162
- return result.status === exports.Results.Success;
5163
- },
5164
- });
5165
-
5166
5195
  var logs = (client, httpAuth) => {
5167
5196
  function partialApplyFind(profileId, groupId) {
5168
5197
  return async (options) => (await client.get(httpAuth, `/${profileId}/groups/${groupId}/logs/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, options)).data;
@@ -5233,6 +5262,10 @@ var profiles = (client, httpAuth) => ({
5233
5262
  async getImpediments(options) {
5234
5263
  return (await client.get(httpAuth, '/impediments', options)).data;
5235
5264
  },
5265
+ async health() {
5266
+ const result = await client.get(httpAuth, '/health');
5267
+ return result.status === 200;
5268
+ },
5236
5269
  });
5237
5270
 
5238
5271
  const profilesService = (httpWithAuth) => {
@@ -5241,24 +5274,12 @@ const profilesService = (httpWithAuth) => {
5241
5274
  basePath: PROFILES_BASE,
5242
5275
  });
5243
5276
  return {
5244
- ...health$4(client, httpWithAuth),
5245
5277
  ...profiles(client, httpWithAuth),
5246
5278
  groups: groups(client, httpWithAuth),
5247
5279
  logs: logs(client, httpWithAuth),
5248
5280
  };
5249
5281
  };
5250
5282
 
5251
- var health$3 = (client, http) => ({
5252
- /**
5253
- * Perform a health check
5254
- * @returns {boolean} success
5255
- */
5256
- async health() {
5257
- const result = await client.get(http, '/health');
5258
- return result.status === exports.Results.Success;
5259
- },
5260
- });
5261
-
5262
5283
  var notifications = (client, httpAuth) => {
5263
5284
  async function find(options) {
5264
5285
  return (await client.get(httpAuth, `/notifications${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, options)).data;
@@ -5304,6 +5325,10 @@ var notifications = (client, httpAuth) => {
5304
5325
  async getTypes(options) {
5305
5326
  return (await client.get(httpAuth, '/types', options)).data;
5306
5327
  },
5328
+ async health() {
5329
+ const result = await client.get(httpAuth, '/health');
5330
+ return result.status === 200;
5331
+ },
5307
5332
  };
5308
5333
  };
5309
5334
 
@@ -5333,23 +5358,11 @@ const notificationsService = (httpWithAuth) => {
5333
5358
  transformRequestData: decamelizeRequestData,
5334
5359
  });
5335
5360
  return {
5336
- ...health$3(client, httpWithAuth),
5337
5361
  ...notifications(client, httpWithAuth),
5338
5362
  settings: settings(client, httpWithAuth),
5339
5363
  };
5340
5364
  };
5341
5365
 
5342
- var health$2 = (client, http) => ({
5343
- /**
5344
- * Perform a health check
5345
- * @returns {boolean} success
5346
- */
5347
- async health() {
5348
- const result = await client.get(http, '/health');
5349
- return result.status === exports.Results.Success;
5350
- },
5351
- });
5352
-
5353
5366
  var notificationsV2 = (client, httpWithAuth) => {
5354
5367
  async function find(options) {
5355
5368
  const result = await client.get(httpWithAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
@@ -5386,6 +5399,10 @@ var notificationsV2 = (client, httpWithAuth) => {
5386
5399
  const rqlWithNotificationId = rqlBuilder().eq('id', notificationId).build();
5387
5400
  return await this.findFirst({ ...options, rql: rqlWithNotificationId });
5388
5401
  },
5402
+ async health() {
5403
+ const result = await client.get(httpWithAuth, '/health');
5404
+ return result.status === 200;
5405
+ },
5389
5406
  };
5390
5407
  };
5391
5408
 
@@ -5434,7 +5451,6 @@ const notificationsV2Service = (httpWithAuth) => {
5434
5451
  basePath: NOTIFICATIONS_V2_BASE,
5435
5452
  });
5436
5453
  return {
5437
- ...health$2(client, httpWithAuth),
5438
5454
  ...notificationsV2(client, httpWithAuth),
5439
5455
  userSettings: notificationV2UserSettings(client, httpWithAuth),
5440
5456
  };
@@ -5460,16 +5476,9 @@ var events = (client, httpAuth) => ({
5460
5476
  }
5461
5477
  return (await client.post(httpAuth, '/', requestBody, requestOptions)).data;
5462
5478
  },
5463
- });
5464
-
5465
- var health$1 = (client, http) => ({
5466
- /**
5467
- * Perform a health check
5468
- * @returns {boolean} success
5469
- */
5470
5479
  async health() {
5471
- const result = await client.get(http, '/health');
5472
- return result.status === exports.Results.Success;
5480
+ const result = await client.get(httpAuth, '/health');
5481
+ return result.status === 200;
5473
5482
  },
5474
5483
  });
5475
5484
 
@@ -5498,7 +5507,6 @@ const eventsService = (httpWithAuth) => {
5498
5507
  transformRequestData: decamelizeRequestData,
5499
5508
  });
5500
5509
  return {
5501
- ...health$1(client, httpWithAuth),
5502
5510
  ...events(client, httpWithAuth),
5503
5511
  subscriptions: subscriptions(client, httpWithAuth),
5504
5512
  };
@@ -5530,17 +5538,6 @@ const logsService = (httpWithAuth) => {
5530
5538
  };
5531
5539
  };
5532
5540
 
5533
- var health = (client, http) => ({
5534
- /**
5535
- * Perform a health check
5536
- * @returns {boolean} success
5537
- */
5538
- async health() {
5539
- const result = await client.get(http, '/health');
5540
- return result.status === exports.Results.Success;
5541
- },
5542
- });
5543
-
5544
5541
  var templatesV2 = (client, httpWithAuth) => {
5545
5542
  async function find(options) {
5546
5543
  const result = await client.get(httpWithAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
@@ -5597,6 +5594,10 @@ var templatesV2 = (client, httpWithAuth) => {
5597
5594
  const result = await find(options);
5598
5595
  return result.data[0];
5599
5596
  },
5597
+ async health() {
5598
+ const result = await client.get(httpWithAuth, '/health');
5599
+ return result.status === 200;
5600
+ },
5600
5601
  };
5601
5602
  };
5602
5603
 
@@ -5605,12 +5606,11 @@ const templatesV2Service = (httpWithAuth) => {
5605
5606
  basePath: TEMPLATES_V2_BASE,
5606
5607
  });
5607
5608
  return {
5608
- ...health(client, httpWithAuth),
5609
5609
  ...templatesV2(client, httpWithAuth),
5610
5610
  };
5611
5611
  };
5612
5612
 
5613
- const version = '8.9.0-dev-136-24be1b9';
5613
+ const version = '8.9.0-dev-138-3022f93';
5614
5614
 
5615
5615
  /**
5616
5616
  * Create ExtraHorizon client.