@extrahorizon/javascript-sdk 8.9.0-dev-122-b59ec47 → 8.9.0-dev-136-24be1b9

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 +6 -0
  2. package/build/index.cjs.js +170 -85
  3. package/build/index.mjs +169 -86
  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 +39 -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/logs/types.d.ts +1 -1
  26. package/build/types/services/tasks/schedules/types.d.ts +1 -1
  27. package/build/types/services/tasks/types.d.ts +2 -2
  28. package/build/types/services/templates/types.d.ts +57 -22
  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,12 @@ 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 a `exh.users.findByEmail` method to find a user by their email address.
12
+
13
+ ### Fixed
14
+ - Corrected the types for the `findFirst` (based) methods to indicate they may return `undefined` when no results are found.
15
+
10
16
 
11
17
  ## [8.8.2]
12
18
 
@@ -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,
@@ -1083,6 +1097,7 @@ exports.GlobalPermissionName = void 0;
1083
1097
  GlobalPermissionName["REMOVE_ROLE_PERMISSION"] = "REMOVE_ROLE_PERMISSION";
1084
1098
  GlobalPermissionName["REMOVE_STAFF"] = "REMOVE_STAFF";
1085
1099
  GlobalPermissionName["RESET_FAILED_LOGIN_ATTEMPTS"] = "RESET_FAILED_LOGIN_ATTEMPTS";
1100
+ GlobalPermissionName["RESOLVE_TEMPLATES"] = "RESOLVE_TEMPLATES";
1086
1101
  GlobalPermissionName["SEND_MAILS"] = "SEND_MAILS";
1087
1102
  GlobalPermissionName["SYNC_PROFILE_GROUPS"] = "SYNC_PROFILE_GROUPS";
1088
1103
  GlobalPermissionName["TRANSFER_PERIOD"] = "TRANSFER_PERIOD";
@@ -1238,15 +1253,6 @@ exports.QueuedMailStatus = void 0;
1238
1253
  QueuedMailStatus["FAILED"] = "failed";
1239
1254
  })(exports.QueuedMailStatus || (exports.QueuedMailStatus = {}));
1240
1255
 
1241
- exports.ObjectMinBytesOptionType = void 0;
1242
- (function (ObjectMinBytesOptionType) {
1243
- ObjectMinBytesOptionType["MIN_BYTES"] = "min_bytes";
1244
- })(exports.ObjectMinBytesOptionType || (exports.ObjectMinBytesOptionType = {}));
1245
- exports.ObjectMaxBytesOptionType = void 0;
1246
- (function (ObjectMaxBytesOptionType) {
1247
- ObjectMaxBytesOptionType["MAX_BYTES"] = "max_bytes";
1248
- })(exports.ObjectMaxBytesOptionType || (exports.ObjectMaxBytesOptionType = {}));
1249
-
1250
1256
  exports.ActionType = void 0;
1251
1257
  (function (ActionType) {
1252
1258
  ActionType["MAIL"] = "mail";
@@ -1647,6 +1653,7 @@ const FILES_BASE = '/files/v1';
1647
1653
  const TASKS_BASE = '/tasks/v1';
1648
1654
  const CONFIGURATION_BASE = '/configurations/v2';
1649
1655
  const TEMPLATE_BASE = '/templates/v1';
1656
+ const TEMPLATES_V2_BASE = '/templates/v2';
1650
1657
  const MAIL_BASE = '/mail/v1';
1651
1658
  const DISPATCHERS_BASE = '/dispatchers/v1';
1652
1659
  const PAYMENTS_BASE = '/payments/v1';
@@ -3543,11 +3550,7 @@ var comments = (client, httpAuth) => ({
3543
3550
  },
3544
3551
  async findById(id, schemaIdOrName, documentId, options) {
3545
3552
  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];
3553
+ return await this.findFirst(schemaIdOrName, documentId, { ...options, rql: rqlWithId });
3551
3554
  },
3552
3555
  async findFirst(schemaIdOrName, documentId, options) {
3553
3556
  const res = await this.find(schemaIdOrName, documentId, options);
@@ -3600,8 +3603,7 @@ var documents = (client, httpAuth) => {
3600
3603
  },
3601
3604
  async findById(schemaIdOrName, documentId, options) {
3602
3605
  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];
3606
+ return await this.findFirst(schemaIdOrName, { ...options, rql: rqlWithId });
3605
3607
  },
3606
3608
  async findFirst(schemaIdOrName, options) {
3607
3609
  const res = await this.find(schemaIdOrName, options);
@@ -3728,13 +3730,11 @@ var schemas = (client, httpAuth) => {
3728
3730
  },
3729
3731
  async findById(id, options) {
3730
3732
  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];
3733
+ return await this.findFirst({ ...options, rql: rqlWithId });
3733
3734
  },
3734
3735
  async findByName(name, options) {
3735
3736
  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];
3737
+ return await this.findFirst({ ...options, rql: rqlWithName });
3738
3738
  },
3739
3739
  async findFirst(options) {
3740
3740
  const res = await find(options);
@@ -3826,8 +3826,7 @@ var files = (client, httpAuth) => ({
3826
3826
  },
3827
3827
  async findByName(name, options) {
3828
3828
  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];
3829
+ return await this.findFirst({ ...options, rql: rqlWithName });
3831
3830
  },
3832
3831
  async findFirst(options) {
3833
3832
  const res = await this.find(options);
@@ -4084,8 +4083,7 @@ var tasks = (client, httpAuth) => ({
4084
4083
  },
4085
4084
  async findById(id, options) {
4086
4085
  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];
4086
+ return await this.findFirst({ ...options, rql: rqlWithId });
4089
4087
  },
4090
4088
  async findFirst(options) {
4091
4089
  const res = await this.find(options);
@@ -4260,7 +4258,7 @@ var groupRoles = (client, httpWithAuth) => ({
4260
4258
  },
4261
4259
  });
4262
4260
 
4263
- var health$6 = (userClient, http) => ({
4261
+ var health$7 = (userClient, http) => ({
4264
4262
  /**
4265
4263
  * Perform a health check
4266
4264
  * @returns {boolean} success
@@ -4310,6 +4308,10 @@ var users$1 = (userClient, httpWithAuth, http) => {
4310
4308
  const res = await find(options);
4311
4309
  return res.data[0];
4312
4310
  },
4311
+ async findByEmail(email, options) {
4312
+ const rqlWithEmail = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('email', email).build();
4313
+ return await this.findFirst({ ...options, rql: rqlWithEmail });
4314
+ },
4313
4315
  async removeUsers(rql, options) {
4314
4316
  return (await userClient.delete(httpWithAuth, `/${rql}`, options)).data;
4315
4317
  },
@@ -4457,7 +4459,7 @@ const usersService = (httpWithAuth, http) => {
4457
4459
  basePath: USER_BASE,
4458
4460
  transformRequestData: decamelizeRequestData,
4459
4461
  });
4460
- const healthMethods = health$6(userClient, httpWithAuth);
4462
+ const healthMethods = health$7(userClient, httpWithAuth);
4461
4463
  const usersMethods = users$1(userClient, httpWithAuth, http);
4462
4464
  const groupRolesMethods = groupRoles(userClient, httpWithAuth);
4463
4465
  const globalRolesMethods = globalRoles(userClient, httpWithAuth);
@@ -4574,10 +4576,11 @@ var templates = (client, httpAuth) => ({
4574
4576
  return result.status === exports.Results.Success;
4575
4577
  },
4576
4578
  async find(options) {
4577
- return (await client.get(httpAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
4579
+ const result = await client.get(httpAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
4578
4580
  ...options,
4579
4581
  customResponseKeys: ['data.schema.fields', 'data.fields'],
4580
- })).data;
4582
+ });
4583
+ return result.data;
4581
4584
  },
4582
4585
  async findAll(options) {
4583
4586
  return findAllGeneric(this.find, options);
@@ -4587,60 +4590,65 @@ var templates = (client, httpAuth) => ({
4587
4590
  },
4588
4591
  async findById(id, options) {
4589
4592
  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];
4593
+ return await this.findFirst({ ...options, rql: rqlWithId });
4592
4594
  },
4593
4595
  async findByName(name, options) {
4594
4596
  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];
4597
+ return await this.findFirst({ ...options, rql: rqlWithName });
4597
4598
  },
4598
4599
  async findFirst(options) {
4599
4600
  const res = await this.find(options);
4600
4601
  return res.data[0];
4601
4602
  },
4602
4603
  async create(requestBody, options) {
4603
- return (await client.post(httpAuth, '/', requestBody, {
4604
+ const result = await client.post(httpAuth, '/', requestBody, {
4604
4605
  ...options,
4605
4606
  customKeys: ['schema.fields', 'fields'],
4606
- })).data;
4607
+ });
4608
+ return result.data;
4607
4609
  },
4608
4610
  async update(templateId, requestBody, options) {
4609
- return (await client.put(httpAuth, `/${templateId}`, requestBody, {
4611
+ const result = await client.put(httpAuth, `/${templateId}`, requestBody, {
4610
4612
  ...options,
4611
4613
  customKeys: ['schema.fields', 'fields'],
4612
- })).data;
4614
+ });
4615
+ return result.data;
4613
4616
  },
4614
4617
  async remove(templateId, options) {
4615
- return (await client.delete(httpAuth, `/${templateId}`, options)).data;
4618
+ const result = await client.delete(httpAuth, `/${templateId}`, options);
4619
+ return result.data;
4616
4620
  },
4617
4621
  async resolveAsPdf(templateId, requestBody, options) {
4618
- return (await client.post(httpAuth, `/${templateId}/pdf`, requestBody, {
4622
+ const result = await client.post(httpAuth, `/${templateId}/pdf`, requestBody, {
4619
4623
  ...options,
4620
4624
  customRequestKeys: ['content'],
4621
4625
  responseType: 'arraybuffer',
4622
- })).data;
4626
+ });
4627
+ return result.data;
4623
4628
  },
4624
4629
  async resolveAsPdfUsingCode(templateId, localizationCode, requestBody, options) {
4625
- return (await client.post(httpAuth, `/${templateId}/pdf/${localizationCode}`, requestBody, {
4630
+ const result = await client.post(httpAuth, `/${templateId}/pdf/${localizationCode}`, requestBody, {
4626
4631
  ...options,
4627
4632
  customRequestKeys: ['content'],
4628
4633
  responseType: 'arraybuffer',
4629
- })).data;
4634
+ });
4635
+ return result.data;
4630
4636
  },
4631
4637
  async resolveAsJson(templateId, requestBody, options) {
4632
- return (await client.post(httpAuth, `/${templateId}/resolve`, requestBody, {
4638
+ const result = await client.post(httpAuth, `/${templateId}/resolve`, requestBody, {
4633
4639
  ...options,
4634
4640
  customRequestKeys: ['content'],
4635
4641
  customResponseKeys: ['*'],
4636
- })).data;
4642
+ });
4643
+ return result.data;
4637
4644
  },
4638
4645
  async resolveAsJsonUsingCode(templateId, localizationCode, requestBody, options) {
4639
- return (await client.post(httpAuth, `/${templateId}/resolve/${localizationCode}`, requestBody, {
4646
+ const result = await client.post(httpAuth, `/${templateId}/resolve/${localizationCode}`, requestBody, {
4640
4647
  ...options,
4641
4648
  customRequestKeys: ['content'],
4642
4649
  customResponseKeys: ['*'],
4643
- })).data;
4650
+ });
4651
+ return result.data;
4644
4652
  },
4645
4653
  });
4646
4654
 
@@ -4661,34 +4669,37 @@ var mails = (client, httpAuth) => ({
4661
4669
  return result.status === exports.Results.Success;
4662
4670
  },
4663
4671
  async find(options) {
4664
- return (await client.get(httpAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
4672
+ const result = await client.get(httpAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
4665
4673
  ...options,
4666
4674
  customResponseKeys: ['data.content'],
4667
- })).data;
4675
+ });
4676
+ return result.data;
4668
4677
  },
4669
4678
  async findById(id, options) {
4670
4679
  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];
4680
+ return await this.findFirst({ ...options, rql: rqlWithId });
4673
4681
  },
4674
4682
  async findFirst(options) {
4675
4683
  const res = await this.find(options);
4676
4684
  return res.data[0];
4677
4685
  },
4678
4686
  async send(requestBody, options) {
4679
- return (await client.post(httpAuth, '/', requestBody, {
4687
+ const result = await client.post(httpAuth, '/', requestBody, {
4680
4688
  ...options,
4681
4689
  customKeys: ['content'],
4682
- })).data;
4690
+ });
4691
+ return result.data;
4683
4692
  },
4684
4693
  async track(trackingHash, options) {
4685
- return (await client.get(httpAuth, `/${trackingHash}/open`, options)).data;
4694
+ const result = await client.get(httpAuth, `/${trackingHash}/open`, options);
4695
+ return result.data;
4686
4696
  },
4687
4697
  async findOutbound(options) {
4688
- return (await client.get(httpAuth, `/queued${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
4698
+ const result = await client.get(httpAuth, `/queued${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
4689
4699
  ...options,
4690
4700
  customResponseKeys: ['data.templateData.content'],
4691
- })).data;
4701
+ });
4702
+ return result.data;
4692
4703
  },
4693
4704
  });
4694
4705
 
@@ -4838,7 +4849,7 @@ var appStoreSubscriptions = (client, httpAuth) => ({
4838
4849
  },
4839
4850
  });
4840
4851
 
4841
- var health$5 = (client, httpAuth) => ({
4852
+ var health$6 = (client, httpAuth) => ({
4842
4853
  /**
4843
4854
  * Check if the service is available
4844
4855
  * @returns true if service is up and running
@@ -4864,8 +4875,7 @@ var orders = (client, httpAuth) => ({
4864
4875
  },
4865
4876
  async findById(id, options) {
4866
4877
  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];
4878
+ return await this.findFirst({ ...options, rql: rqlWithId });
4869
4879
  },
4870
4880
  async findFirst(options) {
4871
4881
  const res = await this.find(options);
@@ -4964,8 +4974,7 @@ var products = (client, httpAuth) => ({
4964
4974
  },
4965
4975
  async findById(id, options) {
4966
4976
  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];
4977
+ return await this.findFirst({ ...options, rql: rqlWithId });
4969
4978
  },
4970
4979
  async findFirst(options) {
4971
4980
  const res = await this.find(options);
@@ -5044,7 +5053,7 @@ const paymentsService = (httpWithAuth) => {
5044
5053
  basePath: PAYMENTS_BASE,
5045
5054
  });
5046
5055
  return {
5047
- ...health$5(client, httpWithAuth),
5056
+ ...health$6(client, httpWithAuth),
5048
5057
  products: products(client, httpWithAuth),
5049
5058
  orders: orders(client, httpWithAuth),
5050
5059
  subscriptions: subscriptions$1(client, httpWithAuth),
@@ -5066,7 +5075,7 @@ var countries = (client, httpAuth) => ({
5066
5075
  },
5067
5076
  });
5068
5077
 
5069
- var health$4 = (client, http) => ({
5078
+ var health$5 = (client, http) => ({
5070
5079
  /**
5071
5080
  * Perform a health check
5072
5081
  * @returns {boolean} success
@@ -5089,8 +5098,7 @@ var localizations = (client, httpAuth) => ({
5089
5098
  },
5090
5099
  async findByKey(key, options) {
5091
5100
  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];
5101
+ return await this.findFirst({ ...options, rql: rqlWithKey });
5094
5102
  },
5095
5103
  async findFirst(options) {
5096
5104
  const res = await this.find(options);
@@ -5119,7 +5127,7 @@ const localizationsService = (httpWithAuth) => {
5119
5127
  basePath: LOCALIZATIONS_BASE,
5120
5128
  });
5121
5129
  return {
5122
- ...health$4(client, httpWithAuth),
5130
+ ...health$5(client, httpWithAuth),
5123
5131
  ...localizations(client, httpWithAuth),
5124
5132
  ...countries(client, httpWithAuth),
5125
5133
  ...languages(client, httpWithAuth),
@@ -5144,7 +5152,7 @@ var groups = (client, httpAuth) => ({
5144
5152
  },
5145
5153
  });
5146
5154
 
5147
- var health$3 = (client, httpAuth) => ({
5155
+ var health$4 = (client, httpAuth) => ({
5148
5156
  /**
5149
5157
  * Perform a health check for profiles service
5150
5158
  * @returns {boolean} success
@@ -5198,8 +5206,7 @@ var profiles = (client, httpAuth) => ({
5198
5206
  },
5199
5207
  async findById(id, options) {
5200
5208
  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];
5209
+ return await this.findFirst({ ...options, rql: rqlWithId });
5203
5210
  },
5204
5211
  async findFirst(options) {
5205
5212
  const res = await this.find(options);
@@ -5234,14 +5241,14 @@ const profilesService = (httpWithAuth) => {
5234
5241
  basePath: PROFILES_BASE,
5235
5242
  });
5236
5243
  return {
5237
- ...health$3(client, httpWithAuth),
5244
+ ...health$4(client, httpWithAuth),
5238
5245
  ...profiles(client, httpWithAuth),
5239
5246
  groups: groups(client, httpWithAuth),
5240
5247
  logs: logs(client, httpWithAuth),
5241
5248
  };
5242
5249
  };
5243
5250
 
5244
- var health$2 = (client, http) => ({
5251
+ var health$3 = (client, http) => ({
5245
5252
  /**
5246
5253
  * Perform a health check
5247
5254
  * @returns {boolean} success
@@ -5282,8 +5289,7 @@ var notifications = (client, httpAuth) => {
5282
5289
  },
5283
5290
  async findById(id, options) {
5284
5291
  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];
5292
+ return await this.findFirst({ ...options, rql: rqlWithId });
5287
5293
  },
5288
5294
  async findFirst(options) {
5289
5295
  const res = await this.find(options);
@@ -5307,8 +5313,7 @@ var settings = (client, httpAuth) => ({
5307
5313
  },
5308
5314
  async findById(id, options) {
5309
5315
  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];
5316
+ return await this.findFirst({ ...options, rql: rqlWithId });
5312
5317
  },
5313
5318
  async findFirst(options) {
5314
5319
  const res = await this.find(options);
@@ -5328,13 +5333,13 @@ const notificationsService = (httpWithAuth) => {
5328
5333
  transformRequestData: decamelizeRequestData,
5329
5334
  });
5330
5335
  return {
5331
- ...health$2(client, httpWithAuth),
5336
+ ...health$3(client, httpWithAuth),
5332
5337
  ...notifications(client, httpWithAuth),
5333
5338
  settings: settings(client, httpWithAuth),
5334
5339
  };
5335
5340
  };
5336
5341
 
5337
- var health$1 = (client, http) => ({
5342
+ var health$2 = (client, http) => ({
5338
5343
  /**
5339
5344
  * Perform a health check
5340
5345
  * @returns {boolean} success
@@ -5379,8 +5384,7 @@ var notificationsV2 = (client, httpWithAuth) => {
5379
5384
  },
5380
5385
  async findById(notificationId, options) {
5381
5386
  const rqlWithNotificationId = rqlBuilder().eq('id', notificationId).build();
5382
- const result = await find({ ...options, rql: rqlWithNotificationId });
5383
- return result.data[0];
5387
+ return await this.findFirst({ ...options, rql: rqlWithNotificationId });
5384
5388
  },
5385
5389
  };
5386
5390
  };
@@ -5430,7 +5434,7 @@ const notificationsV2Service = (httpWithAuth) => {
5430
5434
  basePath: NOTIFICATIONS_V2_BASE,
5431
5435
  });
5432
5436
  return {
5433
- ...health$1(client, httpWithAuth),
5437
+ ...health$2(client, httpWithAuth),
5434
5438
  ...notificationsV2(client, httpWithAuth),
5435
5439
  userSettings: notificationV2UserSettings(client, httpWithAuth),
5436
5440
  };
@@ -5442,8 +5446,7 @@ var events = (client, httpAuth) => ({
5442
5446
  },
5443
5447
  async findById(id, options) {
5444
5448
  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];
5449
+ return await this.findFirst({ ...options, rql: rqlWithId });
5447
5450
  },
5448
5451
  async findFirst(options) {
5449
5452
  const res = await this.find(options);
@@ -5459,7 +5462,7 @@ var events = (client, httpAuth) => ({
5459
5462
  },
5460
5463
  });
5461
5464
 
5462
- var health = (client, http) => ({
5465
+ var health$1 = (client, http) => ({
5463
5466
  /**
5464
5467
  * Perform a health check
5465
5468
  * @returns {boolean} success
@@ -5477,8 +5480,7 @@ var subscriptions = (client, httpAuth) => ({
5477
5480
  },
5478
5481
  async findById(id, options) {
5479
5482
  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];
5483
+ return await this.findFirst({ ...options, rql: rqlWithId });
5482
5484
  },
5483
5485
  async findFirst(options) {
5484
5486
  const res = await this.find(options);
@@ -5496,7 +5498,7 @@ const eventsService = (httpWithAuth) => {
5496
5498
  transformRequestData: decamelizeRequestData,
5497
5499
  });
5498
5500
  return {
5499
- ...health(client, httpWithAuth),
5501
+ ...health$1(client, httpWithAuth),
5500
5502
  ...events(client, httpWithAuth),
5501
5503
  subscriptions: subscriptions(client, httpWithAuth),
5502
5504
  };
@@ -5528,7 +5530,87 @@ const logsService = (httpWithAuth) => {
5528
5530
  };
5529
5531
  };
5530
5532
 
5531
- const version = '8.9.0-dev-122-b59ec47';
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
+ var templatesV2 = (client, httpWithAuth) => {
5545
+ async function find(options) {
5546
+ const result = await client.get(httpWithAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
5547
+ ...options,
5548
+ customResponseKeys: ['data.properties', 'data.outputs'],
5549
+ });
5550
+ return result.data;
5551
+ }
5552
+ return {
5553
+ async create(requestBody, options) {
5554
+ const result = (await client.post(httpWithAuth, '/', requestBody, {
5555
+ ...options,
5556
+ customKeys: ['properties', 'outputs'],
5557
+ }));
5558
+ return result.data;
5559
+ },
5560
+ async update(templateId, requestBody, options) {
5561
+ const result = (await client.put(httpWithAuth, `/${templateId}`, requestBody, {
5562
+ ...options,
5563
+ customKeys: ['properties', 'outputs'],
5564
+ }));
5565
+ return result.data;
5566
+ },
5567
+ async remove(templateId, options) {
5568
+ const result = (await client.delete(httpWithAuth, `/${templateId}`, options));
5569
+ return result.data;
5570
+ },
5571
+ async resolve(templateId, requestBody, options) {
5572
+ const result = (await client.post(httpWithAuth, `/${templateId}/resolve`, requestBody, {
5573
+ ...options,
5574
+ customRequestKeys: ['data'],
5575
+ customResponseKeys: ['*'],
5576
+ }));
5577
+ return result.data;
5578
+ },
5579
+ async find(options) {
5580
+ const result = await find(options);
5581
+ return addPagersFn(find, options, result);
5582
+ },
5583
+ async findAll(options) {
5584
+ return findAllGeneric(find, options);
5585
+ },
5586
+ async findById(templateId, options) {
5587
+ const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', templateId).build();
5588
+ const result = await find({ ...options, rql: rqlWithId });
5589
+ return result.data[0];
5590
+ },
5591
+ async findByName(name, options) {
5592
+ const rqlWithName = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('name', name).build();
5593
+ const result = await find({ ...options, rql: rqlWithName });
5594
+ return result.data[0];
5595
+ },
5596
+ async findFirst(options) {
5597
+ const result = await find(options);
5598
+ return result.data[0];
5599
+ },
5600
+ };
5601
+ };
5602
+
5603
+ const templatesV2Service = (httpWithAuth) => {
5604
+ const client = httpClient({
5605
+ basePath: TEMPLATES_V2_BASE,
5606
+ });
5607
+ return {
5608
+ ...health(client, httpWithAuth),
5609
+ ...templatesV2(client, httpWithAuth),
5610
+ };
5611
+ };
5612
+
5613
+ const version = '8.9.0-dev-136-24be1b9';
5532
5614
 
5533
5615
  /**
5534
5616
  * Create ExtraHorizon client.
@@ -5561,6 +5643,7 @@ function createClient(rawConfig) {
5561
5643
  files: filesService(httpWithAuth),
5562
5644
  tasks: tasksService(httpWithAuth),
5563
5645
  templates: templatesService(httpWithAuth),
5646
+ templatesV2: templatesV2Service(httpWithAuth),
5564
5647
  mails: mailsService(httpWithAuth),
5565
5648
  configurations: configurationsService(httpWithAuth),
5566
5649
  dispatchers: dispatchersService(httpWithAuth),
@@ -5798,6 +5881,8 @@ exports.StatusInUseError = StatusInUseError;
5798
5881
  exports.StripePaymentMethodError = StripePaymentMethodError;
5799
5882
  exports.StripeRequestError = StripeRequestError;
5800
5883
  exports.TemplateFillingError = TemplateFillingError;
5884
+ exports.TemplateResolvingError = TemplateResolvingError;
5885
+ exports.TemplateSyntaxError = TemplateSyntaxError;
5801
5886
  exports.TokenNotDeleteableError = TokenNotDeleteableError;
5802
5887
  exports.TooManyFailedAttemptsError = TooManyFailedAttemptsError;
5803
5888
  exports.UnauthorizedClientError = UnauthorizedClientError;