@extrahorizon/javascript-sdk 8.6.0 → 8.7.0-dev-97-1cdbd8b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [8.7.0]
9
+
10
+
8
11
  ## [8.6.0]
9
12
 
10
13
  ### Added
@@ -1636,6 +1636,7 @@ const DISPATCHERS_BASE = '/dispatchers/v1';
1636
1636
  const PAYMENTS_BASE = '/payments/v1';
1637
1637
  const PROFILES_BASE = '/profiles/v1';
1638
1638
  const NOTIFICATIONS_BASE = '/notifications/v1';
1639
+ const NOTIFICATIONS_V2_BASE = '/notifications/v2';
1639
1640
  const LOCALIZATIONS_BASE = '/localizations/v1';
1640
1641
  const EVENTS_BASE = '/events/v1';
1641
1642
  const LOGS_BASE = '/logs/v1';
@@ -4229,7 +4230,7 @@ var groupRoles = (client, httpWithAuth) => ({
4229
4230
  },
4230
4231
  });
4231
4232
 
4232
- var health$5 = (userClient, http) => ({
4233
+ var health$6 = (userClient, http) => ({
4233
4234
  /**
4234
4235
  * Perform a health check
4235
4236
  * @returns {boolean} success
@@ -4426,7 +4427,7 @@ const usersService = (httpWithAuth, http) => {
4426
4427
  basePath: USER_BASE,
4427
4428
  transformRequestData: decamelizeRequestData,
4428
4429
  });
4429
- const healthMethods = health$5(userClient, httpWithAuth);
4430
+ const healthMethods = health$6(userClient, httpWithAuth);
4430
4431
  const usersMethods = users$1(userClient, httpWithAuth, http);
4431
4432
  const groupRolesMethods = groupRoles(userClient, httpWithAuth);
4432
4433
  const globalRolesMethods = globalRoles(userClient, httpWithAuth);
@@ -4807,7 +4808,7 @@ var appStoreSubscriptions = (client, httpAuth) => ({
4807
4808
  },
4808
4809
  });
4809
4810
 
4810
- var health$4 = (client, httpAuth) => ({
4811
+ var health$5 = (client, httpAuth) => ({
4811
4812
  /**
4812
4813
  * Check if the service is available
4813
4814
  * @returns true if service is up and running
@@ -5013,7 +5014,7 @@ const paymentsService = (httpWithAuth) => {
5013
5014
  basePath: PAYMENTS_BASE,
5014
5015
  });
5015
5016
  return {
5016
- ...health$4(client, httpWithAuth),
5017
+ ...health$5(client, httpWithAuth),
5017
5018
  products: products(client, httpWithAuth),
5018
5019
  orders: orders(client, httpWithAuth),
5019
5020
  subscriptions: subscriptions$1(client, httpWithAuth),
@@ -5035,7 +5036,7 @@ var countries = (client, httpAuth) => ({
5035
5036
  },
5036
5037
  });
5037
5038
 
5038
- var health$3 = (client, http) => ({
5039
+ var health$4 = (client, http) => ({
5039
5040
  /**
5040
5041
  * Perform a health check
5041
5042
  * @returns {boolean} success
@@ -5088,7 +5089,7 @@ const localizationsService = (httpWithAuth) => {
5088
5089
  basePath: LOCALIZATIONS_BASE,
5089
5090
  });
5090
5091
  return {
5091
- ...health$3(client, httpWithAuth),
5092
+ ...health$4(client, httpWithAuth),
5092
5093
  ...localizations(client, httpWithAuth),
5093
5094
  ...countries(client, httpWithAuth),
5094
5095
  ...languages(client, httpWithAuth),
@@ -5113,7 +5114,7 @@ var groups = (client, httpAuth) => ({
5113
5114
  },
5114
5115
  });
5115
5116
 
5116
- var health$2 = (client, httpAuth) => ({
5117
+ var health$3 = (client, httpAuth) => ({
5117
5118
  /**
5118
5119
  * Perform a health check for profiles service
5119
5120
  * @returns {boolean} success
@@ -5203,14 +5204,14 @@ const profilesService = (httpWithAuth) => {
5203
5204
  basePath: PROFILES_BASE,
5204
5205
  });
5205
5206
  return {
5206
- ...health$2(client, httpWithAuth),
5207
+ ...health$3(client, httpWithAuth),
5207
5208
  ...profiles(client, httpWithAuth),
5208
5209
  groups: groups(client, httpWithAuth),
5209
5210
  logs: logs(client, httpWithAuth),
5210
5211
  };
5211
5212
  };
5212
5213
 
5213
- var health$1 = (client, http) => ({
5214
+ var health$2 = (client, http) => ({
5214
5215
  /**
5215
5216
  * Perform a health check
5216
5217
  * @returns {boolean} success
@@ -5297,12 +5298,103 @@ const notificationsService = (httpWithAuth) => {
5297
5298
  transformRequestData: decamelizeRequestData,
5298
5299
  });
5299
5300
  return {
5300
- ...health$1(client, httpWithAuth),
5301
+ ...health$2(client, httpWithAuth),
5301
5302
  ...notifications(client, httpWithAuth),
5302
5303
  settings: settings(client, httpWithAuth),
5303
5304
  };
5304
5305
  };
5305
5306
 
5307
+ var health$1 = (client, http) => ({
5308
+ /**
5309
+ * Perform a health check
5310
+ * @returns {boolean} success
5311
+ */
5312
+ async health() {
5313
+ const result = await client.get(http, '/health');
5314
+ return result.status === exports.Results.Success;
5315
+ },
5316
+ });
5317
+
5318
+ var notificationsV2 = (client, httpWithAuth) => {
5319
+ async function find(options) {
5320
+ const result = await client.get(httpWithAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
5321
+ ...options,
5322
+ customResponseKeys: ['data.data'],
5323
+ });
5324
+ return result.data;
5325
+ }
5326
+ return {
5327
+ async create(requestBody, options) {
5328
+ const result = await client.post(httpWithAuth, '/', requestBody, {
5329
+ ...options,
5330
+ customKeys: ['data'],
5331
+ });
5332
+ return result.data;
5333
+ },
5334
+ async find(options) {
5335
+ const result = await find(options);
5336
+ return addPagersFn(find, options, result);
5337
+ },
5338
+ async findAll(options) {
5339
+ return findAllGeneric(find, options);
5340
+ },
5341
+ async findByTargetUserId(targetUserId, options) {
5342
+ const rqlWithTargetUserId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('targetUserId', targetUserId).build();
5343
+ const result = await find({ ...options, rql: rqlWithTargetUserId });
5344
+ return addPagersFn(find, { ...options, rql: rqlWithTargetUserId }, result);
5345
+ },
5346
+ async findFirst(options) {
5347
+ const result = await find(options);
5348
+ return result.data[0];
5349
+ },
5350
+ async findById(notificationId, options) {
5351
+ const rqlWithNotificationId = rqlBuilder().eq('id', notificationId).build();
5352
+ const result = await find({ ...options, rql: rqlWithNotificationId });
5353
+ return result.data[0];
5354
+ },
5355
+ };
5356
+ };
5357
+
5358
+ var notificationV2Users = (client, httpWithAuth) => {
5359
+ async function find(options) {
5360
+ const result = await client.get(httpWithAuth, `/users/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, options);
5361
+ return result.data;
5362
+ }
5363
+ return {
5364
+ async update(userId, requestBody, options) {
5365
+ const result = await client.put(httpWithAuth, `/users/${userId}`, requestBody, options);
5366
+ return result.data;
5367
+ },
5368
+ async find(options) {
5369
+ const result = await find(options);
5370
+ return addPagersFn(find, options, result);
5371
+ },
5372
+ async findAll(options) {
5373
+ return findAllGeneric(find, options);
5374
+ },
5375
+ async findByUserId(userId, options) {
5376
+ const rqlWithUserId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', userId).build();
5377
+ const result = await find({ ...options, rql: rqlWithUserId });
5378
+ return result.data[0];
5379
+ },
5380
+ async findFirst(options) {
5381
+ const result = await find(options);
5382
+ return result.data[0];
5383
+ },
5384
+ };
5385
+ };
5386
+
5387
+ const notificationsV2Service = (httpWithAuth) => {
5388
+ const client = httpClient({
5389
+ basePath: NOTIFICATIONS_V2_BASE,
5390
+ });
5391
+ return {
5392
+ ...health$1(client, httpWithAuth),
5393
+ ...notificationsV2(client, httpWithAuth),
5394
+ users: notificationV2Users(client, httpWithAuth),
5395
+ };
5396
+ };
5397
+
5306
5398
  var events = (client, httpAuth) => ({
5307
5399
  async find(options) {
5308
5400
  return (await client.get(httpAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`)).data;
@@ -5395,7 +5487,7 @@ const logsService = (httpWithAuth) => {
5395
5487
  };
5396
5488
  };
5397
5489
 
5398
- const version = '8.6.0';
5490
+ const version = '8.7.0-dev-97-1cdbd8b';
5399
5491
 
5400
5492
  /**
5401
5493
  * Create ExtraHorizon client.
@@ -5435,6 +5527,7 @@ function createClient(rawConfig) {
5435
5527
  localizations: localizationsService(httpWithAuth),
5436
5528
  profiles: profilesService(httpWithAuth),
5437
5529
  notifications: notificationsService(httpWithAuth),
5530
+ notificationsV2: notificationsV2Service(httpWithAuth),
5438
5531
  events: eventsService(httpWithAuth),
5439
5532
  logs: logsService(httpWithAuth),
5440
5533
  auth: {
package/build/index.mjs CHANGED
@@ -1606,6 +1606,7 @@ const DISPATCHERS_BASE = '/dispatchers/v1';
1606
1606
  const PAYMENTS_BASE = '/payments/v1';
1607
1607
  const PROFILES_BASE = '/profiles/v1';
1608
1608
  const NOTIFICATIONS_BASE = '/notifications/v1';
1609
+ const NOTIFICATIONS_V2_BASE = '/notifications/v2';
1609
1610
  const LOCALIZATIONS_BASE = '/localizations/v1';
1610
1611
  const EVENTS_BASE = '/events/v1';
1611
1612
  const LOGS_BASE = '/logs/v1';
@@ -4199,7 +4200,7 @@ var groupRoles = (client, httpWithAuth) => ({
4199
4200
  },
4200
4201
  });
4201
4202
 
4202
- var health$5 = (userClient, http) => ({
4203
+ var health$6 = (userClient, http) => ({
4203
4204
  /**
4204
4205
  * Perform a health check
4205
4206
  * @returns {boolean} success
@@ -4396,7 +4397,7 @@ const usersService = (httpWithAuth, http) => {
4396
4397
  basePath: USER_BASE,
4397
4398
  transformRequestData: decamelizeRequestData,
4398
4399
  });
4399
- const healthMethods = health$5(userClient, httpWithAuth);
4400
+ const healthMethods = health$6(userClient, httpWithAuth);
4400
4401
  const usersMethods = users$1(userClient, httpWithAuth, http);
4401
4402
  const groupRolesMethods = groupRoles(userClient, httpWithAuth);
4402
4403
  const globalRolesMethods = globalRoles(userClient, httpWithAuth);
@@ -4777,7 +4778,7 @@ var appStoreSubscriptions = (client, httpAuth) => ({
4777
4778
  },
4778
4779
  });
4779
4780
 
4780
- var health$4 = (client, httpAuth) => ({
4781
+ var health$5 = (client, httpAuth) => ({
4781
4782
  /**
4782
4783
  * Check if the service is available
4783
4784
  * @returns true if service is up and running
@@ -4983,7 +4984,7 @@ const paymentsService = (httpWithAuth) => {
4983
4984
  basePath: PAYMENTS_BASE,
4984
4985
  });
4985
4986
  return {
4986
- ...health$4(client, httpWithAuth),
4987
+ ...health$5(client, httpWithAuth),
4987
4988
  products: products(client, httpWithAuth),
4988
4989
  orders: orders(client, httpWithAuth),
4989
4990
  subscriptions: subscriptions$1(client, httpWithAuth),
@@ -5005,7 +5006,7 @@ var countries = (client, httpAuth) => ({
5005
5006
  },
5006
5007
  });
5007
5008
 
5008
- var health$3 = (client, http) => ({
5009
+ var health$4 = (client, http) => ({
5009
5010
  /**
5010
5011
  * Perform a health check
5011
5012
  * @returns {boolean} success
@@ -5058,7 +5059,7 @@ const localizationsService = (httpWithAuth) => {
5058
5059
  basePath: LOCALIZATIONS_BASE,
5059
5060
  });
5060
5061
  return {
5061
- ...health$3(client, httpWithAuth),
5062
+ ...health$4(client, httpWithAuth),
5062
5063
  ...localizations(client, httpWithAuth),
5063
5064
  ...countries(client, httpWithAuth),
5064
5065
  ...languages(client, httpWithAuth),
@@ -5083,7 +5084,7 @@ var groups = (client, httpAuth) => ({
5083
5084
  },
5084
5085
  });
5085
5086
 
5086
- var health$2 = (client, httpAuth) => ({
5087
+ var health$3 = (client, httpAuth) => ({
5087
5088
  /**
5088
5089
  * Perform a health check for profiles service
5089
5090
  * @returns {boolean} success
@@ -5173,14 +5174,14 @@ const profilesService = (httpWithAuth) => {
5173
5174
  basePath: PROFILES_BASE,
5174
5175
  });
5175
5176
  return {
5176
- ...health$2(client, httpWithAuth),
5177
+ ...health$3(client, httpWithAuth),
5177
5178
  ...profiles(client, httpWithAuth),
5178
5179
  groups: groups(client, httpWithAuth),
5179
5180
  logs: logs(client, httpWithAuth),
5180
5181
  };
5181
5182
  };
5182
5183
 
5183
- var health$1 = (client, http) => ({
5184
+ var health$2 = (client, http) => ({
5184
5185
  /**
5185
5186
  * Perform a health check
5186
5187
  * @returns {boolean} success
@@ -5267,12 +5268,103 @@ const notificationsService = (httpWithAuth) => {
5267
5268
  transformRequestData: decamelizeRequestData,
5268
5269
  });
5269
5270
  return {
5270
- ...health$1(client, httpWithAuth),
5271
+ ...health$2(client, httpWithAuth),
5271
5272
  ...notifications(client, httpWithAuth),
5272
5273
  settings: settings(client, httpWithAuth),
5273
5274
  };
5274
5275
  };
5275
5276
 
5277
+ var health$1 = (client, http) => ({
5278
+ /**
5279
+ * Perform a health check
5280
+ * @returns {boolean} success
5281
+ */
5282
+ async health() {
5283
+ const result = await client.get(http, '/health');
5284
+ return result.status === Results.Success;
5285
+ },
5286
+ });
5287
+
5288
+ var notificationsV2 = (client, httpWithAuth) => {
5289
+ async function find(options) {
5290
+ const result = await client.get(httpWithAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
5291
+ ...options,
5292
+ customResponseKeys: ['data.data'],
5293
+ });
5294
+ return result.data;
5295
+ }
5296
+ return {
5297
+ async create(requestBody, options) {
5298
+ const result = await client.post(httpWithAuth, '/', requestBody, {
5299
+ ...options,
5300
+ customKeys: ['data'],
5301
+ });
5302
+ return result.data;
5303
+ },
5304
+ async find(options) {
5305
+ const result = await find(options);
5306
+ return addPagersFn(find, options, result);
5307
+ },
5308
+ async findAll(options) {
5309
+ return findAllGeneric(find, options);
5310
+ },
5311
+ async findByTargetUserId(targetUserId, options) {
5312
+ const rqlWithTargetUserId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('targetUserId', targetUserId).build();
5313
+ const result = await find({ ...options, rql: rqlWithTargetUserId });
5314
+ return addPagersFn(find, { ...options, rql: rqlWithTargetUserId }, result);
5315
+ },
5316
+ async findFirst(options) {
5317
+ const result = await find(options);
5318
+ return result.data[0];
5319
+ },
5320
+ async findById(notificationId, options) {
5321
+ const rqlWithNotificationId = rqlBuilder().eq('id', notificationId).build();
5322
+ const result = await find({ ...options, rql: rqlWithNotificationId });
5323
+ return result.data[0];
5324
+ },
5325
+ };
5326
+ };
5327
+
5328
+ var notificationV2Users = (client, httpWithAuth) => {
5329
+ async function find(options) {
5330
+ const result = await client.get(httpWithAuth, `/users/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, options);
5331
+ return result.data;
5332
+ }
5333
+ return {
5334
+ async update(userId, requestBody, options) {
5335
+ const result = await client.put(httpWithAuth, `/users/${userId}`, requestBody, options);
5336
+ return result.data;
5337
+ },
5338
+ async find(options) {
5339
+ const result = await find(options);
5340
+ return addPagersFn(find, options, result);
5341
+ },
5342
+ async findAll(options) {
5343
+ return findAllGeneric(find, options);
5344
+ },
5345
+ async findByUserId(userId, options) {
5346
+ const rqlWithUserId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', userId).build();
5347
+ const result = await find({ ...options, rql: rqlWithUserId });
5348
+ return result.data[0];
5349
+ },
5350
+ async findFirst(options) {
5351
+ const result = await find(options);
5352
+ return result.data[0];
5353
+ },
5354
+ };
5355
+ };
5356
+
5357
+ const notificationsV2Service = (httpWithAuth) => {
5358
+ const client = httpClient({
5359
+ basePath: NOTIFICATIONS_V2_BASE,
5360
+ });
5361
+ return {
5362
+ ...health$1(client, httpWithAuth),
5363
+ ...notificationsV2(client, httpWithAuth),
5364
+ users: notificationV2Users(client, httpWithAuth),
5365
+ };
5366
+ };
5367
+
5276
5368
  var events = (client, httpAuth) => ({
5277
5369
  async find(options) {
5278
5370
  return (await client.get(httpAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`)).data;
@@ -5365,7 +5457,7 @@ const logsService = (httpWithAuth) => {
5365
5457
  };
5366
5458
  };
5367
5459
 
5368
- const version = '8.6.0';
5460
+ const version = '8.7.0-dev-97-1cdbd8b';
5369
5461
 
5370
5462
  /**
5371
5463
  * Create ExtraHorizon client.
@@ -5405,6 +5497,7 @@ function createClient(rawConfig) {
5405
5497
  localizations: localizationsService(httpWithAuth),
5406
5498
  profiles: profilesService(httpWithAuth),
5407
5499
  notifications: notificationsService(httpWithAuth),
5500
+ notificationsV2: notificationsV2Service(httpWithAuth),
5408
5501
  events: eventsService(httpWithAuth),
5409
5502
  logs: logsService(httpWithAuth),
5410
5503
  auth: {
@@ -1,5 +1,5 @@
1
1
  import { AuthHttpClient, OAuth1HttpClient, OAuth2HttpClient, ProxyInstance } from './http/types';
2
- import { authService, configurationsService, dataService, dispatchersService, eventsService, filesService, localizationsService, logsService, mailsService, notificationsService, paymentsService, profilesService, tasksService, templatesService, usersService } from './services';
2
+ import { authService, configurationsService, dataService, dispatchersService, eventsService, filesService, localizationsService, logsService, mailsService, notificationsService, notificationsV2Service, paymentsService, profilesService, tasksService, templatesService, usersService } from './services';
3
3
  import { ClientParams, ParamsOauth1, ParamsOauth2, ParamsProxy } from './types';
4
4
  export interface Client<T extends ClientParams> {
5
5
  raw: AuthHttpClient;
@@ -58,6 +58,11 @@ export interface Client<T extends ClientParams> {
58
58
  * @see https://swagger.extrahorizon.com/listing/?service=notifications-service&redirectToVersion=1
59
59
  */
60
60
  notifications: ReturnType<typeof notificationsService>;
61
+ /**
62
+ * A service that handles push notifications.
63
+ * @see https://swagger.extrahorizon.com/listing/?service=notifications-service&redirectToVersion=2
64
+ */
65
+ notificationsV2: ReturnType<typeof notificationsV2Service>;
61
66
  /**
62
67
  * Service that provides event (publish/subscribe) functionality for other services.
63
68
  * @see https://swagger.extrahorizon.com/listing/?service=events-service&redirectToVersion=1
@@ -10,6 +10,7 @@ export declare const DISPATCHERS_BASE = "/dispatchers/v1";
10
10
  export declare const PAYMENTS_BASE = "/payments/v1";
11
11
  export declare const PROFILES_BASE = "/profiles/v1";
12
12
  export declare const NOTIFICATIONS_BASE = "/notifications/v1";
13
+ export declare const NOTIFICATIONS_V2_BASE = "/notifications/v2";
13
14
  export declare const LOCALIZATIONS_BASE = "/localizations/v1";
14
15
  export declare const EVENTS_BASE = "/events/v1";
15
16
  export declare const LOGS_BASE = "/logs/v1";
@@ -427,6 +427,22 @@ export declare type MockClientOAuth1<MockFn> = {
427
427
  remove: MockFn;
428
428
  };
429
429
  };
430
+ notificationsV2: {
431
+ health: MockFn;
432
+ create: MockFn;
433
+ find: MockFn;
434
+ findAll: MockFn;
435
+ findByTargetUserId: MockFn;
436
+ findFirst: MockFn;
437
+ findById: MockFn;
438
+ users: {
439
+ update: MockFn;
440
+ find: MockFn;
441
+ findAll: MockFn;
442
+ findByUserId: MockFn;
443
+ findFirst: MockFn;
444
+ };
445
+ };
430
446
  events: {
431
447
  health: MockFn;
432
448
  find: MockFn;
@@ -961,6 +977,22 @@ export declare type MockClientOAuth2<MockFn> = {
961
977
  remove: MockFn;
962
978
  };
963
979
  };
980
+ notificationsV2: {
981
+ health: MockFn;
982
+ create: MockFn;
983
+ find: MockFn;
984
+ findAll: MockFn;
985
+ findByTargetUserId: MockFn;
986
+ findFirst: MockFn;
987
+ findById: MockFn;
988
+ users: {
989
+ update: MockFn;
990
+ find: MockFn;
991
+ findAll: MockFn;
992
+ findByUserId: MockFn;
993
+ findFirst: MockFn;
994
+ };
995
+ };
964
996
  events: {
965
997
  health: MockFn;
966
998
  find: MockFn;
@@ -1495,6 +1527,22 @@ export declare type MockClientProxy<MockFn> = {
1495
1527
  remove: MockFn;
1496
1528
  };
1497
1529
  };
1530
+ notificationsV2: {
1531
+ health: MockFn;
1532
+ create: MockFn;
1533
+ find: MockFn;
1534
+ findAll: MockFn;
1535
+ findByTargetUserId: MockFn;
1536
+ findFirst: MockFn;
1537
+ findById: MockFn;
1538
+ users: {
1539
+ update: MockFn;
1540
+ find: MockFn;
1541
+ findAll: MockFn;
1542
+ findByUserId: MockFn;
1543
+ findFirst: MockFn;
1544
+ };
1545
+ };
1498
1546
  events: {
1499
1547
  health: MockFn;
1500
1548
  find: MockFn;
@@ -11,5 +11,6 @@ export * from './payments';
11
11
  export * from './localizations';
12
12
  export * from './profiles';
13
13
  export * from './notifications';
14
+ export * from './notificationsV2';
14
15
  export * from './events';
15
16
  export * from './logs';
@@ -0,0 +1,9 @@
1
+ import type { HttpInstance } from '../../types';
2
+ declare const _default: (client: any, http: HttpInstance) => {
3
+ /**
4
+ * Perform a health check
5
+ * @returns {boolean} success
6
+ */
7
+ health(): Promise<boolean>;
8
+ };
9
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { AuthHttpClient } from '../../types';
2
+ import health from './health';
3
+ import { NotificationV2Service } from './types';
4
+ import { NotificationV2UserService } from './users/types';
5
+ export declare const notificationsV2Service: (httpWithAuth: AuthHttpClient) => ReturnType<typeof health> & NotificationV2Service & {
6
+ users: NotificationV2UserService;
7
+ };
@@ -0,0 +1,5 @@
1
+ import { AuthHttpClient } from '../../types';
2
+ import { HttpClient } from '../http-client';
3
+ import { NotificationV2Service } from './types';
4
+ declare const _default: (client: HttpClient, httpWithAuth: AuthHttpClient) => NotificationV2Service;
5
+ export default _default;
@@ -0,0 +1,109 @@
1
+ import { ObjectId, OptionsBase, OptionsWithRql, PagedResultWithPager } from '../types';
2
+ export * from './users/types';
3
+ export interface NotificationV2Creation<T extends Record<string, string> = Record<string, string>> {
4
+ targetUserId: string;
5
+ title: string;
6
+ body: string;
7
+ data?: T;
8
+ /**
9
+ * See https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#AndroidConfig
10
+ */
11
+ android?: any;
12
+ /**
13
+ * See https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#ApnsConfig
14
+ */
15
+ apns?: any;
16
+ /**
17
+ * See https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#WebpushConfig
18
+ */
19
+ webpush?: any;
20
+ }
21
+ export interface NotificationV2<T extends Record<string, string> = Record<string, string>> extends NotificationV2Creation<T> {
22
+ id: ObjectId;
23
+ creatorId: ObjectId;
24
+ sent: boolean;
25
+ creationTimestamp: Date;
26
+ updateTimestamp: Date;
27
+ }
28
+ export interface NotificationV2Service {
29
+ /**
30
+ * # Create a notification
31
+ *
32
+ * ## Access via permissions
33
+ * Permission | Scopes | Effect
34
+ * - | - | -
35
+ * `CREATE_NOTIFICATIONS` | `global` | Create notifications for any user
36
+ * `CREATE_NOTIFICATIONS` | `group` | Create notifications for any patient in group
37
+ * none | | Create notifications for yourself
38
+ *
39
+ * # Interface
40
+ * @param requestBody
41
+ * @param options
42
+ * @returns NotificationV2<T>
43
+ */
44
+ create<T extends Record<string, string>>(requestBody: NotificationV2Creation<T>, options?: OptionsBase): Promise<NotificationV2<T>>;
45
+ /**
46
+ * # Request a list of notifications
47
+ *
48
+ * ## Access via permissions
49
+ * Permission | Scopes | Effect
50
+ * - | - | -
51
+ * `VIEW_NOTIFICATIONS` | `global` | View all notifications
52
+ *
53
+ * # Interface
54
+ * @returns PagedResultWithPager<NotificationV2<T>>
55
+ */
56
+ find<T extends Record<string, string>>(options?: OptionsWithRql): Promise<PagedResultWithPager<NotificationV2<T>>>;
57
+ /**
58
+ * # Request a list of notifications
59
+ *
60
+ * Do not pass in an rql with limit operator!
61
+ *
62
+ * ## Access via permissions
63
+ * Permission | Scopes | Effect
64
+ * - | - | -
65
+ * `VIEW_NOTIFICATIONS` | `global` | View all notifications
66
+ *
67
+ * # Interface
68
+ * @returns NotificationV2<T>[]
69
+ */
70
+ findAll<T extends Record<string, string>>(options?: OptionsWithRql): Promise<NotificationV2<T>[]>;
71
+ /**
72
+ * # Request a list of notifications created for a user
73
+ *
74
+ * ## Access via permissions
75
+ * Permission | Scopes | Effect
76
+ * - | - | -
77
+ * `VIEW_NOTIFICATIONS` | `global` | View all notifications
78
+ *
79
+ * # Interface
80
+ * @param targetUserId the user id to search for
81
+ * @returns PagedResultWithPager<NotificationV2<T>>
82
+ */
83
+ findByTargetUserId<T extends Record<string, string>>(targetUserId: ObjectId, options?: OptionsWithRql): Promise<PagedResultWithPager<NotificationV2<T>>>;
84
+ /**
85
+ * # Request the first notification found
86
+ *
87
+ * ## Access via permissions
88
+ * Permission | Scopes | Effect
89
+ * - | - | -
90
+ * `VIEW_NOTIFICATIONS` | `global` | View all notifications
91
+ *
92
+ * # Interface
93
+ * @returns NotificationV2<T> | undefined
94
+ */
95
+ findFirst<T extends Record<string, string>>(options?: OptionsWithRql): Promise<NotificationV2<T> | undefined>;
96
+ /**
97
+ * # Request a notification by id
98
+ *
99
+ * ## Access via permissions
100
+ * Permission | Scopes | Effect
101
+ * - | - | -
102
+ * `VIEW_NOTIFICATIONS` | `global` | View all notifications
103
+ *
104
+ * # Interface
105
+ * @param notificationId the Id to search for
106
+ * @returns NotificationV2<T> | undefined
107
+ */
108
+ findById<T extends Record<string, string>>(notificationId: ObjectId, options?: OptionsBase): Promise<NotificationV2<T> | undefined>;
109
+ }
@@ -0,0 +1,5 @@
1
+ import { AuthHttpClient } from '../../../types';
2
+ import { HttpClient } from '../../http-client';
3
+ import { NotificationV2UserService } from './types';
4
+ declare const _default: (client: HttpClient, httpWithAuth: AuthHttpClient) => NotificationV2UserService;
5
+ export default _default;
@@ -0,0 +1,79 @@
1
+ import { AffectedRecords, ObjectId, OptionsBase, OptionsWithRql, PagedResultWithPager } from '../../types';
2
+ export interface NotificationV2UserUpsert {
3
+ fcmToken: string;
4
+ }
5
+ export interface NotificationV2User extends NotificationV2UserUpsert {
6
+ id: ObjectId;
7
+ creationTimestamp: Date;
8
+ updateTimestamp: Date;
9
+ }
10
+ export interface NotificationV2UserService {
11
+ /**
12
+ * # Update a user its notification settings
13
+ *
14
+ * Updates (or creates if non exists) a user its settings for the specified user id.
15
+ *
16
+ * ## Access via permissions
17
+ * Permission | Scopes | Effect
18
+ * - | - | -
19
+ * `UPDATE_NOTIFICATION_SETTINGS` | `global` | Update the notification settings of any user
20
+ * none | | Update your own notification settings
21
+ *
22
+ * # Interface
23
+ * @param requestBody
24
+ * @param options
25
+ * @returns AffectedRecords
26
+ */
27
+ update(userId: ObjectId, requestBody: NotificationV2UserUpsert, options?: OptionsBase): Promise<AffectedRecords>;
28
+ /**
29
+ * # Request a list of user notification settings
30
+ *
31
+ * ## Access via permissions
32
+ * Permission | Scopes | Effect
33
+ * - | - | -
34
+ * `VIEW_NOTIFICATION_SETTINGS` | `global` | View all notifications
35
+ *
36
+ * # Interface
37
+ * @returns PagedResultWithPager<NotificationV2User>
38
+ */
39
+ find(options?: OptionsWithRql): Promise<PagedResultWithPager<NotificationV2User>>;
40
+ /**
41
+ * # Request a list of user notification settings
42
+ *
43
+ * Do not pass in an rql with limit operator!
44
+ *
45
+ * ## Access via permissions
46
+ * Permission | Scopes | Effect
47
+ * - | - | -
48
+ * `VIEW_NOTIFICATION_SETTINGS` | `global` | View all notifications
49
+ *
50
+ * # Interface
51
+ * @returns NotificationV2User[]
52
+ */
53
+ findAll(options?: OptionsWithRql): Promise<NotificationV2User[]>;
54
+ /**
55
+ * # Request notification settings for a specific user
56
+ *
57
+ * ## Access via permissions
58
+ * Permission | Scopes | Effect
59
+ * - | - | -
60
+ * `VIEW_NOTIFICATION_SETTINGS` | `global` | View all notifications
61
+ *
62
+ * # Interface
63
+ * @param userId the user id to search for
64
+ * @returns NotificationV2User | undefined
65
+ */
66
+ findByUserId(userId: ObjectId, options?: OptionsWithRql): Promise<NotificationV2User | undefined>;
67
+ /**
68
+ * # Request the first user notification settings
69
+ *
70
+ * ## Access via permissions
71
+ * Permission | Scopes | Effect
72
+ * - | - | -
73
+ * `VIEW_NOTIFICATION_SETTINGS` | `global` | View all notifications
74
+ *
75
+ * # Interface
76
+ * @returns NotificationV2User | undefined
77
+ */
78
+ findFirst(options?: OptionsWithRql): Promise<NotificationV2User | undefined>;
79
+ }
@@ -15,6 +15,7 @@ export * from './services/payments/types';
15
15
  export * from './services/localizations/types';
16
16
  export * from './services/profiles/types';
17
17
  export * from './services/notifications/types';
18
+ export * from './services/notificationsV2/types';
18
19
  export * from './services/events/types';
19
20
  export interface ParamsOauth1WithEmail {
20
21
  email: string;
@@ -1 +1 @@
1
- export declare const version = "8.6.0";
1
+ export declare const version = "8.7.0-dev-97-1cdbd8b";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extrahorizon/javascript-sdk",
3
- "version": "8.6.0",
3
+ "version": "8.7.0-dev-97-1cdbd8b",
4
4
  "description": "This package serves as a JavaScript wrapper around all Extra Horizon cloud services.",
5
5
  "main": "build/index.cjs.js",
6
6
  "types": "build/types/index.d.ts",
@@ -58,4 +58,4 @@
58
58
  "ts-jest": "^29.1.2",
59
59
  "typescript": "^4.5.5"
60
60
  }
61
- }
61
+ }