@extrahorizon/javascript-sdk 8.9.0-dev-121-e732d56 → 8.9.0-dev-135-f1c216a

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/build/index.mjs CHANGED
@@ -587,6 +587,18 @@ class LocalizationKeyMissingError extends BadRequestError {
587
587
  }
588
588
  class TemplateFillingError extends BadRequestError {
589
589
  }
590
+ class TemplateSyntaxError extends BadRequestError {
591
+ constructor(apiError) {
592
+ super(apiError);
593
+ this.syntaxError = apiError.response.syntaxError;
594
+ }
595
+ }
596
+ class TemplateResolvingError extends BadRequestError {
597
+ constructor(apiError) {
598
+ super(apiError);
599
+ this.resolveError = apiError.response.resolveError;
600
+ }
601
+ }
590
602
  class MissingRequiredFieldsError extends BadRequestError {
591
603
  }
592
604
  class InvalidCurrencyForProductPrice extends BadRequestError {
@@ -887,6 +899,8 @@ const ErrorClassMap = {
887
899
  801: DefaultLocalizationMissingError,
888
900
  1002: LocalizationKeyMissingError,
889
901
  1003: TemplateFillingError,
902
+ 1004: TemplateSyntaxError,
903
+ 1005: TemplateResolvingError,
890
904
  2605: InvalidTokenError,
891
905
  2606: UnauthorizedTokenError,
892
906
  2607: TokenNotDeleteableError,
@@ -1053,6 +1067,7 @@ var GlobalPermissionName;
1053
1067
  GlobalPermissionName["REMOVE_ROLE_PERMISSION"] = "REMOVE_ROLE_PERMISSION";
1054
1068
  GlobalPermissionName["REMOVE_STAFF"] = "REMOVE_STAFF";
1055
1069
  GlobalPermissionName["RESET_FAILED_LOGIN_ATTEMPTS"] = "RESET_FAILED_LOGIN_ATTEMPTS";
1070
+ GlobalPermissionName["RESOLVE_TEMPLATES"] = "RESOLVE_TEMPLATES";
1056
1071
  GlobalPermissionName["SEND_MAILS"] = "SEND_MAILS";
1057
1072
  GlobalPermissionName["SYNC_PROFILE_GROUPS"] = "SYNC_PROFILE_GROUPS";
1058
1073
  GlobalPermissionName["TRANSFER_PERIOD"] = "TRANSFER_PERIOD";
@@ -1208,15 +1223,6 @@ var QueuedMailStatus;
1208
1223
  QueuedMailStatus["FAILED"] = "failed";
1209
1224
  })(QueuedMailStatus || (QueuedMailStatus = {}));
1210
1225
 
1211
- var ObjectMinBytesOptionType;
1212
- (function (ObjectMinBytesOptionType) {
1213
- ObjectMinBytesOptionType["MIN_BYTES"] = "min_bytes";
1214
- })(ObjectMinBytesOptionType || (ObjectMinBytesOptionType = {}));
1215
- var ObjectMaxBytesOptionType;
1216
- (function (ObjectMaxBytesOptionType) {
1217
- ObjectMaxBytesOptionType["MAX_BYTES"] = "max_bytes";
1218
- })(ObjectMaxBytesOptionType || (ObjectMaxBytesOptionType = {}));
1219
-
1220
1226
  var ActionType;
1221
1227
  (function (ActionType) {
1222
1228
  ActionType["MAIL"] = "mail";
@@ -1617,6 +1623,7 @@ const FILES_BASE = '/files/v1';
1617
1623
  const TASKS_BASE = '/tasks/v1';
1618
1624
  const CONFIGURATION_BASE = '/configurations/v2';
1619
1625
  const TEMPLATE_BASE = '/templates/v1';
1626
+ const TEMPLATES_V2_BASE = '/templates/v2';
1620
1627
  const MAIL_BASE = '/mail/v1';
1621
1628
  const DISPATCHERS_BASE = '/dispatchers/v1';
1622
1629
  const PAYMENTS_BASE = '/payments/v1';
@@ -3513,11 +3520,7 @@ var comments = (client, httpAuth) => ({
3513
3520
  },
3514
3521
  async findById(id, schemaIdOrName, documentId, options) {
3515
3522
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
3516
- const res = await this.find(schemaIdOrName, documentId, {
3517
- ...options,
3518
- rql: rqlWithId,
3519
- });
3520
- return res.data[0];
3523
+ return await this.findFirst(schemaIdOrName, documentId, { ...options, rql: rqlWithId });
3521
3524
  },
3522
3525
  async findFirst(schemaIdOrName, documentId, options) {
3523
3526
  const res = await this.find(schemaIdOrName, documentId, options);
@@ -3570,8 +3573,7 @@ var documents = (client, httpAuth) => {
3570
3573
  },
3571
3574
  async findById(schemaIdOrName, documentId, options) {
3572
3575
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', documentId).build();
3573
- const res = await this.find(schemaIdOrName, { ...options, rql: rqlWithId });
3574
- return res.data[0];
3576
+ return await this.findFirst(schemaIdOrName, { ...options, rql: rqlWithId });
3575
3577
  },
3576
3578
  async findFirst(schemaIdOrName, options) {
3577
3579
  const res = await this.find(schemaIdOrName, options);
@@ -3698,13 +3700,11 @@ var schemas = (client, httpAuth) => {
3698
3700
  },
3699
3701
  async findById(id, options) {
3700
3702
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
3701
- const res = await find({ ...options, rql: rqlWithId });
3702
- return res.data[0];
3703
+ return await this.findFirst({ ...options, rql: rqlWithId });
3703
3704
  },
3704
3705
  async findByName(name, options) {
3705
3706
  const rqlWithName = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('name', name).build();
3706
- const res = await find({ ...options, rql: rqlWithName });
3707
- return res.data[0];
3707
+ return await this.findFirst({ ...options, rql: rqlWithName });
3708
3708
  },
3709
3709
  async findFirst(options) {
3710
3710
  const res = await find(options);
@@ -3796,8 +3796,7 @@ var files = (client, httpAuth) => ({
3796
3796
  },
3797
3797
  async findByName(name, options) {
3798
3798
  const rqlWithName = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('name', name).build();
3799
- const res = await this.find({ ...options, rql: rqlWithName });
3800
- return res.data[0];
3799
+ return await this.findFirst({ ...options, rql: rqlWithName });
3801
3800
  },
3802
3801
  async findFirst(options) {
3803
3802
  const res = await this.find(options);
@@ -4054,8 +4053,7 @@ var tasks = (client, httpAuth) => ({
4054
4053
  },
4055
4054
  async findById(id, options) {
4056
4055
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
4057
- const res = await this.find({ ...options, rql: rqlWithId });
4058
- return res.data[0];
4056
+ return await this.findFirst({ ...options, rql: rqlWithId });
4059
4057
  },
4060
4058
  async findFirst(options) {
4061
4059
  const res = await this.find(options);
@@ -4230,7 +4228,7 @@ var groupRoles = (client, httpWithAuth) => ({
4230
4228
  },
4231
4229
  });
4232
4230
 
4233
- var health$6 = (userClient, http) => ({
4231
+ var health$7 = (userClient, http) => ({
4234
4232
  /**
4235
4233
  * Perform a health check
4236
4234
  * @returns {boolean} success
@@ -4280,6 +4278,10 @@ var users$1 = (userClient, httpWithAuth, http) => {
4280
4278
  const res = await find(options);
4281
4279
  return res.data[0];
4282
4280
  },
4281
+ async findByEmail(email, options) {
4282
+ const rqlWithEmail = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('email', email).build();
4283
+ return await this.findFirst({ ...options, rql: rqlWithEmail });
4284
+ },
4283
4285
  async removeUsers(rql, options) {
4284
4286
  return (await userClient.delete(httpWithAuth, `/${rql}`, options)).data;
4285
4287
  },
@@ -4427,7 +4429,7 @@ const usersService = (httpWithAuth, http) => {
4427
4429
  basePath: USER_BASE,
4428
4430
  transformRequestData: decamelizeRequestData,
4429
4431
  });
4430
- const healthMethods = health$6(userClient, httpWithAuth);
4432
+ const healthMethods = health$7(userClient, httpWithAuth);
4431
4433
  const usersMethods = users$1(userClient, httpWithAuth, http);
4432
4434
  const groupRolesMethods = groupRoles(userClient, httpWithAuth);
4433
4435
  const globalRolesMethods = globalRoles(userClient, httpWithAuth);
@@ -4544,10 +4546,11 @@ var templates = (client, httpAuth) => ({
4544
4546
  return result.status === Results.Success;
4545
4547
  },
4546
4548
  async find(options) {
4547
- return (await client.get(httpAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
4549
+ const result = await client.get(httpAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
4548
4550
  ...options,
4549
4551
  customResponseKeys: ['data.schema.fields', 'data.fields'],
4550
- })).data;
4552
+ });
4553
+ return result.data;
4551
4554
  },
4552
4555
  async findAll(options) {
4553
4556
  return findAllGeneric(this.find, options);
@@ -4557,60 +4560,65 @@ var templates = (client, httpAuth) => ({
4557
4560
  },
4558
4561
  async findById(id, options) {
4559
4562
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
4560
- const res = await this.find({ ...options, rql: rqlWithId });
4561
- return res.data[0];
4563
+ return await this.findFirst({ ...options, rql: rqlWithId });
4562
4564
  },
4563
4565
  async findByName(name, options) {
4564
4566
  const rqlWithName = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('name', name).build();
4565
- const res = await this.find({ ...options, rql: rqlWithName });
4566
- return res.data[0];
4567
+ return await this.findFirst({ ...options, rql: rqlWithName });
4567
4568
  },
4568
4569
  async findFirst(options) {
4569
4570
  const res = await this.find(options);
4570
4571
  return res.data[0];
4571
4572
  },
4572
4573
  async create(requestBody, options) {
4573
- return (await client.post(httpAuth, '/', requestBody, {
4574
+ const result = await client.post(httpAuth, '/', requestBody, {
4574
4575
  ...options,
4575
4576
  customKeys: ['schema.fields', 'fields'],
4576
- })).data;
4577
+ });
4578
+ return result.data;
4577
4579
  },
4578
4580
  async update(templateId, requestBody, options) {
4579
- return (await client.put(httpAuth, `/${templateId}`, requestBody, {
4581
+ const result = await client.put(httpAuth, `/${templateId}`, requestBody, {
4580
4582
  ...options,
4581
4583
  customKeys: ['schema.fields', 'fields'],
4582
- })).data;
4584
+ });
4585
+ return result.data;
4583
4586
  },
4584
4587
  async remove(templateId, options) {
4585
- return (await client.delete(httpAuth, `/${templateId}`, options)).data;
4588
+ const result = await client.delete(httpAuth, `/${templateId}`, options);
4589
+ return result.data;
4586
4590
  },
4587
4591
  async resolveAsPdf(templateId, requestBody, options) {
4588
- return (await client.post(httpAuth, `/${templateId}/pdf`, requestBody, {
4592
+ const result = await client.post(httpAuth, `/${templateId}/pdf`, requestBody, {
4589
4593
  ...options,
4590
4594
  customRequestKeys: ['content'],
4591
4595
  responseType: 'arraybuffer',
4592
- })).data;
4596
+ });
4597
+ return result.data;
4593
4598
  },
4594
4599
  async resolveAsPdfUsingCode(templateId, localizationCode, requestBody, options) {
4595
- return (await client.post(httpAuth, `/${templateId}/pdf/${localizationCode}`, requestBody, {
4600
+ const result = await client.post(httpAuth, `/${templateId}/pdf/${localizationCode}`, requestBody, {
4596
4601
  ...options,
4597
4602
  customRequestKeys: ['content'],
4598
4603
  responseType: 'arraybuffer',
4599
- })).data;
4604
+ });
4605
+ return result.data;
4600
4606
  },
4601
4607
  async resolveAsJson(templateId, requestBody, options) {
4602
- return (await client.post(httpAuth, `/${templateId}/resolve`, requestBody, {
4608
+ const result = await client.post(httpAuth, `/${templateId}/resolve`, requestBody, {
4603
4609
  ...options,
4604
4610
  customRequestKeys: ['content'],
4605
4611
  customResponseKeys: ['*'],
4606
- })).data;
4612
+ });
4613
+ return result.data;
4607
4614
  },
4608
4615
  async resolveAsJsonUsingCode(templateId, localizationCode, requestBody, options) {
4609
- return (await client.post(httpAuth, `/${templateId}/resolve/${localizationCode}`, requestBody, {
4616
+ const result = await client.post(httpAuth, `/${templateId}/resolve/${localizationCode}`, requestBody, {
4610
4617
  ...options,
4611
4618
  customRequestKeys: ['content'],
4612
4619
  customResponseKeys: ['*'],
4613
- })).data;
4620
+ });
4621
+ return result.data;
4614
4622
  },
4615
4623
  });
4616
4624
 
@@ -4631,34 +4639,37 @@ var mails = (client, httpAuth) => ({
4631
4639
  return result.status === Results.Success;
4632
4640
  },
4633
4641
  async find(options) {
4634
- return (await client.get(httpAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
4642
+ const result = await client.get(httpAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
4635
4643
  ...options,
4636
4644
  customResponseKeys: ['data.content'],
4637
- })).data;
4645
+ });
4646
+ return result.data;
4638
4647
  },
4639
4648
  async findById(id, options) {
4640
4649
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
4641
- const res = await this.find({ ...options, rql: rqlWithId });
4642
- return res.data[0];
4650
+ return await this.findFirst({ ...options, rql: rqlWithId });
4643
4651
  },
4644
4652
  async findFirst(options) {
4645
4653
  const res = await this.find(options);
4646
4654
  return res.data[0];
4647
4655
  },
4648
4656
  async send(requestBody, options) {
4649
- return (await client.post(httpAuth, '/', requestBody, {
4657
+ const result = await client.post(httpAuth, '/', requestBody, {
4650
4658
  ...options,
4651
4659
  customKeys: ['content'],
4652
- })).data;
4660
+ });
4661
+ return result.data;
4653
4662
  },
4654
4663
  async track(trackingHash, options) {
4655
- return (await client.get(httpAuth, `/${trackingHash}/open`, options)).data;
4664
+ const result = await client.get(httpAuth, `/${trackingHash}/open`, options);
4665
+ return result.data;
4656
4666
  },
4657
4667
  async findOutbound(options) {
4658
- return (await client.get(httpAuth, `/queued${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
4668
+ const result = await client.get(httpAuth, `/queued${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
4659
4669
  ...options,
4660
4670
  customResponseKeys: ['data.templateData.content'],
4661
- })).data;
4671
+ });
4672
+ return result.data;
4662
4673
  },
4663
4674
  });
4664
4675
 
@@ -4808,7 +4819,7 @@ var appStoreSubscriptions = (client, httpAuth) => ({
4808
4819
  },
4809
4820
  });
4810
4821
 
4811
- var health$5 = (client, httpAuth) => ({
4822
+ var health$6 = (client, httpAuth) => ({
4812
4823
  /**
4813
4824
  * Check if the service is available
4814
4825
  * @returns true if service is up and running
@@ -4834,8 +4845,7 @@ var orders = (client, httpAuth) => ({
4834
4845
  },
4835
4846
  async findById(id, options) {
4836
4847
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
4837
- const res = await this.find({ ...options, rql: rqlWithId });
4838
- return res.data[0];
4848
+ return await this.findFirst({ ...options, rql: rqlWithId });
4839
4849
  },
4840
4850
  async findFirst(options) {
4841
4851
  const res = await this.find(options);
@@ -4934,8 +4944,7 @@ var products = (client, httpAuth) => ({
4934
4944
  },
4935
4945
  async findById(id, options) {
4936
4946
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
4937
- const res = await this.find({ ...options, rql: rqlWithId });
4938
- return res.data[0];
4947
+ return await this.findFirst({ ...options, rql: rqlWithId });
4939
4948
  },
4940
4949
  async findFirst(options) {
4941
4950
  const res = await this.find(options);
@@ -5014,7 +5023,7 @@ const paymentsService = (httpWithAuth) => {
5014
5023
  basePath: PAYMENTS_BASE,
5015
5024
  });
5016
5025
  return {
5017
- ...health$5(client, httpWithAuth),
5026
+ ...health$6(client, httpWithAuth),
5018
5027
  products: products(client, httpWithAuth),
5019
5028
  orders: orders(client, httpWithAuth),
5020
5029
  subscriptions: subscriptions$1(client, httpWithAuth),
@@ -5036,7 +5045,7 @@ var countries = (client, httpAuth) => ({
5036
5045
  },
5037
5046
  });
5038
5047
 
5039
- var health$4 = (client, http) => ({
5048
+ var health$5 = (client, http) => ({
5040
5049
  /**
5041
5050
  * Perform a health check
5042
5051
  * @returns {boolean} success
@@ -5059,8 +5068,7 @@ var localizations = (client, httpAuth) => ({
5059
5068
  },
5060
5069
  async findByKey(key, options) {
5061
5070
  const rqlWithKey = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('key', key).build();
5062
- const res = await this.find({ ...options, rql: rqlWithKey });
5063
- return res.data[0];
5071
+ return await this.findFirst({ ...options, rql: rqlWithKey });
5064
5072
  },
5065
5073
  async findFirst(options) {
5066
5074
  const res = await this.find(options);
@@ -5089,7 +5097,7 @@ const localizationsService = (httpWithAuth) => {
5089
5097
  basePath: LOCALIZATIONS_BASE,
5090
5098
  });
5091
5099
  return {
5092
- ...health$4(client, httpWithAuth),
5100
+ ...health$5(client, httpWithAuth),
5093
5101
  ...localizations(client, httpWithAuth),
5094
5102
  ...countries(client, httpWithAuth),
5095
5103
  ...languages(client, httpWithAuth),
@@ -5114,7 +5122,7 @@ var groups = (client, httpAuth) => ({
5114
5122
  },
5115
5123
  });
5116
5124
 
5117
- var health$3 = (client, httpAuth) => ({
5125
+ var health$4 = (client, httpAuth) => ({
5118
5126
  /**
5119
5127
  * Perform a health check for profiles service
5120
5128
  * @returns {boolean} success
@@ -5168,8 +5176,7 @@ var profiles = (client, httpAuth) => ({
5168
5176
  },
5169
5177
  async findById(id, options) {
5170
5178
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
5171
- const res = await this.find({ ...options, rql: rqlWithId });
5172
- return res.data[0];
5179
+ return await this.findFirst({ ...options, rql: rqlWithId });
5173
5180
  },
5174
5181
  async findFirst(options) {
5175
5182
  const res = await this.find(options);
@@ -5204,14 +5211,14 @@ const profilesService = (httpWithAuth) => {
5204
5211
  basePath: PROFILES_BASE,
5205
5212
  });
5206
5213
  return {
5207
- ...health$3(client, httpWithAuth),
5214
+ ...health$4(client, httpWithAuth),
5208
5215
  ...profiles(client, httpWithAuth),
5209
5216
  groups: groups(client, httpWithAuth),
5210
5217
  logs: logs(client, httpWithAuth),
5211
5218
  };
5212
5219
  };
5213
5220
 
5214
- var health$2 = (client, http) => ({
5221
+ var health$3 = (client, http) => ({
5215
5222
  /**
5216
5223
  * Perform a health check
5217
5224
  * @returns {boolean} success
@@ -5252,8 +5259,7 @@ var notifications = (client, httpAuth) => {
5252
5259
  },
5253
5260
  async findById(id, options) {
5254
5261
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
5255
- const res = await this.find({ ...options, rql: rqlWithId });
5256
- return res.data[0];
5262
+ return await this.findFirst({ ...options, rql: rqlWithId });
5257
5263
  },
5258
5264
  async findFirst(options) {
5259
5265
  const res = await this.find(options);
@@ -5277,8 +5283,7 @@ var settings = (client, httpAuth) => ({
5277
5283
  },
5278
5284
  async findById(id, options) {
5279
5285
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
5280
- const res = await this.find({ ...options, rql: rqlWithId });
5281
- return res.data[0];
5286
+ return await this.findFirst({ ...options, rql: rqlWithId });
5282
5287
  },
5283
5288
  async findFirst(options) {
5284
5289
  const res = await this.find(options);
@@ -5298,13 +5303,13 @@ const notificationsService = (httpWithAuth) => {
5298
5303
  transformRequestData: decamelizeRequestData,
5299
5304
  });
5300
5305
  return {
5301
- ...health$2(client, httpWithAuth),
5306
+ ...health$3(client, httpWithAuth),
5302
5307
  ...notifications(client, httpWithAuth),
5303
5308
  settings: settings(client, httpWithAuth),
5304
5309
  };
5305
5310
  };
5306
5311
 
5307
- var health$1 = (client, http) => ({
5312
+ var health$2 = (client, http) => ({
5308
5313
  /**
5309
5314
  * Perform a health check
5310
5315
  * @returns {boolean} success
@@ -5349,8 +5354,7 @@ var notificationsV2 = (client, httpWithAuth) => {
5349
5354
  },
5350
5355
  async findById(notificationId, options) {
5351
5356
  const rqlWithNotificationId = rqlBuilder().eq('id', notificationId).build();
5352
- const result = await find({ ...options, rql: rqlWithNotificationId });
5353
- return result.data[0];
5357
+ return await this.findFirst({ ...options, rql: rqlWithNotificationId });
5354
5358
  },
5355
5359
  };
5356
5360
  };
@@ -5400,7 +5404,7 @@ const notificationsV2Service = (httpWithAuth) => {
5400
5404
  basePath: NOTIFICATIONS_V2_BASE,
5401
5405
  });
5402
5406
  return {
5403
- ...health$1(client, httpWithAuth),
5407
+ ...health$2(client, httpWithAuth),
5404
5408
  ...notificationsV2(client, httpWithAuth),
5405
5409
  userSettings: notificationV2UserSettings(client, httpWithAuth),
5406
5410
  };
@@ -5412,8 +5416,7 @@ var events = (client, httpAuth) => ({
5412
5416
  },
5413
5417
  async findById(id, options) {
5414
5418
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
5415
- const res = await this.find({ ...options, rql: rqlWithId });
5416
- return res.data[0];
5419
+ return await this.findFirst({ ...options, rql: rqlWithId });
5417
5420
  },
5418
5421
  async findFirst(options) {
5419
5422
  const res = await this.find(options);
@@ -5429,7 +5432,7 @@ var events = (client, httpAuth) => ({
5429
5432
  },
5430
5433
  });
5431
5434
 
5432
- var health = (client, http) => ({
5435
+ var health$1 = (client, http) => ({
5433
5436
  /**
5434
5437
  * Perform a health check
5435
5438
  * @returns {boolean} success
@@ -5447,8 +5450,7 @@ var subscriptions = (client, httpAuth) => ({
5447
5450
  },
5448
5451
  async findById(id, options) {
5449
5452
  const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
5450
- const res = await this.find({ ...options, rql: rqlWithId });
5451
- return res.data[0];
5453
+ return await this.findFirst({ ...options, rql: rqlWithId });
5452
5454
  },
5453
5455
  async findFirst(options) {
5454
5456
  const res = await this.find(options);
@@ -5466,7 +5468,7 @@ const eventsService = (httpWithAuth) => {
5466
5468
  transformRequestData: decamelizeRequestData,
5467
5469
  });
5468
5470
  return {
5469
- ...health(client, httpWithAuth),
5471
+ ...health$1(client, httpWithAuth),
5470
5472
  ...events(client, httpWithAuth),
5471
5473
  subscriptions: subscriptions(client, httpWithAuth),
5472
5474
  };
@@ -5498,7 +5500,87 @@ const logsService = (httpWithAuth) => {
5498
5500
  };
5499
5501
  };
5500
5502
 
5501
- const version = '8.9.0-dev-121-e732d56';
5503
+ var health = (client, http) => ({
5504
+ /**
5505
+ * Perform a health check
5506
+ * @returns {boolean} success
5507
+ */
5508
+ async health() {
5509
+ const result = await client.get(http, '/health');
5510
+ return result.status === Results.Success;
5511
+ },
5512
+ });
5513
+
5514
+ var templatesV2 = (client, httpWithAuth) => {
5515
+ async function find(options) {
5516
+ const result = await client.get(httpWithAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
5517
+ ...options,
5518
+ customResponseKeys: ['data.properties', 'data.outputs'],
5519
+ });
5520
+ return result.data;
5521
+ }
5522
+ return {
5523
+ async create(requestBody, options) {
5524
+ const result = (await client.post(httpWithAuth, '/', requestBody, {
5525
+ ...options,
5526
+ customKeys: ['properties', 'outputs'],
5527
+ }));
5528
+ return result.data;
5529
+ },
5530
+ async update(templateId, requestBody, options) {
5531
+ const result = (await client.put(httpWithAuth, `/${templateId}`, requestBody, {
5532
+ ...options,
5533
+ customKeys: ['properties', 'outputs'],
5534
+ }));
5535
+ return result.data;
5536
+ },
5537
+ async remove(templateId, options) {
5538
+ const result = (await client.delete(httpWithAuth, `/${templateId}`, options));
5539
+ return result.data;
5540
+ },
5541
+ async resolve(templateId, requestBody, options) {
5542
+ const result = (await client.post(httpWithAuth, `/${templateId}/resolve`, requestBody, {
5543
+ ...options,
5544
+ customRequestKeys: ['data'],
5545
+ customResponseKeys: ['*'],
5546
+ }));
5547
+ return result.data;
5548
+ },
5549
+ async find(options) {
5550
+ const result = await find(options);
5551
+ return addPagersFn(find, options, result);
5552
+ },
5553
+ async findAll(options) {
5554
+ return findAllGeneric(find, options);
5555
+ },
5556
+ async findById(templateId, options) {
5557
+ const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', templateId).build();
5558
+ const result = await find({ ...options, rql: rqlWithId });
5559
+ return result.data[0];
5560
+ },
5561
+ async findByName(name, options) {
5562
+ const rqlWithName = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('name', name).build();
5563
+ const result = await find({ ...options, rql: rqlWithName });
5564
+ return result.data[0];
5565
+ },
5566
+ async findFirst(options) {
5567
+ const result = await find(options);
5568
+ return result.data[0];
5569
+ },
5570
+ };
5571
+ };
5572
+
5573
+ const templatesV2Service = (httpWithAuth) => {
5574
+ const client = httpClient({
5575
+ basePath: TEMPLATES_V2_BASE,
5576
+ });
5577
+ return {
5578
+ ...health(client, httpWithAuth),
5579
+ ...templatesV2(client, httpWithAuth),
5580
+ };
5581
+ };
5582
+
5583
+ const version = '8.9.0-dev-135-f1c216a';
5502
5584
 
5503
5585
  /**
5504
5586
  * Create ExtraHorizon client.
@@ -5531,6 +5613,7 @@ function createClient(rawConfig) {
5531
5613
  files: filesService(httpWithAuth),
5532
5614
  tasks: tasksService(httpWithAuth),
5533
5615
  templates: templatesService(httpWithAuth),
5616
+ templatesV2: templatesV2Service(httpWithAuth),
5534
5617
  mails: mailsService(httpWithAuth),
5535
5618
  configurations: configurationsService(httpWithAuth),
5536
5619
  dispatchers: dispatchersService(httpWithAuth),
@@ -5677,4 +5760,4 @@ const parseStoredCredentials = (fileContent) => exhCredentialsDecoder(fileConten
5677
5760
  .filter(line => line.length === 2)
5678
5761
  .reduce((memo, [key, value]) => ({ ...memo, [key]: value }), {}));
5679
5762
 
5680
- export { AccessTokenExpiredError, AccessTokenUnknownError, ActionType, ActivationRequestLimitError, ActivationRequestTimeoutError, ActivationUnknownError, AlreadyActivatedError, ApiError, ApiFunctionRequestMethod, ApiRequestErrorType, AppStoreTransactionAlreadyLinked, ApplicationNotAuthenticatedError, ApplicationType, ApplicationUnknownError, AuthenticationError, AuthorizationCodeExpiredError, AuthorizationUnknownError, BadGatewayServerError, BadRequestError, BodyFormatError, CallbackNotValidError, Comorbidities, DefaultLocalizationMissingError, DisabledForOidcUsersError, DuplicateRequestError, EmailUnknownError, EmailUsedError, EmptyBodyError, ErrorClassMap, FieldFormatError, FieldType, FileTooLargeError, FirebaseConnectionError, FirebaseInvalidPlatformDataError, ForbiddenError, ForgotPasswordRequestLimitError, ForgotPasswordRequestTimeoutError, Gender, GlobalPermissionName, IDFormatError, IllegalArgumentError, IllegalStateError, Impediments, IncorrectPinCodeError, InvalidClientError, InvalidCurrencyForProductPrice, InvalidGrantError, InvalidMfaCodeError, InvalidMfaTokenError, InvalidNonceError, InvalidPKCEError, InvalidPresenceTokenError, InvalidReceiptDataError, InvalidRequestError, InvalidTokenError, JSONSchemaType, LocalizationKeyMissingError, LockedDocumentError, LoginAttemptStatus, LoginFreezeError, LoginTimeoutError, MedicationFrequency, MedicationUnit, MfaReattemptDelayError, MfaRequiredError, MissingPKCEVerifierError, MissingRequiredFieldsError, NewMFARequiredError, NewPasswordHashUnknownError, NewPasswordPinCodeUnknownError, NoConfiguredAppStoreProduct, NoConfiguredPlayStoreProduct, NoMatchingPlayStoreLinkedSubscription, NoPermissionError, NotActivatedError, NotEnoughMfaMethodsError, NotFoundError, OAuth2ClientIdError, OAuth2ClientSecretError, OAuth2ErrorClassMap, OAuth2LoginError, OAuth2MissingClientCredentialsError, OauthKeyError, OauthSignatureError, OauthTokenError, ObjectMaxBytesOptionType, ObjectMinBytesOptionType, OidcIdTokenError, OidcInvalidAuthorizationCodeError, OidcProviderResponseError, OrderSchemaStatus, PasswordError, PaymentIntentCreationSchemaPaymentMethodType, PaymentIntentCreationSchemaSetupPaymentMethodReuse, PinCodesNotEnabledError, PlayStoreTransactionAlreadyLinked, ProfileActivity, ProfileAlreadyExistsError, QueuedMailStatus, RefreshTokenExpiredError, RefreshTokenUnknownError, RemoveFieldError, RequestAbortedError, ResourceAlreadyExistsError, ResourceUnknownError, Results, ServerError, ServiceUnavailableError, StatusInUseError, StripePaymentMethodError, StripeRequestError, SubscriptionEntitlementSource, SubscriptionEntitlementStatus, SubscriptionEntitlementStatusCategory, SubscriptionEventSource, SubscriptionEventType, SupportedLanguageCodes, TaskStatus, TemplateFillingError, TokenNotDeleteableError, TokenPermission, TooManyFailedAttemptsError, UnauthorizedClientError, UnauthorizedError, UnauthorizedTokenError, UnknownReceiptTransactionError, UnsupportedGrantError, UnsupportedGrantTypeError, UnsupportedResponseTypeError, UserNotAuthenticatedError, createClient, createOAuth1Client, createOAuth2Client, createProxyClient, findAllGeneric, findAllIterator, getMockSdkOAuth2 as getMockSdk, getMockSdkOAuth1, getMockSdkOAuth2, getMockSdkProxy, parseGlobalPermissions, parseStoredCredentials, recursiveMap, rqlBuilder, rqlParser };
5763
+ export { AccessTokenExpiredError, AccessTokenUnknownError, ActionType, ActivationRequestLimitError, ActivationRequestTimeoutError, ActivationUnknownError, AlreadyActivatedError, ApiError, ApiFunctionRequestMethod, ApiRequestErrorType, AppStoreTransactionAlreadyLinked, ApplicationNotAuthenticatedError, ApplicationType, ApplicationUnknownError, AuthenticationError, AuthorizationCodeExpiredError, AuthorizationUnknownError, BadGatewayServerError, BadRequestError, BodyFormatError, CallbackNotValidError, Comorbidities, DefaultLocalizationMissingError, DisabledForOidcUsersError, DuplicateRequestError, EmailUnknownError, EmailUsedError, EmptyBodyError, ErrorClassMap, FieldFormatError, FieldType, FileTooLargeError, FirebaseConnectionError, FirebaseInvalidPlatformDataError, ForbiddenError, ForgotPasswordRequestLimitError, ForgotPasswordRequestTimeoutError, Gender, GlobalPermissionName, IDFormatError, IllegalArgumentError, IllegalStateError, Impediments, IncorrectPinCodeError, InvalidClientError, InvalidCurrencyForProductPrice, InvalidGrantError, InvalidMfaCodeError, InvalidMfaTokenError, InvalidNonceError, InvalidPKCEError, InvalidPresenceTokenError, InvalidReceiptDataError, InvalidRequestError, InvalidTokenError, JSONSchemaType, LocalizationKeyMissingError, LockedDocumentError, LoginAttemptStatus, LoginFreezeError, LoginTimeoutError, MedicationFrequency, MedicationUnit, MfaReattemptDelayError, MfaRequiredError, MissingPKCEVerifierError, MissingRequiredFieldsError, NewMFARequiredError, NewPasswordHashUnknownError, NewPasswordPinCodeUnknownError, NoConfiguredAppStoreProduct, NoConfiguredPlayStoreProduct, NoMatchingPlayStoreLinkedSubscription, NoPermissionError, NotActivatedError, NotEnoughMfaMethodsError, NotFoundError, OAuth2ClientIdError, OAuth2ClientSecretError, OAuth2ErrorClassMap, OAuth2LoginError, OAuth2MissingClientCredentialsError, OauthKeyError, OauthSignatureError, OauthTokenError, OidcIdTokenError, OidcInvalidAuthorizationCodeError, OidcProviderResponseError, OrderSchemaStatus, PasswordError, PaymentIntentCreationSchemaPaymentMethodType, PaymentIntentCreationSchemaSetupPaymentMethodReuse, PinCodesNotEnabledError, PlayStoreTransactionAlreadyLinked, ProfileActivity, ProfileAlreadyExistsError, QueuedMailStatus, RefreshTokenExpiredError, RefreshTokenUnknownError, RemoveFieldError, RequestAbortedError, ResourceAlreadyExistsError, ResourceUnknownError, Results, ServerError, ServiceUnavailableError, StatusInUseError, StripePaymentMethodError, StripeRequestError, SubscriptionEntitlementSource, SubscriptionEntitlementStatus, SubscriptionEntitlementStatusCategory, SubscriptionEventSource, SubscriptionEventType, SupportedLanguageCodes, TaskStatus, TemplateFillingError, TemplateResolvingError, TemplateSyntaxError, TokenNotDeleteableError, TokenPermission, TooManyFailedAttemptsError, UnauthorizedClientError, UnauthorizedError, UnauthorizedTokenError, UnknownReceiptTransactionError, UnsupportedGrantError, UnsupportedGrantTypeError, UnsupportedResponseTypeError, UserNotAuthenticatedError, createClient, createOAuth1Client, createOAuth2Client, createProxyClient, findAllGeneric, findAllIterator, getMockSdkOAuth2 as getMockSdk, getMockSdkOAuth1, getMockSdkOAuth2, getMockSdkProxy, parseGlobalPermissions, parseStoredCredentials, recursiveMap, rqlBuilder, rqlParser };
@@ -1,5 +1,6 @@
1
1
  import { AuthHttpClient, OAuth1HttpClient, OAuth2HttpClient, ProxyInstance } from './http/types';
2
2
  import { authService, configurationsService, dataService, dispatchersService, eventsService, filesService, localizationsService, logsService, mailsService, notificationsService, notificationsV2Service, paymentsService, profilesService, tasksService, templatesService, usersService } from './services';
3
+ import { templatesV2Service } from './services/templatesV2';
3
4
  import { ClientParams, ParamsOauth1, ParamsOauth2, ParamsProxy } from './types';
4
5
  export interface Client<T extends ClientParams> {
5
6
  raw: AuthHttpClient;
@@ -8,6 +9,11 @@ export interface Client<T extends ClientParams> {
8
9
  * @see https://swagger.extrahorizon.com/listing/?service=templates-service&redirectToVersion=1
9
10
  */
10
11
  templates: ReturnType<typeof templatesService>;
12
+ /**
13
+ * The template service manages templates used to build emails. It can be used to retrieve, create, update or delete templates as well as resolving them.
14
+ * @see https://swagger.extrahorizon.com/listing/?service=templates-service&redirectToVersion=2
15
+ */
16
+ templatesV2: ReturnType<typeof templatesV2Service>;
11
17
  /**
12
18
  * Provides mail functionality for other services.
13
19
  * @see https://swagger.extrahorizon.com/listing/?service=mail-service&redirectToVersion=1
@@ -5,6 +5,7 @@ export declare const FILES_BASE = "/files/v1";
5
5
  export declare const TASKS_BASE = "/tasks/v1";
6
6
  export declare const CONFIGURATION_BASE = "/configurations/v2";
7
7
  export declare const TEMPLATE_BASE = "/templates/v1";
8
+ export declare const TEMPLATES_V2_BASE = "/templates/v2";
8
9
  export declare const MAIL_BASE = "/mail/v1";
9
10
  export declare const DISPATCHERS_BASE = "/dispatchers/v1";
10
11
  export declare const PAYMENTS_BASE = "/payments/v1";
@@ -1,3 +1,4 @@
1
+ import { TemplatesV2ErrorInfo } from './services/templatesV2/types';
1
2
  import { MfaMethod, NotificationV2Error } from './types';
2
3
  declare type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH';
3
4
  interface RequestConfig {
@@ -101,6 +102,14 @@ export declare class LocalizationKeyMissingError extends BadRequestError {
101
102
  }
102
103
  export declare class TemplateFillingError extends BadRequestError {
103
104
  }
105
+ export declare class TemplateSyntaxError extends BadRequestError {
106
+ syntaxError: TemplatesV2ErrorInfo;
107
+ constructor(apiError: ApiError);
108
+ }
109
+ export declare class TemplateResolvingError extends BadRequestError {
110
+ resolveError: TemplatesV2ErrorInfo;
111
+ constructor(apiError: ApiError);
112
+ }
104
113
  export declare class MissingRequiredFieldsError extends BadRequestError {
105
114
  }
106
115
  export declare class InvalidCurrencyForProductPrice extends BadRequestError {
@@ -324,6 +333,8 @@ export declare const ErrorClassMap: {
324
333
  801: typeof DefaultLocalizationMissingError;
325
334
  1002: typeof LocalizationKeyMissingError;
326
335
  1003: typeof TemplateFillingError;
336
+ 1004: typeof TemplateSyntaxError;
337
+ 1005: typeof TemplateResolvingError;
327
338
  2605: typeof InvalidTokenError;
328
339
  2606: typeof UnauthorizedTokenError;
329
340
  2607: typeof TokenNotDeleteableError;