@extrahorizon/javascript-sdk 8.9.0-dev-121-e732d56 → 8.9.0-feat-134-c0f5b9d

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 (38) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/build/index.cjs.js +198 -62
  3. package/build/index.mjs +197 -63
  4. package/build/types/client.d.ts +6 -0
  5. package/build/types/constants.d.ts +1 -0
  6. package/build/types/errors.d.ts +11 -0
  7. package/build/types/mockType.d.ts +60 -0
  8. package/build/types/services/auth/applications/types.d.ts +3 -3
  9. package/build/types/services/auth/oauth1/types.d.ts +2 -2
  10. package/build/types/services/auth/oauth2/types.d.ts +2 -2
  11. package/build/types/services/auth/oidc/loginAttempts/types.d.ts +1 -1
  12. package/build/types/services/auth/oidc/providers/types.d.ts +1 -1
  13. package/build/types/services/data/types.d.ts +5 -5
  14. package/build/types/services/dispatchers/dispatchers/types.d.ts +1 -1
  15. package/build/types/services/events/types.d.ts +4 -4
  16. package/build/types/services/files/types.d.ts +2 -2
  17. package/build/types/services/localizations/types.d.ts +2 -2
  18. package/build/types/services/logs/access/types.d.ts +2 -2
  19. package/build/types/services/mails/types.d.ts +22 -14
  20. package/build/types/services/notifications/types.d.ts +4 -4
  21. package/build/types/services/payments/types.d.ts +4 -4
  22. package/build/types/services/profiles/types.d.ts +2 -2
  23. package/build/types/services/tasks/apiRequests/logs/types.d.ts +1 -1
  24. package/build/types/services/tasks/apiRequests/types.d.ts +1 -1
  25. package/build/types/services/tasks/functions/types.d.ts +145 -1
  26. package/build/types/services/tasks/logs/types.d.ts +1 -1
  27. package/build/types/services/tasks/schedules/types.d.ts +1 -1
  28. package/build/types/services/tasks/types.d.ts +2 -2
  29. package/build/types/services/templatesV2/health.d.ts +9 -0
  30. package/build/types/services/templatesV2/index.d.ts +4 -0
  31. package/build/types/services/templatesV2/templatesV2.d.ts +5 -0
  32. package/build/types/services/templatesV2/types.d.ts +145 -0
  33. package/build/types/services/types.d.ts +4 -1
  34. package/build/types/services/users/activationRequests/types.d.ts +3 -3
  35. package/build/types/services/users/forgotPasswordRequests/types.d.ts +3 -3
  36. package/build/types/services/users/types.d.ts +27 -9
  37. package/build/types/version.d.ts +1 -1
  38. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [8.9.0]
9
9
 
10
+ ### Added
11
+ - Added the `exh.tasks.functions` methods `find`, `getByName`, `update`, `enable`, `disable` and `delete`
12
+ - Added a `exh.users.findByEmail` method to find a user by their email address.
13
+
14
+ ### Fixed
15
+ - Corrected the types for the `findFirst` (based) methods to indicate they may return `undefined` when no results are found.
16
+
10
17
 
11
18
  ## [8.8.2]
12
19
 
@@ -617,6 +617,18 @@ class LocalizationKeyMissingError extends BadRequestError {
617
617
  }
618
618
  class TemplateFillingError extends BadRequestError {
619
619
  }
620
+ class TemplateSyntaxError extends BadRequestError {
621
+ constructor(apiError) {
622
+ super(apiError);
623
+ this.syntaxError = apiError.response.syntaxError;
624
+ }
625
+ }
626
+ class TemplateResolvingError extends BadRequestError {
627
+ constructor(apiError) {
628
+ super(apiError);
629
+ this.resolveError = apiError.response.resolveError;
630
+ }
631
+ }
620
632
  class MissingRequiredFieldsError extends BadRequestError {
621
633
  }
622
634
  class InvalidCurrencyForProductPrice extends BadRequestError {
@@ -917,6 +929,8 @@ const ErrorClassMap = {
917
929
  801: DefaultLocalizationMissingError,
918
930
  1002: LocalizationKeyMissingError,
919
931
  1003: TemplateFillingError,
932
+ 1004: TemplateSyntaxError,
933
+ 1005: TemplateResolvingError,
920
934
  2605: InvalidTokenError,
921
935
  2606: UnauthorizedTokenError,
922
936
  2607: TokenNotDeleteableError,
@@ -985,6 +999,16 @@ exports.ApiRequestErrorType = void 0;
985
999
  ApiRequestErrorType["RESPONSE"] = "response";
986
1000
  })(exports.ApiRequestErrorType || (exports.ApiRequestErrorType = {}));
987
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
+
988
1012
  exports.TaskStatus = void 0;
989
1013
  (function (TaskStatus) {
990
1014
  TaskStatus["NEW"] = "new";
@@ -1083,6 +1107,7 @@ exports.GlobalPermissionName = void 0;
1083
1107
  GlobalPermissionName["REMOVE_ROLE_PERMISSION"] = "REMOVE_ROLE_PERMISSION";
1084
1108
  GlobalPermissionName["REMOVE_STAFF"] = "REMOVE_STAFF";
1085
1109
  GlobalPermissionName["RESET_FAILED_LOGIN_ATTEMPTS"] = "RESET_FAILED_LOGIN_ATTEMPTS";
1110
+ GlobalPermissionName["RESOLVE_TEMPLATES"] = "RESOLVE_TEMPLATES";
1086
1111
  GlobalPermissionName["SEND_MAILS"] = "SEND_MAILS";
1087
1112
  GlobalPermissionName["SYNC_PROFILE_GROUPS"] = "SYNC_PROFILE_GROUPS";
1088
1113
  GlobalPermissionName["TRANSFER_PERIOD"] = "TRANSFER_PERIOD";
@@ -1647,6 +1672,7 @@ const FILES_BASE = '/files/v1';
1647
1672
  const TASKS_BASE = '/tasks/v1';
1648
1673
  const CONFIGURATION_BASE = '/configurations/v2';
1649
1674
  const TEMPLATE_BASE = '/templates/v1';
1675
+ const TEMPLATES_V2_BASE = '/templates/v2';
1650
1676
  const MAIL_BASE = '/mail/v1';
1651
1677
  const DISPATCHERS_BASE = '/dispatchers/v1';
1652
1678
  const PAYMENTS_BASE = '/payments/v1';
@@ -3543,11 +3569,7 @@ var comments = (client, httpAuth) => ({
3543
3569
  },
3544
3570
  async findById(id, schemaIdOrName, documentId, options) {
3545
3571
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
3546
- const res = await this.find(schemaIdOrName, documentId, {
3547
- ...options,
3548
- rql: rqlWithId,
3549
- });
3550
- return res.data[0];
3572
+ return await this.findFirst(schemaIdOrName, documentId, { ...options, rql: rqlWithId });
3551
3573
  },
3552
3574
  async findFirst(schemaIdOrName, documentId, options) {
3553
3575
  const res = await this.find(schemaIdOrName, documentId, options);
@@ -3600,8 +3622,7 @@ var documents = (client, httpAuth) => {
3600
3622
  },
3601
3623
  async findById(schemaIdOrName, documentId, options) {
3602
3624
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', documentId).build();
3603
- const res = await this.find(schemaIdOrName, { ...options, rql: rqlWithId });
3604
- return res.data[0];
3625
+ return await this.findFirst(schemaIdOrName, { ...options, rql: rqlWithId });
3605
3626
  },
3606
3627
  async findFirst(schemaIdOrName, options) {
3607
3628
  const res = await this.find(schemaIdOrName, options);
@@ -3728,13 +3749,11 @@ var schemas = (client, httpAuth) => {
3728
3749
  },
3729
3750
  async findById(id, options) {
3730
3751
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
3731
- const res = await find({ ...options, rql: rqlWithId });
3732
- return res.data[0];
3752
+ return await this.findFirst({ ...options, rql: rqlWithId });
3733
3753
  },
3734
3754
  async findByName(name, options) {
3735
3755
  const rqlWithName = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('name', name).build();
3736
- const res = await find({ ...options, rql: rqlWithName });
3737
- return res.data[0];
3756
+ return await this.findFirst({ ...options, rql: rqlWithName });
3738
3757
  },
3739
3758
  async findFirst(options) {
3740
3759
  const res = await find(options);
@@ -3826,8 +3845,7 @@ var files = (client, httpAuth) => ({
3826
3845
  },
3827
3846
  async findByName(name, options) {
3828
3847
  const rqlWithName = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('name', name).build();
3829
- const res = await this.find({ ...options, rql: rqlWithName });
3830
- return res.data[0];
3848
+ return await this.findFirst({ ...options, rql: rqlWithName });
3831
3849
  },
3832
3850
  async findFirst(options) {
3833
3851
  const res = await this.find(options);
@@ -4012,8 +4030,48 @@ var apiRequests = (client, httpAuth) => {
4012
4030
  };
4013
4031
 
4014
4032
  var functions = (client, httpAuth) => ({
4033
+ async find(options) {
4034
+ const response = await client.get(httpAuth, '/functions/', options);
4035
+ return response.data;
4036
+ },
4037
+ async create(body, options) {
4038
+ const response = await client.post(httpAuth, '/functions/', body, {
4039
+ ...options,
4040
+ customKeys: ['environmentVariables'],
4041
+ });
4042
+ return response.data;
4043
+ },
4044
+ async getByName(name, options) {
4045
+ const response = await client.get(httpAuth, `/functions/${name}`, {
4046
+ ...options,
4047
+ customResponseKeys: ['environmentVariables'],
4048
+ });
4049
+ return response.data;
4050
+ },
4051
+ async update(name, body, options) {
4052
+ const response = await client.put(httpAuth, `/functions/${name}`, body, {
4053
+ ...options,
4054
+ customRequestKeys: ['environmentVariables'],
4055
+ });
4056
+ return response.data;
4057
+ },
4058
+ async delete(name, options) {
4059
+ const response = await client.delete(httpAuth, `/functions/${name}`, options);
4060
+ return response.data;
4061
+ },
4062
+ async enable(name, options) {
4063
+ const response = await client.post(httpAuth, `/functions/${name}/enable`, {}, options);
4064
+ return response.data;
4065
+ },
4066
+ async disable(name, options) {
4067
+ const response = await client.post(httpAuth, `/functions/${name}/disable`, {}, options);
4068
+ return response.data;
4069
+ },
4015
4070
  async execute(functionName, data, options) {
4016
- const response = await client.post(httpAuth, `/functions/${functionName}/execute`, { data }, { ...options, customKeys: ['data', 'result'] });
4071
+ const response = await client.post(httpAuth, `/functions/${functionName}/execute`, { data }, {
4072
+ ...options,
4073
+ customKeys: ['data', 'result'],
4074
+ });
4017
4075
  return response.data;
4018
4076
  },
4019
4077
  });
@@ -4084,8 +4142,7 @@ var tasks = (client, httpAuth) => ({
4084
4142
  },
4085
4143
  async findById(id, options) {
4086
4144
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
4087
- const res = await this.find({ ...options, rql: rqlWithId });
4088
- return res.data[0];
4145
+ return await this.findFirst({ ...options, rql: rqlWithId });
4089
4146
  },
4090
4147
  async findFirst(options) {
4091
4148
  const res = await this.find(options);
@@ -4260,7 +4317,7 @@ var groupRoles = (client, httpWithAuth) => ({
4260
4317
  },
4261
4318
  });
4262
4319
 
4263
- var health$6 = (userClient, http) => ({
4320
+ var health$7 = (userClient, http) => ({
4264
4321
  /**
4265
4322
  * Perform a health check
4266
4323
  * @returns {boolean} success
@@ -4310,6 +4367,10 @@ var users$1 = (userClient, httpWithAuth, http) => {
4310
4367
  const res = await find(options);
4311
4368
  return res.data[0];
4312
4369
  },
4370
+ async findByEmail(email, options) {
4371
+ const rqlWithEmail = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('email', email).build();
4372
+ return await this.findFirst({ ...options, rql: rqlWithEmail });
4373
+ },
4313
4374
  async removeUsers(rql, options) {
4314
4375
  return (await userClient.delete(httpWithAuth, `/${rql}`, options)).data;
4315
4376
  },
@@ -4457,7 +4518,7 @@ const usersService = (httpWithAuth, http) => {
4457
4518
  basePath: USER_BASE,
4458
4519
  transformRequestData: decamelizeRequestData,
4459
4520
  });
4460
- const healthMethods = health$6(userClient, httpWithAuth);
4521
+ const healthMethods = health$7(userClient, httpWithAuth);
4461
4522
  const usersMethods = users$1(userClient, httpWithAuth, http);
4462
4523
  const groupRolesMethods = groupRoles(userClient, httpWithAuth);
4463
4524
  const globalRolesMethods = globalRoles(userClient, httpWithAuth);
@@ -4587,13 +4648,11 @@ var templates = (client, httpAuth) => ({
4587
4648
  },
4588
4649
  async findById(id, options) {
4589
4650
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
4590
- const res = await this.find({ ...options, rql: rqlWithId });
4591
- return res.data[0];
4651
+ return await this.findFirst({ ...options, rql: rqlWithId });
4592
4652
  },
4593
4653
  async findByName(name, options) {
4594
4654
  const rqlWithName = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('name', name).build();
4595
- const res = await this.find({ ...options, rql: rqlWithName });
4596
- return res.data[0];
4655
+ return await this.findFirst({ ...options, rql: rqlWithName });
4597
4656
  },
4598
4657
  async findFirst(options) {
4599
4658
  const res = await this.find(options);
@@ -4661,34 +4720,37 @@ var mails = (client, httpAuth) => ({
4661
4720
  return result.status === exports.Results.Success;
4662
4721
  },
4663
4722
  async find(options) {
4664
- return (await client.get(httpAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
4723
+ const result = await client.get(httpAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
4665
4724
  ...options,
4666
4725
  customResponseKeys: ['data.content'],
4667
- })).data;
4726
+ });
4727
+ return result.data;
4668
4728
  },
4669
4729
  async findById(id, options) {
4670
4730
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
4671
- const res = await this.find({ ...options, rql: rqlWithId });
4672
- return res.data[0];
4731
+ return await this.findFirst({ ...options, rql: rqlWithId });
4673
4732
  },
4674
4733
  async findFirst(options) {
4675
4734
  const res = await this.find(options);
4676
4735
  return res.data[0];
4677
4736
  },
4678
4737
  async send(requestBody, options) {
4679
- return (await client.post(httpAuth, '/', requestBody, {
4738
+ const result = await client.post(httpAuth, '/', requestBody, {
4680
4739
  ...options,
4681
4740
  customKeys: ['content'],
4682
- })).data;
4741
+ });
4742
+ return result.data;
4683
4743
  },
4684
4744
  async track(trackingHash, options) {
4685
- return (await client.get(httpAuth, `/${trackingHash}/open`, options)).data;
4745
+ const result = await client.get(httpAuth, `/${trackingHash}/open`, options);
4746
+ return result.data;
4686
4747
  },
4687
4748
  async findOutbound(options) {
4688
- return (await client.get(httpAuth, `/queued${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
4749
+ const result = await client.get(httpAuth, `/queued${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
4689
4750
  ...options,
4690
4751
  customResponseKeys: ['data.templateData.content'],
4691
- })).data;
4752
+ });
4753
+ return result.data;
4692
4754
  },
4693
4755
  });
4694
4756
 
@@ -4838,7 +4900,7 @@ var appStoreSubscriptions = (client, httpAuth) => ({
4838
4900
  },
4839
4901
  });
4840
4902
 
4841
- var health$5 = (client, httpAuth) => ({
4903
+ var health$6 = (client, httpAuth) => ({
4842
4904
  /**
4843
4905
  * Check if the service is available
4844
4906
  * @returns true if service is up and running
@@ -4864,8 +4926,7 @@ var orders = (client, httpAuth) => ({
4864
4926
  },
4865
4927
  async findById(id, options) {
4866
4928
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
4867
- const res = await this.find({ ...options, rql: rqlWithId });
4868
- return res.data[0];
4929
+ return await this.findFirst({ ...options, rql: rqlWithId });
4869
4930
  },
4870
4931
  async findFirst(options) {
4871
4932
  const res = await this.find(options);
@@ -4964,8 +5025,7 @@ var products = (client, httpAuth) => ({
4964
5025
  },
4965
5026
  async findById(id, options) {
4966
5027
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
4967
- const res = await this.find({ ...options, rql: rqlWithId });
4968
- return res.data[0];
5028
+ return await this.findFirst({ ...options, rql: rqlWithId });
4969
5029
  },
4970
5030
  async findFirst(options) {
4971
5031
  const res = await this.find(options);
@@ -5044,7 +5104,7 @@ const paymentsService = (httpWithAuth) => {
5044
5104
  basePath: PAYMENTS_BASE,
5045
5105
  });
5046
5106
  return {
5047
- ...health$5(client, httpWithAuth),
5107
+ ...health$6(client, httpWithAuth),
5048
5108
  products: products(client, httpWithAuth),
5049
5109
  orders: orders(client, httpWithAuth),
5050
5110
  subscriptions: subscriptions$1(client, httpWithAuth),
@@ -5066,7 +5126,7 @@ var countries = (client, httpAuth) => ({
5066
5126
  },
5067
5127
  });
5068
5128
 
5069
- var health$4 = (client, http) => ({
5129
+ var health$5 = (client, http) => ({
5070
5130
  /**
5071
5131
  * Perform a health check
5072
5132
  * @returns {boolean} success
@@ -5089,8 +5149,7 @@ var localizations = (client, httpAuth) => ({
5089
5149
  },
5090
5150
  async findByKey(key, options) {
5091
5151
  const rqlWithKey = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('key', key).build();
5092
- const res = await this.find({ ...options, rql: rqlWithKey });
5093
- return res.data[0];
5152
+ return await this.findFirst({ ...options, rql: rqlWithKey });
5094
5153
  },
5095
5154
  async findFirst(options) {
5096
5155
  const res = await this.find(options);
@@ -5119,7 +5178,7 @@ const localizationsService = (httpWithAuth) => {
5119
5178
  basePath: LOCALIZATIONS_BASE,
5120
5179
  });
5121
5180
  return {
5122
- ...health$4(client, httpWithAuth),
5181
+ ...health$5(client, httpWithAuth),
5123
5182
  ...localizations(client, httpWithAuth),
5124
5183
  ...countries(client, httpWithAuth),
5125
5184
  ...languages(client, httpWithAuth),
@@ -5144,7 +5203,7 @@ var groups = (client, httpAuth) => ({
5144
5203
  },
5145
5204
  });
5146
5205
 
5147
- var health$3 = (client, httpAuth) => ({
5206
+ var health$4 = (client, httpAuth) => ({
5148
5207
  /**
5149
5208
  * Perform a health check for profiles service
5150
5209
  * @returns {boolean} success
@@ -5198,8 +5257,7 @@ var profiles = (client, httpAuth) => ({
5198
5257
  },
5199
5258
  async findById(id, options) {
5200
5259
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
5201
- const res = await this.find({ ...options, rql: rqlWithId });
5202
- return res.data[0];
5260
+ return await this.findFirst({ ...options, rql: rqlWithId });
5203
5261
  },
5204
5262
  async findFirst(options) {
5205
5263
  const res = await this.find(options);
@@ -5234,14 +5292,14 @@ const profilesService = (httpWithAuth) => {
5234
5292
  basePath: PROFILES_BASE,
5235
5293
  });
5236
5294
  return {
5237
- ...health$3(client, httpWithAuth),
5295
+ ...health$4(client, httpWithAuth),
5238
5296
  ...profiles(client, httpWithAuth),
5239
5297
  groups: groups(client, httpWithAuth),
5240
5298
  logs: logs(client, httpWithAuth),
5241
5299
  };
5242
5300
  };
5243
5301
 
5244
- var health$2 = (client, http) => ({
5302
+ var health$3 = (client, http) => ({
5245
5303
  /**
5246
5304
  * Perform a health check
5247
5305
  * @returns {boolean} success
@@ -5282,8 +5340,7 @@ var notifications = (client, httpAuth) => {
5282
5340
  },
5283
5341
  async findById(id, options) {
5284
5342
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
5285
- const res = await this.find({ ...options, rql: rqlWithId });
5286
- return res.data[0];
5343
+ return await this.findFirst({ ...options, rql: rqlWithId });
5287
5344
  },
5288
5345
  async findFirst(options) {
5289
5346
  const res = await this.find(options);
@@ -5307,8 +5364,7 @@ var settings = (client, httpAuth) => ({
5307
5364
  },
5308
5365
  async findById(id, options) {
5309
5366
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
5310
- const res = await this.find({ ...options, rql: rqlWithId });
5311
- return res.data[0];
5367
+ return await this.findFirst({ ...options, rql: rqlWithId });
5312
5368
  },
5313
5369
  async findFirst(options) {
5314
5370
  const res = await this.find(options);
@@ -5328,13 +5384,13 @@ const notificationsService = (httpWithAuth) => {
5328
5384
  transformRequestData: decamelizeRequestData,
5329
5385
  });
5330
5386
  return {
5331
- ...health$2(client, httpWithAuth),
5387
+ ...health$3(client, httpWithAuth),
5332
5388
  ...notifications(client, httpWithAuth),
5333
5389
  settings: settings(client, httpWithAuth),
5334
5390
  };
5335
5391
  };
5336
5392
 
5337
- var health$1 = (client, http) => ({
5393
+ var health$2 = (client, http) => ({
5338
5394
  /**
5339
5395
  * Perform a health check
5340
5396
  * @returns {boolean} success
@@ -5379,8 +5435,7 @@ var notificationsV2 = (client, httpWithAuth) => {
5379
5435
  },
5380
5436
  async findById(notificationId, options) {
5381
5437
  const rqlWithNotificationId = rqlBuilder().eq('id', notificationId).build();
5382
- const result = await find({ ...options, rql: rqlWithNotificationId });
5383
- return result.data[0];
5438
+ return await this.findFirst({ ...options, rql: rqlWithNotificationId });
5384
5439
  },
5385
5440
  };
5386
5441
  };
@@ -5430,7 +5485,7 @@ const notificationsV2Service = (httpWithAuth) => {
5430
5485
  basePath: NOTIFICATIONS_V2_BASE,
5431
5486
  });
5432
5487
  return {
5433
- ...health$1(client, httpWithAuth),
5488
+ ...health$2(client, httpWithAuth),
5434
5489
  ...notificationsV2(client, httpWithAuth),
5435
5490
  userSettings: notificationV2UserSettings(client, httpWithAuth),
5436
5491
  };
@@ -5442,8 +5497,7 @@ var events = (client, httpAuth) => ({
5442
5497
  },
5443
5498
  async findById(id, options) {
5444
5499
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
5445
- const res = await this.find({ ...options, rql: rqlWithId });
5446
- return res.data[0];
5500
+ return await this.findFirst({ ...options, rql: rqlWithId });
5447
5501
  },
5448
5502
  async findFirst(options) {
5449
5503
  const res = await this.find(options);
@@ -5459,7 +5513,7 @@ var events = (client, httpAuth) => ({
5459
5513
  },
5460
5514
  });
5461
5515
 
5462
- var health = (client, http) => ({
5516
+ var health$1 = (client, http) => ({
5463
5517
  /**
5464
5518
  * Perform a health check
5465
5519
  * @returns {boolean} success
@@ -5477,8 +5531,7 @@ var subscriptions = (client, httpAuth) => ({
5477
5531
  },
5478
5532
  async findById(id, options) {
5479
5533
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
5480
- const res = await this.find({ ...options, rql: rqlWithId });
5481
- return res.data[0];
5534
+ return await this.findFirst({ ...options, rql: rqlWithId });
5482
5535
  },
5483
5536
  async findFirst(options) {
5484
5537
  const res = await this.find(options);
@@ -5496,7 +5549,7 @@ const eventsService = (httpWithAuth) => {
5496
5549
  transformRequestData: decamelizeRequestData,
5497
5550
  });
5498
5551
  return {
5499
- ...health(client, httpWithAuth),
5552
+ ...health$1(client, httpWithAuth),
5500
5553
  ...events(client, httpWithAuth),
5501
5554
  subscriptions: subscriptions(client, httpWithAuth),
5502
5555
  };
@@ -5528,7 +5581,87 @@ const logsService = (httpWithAuth) => {
5528
5581
  };
5529
5582
  };
5530
5583
 
5531
- const version = '8.9.0-dev-121-e732d56';
5584
+ var health = (client, http) => ({
5585
+ /**
5586
+ * Perform a health check
5587
+ * @returns {boolean} success
5588
+ */
5589
+ async health() {
5590
+ const result = await client.get(http, '/health');
5591
+ return result.status === exports.Results.Success;
5592
+ },
5593
+ });
5594
+
5595
+ var templatesV2 = (client, httpWithAuth) => {
5596
+ async function find(options) {
5597
+ const result = await client.get(httpWithAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
5598
+ ...options,
5599
+ customResponseKeys: ['data.properties', 'data.outputs'],
5600
+ });
5601
+ return result.data;
5602
+ }
5603
+ return {
5604
+ async create(requestBody, options) {
5605
+ const result = (await client.post(httpWithAuth, '/', requestBody, {
5606
+ ...options,
5607
+ customKeys: ['properties', 'outputs'],
5608
+ }));
5609
+ return result.data;
5610
+ },
5611
+ async update(templateId, requestBody, options) {
5612
+ const result = (await client.put(httpWithAuth, `/${templateId}`, requestBody, {
5613
+ ...options,
5614
+ customKeys: ['properties', 'outputs'],
5615
+ }));
5616
+ return result.data;
5617
+ },
5618
+ async remove(templateId, options) {
5619
+ const result = (await client.delete(httpWithAuth, `/${templateId}`, options));
5620
+ return result.data;
5621
+ },
5622
+ async resolve(templateId, requestBody, options) {
5623
+ const result = (await client.post(httpWithAuth, `/${templateId}/resolve`, requestBody, {
5624
+ ...options,
5625
+ customRequestKeys: ['data'],
5626
+ customResponseKeys: ['*'],
5627
+ }));
5628
+ return result.data;
5629
+ },
5630
+ async find(options) {
5631
+ const result = await find(options);
5632
+ return addPagersFn(find, options, result);
5633
+ },
5634
+ async findAll(options) {
5635
+ return findAllGeneric(find, options);
5636
+ },
5637
+ async findById(templateId, options) {
5638
+ const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', templateId).build();
5639
+ const result = await find({ ...options, rql: rqlWithId });
5640
+ return result.data[0];
5641
+ },
5642
+ async findByName(name, options) {
5643
+ const rqlWithName = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('name', name).build();
5644
+ const result = await find({ ...options, rql: rqlWithName });
5645
+ return result.data[0];
5646
+ },
5647
+ async findFirst(options) {
5648
+ const result = await find(options);
5649
+ return result.data[0];
5650
+ },
5651
+ };
5652
+ };
5653
+
5654
+ const templatesV2Service = (httpWithAuth) => {
5655
+ const client = httpClient({
5656
+ basePath: TEMPLATES_V2_BASE,
5657
+ });
5658
+ return {
5659
+ ...health(client, httpWithAuth),
5660
+ ...templatesV2(client, httpWithAuth),
5661
+ };
5662
+ };
5663
+
5664
+ const version = '8.9.0-feat-134-c0f5b9d';
5532
5665
 
5533
5666
  /**
5534
5667
  * Create ExtraHorizon client.
@@ -5561,6 +5694,7 @@ function createClient(rawConfig) {
5561
5694
  files: filesService(httpWithAuth),
5562
5695
  tasks: tasksService(httpWithAuth),
5563
5696
  templates: templatesService(httpWithAuth),
5697
+ templatesV2: templatesV2Service(httpWithAuth),
5564
5698
  mails: mailsService(httpWithAuth),
5565
5699
  configurations: configurationsService(httpWithAuth),
5566
5700
  dispatchers: dispatchersService(httpWithAuth),
@@ -5798,6 +5932,8 @@ exports.StatusInUseError = StatusInUseError;
5798
5932
  exports.StripePaymentMethodError = StripePaymentMethodError;
5799
5933
  exports.StripeRequestError = StripeRequestError;
5800
5934
  exports.TemplateFillingError = TemplateFillingError;
5935
+ exports.TemplateResolvingError = TemplateResolvingError;
5936
+ exports.TemplateSyntaxError = TemplateSyntaxError;
5801
5937
  exports.TokenNotDeleteableError = TokenNotDeleteableError;
5802
5938
  exports.TooManyFailedAttemptsError = TooManyFailedAttemptsError;
5803
5939
  exports.UnauthorizedClientError = UnauthorizedClientError;